Presentation is loading. Please wait.

Presentation is loading. Please wait.

Logic seminar 4 Herbrand’s theorem 07.11.2005. Slobodan Petrović.

Similar presentations


Presentation on theme: "Logic seminar 4 Herbrand’s theorem 07.11.2005. Slobodan Petrović."— Presentation transcript:

1 Logic seminar 4 Herbrand’s theorem 07.11.2005. Slobodan Petrović

2 Herbrand’s theorem A general decision procedure to verify the validity (inconsistency) of a formula: –Tried by Leibnitz, Peano, Hilbert, … –Proved inexistent by Church and Turing (1936) Church and Turing independently showed that there is no general decision procedure to check the validity of formulas of the first order logic.

3 Herbrand’s theorem There are, however, proof procedures which can verify that a formula is valid if it is valid indeed. For invalid formulas, these procedures never terminate in general. This is the best that one can expect from a proof procedure.

4 Herbrand’s theorem By definition, a valid formula is a formula that is true under all interpretations. Herbrand (1930) developed an algorithm to find an interpretation (if it exists) that can falsify a given formula. If the given formula is indeed valid, no such interpretation can exist and Herbrand’s algorithm halts after a finite number of trials.

5 Herbrand’s theorem Herbrand’s procedure is a refutation procedure. Instead of proving a formula valid, it proves that the negation of the formula is inconsistent. There is no loss of generality in using refutation procedures. The refutation procedures are applied to a “standard” form of a formula.

6 Herbrand’s theorem The standard form: –A formula of the first order logic is transformed into prenex normal form: The matrix contains no quantifiers The prefix is a sequence of quantifiers. –The matrix is transformed into a conjunctive normal form. –The existential quantifiers in the prefix are eliminated by using Skolem functions.

7 Herbrand’s theorem Skolem standard form (standard form) –Let a formula F be already in a prenex normal form (Q 1 x 1 )…(Q n x n )M, where M is in a conjunctive normal form. –Let Q r be an existential quantifier in the prefix (Q 1 x 1 )…(Q n x n ), 1≤r≤n.

8 Herbrand’s theorem Skolem standard form (cont.) –If no universal quantifier appears before Q r, we do the following: choose a new constant c different from other constants occurring in M; replace all x r appearing in M by c; delete (Q r x r ) from the prefix.

9 Herbrand’s theorem Skolem standard form (cont.) –If Q s 1,…,Q s m are all the universal quantifiers appearing before Q r, 1≤s 1 ≤s 2 ≤…≤s m ≤r, we do the following: choose a new m-place function symbol f different from other function symbols occurring in M; replace all x r appearing in M by f(x s 1,x s 2,…,x s m ); delete (Q r x r ) from the prefix.

10 Herbrand’s theorem Skolem standard form (cont.) –After this process is applied to all the existential quantifiers in the prefix, a Skolem standard form of the formula F is obtained. –The constants and functions used to replace the existential variables are called Skolem functions. –This process is called Skolemization.

11 Herbrand’s theorem Example –Obtain a standard form of the formula (  x)(  y)(  z)(  u)(  v)(  w)P(x,y,z,u,v,w) –(  x) is preceded by no universal quantifiers, (  u) is preceded by (  y) and (  z), and (  w) by (  y), (  z) and (  v). –Therefore, we replace the existential variable x by a constant a, u by a two-place function f(y,z), and w by a three-place function g(y,z,v). –The standard form of the formula is (  y)(  z)(  v)P(a,y,z,f(y,z),v,g(y,z,v)).

12 Herbrand’s theorem Example –Obtain a standard form of the formula (  x)(  y)(  z)((~P(x,y)  Q(x,z))  R(x,y,z)). –First, the matrix is transformed into a conjunctive normal form: (  x)(  y)(  z)((~P(x,y)  R(x,y,z))  (Q(x,z)  R(x,y,z))). –Then, since (  y) and (  z) are both preceded by (  x), the existential variables y and z are replaced, respectively by one-place functions f(x) and g(x). –The standard form of the formula is (  x)((~P(x,f(x))  R(x,f(x),g(x)))  (Q(x,g(x))  R(x,f(x),g(x)))).

