Formalization of the Resolution Calculus for First-Order Logic - - PowerPoint PPT Presentation

formalization of the resolution calculus for first order
SMART_READER_LITE
LIVE PREVIEW

Formalization of the Resolution Calculus for First-Order Logic - - PowerPoint PPT Presentation

Formalization of the Resolution Calculus for First-Order Logic Anders Schlichtkrull 1 The resolution calculus for first-order logic DTU Compute, Technical University of Denmark 2 The resolution calculus for first-order logic is a proof


slide-1
SLIDE 1

Formalization of the Resolution Calculus for First-Order Logic

Anders Schlichtkrull

1

slide-2
SLIDE 2

DTU Compute, Technical University of Denmark

The resolution calculus for first-order logic

2

slide-3
SLIDE 3

DTU Compute, Technical University of Denmark

The resolution calculus for first-order logic

2

p(x) ∧ (q(y) ∨ r(x))

  • is a proof calculus for FO CNF formulas.

slide-4
SLIDE 4

DTU Compute, Technical University of Denmark

The resolution calculus for first-order logic

2

p(x) ∧ (q(y) ∨ r(x))

  • is a proof calculus for FO CNF formulas.

  • plain logic without types, sorts, equality
slide-5
SLIDE 5

DTU Compute, Technical University of Denmark

The resolution calculus for first-order logic

2

p(x) ∧ (q(y) ∨ r(x))

  • is a proof calculus for FO CNF formulas.

  • plain logic without types, sorts, equality

P ⊢ ⊥

  • is a refutation proof calculus.

slide-6
SLIDE 6

DTU Compute, Technical University of Denmark

The resolution calculus for first-order logic

2

p(x) ∧ (q(y) ∨ r(x))

  • is a proof calculus for FO CNF formulas.

  • was introduced by

  • J. A. Robinson, J. ACM, 1965.
  • plain logic without types, sorts, equality

P ⊢ ⊥

  • is a refutation proof calculus.

slide-7
SLIDE 7

DTU Compute, Technical University of Denmark

The resolution calculus for first-order logic

2

p(x) ∧ (q(y) ∨ r(x))

  • is a proof calculus for FO CNF formulas.

  • was introduced by

  • J. A. Robinson, J. ACM, 1965.
  • plain logic without types, sorts, equality

P ⊢ ⊥

  • is a refutation proof calculus.


1930-2016

slide-8
SLIDE 8

DTU Compute, Technical University of Denmark

The resolution calculus for first-order logic

2

p(x) ∧ (q(y) ∨ r(x))

  • is a proof calculus for FO CNF formulas.

  • was introduced by

  • J. A. Robinson, J. ACM, 1965.

Vampire

  • is used in automatic theorem provers 


(e.g. E, SPASS, Vampire).

  • plain logic without types, sorts, equality

P ⊢ ⊥

  • is a refutation proof calculus.


1930-2016

slide-9
SLIDE 9

DTU Compute, Technical University of Denmark 3

The resolution calculus for propositional logic

A A → C2 C2

slide-10
SLIDE 10

DTU Compute, Technical University of Denmark 3

The resolution calculus for propositional logic

A A → C2 C2 ¬C1 → ¬C1 →

slide-11
SLIDE 11

DTU Compute, Technical University of Denmark 3

The resolution calculus for propositional logic

A A → C2 C2 ¬C1 → ¬C1 → C1 ⋁ A ¬A ⋁ C2 C1 ⋁ C2

slide-12
SLIDE 12

DTU Compute, Technical University of Denmark 3

The resolution calculus for propositional logic

A A → C2 C2 ¬C1 → ¬C1 → C1 ⋁ A ¬A ⋁ C2 C1 ⋁ C2

Clashing literals

slide-13
SLIDE 13

DTU Compute, Technical University of Denmark

Motivation

The formalization is part of IsaFoL. IsaFoL = library of basic results in automated reasoning. New calculi or calculus variants can be easily developed directly in Isabelle.

4

λ → ∀

=

Isabelle

β α

IsaFoL project Isabelle Formalization of Logic

slide-14
SLIDE 14

DTU Compute, Technical University of Denmark

IsaFoL

  • Completeness of FOL 


Blanchette, Popescu, Traytel (IJCAR 2014)

  • CDCL with extensions


Blanchette, Fleury, Weidenbach (IJCAR 2016)

  • FO resolution


Schlichtkrull (ITP 2016)

5

slide-15
SLIDE 15

DTU Compute, Technical University of Denmark

IsaFoL

  • Completeness of FOL 


Blanchette, Popescu, Traytel (IJCAR 2014)

  • CDCL with extensions


Blanchette, Fleury, Weidenbach (IJCAR 2016)

  • FO resolution


Schlichtkrull (ITP 2016)

5

slide-16
SLIDE 16

DTU Compute, Technical University of Denmark

  • FO model theory


Harrison in HOL Light (TPHOL 1998)

  • FO (but no terms) sequent calculus


Margetson, Ridge in Isabelle/HOL (AFP 2004)

  • FO (but no terms) verified prover


Margetson, Ridge in Isabelle/HOL (TPHOL 2005)

  • FO sequent calculus


Brasenmann, Koepke in Mizar (Formalized Mathematics 2005)

  • Soundness of HOL Light


Harrison in HOL Light (IJCAR 2006)

  • FO natural deduction 


Berghofer in Isabelle/HOL (AFP 2007) …


Related work

6

slide-17
SLIDE 17

DTU Compute, Technical University of Denmark

  • Constructive completeness proofs


Illik in Coq (PhD thesis 2010)

  • FO sequent calculus and uncountable languages


Schlöder, Koepke in Mizar (Formalized Mathematics 2012)

  • Gödel’s incompleteness


