230

# Proving Decidability of Intuitionistic Propositional Calculus on Coq

January 31, 2013

## Transcript

1. ### Proving decidability of Intuitionistic Propositional Calculus on Coq Masaki Hara

(qnighy) University of Tokyo, first grade Logic Zoo 2013 にて
2. ### 1. Task & Known results 2. Brief methodology of the

proof 1. Cut elimination 2. Contraction elimination 3. → elimination 4. Proof of strictly-decreasingness 3. Implementation detail 4. Further implementation plan
3. ### Task • Proposition: , ∧, ∨, →, ⊥ • Task:

Is given propositional formula P provable in LJ? – It’s known to be decidable. [Dyckhoff] • This talk: how to prove this decidability on Coq
4. ### Known results • Decision problem on IPC is PSPACE complete

[Statman] – Especially, O(N log N) space decision procedure is known [Hudelmaier] • These approaches are backtracking on LJ syntax.
5. ### Known results • cf. classical counterpart of this problem is

co-NP complete. – Proof: find counterexample in boolean-valued semantics (SAT).
6. ### methodology • To prove decidability, all rules should be strictly

decreasing on some measuring. • More formally, for all rules 1,2,…, 0 and all number (1 ≤ ≤ ), < 0 on certain well-founded relation <.
7. ### methodology 1. Eliminate cut rule of LJ 2. Eliminate contraction

rule 3. Split → rule into 4 pieces 4. Prove that every rule is strictly decreasing
8. ### Sequent Calculus LJ • Γ⊢ ,Γ⊢ ,,Γ⊢ ,Γ⊢ Γ⊢ ,Δ⊢

Γ,Δ⊢ () • ⊢ ⊥⊢ () • Γ⊢ ,Γ⊢ →,Γ⊢ → ,Γ⊢ Γ⊢→ (→ ) • ,,Γ⊢ ∧,Γ⊢ ∧ Γ⊢ Γ⊢ Γ⊢∧ (∧ ) • ,Γ⊢ ,Γ⊢ ∨,Γ⊢ ∨ Γ⊢ Γ⊢∨ ∨1 Γ⊢ Γ⊢∨ ∨2 •
9. ### Sequent Calculus LJ • Γ⊢ ,Γ⊢ ,,Γ⊢ ,Γ⊢ Γ⊢ ,Δ⊢

Γ,Δ⊢ () • ⊢ ⊥⊢ () • Γ⊢ ,Γ⊢ →,Γ⊢ → ,Γ⊢ Γ⊢→ (→ ) • ,,Γ⊢ ∧,Γ⊢ ∧ Γ⊢ Γ⊢ Γ⊢∧ (∧ ) • ,Γ⊢ ,Γ⊢ ∨,Γ⊢ ∨ Γ⊢ Γ⊢∨ ∨1 Γ⊢ Γ⊢∨ ∨2 • We eliminate cut rule first.
10. ### Cut elimination • 1. Prove these rule by induction on

proof structure. • Γ⊢ Δ,Γ⊢ Δ,Δ,Γ⊢ Δ,Γ⊢ • Γ⊢⊥ Γ⊢ ⊥ • Γ⊢∧ Γ⊢ ∧1 Γ⊢∧ Γ⊢ ∧2 • Γ⊢→ ,Γ⊢ → • If Γ1⊢ ,Δ1⊢1 Γ1,Δ1⊢1 ( ) and Γ2⊢ ,Δ2⊢2 Γ2,Δ2⊢2 ( ) for all Γ1 , Γ2 , Δ1 , Δ2 , 1 , 2 , then Γ⊢∨ A,Δ⊢ ,Δ⊢ Γ,Δ⊢ (∨ )
11. ### Cut elimination • 2. Prove the general cut rule Γ

⊢ 　, Δ ⊢ Γ, Δ ⊢ by induction on the size of and proof structure of the right hand. • 3. specialize (n = 1) ▪
12. ### Cut-free LJ • Γ⊢ ,Γ⊢ ,,Γ⊢ ,Γ⊢ • ⊢ ⊥⊢

() • Γ⊢ ,Γ⊢ →,Γ⊢ → ,Γ⊢ Γ⊢→ (→ ) • ,,Γ⊢ ∧,Γ⊢ ∧ Γ⊢ Γ⊢ Γ⊢∧ (∧ ) • ,Γ⊢ ,Γ⊢ ∨,Γ⊢ ∨ Γ⊢ Γ⊢∨ ∨1 Γ⊢ Γ⊢∨ ∨2 •
13. ### Cut-free LJ • Γ⊢ ,Γ⊢ ,,Γ⊢ ,Γ⊢ • ⊢ ⊥⊢