13 Herbrand’s theorem Definition –A clause is a disjunction of literals. When it is convenient, it is possible to regard a set of literals as synonymous with a clause. Example –P  Q  ~R={P,Q,~R} A clause consisting of r literals is called an r-literal clause. A one-literal clause is called a unit clause.

14 Herbrand’s theorem When a clause contains no literal, it is called the empty clause. Since the empty clause has no literal that can be satisfied by an interpretation, the empty clause is always false. The empty clause is denoted by □. Example – the clauses are –~P(x,f(x))  R(x,f(x),g(x)) –Q(x,g(x))  R(x,f(x),g(x)).

15 Herbrand’s theorem A set S of clauses is regarded as a conjunction of all clauses in S. Every variable in S is considered governed by a universal quantifier. Thus, a standard form can be represented by a set of clauses.

16 Herbrand’s theorem Example –The standard form of the formula (  x)((~P(x,f(x))  R(x,f(x),g(x)))  (Q(x,g(x))  R(x,f(x),g(x)))) –can be represented by a set of clauses {~P(x,f(x))  R(x,f(x),g(x)), Q(x,g(x))  R(x,f(x),g(x))}. Theorem –Let S be a set of clauses that represents a standard form of a formula F. –Then F is inconsistent if and only if S is inconsistent.

17 Herbrand’s theorem Let S be a standard form of a formula F. If F is inconsistent, then F=S. If F is not inconsistent, F is not equivalent to S in general. Example –F=(  x)P(x), –S=P(a). –S is a standard form of F.

18 Herbrand’s theorem Example (cont.) –The interpretation I: Domain: D={1,2} Assignment for P: P(1)=F, P(2)=T. –F is true in I, but S is false in I. That is, F  S. A formula may have more than one standard form. When a formula F is transformed into a standard formula S, existential quantifiers should be replaced by the simplest possible Skolem functions – with the least number of arguments.

19 Herbrand’s theorem Existential quantifiers should be moved to the left as far as possible. If F=F 1  …  F n, it is possible to separately obtain a set S i of clauses, where S i represents a standard form of F i, i=1,…,n. Let S=S 1  …  S n. Then F is inconsistent if and only if S is inconsistent.

20 Herbrand’s theorem Example –The theorem: If x  x=e for all x in group G, where  is a binary operator and e is the identity in G, then G is commutative. –We first symbolize the theorem and some other axioms of group theory. –Then we represent the negation of the theorem as a set of clauses.

21 Herbrand’s theorem Example (cont.) –The axioms of the group: A 1 : x,y  G implies that x  y  G (closure property) A 2 : x,y,z  G implies that x  (y  z)=(x  y)  z (associativity property) A 3 : x  e=e  x=x for all x  G (identity property) A 4 : For every x  G there exists an element x -1  G such that x  x -1 =x -1  x=e (inverse property).

22 Herbrand’s theorem Example (cont.) –Let P(x,y,z) stand for x  y=z and i(x) for x -1. –Then, the axioms of the group can be represented by: A 1 ’: (  x)(  y)(  z)P(x,y,z) A 2 ’: (  x)(  y)(  z)(  u)(  v)(  w)(P(x,y,u)  P(y,z,v)  P(u,z,w)  P(x,v,w))  (  x)(  y)(  z)(  u)(  v)(  w)(P(x,y,u)  P(y,z,v)  P(x,v,w)  P(y,z,w)) A 3 ’: (  x)P(x,e,x)  (  x)P(e,x,x) A 4 ’: (  x)P(x,i(x),e)  (  x)P(i(x),x,e).

