22
PREDICATE CALCULS In Propositional Calculus, each atomic symbol denotes a proposition. But there is no way to access the components of an individual assertion. For example:- it is raining =P it is sunny =Q A proposition: If it is raining, then it is not sunny P ¬Q

PREDICATE CALCULS In Propositional Calculus, each atomic symbol denotes a proposition. But there is no way to access the components of an individual assertion

Embed Size (px)

DESCRIPTION

SYNTAX OF PREDICATES

Citation preview

Page 1: PREDICATE CALCULS In Propositional Calculus, each atomic symbol denotes a proposition. But there is no way to access the components of an individual assertion

PREDICATE CALCULSIn Propositional Calculus, each atomic symbol denotes a proposition. But there is no way to access the components of an individual assertion.For example:-

it is raining =Pit is sunny =Q

A proposition:If it is raining, then it is not sunny

P ¬Q

Page 2: PREDICATE CALCULS In Propositional Calculus, each atomic symbol denotes a proposition. But there is no way to access the components of an individual assertion

In Propositional Calculus, a single propsitional symbol P may denote the entire sentence “it rained on Tuesday”

it rained on Tuesday =P

In Predicate Calculus, a predicate weather may be created, that describes a relationship between a day and the weather:

weather(tuesday,rain)

Predicate Calculus also allows expressions to contain variables.

For example:

For all values of X, where X is a day of the week, the statement weather(X,rain) is true:

i.e. it rains every day.

Page 3: PREDICATE CALCULS In Propositional Calculus, each atomic symbol denotes a proposition. But there is no way to access the components of an individual assertion

SYNTAX OF PREDICATES

Page 4: PREDICATE CALCULS In Propositional Calculus, each atomic symbol denotes a proposition. But there is no way to access the components of an individual assertion

Symbols are used to denote objects, properties or relations in the world of discourse.

The use of WORDS that suggest the symbol’s intended meaning assists programmers in understanding program code.

Thus, l ( g,k ) = like (george , kate )Both are formally equal in predicate calculus.

But later can be a great help, for humans, in indicating the relationship the expression represents.

Predicate Calculus, however, concerns only with the formal semantics.

Parentheses “( )”, commas “,” and periods”.” are used to form well formed expressions. These are called Improper Symbols.Predicate symbols represent:-

ConstantsVariablesFunctionsPredicates

Page 5: PREDICATE CALCULS In Propositional Calculus, each atomic symbol denotes a proposition. But there is no way to access the components of an individual assertion

Constants Used to name specific objects or properties in the world.Constant symbols must begin with a lowercase letter.Examples:

georgetreetallbLUeaRT

true and false are constants, they are reserved as truth symbols.

VariablesVariable symbols represent general classes of objects or properties in the

world.Variable symbols must begin with an uppercase letter.Examples:

GeorgeTreeTallBLUeART

Page 6: PREDICATE CALCULS In Propositional Calculus, each atomic symbol denotes a proposition. But there is no way to access the components of an individual assertion

Functions A function expression is a function symbol followed by its argument.

functionsymbol ( argument )Function symbol begins with a lowercase letter.A function expression consists of a function constant of arity n, followed by n

terms, t1,t2,…,tn, enclosed in parentheses and separated by commas.

func ( t1,t2,t3,…,tn )

goerge ( likes,kate ) george is a function constant of arity 2, and there are two terms of argument.

Examples:f(X,Y)father(david)price(banana)plus(2,3)

Page 7: PREDICATE CALCULS In Propositional Calculus, each atomic symbol denotes a proposition. But there is no way to access the components of an individual assertion

A predicate calculus term is either a constant, variable or function expression.

Page 8: PREDICATE CALCULS In Propositional Calculus, each atomic symbol denotes a proposition. But there is no way to access the components of an individual assertion

Predicate Calculus SymbolsA predicate name a relationship between none (zero) or more objects in the

world.

Number of objects so related is the arity of the predicate.

Predicate symbols begin with lowercase letters.

An atomic sentence in Predicate Calculus is a predicate of arity n followed by n

terms enclosed in parentheses and separated by commas.

Predicate sentences are delimited by a period (.).

