+ All Categories
Home > Documents > Paqui Lucio 2013-2014 - gipuzkoa · 2013-2014. First-Order Logic 1. FO Language, Models and...

Paqui Lucio 2013-2014 - gipuzkoa · 2013-2014. First-Order Logic 1. FO Language, Models and...

Date post: 08-Oct-2018
Category:
Upload: doandan
View: 213 times
Download: 0 times
Share this document with a friend
37
Paqui Lucio 2013-2014
Transcript

Paqui Lucio

2013-2014

First-Order Logic1. FO Language, Models and Deduction

2. The Tableau Method for FOL

3. Clausal Form for FOL

4. Non-ground Resolution

5. Unification

6. The Resolution Method for FOL

76

Clausal Form for FOL An atom is a predicate symbol followed by arguments

e.g. p(a, f(x)).

A literal is an atom or its negation, as, p(a,f(x)).

A clause is a disjunction of literals, often written as a set. Example: {p(x), p(f(x))} for p(x) p(f(x))

A conjunction of clauses is also written as a set, as, {C1, C2, C3} signifying C1 C2 C3.

77

Clausal Form for FOL Theorem: Any FO-formula can be converted into a equi-

satisfiable set of clauses, usually called CNF()

and ’ are equi-satisfiable if

is satisfiable if and only if ’ is satisfiable

has a model if and only if ’ has a model

and CNF() are equi-satisfiable.

Goal: If CNF() is proved (un)satisfiable by resolution, then is (un)satisfiable.

78

Clausal Form for FOLTranforming to CNF() :

1. Renaming clashing variables then, each quantifier has a unique variable

2. Eliminate and using the equivalences I

3. Move ¬ inwards using the equivalences N + NQ

4. Move { , } inwards using the equivalences Q(this step is not essential, but useful)

5. Skolemize existentially quantified variables

(this is the only step that does not preserve equivalence but equi-satisfiablity)

6. Move outwards/Drop universal quantifiers using Q

7. Distribute disjunction over conjunction and simplify using the equivalences D.

79

Clausal Form for FOL (equivalences) Equivalences NQ: ¬x F x ¬F

¬x F x ¬F

Equivalences Q: x (F G) (x F) G

x (F G) (x F) G

x (F G) (x F) G

x (F G) ( x F) G

x (F G) F (x G)

x (F G) F (x G)

x (F G) F ( x G)

x (F G) F ( x G)

80

if x is notfree in G

if x is notfree in F

Clausal Form for FOL (skolemization) Skolem constant

X(dog(X)) is replaced by dog(c) where c is a new constant.

Skolem function

If the existentially quantified variable is within the scope of universally quantified variables, the existential variable must be a function of those other variables.

X Y mother(X,Y) X Y Z W foo (X,Y,Z,W)

X mother(X,f(X)) X Y W foo(X,Y,f(X,Y),W))

The resulting formula is not equivalent to the original, but they are equi-satisfiable.

81

Clausal Form for FOL (Example)Example: v r(v) (x y ¬(p(x,y) y q(y,y,x)))

1. Renaming clashing variables

v r(v) (x y ¬(p(x,y) z q(z,z,x)))

2. Eliminate and using the equivalences I

v r(v) (x y ¬(¬p(x,y) z q(z,z,x)))

3. Move ¬ inwards using the equivalences N + NQ

v r(v) (x y (¬¬p(x,y) ¬z q(z,z,x)))

v r(v) x y ( p(x,y) ¬z q(z,z,x))v r(v) x y ( p(x,y) z ¬q(z,z,x))

82

v r(v) x y (p(x,y) z ¬q(z,z,x))

4. Move { , } inwards using the equivalences Q

v r(v) x (y p(x,y) z ¬q(z,z,x))

5. Skolemize existentially quantified variables

v r(v) x (y p(x,y) z ¬q(z,z,x))

r(c0) x (y p(x,y) ¬q(f1(x),f1(x),x))

83

r(c0) x (y p(x,y) ¬q(f1(x),f1(x),x))

6. Move outwards/Drop universal quantifiers using Qx y ( r(c0) (p(x,y) ¬q(f1(x),f1(x),x)))r(c0) (p(x,y) ¬q(f1(x),f1(x),x))