Paulson in Isabelle/HOL (JAR 2015)

  • Soundness of HOL Light with definitions


Kumar, Arthan, Myreen, Owens (JAR 2016)

  • The Incredible Proof Machine


Breitner, Lohner in Isabelle/HOL (ITP 2016)

  • FO axiomatic system (soundness only)


Jensen, Schlichtkrull, Villadsen in Isabelle/HOL (Isabelle Workshop 2016)


Related work

7

slide-18
SLIDE 18

DTU Compute, Technical University of Denmark

Books I followed

8

Ben-Ari Chang and Lee Leitsch

slide-19
SLIDE 19

DTU Compute, Technical University of Denmark

  • Isabelle/jEdit
  • Isar
  • Proof methods of Isabelle: auto, blast, metis
  • Sledgehammer

Tools I used

9

λ → ∀

=

I s a b e l l e

β α

HOL

slide-20
SLIDE 20

DTU Compute, Technical University of Denmark

Clausal first-order logic

Terms: x; y; f(c, x); f(y, f(x, c))

datatype fterm =
 Var var-sym 
 | Fun fun-sym (fterm list)

Herbrand (ground) terms: c; d; f(c, d); f(d, f(c, c))

datatype hterm =
 HFun fun-sym (hterm list)

10

slide-21
SLIDE 21

DTU Compute, Technical University of Denmark

Clausal first-order logic

11

slide-22
SLIDE 22

DTU Compute, Technical University of Denmark

Clausal first-order logic

Atoms: p(c, x); q(d)

type-synonym 't atom = pred-sym * 't list

11

slide-23
SLIDE 23

DTU Compute, Technical University of Denmark

Clausal first-order logic

Atoms: p(c, x); q(d)

type-synonym 't atom = pred-sym * 't list

Literals: p(c, x); ¬q(d)