23 Herbrand’s theorem Example (cont.) –The conclusion of the theorem: B: If x  x=e for all x  G, then G is commutative, i.e., u  v=v  u for all u,v  G. –B formalized: B’: (  x)P(x,x,e)  ((  u)(  v)(  w)(P(u,v,w)  P(v,u,w))). –The entire theorem is represented by the formula: F=A 1 ’  …  A 4 ’  B’. Thus, ~F=A 1 ’  A 2 ’  A 3 ’  A 4 ’  ~B’.

24 Herbrand’s theorem Example (cont.) –To obtain a set S of clauses for ~F, we first obtain a set S i of clauses for each axiom A i ’, i=1, 2, 3, 4: S 1 : {P(x,y,f(x,y))} S 2 : {~P(x,y,u)  ~P(y,z,v)  ~P(u,z,w)  P(x,v,w), ~P(x,y,u)  ~P(y,z,v)  ~P(x,v,w)  P(u,z,w)} S 3 : {P(x,e,x),P(e,x,x)} S 4 : {P(x,i(x),e),P(i(x),x,e)}.

25 Herbrand’s theorem Example (cont.) ~B’=~((  x)P(x,x,e)  ((  u)(  v)(  w)(P(u,v,w)  P(v,u,w) ))) =~(~(  x)P(x,x,e)  ((  u)(  v)(  w)(~P(u,v,w)  P(v,u,w)))) =(  x)P(x,x,e)  ~((  u)(  v)(  w)(~P(u,v,w)  P(v,u,w))) =(  x)P(x,x,e)  (  u)(  v)(  w)(P(u,v,w)  ~P(v,u,w)). –A set of clauses for ~B’: T: {P(x,x,e),P(a,b,c),~P(b,a,c)}.

26 Herbrand’s theorem Example (cont.) –The set S=S 1  S 2  S 3  S 4  T: (1) P(x,y,f(x,y)) (2) ~P(x,y,u)  ~P(y,z,v)  ~P(u,z,w)  P(x,v,w) (3) ~P(x,y,u)  ~P(y,z,v)  ~P(x,v,w)  P(u,z,w) (4) P(x,e,x) (5) P(e,x,x) (6) P(x,i(x),e) (7) P(i(x),x,e) (8) P(x,x,e) (9) P(a,b,c) (10) ~P(b,a,c).

27 Herbrand’s theorem F is valid if and only if S is inconsistent. Refutation procedures are used to prove theorems. The input to a refutation procedure is always a set of clauses. Instead of “inconsistent” (“consistent”) “unsatisfiable” (“satisfiable”) is used, respectively for sets of clauses.

28 Herbrand’s theorem The Herbrand universe of a set of clauses –A set of clauses S is unsatisfiable if and only if it is false under all interpretation over all domains. –It is impossible to consider all interpretations over all domains. –It would be desirable to have one special domain H such that S is unsatisfiable if and only if S is false under all the interpretations over this domain. –There exists such a domain – Herbrand universe of S.

29 Herbrand’s theorem The Herbrand universe of a set of clauses –Let H 0 be the set of constants appearing in S. –If no constant appears in S, then H 0 is to consist of a single constant, H 0 ={a}. –For i=0,1,2,… let H i+1 be the union of H i and the set of all terms of the form f n (t 1,…,t n ) for all n-place functions f n occurring in S, where t j, j=1,…,n, are members of the set H i. –H i is called the i-level constant set of S.

30 Herbrand’s theorem The Herbrand universe of a set of clauses –Example 1: S={P(a),  P(x)  P(f(x))} H 0 ={a} H 1 ={a,f(a)} H 2 ={a,f(a),f(f(a))}. H  ={a,f(a),f(f(a)),f(f(f(a))),…}

31 Herbrand’s theorem The Herbrand universe of a set of clauses –Example 2: S={P(x)  Q(x),R(z),T(y)  W(y)} There is no constant in S, so we let H 0 ={a} There is no function symbol in S, hence H=H 0 =H 1 =…={a} –Example 3: S={P(f(x),a,g(y),b)} H 0 ={a,b} H 1 ={a,b,f(a),f(b),g(a),g(b)} H 2 ={a,b,f(a),f(b),g(a),g(b),f(f(a)),f(f(b)),f(g(a)),f(g(b)),g(f(a )),g(f(b)),g(g(a)),g(g(b))} …