likes ( goerge, kate ).

Predicate of arity 2 two terms enclosed in parentheses delimiter

likes(goerge, kate, jim,tuesday ).

Predicate of arity 4 4 terms enclosed in parentheses delimiter

Page 9: PREDICATE CALCULS In Propositional Calculus, each atomic symbol denotes a proposition. But there is no way to access the components of an individual assertion

Examples of atomic sentences:likes(george,kate).likes(geore ,susie).frieds(bill,goerge).helps(bill,george).likes,(X,george).likes(X,X).friends(father(david),father(andrew)).

Likes, friends, help are predicate symbols.Predicates with the same names but different arities are considered different.Bill, george , kate etc are constant symbols and represent objects in the problem domain.The arguments to a predicate are terms and may also include variables or function expressions. For example:-

friends(father(david),father(andrew)).

Page 10: PREDICATE CALCULS In Propositional Calculus, each atomic symbol denotes a proposition. But there is no way to access the components of an individual assertion
Page 11: PREDICATE CALCULS In Propositional Calculus, each atomic symbol denotes a proposition. But there is no way to access the components of an individual assertion

Atomic sentences are also called atomic expressions, atoms or propositions.

Atomic sentences may be combined with connectives:

¬, v, , ,

A variable in the sentence refers to unspecified objects in the domain.

Predicate calculus includes two symbols that defines the meaning of a sentence containing a variable. These are variable quantifiers:

Universal quantifier – :indicate that sentence is true for all values of variable in the domain.

Existential quantifier -- :indicate that sentence is true for some values of variable in the domain.

A quantifier is followed by a variable and a sentence, such that:

Y friends(Y,peter). :A few elements of the domain are friends of Peter.

X likes(X,ice_cream). :All elements of the domain like ice cream.

Page 12: PREDICATE CALCULS In Propositional Calculus, each atomic symbol denotes a proposition. But there is no way to access the components of an individual assertion
Page 13: PREDICATE CALCULS In Propositional Calculus, each atomic symbol denotes a proposition. But there is no way to access the components of an individual assertion

Examples of well formed predicate sentences:

Let times and plus be function symbols of arity 2

Let equal and foo be predicate symbols of arity 2 and 3

respectively.

plus (2 , 3) is a function. Not an atomic sentence.

equal (plus (2 , 3) , five). Is an atomic sentence.

equal (plus (2 , 3) , seven). Is an atomic sentence. Though the

interpretation value of this sentence is false. But well formedness and

truth values are independent issues.

X foo(X,two,plus(2,3)) equal(plus(2,3),five). is a sentence because both

the conjuncts are sentences.

(foo(two,two,plus(2,3))) (equal(plus(2,3),five)=true). is a sentence because

all its components are sentences connected by logical operators.

Page 14: PREDICATE CALCULS In Propositional Calculus, each atomic symbol denotes a proposition. But there is no way to access the components of an individual assertion

verify_sentence algorithm

Page 15: PREDICATE CALCULS In Propositional Calculus, each atomic symbol denotes a proposition. But there is no way to access the components of an individual assertion

Assignment

Submit the flow diagram of the algorithm shown on previous slide

Page 16: PREDICATE CALCULS In Propositional Calculus, each atomic symbol denotes a proposition. But there is no way to access the components of an individual assertion

SEMANTICS FOR THE PREDICATE CALCULUS

•Predicate calculus semantics provide a formal basis for determining the truth values of expressions.

•The truth of expressions depends on the mapping of constants, variables, predicates, and functions into the objects and relations in the domain of discourse.

•For example:•Information about a person George and his friends Kate and Susie may be expressed by:

friends(george,susie).friends(george,kate).

•If it is true that George is a friend of Kate and Susie, then each expression would have truth value (assignment) “T”.•If George is friend of Kate but not of Susie,

then, friends(george,kate). Has the truth value ”T”.and, friends(george,susie). Has the truth value ”F”.

Page 17: PREDICATE CALCULS In Propositional Calculus, each atomic symbol denotes a proposition. But there is no way to access the components of an individual assertion

5. 5. Given an interpretation, the meaning of an expression is a truth value assigned Given an interpretation, the meaning of an expression is a truth value assigned over the interpretation. over the interpretation.

