Artificial Intelligence 605451 Chapter 3 Propositional calculus Predicate

  • Slides: 39
Download presentation
Artificial Intelligence 605451 Chapter 3 Propositional calculus Predicate calculus Dr. Hassan Al-Tarawneh

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

Propositional Calculus Symbols • They symbols of propositional calculus are the propsositional symbols –

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

Propositional Calculus Semantics • Negation P, P P T F F T

Propositional Calculus Semantics • Negation P, P P T F F T

Propositional Calculus Semantics • Conjunction, P Q T T F F F T F

Propositional Calculus Semantics • Conjunction, P Q T T F F F T F F

Propositional Calculus Semantics • Disjunction, P Q T T F F F

Propositional Calculus Semantics • Disjunction, P Q T T F F F

Propositional Calculus Semantics • Implication, – P is the premise or antecedent – Q

Propositional Calculus Semantics • Implication, – P is the premise or antecedent – Q is the conclusion or consequent P T Q T P Q T T F F F T T F F T

Propositional Calculus Semantics • Equivalence, P Q P P Q T T F F

Propositional Calculus Semantics • Equivalence, P Q P P Q T T F F T F T T T F F T T

Identities • • • ( P ) P (P Q) P Q Contrapositive law

Identities • • • ( P ) P (P Q) P Q Contrapositive law (P Q) ( Q P) • De Morgan’s Law (P Q) ( P Q)

Identities • The commutative laws (P Q) (Q P) • The associative law ((P

Identities • The commutative laws (P Q) (Q P) • The associative law ((P Q) R) (P (Q R))

Identities • The Distributive law(it is wrong ) P (Q R) (P Q) (Q

Identities • The Distributive law(it is wrong ) P (Q R) (P Q) (Q R)) • P (Q R) = (P Q) (P R)

Predicate Calculus • In propositional calculus, – P would denote “it rained on Tuesday”

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

Predicate Calculus Symbols • The alphabet that makes up the symbols of the predicate

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, _.

Predicate Calculus Symbols • Symbols in the predicate calculus begin with a letter and

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

Predicate Calculus Symbols • likes(george, kate) – ( ) - parentheses – , -

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

Predicate Calculus Symbols • Truth symbols – true and false • Constants – Must

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

Predicate Calculus Symbols • Variables – – Represented by symbols Begin with upper case

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

Predicate Calculus Symbols • A predicate calculus term is either a constant, variable or

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

Atomic sentences • An atomic sentence is a predicate constant of arity n, followed

Atomic sentences • An atomic sentence is a predicate constant of arity n, followed by n terms, t 1, t 2 … tn, 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))

Advantages of Predicate Calculus • Allows the access to individual components of a proposition

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)

Predicate Calculus • We can combine atomic sentences using logical operators to from sentences

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

Examples • Marcus was a man – man(marcus) • Marcus was a Pompeian –

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)

Examples • All romans were either loyal to Caesar or hated him – X

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)

Predicate Calculus Sentences • • Every atomic sentence is a sentence If s is

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

Predicate Calculus Semantic • • friends(george, susie) = T if true friends(george, kate) =

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

Predicate Calculus Semantic • In predicate calculus variable must be quantified – universally –

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)

Universal Quantification • Problem computing the truth table of a sentence • All possible

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

Universal Quantification • • Propositional calculus does not use variables Has finite no of

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

Existential Quantifier • Evaluating the truth expression is also not easy. • Determine the

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

Universal & Existential Quantification • Relationships X p(X) X p(X) X p(X) Y p(Y)

Universal & Existential Quantification • Relationships 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)

Clauses to Predicate Calculus • If it doesn’t rain on Monday, Tom will go

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)

Inference Rules • Logical inference – Ability to infer correct expression from a set

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

Inference Rules • A mechanical means of producing new predicate calculus sentences from other

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

Inference Rules • If the sentence P and P Q are know to be

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.

Inference Rules • Elimination allows us to infer the truth of either of the

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

Inference Rules • Universal instantiation states that if any universally quantified variable in a

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)

Modus ponen • X (man(X) mortal (X)) • man(socrates) • (man(socrates) mortal (socrates))

Modus ponen • X (man(X) mortal (X)) • man(socrates) • (man(socrates) mortal (socrates))

Unification • Unification is an algorithm for determining the substitutions needed to make two

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)) – foo(W, a, goo(jack)) – foo(Z, a, goo(moo(Z))) {fred/X, Z/Y} {W/X, jack/Y} {Z/X, moo(Z)/Y} • X/Y indicates X is substituted for the variable Y in the original expression

Unification Issues • Variable can be substituted by constant, but constant cannot be replaced

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)

Unification Issues • Once a variable is substituted, future unification and inference must take

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}