Declarative vs Procedural Programming  Procedural programming requires that – the programmer tell the computer what to do. That is, how to get the output.

Slides:



Advertisements
Similar presentations
Artificial Intelligence
Advertisements

1 Knowledge Representation Introduction KR and Logic.
Chapter 11 :: Logic Languages
Logic Use mathematical deduction to derive new knowledge.
Chapter Two Symbolizing in Sentential Logic This chapter is a preliminary to the project of building a model of validity for sentential arguments. We.
Answer Set Programming Overview Dr. Rogelio Dávila Pérez Profesor-Investigador División de Posgrado Universidad Autónoma de Guadalajara
Propositional Logic CMSC 471 Chapter , 7.7 and Chuck Dyer
Logic.
Knowledge Representation
CLASSICAL LOGIC and FUZZY LOGIC. CLASSICAL LOGIC In classical logic, a simple proposition P is a linguistic, or declarative, statement contained within.
F22H1 Logic and Proof Week 7 Clausal Form and Resolution.
Goals Determine the true value of statements with AND, OR, IF..THEN. Negate statements with the connectives above Construct truth tables Understand when.
Knowledge Representation I Suppose I tell you the following... The Duck-Bill Platypus and the Echidna are the only two mammals that lay eggs. Only birds.
Prolog IV Logic, condensed. 2 Propositional logic Propositional logic consists of: The logical values true and false ( T and F ) Propositions: “Sentences,”
Outline Recap Knowledge Representation I Textbook: Chapters 6, 7, 9 and 10.
Computability and Complexity 8-1 Computability and Complexity Andrei Bulatov Logic Reminder.
Logic in general Logics are formal languages for representing information such that conclusions can be drawn Syntax defines the sentences in the language.
9/28/98 Prof. Richard Fikes First-Order Logic Knowledge Interchange Format (KIF) Computer Science Department Stanford University CS222 Fall 1998.
Logic Programming Languages. Objective To introduce the concepts of logic programming and logic programming languages To introduce a brief description.
Knowledge Representation I (Propositional Logic) CSE 473.
Knoweldge Representation & Reasoning
Let remember from the previous lesson what is Knowledge representation
Predicate Calculus.
FIRST ORDER LOGIC Levent Tolga EREN.
Adapted from Discrete Math
Predicates and Quantifiers
Intro to Discrete Structures
Discrete Mathematics and Its Applications
Notes for Chapter 12 Logic Programming The AI War Basic Concepts of Logic Programming Prolog Review questions.
First Order Logic Chapter 7. PL is a Weak Representational Language §Propositional Logic (PL) is not a very expressive language because: §Hard to identify.
1-1 Introduction Logic programming languages, sometimes called declarative programming languages Express programs in a form of symbolic logic Use a logical.
110/19/2015CS360 AI & Robotics AI Application Areas  Neural Networks and Genetic Algorithms  These model the structure of neurons in the brain  Humans.
Pattern-directed inference systems
Logical Agents Logic Propositional Logic Summary
ARTIFICIAL INTELLIGENCE Lecture 3 Predicate Calculus.
1 CMSC 471 Fall 2002 Class #10/12–Wednesday, October 2 / Wednesday, October 9.
CHAPTER 15 & 16 Functional & Logic Programming Languages.
First-Order Logic Introduction Syntax and Semantics Using First-Order Logic Summary.
Propositional Calculus CS 270: Mathematical Foundations of Computer Science Jeremy Johnson.
Dr. Muhammed Al-Mulhem ICS An Introduction to Logical Programming.
Logic Programming Languages Session 13 Course : T Programming Language Concept Year : February 2011.
Automated Reasoning Early AI explored how to automated several reasoning tasks – these were solved by what we might call weak problem solving methods as.
Logical Agents Chapter 7. Outline Knowledge-based agents Logic in general Propositional (Boolean) logic Equivalence, validity, satisfiability.
Ch. 13 Ch. 131 jcmt CSE 3302 Programming Languages CSE3302 Programming Languages (notes?) Dr. Carter Tiernan.
C. Varela1 Logic Programming (PLP 11) Predicate Calculus, Horn Clauses, Clocksin-Mellish Procedure Carlos Varela Rennselaer Polytechnic Institute November.
© Copyright 2008 STI INNSBRUCK Intelligent Systems Propositional Logic.
Logic Programming Tarik Booker. What will we cover?  Introduction  Definitions  Predicate Calculus  Prolog  Applications.
ISBN Chapter 16 Logic Programming Languages.
Reasoning with Propositional Logic automated processing of a simple knowledge base CD.
1-1 An Introduction to Logical Programming Sept
1 Propositional Logic Limits The expressive power of propositional logic is limited. The assumption is that everything can be expressed by simple facts.
Artificial Intelligence CIS 342 The College of Saint Rose David Goldschmidt, Ph.D.
ARTIFICIAL INTELLIGENCE [INTELLIGENT AGENTS PARADIGM] Professor Janis Grundspenkis Riga Technical University Faculty of Computer Science and Information.
First-Order Logic Semantics Reading: Chapter 8, , FOL Syntax and Semantics read: FOL Knowledge Engineering read: FOL.
Introduction to Prolog Asst. Prof. Dr. Senem Kumova Metin Revised lecture notes of “Concepts of Programmig Languages, Robert W. Sebesta, Ch. 16”
Logical Agents Chapter 7. Outline Knowledge-based agents Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules and theorem.
Artificial Intelligence Knowledge Representation.
Artificial Intelligence Logical Agents Chapter 7.
Knowledge Representation Lecture 2 out of 5. Last Week Intelligence needs knowledge We need to represent this knowledge in a way a computer can process.
Logical Agents. Outline Knowledge-based agents Logic in general - models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability.
Knowledge Representation Techniques
By P. S. Suryateja Asst. Professor, CSE Vishnu Institute of Technology
tautology checking continued
Knowledge Representation
Logic Programming Languages
Logic Use mathematical deduction to derive new knowledge.
Chapter 7. Propositional and Predicate Logic
Propositional Logic CMSC 471 Chapter , 7.7 and Chuck Dyer
Deniz Beser A Fundamental Tradeoff in Knowledge Representation and Reasoning Hector J. Levesque and Ronald J. Brachman.
Carlos Varela Rennselaer Polytechnic Institute August 30, 2007
Presentation transcript:

