Share
Embed
Proving Decidability of Intuitionistic Propositional Calculus on Coq
直観主義命題論理の決定性をCoqで証明した話 @ Logic Zoo Workshop 2013 http://logiczoo13.pira.jp/
Masaki Hara
January 31, 2013
Transcript
46 slides
-
Proving decidability of Intuitionistic Propositional Calculus on Coq Masaki Hara
(qnighy) University of Tokyo, first grade Logic Zoo 2013 にて -
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 -
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 -
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. -
Known results • cf. classical counterpart of this problem is
co-NP complete. – Proof: find counterexample in boolean-valued semantics (SAT). -
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 <. -
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 -
Sequent Calculus LJ • Γ⊢ ,Γ⊢ ,,Γ⊢ ,Γ⊢ Γ⊢ ,Δ⊢
Γ,Δ⊢ () • ⊢ ⊥⊢ () • Γ⊢ ,Γ⊢ →,Γ⊢ → ,Γ⊢ Γ⊢→ (→ ) • ,,Γ⊢ ∧,Γ⊢ ∧ Γ⊢ Γ⊢ Γ⊢∧ (∧ ) • ,Γ⊢ ,Γ⊢ ∨,Γ⊢ ∨ Γ⊢ Γ⊢∨ ∨1 Γ⊢ Γ⊢∨ ∨2 • -
Sequent Calculus LJ • Γ⊢ ,Γ⊢ ,,Γ⊢ ,Γ⊢ Γ⊢ ,Δ⊢
Γ,Δ⊢ () • ⊢ ⊥⊢ () • Γ⊢ ,Γ⊢ →,Γ⊢ → ,Γ⊢ Γ⊢→ (→ ) • ,,Γ⊢ ∧,Γ⊢ ∧ Γ⊢ Γ⊢ Γ⊢∧ (∧ ) • ,Γ⊢ ,Γ⊢ ∨,Γ⊢ ∨ Γ⊢ Γ⊢∨ ∨1 Γ⊢ Γ⊢∨ ∨2 • We eliminate cut rule first. -
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,Δ⊢ ,Δ⊢ Γ,Δ⊢ (∨ ) -
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) ▪ -
Cut-free LJ • Γ⊢ ,Γ⊢ ,,Γ⊢ ,Γ⊢ • ⊢ ⊥⊢
() • Γ⊢ ,Γ⊢ →,Γ⊢ → ,Γ⊢ Γ⊢→ (→ ) • ,,Γ⊢ ∧,Γ⊢ ∧ Γ⊢ Γ⊢ Γ⊢∧ (∧ ) • ,Γ⊢ ,Γ⊢ ∨,Γ⊢ ∨ Γ⊢ Γ⊢∨ ∨1 Γ⊢ Γ⊢∨ ∨2 • -
Cut-free LJ • Γ⊢ ,Γ⊢ ,,Γ⊢ ,Γ⊢ • ⊢ ⊥⊢
() • Γ⊢ ,Γ⊢ →,Γ⊢ → ,Γ⊢ Γ⊢→ (→ ) • ,,Γ⊢ ∧,Γ⊢ ∧ Γ⊢ Γ⊢ Γ⊢∧ (∧ ) • ,Γ⊢ ,Γ⊢ ∨,Γ⊢ ∨ Γ⊢ Γ⊢∨ ∨1 Γ⊢ Γ⊢∨ ∨2 • Contraction rule is not strictly decreasing -
Contraction-free LJ • ,Γ⊢ ⊥,Γ⊢ () • →,Γ⊢ ,Γ⊢ →,Γ⊢
→ ,Γ⊢ Γ⊢→ (→ ) • ,,Γ⊢ ∧,Γ⊢ ∧ Γ⊢ Γ⊢ Γ⊢∧ (∧ ) • ,Γ⊢ ,Γ⊢ ∨,Γ⊢ ∨ Γ⊢ Γ⊢∨ ∨1 Γ⊢ Γ⊢∨ ∨2 -
Contraction-free LJ • Implicit weak – ,Γ⊢ ⊥,Γ⊢ () •
Implicit contraction – →,Γ⊢ ,Γ⊢ →,Γ⊢ → – Γ⊢ Γ⊢ Γ⊢∧ (∧ ) – ,Γ⊢ ,Γ⊢ ∨,Γ⊢ ∨ -
Contraction-free LJ • Implicit weak – ,Γ⊢ ⊥,Γ⊢ () •
Implicit contraction – →,Γ⊢ ,Γ⊢ →,Γ⊢ → – Γ⊢ Γ⊢ Γ⊢∧ (∧ ) – ,Γ⊢ ,Γ⊢ ∨,Γ⊢ ∨ -
Proof of contr rule • 1. prove these rules by
induction on proof structure. – ∧,Γ⊢ ,,Γ⊢ ∧ ∨,Γ⊢ ,Γ⊢ ∨1 ∨,Γ⊢ ,Γ⊢ (∨2 ) – →,Γ⊢ ,Γ⊢ (→ ) • 2. prove contr rule by induction on proof structure.▪ -
Contraction-free LJ • ,Γ⊢ ⊥,Γ⊢ () • →,Γ⊢ ,Γ⊢ →,Γ⊢
→ ,Γ⊢ Γ⊢→ (→ ) • ,,Γ⊢ ∧,Γ⊢ ∧ Γ⊢ Γ⊢ Γ⊢∧ (∧ ) • ,Γ⊢ ,Γ⊢ ∨,Γ⊢ ∨ Γ⊢ Γ⊢∨ ∨1 Γ⊢ Γ⊢∨ ∨2 -
Contraction-free LJ • ,Γ⊢ ⊥,Γ⊢ () • →,Γ⊢ ,Γ⊢ →,Γ⊢
→ ,Γ⊢ Γ⊢→ (→ ) • ,,Γ⊢ ∧,Γ⊢ ∧ Γ⊢ Γ⊢ Γ⊢∧ (∧ ) • ,Γ⊢ ,Γ⊢ ∨,Γ⊢ ∨ Γ⊢ Γ⊢∨ ∨1 Γ⊢ Γ⊢∨ ∨2 • This time, → rule is not decreasing -
Terminating LJ • Split →,Γ⊢ ,Γ⊢ →,Γ⊢ → into 4
pieces 1. , ,Γ⊢ →, ,Γ⊢ →1 2. →,Γ⊢→ C,Γ⊢ → →,Γ⊢ (→2 ) 3. → → ,Γ⊢ ∧ →,Γ⊢ (→3 ) 4. →,→,Γ⊢ ∨ →,Γ⊢ (→4 ) -
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 -
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 -
Terminating LJ • ,Γ⊢ ⊥,Γ⊢ () • , ,Γ⊢ →,
,Γ⊢ →1 →,Γ⊢→ C,Γ⊢ → →,Γ⊢ →2 • → → ,Γ⊢ ∧ →,Γ⊢ →3 →,→,Γ⊢ ∨ →,Γ⊢ →4 • ,Γ⊢ Γ⊢→ → ,,Γ⊢ ∧,Γ⊢ ∧ Γ⊢ Γ⊢ Γ⊢∧ (∧ ) • ,Γ⊢ ,Γ⊢ ∨,Γ⊢ ∨ Γ⊢ Γ⊢∨ ∨1 Γ⊢ Γ⊢∨ ∨2 -
Proof of termination • Weight of Proposition – = 1
– ⊥ = 1 – → = + + 1 – ∧ = + + 2 – ∨ = + + 1 • < ⇔ < () -
Proof of termination • ordering of Proposition List – Use
Multiset ordering (Dershowitz and Manna ordering) -
Multiset Ordering • Multiset Ordering: a binary relation between multisets
(not necessarily be ordering) • > ⇔ A B Not empty -
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 -
Multiset Ordering Proof • 1. induction on list • Nil
⇒ there is no such that < Nil, therefore it’s accessible. • We will prove: ⇒ ( ∷ ) -
Multiset Ordering • 2. duplicate assumption • Using () and
(), we will prove ⇒ ( ∷ ) • 3. induction on and – We can use these two inductive hypotheses. 1. ∀ , < ⇒ ⇒ ( ∷ ) 2. ∀, < ⇒ ⇒ ( ∷ ) -
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. -
Decidability • Now, decidability can be proved by induction on
the size of sequent. -
IPC Proposition (Coq) • Inductive PProp:Set := | PPbot :
PProp | PPatom : nat -> PProp | PPimpl : PProp -> PProp -> PProp | PPconj : PProp -> PProp -> PProp | PPdisj : PProp -> PProp -> PProp. -
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 … -
Exchange rule • Exchange rule : Γ, , , Δ
⊢ Γ, , , Δ ⊢ ℎ is replaced by more useful Γ ⊢ Γ′ ⊢ where Γ, Γ′ are permutation -
Permutation Compatibility (Coq) • Allows rewriting over Permutation equality Instance
LJ_provable_compat : Proper (@Permutation _==>eq==>iff) LJ_provable. -
Permutation solver (Coq) • Permutation should be solved automatically Ltac
perm := match goal with … -
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 -
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 -
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 -
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 -
おわり 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 -
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