7. Distribute disjunction over conjunction and simplify using the equivalences D.

(r(c0) p(x,y) ) (r(c0) ¬q(f1(x),f1(x),x))

{ r(c0) p(x,y) , r(c0) ¬q(f1(x),f1(x),x))}

84

First-Order Logic1. FO Language, Models and Deduction

2. The Tableau Method for FOL

3. Clausal Form for FOL

4. Non-ground Resolution

5. Unification

6. The Resolution Method for FOL

85

Non-ground Resolution

Resolution with FO clauses (that include variables), e.g.r(c0) ¬q(f1(x),f1(x),x) q(y,y,z) p(y)

q(c1,y,z) p(y) q(v,y,c2) p(y)

Binary Non-ground Resolution with Factoring

D1 a1 ... ak D2 ¬b

(D1 D2)

where = mgu(a1, ..., ak, b)

"most general unifier"86

(BRF)

Non-ground Resolution

Unification theory is based on the Herbrand’s Theorem

Herbrand’s Theorem (1930):

A universal sentence in CNF has a model if and only if it has a Herbrand model.

Herbrand models has a fixed universe and constant and functions has a fixed interpretation.

Herbrand’s Theorem allows unification/resolution to restrict the search of a model to the Herbrand models.

87

1908–1931

Non-ground Resolution

A Herbrand model H for a formula consist of

UH is formed by all the well-constructed terms using the constant (at least one) and the function symbols occurring in .

IM (c) = c for all c in

(IM (f)) (d1, …,dn) = f (d1, …,dn) for all n-ary f in

Exercise: Give a Herbrand model and a non-Herbrand model for the universal sentence X Y p(c,f(X),h(Y,a)).

88

First-Order Logic1. FO Language, Models and Deduction

2. The Tableau Method for FOL

3. Clausal Form for FOL

4. Non-ground Resolution

5. Unification

6. The Resolution Method for FOL

89

Unification (Substitutions)

A substitution is a finite set {X1t1,, Xn tn} where:

a) every ti is a term,

b) every Xi is a variable distinct from ti , and

c) if i j then Xi Xj.

The empty substitution {} is denoted by .

90

Unification (Subst. Application)

The application of = {X1t1,, Xn tn} to an expression E (term, atom, or formula)

is denoted by E, and

consists in simultaneously and independently replacing each variable Xi by the term ti.

Examples:

p(f(x,a),g(z)) {xh(y,b), zf(a,v))} = p(f(h(y,b),a),g(f(a,v)))

p(x,y) {xy, ya} = p(y,a)

91

Unification (Subst. Composition) Substitution composition: x(1

2)= (x1)2 for all x.

If 1 = {X1t1,, Xn tn} and 2 = {Y1s1,, Ym sm}, then

12 = {X1t12,, Xn tn2} {Yisi | 1im, Yi {X1,, Xn}}

(obviously, every Xi Xi is eliminated)

Example: 1 = {Xf(Y), Y Z}

2 = {Xa, Y b, ZY}

12 = {Xf(b), Y Z, ZY}

92

Unification (Unifiers) A substitution is idempotent iff E = (E) for every

expression E. That is, = .

Unifier of a set of expressions E1,E2,...,En is a substitution such that E1 = E2 =... = En.

E1 = q(f1(x),f1(x),x)

E2 = q(y,y,z)

1 ={y f1(x), z x} {y f1(z), x z}

{y f1(x), x z}

3={y f1(c0), z c0, x c0}

93

Unification (mgu) A unifier for S = {E1, …, En} is most-general iff for

every other unifier for S, there is a substitution such that E1 = (E1).

The most general unifier (mgu) of a set of expressions is a unifier of them that is more general than any other unifier of that expresions.

In the previous example: 1 = mgu(E1,E2)

94

Unification (Algorithm)Input: Set of expressions E

Output: k = mgu(E) or message non-unifiable

1. Initialize k = 0 and 0 = { }

2. While Ek is not a singleton

D:= the disagreement set of Ek

IF there is a var. x and term t in D such that xVar(t)