Declarative vs Procedural Programming  Procedural programming requires that – the programmer tell the computer what to do. That is, how to get the output for the range of required inputs. –The programmer must know an appropriate algorithm.  Declarative programming requires –a more descriptive style. –The programmer must know what relationships hold between various entities.  Pure Prolog allows a program to be read either declaratively or procedurally.  This dual semantics is attractive.

What Kind of Logic?  Prolog is based on First Order Predicate Logic-- sometimes abbreviated to FOPL.  Prolog, like LISP, has a pure subset of features. The implication is that some features of both languages are regarded as impure  These are often provided for efficiency or for usefulness, but strictly unnecessary features.  The impure features of Prolog damage the pleasing equality between the declarative and procedural readings of Prolog programs.

First order predicate logic  First order predicate logic implies the existence of a set of predicate symbols along with a set of connectives.  First order predicate logic implies that there is no means provided for talking about" the predicates themselves.  Prolog is based on FOPL but uses a restricted version of the clausal form.  Clausal form is a particular way of writing the propositions of FOPL. The restriction is known as Horn clause form.  Prolog is a so-called logic programming language. Strictly, it is not the only one but most such languages are its descendents.

PROLOG  Prolog is known to be a difficult language to master.  It does not have the familiar control primitives used by languages like RATFOR, ALGOL and PASCAL so the system does not give too much help to the programmer to employ structured programming concepts.

PROLOG  Also, many programmers have become used to strongly typed languages.  Prolog is very weakly typed indeed.  This gives the programmer great power to experiment but carries the obvious responsibility to be careful.  Another major difference is the treatment of variables special attention should be given to understanding variables in Prolog.

Prolog  Prolog provides a search strategy for free but there is a cost. The programmer has to develop a methodology to handle the unexpected consequences of a faulty program.  In particular, pay careful attention to the issue of backtracking.  It is usual to assume that telling people how they can go wrong is an encouragement to do exactly that  go wrong. The approach taken here is to make the known difficulties explicit.

Knowledge Representation  Propositional calculus and first order predicate logic.  We introduce a simple vocabulary that describes the syntax of Prolog.  Fundamental units which are –clause, rule, fact, goal, subgoal, logical variable, constant, atom, functor, argument, arity.

How do we represent what we know?  The simplest analysis requires that we distinguish between –Knowledge how procedural knowledge such as how to drive a car –Knowledge that :declarative knowledge such as knowing the speed limit for a car on a motorway.  Many schemes for representing knowledge have been advanced including full first order predicate logic.  The strong argument for classical (first order predicate) logic is that it has a well understood theoretical foundation.

Propositional Calculus  The propositional calculus is based on statements which have truth values (true or false).  The calculus provides a means of determining the truth values associated with statements formed from atomic statements.  An example:  p  fred is rich  q  fred is tall

Propositional Calculus  Then we may form statements such as:  p V q p or q  p ^ q p and q  p  q p logically implies q  p = q p is logically equivalent to q  ¬p not p

Propositional Calculus  These are all binary connectives.  They are sometimes referred to, respectively, as the symbols for disjunction, conjunction, implication and equivalence.  ¬ is unary and is the symbol for negation.  Propositional logic is a means for assesing truth value of compound statements from the truth values of the `building blocks'  Then we need some rules for how to do this.

Propositional Calculus  p= all dogs are smelly  p is true  Then we would like to be  able to prove that my dog do is smelly.  We need to be able to get at the structure and meaning of statements.  This is where (first order) predicate logic is useful.

First Order Predicate Calculus  The predicate calculus includes a wider range of entities.  It permits the description of relations and the use of variables.  It also requires an understanding of quantication.  The language of predicate calculus requires: –Variables –Constants |these include the logical constants

First Order Predicate Calculus  For all and There exists: logical constants are additions to the logical connectives of propositional calculus they are known as quantifiers.  The non-logical constants include both the names of entities that are related and the names of the relations. –For example, the constant dog might be a relation and the constant do an entity.

First Order Predicate Calculus  Predicate: relate a number of entities.  This number is usually greater than one.  A predicate with one argument is often used to express a property –e.g. sun(hot) may represent the statement that the sun has the property of being hot".  If there are no arguments then we can regard the `predicate' as standing for a statement