Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 6 Logical Reasoning Xiu-jun GONG (Ph. D) School of Computer Science and Technology, Tianjin University

Similar presentations


Presentation on theme: "Chapter 6 Logical Reasoning Xiu-jun GONG (Ph. D) School of Computer Science and Technology, Tianjin University"— Presentation transcript:

1 Chapter 6 Logical Reasoning Xiu-jun GONG (Ph. D) School of Computer Science and Technology, Tianjin University gongxj@tju.edu.cn http://cs.tju.edu.cn/faculties/gongxj/course/ai/

2 Outline  Intro to logic reasoning  Preparation for resolution Stand form clauses (9 steps) Substitution and unify Control strategies  Resolution reasoning In propositional logic In Predicate logic In particular interrogative sentence  Summary Logic is the Calculus of Computer Science The central role of logic in computer science is comparable to the role of differential equations in the natural sciences

3 Intro to logic  Logic is the study of the principles of valid demonstration and inference.  Consistency, which means that none of the theorems of the system contradict one another.  Soundness, which means that the system's rules of proof will never allow a false inference from a true premise. If a system is sound and its axioms are true then its theorems are also guaranteed to be true.  Completeness, which means that there are no true sentences in the system that cannot, at least in principle, be proved in the system.

4 Classifications of logic  Informal logic is the study of natural language arguments.  Formal logic is the study of inference with purely formal content  Symbolic logic is the study of symbolic abstractions that capture the formal features of logical inference  Mathematical logic is an extension of symbolic logic into other areas(model theory, proof theory, set theory, and recursion theory)

5 Symbolic logic  Two languages Propositional logic Predicate logic  Components Syntax Rules Semantic

6 Syntax  Elements Atoms: {A,B, …, T,F} Literal: atoms and a  sign in front of them Connectives: , , , and  Sentences: Syntax of well-formed formula (wff),  Any atom is a wff.  If w 1 and w 2 are wffs, so are w 1  w 2, w 1  w 2, w 1  w 2,  w 1.  There are no other wffs. Universal sign: x Quantifier sign: x

7 Inference  Reasoning is the cognitive process of looking for reasons for beliefs, conclusions, actions or feelings.  Inference is the act or process of deriving a conclusion based solely on what one knows.  Logic reasoning Deduction: determining the conclusion Induction: determining the rule. Abduction: determining the precondition.

8 Semantics  Semantics associating elements of a logical language with elements of a domain of discourse  Interpretation the proposition associated with an atom (value)  Propositional Truth Table Given the values of atoms under some interpretation, use a truth table to compute a value for any wff under that same interpretation.

9 Standard Form Clauses (1)  Clause: a disjunction of literals.  Conjunctive Normal Form: CNF  Disjunctive Normal Form: DNF  CNF  DNF

10 Standard Form Clauses (2)  Prenex Normal Form: A wff of predicate logic is in prenex normal form, iff all its quantifiers are clustered at the left no quantifier is negated the scope of each quantifier extends to the end of the wff no two quantifiers quantify the same variable every quantified variable occurs in the matrix of the wff

11 Standard Form Clauses (3)  Skolem Standard Form: A formula is in SSF if it is in conjunctive prenex normal form with only universal first- order quantifiers Removing existential quantifiers from formal logic statements  Standard Form Clauses: Clauses in SSF P(c)

12 Convert WFF to SFCs (1) 1. Eliminate implication signs,   > 2. Reduce the scopes of ~ 3. Rename variables

13 Convert WFF to SFC (2) 4. Forward quantifiers 5. Skolem transfer Eliminate existential quantifiers

14 Convert WFF to SFC (3) 6. Get CNF with Skolem standard form 7. Eliminate universal quantifiers

15 Convert WFF to SFC (4) 8. Get clauses 9. Rename variables again

16 An example

17 Resolution reasoning of propositional logic  Resolution is a rule of inference leading to a refutation theorem-proving technique for sentences in propositional logic and first-order logic.  Procedure Choose two clauses that have exactly one pair of literals that are complementary Produce a new clause by deleting the complementary literals and combining the remaining literals

18 General form of resolution Proof: Show that if C 1 and C 2 are true for explanation I, then R is true for I. 1. Under I, if P=false, then C 1 ’ =true, so R=C 1 ’VC 2 ’=true 2. Under I, if P=true, then C 2 ’ =true, so R=C 1 ’VC 2 ’=true

19 Resolution on propositional logic  Convert all the expressions (facts, rules and the negation of conclusion) into standard form clauses  Resolve on all the clauses until reaches contradict (nil) resolution refutation

20 Example Conditions: Conclusion: (6) (2) (7) (1) (8) (4) (9) (5) (6) (2) (1) (4) (5)

21 Example cont. Lucky enough

22 Substitution and Unify  Preparing for predicate logic resolution Universal quantifications for all variables.  If two clauses have matching but complementary literals, it is possible to resolve them literal Clause

23 Substitution  Any substitution can be represented by a set of ordered pairs

24 Example