THEN k+1 = k{xt}; k:= k+1;

ELSE return “E is non-unifiable” (and exit)

3. Return k

The disagreement set of a set of expressions is the set of sub-expressions that starts in the left-most symbol position at which (at least two) expressions “disagree” .

95

Occur-check:xVar(t)

Unification (Example)0 = { } E = { p(a,X,f(Y)), p(U,V,W), p(a,R,f(c)) } D = {a,U}

1 = {Ua}

E1 = {p(a,X,f(Y)), p(a,V,W), p(a,R,f(c))} D = {X, V, R}

2 = {Ua, XV}

E2 = {p(a,V,f(Y)), p(a,V,W), p(a,R,f(c))} D = {V, R}

3 = {Ua, XR, VR}

E3 = {p(a,R,f(Y)), p(a,R,W), p(a,R,f(c))} D = {f(Y), W, f(c)}

4 = {Ua, XR, VR, Wf(Y)}

E4 = {p(a,R,f(Y)), p(a,R,f(c))} D= {Y, c}

5 = 4{Yc} = {Ua, XR, VR, Wf(c), Yc}

E5 = {p(a,R,f(c))} 96

Unification (Algorithm)

The unification algorithm is non-deterministic since theremay be several choices for {Xt} at step 3.

The uniqueness of the mgu makes any rule of selectionpossible.

The algorithm always terminates since there are only a finite number of variables in Q and one variable iseliminated at each step.

97

Unification (non-Examples) The following are pairs of non-unifiable atoms:

1. p(X,a,f(Y)) p(U,b,W)

2. p(b,Z,f(Z)) p(U,a,f(U))

3. p(b,Z,g(Z)) p(U,a,f(X))

4. p(X,a,f(Y)) p(U,a,Y)

5. p(X,Z,f(X)) p(U,a,f(f(U)))

6. P(X,f(X)) p(g(Y),Y)

98

different function/constant symbol

occur-check

First-Order Logic1. FO Language, Models and Deduction

2. The Tableau Method for FOL

3. Clausal Form for FOL

4. Non-ground Resolution

5. Unification

6. The Resolution Method for FOL

99

The Resolution Method for FOLThe resolvent of the two clauses

r(c0) ¬q(f1(x),f1(x),x) q(y,y,z) p(y)

is (r(c0) p(y)) {yf1(z), xz} = r(c0) p(f1(z))

This other two clauses

r(c0) ¬q(f1(x),f1(x),x) q(c1,y,z) p(y)

cannot be solved: q(f1(x),f1(x),x) and q(c1,y,z) are non-unifiable.

The resolvent of the two clauses

r(c0) ¬q(f1(x),f1(x),x) q(v,y,c2) p(y)

is (r(c0) p(y)) {vf1(c2), yf1(c2), xc2} = r(c0) p(f1(c2))100

The Resolution Method for FOLThe method to check ¿ ⊢ ?:

1. Transform {} into the equisatisfiable set of clauses

CNF( {}).

2. Apply to CNF( {}) the rule of BRF

to saturate with all posible resolvents until the empty clause

occurs or no new resolvents can be added (pos. infinite).

Each pair of clauses to be solved with BRF should be

standarised apart i.e. renamed to have not common variables.

101

Example 1x y p(x,y) ⊢ u v p(v,u)

iff Unsat({x y p(x,y), u v p(v,u)}) ?

Set of clauses:

1.- p(X,f1(X))

2.- p(f2(U),U)

Is not refutable because the unique unification fails by occur-check (without occur-check: FO-resolution is unsound).

Exercise: Give a model of {x y p(x,y), u v p(v,u)})

102

Example 2Every transitive and irreflexive relation is asymmetric

Transitive: XYZ((r (X,Y) r(Y,Z)) r(X,Z))

Irreflexive: X¬r(X,X)

Non-Asymmetric: ¬XY(r(X,Y)¬r(Y,X))

1. ¬r(X,Y) ¬r(Y,Z) r(X,Z)

2. ¬r(U,U)

3. r(c0,c1)

4. r(c1,c0)

Exercise: Give a refutation of set of clauses.

