DPLL in Coq

DPLL in Coq
Zhuang Zhong 11-05-2008
Overview

Previous work




Stålmarck algorithm and Binary Decision Diagram
Produce traces of proof
Reconstruct proof term
This work



Formalization of DPLL algorithm
Good use of module type
Proof by reflexivity
Decision Procedure
1.
2.
3.
Make a conjunction F of all the Hypotheses
Convert F to CNF form
Convert F to f with respect to abstract model
(reify)
(FClause
(COr (CLit (Left_idx (Left_idx
End_idx), true))
(COr (CLit (Right_idx End_idx,
false))
(CLit (Left_idx End_idx,
false)))))
Decision Procedure cont.
4.
5.
6.
7.
8.
Measure possible steps about the formula
Compute proof_search(  |- (make f))=
Unsat
If equal, then proof complete
Else, it will print the counter model
The whole procedure is wrap by a tactic
unsat.
Model

Semantics of the abstract formula
Definition model := {M : F.L.t -> Prop | wf_model M}.
Definition sat_clause (M : model) (C : F.LSet.t) :=
exists l, M l /\ F.LSet.In l C.
Definition sat_goal (M : model) (D : F.CSet.t) :=
forall C, F.CSet.In C D -> sat_clause M C.
Definition submodel (G : F.LSet.t) (M : model) :=
forall l, F.LSet.In l G -> (M l /\ ~F.LSet.In (F.L.mk_not l)
G).
Definition incompatible (G : F.LSet.t) (D : F.CSet.t) :=
forall (M : model), submodel G M -> ~sat_goal M D.
Interpretation

Variable




Use varmap (Require Import Quote)
Varmap is quite like a binary tree
index*bool -> lookup index varmap
Formula



Inductive type formula
reify_formula Formula varmap
Generate sequent
Modularity

Module Type & Module



Module Type is a signature
Module can be parameterized with other module
and instantiated to match a certain module type
In this work

Module Types


Module


LITERAL, CNF
LProp, CNFProp…
Advantage

High level abstraction

Eg. Different prop, different pick method
Example

A /\ (C \/ ~B /\ (~D -> ~A)) -> B /\ ~A -> D
/\ D /\ ~ A.

E -> F /\ (A -> A) \/ ~B \/ ~C /\ D -> C \/
~C /\ ~(B \/ F) -> D \/ ~E.
Conclusion


Develop a tactic in Coq like omega, ring…
What can be done:


Optimization
Combine with other decision procedure


Congruence, linear arithmetic…
Next week


Decision procedures above
Read more about this work