25 Unify  F 1 and F 2 are predicate formula,θ is a substitution. if F 1 θ=F 2 θ,then θ is the Unifier of F 1 and F 2 P(c,y,b)and P(x,a,b), θ={c/x,a/y} P(x,y,b)and P(z,u,b) θ={z/x,u/y} other else? P(f(y),a)and P(x,a) θ={f(y)/x}  Three types of unifier Constant/variable —— 变量实例化 Variable/variable —— 变量一致化 Function/variable —— 变量函数化

26 Most General Unifier: MGU  σ is a MGU between F1 and F2 if for any θ be one of unifiers between F1 and F2, there exists a λ such that θ=σ · λ  i.e. F 1 =P(x), F 2 =P(f(y)) θ 1 ={f(a)/x,a/y},θ 2 ={f(b)/x,b/y} θ 1,θ 2 are unifiers, but not MGUs σ = {f(y)/x} is a MGU, where  θ 1 =σ · {a/y}, λ= {a/y}  θ 2 =σ · {b/y}, λ= {b/y}

27 Algorithms looking for a MGU  Steps Find out the difference sets of variables between two clauses Identify the substitutions for each set  Ex1. F 1 = P(x,y,z) F 2 = P(x,f(a),h(b)) Difference set: D 1 ={y,f(a)}, D 2 ={z,h(b)} MGU= {f(a)/ y, h(b)/z}  Ex2. F 1 = P(x), F 2 = P(y) Difference set: D={x,y} MGU={x/y} or {y/x}

28 Resolution Reasoning of Predicate Logic  F1 and F2 are clauses, P1 in F1 and ~ P2 in F2 are literals such that P1 and P2 have a MGU μ, then These two clauses have a resolvent ρ. The resolvent is obtained by applying the substitution μ to the union of F1 and F2, leaving out the complementary literals. Ρ=[(F1-{P1}) ∨ (F1-{ ~ P2}) ] μ

29 Example  Problem Marcus is a man Caesar is a ruler A person trying to assassinate its ruler is not loyal Marcus want to assassinate Caesar  Step1 Convert to logic expression man (marcus) ruler (caesar) person(X) ∧ rule(Y) ∧ tryassassinate(X,Y) → ~ loyalto(X,Y) tryassassinate (marcus, caesar) man(X) → person(X) Show that Marcus is not loyal to Caesar ~ loyalto(marcus,caesar)

30 Example cont.  Step2, build standard form clauses (1) man(m) (2) ruler(c) (3) ~ person(X) ∨~ ruler(Y) ∨~ trya (X,Y) ∨~ loyalto(X,Y) (4) trya (m,c) (5) ~ man (Z) ∨ person(Z) (6) loyalto(m,c)  Step3, resolution reasoning (7) ~ person(m) ∨~ ruler(c) ∨~ trya (m,c) (6) (3) {m/X, c/Y} (8) ~ person(m) ∨~ ruler(c) (7) (4) (9) ~ person(m) (8) (2) (10) ~ man (m) (9) (5) {m/Z} (11) NIL (10)(1)

31 Example cont.

32 Control Strategy (1)  Problem How to pick up clauses to resolve? Quick and completeness  Strategies 1. Breadth-first resolution: completeness, time- consuming 2. Unit resolution: with priority with literals 3. Input resolution: each resolvent at lease involves a input clause

33 Control strategies (2) 4. Linear resolution: Start from an initiate clause, then resolve continue linearly. (1) ~P ∨ S (2) P ∨ Q (3)~P ∨ R (4)~Q ∨ R (5)~R (6)Q ∨ R (2)(3) (7)R (6)(4) (8)NIL (7)(5) The point is how to choose the initiate clause

34 Control strategies (3) 5. Supported set resolution: for each resolvent, one of clause must be in “supported set” The supported set includes negation of the conclusion and its resolvents (1) ~P ∨ S (2) P ∨ Q (3)~P ∨ R (4)~Q ∨ R (5)~R

35 Control strategies (4) 6. One occurrence literal deletion (1) ~P ∨ S (2) P ∨ Q (3)~P ∨ R (4)~Q ∨ R (5)~R

36 Resolution for Particular Interrogative Sentence  Answers for who , what , when , where , how Known as: pompeian(x)->died(x,70) pompeian(marcus) Ask: died(marcus,?) Clause set: (1) ~pompeian(x) ∨ died(x,70) (2) pompeian(marcus) (3) ~died(marcus,t) ∨ died(marus,t) (ever-true expression is added for conclusion)

37 Example cont. (1) ~pompeian(x) ∨ died(x,70) (2) pompeian(marcus) (3) ~died(marcus,t) ∨ died(marus,t)

38 Summary  Preparation for resolution Stand form clauses (9 steps) Substitution and unify Control strategies  Resolution reasoning In propositional logic In Predicate logic In particular interrogative sentence


Download ppt "Chapter 6 Logical Reasoning Xiu-jun GONG (Ph. D) School of Computer Science and Technology, Tianjin University"

Similar presentations


Ads by Google