-103-

Example 3Every loon eats fish is a logical consequence of

a) Every bird sleeps in some tree.

b) Every loon is a bird, and every loon is aquatic.

c) Every tree in which any aquatic bird sleeps is beside some lake.

d) Anything that sleeps in anything that is beside any lake eats fish.

104

a) x (bird(x) y (tree(y) sleep(x,y)))

b) x (loon(x) (bird(x) aquatic(x)))

c) x ((tree(x) y (aquatic(y) sleep(y,x)) ) bslake(x))

d) x (y (bslake(y) sleep(x,y)) ) eatfish(x))

x (loon(x) eatfish(x))

105

a) x (bird(x) y (tree(y) sleep(x,y)))

b) x (loon(x) (bird(x) aquatic(x)))

c) x ((tree(x) y (aquatic(y) sleep(y,x)) ) bslake(x))

d) x (y (bslake(y) sleep(x,y)) ) eatfish(x))

x (loon(x) eatfish(x))

a) bird(x) tree(f(x))

bird(x) sleep(x, f(x))

b) loon(x) bird(x)

loon(x) aquatic(x)

c) tree(x) aquatic(y) sleep(y,x) bslake(x)

d) bslake(y) sleep(x,y) eatfish(x)

negetad conjecture: loon(c) eatfish(c)

106

1. bird(x) tree(f(x))

2. bird(x) sleep(x, f(x))

3. loon(x) bird(x)

4. loon(x) aquatic(x)

5. tree(x) aquatic(y) sleep(y,x) bslake(x)

6. bslake(y) sleep(x,y) eatfish(x)

7. loon(c)

8. eatfish(c)

9. bird(c) (3,7)

10. aquatic(c) (4,7)

11. tree(f(c)) (1,9)

12. sleep(c, f(c)) (2,9)

13. bslake(f(c)) (5,11,10,12) h-r

14. eatfish(c) (6,13,12) h-r

15. (8,14)

107

1. bird(x) tree(f(x))

2. bird(x) sleep(x, f(x))

3. loon(x) bird(x)

4. loon(x) aquatic(x)

5. tree(x) aquatic(y) sleep(y,x) bslake(x)

6. bslake(y) sleep(x,y) eatfish(x)

7. loon(c)

8. eatfish(c)

9. loon(x1) sleep(x1, f(x1)) (2,3)

10. loon(x2) tree(f(x2)) (1,3)

11. tree(f(c)) (7,10)

12. sleep(c, f(c)) (7,9)

13. aquatic(c) (4,7)

14. bslake(f(c)) (5,11,12,13) h-r

15. eatfish(c) (6,14,12) h-r

16. (8,15)

The Resolution Method for FOL

Binary Resolution with Factoring (Robinson, 1965) is refutationally complete, i.e.

Any unsatisfiable set produces, by saturation, the empty clause in a finite number of steps

Semi-decision procedure (FOL is undecidable)

The saturation of a satisfiable set could be an infinite set

108

In practice there are three possible scenarios:

1. At some moment the empty clause is generated, in this case the input set of clauses is unsatisfiable.

2. Saturation will terminate without ever generating , in this case the input set of clauses in satisfiable.

3. Saturation will run until we run out of resources, but without generating . In this case it is unknown whether the input set is satisfiable or satisfiable.

-109-

An example of unknown Transitive: XYZ((r(X,Y) r(Y,Z)) r(X,Z))

Irreflexive: X¬r(X,X)

Serial: X Y r(X,Y)

1. ¬r(Y,Z) ¬r(Z,W) r(Y,W)

2. ¬r(X,X)

3. r(U,f(U))

The unique resolvents are of the form r(f(…f(U)…),f(f(…f(U)…)))

Exercise: Give a model.

-110-

n n+1

The Resolution Method for FOL

Practical automated reasoning systems (theorem-provers, proof-assistants) use

Refinements of BRF, e.g. Ordered Hyper-resolution

Redundancy criteria and simplification techniques for pruning the search space: tautology deletion, subsumption, ...

Efficient indexing techniques is used to implement all major operations on sets of terms and clauses (e.g. unification).

102


Recommended