Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Proving Decidability of Intuitionistic Propositional Calculus on Coq

Masaki Hara
January 31, 2013

Proving Decidability of Intuitionistic Propositional Calculus on Coq

直観主義命題論理の決定性をCoqで証明した話 @ Logic Zoo Workshop 2013 http://logiczoo13.pira.jp/

Masaki Hara

January 31, 2013
Tweet

More Decks by Masaki Hara

Other Decks in Technology

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 – →,Γ⊢ ,Γ⊢ →,Γ⊢ → – Γ⊢ Γ⊢ Γ⊢∧ (∧ ) – ,Γ⊢ ,Γ⊢ ∨,Γ⊢ ∨
  17. Proof of contr rule • 1. prove these rules by

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

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

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

    pieces 1. , ,Γ⊢ →, ,Γ⊢ →1 2. →,Γ⊢→ C,Γ⊢ → →,Γ⊢ (→2 ) 3. → → ,Γ⊢ ∧ →,Γ⊢ (→3 ) 4. →,→,Γ⊢ ∨ →,Γ⊢ (→4 )
  21. 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
  22. 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
  23. Terminating LJ • ,Γ⊢ ⊥,Γ⊢ () • , ,Γ⊢ →,

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

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

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

    (not necessarily be ordering) • > ⇔ A B Not empty
  27. 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
  28. Multiset Ordering Proof • 1. induction on list • Nil

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

    (), we will prove ⇒ ( ∷ ) • 3. induction on and – We can use these two inductive hypotheses. 1. ∀ , < ⇒ ⇒ ( ∷ ) 2. ∀, < ⇒ ⇒ ( ∷ )
  30. 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.
  31. IPC Proposition (Coq) • Inductive PProp:Set := | PPbot :

    PProp | PPatom : nat -> PProp | PPimpl : PProp -> PProp -> PProp | PPconj : PProp -> PProp -> PProp | PPdisj : PProp -> PProp -> PProp.
  32. 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 …
  33. Exchange rule • Exchange rule : Γ, , , Δ

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

    LJ_provable_compat : Proper (@Permutation _==>eq==>iff) LJ_provable.
  35. 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
  36. 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
  37. 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
  38. 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
  39. おわり 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
  40. 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