() • Γ⊢ ,Γ⊢ →,Γ⊢ → ,Γ⊢ Γ⊢→ (→ ) • ,,Γ⊢ ∧,Γ⊢ ∧ Γ⊢ Γ⊢ Γ⊢∧ (∧ ) • ,Γ⊢ ,Γ⊢ ∨,Γ⊢ ∨ Γ⊢ Γ⊢∨ ∨1 Γ⊢ Γ⊢∨ ∨2 • Contraction rule is not strictly decreasing
14. ### Contraction-free LJ • ,Γ⊢ ⊥,Γ⊢ () • →,Γ⊢ ,Γ⊢ →,Γ⊢

→ ,Γ⊢ Γ⊢→ (→ ) • ,,Γ⊢ ∧,Γ⊢ ∧ Γ⊢ Γ⊢ Γ⊢∧ (∧ ) • ,Γ⊢ ,Γ⊢ ∨,Γ⊢ ∨ Γ⊢ Γ⊢∨ ∨1 Γ⊢ Γ⊢∨ ∨2
15. ### Contraction-free LJ • Implicit weak – ,Γ⊢ ⊥,Γ⊢ () •

Implicit contraction – →,Γ⊢ ,Γ⊢ →,Γ⊢ → – Γ⊢ Γ⊢ Γ⊢∧ (∧ ) – ,Γ⊢ ,Γ⊢ ∨,Γ⊢ ∨
16. ### Contraction-free LJ • Implicit weak – ,Γ⊢ ⊥,Γ⊢ () •

Implicit contraction – →,Γ⊢ ,Γ⊢ →,Γ⊢ → – Γ⊢ Γ⊢ Γ⊢∧ (∧ ) – ,Γ⊢ ,Γ⊢ ∨,Γ⊢ ∨

18. ### Proof of contr rule • 1. prove these rules by

induction on proof structure. – ∧,Γ⊢ ,,Γ⊢ ∧ ∨,Γ⊢ ,Γ⊢ ∨1 ∨,Γ⊢ ,Γ⊢ (∨2 ) – →,Γ⊢ ,Γ⊢ (→ ) • 2. prove contr rule by induction on proof structure.▪
19. ### Contraction-free LJ • ,Γ⊢ ⊥,Γ⊢ () • →,Γ⊢ ,Γ⊢ →,Γ⊢

→ ,Γ⊢ Γ⊢→ (→ ) • ,,Γ⊢ ∧,Γ⊢ ∧ Γ⊢ Γ⊢ Γ⊢∧ (∧ ) • ,Γ⊢ ,Γ⊢ ∨,Γ⊢ ∨ Γ⊢ Γ⊢∨ ∨1 Γ⊢ Γ⊢∨ ∨2
20. ### Contraction-free LJ • ,Γ⊢ ⊥,Γ⊢ () • →,Γ⊢ ,Γ⊢ →,Γ⊢

→ ,Γ⊢ Γ⊢→ (→ ) • ,,Γ⊢ ∧,Γ⊢ ∧ Γ⊢ Γ⊢ Γ⊢∧ (∧ ) • ,Γ⊢ ,Γ⊢ ∨,Γ⊢ ∨ Γ⊢ Γ⊢∨ ∨1 Γ⊢ Γ⊢∨ ∨2 • This time, → rule is not decreasing
21. ### Terminating LJ • Split →,Γ⊢ ,Γ⊢ →,Γ⊢ → into 4

pieces 1. , ,Γ⊢ →, ,Γ⊢ →1 2. →,Γ⊢→ C,Γ⊢ → →,Γ⊢ (→2 ) 3. → → ,Γ⊢ ∧ →,Γ⊢ (→3 ) 4. →,→,Γ⊢ ∨ →,Γ⊢ (→4 )
22. ### Correctness of Terminating LJ • 1. If Γ ⊢ is

provable in Contraction-free LJ, At least one of these is true: – Γ includes ⊥, ∧ , or ∨ – Γ includes both () and → – Γ ⊢ has a proof whose bottommost rule is not the form of →, ,Γ⊢ , ,Γ⊢ →,(),Γ⊢ (→ ) • Proof: induction on proof structure
23. ### Correctness of Terminating LJ • 2. every sequent provable in

Contraction-free LJ is also provable in Terminating LJ. • Proof: induction by size of the sequent. – Size: we will introduce later
24. ### Terminating LJ • ,Γ⊢ ⊥,Γ⊢ () • , ,Γ⊢ →,

,Γ⊢ →1 →,Γ⊢→ C,Γ⊢ → →,Γ⊢ →2 • → → ,Γ⊢ ∧ →,Γ⊢ →3 →,→,Γ⊢ ∨ →,Γ⊢ →4 • ,Γ⊢ Γ⊢→ → ,,Γ⊢ ∧,Γ⊢ ∧ Γ⊢ Γ⊢ Γ⊢∧ (∧ ) • ,Γ⊢ ,Γ⊢ ∨,Γ⊢ ∨ Γ⊢ Γ⊢∨ ∨1 Γ⊢ Γ⊢∨ ∨2
25. ### Proof of termination • Weight of Proposition – = 1

