Resolution for Predicate Logic

Similar documents
Normal Forms for First-Order Logic

The non-logical symbols determine a specific F OL language and consists of the following sets. Σ = {Σ n } n<ω

First-Order Logic. Resolution

1 Introduction to Predicate Resolution

Introduction to Logic in Computer Science: Autumn 2007

Syntax of FOL. Introduction to Logic in Computer Science: Autumn Tableaux for First-order Logic. Syntax of FOL (2)

INF3170 / INF4171 Notes on Resolution

Closed Book Examination. Two hours UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE. M.Sc. in Advanced Computer Science


Resolution for Predicate Logic

Logic and Computation

Technische Universität München Summer term 2011 Theoretische Informatik Prof. Dr. Dr. h.c J. Esparza / M. Luttenberger / R.

Computational Logic Automated Deduction Fundamentals

Resolution for mixed Post logic

Outline. Logic. Definition. Theorem (Gödel s Completeness Theorem) Summary of Previous Week. Undecidability. Unification

First-Order Logic. 1 Syntax. Domain of Discourse. FO Vocabulary. Terms

Inference in first-order logic

Tecniche di Verifica. Introduction to Propositional Logic

Definite Logic Programs: Derivation and Proof Trees. CSE 505 Computing with Logic Stony Brook University

Advanced Topics in LP and FP

Propositional Logic Language

Automated Reasoning in First-Order Logic

Handout Proof Methods in Computer Science

Propositional and Predicate Logic - V

First-Order Theorem Proving and Vampire

Tutorial 1: Modern SMT Solvers and Verification

07 Equational Logic and Algebraic Reasoning

Theory Combination. Clark Barrett. New York University. CS357, Stanford University, Nov 2, p. 1/24

Herbrand Theorem, Equality, and Compactness

T -resolution: Refinements and Model Elimination

Syntax. Notation Throughout, and when not otherwise said, we assume a vocabulary V = C F P.

Inference in first-order logic

Computational Logic. Davide Martinenghi. Spring Free University of Bozen-Bolzano. Computational Logic Davide Martinenghi (1/26)

7.5.2 Proof by Resolution

Resolution for predicate logic

Lecture 12 September 26, 2007

Chapter 3 Deterministic planning

First-Order Theorem Proving and Vampire. Laura Kovács (Chalmers University of Technology) Andrei Voronkov (The University of Manchester)

Warm-Up Problem. Is the following true or false? 1/35

Some Rewriting Systems as a Background of Proving Methods

Cooperation of Background Reasoners in Theory Reasoning by Residue Sharing

Propositional Logic: Models and Proofs

Mathematical Foundations of Logic and Functional Programming

CHAPTER 10. Predicate Automated Proof Systems

Two hours. Examination definition sheet is available at the back of the examination. UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE

Cooperation of Background Reasoners in Theory Reasoning by Residue Sharing

a. (6.25 points) where we let b. (6.25 points) c. (6.25 points) d. (6.25 points) B 3 =(x)[ H(x) F (x)], and (11)

SLD-Resolution And Logic Programming (PROLOG)

Inference in first-order logic

Kreisel s Conjecture with minimality principle

COMP9414: Artificial Intelligence First-Order Logic

Convert to clause form:

Completeness in the Monadic Predicate Calculus. We have a system of eight rules of proof. Let's list them:

CTL-RP: A Computational Tree Logic Resolution Prover

Title: Logical Agents AIMA: Chapter 7 (Sections 7.4 and 7.5)

CS2742 midterm test 2 study sheet. Boolean circuits: Predicate logic:

7. Propositional Logic. Wolfram Burgard and Bernhard Nebel

A Lower Bound for Boolean Satisfiability on Turing Machines

Normal Forms of Propositional Logic

CMPS 217 Logic in Computer Science. Lecture #17

A Tableau Calculus for Minimal Modal Model Generation

First-Order Logic First-Order Theories. Roopsha Samanta. Partly based on slides by Aaron Bradley and Isil Dillig

Math 225A Model Theory. Speirs, Martin

A Resolution Decision Procedure for the Guarded Fragment with Transitive Guards

AAA615: Formal Methods. Lecture 2 First-Order Logic

Equational Logic. Chapter Syntax Terms and Term Algebras

Mathematical Logic (IX)

CHAPTER 2. FIRST ORDER LOGIC

Chapter 3. SLD-Resolution. 3.1 Informal Introduction

3 Propositional Logic

Computational Logic. Davide Martinenghi. Spring Free University of Bozen-Bolzano. Computational Logic Davide Martinenghi (1/30)

Strong AI vs. Weak AI Automated Reasoning

Unification and occur check. The programming language Prolog

hal , version 1-21 Oct 2009

Logic as a Tool Chapter 4: Deductive Reasoning in First-Order Logic 4.4 Prenex normal form. Skolemization. Clausal form.

Clausal Presentation of Theories in Deduction Modulo

Logic for Computer Scientists

8 General first order representation

A MODEL-THEORETIC PROOF OF HILBERT S NULLSTELLENSATZ

Ackermann s Function

4 Predicate / First Order Logic

A Lower Bound of 2 n Conditional Jumps for Boolean Satisfiability on A Random Access Machine

Propositional Resolution

CS 730/830: Intro AI. 3 handouts: slides, asst 6, asst 7. Wheeler Ruml (UNH) Lecture 12, CS / 16. Reasoning.

What are the recursion theoretic properties of a set of axioms? Understanding a paper by William Craig Armando B. Matos

CogSysI Lecture 8: Automated Theorem Proving

Halting and Equivalence of Program Schemes in Models of Arbitrary Theories

MODELLING AND VERIFICATION ANALYSIS OF A TWO SPECIES ECOSYSTEM VIA A FIRST ORDER LOGIC APPROACH

Peano Arithmetic. CSC 438F/2404F Notes (S. Cook) Fall, Goals Now

First-order resolution for CTL

Division of Informatics, University of Edinburgh

Foundations of Artificial Intelligence

G52DOA - Derivation of Algorithms Predicate Logic

CS 730/730W/830: Intro AI

Foundations of Artificial Intelligence

C-clause calculi and refutation search in first-order classical logic

Logic for Computer Scientists

Satisfiability Modulo Theories

Seminaar Abstrakte Wiskunde Seminar in Abstract Mathematics Lecture notes in progress (27 March 2010)

Peano Arithmetic. by replacing the schematic letter R with a formula, then prefixing universal quantifiers to bind

Transcription:

Logic and Proof Hilary 2016 James Worrell Resolution for Predicate Logic A serious drawback of the ground resolution procedure is that it requires looking ahead to predict which ground instances of clauses will be needed in a proof. In this lecture we introduce the predicate-logic version of resolution, which allows us to perform substitution by need. This relies on the notion of unification, which we introduce next. 1 Unification A substitution is a function θ from the set of σ-terms back to itself such that (writing function application on the right) cθ = c for each constant symbol c and f(t 1,..., t k )θ = f(t 1 θ,..., t k θ) for each k-ary function symbol f. It is clear that the composition of two such substitutions (as functions) is also a substitution. We have previously considered substitutions of the form [t/x] for a σ-term t and variable x. We write composition of substitutions diagrammatically, that is, θ θ denotes the substitution obtained by applying θ first and then θ. (This convention matches the fact that for substitutions we write function application on the right.) In particular [t 1 /x 1 ] [t k /x x ] denotes the substitution obtained by sequentially applying the substitutions [t 1 /x 1 ],..., [t k /x k ] left-to-right. Given a set of literals D = {L 1,..., L k } and a substitution θ, define Dθ := {L 1 θ,..., L k θ}. We say that θ unifies D if Dθ = {L} for some literal L. For example, the substitution θ = [f(a)/x][a/y] unifies {P (x), P (f(y))}, as does the substitution θ = [f(y)/x]. In this example we regard θ as a more general unifier because θ = θ [a/y], that is, θ factors through θ. We say that θ is a most general unifier of a set of literals D if θ is a unifier of D and any other unifier θ factors through θ, i.e., we have θ = θ θ for some substitution θ. Note that both the substitutions [x/y] and [y/x] are both most general unifiers of {P (x), P (y)} (in fact most-general unifiers are only unique up to renaming variables). We will show that a set of literals either has no unifier or it has a most general unifier. Examples of sets of literals that cannot be unified are {P (f(x)), P (g(x))} and {P (f(x)), P (x))}. The problem in the second case is that we cannot unify a variable x and term t if x occurs in t. Theorem 1 (Unification Theorem). A unifiable set of literals D has a most general unifier. Proof. We claim that the following algorithm determines whether a set of literals has a unifier and, if so, outputs a most general unifier. Unification Algorithm Input: Set of literals D Output: Either a most general unifier of D or fail θ := identity substitution while θ is not a unifier of D do begin pick two distinct literals in Dθ and find the left-most positions at which they differ 1

