
Resolution for First Order Logic Meghdad Ghari Institute for Research in Fundamental Sciences (IPM) School of Mathematics-Isfahan Branch Logic Group http://math.ipm.ac.ir/Isfahan/Logic-Group.htm Logic Short Course II, Computational Predicate Logic March 9, 2017 Meghdad Ghari (IPM) Resolution Logic Short Course 2017 1 / 82 Outline 1 Propositional Logic Conjunctive Normal Form Propositional Resolution 2 First Order Logic Syntax Semantics Resolution for FOL PROLOG Meghdad Ghari (IPM) Resolution Logic Short Course 2017 2 / 82 Language Atom = fp1; p2; p3;:::g, A (finite or infinite) set of atomic propositions (or propositional variables). L = Atom [ f(; ); :; ^; _; !g Formulas of propositional logic are defined by the following grammar in Backus Naur form (BNF): φ ::= p j (:φ) j (φ ^ φ) j (φ _ φ) j (φ ! φ); p 2 Atom Meghdad Ghari (IPM) Resolution Logic Short Course 2017 3 / 82 Semantics: principle of compositionality The meaning of a complex expression is determined by the meanings of its constituent expressions and the rules used to combine them. Valuations: v : Atom ! fT; Fg Valuations can be extended to the set of all formulas as follows: v(:φ) = 1 − v(φ) v(φ ^ ) = min(v(φ); v( )) v(φ _ ) = max(v(φ); v( )) v(φ ! ) = min(1; 1 − v(φ) + v( )) Meghdad Ghari (IPM) Resolution Logic Short Course 2017 4 / 82 Decideability Definition A logical system is decidable if there is an effective method (or algorithm) for determining whether arbitrary formulas are theorems of the logical system. Truth tables provide a decision procedure for propositional logic. Meghdad Ghari (IPM) Resolution Logic Short Course 2017 5 / 82 Validity and satisfiability Theorem Let φ be a formula of propositional logic. Then φ is satisfiable iff :φ is not valid. Theorem Given formulas φ1; φ2; : : : ; φn and of propositional logic, φ1; φ2; : : : ; φn j= iff j= φ1 ^ φ2 ^ ::: ^ φn ! Meghdad Ghari (IPM) Resolution Logic Short Course 2017 6 / 82 Validity and satisfiability Theorem Let φ be a formula of propositional logic. Then φ is satisfiable iff :φ is not valid. Theorem Given formulas φ1; φ2; : : : ; φn and of propositional logic, φ1; φ2; : : : ; φn j= iff j= φ1 ^ φ2 ^ ::: ^ φn ! Meghdad Ghari (IPM) Resolution Logic Short Course 2017 6 / 82 Conjunctive Normal Form (CNF) L ::= p j :p; p 2 Atom Literal D ::= L j L _ D Clause C ::= D j D ^ C Conjunctive normal form Example (Set representation) CNF Clausal form (:q _ p _ r) ^ (:p _ r) ^ q ^ (r _:p) ff:q; p; rg; f:p; rg; fqgg Facts The empty clsuse is always false and unsatisfiable. The empty clause form ; is valid. A clause form that has is a contradiction, and hence unsatisfiable. Meghdad Ghari (IPM) Resolution Logic Short Course 2017 7 / 82 Converting formulas to CNF Theorem Every formula in propositional logic can be transformed into an equivalent formula in CNF Step 1. Elimination of ! and $: φ ! ≡ :φ _ φ $ ≡ (:φ _ ) ^ (φ _: ) Step 2. Converting to negation normal forms (NNF): ::φ ≡ φ :(φ ^ ) ≡ :φ _: :(φ _ ) ≡ :φ ^ : Step 3. Distributivity rules: φ ^ ( _ σ) ≡ (φ ^ ) _ (φ ^ σ) φ _ ( ^ σ) ≡ (φ _ ) ^ (φ _ σ) Meghdad Ghari (IPM) Resolution Logic Short Course 2017 8 / 82 Resolution John Alan Robinson, A Machine-Oriented Logic Based on the Resolution Principle J. ACM. 12 (1): 23-41, 1965. Meghdad Ghari (IPM) Resolution Logic Short Course 2017 9 / 82 Propositional Resolution Resolution is a refutation procedure used to check if a formula in clausal form is unsatisfiable. The resolution procedure consists of a sequence of applications of the resolution rule to a set of clauses. The rule maintains satisfiability: if a set of clauses is satisfiable, so is the set of clauses produced by an application of the rule. Therefore, if the (unsatisfiable) empty clause is ever obtained, the original set of clauses must have been unsatisfiable. Meghdad Ghari (IPM) Resolution Logic Short Course 2017 10 / 82 Propositional Resolution Rule Resolution: :φ _ φ _ χ _ χ Resolution is sound (preserves validity). Modus Ponens: φ ! φ :φ _ φ _ > _ χ Modus Ponens is a special case of resolution. Meghdad Ghari (IPM) Resolution Logic Short Course 2017 11 / 82 Propositional Resolution Rule Resolution: :φ _ φ _ χ _ χ Resolution is sound (preserves validity). Modus Ponens: φ ! φ :φ _ φ _ > _ χ Modus Ponens is a special case of resolution. Meghdad Ghari (IPM) Resolution Logic Short Course 2017 11 / 82 Propositional Resolution Rule Propositional Resolution Rule: C t fpg D t f:pg C [ D where C and D are clauses and t denotes disjoint union. C [ D is called the resolvent of C t fpg and D t f:pg: C [ D = Res(C t fpg; D t f:pg) Resolution on clause forms: fC1;:::; C t fpg; D t f:pg;:::; Cng fC1;:::; C [ D;:::; Cng Resolution on clause forms preserves satisfiability. Meghdad Ghari (IPM) Resolution Logic Short Course 2017 12 / 82 Proof by resolution Definition A resolution refutation of S is a resolution proof of empty clause from S. Theorem S is unsatisfiable iff there is a resolution refutation of S. Checking validity φ is valid, if :φ is unsatisfiable or there is a resolution refutation of :φ. Meghdad Ghari (IPM) Resolution Logic Short Course 2017 13 / 82 Proof by resolution In order to show that φ1; φ2; : : : ; φn j= ; we show that φ1 ^ φ2 ^ ::: ^ φn ^ : is unsatisfiable. 1 First, φ1 ^ φ2 ^ ::: ^ φn ^ : is converted into CNF. 2 Then, the resolution rule is applied to the resulting clauses. 3 The process continues until one of two things happens: I two clauses resolve to yield the empty clause , in which case φ1; φ2; : : : ; φn j= . I there are no new clauses that can be added, in which case φ1; φ2; : : : ; φn 6j= ; Meghdad Ghari (IPM) Resolution Logic Short Course 2017 14 / 82 Resolution algorithm /* Input: A set of clauses S */ /* Output: S is satisfiable or unsatisfiable */ while there are clauses C1; C2 2 S and C := Res(C1; C2) such that C 62 S do S := S [ fCg If 2 S then return unsatisfiable else (i.e. if 62 S) return satisfiable. Meghdad Ghari (IPM) Resolution Logic Short Course 2017 15 / 82 Example I We prove that j= :(p _ q) ! (:p ^ :q): To this end, we show that :[:(p _ q) ! (:p ^ :q)] (1) is unsatisfiable. The CNF of (1) is: :p ^ :q ^ (p _ q); and in clausal form: ff:pg; f:qg; fp; qgg: The following is a resolution refutation of it: f:pg fp; qg fqg f:qg Meghdad Ghari (IPM) Resolution Logic Short Course 2017 16 / 82 Example II We show that p 6j= p ^ q: To this end, we show that p ^ :(p ^ q) (2) is satisfiable. The CNF of (2) is: p ^ (:p _:q); and in clausal form: S = ffpg; f:p; :qgg: Using resolution algorithm we update S as follows: 1 fpg a clause of S 2 f:p; :qg a clause of S 3 f:qg resolvent of clauses 1 and 2 S is satisfiable, since there are no new resolvents that can be added and 62 S. Meghdad Ghari (IPM) Resolution Logic Short Course 2017 17 / 82 Resolution refutation as a tree In order to prove that (p ! (q ! r)) ! ((p ! q) ! (p ! r)) is valid, we show that its negation is unsatisfiable. The following is a resolution refutation tree of its negation: ¨H ¨ H ¨¨ HH ¨¨ HH p¯ p @ @ @ @ p¯q¯ pq¯ ¡A ¡ A ¡ A ¡ A p¯qr¯ ¯r p¯ denotes :p. pq¯ denotes the clause f:p; qg. Meghdad Ghari (IPM) Resolution Logic Short Course 2017 18 / 82 Exercise By the resolution algorithm show that: 1 :(p !:q) j= p. Counterexample in natural language: it is not the case that if it is raining then the ground is not wet j= it is raining. 2 p ! q 6j= :(p !:q). Counterexample in natural language: if it is raining then the ground is wet j= it is not the case that if it is raining then the ground is not wet. Meghdad Ghari (IPM) Resolution Logic Short Course 2017 19 / 82 Ontological commitment Ontological commitment: what the logic assumes about the nature of reality: propositional logic assumes that there are facts that either hold or do not hold in the world. First-order logic assumes that the world consists of objects with certain relations among them that do or do not hold. Meghdad Ghari (IPM) Resolution Logic Short Course 2017 20 / 82 Language Objects: people, houses, numbers, theories, Ronald McDonald, colors, baseball games, wars, centuries . Relations: these can be unary relations or properties such as red, round, prime, . ., or more general n-ary relations such as brother of, bigger than, inside, part of, has color, occurred after, owns, comes between, . Functions: father of, best friend, one more than, beginning of . Meghdad Ghari (IPM) Resolution Logic Short Course 2017 21 / 82 Language Variables: V = fx1; x2; x3;:::g Logical operators: L = f?; :; _; ^; !; 8x; 9x; =gx2V for x 2 V First order language: L(R; F; C) = L [R[F[C R is a finite or countable set of relation symbols (or predicate symbols) of any arity. F is a finite or countable set of function symbols of any arity. C is a finite or countable set of constant symbols. Meghdad Ghari (IPM) Resolution Logic Short Course 2017 22 / 82 Language Terms (Tm): t ::= x j c j f (t; t;:::; t); where x 2 V; c 2 C; f 2 F: Formulas (Fml): φ ::= P(t; t;:::; t) j t = t j (:φ) j (φ ^ φ) j (φ _ φ) j (φ ! φ) j (8x)φ j 9xφ, where P 2 R; t 2 Tm; x 2 V Meghdad Ghari (IPM) Resolution Logic Short Course 2017 23 / 82 Examples Natural language Logical formula John walks W (j) John sees Mary S(j; m) John gives Mary the book G(j; m; b) He walks W (x) John sees her S(j; x) Someone walks 9xW (x) Some boy walks 9x(B(x) ^ W (x)) Everyone walks 8xW (x) Every girl sees Mary 8x(G(x) ! S(x; m)) Someone creates everythings 9x8yC(x; y) Natural language processing Computers translate Meghdad Ghari (IPM) Resolution Logic Short Course 2017 24 / 82 First Order Theories First order logic is a framework to formalize mathematical theories.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages99 Page
-
File Size-