Slide 1

Slide 1 text

Proving decidability of Intuitionistic Propositional Calculus on Coq Masaki Hara (qnighy) University of Tokyo, first grade Logic Zoo 2013 にて

Slide 2

Slide 2 text

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

Slide 3

Slide 3 text

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

Slide 4

Slide 4 text

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.

Slide 5

Slide 5 text

Known results • cf. classical counterpart of this problem is co-NP complete. – Proof: find counterexample in boolean-valued semantics (SAT).

Slide 6

Slide 6 text

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 <.

Slide 7

Slide 7 text

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

Slide 8

Slide 8 text

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

Slide 9

Slide 9 text

Sequent Calculus LJ • Γ⊢ ,Γ⊢ ,,Γ⊢ ,Γ⊢ Γ⊢ ,Δ⊢ Γ,Δ⊢ () • ⊢ ⊥⊢ () • Γ⊢ ,Γ⊢ →,Γ⊢ → ,Γ⊢ Γ⊢→ (→ ) • ,,Γ⊢ ∧,Γ⊢ ∧ Γ⊢ Γ⊢ Γ⊢∧ (∧ ) • ,Γ⊢ ,Γ⊢ ∨,Γ⊢ ∨ Γ⊢ Γ⊢∨ ∨1 Γ⊢ Γ⊢∨ ∨2 • We eliminate cut rule first.

Slide 10

Slide 10 text

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,Δ⊢ ,Δ⊢ Γ,Δ⊢ (∨ )

Slide 11

Slide 11 text

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) ■

Slide 12

Slide 12 text

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

Slide 13

Slide 13 text

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

Slide 14

Slide 14 text

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

Slide 15

Slide 15 text

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

Slide 16

Slide 16 text

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

Slide 17

Slide 17 text

Proof of weak rule • Easily done by induction ■

Slide 18

Slide 18 text

Proof of contr rule • 1. prove these rules by induction on proof structure. – ∧,Γ⊢ ,,Γ⊢ ∧ ∨,Γ⊢ ,Γ⊢ ∨1 ∨,Γ⊢ ,Γ⊢ (∨2 ) – →,Γ⊢ ,Γ⊢ (→ ) • 2. prove contr rule by induction on proof structure.■

Slide 19

Slide 19 text

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

Slide 20

Slide 20 text

Contraction-free LJ • ,Γ⊢ ⊥,Γ⊢ () • →,Γ⊢ ,Γ⊢ →,Γ⊢ → ,Γ⊢ Γ⊢→ (→ ) • ,,Γ⊢ ∧,Γ⊢ ∧ Γ⊢ Γ⊢ Γ⊢∧ (∧ ) • ,Γ⊢ ,Γ⊢ ∨,Γ⊢ ∨ Γ⊢ Γ⊢∨ ∨1 Γ⊢ Γ⊢∨ ∨2 • This time, → rule is not decreasing

Slide 21

Slide 21 text

Terminating LJ • Split →,Γ⊢ ,Γ⊢ →,Γ⊢ → into 4 pieces 1. , ,Γ⊢ →, ,Γ⊢ →1 2. →,Γ⊢→ C,Γ⊢ → →,Γ⊢ (→2 ) 3. → → ,Γ⊢ ∧ →,Γ⊢ (→3 ) 4. →,→,Γ⊢ ∨ →,Γ⊢ (→4 )

Slide 22

Slide 22 text

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

Slide 23

Slide 23 text

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

Slide 24

Slide 24 text

Terminating LJ • ,Γ⊢ ⊥,Γ⊢ () • , ,Γ⊢ →, ,Γ⊢ →1 →,Γ⊢→ C,Γ⊢ → →,Γ⊢ →2 • → → ,Γ⊢ ∧ →,Γ⊢ →3 →,→,Γ⊢ ∨ →,Γ⊢ →4 • ,Γ⊢ Γ⊢→ → ,,Γ⊢ ∧,Γ⊢ ∧ Γ⊢ Γ⊢ Γ⊢∧ (∧ ) • ,Γ⊢ ,Γ⊢ ∨,Γ⊢ ∨ Γ⊢ Γ⊢∨ ∨1 Γ⊢ Γ⊢∨ ∨2

Slide 25

Slide 25 text

Proof of termination • Weight of Proposition – = 1 – ⊥ = 1 – → = + + 1 – ∧ = + + 2 – ∨ = + + 1 • < ⇔ < ()

Slide 26

Slide 26 text

Proof of termination • ordering of Proposition List – Use Multiset ordering (Dershowitz and Manna ordering)

Slide 27

Slide 27 text

Multiset Ordering • Multiset Ordering: a binary relation between multisets (not necessarily be ordering) • > ⇔ A B Not empty

Slide 28

Slide 28 text

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

Slide 29

Slide 29 text

Multiset Ordering Proof • 1. induction on list • Nil ⇒ there is no such that < Nil, therefore it’s accessible. • We will prove: ⇒ ( ∷ )

Slide 30

Slide 30 text

Multiset Ordering • 2. duplicate assumption • Using () and (), we will prove ⇒ ( ∷ ) • 3. induction on and – We can use these two inductive hypotheses. 1. ∀ , < ⇒ ⇒ ( ∷ ) 2. ∀, < ⇒ ⇒ ( ∷ )

Slide 31

Slide 31 text

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.

Slide 32

Slide 32 text

Decidability • Now, decidability can be proved by induction on the size of sequent.

Slide 33

Slide 33 text

Implementation Detail •

Slide 34

Slide 34 text

IPC Proposition (Coq) • Inductive PProp:Set := | PPbot : PProp | PPatom : nat -> PProp | PPimpl : PProp -> PProp -> PProp | PPconj : PProp -> PProp -> PProp | PPdisj : PProp -> PProp -> PProp.

Slide 35

Slide 35 text

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 …

Slide 36

Slide 36 text

Exchange rule • Exchange rule : Γ, , , Δ ⊢ Γ, , , Δ ⊢ ℎ is replaced by more useful Γ ⊢ Γ′ ⊢ where Γ, Γ′ are permutation

Slide 37

Slide 37 text

Permutation Compatibility (Coq) • Allows rewriting over Permutation equality Instance LJ_provable_compat : Proper (@Permutation _==>eq==>iff) LJ_provable.

Slide 38

Slide 38 text

Permutation solver (Coq) • Permutation should be solved automatically Ltac perm := match goal with …

Slide 39

Slide 39 text

Further implementation plan •

Slide 40

Slide 40 text

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

Slide 41

Slide 41 text

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

Slide 42

Slide 42 text

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

Slide 43

Slide 43 text

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

Slide 44

Slide 44 text

Source code • Source codes are: • https://github.com/qnighy/IPC-Coq

Slide 45

Slide 45 text

おわり 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

Slide 46

Slide 46 text

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