32 Herbrand’s theorem The Herbrand universe of a set of clauses –Expression – a term, a set of terms, an atom, a set of atoms, a literal, a clause, or a set of clauses. –When no variable appears in an expression, it is called a ground expression. –It is possible to use a ground term, a ground atom, a ground literal, and a ground clause – this means that no variable occurs in respective expressions. –A subexpression of an expression E is an expression that occurs in E.

33 Herbrand’s theorem The Herbrand universe of a set of clauses –Let S be a set of clauses. The set of ground atoms of the form P n (t 1,…,t n ) for all n-place predicates P n occurring in S, where t 1,…,t n are elements of the Herbrand universe of S, is called the atom set, or the Herbrand base of S. –A ground instance of a clause C of the set S of clauses is a clause obtained by replacing variables in C by members of the Herbrand universe of S.

34 Herbrand’s theorem The Herbrand universe of a set of clauses –Example S={P(x),Q(f(y))  R(y)} C=P(x) is a clause in S H={a,f(a),f(f(a)),…} is the Herbrand universe of S. P(a) and P(f(f(a))) are ground instances of C.

35 Herbrand’s theorem The Herbrand universe of a set of clauses –Let S be a set of clauses. –An interpretation over the Herbrand universe of S is an assignment of constants, function symbols and predicate symbols occurring in S.

36 Herbrand’s theorem The Herbrand universe of a set of clauses –Let S be a set of clauses, H the Herbrand universe of S and I an interpretation of S over H. I is an H- interpretation of S if: I maps all constants in S to themselves. Let f be an n-place function symbol and h 1,…,h n be elements of H. In I, f is assigned a function that maps (h 1,…,h n ) (an element in H n ) to f(h 1,…,h n ) (an element in H).

37 Herbrand’s theorem The Herbrand universe of a set of clauses –There is no restriction on the assignment to each n-place predicate symbol in S. –Let A={A 1,A 2,…,A n,…} be the atom set of S. –An H-interpretation I can be conveniently represented by a set I={m 1,m 2,…,m n,…} in which m j is either A j or ~A j for j=1,2,… –If m j is A j then A j is assigned “true”, otherwise A j is assigned “false”.

38 Herbrand’s theorem The Herbrand universe of a set of clauses –Example: S={P(x)  Q(x),R(f(y))} The Herbrand universe of S is H={a,f(a),f(f(a)),…}. Predicate symbols: P, Q, R. The atom set of S: –A={P(a),Q(a),R(a),P(f(a)),Q(f(a)),R(f(a)),…}. Some H-interpretations for S: –I 1 ={P(a),Q(a),R(a),P(f(a)),Q(f(a)),R(f(a)),…} –I 2 ={~P(a),~Q(a),~R(a),~P(f(a)),~Q(f(a)),~R(f(a)),…} –I 3 ={P(a),Q(a),~R(a),P(f(a)),Q(f(a)),~R(f(a)),…}

39 Herbrand’s theorem The Herbrand universe of a set of clauses –An interpretation of a set S of clauses does not necessarily have to be defined over the Herbrand universe of S. –Thus an interpretation may not be an H-interpretation. –Example: S={P(x),Q(y,f(y,a))} D={1,2}

40 Herbrand’s theorem The Herbrand universe of a set of clauses –Example (cont.) – an interpretation of S: af(1,1)f(1,2)f(2,1)f(2,2) 21221 P(1)P(2)Q(1,1)Q(1,2)Q(2,1)Q(2,2) TFFTFT

41 Herbrand’s theorem The Herbrand universe of a set of clauses –Example (cont.) – we can define an H-interpretation I* corresponding to I. –First we find the atom set of S A={P(a),Q(a,a),P(f(a,a)),Q(a,f(a,a)),Q(f(a,a),a),Q(f(a,a),f(a,a)),…} –Next we evaluate each member of A by using the given table P(a)=P(2)=F Q(a,a)=Q(2,2)=T P(f(a,a))=P(f(2,2))=P(1)=T Q(a,f(a,a))=Q(2,f(2,2))=Q(2,1)=F

