refactor: modifications asked by @gbury in review

This commit is contained in:
Simon Cruanes 2019-02-26 19:03:47 -06:00 committed by Guillaume Bury
parent 7a050df902
commit 2aa9b3d4bc
3 changed files with 12 additions and 6 deletions

View file

@ -79,7 +79,7 @@ module Make(S : Msat.S)(A : Arg with type atom := S.atom
let print_edges fmt n = let print_edges fmt n =
match P.(n.step) with match P.(n.step) with
| P.Hyper_res {P.hr_steps=[];_} -> () (* NOTE: should never happen *) | P.Hyper_res {P.hr_steps=[];_} -> assert false (* NOTE: should never happen *)
| P.Hyper_res {P.hr_init; hr_steps=((_,p0)::_) as l} -> | P.Hyper_res {P.hr_init; hr_steps=((_,p0)::_) as l} ->
print_edge fmt (res_np_id n p0) (proof_id hr_init); print_edge fmt (res_np_id n p0) (proof_id hr_init);
List.iter List.iter

View file

@ -610,10 +610,6 @@ module Make(Plugin : PLUGIN)
let duplicates, res = find_dups c in let duplicates, res = find_dups c in
assert (same_lits (Sequence.of_list res) (Clause.atoms_seq conclusion)); assert (same_lits (Sequence.of_list res) (Clause.atoms_seq conclusion));
{ conclusion; step = Duplicate (c, duplicates) } { conclusion; step = Duplicate (c, duplicates) }
| History (c :: ([_] as r)) ->
let res, steps = find_pivots c r in
assert (same_lits (Sequence.of_list res) (Clause.atoms_seq conclusion));
{ conclusion; step = Hyper_res { hr_init=c; hr_steps=steps; }; }
| History (c :: r) -> | History (c :: r) ->
let res, steps = find_pivots c r in let res, steps = find_pivots c r in
assert (same_lits (Sequence.of_list res) (Clause.atoms_seq conclusion)); assert (same_lits (Sequence.of_list res) (Clause.atoms_seq conclusion));
@ -714,7 +710,7 @@ module Make(Plugin : PLUGIN)
let check_empty_conclusion (p:t) = let check_empty_conclusion (p:t) =
if Array.length p.atoms > 0 then ( if Array.length p.atoms > 0 then (
error_res_f "@[<2>Proof.check: non empty conclusion for claus@ %a@]" Clause.debug p; error_res_f "@[<2>Proof.check: non empty conclusion for clause@ %a@]" Clause.debug p;
) )
let check (p:t) = fold (fun () _ -> ()) () p let check (p:t) = fold (fun () _ -> ()) () p

View file

@ -79,6 +79,16 @@ type ('term, 'formula, 'proof) reason =
| Consequence of (unit -> 'formula list * 'proof) | Consequence of (unit -> 'formula list * 'proof)
(** [Consequence (l, p)] means that the formulas in [l] imply the propagated (** [Consequence (l, p)] means that the formulas in [l] imply the propagated
formula [f]. The proof should be a proof of the clause "[l] implies [f]". formula [f]. The proof should be a proof of the clause "[l] implies [f]".
invariant: in [Consequence (l,p)], all elements of [l] must be true in
the current trail.
note on lazyiness: the justification is suspended (using [unit -> ])
to avoid potentially costly computations that might never be used
if this literal is backtracked without participating in a conflict.
However, if the theory isn't robust wrt backtracking an subsequent changes,
it can be easier to produce the explanation eagerly when
propagating, and then use [Consequence (fun () -> expl, proof)].
*) *)
(** The type of reasons for propagations of a formula [f]. *) (** The type of reasons for propagations of a formula [f]. *)