if one of the corresponding sub-terms is a variable x and the other a term t not containing x then θ := θ [t/x] else output fail and halt end We argue termination as follows. In any iteration of the while loop that does not cause the program to halt, a variable x is replaced everywhere in Dθ by a term t that does not contain x. Thus the number of different variables occurring in Dθ decreases by one in each iteration, and the loop must terminate. The loop invariant is that for any unifier θ of D we have θ = θ θ. Clearly the invariant is established by the initial assignment of the identity substitution to θ. To see that the invariant is maintained by an iteration of the loop, suppose we find an occurrence of variable x in a literal in Dθ such that a different term t occurs in the same position in another literal in Dθ. From the invariant we know that θ is a unifier of Dθ, and thus tθ = xθ. It immediately follows that θ = [t/x] θ. Thus the loop invariant is maintained by the assignment θ := θ [t/x]. The termination condition of the while loop is that θ is a unifier of D. In conjunction with the loop invariant this implies that the final value of θ is a most general unifier of D. Finally, the invariant implies that if θ is a unifier of D then it is also a unifier of Dθ. But the algorithm only outputs fail if Dθ has no unifier, in which case D has no unifier. Example 2. Consider an execution of the unification algorithm on input D = {P (x, y), P (f(z), x)}. Scanning left-to-right, the leftmost discrepancy is underlined in {P (x, y), P (f(z), x)}. Applying the substitution [f(z)/x] to D yields the set D = {P (f(z), y), P (f(z), f(z))}, where the underlined positions again indicate the leftmost discrepancy. Applying the substitution [f(z)/y] to D yields the singleton set {P (f(z), f(z))}. Thus [f(z)/x][f(z)/y] is a most general unifier of the set D. 2 Resolution First-order resolution operates on sets of clauses, that is, sets of sets of literals. Given a formula x 1... x n F in Skolem form we perform resolution on the clauses in the matrix F with the goal of deriving the empty clause. Although quantifiers do not explicitly appear in resolution proofs, we can see the variables in such a proof as being implicitly universally quantified. This is made more formal when we formulate the Resolution Lemma in the next section. For any set of literals D, let D denote the set of complementary literals. D = { P (x), R(x, y)} then D = {P (x), R(x, y)}. For example, if Definition 3 (Resolution). Let C 1 and C 2 be clauses with no variable in common. We say that a clause R is a resolvent of C 1 and C 2 if there are sets of literals D 1 C 1 and D 2 C 2 such that D 1 D 2 has a most general unifier θ, and R = (C 1 θ \ {L}) (C 2 θ \ {L}), (1) where L = D 1 θ and L = D 2 θ. More generally, if C 1 and C 2 are arbitrary clauses, we say that R is a resolvent of C 1 and C 2 if there are variable renamings θ 1 and θ 2 such that C 1 θ 1 and C 2 θ 2 have no variable in common, and R is a resolvent of C 1 θ 1 and C 2 θ 2 according to the definition above. Example 4. Consider a signature with constant symbol e, unary function symbols f and g, and a ternary predicate symbol P. We compute a resolvent of the clauses C 1 = { P (f(e), x, f(g(e)))} 2