42 Herbrand’s theorem The Herbrand universe of a set of clauses –Example (cont.) Q(f(a,a),a)=Q(f(2,2),2)=Q(1,2)=T Q(f(a,a),f(a,a))=Q(f(2,2),f(2,2))=Q(1,1)=T –H-interpretation I* corresponding to I –I*={~P(a),Q(a,a),P(f(a,a)),~Q(a,f(a,a)),Q(f(a,a),a), ~Q(f(a,a),f(a,a)),…}.

43 Herbrand’s theorem The Herbrand universe of a set of clauses –If there is no constant in S, the element a used to initiate the Herbrand universe of S can be mapped into any element of the domain D. –If there is more than one element in D, then there is more than one H-interpretation corresponding to I. –Example: S={P(x),Q(y,f(y,z))}, D={1,2}

44 Herbrand’s theorem The Herbrand universe of a set of clauses –Example (cont.): f(1,1)f(1,2)f(2,1)f(2,2) 1221 P(1)P(2)Q(1,1)Q(1,2)Q(2,1)Q(2,2) TFFTFT

45 Herbrand’s theorem The Herbrand universe of a set of clauses –Example (cont.): –Then the two H-interpretations corresponding to I are: I*={~P(a),Q(a,a),P(f(a,a)),~Q(a,f(a,a)),Q(f(a,a),a), ~Q(f(a,a),f(a,a)),…} if a=2, I*={P(a),~Q(a,a),P(f(a,a)),~Q(a,f(a,a)),~Q(f(a,a),a), ~Q(f(a,a),f(a,a)),…} if a=1.

46 Herbrand’s theorem The Herbrand universe of a set of clauses –Definition Given an interpretation I over a domain D, an H-interpretation I* corresponding to I is an H-interpretation that satisfies the condition: Let h 1,…,h n be elements of H (the Herbrand universe of S). Let every h i be mapped to some d i in D. If P(d 1,…,d n ) is assigned T (F) by I, then P(h 1,…,h n ) is also assigned T(F) in I*. –Lemma: If an interpretation I over some domain D satisfies a set S of clauses, then any H-interpretation I* corresponding to I also satisfies S.

47 Herbrand’s theorem The Herbrand universe of a set of clauses –Theorem A set S of clauses is unsatisfiable if and only if S is false under all the H-interpretations of S. –We need consider only H-interpretations for checking whether or not a set of clauses is unsatisfiable. –Thus, whenever the term “interpretation” is used, a H-interpretation is meant.

48 Herbrand’s theorem The Herbrand universe of a set of clauses –Let  denote an empty set. Then: A ground instance C’ of a clause C is satisfied by an interpretation I if and only if there is a ground literal L’ in C’ such that L’ is also in I, i.e. C’  I . A clause C is satisfied by an interpretation I if and only if every ground instance of C is satisfied by I. A clause C is falsified by an interpretation I if and only if there is at least one ground instance C’ of C such that C’ is not satisfied by I. A set S of clauses is unsatisfiable if and only if for every interpretation I there is at least one ground instance C’ of some clause C in S such that C’ is not satisfied by I.

49 Herbrand’s theorem The Herbrand universe of a set of clauses –Example: Consider the clause C=  P(x)  Q(f(x)). Let I 1, I 2, and I 3 be defined as follows: I 1 ={  P(a),  Q(a),  P(f(a)),  Q(f(a)),  P(f(f(a))),  Q(f(f(a))),…} I 2 ={P(a),Q(a),P(f(a)),Q(f(a)),P(f(f(a))),Q(f(f(a))),…} I 3 ={P(a),  Q(a),P(f(a)),  Q(f(a)),P(f(f(a))),  Q(f(f(a))),…} –C is satisfied by I 1 and I 2, but falsified by I 3. –Example: S={P(x),  P(a)}. The only two H-interpretations are: I 1 ={P(a)}, I 2 ={  P(a)}. –S is falsified by both H-interpretations and therefore is unsatisfiable.

50 Herbrand’s theorem Semantic trees –Introduced by Robinson, 1968. –It can be shown that finding a proof for a set of clauses is equivalent to generating a semantic tree. –Definition If A is an atom, then the two literals A and  A are said to be each other’s complement. The set {A,  A} is called a complementary pair. –A clause is a tautology if it contains a complementary pair.

51 Herbrand’s theorem Semantic trees –Definition Given a set S of clauses, let A be the atom set of S. A semantic tree for S is a (downward) tree T, where each link is attached with a finite set of atoms or negations of atoms from A in such a way that: –For each node N, there are only finitely many immediate links L 1,…,L n from N. Let Q i be the conjunction of all the literals in the set attached to L i, i=1,…,n. Then Q 1  Q 2  …  Q n is a valid propositional formula. –For each node N, let I(N) be the union of all the sets attached to the links of the branch of T down to and including N. Then I(N) does not contain any complementary pair.

52 Herbrand’s theorem Semantic trees –Definition Let A={A 1,A 2,…,A k,…} be the atom set of a set S of clauses. A semantic tree for S is said to be complete if and only if for every tip node N of the semantic tree, i.e. a node that has no links sprouting from it, I(N) contains either A i or  A i for i=1,2,… –Example: Let A={P,Q,R} be the atom set of a set S of clauses. Two examples of complete semantic trees for S:

53 Herbrand’s theorem Semantic trees –Example (cont.)

54 Herbrand’s theorem Semantic trees –Example (cont.)

55 Herbrand’s theorem Semantic trees –Example: S={P(x),P(a)} The atom set of S is {P(a)} A complete semantic tree for S: –Example: S={P(x),Q(f(x))} The atom set of S is {P(a),Q(a),P(f(a)),Q(f(a)),P(f(f(a))),Q(f(f(a))),…} A semantic tree for S:

56 Herbrand’s theorem Semantic trees –Example (cont.)

57 Herbrand’s theorem Semantic trees –For each node N in a semantic tree for S, I(N) is a subset of some interpretation for S. –I(N) is called partial interpretation for S. –When the atom set A of a set S of clauses is infinite, any complete semantic tree for S is infinite. –A complete semantic tree for S corresponds to an exhaustive survey of all possible interpretations for S. –If S is unsatisfiable, then S fails to be true in each of the interpretations. –We may stop expanding nodes from a node N if I(N) falsifies S.

58 Herbrand’s theorem Semantic trees –Definition – A node N is a failure node if I(N) falsifies some ground instance of a clause in S, but I(N’) does not falsify any ground instance of a clause in S for every ancestor node N’ of N. –Definition – A semantic tree T is said to be closed if and only if every branch of T terminates at a failure node. –A node N of a closed semantic tree is called an inference node if all the immediate descendant nodes of N are failure nodes.

59 Herbrand’s theorem Semantic trees –Example: Let S={P,Q  R,  P  Q,  P  R}. The atom set of S is A={P,Q,R}. A complete semantic tree for S:

60 Herbrand’s theorem Semantic trees –Example (cont.): A closed semantic tree for S:

61 Herbrand’s theorem Semantic trees –Example: Consider S={P(x),  P(x)  Q(f(x)),  Q(f(a))} The atom set of S: A={P(a),Q(a),P(f(a)),Q(f(a)),…} A closed semantic tree for S:

62 Herbrand’s theorem To test whether a set S of clauses is unsatisfiable, we need consider only interpretations over the Herbrand universe of S. If S is false under all interpretations over the Herbrand universe of S, then we can conclude that S is unsatisfiable. Since there are usually many, possibly an infinite number, of these interpretations, we should organize them in a systematic way – by using a semantic tree.