– ⊥ = 1 – → = + + 1 – ∧ = + + 2 – ∨ = + + 1 • < ⇔ < ()
26. ### Proof of termination • ordering of Proposition List – Use

Multiset ordering (Dershowitz and Manna ordering)
27. ### Multiset Ordering • Multiset Ordering: a binary relation between multisets

(not necessarily be ordering) • > ⇔ A B Not empty
28. ### Multiset Ordering • If is a well-founded binary relation, the

Multiset Ordering over is also well-founded. • Well-founded: every element is accessible • is accessible : every element such that < is accessible
29. ### Multiset Ordering Proof • 1. induction on list • Nil

⇒ there is no such that < Nil, therefore it’s accessible. • We will prove: ⇒ ( ∷ )
30. ### Multiset Ordering • 2. duplicate assumption • Using () and

(), we will prove ⇒ ( ∷ ) • 3. induction on and – We can use these two inductive hypotheses. 1. ∀ , < ⇒ ⇒ ( ∷ ) 2. ∀, < ⇒ ⇒ ( ∷ )
31. ### Multiset Ordering • 4. Case Analysis • By definition, (

∷ ) is equivalent to ∀, < ( ∷ ) ⇒ () • And there are 3 patterns: 1. includes 2. includes s s.t. < , and minus all such is equal to 3. includes s s.t. < , and minus all such is less than • Each pattern is proved using the Inductive Hypotheses.
32. ### Decidability • Now, decidability can be proved by induction on

the size of sequent.

34. ### IPC Proposition (Coq) • Inductive PProp:Set := | PPbot :

PProp | PPatom : nat -> PProp | PPimpl : PProp -> PProp -> PProp | PPconj : PProp -> PProp -> PProp | PPdisj : PProp -> PProp -> PProp.
35. ### Cut-free LJ (Coq) • Inductive LJ_provable : list PProp ->

PProp -> Prop := | LJ_perm P1 L1 L2 : Permutation L1 L2 -> LJ_provable L1 P1 -> LJ_provable L2 P1 | LJ_weak P1 P2 L1 : LJ_provable L1 P2 -> LJ_provable (P1::L1) P2 | LJ_contr P1 P2 L1 : LJ_provable (P1::P1::L1) P2 -> LJ_provable (P1::L1) P2 …
36. ### Exchange rule • Exchange rule : Γ, , , Δ

⊢ Γ, , , Δ ⊢ ℎ is replaced by more useful Γ ⊢ Γ′ ⊢ where Γ, Γ′ are permutation
37. ### Permutation Compatibility (Coq) • Allows rewriting over Permutation equality Instance

LJ_provable_compat : Proper (@Permutation _==>eq==>iff) LJ_provable.
38. ### Permutation solver (Coq) • Permutation should be solved automatically Ltac

perm := match goal with …

40. ### Further implementation plan • Refactoring (1) : improve Permutation- associated

tactics – A smarter auto-unifying tactics is needed – Write tactics using Objective Caml • Refactoring (2) : use Ssreflect tacticals – This makes the proof more manageable
41. ### Further implementation plan • Refactoring (3) : change proof order

– Contraction first, cut next – It will make the proof shorter • Refactoring (4) : discard Multiset Ordering – If we choose appropriate weight function of Propositional Formula, we don’t need Multiset Ordering. (See [Hudelmaier]) – It also enables us to analyze complexity of this procedure
42. ### Further implementation plan • Refactoring (5) : Proof of completeness

– Now completeness theorem depends on the decidability • New Theorem (1) : Other Syntaxes – NJ and HJ may be introduced • New Theorem (2) : Other Semantics – Heyting Algebra
43. ### Further implementation plan • New Theorem (3) : Other decision

procedure – Decision procedure using semantics (if any) – More efficient decision procedure (especially ( log )-space decision procedure) • New Theorem (4) : Complexity – Proof of PSPACE-completeness

45. ### おわり 1. Task & Known results 2. Brief methodology of

the proof 1. Cut elimination 2. Contraction elimination 3. → elimination 4. Proof of strictly-decreasingness 3. Implementation detail 4. Further implementation plan
46. ### References • [Dyckhoff] Roy Dyckhoff, Contraction-free Sequent Calculi for Intuitionistic

Logic, The Journal of Symbolic Logic, Vol. 57, No.3, 1992, pp. 795 – 807 • [Statman] Richard Statman, Intuitionistic Propositional Logic is Polynomial-Space Complete, Theoretical Computer Science 9, 1979, pp. 67 – 72 • [Hudelmaier] Jörg Hudelmaier, An O(n log n)-Space Decision Procedure for Intuitionistic Propositional Logic, Journal of Logic and Computation, Vol. 3, Issue 1, pp. 63-75