{ P (f(e), x, f(g(e)))} [u/x] { P (f(e), u, f(g(e)))} [e/x][u/y][g(e)/z] { P (x, y, z), P (f(x), y, f(z))} { P (e, u, g(e))} Figure 1: First-order resolution example and C 2 = { P (x, y, z), P (f(x), y, f(z))} as follows (see Figure 1). First apply the substitution [u/x] to C 1, obtaining a clause C 1 that has no variable in common in C 2. Now unify complementary literals under the substitution [e/x][u/y][g(e)/z], obtaining the clause { P (e, u, g(e))}. A predicate-logic resolution derivation of a clause C from a set of clauses F is a sequence of clauses C 1,..., C m, with C m = C such that each C i is either a clause of F (possibly with the variables renamed) or follows by a resolution step from two preceding clauses C j, C k, with j, k < i. We write Res (F ) for the set of clauses C such that there is a derivation of C from F. Example 5. Consider the following sentences over a signature with ternary predicate symbol A, constant symbol e, and unary function symbol s. The idea is that A represents the ternary addition relation, e the zero element, and s the successor function. F 1 : x A(e, x, x) F 2 : x y z ( A(x, y, z) A(s(x), y, s(z))) F 3 : x y A(s(s(e)), x, y) We use first-order resolution to show that F 1 F 2 = F 3, that is, we show that F 1 F 2 F 3 is unsatisfiable. We proceed in two steps. Step (i): separately Skolemise each formula. Formula F 3 is equivalent to y z A(s(s(e)), y, z). Skolemising, we obtain the formula G 3 := z A(s(s(e)), c, z), where c is a new constant symbol. Now F 1 F 2 G 3 is equisatisfiable with F 1 F 2 F 3 and so it suffices to give a resolution refutation of F 1 F 2 G 3. 1 Step (ii). derive the empty clause using resolution. The proof is as follows. Note that in order to always ensure that we resolve clauses with disjoint variables, we arrange it so that the variables in line k of the proof are subscripted with k. In particular, we add a variable renaming at the end of each unifying substitution so that the variables in the output formula have the right subscript for the next line of the proof. 1 Formally the notion of a resolution proof assumes a single Skolem-form formula. So strictly speaking the proof below is a resolution refutation of the formula x y z(a(e, x, x) (( A(x, y, z) A(s(x), y, s(z))) A(s(s(e)), x, y)), which is logically equivalent to F 1 F 2 G 3. 3

1. { A(s(s(e)), c, z 1 )} clause of G 3 2. { A(x 2, y 2, z 2 ), A(s(x 2 ), y 2, s(z 2 ))} clause of F 2 3. { A(s(e), c, z 3 )} 1,2 Res. Sub [s(e)/x 2 ][c/y 2 ][s(z 2 )/z 1 ][z 3 /z 2 ] 4. { A(e, c, z 4 )} 2,3 Res. Sub [e/x 2 ][c/y 2 ][s(z 2 )/z 3 ][z 4 /z 3 ] 5. {A(e, y 5, y 5 )} clause of F 1 6. 4,5 Res. Sub [c/y 5 ][c/z 4 ] Given a formula H with free variables x 1, x 2,..., x n, its universal closure H is the sentence x 1 x 2... x n H. The following lemma is key to the soundness of resolution. Lemma 6 (Resolution Lemma). Let F = x 1... x n G be a closed formula in Skolem form, with G quantifier-free. Let R be a resolvent of two clauses in G. Then F (G {R}). Proof. Clearly (G {R}) = F. The non-trivial direction is to show that F = R. For this, since F is closed, it suffices to show that F = R. (Check that you understand why this is so!) To this end, suppose that R is a resolvent of clauses C 1, C 2 G, with R = (C 1 θ \ {L}) (C 2 θ \ {L}) for some substitutions θ, θ and complementary literals L C 1 θ and L C 2 θ. Let A be an assignment that satisfies F = G. Since C 1, C 2 G, by the Translation Lemma A = C 1 θ and A = C 2 θ. Moreover, since A satisfies at most one of the complementary literals L and L, it follows that A satisfies at least one of C 1 θ \ {L} and C 2 θ \ {L}. We conclude that A satisfies R, as required. Corollary 7 (Soundness). Let F = x 1... x n G be a closed formula in Skolem form. Let clause C be obtained from G by a resolution derivation. Then F (G C). Proof. Induction on the length of the resolution derivation, using the Resolution Lemma for the induction step. A Refutation Completeness In this appendix we prove the refutation completeness of predicate-logic resolution proofs by showing that ground resolution proofs lift to predicate-logic resolution proofs. The proofs here are more technical and can be regarded as optional. Lemma 8 (Lifting Lemma). Let C 1 and C 2 be clauses with respective ground instances G 1 and G 2. Suppose that R is a propositional resolvent of G 1 and G 2. Then C 1 and C 2 have a predicate-logic resolvent R such that R is a ground instance of R. Proof. The situation of the lemma is shown in Figure 2. We can write the ground resolvent R in the form R = (G 1 \ {L}) (G 2 \ {L}), for complementary literals L G 1 and L G 2. Let C 1 and C 2 be variable-disjoint renamings of C 1 and C 2, cf. Figure 2. Then G 1 and G 2 are also ground instances of C 1 and C 2. Thus we can write G 1 = C 1 θ and G 2 = C 2 θ for some ground substitution θ. Let D 1 C 1 be the set of literals mapped to the literal L by θ and let D 2 C 2 be the set of literals mapped to the literal L by θ. Then θ is a unifier of D 1 D 2. Writing θ for the most general unifier of D 1 D 2, we have that R := (C 1θ \ D 1 θ) (C 2θ \ D 2 θ) (2) 4

C 1 C 2 C 1 C 2 G 1 G 2 C 1 C 2 R R Figure 2: Ground resolution step on the left, and its predicate-logic lifting on the right. is a predicate-logic resolvent of C 1 and C 2. Now we know from the proof of the Unification Lemma that θ = θθ. Thus we have Now from (2) we have that G 1 = C 1θ = C 1θθ and G 2 = C 2θ = C 2θθ. R θ = (C 1θθ \ D 1 θθ ) (C 2θθ \ D 2 θθ ) = (G 1 \ {L}) (G 2 \ {L}). (Note that the first equality uses the fact that D 1 θ is precisely the set of literals in C 1 θ that map to L under θ and similarly D 2 θ is precisely the set of literals in C 2 θ that map to L under θ.) We conclude that R is a ground instance of R under the substitution θ. Corollary 9 (Completeness). Let F be a closed formula in Skolem form with its matrix F in CNF. If F is unsatisfiable then there is a predicate-logic resolution proof of from F. Proof. Suppose F is unsatisfiable. By the completeness of ground resolution there is a proof C 1, C 2,..., C n, where C n = and each C i is either a ground instance of a clause in F or is a resolvent of two clauses C j, C k for j, k < i. We inductively define a corresponding predicate-logic resolution proof C 1, C 2,..., C n, such that C i is a ground instance of C i. For each i, if C i is a ground instance of a clause C F then define C i = C. On the other hand, suppose that C i is a resolvent of two ground clauses C j, C k, with j, k < i. By induction we have constructed clauses C j and C k such that C j is a ground instance of C j and C k is a ground instance of C k. By the Lifting Lemma we can find a clause C i which is a resolvent of C j and C k such that C i is a ground instance of C i. 5