440 likes | 710 Views
CSNB234 ARTIFICIAL INTELLIGENCE. Chapter 3 Propositional Logic & Predicate Logic. (Chapter 2, pp. 45-76, Textbook) (Chapter 8, pp. 240-253, Ref. #3) Read online supplementary slides. Instructor: Alicia Tang Y. C. Early Development of Symbolic Logic.
E N D
CSNB234ARTIFICIAL INTELLIGENCE Chapter 3 Propositional Logic & Predicate Logic (Chapter 2, pp. 45-76, Textbook) (Chapter 8, pp. 240-253, Ref. #3) Read online supplementary slides Instructor: Alicia Tang Y. C. UNIVERSITI TENAGA NASIONAL
Early Development of Symbolic Logic • English mathematician DeMorgan criticised traditional logic because it was written in natural language. • He thought that the formal meaning of a syllogistic statement was confused by the semantics of natural language. • DeMorgan and Boole both contributed to the development of Propositional Logic (or Propositional Calculus). • Using familiar algebraic symbols, they showed how certain algebraic rules were equally applicable to numbers, set and truth values of propositions. UNIVERSITI TENAGA NASIONAL
Propositional Logic (I) • Definition • Propositional Logic Sentences • Every propositional symbol and truth symbol is a sentence. • For example: true, P, Q, and R are four sentences • The negation of a sentence is a sentence • For example: P and false are sentences • The conjunction (and) of two sentences is a sentence • For example: P P is a sentence UNIVERSITI TENAGA NASIONAL
Propositional Logic (II) • Propositional Logic Sentences • The disjunction (or) of two sentence s is a sentence • For example: P P is a sentence • The implication of one sentence for another is a sentence • For example: P Q is a sentence • The equivalence of two sentences is a sentence • for example: P Q = R is a sentence UNIVERSITI TENAGA NASIONAL
Propositional Logic (III) • Propositional Logic Semantics • An interpretation of a set of propositions is the assignment of a truth value, either T of F, to each propositional symbol. • The interpretation or truth value for sentences is determined by: • The truth assignment of negation, P, where P is any propositional symbol, is F if the assignment to P is T and T if the assignment to P is F. • The truth assignment of conjunction, , is T only when both conjuncts have truth value T; otherwise it is F. UNIVERSITI TENAGA NASIONAL
Propositional Logic (IV) • Propositional Calculus Semantics • The truth assignment of disjunction, , is F only when both conjuncts have truth value F; otherwise it is T. • The truth assignment of implication, , is F only when the premise or symbol before the implication is T and the truth value of the consequent or symbol after the implication is F; otherwise it is always T. • The truth assignment of equivalence, =, is T only when both expressions have the same truth assignment for all possible interpretations; otherwise it is F. UNIVERSITI TENAGA NASIONAL
A Worked Example • Prove that ((PQR) = P Q R is a well-formed sentence in the propositional calculus. • Answer. Since: • P, Q and R are propositions and thus sentences • P Q, the conjunction of two sentences, is a sentence • (P Q) R, the implication of a sentence for another, is a sentence UNIVERSITI TENAGA NASIONAL
A Worked Example ..cont P, Q and R are propositions and thus sentences P and Q , the negation of two sentences, are sentences P Q, the disjunction of two sentences, is a sentence P Q R, the disjunction of two sentences, is a sentence ((P Q) R) = P Q R, the equivalence of two sentences, is a sentence We get back the original sentence UNIVERSITI TENAGA NASIONAL
Conclusion for the worked example The above is our original sentence, which has been constructed through a series of applications of legal rules and is therefore well-formed. UNIVERSITI TENAGA NASIONAL
Constant & Compound Sentences in Propositional Logic • Constants refer to atomic propositions. raining snowing eating hungry wet • Compound sentences capture relationships among propositions. • raining snowing wet UNIVERSITI TENAGA NASIONAL
Compound Sentences • Negations: ¬ raining • The argument of a negation is called the target . • Conjunctions: (raining snowing ) • The arguments of a conjunction are called conjuncts . • Disjunctions: (raining snowing ) • The arguments of a disjunction are called disjuncts . UNIVERSITI TENAGA NASIONAL
Compound Sentences • Implications: (raining cloudy ) • The left argument of an implication is the antecedent . • The right argument of an implication is called the consequent . • Reductions: cloudy raining • The left argument of a reduction is the consequent . • The right argument of a reduction is called the antecedent . • Equivalences: raining cloudy UNIVERSITI TENAGA NASIONAL
Rules of Algebraic Manipulation • x y = y x Commutativity • x y = y x • x (y z) = (x y) z Associativity • x (y z) = (x y) z • x (y z) = (x y) (x z) Distributivity • x (y z) = (x y) (x z) Some Laws for Logic Use UNIVERSITI TENAGA NASIONAL
Semantics of Logical Operators • Negation: • Conjunction: P P T F F T P Q P Q T T T T F F F T F F F F UNIVERSITI TENAGA NASIONAL
Semantics of Logical Operators • Disjunction: P Q P Q T T T T F T F T T F F F UNIVERSITI TENAGA NASIONAL
More Semantics of Logical Operators Implication: Reverse Implication: Equivalence: P Q P Q T T T T F F F T T F F T P Q Q P T T T T F T F T F F F T P Q Q P T T T T F F F T F F F T UNIVERSITI TENAGA NASIONAL
Satisfaction An interpretation i satisfies a sentence φ (written |=i φ ) if and only if φ i =T . A sentence is satisfiable if and only if there is some interpretation that satisfies it. A sentence is valid if and only if every interpretation satisfies it. A sentence is unsatisfiable if and only if there is no interpretation that satisfies it. UNIVERSITI TENAGA NASIONAL
Truth Tables A truth table is a table of all possible values for a set of propositional constants. p q r T T T T T F T F T T F F F T T F T F F F T F F F Each interpretation of a language is a row in the truth table for that language. For a propositional language with n logical constants,there are 2n interpretations. UNIVERSITI TENAGA NASIONAL
Logical Equivalence Two sentences are logically equivalent if and only if they logically entail each other. Examples: ¬(¬p) p ¬(p q ) ¬p ¬q de Morgan’s law ¬(p q ) ¬p ¬q de Morgan’s law (p q ) ¬p q UNIVERSITI TENAGA NASIONAL
Problems • There can be many, many interpretations for a propositional language. • Remember that, for a language with n constants, there are 2n possible interpretations. • Sometimes there are many constants among premises that are irrelevant to the conclusion. ---- Much work wasted. Solution: use other kind of proof theory, such as refutation proof (later part) UNIVERSITI TENAGA NASIONAL
Truth Tables • The interpretation of any expression in propostional logic can be specified in a truth table. An example of a truth table is shown here: UNIVERSITI TENAGA NASIONAL
Example of validity: Problem to solve Problem: (p q) (q r)? Solution: p q r (p q) (q r) (p q ) (q r ) T T T T T T T T F T F T T F T F T T T F F F T T F T T T T T F T F T F T F F T T T T F F F T T T It is a valid sentence! All values are “true” UNIVERSITI TENAGA NASIONAL
Clausal Form • Propositional resolution works only on expressions in clausal form. • Fortunately, it is possible to convert any set of propositional calculus sentences into an equivalent set of sentences in clausal form. UNIVERSITI TENAGA NASIONAL
Conversion to Clausal Form Implications Out: P Q Ø P Ú Q P Q P Ú Ø Q P Q (Ø P Ú Q) Ù (P Ú ØQ ) Negations In: Ø Ø P P Ø (P Ù Q) Ø PÚ Ø Q Ø (P ÚQ ) Ø P Ù Ø Q UNIVERSITI TENAGA NASIONAL
Predicate Calculus(=Predicate Logic) UNIVERSITI TENAGA NASIONAL
Predicate Calculus (I) • In Proposition Logic, each atomic symbol (P, Q, etc) denotes a proposition of some complexity. There is no way to access the components of an individual assertion. Through inference rules we can manipulate predicate calculus expressions, accessing their individual components and inferring new sentences. UNIVERSITI TENAGA NASIONAL
Predicate Calculus (II) • In Predicate Calculus, there are two ways variables may be used or quantified. In the first, the sentence is true for all constants that can be substituted for the variable under the intended interpretation. The variable is said to be universal quantified. Variables may also be quantified existentially. In this case the expression containing the variable is said to be true for at least one substitution from the domain of definition. Several relationships between negation and the universal and existential quantifiers are given below: UNIVERSITI TENAGA NASIONAL
Predicate Calculus (III) • Predicate calculus sentences • Every atomic sentence is a sentence • if s is a sentence, then so is its negation, s • if s1 and s2 are sentences, then so is their conjunction, s1 s2 • if s1 and s2 are sentences, then so is their disjunction, s1 s2 • if s1 and s2 are sentences, then so is their implication, s1 s2 • if s1 and s2 are sentences, then so is their equivalence, s1 = s2 UNIVERSITI TENAGA NASIONAL
Predicate Calculus (IV) • If X is a variable and s is a sentence, then X sis a sentence • If X is a variable and s is a sentence, then X s is a sentence UNIVERSITI TENAGA NASIONAL
English sentences represented in Predicate Calculus: • Some people like fried chicken. • X (people(X) likes(X, fried_chicken)). • Nobody likes income taxes. • X likes(X, income_taxes). • X likes(X, income_taxes). UNIVERSITI TENAGA NASIONAL
Rule: All purple mushrooms are poisonous. X (purple(X) mushroom(X) poisonous(X)) Fact: Tom loves Jerry. loves(tom, Jerry). UNIVERSITI TENAGA NASIONAL
Quiz: Translate the following English Statements into Predicate Expressions All people that are not poor and are intelligent are happy. Students who like to read books are not stupid. Batman is knowledgeable and he is wealthy. Tweety can fly if it is not fried and has wings. UNIVERSITI TENAGA NASIONAL
Exercise #1 Everybody likes something. There is something whom everybody likes. UNIVERSITI TENAGA NASIONAL
Answers to Exercise #1 • Everybody likes something. • "x.$y. likes(x,y) • There is something whom everybody likes. • $y."x. likes(x,y) UNIVERSITI TENAGA NASIONAL
Exercise #2 For predicates p & q, and variables X and Y: Write the following in English X p(X) = X p(X) Y q(Y) = Y q(Y) UNIVERSITI TENAGA NASIONAL
Answers to Exercise #2 UNIVERSITI TENAGA NASIONAL
Quiz: Convert each of the following predicate logic to English sentences • X loves(X, superman) loves(superman, X) • food(laksa) • X food(X) like(arul, X) • X Y eat(X, Y) alive(X) food(Y) • X eat(haswan, X) eat(hasman, X) UNIVERSITI TENAGA NASIONAL
Stages involved in Proof Theory • Stage 1 • convert all axioms into prenex form • i.e. all quantifiers are at the front • Stage 2 • purge existential quantifiers • this process is known as skolemization • Stage 3 • drop universal quantifiers • as they convey no information UNIVERSITI TENAGA NASIONAL
An Example Consider the argument: All men are mortal (given premise) Superman is a man (given premise) Superman is mortal (goal to test) The argument gets formalised as: X man(X) mortal(X) man(Superman) mortal(Superman) (goal) And has, as its conflict set in Clausal form: man(X) mortal(X) ---- (1) man(Superman) ---- (2) mortal(Superman) ---- (3) Negation of goal UNIVERSITI TENAGA NASIONAL
Apply resolution to derive at a contradiction: • We get: • man(Superman) from (1) & (3) and, • direct contradiction from (2) & (4) • The conclusion is that “the goal is true” • (i.e. superman is mortal) UNIVERSITI TENAGA NASIONAL
Exercise #3 • Convert each of the following into Predicate Calculus equivalence: • Marcus was a man • Marcus was a Pompeian • All Pompeians were Romans • Caesar was a ruler • All Romans were either loyal to Caesar or hated him • Everyone is loyal to someone • people only try to assassinate rulers they are not loyal to • Marcus tried to assassinate Caesar UNIVERSITI TENAGA NASIONAL
Predicate logic for the 8 facts in Exercise #3 1. man(Marcus) 2. pompeian(Marcus) 3. X. pompeian(X) roman(X) 4. ruler(Caesar) 5. X. roman(X) loyalto(X, Caesar) hate(X, Caesar) 6. X. Y. loyalto(X,Y) 7. X. Y. person(X) ruler(Y) tryassassinate(X,Y) loyalto(X,Y) 8. tryassasinate(Marcus, Caesar) 9. X. man(X) person(X) UNIVERSITI TENAGA NASIONAL
Answers to Exercise #3 loyato(Marcus, Caesar) (using 7, substitution, & apply M.P) person(Marcus) tryassassinate(Marcus, Caesar) ruler(Caesar) using (4) person(Marcus) tryassassinate(Marcus, Caesar) using (8) person(Marcus) (using 9, substitution & apply M.P) man(Marcus) using (1) nil UNIVERSITI TENAGA NASIONAL