mirror of
https://github.com/c-cube/sidekick.git
synced 2025-12-06 03:05:31 -05:00
cdsat
This commit is contained in:
parent
8fbfa98fc8
commit
0393fae090
5 changed files with 9 additions and 8 deletions
|
|
@ -16,8 +16,8 @@ type TVar.theory_view +=
|
||||||
(* our internal state *)
|
(* our internal state *)
|
||||||
type t = { arg: (module ARG); tst: Term.store; vst: TVar.store }
|
type t = { arg: (module ARG); tst: Term.store; vst: TVar.store }
|
||||||
|
|
||||||
let push_level (self : t) = ()
|
let push_level (_self : t) = ()
|
||||||
let pop_levels (self : t) n = ()
|
let pop_levels (_self : t) _n = ()
|
||||||
|
|
||||||
let decide (self : t) (v : TVar.t) : Value.t option =
|
let decide (self : t) (v : TVar.t) : Value.t option =
|
||||||
match TVar.theory_view self.vst v with
|
match TVar.theory_view self.vst v with
|
||||||
|
|
@ -60,7 +60,7 @@ let propagate (self : t) (act : Core.Plugin_action.t) (v : TVar.t)
|
||||||
k "(@[bool-plugin.propagate %a@])" (TVar.pp self.vst) v);
|
k "(@[bool-plugin.propagate %a@])" (TVar.pp self.vst) v);
|
||||||
()
|
()
|
||||||
|
|
||||||
let term_to_var_hooks (self : t) : _ list =
|
let term_to_var_hooks (self : t) : Term_to_var.hook list =
|
||||||
let (module A) = self.arg in
|
let (module A) = self.arg in
|
||||||
|
|
||||||
let rec to_tlit t2v (t : Term.t) : TLit.t =
|
let rec to_tlit t2v (t : Term.t) : TLit.t =
|
||||||
|
|
@ -85,7 +85,7 @@ let term_to_var_hooks (self : t) : _ list =
|
||||||
Some (T_or lits)
|
Some (T_or lits)
|
||||||
| _ -> None
|
| _ -> None
|
||||||
in
|
in
|
||||||
[ h ]
|
[ { Term_to_var.conv = h } ]
|
||||||
|
|
||||||
let iter_theory_view _ (v : TVar.theory_view) k =
|
let iter_theory_view _ (v : TVar.theory_view) k =
|
||||||
match v with
|
match v with
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ let term_to_var_hooks (self : t) : _ list =
|
||||||
) else
|
) else
|
||||||
None
|
None
|
||||||
in
|
in
|
||||||
[ h ]
|
[ { Term_to_var.conv = h } ]
|
||||||
|
|
||||||
let iter_theory_view _ (v : TVar.theory_view) k : unit =
|
let iter_theory_view _ (v : TVar.theory_view) k : unit =
|
||||||
match v with
|
match v with
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ type t = TVar.reason =
|
||||||
hyps: TVar.Vec_of.t;
|
hyps: TVar.Vec_of.t;
|
||||||
proof: Sidekick_proof.step_id;
|
proof: Sidekick_proof.step_id;
|
||||||
}
|
}
|
||||||
|
(* TODO: merge is also a reason *)
|
||||||
|
|
||||||
include Sidekick_sigs.PRINT with type t := t
|
include Sidekick_sigs.PRINT with type t := t
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
type t = { vst: TVar.store; mutable hooks: hook list }
|
type t = { vst: TVar.store; mutable hooks: hook list }
|
||||||
and hook = t -> Term.t -> TVar.theory_view option
|
and hook = { conv: t -> Term.t -> TVar.theory_view option } [@@unboxed]
|
||||||
|
|
||||||
let create vst : t = { vst; hooks = [] }
|
let create vst : t = { vst; hooks = [] }
|
||||||
let add_hook self h = self.hooks <- h :: self.hooks
|
let add_hook self h = self.hooks <- h :: self.hooks
|
||||||
|
|
@ -12,7 +12,7 @@ let rec convert (self : t) (t : Term.t) : TVar.t =
|
||||||
(Term.pp_limit ~max_depth:5 ~max_nodes:30)
|
(Term.pp_limit ~max_depth:5 ~max_nodes:30)
|
||||||
t
|
t
|
||||||
| h :: tl_h ->
|
| h :: tl_h ->
|
||||||
(match h self t with
|
(match h.conv self t with
|
||||||
| Some theory_view ->
|
| Some theory_view ->
|
||||||
let v = TVar.Internal.create self.vst t ~theory_view in
|
let v = TVar.Internal.create self.vst t ~theory_view in
|
||||||
v
|
v
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ val convert : t -> Term.t -> TVar.t
|
||||||
Hooks are responsible for converting {b some} terms (the terms their theory
|
Hooks are responsible for converting {b some} terms (the terms their theory
|
||||||
knows) into variables. *)
|
knows) into variables. *)
|
||||||
|
|
||||||
type hook = t -> Term.t -> TVar.theory_view option
|
type hook = { conv: t -> Term.t -> TVar.theory_view option } [@@unboxed]
|
||||||
(** A hook, responsible to keep some internal state and assigning a theory
|
(** A hook, responsible to keep some internal state and assigning a theory
|
||||||
view if it "accepts" the term. A term that is recognized by no hook
|
view if it "accepts" the term. A term that is recognized by no hook
|
||||||
cannot be turned into a variable. *)
|
cannot be turned into a variable. *)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue