Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 3 Propositional calculus Predicate calculus Artificial Intelligence 605451 Dr.Hassan Al-Tarawneh.

Similar presentations


Presentation on theme: "Chapter 3 Propositional calculus Predicate calculus Artificial Intelligence 605451 Dr.Hassan Al-Tarawneh."— Presentation transcript:

1 Chapter 3 Propositional calculus Predicate calculus Artificial Intelligence 605451 Dr.Hassan Al-Tarawneh

2 Propositional Calculus Symbols They symbols of propositional calculus are the propsositional symbols –P, Q, R, S ….. Truth symbols –true, false Connectives     An interpretation of a set of propositions is the assignment of truth value, either T or F true is always assigned T false is always assigned F

3 Propositional Calculus Semantics Negation  P, P PP TF FT

4 Propositional Calculus Semantics Conjunction,  PQ P  Q TTT TFF FTF FFF

5 Propositional Calculus Semantics Disjunction,  PQ P  Q TTT TFT FTT FFF

6 Propositional Calculus Semantics Implication,  –P is the premise or antecedent –Q is the conclusion or consequent PQ P  Q TTT TFF FTT FFT

7 Propositional Calculus Semantics Equivalence,  PQ PP  P  QP  Q  P  Q  P  Q TTFTTT TFFFFT FTTTTT FFTTTT

8 Identities  (  P )  P (P  Q)   P  Q Contrapositive law (P  Q)  (  Q   P) De Morgan’s Law  (P  Q)  (  P   Q)  (P  Q)  (  P   Q)

9 Identities The commutative laws (P  Q)  (Q  P) (P  Q)  (Q  P) The associative law ((P  Q)  R)  (P  (Q  R)) ((P  Q)  R)  (P  (Q  R))

10 Identities The Distributive law(it is wrong ) P  (Q  R)  (P  Q)  (Q  R)) P  (Q  R)  (P  Q)  (Q  R)) P  (Q  R) = (P  Q)  (P  R)

11 Predicate Calculus In propositional calculus, –P would denote “it rained on Tuesday” In predicate calculus – weather(tuesday, rain) Using variables –weather(X, rain) –X is a day of the week

12 Predicate Calculus Symbols The alphabet that makes up the symbols of the predicate calculus consists of –The set of letter, both upper- and lowercase –The set of digits, 0, 1, …, 9. –The underscore, _.

13 Predicate Calculus Symbols Symbols in the predicate calculus begin with a letter and are followed by any sequence of these legal characters a R 6 9 p _ z Example of characters not in the alphabet include : # % @ / & Legitimate predicate calculus symbols include –George fire3 tom_and_jerry bill XXXX friend_of Example of strings that are not legal symbols are –3jack “no blacks allowed” ab%cd ***71 duck!!!

14 Predicate Calculus Symbols likes(george, kate) –( ) - parentheses –, - commas –. - period

15 Predicate Calculus Symbols Truth symbols –true and false Constants –Must be lower case –goerge, tree

16 Predicate Calculus Symbols Variables –Represented by symbols –Begin with upper case –George, BILL, Kate (correct) –geORGE, bill (wrong) Functions –Begin with lower case –Denoted mapping –Each function had an associated arity –father (jack) – one arity –plus(2,3) – two arity

17 Predicate Calculus Symbols A predicate calculus term is either a constant, variable or function expression Example cat constant times(2,3) function X variable blue constant mother(jane) function kate constant

18 Atomic sentences An atomic sentence is a predicate constant of arity n, followed by n terms, t 1, t 2 … t n, enclosed in parentheses and separated by comas The truth values, true and false are also atomic sentences Example likes(george,kate) likes(X,george) likes(X,X) likes(george,sarah,tuesday) friends(bill,richard) friends(father_of(david),father_of(andrew))

19 Advantages of Predicate Calculus Allows the access to individual components of a proposition –plays(ahmad,fooball) Allows to determine the relationship between individuals or objects and their properties Allows expressions to contain variable, enabling general assertions about classes of entities –plays(X, football) [X refer to humans that play football] –plays(ahmad, Y) [Y refer to class of games] Through inference rules we can manipulate expression to infer new sentences –team_mates(X, Y)  plays (X, football)  plays (Y, football) –team_mates(ahmad, ali)  plays (ahmad, football)  plays (ali, football)

20 Predicate Calculus We can combine atomic sentences using logical operators to from sentences in the predicate calculus. Logical connectives are       is the universal quantifier, indicating that the sentence is true for all values of the  Is the existential quantifier indicating that the sentence is true for at least one value in the domain

21 Examples Marcus was a man –man(marcus) Marcus was a Pompeian –pompeian(marcus) All pompeians were Romans –  X pompeian(X)  roman(X) Caesar was a ruler –ruler(ceaser)

22 Examples All romans were either loyal to Caesar or hated him –  X roman(X)  loyal_to(X, caeser)  hate(X, caeser) Everyone it loyal to someone –  X  Y loyal_to(X,Y) People try to assassinate rulers that they are not loyal to –  X  Y person(X)  ruler (Y)  tryassassinate (X,Y)   loyalto(X,Y) Marcus tried to assassinate Caesar –tryassassinate(marcus,caesar)

23 Predicate Calculus Sentences Every atomic sentence is a sentence If s is a sentence, then also its negation,  s. If s 1 and s 2 is a sentence, then also their conjunctions, s 1  s 2. If s 1 and s 2 is a sentence, then also their disjunctions, s 1  s 2. If s 1 and s 2 is a sentence, then also their implication, s 1  s 2. If s 1 and s 2 is a sentence, then also their equivalence, s 1  s 2. If X is a variable and s is a sentence, then  X is a sentence If X is a variable and s is a sentence, then  X is a sentence

24 Predicate Calculus Semantic friends(george,susie) = T if true friends(george,kate) = F if false friends(george,X) X is a place holder –Substitute X with katie or susie –X is for all constants –Can have any other name, Y or PEOPLE

25 Predicate Calculus Semantic In predicate calculus variable must be quantified –universally –existentially Free variables –If it is not within the scope of the universal or existential quantifier Closed expression –If its variables are quantified Ground expression –Has no variables at all  X (p(X)  q (Y)  r(X)) –X is universally quantified to p(X) and r(X)

26 Universal Quantification Problem computing the truth table of a sentence All possible values of a variable must be tested to see whether the expression remains true  X likes(george,X) –X is all humans

27 Universal Quantification Propositional calculus does not use variables Has finite no of possible truth assignment Can test all assignments Done with truth table

28 Existential Quantifier Evaluating the truth expression is also not easy. Determine the truth by trying substitution until one is found that makes the expression true. If the domain is infinite, algorithm will not halt

29 Universal & Existential Quantification Relationships   X p(X)   X  p(X)   X p(X)   X  p(X)  X p(X)   Y p(Y)  X q(X)   Y q(Y)  X (p(X)  q(X))   X p(X)   Y p(Y)  X (p(X)  q(X))   X p(X)   Y p(Y)

30 Clauses to Predicate Calculus If it doesn’t rain on Monday, Tom will go to the mountains  weather(rain,Monday)  go(tom,mountains) Emma is a Doberman and a good dog gooddog(emma)  isa(emma,doberman) All basketball players are tall  X(basketball_player(X)  tall(X)) Some people like anchovies  X (person(X)  likes(X,anchovies)) If wished were horses, beggars would ride equal(wishes,horses)  ride(beggars) Nobody likes taxes   X likes(X, takes)

31 Inference Rules Logical inference –Ability to infer correct expression from a set of true assertions –New expression consistent with all previous interpretation of the original expression

32 Inference Rules A mechanical means of producing new predicate calculus sentences from other sentences Example : modus ponens

33 Inference Rules If the sentence P and P  Q are know to be true, then modus ponens lets us infer Q Under the inference rule modus tollens, if P  Q is know to be true and Q is known to be false, we can infer  P.

34 Inference Rules Elimination allows us to infer the truth of either of the conjuncts from the truth of a conjunctive sentence. For instance, P  Q lets us conclude P and Q are true. Introduction allows us to infer the truth of conjunction from the truth of its conjuncts. For instance, if P and Q are true, then P  Q is true

35 Inference Rules Universal instantiation states that if any universally quantified variable in a true sentence is replaced by an appropriate term from the domain, the results is a true sentence Thus, if a is from the domain of X,  X p(X) lets us infer p(a)

36 Modus ponen  X (man(X)  mortal (X)) man(socrates) (man(socrates)  mortal (socrates))

37 Unification Unification is an algorithm for determining the substitutions needed to make two predicate calculus expression match foo(X,a,goo(Y)) legal substitutes –foo(fred,a,goo(Z)){fred/X, Z/Y} –foo(W,a,goo(jack)) {W/X, jack/Y} –foo(Z,a,goo(moo(Z))) {Z/X, moo(Z)/Y} X/Y indicates X is substituted for the variable Y in the original expression

38 Unification Issues Variable can be substituted by constant, but constant cannot be replaced with a constant Not allowed p(p(p(…X))) Must maintain consistency across all occurrence of the variable in the expression matched – X = socrates in man(X) and mortal(X)

39 Unification Issues Once a variable is substituted, future unification and inference must take the value of this substitution into account –{X/Y, W/Z} {V/X} {a/V, f(b)/W} => {a/Y,f(b)/Z} Use most general unification –p(X) p(Y) => {fred/X, fred/Y} –most general => {Z/X, Z/Y}


Download ppt "Chapter 3 Propositional calculus Predicate calculus Artificial Intelligence 605451 Dr.Hassan Al-Tarawneh."

Similar presentations


Ads by Google