datatype 't literal =
 Pos pred-sym ('t list)
 | Neg pred-sym ('t list)

11

slide-24
SLIDE 24

DTU Compute, Technical University of Denmark

Clausal first-order logic

Atoms: p(c, x); q(d)

type-synonym 't atom = pred-sym * 't list

Literals: p(c, x); ¬q(d)

datatype 't literal =
 Pos pred-sym ('t list)
 | Neg pred-sym ('t list)

Clauses: ∀x y z. p(x, y) ∨ q(z) ∨ q(a)

type-synonym 't clause = 't literal set

11

slide-25
SLIDE 25

DTU Compute, Technical University of Denmark 12

From propositional resolution to FO resolution

r ∨ p ¬r ∨ q p ∨ q {r, p} {¬r, q} {p, q}

slide-26
SLIDE 26

DTU Compute, Technical University of Denmark 12

From propositional resolution to FO resolution

r ∨ p ¬r ∨ q p ∨ q {r, p} {¬r, q} {p, q} {r(x), r(y), p(y)} {¬r(c), q} ???

slide-27
SLIDE 27

DTU Compute, Technical University of Denmark

Machinery

13

slide-28
SLIDE 28

DTU Compute, Technical University of Denmark

Machinery

Complement of a literal:
 p(x, y)C = ¬p(x, y); ¬q(f(x))C = q(f(x))

fun complement :: 't literal ⇒ 't literal where
 (Pos P ts)C = Neg P ts 
 | (Neg P ts)C = Pos P ts

13

slide-29
SLIDE 29

DTU Compute, Technical University of Denmark

Machinery

Complement of a literal:
 p(x, y)C = ¬p(x, y); ¬q(f(x))C = q(f(x))

fun complement :: 't literal ⇒ 't literal where
 (Pos P ts)C = Neg P ts 
 | (Neg P ts)C = Pos P ts

Complement of a set of literals:
 {p(x, y), ¬q(f(x))}C = {¬p(x, y), q(f(x))}

abbreviation complements :: 't literal set ⇒ 't literal set where 
 LC ≡ complement ` L

13

slide-30
SLIDE 30

DTU Compute, Technical University of Denmark

Machinery

14

slide-31
SLIDE 31

DTU Compute, Technical University of Denmark

Machinery

Substitutions:
 {x ↦ c, y ↦d}; {x ↦ f(x, y), z ↦ y}

type_synonym substitution = var-sym ⇒ fterm

14

slide-32
SLIDE 32

DTU Compute, Technical University of Denmark

Machinery

Substitutions:
 {x ↦ c, y ↦d}; {x ↦ f(x, y), z ↦ y}

type_synonym substitution = var-sym ⇒ fterm

Application:
 f(x, g(y)) · {x ↦ c, y ↦d} = f(c, g(d))

fun sub :: fterm ⇒ substitution ⇒ fterm where
 (Var x) ⋅ σ = σ x
 | (Fun f ts) ⋅ σ = Fun f (map (λt. t ⋅ σ) ts)

14

slide-33
SLIDE 33

DTU Compute, Technical University of Denmark

Machinery

15

slide-34
SLIDE 34

DTU Compute, Technical University of Denmark

Machinery

Unifier:
 {p(x, y), p(z, c)} has unifier {x ↦ c, y ↦ c, z ↦ c}

definition unifier :: substitution ⇒ fterm literal set ⇒ bool where
 unifier σ L ⟷ (∃l'. ∀l ∈ L. l · σ = l')

15

slide-35
SLIDE 35

DTU Compute, Technical University of Denmark

Machinery

Unifier:
 {p(x, y), p(z, c)} has unifier {x ↦ c, y ↦ c, z ↦ c}

definition unifier :: substitution ⇒ fterm literal set ⇒ bool where
 unifier σ L ⟷ (∃l'. ∀l ∈ L. l · σ = l')

Most general unifier:
 {p(x, y), p(z, c)} has MGU {x ↦ x, y ↦ c, z ↦ x}

definition mgu :: substitution ⇒ fterm literal set ⇒ bool where
 mgu σ L ⟷ unifier σ L ∧ (∀u. unifier u L ⟶ (∃i. u = σ ⋅ i))

15

slide-36
SLIDE 36

DTU Compute, Technical University of Denmark

FO resolution

16

C1 C2 C1 and C2 share no variables,
 L1 ⊆ C1, L2 ⊆ C2, σ MGU for L1 ∪ L2c ((C1 — L1) ∪ (C2 — L2)) · σ

slide-37
SLIDE 37

DTU Compute, Technical University of Denmark

FO resolution

16

C1 C2 C1 and C2 share no variables,
 L1 ⊆ C1, L2 ⊆ C2, σ MGU for L1 ∪ L2c ((C1 — L1) ∪ (C2 — L2)) · σ

E.g. we can resolve because {r(x), r(y)} ∪ {r(c)} has MGU {x ↦ c, y ↦ c} {r(x), r(y), p(y)} {¬r(c), q} {p(c), q}

slide-38
SLIDE 38

DTU Compute, Technical University of Denmark

Formalization of FO resolution

17

slide-39
SLIDE 39

DTU Compute, Technical University of Denmark

Formalization of FO resolution

definition applicable C1 C2 L1 L2 σ ⟷ 
 C1 ≠ {} ∧ C2 ≠ {} ∧ L1 ≠ {} ∧ L2 ≠ {}
 ∧ vars C1 ∩ vars C2 = {} 
 ∧ L1 ⊆ C1 ∧ L2 ⊆ C2 
 ∧ mgu σ (L1 ∪ L2

C)"

17

slide-40
SLIDE 40

DTU Compute, Technical University of Denmark

Formalization of FO resolution

definition applicable C1 C2 L1 L2 σ ⟷ 
 C1 ≠ {} ∧ C2 ≠ {} ∧ L1 ≠ {} ∧ L2 ≠ {}
 ∧ vars C1 ∩ vars C2 = {} 
 ∧ L1 ⊆ C1 ∧ L2 ⊆ C2 
 ∧ mgu σ (L1 ∪ L2

C)"

definition resolution C1 C2 L1 L2 σ = ((C1 - L1) ∪ (C2 - L2)) ⋅ σ

17

slide-41
SLIDE 41

DTU Compute, Technical University of Denmark

Formalization of FO resolution

definition applicable C1 C2 L1 L2 σ ⟷ 
 C1 ≠ {} ∧ C2 ≠ {} ∧ L1 ≠ {} ∧ L2 ≠ {}
 ∧ vars C1 ∩ vars C2 = {} 
 ∧ L1 ⊆ C1 ∧ L2 ⊆ C2 
 ∧ mgu σ (L1 ∪ L2

C)"

definition resolution C1 C2 L1 L2 σ = ((C1 - L1) ∪ (C2 - L2)) ⋅ σ inductive resolution_step 
 :: fterm clause set ⇒ fterm clause set ⇒ bool where
 resolution_rule: 
 C1 ∈ Cs ⟹ C2 ∈ Cs ⟹ applicable C1 C2 L1 L2 σ ⟹ 
 resolution_step Cs (Cs ∪ {resolution C1 C2 L1 L2 σ})
 | standardize_apart:
 C ∈ Cs ⟹ var_renaming_of C C' ⟹ resolution_step Cs (Cs ∪ {C'})

17

slide-42
SLIDE 42

DTU Compute, Technical University of Denmark

Formalization of FO resolution

definition applicable C1 C2 L1 L2 σ ⟷ 
 C1 ≠ {} ∧ C2 ≠ {} ∧ L1 ≠ {} ∧ L2 ≠ {}
 ∧ vars C1 ∩ vars C2 = {} 
 ∧ L1 ⊆ C1 ∧ L2 ⊆ C2 
 ∧ mgu σ (L1 ∪ L2

C)"

definition resolution C1 C2 L1 L2 σ = ((C1 - L1) ∪ (C2 - L2)) ⋅ σ inductive resolution_step 
 :: fterm clause set ⇒ fterm clause set ⇒ bool where
 resolution_rule: 
 C1 ∈ Cs ⟹ C2 ∈ Cs ⟹ applicable C1 C2 L1 L2 σ ⟹ 
 resolution_step Cs (Cs ∪ {resolution C1 C2 L1 L2 σ})
 | standardize_apart:
 C ∈ Cs ⟹ var_renaming_of C C' ⟹ resolution_step Cs (Cs ∪ {C'}) definition resolution_deriv = rtranclp resolution_step

17

slide-43
SLIDE 43

DTU Compute, Technical University of Denmark

Refutational completeness

18

slide-44
SLIDE 44

DTU Compute, Technical University of Denmark

Refutational completeness

Refutational completeness:
 If C is unsatisfiable then the calculus can derive a contradiction

18

slide-45
SLIDE 45

DTU Compute, Technical University of Denmark

Refutational completeness

Refutational completeness:
 If C is unsatisfiable then the calculus can derive a contradiction

unsatisfiable C ⟹ (C ⊢ {})

18

slide-46
SLIDE 46

DTU Compute, Technical University of Denmark

Semantic tree

19

slide-47
SLIDE 47

DTU Compute, Technical University of Denmark

Enumeration of ground terms: p, q, r(c), …

Semantic tree

19

slide-48
SLIDE 48

DTU Compute, Technical University of Denmark

Enumeration of ground terms: p, q, r(c), …

Semantic tree

19

slide-49
SLIDE 49

DTU Compute, Technical University of Denmark

Enumeration of ground terms: p, q, r(c), … 
 
 
 
 
 Semantic trees are decision trees assigning True and False to the ground atoms.

Semantic tree

19

slide-50
SLIDE 50

DTU Compute, Technical University of Denmark

Enumeration of ground terms: p, q, r(c), … 
 
 
 
 
 Semantic trees are decision trees assigning True and False to the ground atoms. Node on depth i makes decision for atom i.

Semantic tree

19

slide-51
SLIDE 51

DTU Compute, Technical University of Denmark

Semantic tree

20

A path represents a partial (Herbrand) interpretation.

E.g. {p↦T, q↦F, r(c)↦F}

slide-52
SLIDE 52

DTU Compute, Technical University of Denmark

Formalized enumeration

21

slide-53
SLIDE 53

DTU Compute, Technical University of Denmark

Formalized enumeration

definition nat_from_hatom :: hterm atom ⇒ nat where
 nat_from_hatom ≡ (SOME f. bij f)

21

slide-54
SLIDE 54

DTU Compute, Technical University of Denmark

Formalized enumeration

definition nat_from_hatom :: hterm atom ⇒ nat where
 nat_from_hatom ≡ (SOME f. bij f) instantiation hterm :: countable begin
 instance by countable_datatype
 end

21

slide-55
SLIDE 55

DTU Compute, Technical University of Denmark

Formalized enumeration

definition nat_from_hatom :: hterm atom ⇒ nat where
 nat_from_hatom ≡ (SOME f. bij f) instantiation hterm :: countable begin
 instance by countable_datatype
 end lemma infinite_hatoms: infinite (UNIV :: 't atom set)
 <proof>

21

slide-56
SLIDE 56

DTU Compute, Technical University of Denmark

Formalized enumeration

definition nat_from_hatom :: hterm atom ⇒ nat where
 nat_from_hatom ≡ (SOME f. bij f) instantiation hterm :: countable begin
 instance by countable_datatype
 end lemma infinite_hatoms: infinite (UNIV :: 't atom set)
 <proof> lemma nat_from_hatom_bij: bij nat_from_hatom
 proof -
 have countable (UNIV :: hterm atom set) by simp
 moreover
 have infinite (UNIV :: hterm atom set) using infinite_hatoms by auto
 ultimately


  • btain x where bij (x :: hterm atom ⇒ nat) using countableE_infinite by blast


then show ?thesis using … someI by metis
 qed

21

slide-57
SLIDE 57

DTU Compute, Technical University of Denmark

Formalized enumeration

definition nat_from_hatom :: hterm atom ⇒ nat where
 nat_from_hatom ≡ (SOME f. bij f) instantiation hterm :: countable begin
 instance by countable_datatype
 end lemma infinite_hatoms: infinite (UNIV :: 't atom set)
 <proof> lemma nat_from_hatom_bij: bij nat_from_hatom
 proof -
 have countable (UNIV :: hterm atom set) by simp
 moreover
 have infinite (UNIV :: hterm atom set) using infinite_hatoms by auto
 ultimately


  • btain x where bij (x :: hterm atom ⇒ nat) using countableE_infinite by blast


then show ?thesis using … someI by metis
 qed

21

slide-58
SLIDE 58

DTU Compute, Technical University of Denmark

Formalized semantic trees

22

slide-59
SLIDE 59

DTU Compute, Technical University of Denmark

Formalized semantic trees

Finite trees:

datatype tree =
 Leaf
 | Branching tree tree

22

slide-60
SLIDE 60

DTU Compute, Technical University of Denmark

Formalized semantic trees

Finite trees:

datatype tree =
 Leaf
 | Branching tree tree

Paths:

type_synonym path = bool list

22

slide-61
SLIDE 61

DTU Compute, Technical University of Denmark

Formalized semantic trees

Finite trees:

datatype tree =
 Leaf
 | Branching tree tree

Paths:

type_synonym path = bool list

Possibly infinite trees:

type_synonym inftree = path set abbreviation wf_tree :: path set ⇒ bool where
 wf_tree T ≡ (∀ds d. (ds @ d) ∈ T ⟶ ds ∈ T)

22

slide-62
SLIDE 62

DTU Compute, Technical University of Denmark

Falsification by partial interpretation

23

slide-63
SLIDE 63

DTU Compute, Technical University of Denmark

Falsification of ground clause:
 {p↦T, q↦F, r(c)↦T} falsifies {q,¬r(c)}

Falsification by partial interpretation

23

slide-64
SLIDE 64

DTU Compute, Technical University of Denmark

Falsification of ground clause:
 {p↦T, q↦F, r(c)↦T} falsifies {q,¬r(c)}

abbreviation falsifiesg :: path ⇒ fterm clause ⇒ bool where
 falsifiesg G C ≡ ground C ∧ (∀l ∈ C. falsifies G l)

Falsification by partial interpretation

23

slide-65
SLIDE 65

DTU Compute, Technical University of Denmark

Falsification of ground clause:
 {p↦T, q↦F, r(c)↦T} falsifies {q,¬r(c)}

abbreviation falsifiesg :: path ⇒ fterm clause ⇒ bool where
 falsifiesg G C ≡ ground C ∧ (∀l ∈ C. falsifies G l)

Falsification of FO clause:
 {p↦T, q↦F, r(c)↦T} falsifies {q,¬r(x)}

Falsification by partial interpretation

23

slide-66
SLIDE 66

DTU Compute, Technical University of Denmark

Falsification of ground clause:
 {p↦T, q↦F, r(c)↦T} falsifies {q,¬r(c)}

abbreviation falsifiesg :: path ⇒ fterm clause ⇒ bool where
 falsifiesg G C ≡ ground C ∧ (∀l ∈ C. falsifies G l)

Falsification of FO clause:
 {p↦T, q↦F, r(c)↦T} falsifies {q,¬r(x)}

abbreviation falsifies :: path ⇒ fterm clause ⇒ bool where
 falsifies G C ≡ (∃C'. instance_of C' C ∧ falsifiesg G C')

Falsification by partial interpretation

23

slide-67
SLIDE 67

DTU Compute, Technical University of Denmark

Definition of closed semantic tree:
 All branches falsify a ground instance of a clause in Cs 


Closed semantic tree

24

slide-68
SLIDE 68

DTU Compute, Technical University of Denmark

Definition of closed semantic tree:
 All branches falsify a ground instance of a clause in Cs 


Closed semantic tree

24

Definition of closed semantic tree:
 All branches falsify a ground instance of a clause in Cs
 Cs = { {¬q,¬p}, {r(x)}, {¬p,q,¬r(y)}, {p}}

p↦F q↦T q↦F r(c)↦T p↦T r(c)↦F

slide-69
SLIDE 69

DTU Compute, Technical University of Denmark

Definition of closed semantic tree:
 All branches falsify a ground instance of a clause in Cs 


Closed semantic tree

24

Definition of closed semantic tree:
 All branches falsify a ground instance of a clause in Cs
 Cs = { {¬q,¬p}, {r(x)}, {¬p,q,¬r(y)}, {p}}

p↦F q↦T q↦F r(c)↦T p↦T r(c)↦F

Definition of closed semantic tree:
 All branches falsify a ground instance of a clause in Cs
 Cs = { {¬q,¬p}, {r(x)}, {¬p,q,¬r(y)}, {p}}

p↦F q↦T q↦F r(c)↦T p↦T r(c)↦F {p↦T, q↦T} falsifies {¬q,¬p}

slide-70
SLIDE 70

DTU Compute, Technical University of Denmark

Definition of closed semantic tree:
 All branches falsify a ground instance of a clause in Cs 


Closed semantic tree

24

Definition of closed semantic tree:
 All branches falsify a ground instance of a clause in Cs
 Cs = { {¬q,¬p}, {r(x)}, {¬p,q,¬r(y)}, {p}}

p↦F q↦T q↦F r(c)↦T p↦T r(c)↦F

Definition of closed semantic tree:
 All branches falsify a ground instance of a clause in Cs
 Cs = { {¬q,¬p}, {r(x)}, {¬p,q,¬r(y)}, {p}}

p↦F q↦T q↦F r(c)↦T p↦T r(c)↦F {p↦T, q↦T} falsifies {¬q,¬p}

Definition of closed semantic tree:
 All branches falsify a ground instance of a clause in Cs
 Cs = { {¬q,¬p}, {r(x)}, {¬p,q,¬r(y)}, {p}}

p↦F q↦T q↦F r(c)↦T p↦T r(c)↦F {p↦T, q↦F, r(c)↦T} falsifies {¬p,q,¬r(c)} ground instance of {¬p,q,¬r(y)}

slide-71
SLIDE 71

DTU Compute, Technical University of Denmark

Definition of closed semantic tree:
 All branches falsify a ground instance of a clause in Cs 


Closed semantic tree

24

Definition of closed semantic tree:
 All branches falsify a ground instance of a clause in Cs
 Cs = { {¬q,¬p}, {r(x)}, {¬p,q,¬r(y)}, {p}}

p↦F q↦T q↦F r(c)↦T p↦T r(c)↦F

Definition of closed semantic tree:
 All branches falsify a ground instance of a clause in Cs
 Cs = { {¬q,¬p}, {r(x)}, {¬p,q,¬r(y)}, {p}}

p↦F q↦T q↦F r(c)↦T p↦T r(c)↦F {p↦T, q↦T} falsifies {¬q,¬p}

Definition of closed semantic tree:
 All branches falsify a ground instance of a clause in Cs
 Cs = { {¬q,¬p}, {r(x)}, {¬p,q,¬r(y)}, {p}}

p↦F q↦T q↦F r(c)↦T p↦T r(c)↦F {p↦T, q↦F, r(c)↦T} falsifies {¬p,q,¬r(c)} ground instance of {¬p,q,¬r(y)}

Definition of closed semantic tree:
 All branches falsify a ground instance of a clause in Cs
 Cs = { {¬q,¬p}, {r(x)}, {¬p,q,¬r(y)}, {p}}

{p↦T, q↦F, r(c)↦T} falsifies {r(c)} ground instance of {r(x)} p↦F q↦T q↦F r(c)↦T p↦T r(c)↦F

slide-72
SLIDE 72

DTU Compute, Technical University of Denmark

Definition of closed semantic tree:
 All branches falsify a ground instance of a clause in Cs 


Closed semantic tree

24

Definition of closed semantic tree:
 All branches falsify a ground instance of a clause in Cs
 Cs = { {¬q,¬p}, {r(x)}, {¬p,q,¬r(y)}, {p}}

p↦F q↦T q↦F r(c)↦T p↦T r(c)↦F

Definition of closed semantic tree:
 All branches falsify a ground instance of a clause in Cs
 Cs = { {¬q,¬p}, {r(x)}, {¬p,q,¬r(y)}, {p}}

p↦F q↦T q↦F r(c)↦T p↦T r(c)↦F {p↦T, q↦T} falsifies {¬q,¬p}

Definition of closed semantic tree:
 All branches falsify a ground instance of a clause in Cs
 Cs = { {¬q,¬p}, {r(x)}, {¬p,q,¬r(y)}, {p}}

p↦F q↦T q↦F r(c)↦T p↦T r(c)↦F {p↦T, q↦F, r(c)↦T} falsifies {¬p,q,¬r(c)} ground instance of {¬p,q,¬r(y)}

Definition of closed semantic tree:
 All branches falsify a ground instance of a clause in Cs
 Cs = { {¬q,¬p}, {r(x)}, {¬p,q,¬r(y)}, {p}}

{p↦T, q↦F, r(c)↦T} falsifies {r(c)} ground instance of {r(x)} p↦F q↦T q↦F r(c)↦T p↦T r(c)↦F

Definition of closed semantic tree:
 All branches falsify a ground instance of a clause in Cs
 Cs = { {¬q,¬p}, {r(x)}, {¬p,q,¬r(y)}, {p}}

p↦F q↦T q↦F r(c)↦T p↦T r(c)↦F {p↦F} falsifies {p}

slide-73
SLIDE 73

DTU Compute, Technical University of Denmark

Completeness proof

  • 1. Herbrand’s theorem: 


Any unsatisfiable set of clauses has a finite closed semantic tree.

  • 2. {} is derivable from any set of clauses with a

closed semantic tree. The proof follows Chang & Lee (1973).

25

slide-74
SLIDE 74

DTU Compute, Technical University of Denmark

Completeness proof

Herbrand’s theorem: Any unsatisfiable set of clauses Cs has a finite closed semantic tree. Proof: Let T be a full infinite semantic tree.
 Consider any infinite p path in T.
 p is an interpretation and thus falsifies Cs.
 A (finite) prefix also falsifies Cs.
 Let T’ be a copy of T with all paths replaced with finite falsifying prefixes.
 T’ is finite by König’s lemma.

26

  • 1. Herbrand’s theorem
  • 2. Deriving {}

slide-75
SLIDE 75

DTU Compute, Technical University of Denmark

Completeness proof

Herbrand’s theorem: Any unsatisfiable set of clauses Cs has a finite closed semantic tree. Proof: Let T be a full infinite semantic tree.
 Consider any infinite p path in T.
 p is an interpretation and thus falsifies Cs.
 A (finite) prefix also falsifies Cs.
 Let T’ be a copy of T with all paths replaced with finite falsifying prefixes.
 T’ is finite by König’s lemma.

26

  • 1. Herbrand’s theorem
  • 2. Deriving {}

p is an interpretation? A path is a list of bools. An interpretation is a

fun_sym ⇒ 'u list ⇒ 'u

and a

pred_sym ⇒ 'u list ⇒ bool

slide-76
SLIDE 76

DTU Compute, Technical University of Denmark

Completeness proof

Herbrand’s theorem: Any unsatisfiable set of clauses Cs has a finite closed semantic tree. Proof: Let T be a full infinite semantic tree.
 Consider any infinite p path in T.
 p is an interpretation and thus falsifies Cs.
 A (finite) prefix also falsifies Cs.
 Let T’ be a copy of T with all paths replaced with finite falsifying prefixes.
 T’ is finite by König’s lemma.

26

  • 1. Herbrand’s theorem
  • 2. Deriving {}

p is an interpretation? A path is a list of bools. An interpretation is a

fun_sym ⇒ 'u list ⇒ 'u

and a

pred_sym ⇒ 'u list ⇒ bool

Yes, we can make a conversion function

extend.

slide-77
SLIDE 77

DTU Compute, Technical University of Denmark

Completeness proof

Herbrand’s theorem: Any unsatisfiable set of clauses Cs has a finite closed semantic tree. Proof: Let T be a full infinite semantic tree.
 Consider any infinite p path in T.
 p is an interpretation and thus falsifies Cs.
 A (finite) prefix also falsifies Cs.
 Let T’ be a copy of T with all paths replaced with finite falsifying prefixes.
 T’ is finite by König’s lemma.

26

  • 1. Herbrand’s theorem
  • 2. Deriving {}

Does it?

slide-78
SLIDE 78

DTU Compute, Technical University of Denmark

If an infinite path falsifies a set of clauses, then so does a finite prefix.

27

Interpretation Partial interpretation FO clause set Cs falsified by extend p Cs falsified by prefix of p

Completeness proof

  • 1. Herbrand’s theorem
  • 2. Deriving {}

slide-79
SLIDE 79

DTU Compute, Technical University of Denmark

If an infinite path falsifies a set of clauses, then so does a finite prefix.

27

Interpretation Partial interpretation FO clause set Cs falsified by extend p Cs falsified by prefix of p Ground clause set

Completeness proof

  • 1. Herbrand’s theorem
  • 2. Deriving {}

slide-80
SLIDE 80

DTU Compute, Technical University of Denmark

If an infinite path falsifies a set of clauses, then so does a finite prefix.

27

Interpretation Partial interpretation FO clause set Cs falsified by extend p Cs falsified by prefix of p Ground clause set

Csʹ falsified by extend p

Completeness proof

  • 1. Herbrand’s theorem
  • 2. Deriving {}

slide-81
SLIDE 81

DTU Compute, Technical University of Denmark

If an infinite path falsifies a set of clauses, then so does a finite prefix.

27

Interpretation Partial interpretation FO clause set Cs falsified by extend p Cs falsified by prefix of p Ground clause set

⟹ ⟹ Csʹ falsified by

extend p

Completeness proof

  • 1. Herbrand’s theorem
  • 2. Deriving {}

slide-82
SLIDE 82

DTU Compute, Technical University of Denmark

If an infinite path falsifies a set of clauses, then so does a finite prefix.

27

Interpretation Partial interpretation FO clause set Cs falsified by extend p Cs falsified by prefix of p Ground clause set

Csʹ falsified by prefix of p

⟹ Csʹ falsified by

extend p

Completeness proof

  • 1. Herbrand’s theorem
  • 2. Deriving {}

slide-83
SLIDE 83

DTU Compute, Technical University of Denmark

If an infinite path falsifies a set of clauses, then so does a finite prefix.

27

Interpretation Partial interpretation FO clause set Cs falsified by extend p Cs falsified by prefix of p Ground clause set

Csʹ falsified by prefix of p

⟹ ⟹ Csʹ falsified by

extend p

Completeness proof

  • 1. Herbrand’s theorem
  • 2. Deriving {}

slide-84
SLIDE 84

DTU Compute, Technical University of Denmark

If an infinite path falsifies a set of clauses, then so does a finite prefix.

27

Interpretation Partial interpretation FO clause set Cs falsified by extend p Cs falsified by prefix of p Ground clause set

Csʹ falsified by prefix of p

⟹ ⟹ ⟹

Csʹ falsified by extend p

Completeness proof

  • 1. Herbrand’s theorem
  • 2. Deriving {}

slide-85
SLIDE 85

DTU Compute, Technical University of Denmark

  • 1. Herbrand’s theorem
  • 2. Deriving {}

28

Completeness proof ↳

slide-86
SLIDE 86

DTU Compute, Technical University of Denmark

  • 1. Herbrand’s theorem
  • 2. Deriving {}

28

Completeness proof

  • 1. Herbrand’s theorem
  • 2. Deriving {}

slide-87
SLIDE 87

DTU Compute, Technical University of Denmark

  • 1. Herbrand’s theorem
  • 2. Deriving {}

28

Completeness proof

  • 1. Herbrand’s theorem
  • 2. Deriving {}

r(c)↦T r(c)↦F q↦F closed semantic tree for Cs

slide-88
SLIDE 88

DTU Compute, Technical University of Denmark

  • 1. Herbrand’s theorem
  • 2. Deriving {}

28

Completeness proof

  • 1. Herbrand’s theorem
  • 2. Deriving {}

falsifies C1 C2 r(c)↦T r(c)↦F q↦F closed semantic tree for Cs

slide-89
SLIDE 89

DTU Compute, Technical University of Denmark

  • 1. Herbrand’s theorem
  • 2. Deriving {}

28

Completeness proof

  • 1. Herbrand’s theorem
  • 2. Deriving {}

falsifies C1 C2 C r(c)↦T r(c)↦F q↦F closed semantic tree for Cs

slide-90
SLIDE 90

DTU Compute, Technical University of Denmark

  • 1. Herbrand’s theorem
  • 2. Deriving {}

28

Completeness proof

  • 1. Herbrand’s theorem
  • 2. Deriving {}

falsifies C1 C2 C r(c)↦T r(c)↦F q↦F closed semantic tree for Cs

slide-91
SLIDE 91

DTU Compute, Technical University of Denmark

  • 1. Herbrand’s theorem
  • 2. Deriving {}

28

Completeness proof

  • 1. Herbrand’s theorem
  • 2. Deriving {}

falsifies C1 C2 C r(c)↦T r(c)↦F q↦F closed semantic tree for Cs ⋃ {C}

slide-92
SLIDE 92

DTU Compute, Technical University of Denmark

  • 1. Herbrand’s theorem
  • 2. Deriving {}

28

Completeness proof

  • 1. Herbrand’s theorem
  • 2. Deriving {}

q↦F closed semantic tree for Cs ⋃ {C}

slide-93
SLIDE 93

DTU Compute, Technical University of Denmark

  • 1. Herbrand’s theorem
  • 2. Deriving {}

28

Completeness proof

  • 1. Herbrand’s theorem
  • 2. Deriving {}

q↦F closed semantic tree for Cs ⋃ {C}

slide-94
SLIDE 94

DTU Compute, Technical University of Denmark

  • 1. Herbrand’s theorem
  • 2. Deriving {}

28

Completeness proof

  • 1. Herbrand’s theorem
  • 2. Deriving {}

q↦F closed semantic tree for Cs ⋃ {C}

slide-95
SLIDE 95

DTU Compute, Technical University of Denmark

  • 1. Herbrand’s theorem
  • 2. Deriving {}

29

Completeness proof ↳

Eventually the empty tree is closed for our Cs. Then we have derived {}.

slide-96
SLIDE 96

DTU Compute, Technical University of Denmark

  • 1. Herbrand’s theorem
  • 2. Deriving {}

30

Completeness proof

  • 1. Herbrand’s theorem
  • 2. Deriving {}

falsifies C1 C2 C r(c)↦T r(c)↦F q↦F closed semantic tree for Cs

slide-97
SLIDE 97

DTU Compute, Technical University of Denmark

  • 1. Herbrand’s theorem
  • 2. Deriving {}

30

Completeness proof

  • 1. Herbrand’s theorem
  • 2. Deriving {}

falsifies C1 C2 r(c)↦T r(c)↦F q↦F closed semantic tree for Cs

slide-98
SLIDE 98

DTU Compute, Technical University of Denmark

  • 1. Herbrand’s theorem
  • 2. Deriving {}

30

Completeness proof

  • 1. Herbrand’s theorem
  • 2. Deriving {}

falsifies C1 C2 r(c)↦T r(c)↦F q↦F closed semantic tree for Cs instance of C1ʹ C2ʹ

slide-99
SLIDE 99

DTU Compute, Technical University of Denmark

  • 1. Herbrand’s theorem
  • 2. Deriving {}

30

Completeness proof

  • 1. Herbrand’s theorem
  • 2. Deriving {}

falsifies C1 C2 r(c)↦T r(c)↦F q↦F closed semantic tree for Cs instance of C1ʹ C2ʹ Cʹ

slide-100
SLIDE 100

DTU Compute, Technical University of Denmark

  • 1. Herbrand’s theorem
  • 2. Deriving {}

30

Completeness proof

  • 1. Herbrand’s theorem
  • 2. Deriving {}

falsifies C1 C2 r(c)↦T r(c)↦F q↦F closed semantic tree for Cs instance of C1ʹ C2ʹ Cʹ falsifies by arguments about enumeration

slide-101
SLIDE 101

DTU Compute, Technical University of Denmark

  • 1. Herbrand’s theorem
  • 2. Deriving {}

30

Completeness proof

  • 1. Herbrand’s theorem
  • 2. Deriving {}

falsifies C1 C2 r(c)↦T r(c)↦F q↦F closed semantic tree for Cs instance of C1ʹ C2ʹ Cʹ falsifies

slide-102
SLIDE 102

DTU Compute, Technical University of Denmark

  • 1. Herbrand’s theorem
  • 2. Deriving {}

30

Completeness proof

  • 1. Herbrand’s theorem
  • 2. Deriving {}

falsifies C1 C2 r(c)↦T r(c)↦F q↦F closed semantic tree for Cs instance of C1ʹ C2ʹ Cʹ falsifies C

slide-103
SLIDE 103

DTU Compute, Technical University of Denmark

  • 1. Herbrand’s theorem
  • 2. Deriving {}

30

Completeness proof

  • 1. Herbrand’s theorem
  • 2. Deriving {}

falsifies C1 C2 r(c)↦T r(c)↦F q↦F closed semantic tree for Cs instance of C1ʹ C2ʹ Cʹ falsifies C

slide-104
SLIDE 104

DTU Compute, Technical University of Denmark

  • 1. Herbrand’s theorem
  • 2. Deriving {}

30

Completeness proof

  • 1. Herbrand’s theorem
  • 2. Deriving {}

falsifies C1 C2 r(c)↦T r(c)↦F q↦F closed semantic tree for Cs instance of C1ʹ C2ʹ Cʹ falsifies C by the lifting lemma

slide-105
SLIDE 105

DTU Compute, Technical University of Denmark

Lifting lemma

means instantiation, e.g. C1ʹ instance of C1

31

C1 C2 C1ʹ C2ʹ Cʹ ground

slide-106
SLIDE 106

DTU Compute, Technical University of Denmark

Lifting lemma

means instantiation, e.g. C1ʹ instance of C1

31

C1 C2 C C1ʹ C2ʹ Cʹ ground Black: Assumptions Green: Established by lemma

slide-107
SLIDE 107

DTU Compute, Technical University of Denmark

Lifting lemma

means instantiation, e.g. C1ʹ instance of C1

32

{p(x), p(y), q(y)} {¬r,¬p(z)} {q(c),¬r} ground Black: Assumptions Green: Established by lemma {p(c), q(c)} {¬r,¬p(c)}

slide-108
SLIDE 108

DTU Compute, Technical University of Denmark

Lifting lemma

means instantiation, e.g. C1ʹ instance of C1

32

{p(x), p(y), q(y)} {¬r,¬p(z)} {q(z),¬r} {q(c),¬r} ground Black: Assumptions Green: Established by lemma {p(c), q(c)} {¬r,¬p(c)}

slide-109
SLIDE 109

DTU Compute, Technical University of Denmark

Lifting lemma

Challenge 1: Showing the existence of MGUs. Solution: Reuse theorem from IsaFoR. Challenge 2: Proof by Chang & Lee (1973) is flawed.

33

slide-110
SLIDE 110

DTU Compute, Technical University of Denmark

Lifting lemma

34

  • Chang & Lee (1973)
slide-111
SLIDE 111

DTU Compute, Technical University of Denmark

Lifting lemma

34

  • Chang & Lee (1973)
slide-112
SLIDE 112

DTU Compute, Technical University of Denmark

Lifting lemma

The flaw was already discovered by Leitsch (Mathematical Logic Quarterly,1989). Chang & Lee do resolution on factors of clauses and remove literals before applying substitution. Other calculi (e.g. by Leitsch (1997)) remove literals after applying substitution. This allows for a simple proof of the lifting lemma.

35

slide-113
SLIDE 113

DTU Compute, Technical University of Denmark

Completeness

The lifting lemma completes the completeness proof.

theorem completeness:
 assumes finite Cs ∧ (∀C∈Cs. finite C)
 assumes ∀(F::hterm fun_denot) (G::hterm pred_denot). ¬eval F G Cs
 shows ∃Cs'. resolution_deriv Cs Cs' ∧ {} ∈ Cs'
 <proof>

36

slide-114
SLIDE 114

DTU Compute, Technical University of Denmark

Conclusion

Soundness and completeness of resolution is formalized. It was particularly challenging to formalize the lifting lemma. Available in the IsaFoL repository + AFP:
 bitbucket.org/jasmin_blanchette/isafol/
 isa-afp.org/entries/Resolution_FOL.shtml I am now working on extensions (ordered resolution, redundancy, selection) to get closer to the theory of modern ATP’s that use the superposition calculus.

37

slide-115
SLIDE 115

DTU Compute, Technical University of Denmark

References

A machine-oriented logic based on the resolution principle


  • J. A. Robinson, J. ACM, 1965

Mathematical Logic for Computer Science


  • M. Ben-Ari, 3rd ed, Springer, 2012

Symbolic Logic and Mechanical Theorem Proving


  • C. L. Chang and R. C. T. Lee, Academic Press, 1973

The Resolution Calculus


  • A. Leitsch, Springer, 1997

IsaFoR (Isabelle Formalization of Rewriting)
 cl-informatik.uibk.ac.at/software/ceta/
 IsaFoR developers On different concepts of resolution


  • A. Leitsch, Mathematical Logic Quarterly, 1989

For precise references to the related work, see my paper. Picture of J. A. Robinson by D. Monniaux [CC BY-SA 3.0], via Wikimedia Commons

38