Page 18: PREDICATE CALCULS In Propositional Calculus, each atomic symbol denotes a proposition. But there is no way to access the components of an individual assertion

INTERPRETATION

Sentence:

friends(father(david),father(andrew)).Functions:

father(david) function evaluation : george

father(andrew) function evaluation : allen

Semantics of expression:

friends(george,allen).

Page 19: PREDICATE CALCULS In Propositional Calculus, each atomic symbol denotes a proposition. But there is no way to access the components of an individual assertion
Page 20: PREDICATE CALCULS In Propositional Calculus, each atomic symbol denotes a proposition. But there is no way to access the components of an individual assertion

•For example: For example: (Likes) Likes(george,kate). (Likes) Likes(george,kate). Is not a well-formed expression in the first-order predicate calculus.Is not a well-formed expression in the first-order predicate calculus.•Any grammatically correct English sentence may be represented in first-Any grammatically correct English sentence may be represented in first- order order predicate calculus using the symbols,connectives and variables.predicate calculus using the symbols,connectives and variables.•A few examples of sentences represented in predicate calculus:A few examples of sentences represented in predicate calculus:

•If it doesn’t rain tomorrow, Aslam will go to the mountains.If it doesn’t rain tomorrow, Aslam will go to the mountains.

¬ weather (rain , tomorrow) ¬ weather (rain , tomorrow) go (aslam , mountains). go (aslam , mountains).

•All basketball players are tall.All basketball players are tall.

X (basketball_player (X) X (basketball_player (X) tall(X)). tall(X)).

•Some people like bananas.Some people like bananas.

X (person (X) X (person (X) likes ( X, bananas)). likes ( X, bananas)).

•Nobody likes taxes.Nobody likes taxes.

¬ ¬ X likes (X , taxes) X likes (X , taxes)

Page 21: PREDICATE CALCULS In Propositional Calculus, each atomic symbol denotes a proposition. But there is no way to access the components of an individual assertion

• Model the blocks world of figure to design a control algorithm for a robot arm.• Computer has knowledge of location of blocks and the robot arm. It can keep record of these locations as

the robot hand moves blocks about the table. • To pick up a block and stack it on another block, both blocks must be clear. If block a is required to be

moved, it is not clear.• The arm can change the state of the world and clear a block.• The arm can move block c from block a, and update its knowledge base to reflect this by deleting the

assertion on(c,a).• The program needs to be able to infer that block a has become clear.• The following rule describes when a block is clear:

X (X (¬ ¬ Y on (Y , X) Y on (Y , X) clear ( X )). clear ( X )).• Following rule describes operations to stack a block

on top of another. • For example to stack X on Y:

1. Empty the hand.2. Then clear X.3. Then clear Y.4. Then pickup X.5. Put down X on Y. X X Y (( hand_empty Y (( hand_empty clear (X) clear(Y) pick_up (X) pu_down (X,Y)) stack (X,Y)). stack (X,Y)).

A BLOCK WORLD PROBLEMA BLOCK WORLD PROBLEM

Page 22: PREDICATE CALCULS In Propositional Calculus, each atomic symbol denotes a proposition. But there is no way to access the components of an individual assertion

Slide 2.22

INFERENCE RULESThe ability to infer new correct expressions from a set of true assertions is an important feature of predicate calculus.

These new expressions are correct in that they are consistent with all previous interpretations of the original set of expressions.

An interpretation that makes a sentence true is said to satisfy that sentence.An interpretation that satisfy every member of a set of expressions is said to

satisfy the set.An expression X logically follows from a set of predicate calculus expressions

S if every interpretation that satisfy S also satisfy X.The function of logical inference is to produce new sentences that logically

follow a set of predicate calculus sentences.An inference rule is essentially a mechanical means of producing new

predicate calculus sentences from other sentences.S: X human (X) X human (X) mortal (X).mortal (X). human( socrates).human( socrates).

I: all human die.I: all human die.

X: mortal (socrates).X: mortal (socrates). X, an expression logically following from S (also X, an expression logically following from S (also satisfied by I)satisfied by I)