63 Herbrand’s theorem Herbrand’s theorem – Version 1 (a classical one). –A set S of clauses is unsatisfiable if and only if there is a finite unsatisfiable set S’ of ground instances of clauses of S. Herbrand’s theorem – Version 2 (with semantic trees) –A set S of clauses is unsatisfiable if and only if corresponding to every complete semantic tree of S, there is a finite closed semantic tree.

64 Herbrand’s theorem Example: –Let S={P(x),  P(f(a))}. –S is unsatisfiable. –Hence, by Herbrand’s theorem, there is a finite unsatisfiable set S’ of ground instances of clauses in S. –One of these sets is S’={P(f(a)),  P(f(a))}

65 Herbrand’s theorem Example: –Let S={  P(x)  Q(f(x),x),P(g(b)),  Q(y,z)} –S is unsatisfiable. –One of the unsatisfiable sets of ground instances of clauses in S: S’={  P(g(b))  Q(f(g(b)),g(b)),P(g(b)),  Q(f(g(b)),g(b))}

66 Herbrand’s theorem Example: –Let S consist of the following clauses: S={  P(x,y,u)  P(y,z,v)  P(x,v,w)  P(u,z,w),  P(x,y,u)  P(y,z,v)  P(u,z,w)  P(x,v,w), P(g(x,y),x,y),P(x,h(x,y),y),P(x,y,f(x,y)),  P(k(x),x,k(x))} –S is unsatisfiable. –It is not easy to find by hand a finite unsatisfiable set S’ of ground instances of clauses in S.

67 Herbrand’s theorem Example (cont.): –One way to find such a set S’ is to generate a closed semantic tree T’ for S. –Then the set S’ of all the ground instances falsified at all the failure nodes of T’ is such a desired set. –Each ground clause in S’ is a ground instance of some clause in S. –S’ is unsatisfiable.

68 Herbrand’s theorem Example (cont.): –The set S’: S’={P(a,h(a,a),a),  P(k(h(a,a)),h(a,a),k(h(a,a))), P(g(a,k(h(a,a))),a,k(h(a,a))),  P(g(a,k(h(a,a))),a,k(h(a,a)))  P(a,h(a,a),a)  P(g(a,k(h(a,a))),a,k(h(a,a)))  P(k(h(a,a)),h(a,a),k(h(a,a)))}

69 Herbrand’s theorem Implementations of Herbrand’s theorem –The classical version of the Herbrand’s theorem suggests a refutation procedure. –Given an unsatisfiable set of clauses to prove, if there is a mechanical procedure that can successively generate sets S 1 ’,…S n ’,… of ground instances of clauses in S and can successively test S 1 ’,S 2 ’,… for unsatisfiability, then it is guaranteed by Herbrand’s theorem that this procedure can detect a finite N such that S n ’ is unsatisfiable.

70 Herbrand’s theorem Gilmore’s implementation –In 1960, Gilmore wrote a computer program that successively generated S 0 ’,S 1 ’,…, where S i ’ is the set of all the ground instances obtained by replacing variables in S by the constants in the i-level constant set H i of S. –Since each S i ’ is a conjunction of ground clauses, it is possible to use any method of the propositional logic to check its unsatisfiability.

71 Herbrand’s theorem Gilmore’s implementation (cont.) –Gilmore used the multiplication method. –As each S i ’ is produced, it is multiplied out into a disjunctive normal form. –Any conjunction in the disjunctive normal form containing a complementary pair is removed. –Should some S i ’ be empty, then S i ’ is unsatisfiable and a proof is found.

72 Herbrand’s theorem Gilmore’s implementation (cont.) –Example: S={P(x),  P(a)}. H 0 ={a} S 0 ’=P(a)  P(a)=□. Thus S is proved to be unsatisfiable.

73 Herbrand’s theorem Gilmore’s implementation (cont.) –Example: S={P(a),  P(x)  Q(f(x)),  Q(f(a))}. H 0 ={a} S 0 ’=P(a)  (  P(a)  Q(f(a)))  Q(f(a)) =(P(a)  P(a)  Q(f(a)))  (P(a)  Q(f(a))  Q(f(a))) =□  □=□. Thus S is proved to be unsatisfiable.

