[feature] Adds proofs for atoms true at level 0

This commit is contained in:
Guillaume Bury 2016-04-06 15:32:12 +02:00
parent 9a5c23d9c5
commit 0186edbf34
2 changed files with 17 additions and 2 deletions

View file

@ -96,6 +96,16 @@ module Make(St : Solver_types.S) = struct
St.make_clause (fresh_pcl_name ()) [] 0 true (St.History (c :: l))
(List.fold_left (fun i c -> max i c.St.c_level) 0 l)
let prove_atom a =
if St.(a.is_true && a.var.v_level = 0) then begin
match St.(a.var.reason) with
| St.Bcp Some c ->
assert (Vec.size St.(c.atoms) = 1 && equal_atoms a (Vec.get St.(c.atoms) 0));
Some c
| _ -> assert false
end else
None
(* Interface exposed *)
type proof = clause
and proof_node = {

View file

@ -29,7 +29,8 @@ module type S = sig
| Hypothesis
| Lemma of lemma
| Resolution of proof * proof * atom
(** Lazy type for proof trees. Proofs can be extended to proof nodes using functions defined later. *)
(** Lazy type for proof trees. Proofs are persistent objects, and can be
extended to proof nodes using functions defined later. *)
(** {3 Resolution helpers} *)
val to_list : clause -> atom list
@ -46,12 +47,16 @@ module type S = sig
(** {3 Proof building functions} *)
val prove : clause -> proof
(** Same as 'learn', but works on single clauses instead of vectors. *)
(** Given a clause, return a proof of that clause.
@raise Insuficient_hyps if it does not succeed. *)
val prove_unsat : clause -> proof
(** Given a conflict clause [c], returns a proof of the empty clause.
@raise Insuficient_hyps if it does not succeed. *)
val prove_atom : atom -> proof option
(** Given an atom [a], returns a proof of the clause [\[a\]] if [a] is true at level 0 *)
(** {3 Proof Manipulation} *)
val expand : proof -> proof_node