Resolution for first order logic
藤原 誠
東北大学理学研究科数学専攻
2010.11.5東北大学ロジックセミナー
Introduction
Satisfiability problem is one of decision problems.
If we resolve this problem,
we could also resolve Valid problem, Consequence
problem, and Equivalence problem.
The subject of my talk is to decide unsatisfiability of
first-order sentence, automatically by a computer.
I rewrite the condition that a first-order sentence ϕ
is satisfiable one after another to be more simple
form .
Introduction
Satisfiability problem is one of decision problems.
If we resolve this problem,
we could also resolve Valid problem, Consequence
problem, and Equivalence problem.
The subject of my talk is to decide unsatisfiability of
first-order sentence, automatically by a computer.
I rewrite the condition that a first-order sentence ϕ
is satisfiable one after another to be more simple
form .
Definition.
A formula is inSNFif it has the form∀x1...∀xnψwhereψis a conjunction of disjunctions of literals.
Fact.1
For any formulaϕof first-order logic, we can find a formulaϕS in SNF such thatϕis satisfiable⇔ ϕS is satisfiable by simple automatic operations.
For any formulaϕin SNF, we define a formula that does not use equality.
Definition.
A formula is inSNFif it has the form∀x1...∀xnψwhereψis a conjunction of disjunctions of literals.
Fact.1
For any formulaϕof first-order logic, we can find a formulaϕS in SNF such thatϕis satisfiable⇔ ϕS is satisfiable by simple automatic operations.
For any formulaϕin SNF, we define a formula that does not use equality.
Definition.
A formula is inSNFif it has the form∀x1...∀xnψwhereψis a conjunction of disjunctions of literals.
Fact.1
For any formulaϕof first-order logic, we can find a formulaϕS in SNF such thatϕis satisfiable⇔ ϕS is satisfiable by simple automatic operations.
For any formulaϕin SNF, we define a formula that does not use equality.
Definition.
V :vocabulary ofϕ, E :binary relation that is not inV ϕ, ≡the sentence obtained by replacing each occurrence of
t1= t2inϕwithE(t1,t2).
ϕER≡ ∀x∀y∀z[E(x, y) ∧ (E(x, y) ↔ E(y, x)) ∧ (E(x, y) ∧ E(y, z) → E(x, z))] ϕR ≡ ∀x∀y∀z[(∧ni=1E(xi,yi) ∧ R(x1, ...,xn))→ R(y1, ...,yn)]
ϕ1 ≡ ∧
R∈V
ϕR
ϕf ≡ ∀x1...∀xn∀y1∀yn[∧ni=1E(xi,yi) → E ( f (x1, ...,xn), f (y1, ..,yn))] ϕ2 ≡ ∧
f ∈V
ϕf
ϕE ≡ (ϕ,∧ ϕER∧ ϕ1∧ ϕ2)S
Fact.2
For any SNF sentenceϕ,
ϕis satisfiable ⇔ ϕE is satisfiable.
Definition.
V :vocabulary ofϕ, E :binary relation that is not inV ϕ, ≡the sentence obtained by replacing each occurrence of
t1= t2inϕwithE(t1,t2).
ϕER≡ ∀x∀y∀z[E(x, y) ∧ (E(x, y) ↔ E(y, x)) ∧ (E(x, y) ∧ E(y, z) → E(x, z))] ϕR ≡ ∀x∀y∀z[(∧ni=1E(xi,yi) ∧ R(x1, ...,xn))→ R(y1, ...,yn)]
ϕ1 ≡ ∧
R∈V
ϕR
ϕf ≡ ∀x1...∀xn∀y1∀yn[∧ni=1E(xi,yi) → E ( f (x1, ...,xn), f (y1, ..,yn))] ϕ2 ≡ ∧
f ∈V
ϕf
ϕE ≡ (ϕ,∧ ϕER∧ ϕ1∧ ϕ2)S
Fact.2
For any SNF sentenceϕ,
ϕis satisfiable ⇔ ϕE is satisfiable.
Definition.
LetV be a vocabulary.
HerbrandV-structureisV-structure that hasH(V)as
universe and interprets the constans and relations in natural way,where H(V)is the set of all variable freeV-term.
It is regardless of how the relations are interpreted. H(V)is calledHerbrand universeforV.
Example.
LetV = { f (arity : 1), R(arity : 2), c}. Then,H(V) = {c, f (c), f ( f (c)), ...}. M = (H(V)| f, R, c),
which interpretcand f in natural way andRas{(c, c), (c, f (c))}, be a HerbrandV-structure.
Definition.
LetΓbe a set of sentences.
Herbrand modelofΓis HerbrandVΓ-structure that modelsΓ, where VΓ is the set of constants, functions, and relations inΓ. (IfΓcontains no constant, we add one constant inVΓ)
In the case where Γcontains a single sentenceϕ, we will replaceΓin the above notion withϕ.
H(Vϕ)is calledHerbrand universeofϕ.
Let SNF sentenceϕbe∀x1...∀xnϕ0(x1...xn), whereϕ0 is quantifier-free and equality free.
Then,
E(ϕ) := {ϕ0(t1, ...,tn)|t1, ...,tn ∈ H(Vϕ)}.
Theorem.1
For any equality-free SNF sentenceϕ,
ϕis satisfiable ⇔ E(ϕ)is satisfiable. proof.(⇒)
Letϕ ≡ ∀x1...∀xnϕ0(x1, ...,xn)is satisfiable. If M |= ∀x1...∀xnϕ0(x1, ...,xn),
M |= ϕ0(t1, ...,tn)for all variable-freeVϕ-termti. This is that M |= E(ϕ), soE(ϕ)is satisfiable.
To prove the converse, we assert following Lemma.
Theorem.1
For any equality-free SNF sentenceϕ,
ϕis satisfiable ⇔ E(ϕ)is satisfiable. proof.(⇒)
Letϕ ≡ ∀x1...∀xnϕ0(x1, ...,xn)is satisfiable. If M |= ∀x1...∀xnϕ0(x1, ...,xn),
M |= ϕ0(t1, ...,tn)for all variable-freeVϕ-termti. This is that M |= E(ϕ), soE(ϕ)is satisfiable.
To prove the converse, we assert following Lemma.
Theorem.1
For any equality-free SNF sentenceϕ,
ϕis satisfiable ⇔ E(ϕ)is satisfiable. proof.(⇒)
Letϕ ≡ ∀x1...∀xnϕ0(x1, ...,xn)is satisfiable. If M |= ∀x1...∀xnϕ0(x1, ...,xn),
M |= ϕ0(t1, ...,tn)for all variable-freeVϕ-termti. This is that M |= E(ϕ), soE(ϕ)is satisfiable.
To prove the converse, we assert following Lemma.
Lemma.1
LetΓbe a set of equality-free SNF sentence. Then,
Γis satisfiable ⇔ Γhas a Herbrand model. outline of proof.
IfΓhas a Herbrand model,Γis satisfiable. Conversely, supposeΓis satisfiable. LetVΓbe the Herbrand vocabulary forΓ.
LetN be aVΓ-structure that modelsΓand M′ be a Herbrand VΓ-structure.
Then, we can make a HerbrandVΓ-structure M fromN and M′, that modelsΓ.
The universe of Mis same to M′. Minterprets constants and functions the same way as M′and relations the same way as N.
Lemma.1
LetΓbe a set of equality-free SNF sentence. Then,
Γis satisfiable ⇔ Γhas a Herbrand model. outline of proof.
IfΓhas a Herbrand model,Γis satisfiable. Conversely, supposeΓis satisfiable. LetVΓbe the Herbrand vocabulary forΓ.
LetN be aVΓ-structure that modelsΓand M′ be a Herbrand VΓ-structure.
Then, we can make a HerbrandVΓ-structure M fromN and M′, that modelsΓ.
The universe of Mis same to M′. Minterprets constants and functions the same way as M′and relations the same way as N.
Theorem.1
For any equality-free SNF sentenceϕ,
ϕis satisfiable ⇔ E(ϕ)is satisfiable. proof.(⇐)
Suppose E(ϕ)is satisfiable andϕ ≡ ∀x1...∀xnϕ0(x1, ...,xn). By Lemma.1, E(ϕ)has a Herbrand model M.
Since the Herbrand vocabulary forE(ϕ)is the same as the Herbrand vocabulary forϕ, the universe ofM isH(ϕ). For eacht1, ...,tnin H(ϕ),
M |= ϕ0(t1, ...,tn)since this sentence is inE(ϕ). That is, M |= ϕ.
ϕis satisfiable.
Resolution
Resolution is a system of formal proof that involves a minimal number of rule.
It is made by J.A.Robinson(Reference.3) for the purpose of providing a method of proof that can be done by a computer. Resolution can be used to determine whether or not any given sentence is satisfiable.
First, we define resolution principle for propositional logic. Definition.
Clauseis a disjunction of literals. From now, I write each clause as a set. LetC1andC2 be two clauses.
Suppose that A ∈ C1 and¬A ∈ C2 for some atomic formulaA. Then the clauseR = (C1− {A}) ∪ (C2− {¬A})is aresolventofC1 andC2.
Example.
{A1,A2, ¬A2,A4}is a resolvent of{A1, ¬A2,A3}and{A2, ¬A3,A4}. {A1,A3, ¬A3,A4}is also a resolvent of{A1, ¬A2,A3}and
{A2, ¬A3,A4}.
Definition.
LetF be a set of formulas in conjunctive normal form (CNF). Res (F) := {R | Ris resolvent of two clauses inF}
Res0(F) := {C | C is a clause in F} Resn(F) := Resn−1(F) ∪ Res(Resn−1(F)) Res∗(F) := ∪
n∈N
Resn(F)
Fact.3
LetF be a set of CNF formula. Then
F is unsatifiable ⇔ ∅ ∈ Res∗(F).
Definition.
LetF be a set of formulas in conjunctive normal form (CNF). Res (F) := {R | Ris resolvent of two clauses inF}
Res0(F) := {C | C is a clause in F} Resn(F) := Resn−1(F) ∪ Res(Resn−1(F)) Res∗(F) := ∪
n∈N
Resn(F)
Fact.3
LetF be a set of CNF formula. Then
F is unsatifiable ⇔ ∅ ∈ Res∗(F).
Next, we define resolution principle for first-order logic. Definition.
For any SNF sentenceϕ,
clauseinϕis a clause in CNF formulaϕ0whereϕis
∀x1...∀xnϕ0.
LetL = {L1, ...,Ln}is a clause (set of literals).
Lisunifiableif there exist substitution subsuch thatLsub contains only one literal.
subis themost general unifier forL
if it unifiesLand subsub′ = sub′ for any other unifier sub′for L.
Example.
LetL = {P( f (x), y), P( f (a), z)}.
( It represent∀x∀y∀z(P( f (x), y) ∨ P( f (a), z)). ) Let sub1= (x/a, y/z).
ThenLsub1= {P( f (a), z)}, so Lis unifiable. Moreover, sub1is the most general unifier forL.
For instance, sub2= (x/a, y/a, z/a)is also unifier forL, whereas sub1sub2= sub2.
Fact.4
We can exhibit an algorithm that, givenLas input, outputs
{ NOT UNIFIABLE ifLis not unifiable the most general unifier forL ifLis unifiable.
Example.
LetL = {P( f (x), y), P( f (a), z)}.
( It represent∀x∀y∀z(P( f (x), y) ∨ P( f (a), z)). ) Let sub1= (x/a, y/z).
ThenLsub1= {P( f (a), z)}, so Lis unifiable. Moreover, sub1is the most general unifier forL.
For instance, sub2= (x/a, y/a, z/a)is also unifier forL, whereas sub1sub2= sub2.
Fact.4
We can exhibit an algorithm that, givenLas input, outputs
{ NOT UNIFIABLE ifLis not unifiable the most general unifier forL ifLis unifiable.
Definition.
LetC1andC2 be two clauses in first-order formula.
Lets1 and s2 be any substitutions such thatC1s1 andC2s2have no variables in common.
Let{L1, ...,Lm} ⊂ C1s1and{L′1, ...,L′n} ⊂ C2s2be such that L = { ¯L1, ..., ¯Lm,L′1, ...,L′n}is unifiable, whereL = ¬L¯ or¬ ¯L = L. Let subbe the most general unifier forL.
ThenR = [(C1s1− {L1, ...,Lm}) ∪ (C2s2− {L1′, ...,L′n})]subis a resolventofC1andC2.
Fact.5 (Soundness)
Ris a resolvent ofC1andC2 ⇒ Ris a consequence ofC1 andC2
Definition.
LetC1andC2 be two clauses in first-order formula.
Lets1 and s2 be any substitutions such thatC1s1 andC2s2have no variables in common.
Let{L1, ...,Lm} ⊂ C1s1and{L′1, ...,L′n} ⊂ C2s2be such that L = { ¯L1, ..., ¯Lm,L′1, ...,L′n}is unifiable, whereL = ¬L¯ or¬ ¯L = L. Let subbe the most general unifier forL.
ThenR = [(C1s1− {L1, ...,Lm}) ∪ (C2s2− {L1′, ...,L′n})]subis a resolventofC1andC2.
Fact.5 (Soundness)
Ris a resolvent ofC1andC2 ⇒ Ris a consequence ofC1 andC2
Example.
LetC1= {Q(x, y), P( f (x), y)}and
C2 = {R(x, c), ¬P( f (c), x), ¬P( f (y), h(z))}. We find a resolvent ofC1andC2.
Let s1= (x/u, y/v).
ThenC1s1 = {Q(u, v), P( f (u), v)}, which has no variable in common withC2.
LetL = {¬P( f (u), v), ¬P( f (c), x), ¬P( f (y), h(z))}.
ThenLis unifiable andsub = (u/c, y/c, v/h(z), x/h(z))is the most general unifier.
We conclude thatC1 andC2have resolvent
R = [(C1s1− {P( f (u), v)}) ∪ (C2− {¬P( f (c), x), ¬P( f (y), h(z))})] sub
= {Q(u, v), R(x, c)}sub
= {Q(c, h(z)), R(h(z), c)}.
Example.
Next, we check the soundness.
C1 represents∀x∀y (Q(x, y) ∨ P( f (x), y)), and
C2 represents∀x∀y∀z (R(x, c) ∨ ¬P( f (c), x) ∨ ¬P( f (y), h(z))). SupposeC1 andC2hold in some structure.
Then they hold no matter what we plog in for the variables. In particular,
C1s1sub ≈ ∀z (Q(c, h(z)) ∨ P( f (c), h(z))), and C2sub ≈∀z (R(h(z), c) ∨ ¬P( f (c), h(z))) both hold. ThenR ≈ ∀z (Q(c, h(z)), R(h(z), c)) holds.
Definition.
Letϕbe a SNF sentence.
Res (ϕ) := {R | Ris resolvent of two clauses inϕ} Res0(ϕ) := {C | C is a clause inϕ}
Resn(ϕ) := Resn−1(ϕ) ∪ Res(Resn−1(ϕ)) Res∗(ϕ) := ∪
n∈N
Resn(ϕ)
Theorem.2
For any equality-free SNF sentenceϕ,
ϕis unsatisfiable⇔ ∅ ∈ Res∗(ϕ). proof.(⇐)
Let∅ ∈ Res∗(ϕ).
Then there existn > 0s.t. ∅ ∈ Resn(ϕ).
Then there exist an atomic formula Land sets of atomic formulas L1, L2 ∈ Resn−1(ϕ)and asub, such thatL¯1sub = L2sub = {L}. Suppose that M |= ϕ,M |= ¯L ∨ Lby the soundness of resolution. ButL ∨ L¯ is contradiction.
Soϕis unsatisfiable.
To prove the converse, we assert following Lemma and Corollary.
Theorem.2
For any equality-free SNF sentenceϕ,
ϕis unsatisfiable⇔ ∅ ∈ Res∗(ϕ). proof.(⇐)
Let∅ ∈ Res∗(ϕ).
Then there existn > 0s.t. ∅ ∈ Resn(ϕ).
Then there exist an atomic formula Land sets of atomic formulas L1, L2 ∈ Resn−1(ϕ)and asub, such thatL¯1sub = L2sub = {L}. Suppose that M |= ϕ,M |= ¯L ∨ Lby the soundness of resolution. ButL ∨ L¯ is contradiction.
Soϕis unsatisfiable.
To prove the converse, we assert following Lemma and Corollary.
Theorem.2
For any equality-free SNF sentenceϕ,
ϕis unsatisfiable⇔ ∅ ∈ Res∗(ϕ). proof.(⇐)
Let∅ ∈ Res∗(ϕ).
Then there existn > 0s.t. ∅ ∈ Resn(ϕ).
Then there exist an atomic formula Land sets of atomic formulas L1, L2 ∈ Resn−1(ϕ)and asub, such thatL¯1sub = L2sub = {L}. Suppose that M |= ϕ,M |= ¯L ∨ Lby the soundness of resolution. ButL ∨ L¯ is contradiction.
Soϕis unsatisfiable.
To prove the converse, we assert following Lemma and Corollary.
Lemma. (Lifting lemma) Letϕbe a SNF sentence.
IfR′ ∈ Res(E(ϕ)), then there existR ∈ Res(ϕ)such thatRsub′ = R′ for some sub′.
outline of proof.
LetC1′ andC2′ inE(ϕ)be such thatC1s1sub1= C′1andC2sub2 = C′2. LetR′be a resolvent ofC′1andC′2 (in propositional logic sence). Then there exist some literal L ∈ C1′ such thatL ∈ C¯ ′2and
R′ = (C1′ − {L}) ∪ (C2′ − { ¯L}). sub′ := sub1sub2.
ThenC1s1sub′ = C1s1sub1 = C1′ andC2sub′ = C2sub2 = C2′.
LetL1 ⊂ C1s1be s.t. L1sub′ = {L}andL2⊂ C2be s.t.L2sub′ = { ¯L}. L:= ¯L1∪ L2is unifiable sinceLsub′= { ¯L}.
Let subbe the most general unifier forL.
R := [(C1s1− L1) ∪ (C2− L2)]subis a resolvent ofC1 andC2. Then,Rsub′ = R′.
Lemma. (Lifting lemma) Letϕbe a SNF sentence.
IfR′ ∈ Res(E(ϕ)), then there existR ∈ Res(ϕ)such thatRsub′ = R′ for some sub′.
outline of proof.
LetC1′ andC2′ inE(ϕ)be such thatC1s1sub1= C′1andC2sub2 = C′2. LetR′be a resolvent ofC′1andC′2 (in propositional logic sence). Then there exist some literal L ∈ C1′ such thatL ∈ C¯ ′2and
R′ = (C1′ − {L}) ∪ (C2′ − { ¯L}). sub′ := sub1sub2.
ThenC1s1sub′ = C1s1sub1 = C1′ andC2sub′ = C2sub2 = C2′.
LetL1 ⊂ C1s1be s.t. L1sub′ = {L}andL2⊂ C2be s.t.L2sub′ = { ¯L}. L:= ¯L1∪ L2is unifiable sinceLsub′= { ¯L}.
Let subbe the most general unifier forL.
R := [(C1s1− L1) ∪ (C2− L2)]subis a resolvent ofC1 andC2. Then,Rsub′ = R′.
Corollary.
Letϕbe a SNF sentence.
IfC′ ∈ Res∗(E(ϕ)), then there existC ∈ Res∗(ϕ)and asub′ such thatC sub′= C′.
proof.
IfC′∈ Res∗(E(ϕ)),C′∈ Resn(E(ϕ))for somen. We prove by induction onn.
Ifn = 0, thenC′∈ E(ϕ).
By definition ofE(ϕ),C′is obtained byC ∈ ϕ ⊂ Res∗(ϕ)via substitution. For induction step, suppose the case ofmis satisfied.
Letϕ ⊂˜ Res∗(ϕ)be s.t. Resm(E(ϕ))comes fromϕ˜ via substitution. Then,Resm(E(ϕ)) ⊂ E( ˜ϕ).
IfC′∈ Resm+1(E(ϕ)), thenC′ ∈ Res (E( ˜ϕ))since
Resm(E(ϕ)) ⊂ E( ˜ϕ) ⊂ Res (E( ˜ϕ))andRes (Resm(E(ϕ))) ⊂ Res (E( ˜ϕ)). By Lifting lemma, there existC ∈ Res( ˜ϕ)s.t.C sub′ = C′for somesub′. Sinceϕ ⊂˜ Res∗(E(ϕ)),C ∈ Res∗(ϕ).
Corollary.
Letϕbe a SNF sentence.
IfC′ ∈ Res∗(E(ϕ)), then there existC ∈ Res∗(ϕ)and asub′ such thatC sub′= C′.
proof.
IfC′∈ Res∗(E(ϕ)),C′∈ Resn(E(ϕ))for somen. We prove by induction onn.
Ifn = 0, thenC′∈ E(ϕ).
By definition ofE(ϕ),C′is obtained byC ∈ ϕ ⊂ Res∗(ϕ)via substitution. For induction step, suppose the case ofmis satisfied.
Letϕ ⊂˜ Res∗(ϕ)be s.t. Resm(E(ϕ))comes fromϕ˜ via substitution. Then,Resm(E(ϕ)) ⊂ E( ˜ϕ).
IfC′∈ Resm+1(E(ϕ)), thenC′ ∈ Res (E( ˜ϕ))since
Resm(E(ϕ)) ⊂ E( ˜ϕ) ⊂ Res (E( ˜ϕ))andRes (Resm(E(ϕ))) ⊂ Res (E( ˜ϕ)). By Lifting lemma, there existC ∈ Res( ˜ϕ)s.t.C sub′ = C′for somesub′. Sinceϕ ⊂˜ Res∗(E(ϕ)),C ∈ Res∗(ϕ).
Theorem.2
For any equality-free SNF sentenceϕ,
ϕis unsatisfiable⇔ ∅ ∈ Res∗(ϕ). proof.(⇒)
By corollary, in particular, if∅ ∈ Res∗(E(ϕ)), there exist some C ∈ Res∗(ϕ)s.t. C sub′ = ∅for somesub′.
But this is only possible ifC = ∅. So if∅ ∈ Res∗(E(ϕ)), then∅ ∈ Res∗(ϕ).
By Theorem.1, Fact.3 and above, the proof is complete. [Theorem.1] For any equality-free SNF sentenceϕ,
ϕis satisfiable ⇔ E(ϕ)is satisfiable. [Fact.3] LetF be a set of CNF formula.
Then,Fis unsatifiable ⇔ ∅ ∈ Res∗(F).
By Fact.1, Fact.2 and Theorem.2, we can conclude as follows.
Conclusion.
For any first-order sentenceϕ,
ϕis unsatisfiable ⇔ ∅ ∈ Res∗((ϕS)E).
[Fact.1] For any formulaϕof first-order logic, ϕis satisfiable ⇔ ϕS is satisfiable. [Fact.2] For any SNF sentenceϕ,
ϕis satisfiable ⇔ ϕE is satisfiable. [Theorem.2] For any equality-free SNF sentenceϕ,
ϕis unsatisfiable ⇔ ∅ ∈ Res∗(ϕ).
Reference
1 SHAWN HEDMAN, A First Course in Logic: An introduction to model theory, proof theory, computability, and complexity, Oxford University Press(2004).
2 岩波 数学辞典 第四版,日本数学会編集,岩波書店(2007).
3 J.A.Robinson, A Machine-oriented Logic Based on the Resolution Principle, J.Association for Computing Machinery,12(1965),23-41.
Thank you for your attention !