74 Herbrand’s theorem Gilmore’s implementation (cont.) –The multiplication method used by Gilmore is inefficient. –Even for a small set of ten two-literal ground clauses, there are 2 10 conjunctions.

75 Herbrand’s theorem The method of Davis and Putnam –Let S be a set of ground clauses. –The method of Davis and Putnam consists of four rules: Tautology: –Delete all the ground clauses from S that are tautologies. The remaining set S’ is unsatisfiable if and only if S is. One-literal rule: –If there is a unit ground clause L in S, obtain S’ from S by deleting those ground clauses in S containing L. If S’ is empty, S is satisfiable. Otherwise, obtain a set S’’ from S’ by deleting  L from S’. S’’ is unsatisfiable if and only if S is. If  L is a unit ground clause, then the clause becomes □ when  L is deleted from it.

76 Herbrand’s theorem The method of Davis and Putnam –The method of Davis and Putnam rules (cont.): Pure-literal rule: –A literal L in a ground clause of S is said to be pure in S if and only if the literal  L does not appear in any ground clause in S. If a literal L is pure in S, delete all the ground clauses containing L. The remaining set S’ is unsatisfiable if and only if S is.

77 Herbrand’s theorem The method of Davis and Putnam –The method of Davis and Putnam rules (cont.): Splitting rule: –If the set S can be put into the form: (A 1  L)  …  (A m  L)  (B 1  L)  …  (B n  L)  R, where A i, B i, and R are free of L and  L, then obtain the sets S 1 =A 1  …  A m  R and S 2 =B 1  …  B n  R. S is unsatisfiable if and only if (S 1  S 2 ) is unsatisfiable, i.e. both S 1 and S 2 are unsatisfiable.

78 Herbrand’s theorem The method of Davis and Putnam –Example: Show that S=(P  Q  R)  (P  Q)  P  R  U is unsatisfiable. (P  Q  R)  (P  Q)  P  R  U (Q  R)  (  Q)  R  U(One-literal rule on  P)  R  R  U(One-literal rule on  Q) □  U (One-literal rule on  R) –Since the last formula contains the empty clause □, S is unsatisfiable.

79 Herbrand’s theorem The method of Davis and Putnam –Example: Show that S=(P  Q)  Q  (  P  Q  R) is satisfiable. (P  Q)  Q  (  P  Q  R) P  (  P  R)(One-literal rule on  Q)  R(One-literal rule on P) ■ (One-literal rule on  R) –Thus, S is satisfiable.

80 Herbrand’s theorem The method of Davis and Putnam –Example: Show that S=(P  Q)  (  P  Q)  (Q  R)  (  Q  R) is satisfiable. (P  Q)  (  P  Q)  (Q  R)  (  Q  R) (  Q  (Q  R)  (  Q  R))  (Q  (Q  R)  (  Q  R))(Splitting rule on P)  R  R(One-literal rule on  Q and Q) ■  ■ (One-literal rule on  R) –Thus, S is satisfiable.

81 Herbrand’s theorem The method of Davis and Putnam –Example: Show that S=(P  Q)  (P  Q)  (R  Q)  (R  Q) is satisfiable. (P  Q)  (P  Q)  (R  Q)  (R  Q) (R  Q)  (R  Q)(Pure-literal rule on P) ■ (Pure-literal rule on R) –Thus, S is satisfiable.

82 Herbrand’s theorem The method of Davis and Putnam –The method of Davis and Putnam is more efficient than the Gilmore’s multiplication method. –This method can be applied to any formula in the propositional logic. –The procedure is: Transform the given propositional formula into a conjunctive normal form. Apply the four rules on the conjunctive normal form.


Download ppt "Logic seminar 4 Herbrand’s theorem 07.11.2005. Slobodan Petrović."

Similar presentations


Ads by Google