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 weak rule
โข Easily done by induction โ
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.
Implementation Detail
โข
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
โข
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
Source code
โข Source codes are:
โข https://github.com/qnighy/IPC-Coq
ใใใ
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