SLIDE 1 Unified Classical Logic Completeness
A Coinductive Pearl
Jasmin Blanchette Andrei Popescu Dmitriy Traytel
λ → ∀
=
Isabelle
β α
H O L
SLIDE 2
SLIDE 3
All too often, proof-theoretic methods are neglected in favor of shorter, and superficially more elegant semantic arguments. [In contrast, in Gallier’s book] the treatment of the proof theory of the Gentzen system is oriented towards computation with proofs. For example, a pseudo-Pascal version of a complete search procedure for first-order cut-free Gentzen proofs is presented. Frank Pfenning
SLIDE 4
A Proof
∀x. p(x) ⊢ p(y) ∧ p(z)
SLIDE 5 A Proof
∀x. p(x) ⊢ p(y) ∧ p(z) ∀x. p(x) ⊢ p(y) ∀x. p(x) ⊢ p(z)
CONJRp(y), p(z)
SLIDE 6 A Proof
∀x. p(x) ⊢ p(y) ∧ p(z) ∀x. p(x) ⊢ p(y) ∀x. p(x), p(y) ⊢ p(y) ∀x. p(x) ⊢ p(z)
CONJRp(y), p(z) ALLLx,p(x),y
SLIDE 7 A Proof
∀x. p(x) ⊢ p(y) ∧ p(z) ∀x. p(x) ⊢ p(y) ∀x. p(x), p(y) ⊢ p(y) ∀x. p(x) ⊢ p(z)
CONJRp(y), p(z) ALLLx,p(x),y AXp(y)
SLIDE 8 A Proof
∀x. p(x) ⊢ p(y) ∧ p(z) ∀x. p(x) ⊢ p(y) ∀x. p(x), p(y) ⊢ p(y) ∀x. p(x) ⊢ p(z) ∀x. p(x), p(z) ⊢ p(z)
CONJRp(y), p(z) ALLLx,p(x),y ALLLx,p(x),z AXp(y)
SLIDE 9 A Proof
∀x. p(x) ⊢ p(y) ∧ p(z) ∀x. p(x) ⊢ p(y) ∀x. p(x), p(y) ⊢ p(y) ∀x. p(x) ⊢ p(z) ∀x. p(x), p(z) ⊢ p(z)
CONJRp(y), p(z) ALLLx,p(x),y ALLLx,p(x),z AXp(y) AXp(z)
SLIDE 10 A Failing Proof
∀x. p(x) ⊢ p(y) ∧ p(z) ∀x. p(x) ⊢ p(y) ∀x. p(x), p(y) ⊢ p(y) ∀x. p(x) ⊢ p(z)
CONJRp(y), p(z) ALLLx,p(x),y AXp(y)
SLIDE 11 A Failing Proof
∀x. p(x) ⊢ p(y) ∧ p(z) ∀x. p(x) ⊢ p(y) ∀x. p(x), p(y) ⊢ p(y) ∀x. p(x) ⊢ p(z) ∀x. p(x), p(y) ⊢ p(z)
CONJRp(y), p(z) ALLLx,p(x),y AXp(y) ALLLx,p(x),y
SLIDE 12 A Failing Proof
∀x. p(x) ⊢ p(y) ∧ p(z) ∀x. p(x) ⊢ p(y) ∀x. p(x), p(y) ⊢ p(y) ∀x. p(x) ⊢ p(z) ∀x. p(x), p(y) ⊢ p(z) ∀x. p(x), p(y) ⊢ p(z)
CONJRp(y), p(z) ALLLx,p(x),y AXp(y) ALLLx,p(x),y ALLLx,p(x),y
SLIDE 13 A Failing Proof
∀x. p(x) ⊢ p(y) ∧ p(z) ∀x. p(x) ⊢ p(y) ∀x. p(x), p(y) ⊢ p(y) ∀x. p(x) ⊢ p(z) ∀x. p(x), p(y) ⊢ p(z) ∀x. p(x), p(y) ⊢ p(z) ∀x. p(x), p(y) ⊢ p(z)
. . .
CONJRp(y), p(z) ALLLx,p(x),y AXp(y) ALLLx,p(x),y ALLLx,p(x),y ALLLx,p(x),y ALLLx,p(x),y
SLIDE 14 A Systematic Proof
∀x. p(x) ⊢ p(y) ∧ p(z) ∀x. p(x) ⊢ p(y) ∀x. p(x), p(y) ⊢ p(y) ∀x. p(x) ⊢ p(z) ∀x. p(x), p(x) ⊢ p(z) ∀x. p(x), p(y) ⊢ p(z) ∀x. p(x), p(z) ⊢ p(z)
CONJRp(y), p(z) ALLLx,p(x),y AXp(y) ALLLx,p(x),x ALLLx,p(x),y ALLLx,p(x),z AXp(z)
SLIDE 15 A Failing Systematic Proof
∀x. p(x) ⊢ p(y) ∧ q(z) ∀x. p(x) ⊢ p(y) ∀x. p(x), p(y) ⊢ p(y) ∀x. p(x) ⊢ q(z) ∀x. p(x), p(x) ⊢ q(z) ∀x. p(x), p(y) ⊢ q(z) ∀x. p(x), p(z) ⊢ q(z)
. . .
CONJRp(y), p(z) ALLLx,p(x),y AXp(y) ALLLx,p(x),x ALLLx,p(x),y ALLLx,p(x),z ALLLx,p(x),y
SLIDE 16 Our Interest in Gallier’s Proof
Polymorphic FOL
− → Monomorphic FOL
− → Untyped FOL
SLIDE 17 Our Interest in Gallier’s Proof
Polymorphic FOL
− → Monomorphic FOL
− → Untyped FOL
Claessen, Lillieström, Smallbone CADE 2011 Blanchette, Böhme, Popescu, Smallbone TACAS 2013
SLIDE 18 Our Interest in Gallier’s Proof
Polymorphic FOL
− → Monomorphic FOL
− → Untyped FOL
Claessen, Lillieström, Smallbone CADE 2011 Blanchette, Böhme, Popescu, Smallbone TACAS 2013 Blanchette, Popescu FroCoS 2013
SLIDE 19
How to Formalize Completeness?
Harrison TPHOLs 1998 HOL Light Henkin Berghofer 2002 Isabelle/HOL Henkin Ridge, Margetson TPHOLs 2005 Isabelle/HOL Beth–Hintikka Ilik 2010 Coq Henkin Schlöder, Koepke 2012 Mizar Henkin
Henkin ≈ Gödel ≈ canonical models ≈ semantic Beth–Hintikka ≈ Gallier ≈ complete prover ≈ syntactic
SLIDE 20
How to Formalize Completeness?
Harrison TPHOLs 1998 HOL Light Henkin Berghofer 2002 Isabelle/HOL Henkin Ridge, Margetson TPHOLs 2005 Isabelle/HOL Beth–Hintikka Ilik 2010 Coq Henkin Schlöder, Koepke 2012 Mizar Henkin
Henkin ≈ Gödel ≈ canonical models ≈ semantic Beth–Hintikka ≈ Gallier ≈ complete prover ≈ syntactic
SLIDE 21 Our Version
- Isabelle/HOL, Beth–Hintikka
- Abstract proof + instantiation with rich FOLs
- Codatatype of possibly infinite trees
- Code generation to Haskell
SLIDE 22 Our Version
- Isabelle/HOL, Beth–Hintikka
- Abstract proof + instantiation with rich FOLs
- Codatatype of possibly infinite trees
- Code generation to Haskell
A A pseudo-Pascal version of a complete search procedure for first-order cut-free Gentzen proofs is presented.
SLIDE 23 Our Version
- Isabelle/HOL, Beth–Hintikka
- Abstract proof + instantiation with rich FOLs
- Codatatype of possibly infinite trees
- Code generation to Haskell
A Haskell A pseudo-Pascal ——————– version of a complete search procedure for first-order cut-free Gentzen proofs is presented.
SLIDE 24
Isabelle/HOL Demonstration
SLIDE 25
Codatatypes
Inductive (or algebraic) datatypes: datatype α list = Nil | Cons α (α list)
SLIDE 26
Codatatypes
Inductive (or algebraic) datatypes: datatype α list = Nil | Cons α (α list) Theorems: Distinctness, injectivity, exhaustiveness, induction
SLIDE 27
Codatatypes
Inductive (or algebraic) datatypes: datatype α list = Nil | Cons α (α list) Theorems: Distinctness, injectivity, exhaustiveness, induction Coinductive (or coalgebraic) datatypes: codatatype α llist = LNil | LCons α (α llist)
SLIDE 28
Codatatypes
Inductive (or algebraic) datatypes: datatype α list = Nil | Cons α (α list) Theorems: Distinctness, injectivity, exhaustiveness, induction Coinductive (or coalgebraic) datatypes: codatatype α llist = LNil | LCons α (α llist) codatatype α stream = SCons α (α stream)
SLIDE 29
Codatatypes
Inductive (or algebraic) datatypes: datatype α list = Nil | Cons α (α list) Theorems: Distinctness, injectivity, exhaustiveness, induction Coinductive (or coalgebraic) datatypes: codatatype α llist = LNil | LCons α (α llist) codatatype α stream = SCons α (α stream) Theorems: Distinctness, injectivity, exhaustiveness, coinduction
SLIDE 30
Syntax and Semantics
datatype fmla = Atm atom | Neg fmla | Conj fmla fmla | All var fmla
SLIDE 31 Syntax and Semantics
datatype fmla = Atm atom | Neg fmla | Conj fmla fmla | All var fmla Terms
xS
ξ
= ξ x f(t1, ... , tn)S
ξ
=
F
f
ξ , ... , tnS ξ
S | =ξ p(t1, ... , tn) =
P
p
ξ , ... , tnS ξ
SLIDE 32 Syntax and Semantics
datatype fmla = Atm atom | Neg fmla | Conj fmla fmla | All var fmla Terms
xS
ξ
= ξ x f(t1, ... , tn)S
ξ
=
F
f
ξ , ... , tnS ξ
S | =ξ p(t1, ... , tn) =
P
p
ξ , ... , tnS ξ
S | =ξ Atm a = S | =ξ a S | =ξ Neg ϕ = S | =ξ ϕ S | =ξ Conj ϕ ψ = S | =ξ ϕ ∧ S | =ξ ψ S | =ξ All x ϕ = ∀a∈ S. S | =ξ[x←a] ϕ
SLIDE 33
A Gentzen System
AX
Γ, Atm a ⊢ ∆, Atm a Γ ⊢ ∆, ϕ
NEGL
Γ, Neg ϕ ⊢ ∆ Γ, ϕ ⊢ ∆
NEGR
Γ ⊢ ∆, Neg ϕ Γ, ϕ, ψ ⊢ ∆
CONJL
Γ, Conj ϕ ψ ⊢ ∆ Γ ⊢ ∆, ϕ Γ ⊢ ∆, ψ
CONJR
Γ ⊢ ∆, Conj ϕ ψ Γ, All x ϕ, ϕ[t/x] ⊢ ∆
ALLL
Γ, All x ϕ ⊢ ∆ Γ ⊢ ∆, ϕ[y/x] ALLR (y fresh) Γ ⊢ ∆, All x ϕ
SLIDE 34 Abstracting Away
∀x. p(x) ⊢ p(y) ∧ p(z) ∀x. p(x) ⊢ p(y) ∀x. p(x), p(y) ⊢ p(y) ∀x. p(x) ⊢ p(z) ∀x. p(x), p(x) ⊢ p(z) ∀x. p(x), p(y) ⊢ p(z) ∀x. p(x), p(z) ⊢ p(z)
CONJRp(y), p(z) ALLLx,p(x),y AXp(y) ALLLx,p(x),x ALLLx,p(x),y ALLLx,p(x),z AXp(z)
SLIDE 35 Abstracting Away
s0 s1 s3 s2 s4 s5 s6
r0 r1 r3 r2 r4 r5 r6
SLIDE 36
Abstracting Away
(s0, r0) (s1, r1) (s3, r3) (s2, r2) (s4, r4) (s5, r5) (s6, r6)
SLIDE 37 Abstracting Away
(s0, r0) (s1, r1) (s3, r3) (s2, r2) (s4, r4) (s5, r5) (s6, r6)
∀x. p(x) ⊢ p(y) ∧ p(z) ∀x. p(x) ⊢ p(y) ∀x. p(x), p(y) ⊢ p(y) ∀x. p(x) ⊢ p(z) ∀x. p(x), p(y) ⊢ p(z) ∀x. p(x), p(y) ⊢ p(z) ∀x. p(x), p(y) ⊢ p(z)
. . . CONJRp(y), p(z) ALLLx,p(x),y AXp(y) ALLLx,p(x),y ALLLx,p(x),y ALLLx,p(x),y AXp(z)
SLIDE 38
Abstracting Away
(s0, r0) (s1, r1) (s3, r3) (s2, r2) (s4, r4) (s5, r5) (s6, r6) (s0, r0) (s1, r1) (s3, r3) (s2, r2) (s4, r4) (s5, r5) (s6, r6)
. . .
SLIDE 39
Abstracting Away
(s0, r0) (s1, r1) (s3, r3) (s2, r2) (s4, r4) (s5, r5) (s6, r6)
. . .
SLIDE 40
Abstracting Away
(s0, r0) (s1, r1) (s3, r3) (s2, r2) (s4, r4) (s5, r5) (s6, r6)
. . . eff : rule → state → state fset → bool enabled r s = (∃ss. eff r s ss)
SLIDE 41
Abstracting Away
(s0, r0) (s1, r1) (s3, r3) (s2, r2) (s4, r4) (s5, r5) (s6, r6)
. . . eff : rule → state → state fset → bool enabled r s = (∃ss. eff r s ss) Available ∀s. ∃r. enabled r s Persistent ∀s, r, r ′, s′, ss. enabled r ′ s ∧ r′ = r ∧ eff r s ss ∧ s′ ∈ set ss ⇒ enabled r ′ s′
SLIDE 42
Abstracting Away
(s0, r0) (s1, r1) (s3, r3) (s2, r2) (s4, r4) (s5, r5) (s6, r6)
. . . eff : rule → state → state fset → bool enabled r s = (∃ss. eff r s ss) Available ∀s. ∃r. enabled r s Persistent ∀s, r, r ′, s′, ss. enabled r ′ s ∧ r′ = r ∧ eff r s ss ∧ s′ ∈ set ss ⇒ enabled r ′ s′
codatatype tree = Node (state× rule) (tree fset)
SLIDE 43
Abstracting Away
(s0, r0) (s1, r1) (s3, r3) (s2, r2) (s4, r4) (s5, r5) (s6, r6)
. . . eff : rule → state → state fset → bool enabled r s = (∃ss. eff r s ss) Available ∀s. ∃r. enabled r s Persistent ∀s, r, r ′, s′, ss. enabled r ′ s ∧ r′ = r ∧ eff r s ss ∧ s′ ∈ set ss ⇒ enabled r ′ s′
codatatype tree = Node (state× rule) (tree fset)
eff r s ss s′ ∈ ss epath (SCons (s′, r ′) σ) epath (SCons (s, r) (SCons (s′, r ′) σ))
SLIDE 44
Abstracting Away
(s0, r0) (s1, r1) (s3, r3) (s2, r2) (s4, r4) (s5, r5) (s6, r6)
. . . eff : rule → state → state fset → bool enabled r s = (∃ss. eff r s ss) Available ∀s. ∃r. enabled r s Persistent ∀s, r, r ′, s′, ss. enabled r ′ s ∧ r′ = r ∧ eff r s ss ∧ s′ ∈ set ss ⇒ enabled r ′ s′
codatatype tree = Node (state× rule) (tree fset)
eff r s ss s′ ∈ ss epath (SCons (s′, r ′) σ) epath (SCons (s, r) (SCons (s′, r ′) σ)) Fair ∀r. ev (alw enabledAtr) σ ⇒ alw (ev takenr) σ
SLIDE 45
Theorem (Abstract Completeness)
Assume that the effect relation is available and persistent. Then each state admits either a finite proof tree or a fair escape path.
Proof Idea.
mk Tree : rule stream → state → tree
SLIDE 46
Theorem (Abstract Completeness)
Assume that the effect relation is available and persistent. Then each state admits either a finite proof tree or a fair escape path.
Proof Idea.
mk Tree : rule stream → state → tree mk Tree ρ s = let SCons r ρ′ = sdropWhile (λr. ¬ enabled r s) ρ ss = (εss. eff r s ss) in Node (s, r) (image (mk Tree ρ′) ss)
SLIDE 47 Our CASC-25 Submission
data Stream a = SCons a (Stream a) newtype FSet a = FSet [a] data Tree a = Node a (FSet (Tree a)) fmap f (FSet xs) = FSet (map f xs) sdropWhile p (SCons a s) = if p a then sdropWhile p s else SCons a s mkTree eff rho s = Node (s, r) (fmap (mkTree eff rho’) (fromJust (eff r s))) where SCons r rho’ = sdropWhile (\r -> not (isJust (eff r s))) rho
SLIDE 48 Our CASC-25 Submission
data Stream a = SCons a (Stream a) newtype FSet a = FSet [a] data Tree a = Node a (FSet (Tree a)) fmap f (FSet xs) = FSet (map f xs) sdropWhile p (SCons a s) = if p a then sdropWhile p s else SCons a s mkTree eff rho s = Node (s, r) (fmap (mkTree eff rho’) (fromJust (eff r s))) where SCons r rho’ = sdropWhile (\r -> not (isJust (eff r s))) rho
SLIDE 49 Conclusion
Our complete abstract proof:
- 425 lines of Isabelle (≈ 8 pages)
- Rigorous
- Formal (mechanized)
- Coinductive
SLIDE 50 Conclusion
Our complete abstract proof:
- 425 lines of Isabelle (≈ 8 pages)
- Rigorous
- Formal (mechanized)
- Coinductive
A key part of “mechanized metatheory of Sledgehammer”
SLIDE 51 Conclusion
Our complete abstract proof:
- 425 lines of Isabelle (≈ 8 pages)
- Rigorous
- Formal (mechanized)
- Coinductive
A key part of “mechanized metatheory of Sledgehammer” Future work:
- Completeness for resolution, superposition, ... ?
SLIDE 52 Evangelizing presupposes a desire in the Church to come out of
- herself. ... When the Church does not come out of herself to
evangelize, she becomes self-referential and then gets sick. The evils that, over time, happen in ecclesial institutions have their root in self-referentiality and a kind of theological narcissism. Jorge Mario Bergoglio