let add_to_bag bag (_,lit,vl,proof) =
let id = mk_id () in
let clause = (id, lit, vl, proof) in
- let bag = Terms.M.add id clause bag in
+ let bag = Terms.M.add id (clause,false) bag in
bag, clause
;;
t vl
in
let get_literal id =
- let _, lit, vl, proof = Terms.M.find id bag in
+ let (_, lit, vl, proof),_ = Terms.M.find id bag in
let lit =match lit with
| Terms.Predicate t -> assert false
| Terms.Equation (l,r,ty,_) ->
(* $Id: orderings.ml 9869 2009-06-11 22:52:38Z denes $ *)
-(* let debug s = prerr_endline s ;;*)
+ (*let debug s = prerr_endline s ;;*)
let debug _ = ();;
let max_nb_iter = 999999999 ;;
let rec aux_select passives g_passives =
let backward,current,passives,g_passives =
- select ~use_age passives g_passives
+ select ~use_age:false passives g_passives
in
if backward then
match Sup.simplify_goal maxvar (snd actives) bag g_actives current with
let l =
let rec traverse ongoal (accg,acce) i =
match Terms.M.find i bag with
- | (id,_,_,Terms.Exact _) ->
+ | (id,_,_,Terms.Exact _),_ ->
if ongoal then [i],acce else
if (List.mem i acce) then accg,acce else accg,acce@[i]
- | (_,_,_,Terms.Step (_,i1,i2,_,_,_)) ->
+ | (_,_,_,Terms.Step (_,i1,i2,_,_,_)),_ ->
if (not ongoal) && (List.mem i acce) then accg,acce
else
let accg,acce =
prerr_endline
(Printf.sprintf "Found proof, %fs"
(Unix.gettimeofday() -. timeout +. amount_of_time));
- prerr_endline "Proof:";
+ (* prerr_endline "Proof:";
List.iter (fun x -> prerr_endline (string_of_int x);
- prerr_endline (Pp.pp_unit_clause (Terms.M.find x bag))) l;
+ prerr_endline (Pp.pp_unit_clause (fst (Terms.M.find x bag)))) l;*)
[ bag, i, l ]
| Failure (msg,_bag,_maxvar,nb_iter) ->
prerr_endline msg;
eq (string_of_rule rule);
Format.fprintf f "|%d with %d dir %s))" eq1 eq2
(string_of_direction dir);
- let (_, _, _, proof1) = Terms.M.find eq1 bag in
- let (_, _, _, proof2) = Terms.M.find eq2 bag in
+ let (_, _, _, proof1),_ = Terms.M.find eq1 bag in
+ let (_, _, _, proof2),_ = Terms.M.find eq2 bag in
Format.fprintf f "@[<v 2>";
aux eq1 proof1;
aux eq2 proof2;
let pp_bag ~formatter:f bag =
Format.fprintf f "@[<v>";
Terms.M.iter
- (fun _ c -> pp_unit_clause ~formatter:f c;Format.fprintf f "@;") bag;
+ (fun _ c,_ -> pp_unit_clause ~formatter:f c;Format.fprintf f "@;") bag;
Format.fprintf f "@]"
;;
(* demodulate and check for subsumption *)
let simplify table maxvar bag clause =
let bag, clause = demodulate bag clause table in
- if is_identity_clause ~unify:false clause then None
+ if is_identity_clause ~unify:false clause then bag,None
else
match is_subsumed ~unify:false bag maxvar clause table with
- | None -> Some (bag, clause)
- | Some _ -> None
+ | None -> bag, Some clause
+ | Some _ -> bag, None
;;
let one_pass_simplification new_clause (alist,atable) bag maxvar =
match simplify atable maxvar bag new_clause with
- | None -> None (* new_clause has been discarded *)
- | Some (bag, clause) ->
+ | bag,None -> None (* new_clause has been discarded *)
+ | bag,(Some clause) ->
let ctable = IDX.index_unit_clause IDX.DT.empty clause in
let bag, alist, atable =
List.fold_left
(fun (bag, alist, atable as acc) c ->
match simplify ctable maxvar bag c with
- |None -> acc (* an active clause as been discarded *)
- |Some (bag, c1) ->
+ |bag,None -> acc (* an active clause as been discarded *)
+ |bag,Some c1 ->
bag, c :: alist, IDX.index_unit_clause atable c)
(bag,[],IDX.DT.empty) alist
in
* - actives and cl if new_clause is not cl *
* - only actives otherwise *)
match simplify atable1 maxvar bag new_clause with
- | None -> (Some cl, None) (* new_clause has been discarded *)
- | Some (bag, clause) ->
+ | bag,None -> (Some cl, None) (* new_clause has been discarded *)
+ | bag,Some clause ->
(* Simplification of each active clause with clause *
* which is the simplified form of new_clause *)
let ctable = IDX.index_unit_clause IDX.DT.empty clause in
List.fold_left
(fun (bag, newa, alist, atable as acc) c ->
match simplify ctable maxvar bag c with
- |None -> acc (* an active clause as been discarded *)
- |Some (bag, c1) ->
+ |bag,None -> acc (* an active clause as been discarded *)
+ |bag,Some c1 ->
if (c1 == c) then
bag, newa, c :: alist,
IDX.index_unit_clause atable c
else
(* if new_clause is not cl, we simplify cl with clause *)
match simplify ctable maxvar bag cl with
- | None ->
+ | bag,None ->
(* cl has been discarded *)
(None, Some (clause, (alist,atable), newa, bag))
- | Some (bag,cl1) ->
+ | bag,Some cl1 ->
(Some cl1, Some (clause, (alist,atable), newa, bag))
;;
debug (Printf.sprintf "Demodulating %d clauses"
(List.length new_clauses));
let bag, new_clauses =
- HExtlib.filter_map_acc (simplify atable maxvar) bag new_clauses
+ HExtlib.filter_map_monad (simplify atable maxvar) bag new_clauses
in
debug "Demodulated new clauses";
bag, maxvar, (alist, atable), new_clauses
int ->
B.t Terms.bag ->
B.t Terms.unit_clause ->
- (B.t Terms.bag * B.t Terms.unit_clause) option
+ B.t Terms.bag * (B.t Terms.unit_clause option)
(* may raise success *)
val simplify_goal :
module M : Map.S with type key = int
= Map.Make(OT)
-type 'a bag = 'a unit_clause M.t
+type 'a bag = ('a unit_clause * bool) M.t
module type Blob =
sig
module M : Map.S with type key = int
-type 'a bag = 'a unit_clause M.t
+type 'a bag = ('a unit_clause * bool) M.t
module type Blob =
sig