200 likes | 359 Views
Language, Proof and Logic. Advanced Topics in FOL. Chapter 18. 18.1. A first-order structure (sometimes called a model , or interpretation ) is a function M defined on the predicate and function symbols of the language, the names (constants),
E N D
Language, Proof and Logic Advanced Topics in FOL Chapter 18
18.1 A first-order structure (sometimes called a model, or interpretation) is a function M defined on the predicate and function symbols of the language, the names (constants), and the quantifier symbol , such that the following conditions are satisfied: First-order structures 1.M()is a nonempty set D, called the domain of discourse of M. • If P is an n-ary predicate symbol of the language, thenM(P)is an n-ary relation on • D (i.e., a set of n-tuples<x1,...,xn>of elements ofD). This relation is called the • extension of P in M. • It is required that the extension of the identity symbol is {<x,x> | xD}. 3. If f is an n-ary function symbol of the language, thenM(f)is an n-ary total function on D, i.e., an always-defined function of type DnD. This function is called the extension of P in M. This includes names (constants), which are nothing but 0-ary function symbols. We usually write PM instead of M(P), fM instead of M(f), and DM or just (when the structure is fixed in the context) D instead of M().
18.2.a LetM be a first-order structure with domain D. A variable assignment in M is, by definition, some (possibly partial) function g defined on a set of variables and taking values in D. Given a wffP, we say that the variable assignment g is appropriate for P if all the free variables of P are in the domain of g, that is, if g assigns objects to each free variable of P. Truth and satisfaction, revisited Where g is a variable assignment, g[v/] is the assignment whose domain is that of g plus the variable v, and which assigns the same values as g, except that the new assignment assigns to the variable v. Where g is a variable assignment appropriate for P and t is a term of P, the (M,g)-denotation of t in is defined inductively as follows: • If t is a variable, then the (M,g)-denotation of t is g(t); • If t is f(t1,…,tn),where f is an n-ary (n0) function symbol and t1,…,tn are • terms, then the (M,g)-denotation of t is fM(1,…,n), where 1,…,n are the • the (M,g)-denotations of t1,…,tn, respectively.
18.2.b Truth and satisfaction, revisited Letgbe a variable assignment in M appropriate for a given formula. Then satisfaction by g in M is defined by: • g satisfies an n-ary atom R(t1,...,tn)iff <1,...,n>RM, where each • i is the (M,g)-denotation of ti. • g satisfies Q iff g does not satisfy Q. • g satisfies QRiff g satisfies both Q and R. • g satisfies QRiff g satisfies Q or R or both. • g satisfies QRiff g does not satisfy Q or satisfies R or both. • g satisfies QRiff g satisfies both Q and R or neither. • g satisfies vQ iff for every DM, g[v/]satisfies Q. • g satisfies vQiff for some DM, g[v/] satisfies Q. We write M|= P[g] to indicate that g satisfies the wff P in M.
18.2.c Truth and satisfaction, revisited Let L be some FO language and let M be a structure for it. We say that a sentence S of L is true in M iff the empty(-domain) variable assignment gsatisfies S in M. Otherwise S is false in M. We say that a sentence S is a first-order consequence of a set of sentences iff every structure that makes all sentences in true also makes S true. We say that a sentence S is a first-order validityiff every structure makes S true. We say that a sentence S is first-order satisfiableiff there is a structure that makes S true. We say that a setof sentences is first-order satisfiableiff there is a structure that makes every sentence of true.
18.2.d Truth and satisfaction, revisited Proposition 1. Let M1and M2 be structures which have the same domain and assign the same interpretations to predicates and constant symbols in a wffP. Let g1 and g2 be variable assignments that assign the same objects to the free variables in P. Then M1|= P[g1]iff M2|= P[g2]. Proof: Straightforward induction.
18.3.a Soundness for FOL |- S means that S is provable in F from premises that all come from . Theorem (Soundness of F) If |-S, then S is a FO consequence of . Proof. By induction, we can show that any sentence that occurs at any step in a proof is a FO consequence of the assumptions in force at that step (even if the sentence appears in a deeply nested subproof). Since the goal sentence S appears at the main level where all assumptions are only from , we can then conclude that S is a FO consequence of . The basis of induction is straightforward, as all premises are from and hence FO consequences of . The inductive step requires going through all rules. Here we only consider two rules: Elim and Elim, leaving the other cases as exercises.
18.3.b Soundness for FOL • Elim: Suppose the given step derives R by this rule from QR and Q. Let A1,...,Akbe the assumptions in force at this step. Note that then the assumptions in force at steps QR and Q are also among A1,...,Ak. By the induction hypothesis, both QR and Q are FO consequences of A1,...,Ak. Hence, any model M that makes these k sentences true, also makes both QR and Q true. But then, by the definition of truth for , Malso makes R true. • Elim: Suppose the given, nth, step derives R by this rule from xP(x) (jthstep) and a subproof containing, at themth step,Rat its main level. • LetP(c) be the assumption of that subproof. • And letA1,...,Akbe the assumptions in force at step n. Note that the • assumptions at stepjare among A1,...,Ak, and the assumptions at • step m are among A1,...,Ak,P(c).
18.3.c Soundness for FOL Consider any model M which makes A1,...,Aktrue. By the induction hypothesis, M|=xP(x).So, there is an objectin the domain ofMthat satisfiesP(x). LetM’ beexactly likeM,only such thatM’ assigns to constantc. Sincecis not contained inA1,...,Akand R, byProposition 1,M’agrees withM(in making true or false) on these sentences. So,M’makes A1,...,Aktrue. Plus, obviously we also have M’|=P(c).As (again by the induction hypothesis)Ris a FO consequence ofA1,...,Akand P(c),we then haveM’|=R. HenceM|=R,as desired. ... j. xP(x) ... cP(c) ... m. R ... ... n. R
18.5.a Consider a sentence S in prenex normal form (all quantifiers precede the quantifier-free part of S). To SkolemizeS, replace in it each existentially quantified variable y by f(x1,…,xn), where x1,…,xn are the variables that are universally quantified and whose quantifiers precede that of y, and f is a fresh (not occurring elsewhere) n-ary function symbol. Original sentence Skolemization Skolemization xyQ(x,y) xyzQ(x,y,z) xyztQ(x,y,z,t) xQ(x) xyQ(x,y)
18.5.b While a sentence S generally is not logically equivalent to its SkolemizationS’, the two are always equisatisfiable, that is, S is FO-satisfiable (true in some model) iff so is S’. Indeed, every model that satisfies S’ obviously automatically also satisfies S. And every model that satisfies S can be can be turned into one satisfying S’ by interpreting the new (Skolem) function symbols of S’ as corresponding choice functions. For instance, if xyNeighbor(x,y) is true in a given world (model), then the SkolemizationxNeighbor(x,f(x)) can also be made true by interpreting f as a function that chooses, for every x, a neighbor f(x) of x. Such a function is said to be a Skolem function for y in xyNeighbor(x,y). Could the following functions on f(z) = z2 natural numbers be used as Skolemf(z) = z2 + 1 functions for y in the sentence f(z) = z2 + 2 zy [(1 + (z x z)) < y] ? f(z) = z3 Skolem functions
18.5.c A sentence is said to be in Skolem normal form iff it is a CNF prefixed with only universal quantifiers. Claim: Every FO sentence can be efficiently (in polynomial time) brought to an equisatisfiableSkolem normal form. This plays a crucial role in automated theorem proving, through allowing us to generalize the resolution method from propositional logic to FO logic. Skolem normal form
18.6.a Unification is of special importance for Section 18.7, where the resolution method is extended to the full first-order language. For preliminary insights, compare the following pairs of sentences: First pair:P(f(a)))xP(f(g(x))) Second pair: P(f(g(a)))xP(f(x)) The first pair is a logical possibility. It is consistent to suppose that the object f(a) has property P, but that no object of the form f(g(b)) has property P. This can only happen, though, if a is not of the form g(b). By contrast, the second pair is not a logical possibility. Because if xP(f(x)) holds, so does the instance where we substitute g(a) for x: P(f(g(a))). But this contradicts P(f(g(a))). Unification – preliminary insights
18.6.b Unification gives a useful test to see if sets of claims like the above are contradictory or not. You look at the terms involved, and see if they’re “unifiable.” The terms f(a) and f(g(x)) in the first pair of sentence are not unifiable, whereas the terms in the second pair, f(g(a)) and f(x), are unifiable. Definition: Terms t1 and t2 are unifiableiff there is a substitution of terms for some or all of the variables in t1 and t2 such that the terms that result from the substitution are syntactically identical. Similarly, a set {t1,…,tn}of erms is said to be unifiableiff there is a single substitution of terms for some or all of the variables that occur in any of t1,…,tn such that all of the resulting terms are identical. Note that whether terms are unifiable is a purely syntactic notion. It has to do with terms, not what they denote. Unifiability
18.6.c The following three terms are unifiable. f(g(z),x), f(y,x), f(y,h(a)) The term h(a) can be substituted for x, and g(z) for y. All three terms are thus transformed into the term f(g(z),h(a))(note that this isn’t the only substitution that will work!) Are the following pairs of terms unifiable? g(x) h(x) h(f(x,x)) h(y) f(x,y) f(y,x) g(g(x)) g(h(y)) g(x) g(h(z)) g(x) g(h(x)) Unifiability: examples
18.6.d There is a general efficient (polynomial-time) procedure for checking whether terms are unifiable. It is known as the unification algorithm. Whenever the unification algorithm finds that given terms are unifiable, it also generates a particular substitution that yields a unification. Although the algorithm in full generality is not described here, doing the exercises in Section 18.6 will provide a basic idea of how it works. Unification Algorithm
18.7.a Suppose we have sentences S1, S2, S3, … and want to show that they are not simultane- ouslysatisfiable. To do this using resolution, carry out the following steps: 1. Put each sentence Siinto prenex form. 2. Skolemize each of the resulting sentences, using different Skolem function symbols for different sentences. 3. Convert the quantifier-free part each of the resulting sentences into CNF. 4. Distribute the universal quantifiers in each resulting sentence across the conjunctions and drop the conjunction signs, ending with a set of sentences of the form x1x2…P, where P is a disjunction of literals. 5. Change the bound variables in each of the resulting sentences so that no variable appears in two of them. 6. Turn each of the resulting sentences into a set of literals by dropping the universal quantifiers and disjunction signs. In this way we end up with a set of resolution clauses. 7. Use resolution combined with unification to resolve this set of clauses. Rather than explain this (especially step 7) in great detail, let us look at an example. Resolution method for FOL
18.7.b Assume the sentences we deal with consists of: (S1) x[A(x,q)y(A(x,y)A(y,x))] (S2) xy[A(x,q)A(x,y)A(y,x)] Step 1: Bringing to prenex form Step 2: Skolemizing Step 3: CNF-izing Example xy [A(x,q)A(x,y)A(y,x)] xy [A(x,q)A(x,y)A(y,x)] x[A(x,q)A(x,f(x))A(f(x),x)] xy [A(x,q)A(x,y)A(y,x)] x[(A(x,q)A(x,f(x))(A(x,q)A(f(x),x))] xy [A(x,q)A(x,y)A(y,x)]
18.7.c Example x[(A(x,q)A(x,f(x))(A(x,q)A(f(x),x))] xy [A(x,q)A(x,y)A(y,x)] Step 4: Distributing s and dropping s Step 5: Renaming variables Step 6: Dropping s and s x[A(x,q)A(x,f(x)] x[A(x,q)A(f(x),x)] xy [A(x,q)A(x,y)A(y,x)] x[A(x,q)A(x,f(x)] y[A(y,q)A(f(y),y)] zw [A(z,q)A(z,w)A(w,z)] {A(x,q), A(x,f(x)} {A(y,q), A(f(y),y)} {A(z,q), A(z,w), A(w,z)}
18.7.d Step 7: Resolving Example 1. {A(x,q), A(x,f(x)} 2. {A(y,q), A(f(y),y)} 3. {A(z,q), A(z,w), A(w,z)} Base set of clauses Resolvent Resolved clauses Substitution 4. {A(q,f(q))} 1,3 q for w,x,z 5. {A(f(q),q)} 2,3 q for w,y,z 6. {A(q,f(q))} 3,5 f(q) for z, and q for w 7. 4,6none needed