mirror of
https://github.com/c-cube/sidekick.git
synced 2025-12-08 04:05:43 -05:00
Auto re-indent
This commit is contained in:
parent
631280af9a
commit
679d928b88
11 changed files with 51 additions and 51 deletions
|
|
@ -122,7 +122,7 @@ module Make(S : Res.S)(A : Arg with type atom := S.atom
|
||||||
| S.Duplicate (p, l) ->
|
| S.Duplicate (p, l) ->
|
||||||
print_dot_node fmt (node_id n) "GREY" S.(n.conclusion) "Duplicate" "GREY"
|
print_dot_node fmt (node_id n) "GREY" S.(n.conclusion) "Duplicate" "GREY"
|
||||||
((fun fmt () -> (Format.fprintf fmt "%s" (node_id n))) ::
|
((fun fmt () -> (Format.fprintf fmt "%s" (node_id n))) ::
|
||||||
List.map (ttify A.print_atom) l);
|
List.map (ttify A.print_atom) l);
|
||||||
print_edge fmt (node_id n) (node_id (S.expand p))
|
print_edge fmt (node_id n) (node_id (S.expand p))
|
||||||
| S.Resolution (_, _, a) ->
|
| S.Resolution (_, _, a) ->
|
||||||
print_dot_node fmt (node_id n) "GREY" S.(n.conclusion) "Resolution" "GREY"
|
print_dot_node fmt (node_id n) "GREY" S.(n.conclusion) "Resolution" "GREY"
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,8 @@ module type S = sig
|
||||||
(** Equality over formulas. *)
|
(** Equality over formulas. *)
|
||||||
|
|
||||||
val hash : t -> int
|
val hash : t -> int
|
||||||
(** Hashing function for formulas. Should be such that two formulas equal according
|
(** Hashing function for formulas. Should be such that two formulas equal according
|
||||||
to {!val:Expr_intf.S.equal} have the same hash. *)
|
to {!val:Expr_intf.S.equal} have the same hash. *)
|
||||||
|
|
||||||
val print : Format.formatter -> t -> unit
|
val print : Format.formatter -> t -> unit
|
||||||
(** Printing function used among other thing for debugging. *)
|
(** Printing function used among other thing for debugging. *)
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ module Make
|
||||||
- this is repeated until a fixpoint is reached;
|
- this is repeated until a fixpoint is reached;
|
||||||
- before a decision (and after the fixpoint),
|
- before a decision (and after the fixpoint),
|
||||||
th_head = elt_head = length elt_queue
|
th_head = elt_head = length elt_queue
|
||||||
*)
|
*)
|
||||||
|
|
||||||
|
|
||||||
mutable simpDB_props : int;
|
mutable simpDB_props : int;
|
||||||
|
|
@ -211,12 +211,12 @@ module Make
|
||||||
let res = add_atom f in
|
let res = add_atom f in
|
||||||
if St.mcsat then
|
if St.mcsat then
|
||||||
begin match res.var.v_assignable with
|
begin match res.var.v_assignable with
|
||||||
| Some _ -> ()
|
| Some _ -> ()
|
||||||
| None ->
|
| None ->
|
||||||
let l = ref [] in
|
let l = ref [] in
|
||||||
Plugin.iter_assignable (fun t -> l := add_term t :: !l) res.var.pa.lit;
|
Plugin.iter_assignable (fun t -> l := add_term t :: !l) res.var.pa.lit;
|
||||||
res.var.v_assignable <- Some !l;
|
res.var.v_assignable <- Some !l;
|
||||||
end;
|
end;
|
||||||
res
|
res
|
||||||
|
|
||||||
(* Variable and literal activity.
|
(* Variable and literal activity.
|
||||||
|
|
@ -233,8 +233,8 @@ module Make
|
||||||
Iheap.insert f_weight env.order v.vid;
|
Iheap.insert f_weight env.order v.vid;
|
||||||
insert_subterms_order v
|
insert_subterms_order v
|
||||||
|
|
||||||
and insert_subterms_order v =
|
and insert_subterms_order v =
|
||||||
iter_sub (fun t -> insert_var_order (elt_of_lit t)) v
|
iter_sub (fun t -> insert_var_order (elt_of_lit t)) v
|
||||||
|
|
||||||
(* Add new litterals/atoms on which to decide on, even if there is no
|
(* Add new litterals/atoms on which to decide on, even if there is no
|
||||||
clause that constrains it.
|
clause that constrains it.
|
||||||
|
|
@ -329,8 +329,8 @@ module Make
|
||||||
) clause.atoms;
|
) clause.atoms;
|
||||||
List.iter (fun a ->
|
List.iter (fun a ->
|
||||||
begin match a.var.seen with
|
begin match a.var.seen with
|
||||||
| Both -> trivial := true
|
| Both -> trivial := true
|
||||||
| _ -> ()
|
| _ -> ()
|
||||||
end;
|
end;
|
||||||
clear a.var) !res;
|
clear a.var) !res;
|
||||||
if !trivial then
|
if !trivial then
|
||||||
|
|
@ -504,7 +504,7 @@ module Make
|
||||||
let c' = make_clause (fresh_lname ()) l (History (cl :: history)) in
|
let c' = make_clause (fresh_lname ()) l (History (cl :: history)) in
|
||||||
Log.debugf debug "Simplified reason: @[<v>%a@,%a@]"
|
Log.debugf debug "Simplified reason: @[<v>%a@,%a@]"
|
||||||
(fun k -> k St.pp_clause cl St.pp_clause c');
|
(fun k -> k St.pp_clause cl St.pp_clause c');
|
||||||
Bcp c'
|
Bcp c'
|
||||||
end
|
end
|
||||||
| _ ->
|
| _ ->
|
||||||
Log.debugf error "@[<v 2>Failed at reason simplification:@,%a@,%a@]"
|
Log.debugf error "@[<v 2>Failed at reason simplification:@,%a@,%a@]"
|
||||||
|
|
@ -759,9 +759,9 @@ module Make
|
||||||
(* Get the correct vector to insert a clause in. *)
|
(* Get the correct vector to insert a clause in. *)
|
||||||
let clause_vector c =
|
let clause_vector c =
|
||||||
match c.cpremise with
|
match c.cpremise with
|
||||||
| Hyp -> env.clauses_hyps
|
| Hyp -> env.clauses_hyps
|
||||||
| Local -> env.clauses_temp
|
| Local -> env.clauses_temp
|
||||||
| Lemma _ | History _ -> env.clauses_learnt
|
| Lemma _ | History _ -> env.clauses_learnt
|
||||||
|
|
||||||
(* Add a new clause, simplifying, propagating, and backtracking if
|
(* Add a new clause, simplifying, propagating, and backtracking if
|
||||||
the clause is false in the current trail *)
|
the clause is false in the current trail *)
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ type 'term eval_res =
|
||||||
| Valued of bool * ('term list) (** The given formula can be evaluated to the given bool.
|
| Valued of bool * ('term list) (** The given formula can be evaluated to the given bool.
|
||||||
The list of terms to give is the list of terms that
|
The list of terms to give is the list of terms that
|
||||||
were effectively used for the evaluation.
|
were effectively used for the evaluation.
|
||||||
*)
|
*)
|
||||||
(** The type of evaluation results for a given formula.
|
(** The type of evaluation results for a given formula.
|
||||||
For instance, let's suppose we want to evaluate the formula [x * y = 0], the
|
For instance, let's suppose we want to evaluate the formula [x * y = 0], the
|
||||||
following result are correct:
|
following result are correct:
|
||||||
|
|
@ -36,15 +36,15 @@ type 'term eval_res =
|
||||||
- [Valued (true, [x])] if [x] is assigned to [0]
|
- [Valued (true, [x])] if [x] is assigned to [0]
|
||||||
- [Valued (true, [y])] if [y] is assigned to [0]
|
- [Valued (true, [y])] if [y] is assigned to [0]
|
||||||
- [Valued (false, [x; y])] if [x] and [y] are assigned to 1 (or any non-zero number)
|
- [Valued (false, [x; y])] if [x] and [y] are assigned to 1 (or any non-zero number)
|
||||||
*)
|
*)
|
||||||
|
|
||||||
type ('formula, 'proof) res =
|
type ('formula, 'proof) res =
|
||||||
| Sat
|
| Sat
|
||||||
(** The current set of assumptions is satisfiable. *)
|
(** The current set of assumptions is satisfiable. *)
|
||||||
| Unsat of 'formula list * 'proof
|
| Unsat of 'formula list * 'proof
|
||||||
(** The current set of assumptions is *NOT* satisfiable, and here is a
|
(** The current set of assumptions is *NOT* satisfiable, and here is a
|
||||||
theory tautology (with its proof), for which every litteral is false
|
theory tautology (with its proof), for which every litteral is false
|
||||||
under the current assumptions. *)
|
under the current assumptions. *)
|
||||||
(** Type returned by the theory. Formulas in the unsat clause must come from the
|
(** Type returned by the theory. Formulas in the unsat clause must come from the
|
||||||
current set of assumptions, i.e must have been encountered in a slice. *)
|
current set of assumptions, i.e must have been encountered in a slice. *)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,17 +32,17 @@ module type S = sig
|
||||||
(** A proof can be expanded into a proof node, which show the first step of the proof. *)
|
(** A proof can be expanded into a proof node, which show the first step of the proof. *)
|
||||||
and step =
|
and step =
|
||||||
| Hypothesis
|
| Hypothesis
|
||||||
(** The conclusion is a user-provided hypothesis *)
|
(** The conclusion is a user-provided hypothesis *)
|
||||||
| Assumption
|
| Assumption
|
||||||
(** The conclusion has been locally assumed by the user *)
|
(** The conclusion has been locally assumed by the user *)
|
||||||
| Lemma of lemma
|
| Lemma of lemma
|
||||||
(** The conclusion is a tautology provided by the theory, with associated proof *)
|
(** The conclusion is a tautology provided by the theory, with associated proof *)
|
||||||
| Duplicate of proof * atom list
|
| Duplicate of proof * atom list
|
||||||
(** The conclusion is obtained by eliminating multiple occurences of the atom in
|
(** The conclusion is obtained by eliminating multiple occurences of the atom in
|
||||||
the conclusion of the provided proof. *)
|
the conclusion of the provided proof. *)
|
||||||
| Resolution of proof * proof * atom
|
| Resolution of proof * proof * atom
|
||||||
(** The conclusion can be deduced by performing a resolution between the conclusions
|
(** The conclusion can be deduced by performing a resolution between the conclusions
|
||||||
of the two given proofs. The atom on which to perform the resolution is also given. *)
|
of the two given proofs. The atom on which to perform the resolution is also given. *)
|
||||||
(** The type of reasoning steps allowed in a proof. *)
|
(** The type of reasoning steps allowed in a proof. *)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -196,8 +196,8 @@ module McMake (E : Expr_intf.S)(Dummy : sig end) = struct
|
||||||
let add_atom lit =
|
let add_atom lit =
|
||||||
let var, negated = make_boolean_var lit in
|
let var, negated = make_boolean_var lit in
|
||||||
match negated with
|
match negated with
|
||||||
| Formula_intf.Negated -> var.na
|
| Formula_intf.Negated -> var.na
|
||||||
| Formula_intf.Same_sign -> var.pa
|
| Formula_intf.Same_sign -> var.pa
|
||||||
|
|
||||||
let make_clause ?tag name ali premise =
|
let make_clause ?tag name ali premise =
|
||||||
let atoms = Array.of_list ali in
|
let atoms = Array.of_list ali in
|
||||||
|
|
|
||||||
|
|
@ -25,11 +25,11 @@ Copyright 2016 Simon Cruanes
|
||||||
|
|
||||||
type ('formula, 'proof) res = ('formula, 'proof) Plugin_intf.res =
|
type ('formula, 'proof) res = ('formula, 'proof) Plugin_intf.res =
|
||||||
| Sat
|
| Sat
|
||||||
(** The current set of assumptions is satisfiable. *)
|
(** The current set of assumptions is satisfiable. *)
|
||||||
| Unsat of 'formula list * 'proof
|
| Unsat of 'formula list * 'proof
|
||||||
(** The current set of assumptions is *NOT* satisfiable, and here is a
|
(** The current set of assumptions is *NOT* satisfiable, and here is a
|
||||||
theory tautology (with its proof), for which every litteral is false
|
theory tautology (with its proof), for which every litteral is false
|
||||||
under the current assumptions. *)
|
under the current assumptions. *)
|
||||||
(** Type returned by the theory. Formulas in the unsat clause must come from the
|
(** Type returned by the theory. Formulas in the unsat clause must come from the
|
||||||
current set of assumptions, i.e must have been encountered in a slice. *)
|
current set of assumptions, i.e must have been encountered in a slice. *)
|
||||||
|
|
||||||
|
|
@ -42,9 +42,9 @@ type ('form, 'proof) slice = {
|
||||||
push : 'form list -> 'proof -> unit; (** Allows to add to the solver a clause. *)
|
push : 'form list -> 'proof -> unit; (** Allows to add to the solver a clause. *)
|
||||||
propagate : 'form -> 'form list -> 'proof -> unit;
|
propagate : 'form -> 'form list -> 'proof -> unit;
|
||||||
(** [propagate lit causes proof] informs the solver to propagate [lit], with the reason
|
(** [propagate lit causes proof] informs the solver to propagate [lit], with the reason
|
||||||
that the clause [causes => lit] is a theory tautology. It is faster than pushing
|
that the clause [causes => lit] is a theory tautology. It is faster than pushing
|
||||||
the associated clause but the clause will not be remembered by the sat solver,
|
the associated clause but the clause will not be remembered by the sat solver,
|
||||||
i.e it will not be used by the solver to do boolean propagation. *)
|
i.e it will not be used by the solver to do boolean propagation. *)
|
||||||
}
|
}
|
||||||
(** The type for a slice. Slices are some kind of view of the current
|
(** The type for a slice. Slices are some kind of view of the current
|
||||||
propagation queue. They allow to look at the propagated literals,
|
propagation queue. They allow to look at the propagated literals,
|
||||||
|
|
|
||||||
|
|
@ -66,10 +66,10 @@ let rec list_cmp ord l1 l2 =
|
||||||
| [], _ -> -1
|
| [], _ -> -1
|
||||||
| _, [] -> 1
|
| _, [] -> 1
|
||||||
| x1::l1', x2::l2' ->
|
| x1::l1', x2::l2' ->
|
||||||
let c = ord x1 x2 in
|
let c = ord x1 x2 in
|
||||||
if c = 0
|
if c = 0
|
||||||
then list_cmp ord l1' l2'
|
then list_cmp ord l1' l2'
|
||||||
else c
|
else c
|
||||||
|
|
||||||
(* Exceptions *)
|
(* Exceptions *)
|
||||||
(* ************************************************************************ *)
|
(* ************************************************************************ *)
|
||||||
|
|
|
||||||
|
|
@ -50,12 +50,12 @@ module Plugin(E : Formula_intf.S)
|
||||||
propagate f (Plugin_intf.Consequence (l, proof))
|
propagate f (Plugin_intf.Consequence (l, proof))
|
||||||
|
|
||||||
let mk_slice s = {
|
let mk_slice s = {
|
||||||
Theory_intf.start = s.Plugin_intf.start;
|
Theory_intf.start = s.Plugin_intf.start;
|
||||||
length = s.Plugin_intf.length;
|
length = s.Plugin_intf.length;
|
||||||
get = assume_get s.Plugin_intf.get;
|
get = assume_get s.Plugin_intf.get;
|
||||||
push = s.Plugin_intf.push;
|
push = s.Plugin_intf.push;
|
||||||
propagate = assume_propagate s.Plugin_intf.propagate;
|
propagate = assume_propagate s.Plugin_intf.propagate;
|
||||||
}
|
}
|
||||||
|
|
||||||
let assume s = Th.assume (mk_slice s)
|
let assume s = Th.assume (mk_slice s)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ let debugf l format k =
|
||||||
if l <= !debug_level_
|
if l <= !debug_level_
|
||||||
then
|
then
|
||||||
k (Format.kfprintf
|
k (Format.kfprintf
|
||||||
(fun fmt -> Format.fprintf fmt "@]@.")
|
(fun fmt -> Format.fprintf fmt "@]@.")
|
||||||
!debug_fmt_ format)
|
!debug_fmt_ format)
|
||||||
|
|
||||||
let debug l msg = debugf l "%s" (fun k->k msg)
|
let debug l msg = debugf l "%s" (fun k->k msg)
|
||||||
|
|
|
||||||
|
|
@ -164,8 +164,8 @@ let print ?(sep=", ") pp out v =
|
||||||
let first = ref true in
|
let first = ref true in
|
||||||
iter
|
iter
|
||||||
(fun x ->
|
(fun x ->
|
||||||
if !first then first := false else Format.fprintf out "%s@," sep;
|
if !first then first := false else Format.fprintf out "%s@," sep;
|
||||||
pp out x)
|
pp out x)
|
||||||
v
|
v
|
||||||
|
|
||||||
(*
|
(*
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue