From 70d59f82a60c096854d42a0f82accd0d7938a79a Mon Sep 17 00:00:00 2001 From: c-cube Date: Sun, 4 Jul 2021 04:27:03 +0000 Subject: [PATCH] deploy: 71360ad1f8b37d37022a6c6a43178f002b16b930 --- .../Sidekick_base_solver/Solver/Solver_internal/CC/N/index.html | 2 +- .../Sidekick_base_solver/Solver/Solver_internal/CC/index.html | 2 +- .../Th_bool/A/S/Solver_internal/CC/N/index.html | 2 +- .../Th_bool/A/S/Solver_internal/CC/index.html | 2 +- .../Th_data/A/S/Solver_internal/CC/N/index.html | 2 +- .../Th_data/A/S/Solver_internal/CC/index.html | 2 +- .../Th_lra/A/S/Solver_internal/CC/N/index.html | 2 +- .../Th_lra/A/S/Solver_internal/CC/index.html | 2 +- .../Process/Solver/Solver_internal/CC/N/index.html | 2 +- .../Process/Solver/Solver_internal/CC/index.html | 2 +- .../Process/Solver/Solver_internal/CC/N/index.html | 2 +- .../Process/Solver/Solver_internal/CC/index.html | 2 +- .../Solver/Solver_internal/CC/N/index.html | 2 +- .../Solver/Solver_internal/CC/index.html | 2 +- .../Make/argument-1-A/S/Solver_internal/CC/N/index.html | 2 +- .../Make/argument-1-A/S/Solver_internal/CC/index.html | 2 +- .../module-type-ARG/S/Solver_internal/CC/N/index.html | 2 +- .../module-type-ARG/S/Solver_internal/CC/index.html | 2 +- .../module-type-S/A/S/Solver_internal/CC/N/index.html | 2 +- .../module-type-S/A/S/Solver_internal/CC/index.html | 2 +- dev/sidekick/Sidekick_cc/Make/N/index.html | 2 +- dev/sidekick/Sidekick_cc/Make/index.html | 2 +- dev/sidekick/Sidekick_cc/module-type-S/N/index.html | 2 +- dev/sidekick/Sidekick_cc/module-type-S/index.html | 2 +- .../Monoid_of_repr/argument-1-M/SI/CC/N/index.html | 2 +- .../Sidekick_core/Monoid_of_repr/argument-1-M/SI/CC/index.html | 2 +- dev/sidekick/Sidekick_core/index.html | 2 +- dev/sidekick/Sidekick_core/module-type-CC_S/N/index.html | 2 +- dev/sidekick/Sidekick_core/module-type-CC_S/index.html | 2 +- .../Sidekick_core/module-type-MONOID_ARG/SI/CC/N/index.html | 2 +- .../Sidekick_core/module-type-MONOID_ARG/SI/CC/index.html | 2 +- .../module-type-SOLVER/Solver_internal/CC/N/index.html | 2 +- .../module-type-SOLVER/Solver_internal/CC/index.html | 2 +- .../Sidekick_core/module-type-SOLVER_INTERNAL/CC/N/index.html | 2 +- .../Sidekick_core/module-type-SOLVER_INTERNAL/CC/index.html | 2 +- .../Sidekick_msat_solver/Make/Solver_internal/CC/N/index.html | 2 +- .../Sidekick_msat_solver/Make/Solver_internal/CC/index.html | 2 +- .../module-type-S/Solver_internal/CC/N/index.html | 2 +- .../module-type-S/Solver_internal/CC/index.html | 2 +- .../Make/argument-1-A/S/Solver_internal/CC/N/index.html | 2 +- .../Make/argument-1-A/S/Solver_internal/CC/index.html | 2 +- .../module-type-ARG/S/Solver_internal/CC/N/index.html | 2 +- .../module-type-ARG/S/Solver_internal/CC/index.html | 2 +- .../module-type-S/A/S/Solver_internal/CC/N/index.html | 2 +- .../module-type-S/A/S/Solver_internal/CC/index.html | 2 +- .../Make/argument-1-A/S/Solver_internal/CC/N/index.html | 2 +- .../Make/argument-1-A/S/Solver_internal/CC/index.html | 2 +- .../module-type-ARG/S/Solver_internal/CC/N/index.html | 2 +- .../module-type-ARG/S/Solver_internal/CC/index.html | 2 +- .../module-type-S/A/S/Solver_internal/CC/N/index.html | 2 +- .../module-type-S/A/S/Solver_internal/CC/index.html | 2 +- .../Make/argument-1-A/S/Solver_internal/CC/N/index.html | 2 +- .../Make/argument-1-A/S/Solver_internal/CC/index.html | 2 +- .../module-type-ARG/S/Solver_internal/CC/N/index.html | 2 +- .../module-type-ARG/S/Solver_internal/CC/index.html | 2 +- .../module-type-S/A/S/Solver_internal/CC/N/index.html | 2 +- .../module-type-S/A/S/Solver_internal/CC/index.html | 2 +- 57 files changed, 57 insertions(+), 57 deletions(-) diff --git a/dev/sidekick-base/Sidekick_base_solver/Solver/Solver_internal/CC/N/index.html b/dev/sidekick-base/Sidekick_base_solver/Solver/Solver_internal/CC/N/index.html index 751a5430..7a8895c8 100644 --- a/dev/sidekick-base/Sidekick_base_solver/Solver/Solver_internal/CC/N/index.html +++ b/dev/sidekick-base/Sidekick_base_solver/Solver/Solver_internal/CC/N/index.html @@ -1,2 +1,2 @@ -N (sidekick-base.Sidekick_base_solver.Solver.Solver_internal.CC.N)

Module CC.N

type t = Sidekick_msat_solver.Make(Solver_arg).Solver_internal.CC.N.t
val term : t -> term
val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
val is_root : t -> bool
val iter_class : t -> t Iter.t
val iter_parents : t -> t Iter.t
type bitfield = Sidekick_msat_solver.Make(Solver_arg).Solver_internal.CC.N.bitfield
val get_field : bitfield -> t -> bool
\ No newline at end of file +N (sidekick-base.Sidekick_base_solver.Solver.Solver_internal.CC.N)

Module CC.N

type t = Sidekick_msat_solver.Make(Solver_arg).Solver_internal.CC.N.t
val term : t -> term
val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
val is_root : t -> bool
val iter_class : t -> t Iter.t
val iter_parents : t -> t Iter.t
type bitfield = Sidekick_msat_solver.Make(Solver_arg).Solver_internal.CC.N.bitfield
\ No newline at end of file diff --git a/dev/sidekick-base/Sidekick_base_solver/Solver/Solver_internal/CC/index.html b/dev/sidekick-base/Sidekick_base_solver/Solver/Solver_internal/CC/index.html index 3591c947..a67c2fee 100644 --- a/dev/sidekick-base/Sidekick_base_solver/Solver/Solver_internal/CC/index.html +++ b/dev/sidekick-base/Sidekick_base_solver/Solver/Solver_internal/CC/index.html @@ -1,2 +1,2 @@ -CC (sidekick-base.Sidekick_base_solver.Solver.Solver_internal.CC)

Module Solver_internal.CC

module T : sig ... end
module P : sig ... end
module Lit : sig ... end
module Actions : sig ... end
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t = Sidekick_msat_solver.Make(Solver_arg).Solver_internal.CC.t
module N : sig ... end
module Expl : sig ... end
type node = N.t
type repr = N.t
type explanation = Expl.t
val term_store : t -> term_store
val find : t -> node -> repr
val add_term : t -> term -> node
val mem_term : t -> term -> bool
type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit
type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit
type ev_on_new_term = t -> N.t -> term -> unit
type ev_on_conflict = t -> th:bool -> lit list -> unit
type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit
type ev_on_is_subterm = N.t -> term -> unit
val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Big | `Small ] -> term_store -> t
val allocate_bitfield : descr:string -> t -> N.bitfield
val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit
val on_pre_merge : t -> ev_on_pre_merge -> unit
val on_post_merge : t -> ev_on_post_merge -> unit
val on_new_term : t -> ev_on_new_term -> unit
val on_conflict : t -> ev_on_conflict -> unit
val on_propagate : t -> ev_on_propagate -> unit
val on_is_subterm : t -> ev_on_is_subterm -> unit
val set_as_lit : t -> N.t -> lit -> unit
val find_t : t -> term -> repr
val add_seq : t -> term Iter.t -> unit
val all_classes : t -> repr Iter.t
val assert_lit : t -> lit -> unit
val assert_lits : t -> lit Iter.t -> unit
val explain_eq : t -> N.t -> N.t -> lit list
val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a
val n_true : t -> N.t
val n_false : t -> N.t
val n_bool : t -> bool -> N.t
val merge : t -> N.t -> N.t -> Expl.t -> unit
val merge_t : t -> term -> term -> Expl.t -> unit
val check : t -> actions -> unit
val new_merges : t -> bool
val push_level : t -> unit
val pop_levels : t -> int -> unit
val get_model : t -> N.t Iter.t Iter.t
module Debug_ : sig ... end
\ No newline at end of file +CC (sidekick-base.Sidekick_base_solver.Solver.Solver_internal.CC)

Module Solver_internal.CC

module T : sig ... end
module P : sig ... end
module Lit : sig ... end
module Actions : sig ... end
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t = Sidekick_msat_solver.Make(Solver_arg).Solver_internal.CC.t
module N : sig ... end
module Expl : sig ... end
type node = N.t
type repr = N.t
type explanation = Expl.t
val term_store : t -> term_store
val find : t -> node -> repr
val add_term : t -> term -> node
val mem_term : t -> term -> bool
type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit
type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit
type ev_on_new_term = t -> N.t -> term -> unit
type ev_on_conflict = t -> th:bool -> lit list -> unit
type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit
type ev_on_is_subterm = N.t -> term -> unit
val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Big | `Small ] -> term_store -> t
val allocate_bitfield : descr:string -> t -> N.bitfield
val get_bitfield : t -> N.bitfield -> N.t -> bool
val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit
val on_pre_merge : t -> ev_on_pre_merge -> unit
val on_post_merge : t -> ev_on_post_merge -> unit
val on_new_term : t -> ev_on_new_term -> unit
val on_conflict : t -> ev_on_conflict -> unit
val on_propagate : t -> ev_on_propagate -> unit
val on_is_subterm : t -> ev_on_is_subterm -> unit
val set_as_lit : t -> N.t -> lit -> unit
val find_t : t -> term -> repr
val add_seq : t -> term Iter.t -> unit
val all_classes : t -> repr Iter.t
val assert_lit : t -> lit -> unit
val assert_lits : t -> lit Iter.t -> unit
val explain_eq : t -> N.t -> N.t -> lit list
val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a
val n_true : t -> N.t
val n_false : t -> N.t
val n_bool : t -> bool -> N.t
val merge : t -> N.t -> N.t -> Expl.t -> unit
val merge_t : t -> term -> term -> Expl.t -> unit
val check : t -> actions -> unit
val new_merges : t -> bool
val push_level : t -> unit
val pop_levels : t -> int -> unit
val get_model : t -> N.t Iter.t Iter.t
module Debug_ : sig ... end
\ No newline at end of file diff --git a/dev/sidekick-base/Sidekick_base_solver/Th_bool/A/S/Solver_internal/CC/N/index.html b/dev/sidekick-base/Sidekick_base_solver/Th_bool/A/S/Solver_internal/CC/N/index.html index e412dce1..036fac8d 100644 --- a/dev/sidekick-base/Sidekick_base_solver/Th_bool/A/S/Solver_internal/CC/N/index.html +++ b/dev/sidekick-base/Sidekick_base_solver/Th_bool/A/S/Solver_internal/CC/N/index.html @@ -1,2 +1,2 @@ -N (sidekick-base.Sidekick_base_solver.Th_bool.A.S.Solver_internal.CC.N)

Module CC.N

type t = Sidekick_msat_solver.Make(Solver_arg).Solver_internal.CC.N.t
val term : t -> term
val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
val is_root : t -> bool
val iter_class : t -> t Iter.t
val iter_parents : t -> t Iter.t
type bitfield = Sidekick_msat_solver.Make(Solver_arg).Solver_internal.CC.N.bitfield
val get_field : bitfield -> t -> bool
\ No newline at end of file +N (sidekick-base.Sidekick_base_solver.Th_bool.A.S.Solver_internal.CC.N)

Module CC.N

type t = Sidekick_msat_solver.Make(Solver_arg).Solver_internal.CC.N.t
val term : t -> term
val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
val is_root : t -> bool
val iter_class : t -> t Iter.t
val iter_parents : t -> t Iter.t
type bitfield = Sidekick_msat_solver.Make(Solver_arg).Solver_internal.CC.N.bitfield
\ No newline at end of file diff --git a/dev/sidekick-base/Sidekick_base_solver/Th_bool/A/S/Solver_internal/CC/index.html b/dev/sidekick-base/Sidekick_base_solver/Th_bool/A/S/Solver_internal/CC/index.html index 8ac41985..237220a0 100644 --- a/dev/sidekick-base/Sidekick_base_solver/Th_bool/A/S/Solver_internal/CC/index.html +++ b/dev/sidekick-base/Sidekick_base_solver/Th_bool/A/S/Solver_internal/CC/index.html @@ -1,2 +1,2 @@ -CC (sidekick-base.Sidekick_base_solver.Th_bool.A.S.Solver_internal.CC)

Module Solver_internal.CC

module T : sig ... end
module P : sig ... end
module Lit : sig ... end
module Actions : sig ... end
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t = Sidekick_msat_solver.Make(Solver_arg).Solver_internal.CC.t
module N : sig ... end
module Expl : sig ... end
type node = N.t
type repr = N.t
type explanation = Expl.t
val term_store : t -> term_store
val find : t -> node -> repr
val add_term : t -> term -> node
val mem_term : t -> term -> bool
type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit
type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit
type ev_on_new_term = t -> N.t -> term -> unit
type ev_on_conflict = t -> th:bool -> lit list -> unit
type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit
type ev_on_is_subterm = N.t -> term -> unit
val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Big | `Small ] -> term_store -> t
val allocate_bitfield : descr:string -> t -> N.bitfield
val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit
val on_pre_merge : t -> ev_on_pre_merge -> unit
val on_post_merge : t -> ev_on_post_merge -> unit
val on_new_term : t -> ev_on_new_term -> unit
val on_conflict : t -> ev_on_conflict -> unit
val on_propagate : t -> ev_on_propagate -> unit
val on_is_subterm : t -> ev_on_is_subterm -> unit
val set_as_lit : t -> N.t -> lit -> unit
val find_t : t -> term -> repr
val add_seq : t -> term Iter.t -> unit
val all_classes : t -> repr Iter.t
val assert_lit : t -> lit -> unit
val assert_lits : t -> lit Iter.t -> unit
val explain_eq : t -> N.t -> N.t -> lit list
val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a
val n_true : t -> N.t
val n_false : t -> N.t
val n_bool : t -> bool -> N.t
val merge : t -> N.t -> N.t -> Expl.t -> unit
val merge_t : t -> term -> term -> Expl.t -> unit
val check : t -> actions -> unit
val new_merges : t -> bool
val push_level : t -> unit
val pop_levels : t -> int -> unit
val get_model : t -> N.t Iter.t Iter.t
module Debug_ : sig ... end
\ No newline at end of file +CC (sidekick-base.Sidekick_base_solver.Th_bool.A.S.Solver_internal.CC)

Module Solver_internal.CC

module T : sig ... end
module P : sig ... end
module Lit : sig ... end
module Actions : sig ... end
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t = Sidekick_msat_solver.Make(Solver_arg).Solver_internal.CC.t
module N : sig ... end
module Expl : sig ... end
type node = N.t
type repr = N.t
type explanation = Expl.t
val term_store : t -> term_store
val find : t -> node -> repr
val add_term : t -> term -> node
val mem_term : t -> term -> bool
type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit
type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit
type ev_on_new_term = t -> N.t -> term -> unit
type ev_on_conflict = t -> th:bool -> lit list -> unit
type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit
type ev_on_is_subterm = N.t -> term -> unit
val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Big | `Small ] -> term_store -> t
val allocate_bitfield : descr:string -> t -> N.bitfield
val get_bitfield : t -> N.bitfield -> N.t -> bool
val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit
val on_pre_merge : t -> ev_on_pre_merge -> unit
val on_post_merge : t -> ev_on_post_merge -> unit
val on_new_term : t -> ev_on_new_term -> unit
val on_conflict : t -> ev_on_conflict -> unit
val on_propagate : t -> ev_on_propagate -> unit
val on_is_subterm : t -> ev_on_is_subterm -> unit
val set_as_lit : t -> N.t -> lit -> unit
val find_t : t -> term -> repr
val add_seq : t -> term Iter.t -> unit
val all_classes : t -> repr Iter.t
val assert_lit : t -> lit -> unit
val assert_lits : t -> lit Iter.t -> unit
val explain_eq : t -> N.t -> N.t -> lit list
val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a
val n_true : t -> N.t
val n_false : t -> N.t
val n_bool : t -> bool -> N.t
val merge : t -> N.t -> N.t -> Expl.t -> unit
val merge_t : t -> term -> term -> Expl.t -> unit
val check : t -> actions -> unit
val new_merges : t -> bool
val push_level : t -> unit
val pop_levels : t -> int -> unit
val get_model : t -> N.t Iter.t Iter.t
module Debug_ : sig ... end
\ No newline at end of file diff --git a/dev/sidekick-base/Sidekick_base_solver/Th_data/A/S/Solver_internal/CC/N/index.html b/dev/sidekick-base/Sidekick_base_solver/Th_data/A/S/Solver_internal/CC/N/index.html index af5dc5c8..0c141536 100644 --- a/dev/sidekick-base/Sidekick_base_solver/Th_data/A/S/Solver_internal/CC/N/index.html +++ b/dev/sidekick-base/Sidekick_base_solver/Th_data/A/S/Solver_internal/CC/N/index.html @@ -1,2 +1,2 @@ -N (sidekick-base.Sidekick_base_solver.Th_data.A.S.Solver_internal.CC.N)

Module CC.N

type t = Sidekick_msat_solver.Make(Solver_arg).Solver_internal.CC.N.t
val term : t -> term
val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
val is_root : t -> bool
val iter_class : t -> t Iter.t
val iter_parents : t -> t Iter.t
type bitfield = Sidekick_msat_solver.Make(Solver_arg).Solver_internal.CC.N.bitfield
val get_field : bitfield -> t -> bool
\ No newline at end of file +N (sidekick-base.Sidekick_base_solver.Th_data.A.S.Solver_internal.CC.N)

Module CC.N

type t = Sidekick_msat_solver.Make(Solver_arg).Solver_internal.CC.N.t
val term : t -> term
val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
val is_root : t -> bool
val iter_class : t -> t Iter.t
val iter_parents : t -> t Iter.t
type bitfield = Sidekick_msat_solver.Make(Solver_arg).Solver_internal.CC.N.bitfield
\ No newline at end of file diff --git a/dev/sidekick-base/Sidekick_base_solver/Th_data/A/S/Solver_internal/CC/index.html b/dev/sidekick-base/Sidekick_base_solver/Th_data/A/S/Solver_internal/CC/index.html index 601b8d0c..8be5f543 100644 --- a/dev/sidekick-base/Sidekick_base_solver/Th_data/A/S/Solver_internal/CC/index.html +++ b/dev/sidekick-base/Sidekick_base_solver/Th_data/A/S/Solver_internal/CC/index.html @@ -1,2 +1,2 @@ -CC (sidekick-base.Sidekick_base_solver.Th_data.A.S.Solver_internal.CC)

Module Solver_internal.CC

module T : sig ... end
module P : sig ... end
module Lit : sig ... end
module Actions : sig ... end
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t = Sidekick_msat_solver.Make(Solver_arg).Solver_internal.CC.t
module N : sig ... end
module Expl : sig ... end
type node = N.t
type repr = N.t
type explanation = Expl.t
val term_store : t -> term_store
val find : t -> node -> repr
val add_term : t -> term -> node
val mem_term : t -> term -> bool
type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit
type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit
type ev_on_new_term = t -> N.t -> term -> unit
type ev_on_conflict = t -> th:bool -> lit list -> unit
type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit
type ev_on_is_subterm = N.t -> term -> unit
val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Big | `Small ] -> term_store -> t
val allocate_bitfield : descr:string -> t -> N.bitfield
val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit
val on_pre_merge : t -> ev_on_pre_merge -> unit
val on_post_merge : t -> ev_on_post_merge -> unit
val on_new_term : t -> ev_on_new_term -> unit
val on_conflict : t -> ev_on_conflict -> unit
val on_propagate : t -> ev_on_propagate -> unit
val on_is_subterm : t -> ev_on_is_subterm -> unit
val set_as_lit : t -> N.t -> lit -> unit
val find_t : t -> term -> repr
val add_seq : t -> term Iter.t -> unit
val all_classes : t -> repr Iter.t
val assert_lit : t -> lit -> unit
val assert_lits : t -> lit Iter.t -> unit
val explain_eq : t -> N.t -> N.t -> lit list
val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a
val n_true : t -> N.t
val n_false : t -> N.t
val n_bool : t -> bool -> N.t
val merge : t -> N.t -> N.t -> Expl.t -> unit
val merge_t : t -> term -> term -> Expl.t -> unit
val check : t -> actions -> unit
val new_merges : t -> bool
val push_level : t -> unit
val pop_levels : t -> int -> unit
val get_model : t -> N.t Iter.t Iter.t
module Debug_ : sig ... end
\ No newline at end of file +CC (sidekick-base.Sidekick_base_solver.Th_data.A.S.Solver_internal.CC)

Module Solver_internal.CC

module T : sig ... end
module P : sig ... end
module Lit : sig ... end
module Actions : sig ... end
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t = Sidekick_msat_solver.Make(Solver_arg).Solver_internal.CC.t
module N : sig ... end
module Expl : sig ... end
type node = N.t
type repr = N.t
type explanation = Expl.t
val term_store : t -> term_store
val find : t -> node -> repr
val add_term : t -> term -> node
val mem_term : t -> term -> bool
type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit
type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit
type ev_on_new_term = t -> N.t -> term -> unit
type ev_on_conflict = t -> th:bool -> lit list -> unit
type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit
type ev_on_is_subterm = N.t -> term -> unit
val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Big | `Small ] -> term_store -> t
val allocate_bitfield : descr:string -> t -> N.bitfield
val get_bitfield : t -> N.bitfield -> N.t -> bool
val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit
val on_pre_merge : t -> ev_on_pre_merge -> unit
val on_post_merge : t -> ev_on_post_merge -> unit
val on_new_term : t -> ev_on_new_term -> unit
val on_conflict : t -> ev_on_conflict -> unit
val on_propagate : t -> ev_on_propagate -> unit
val on_is_subterm : t -> ev_on_is_subterm -> unit
val set_as_lit : t -> N.t -> lit -> unit
val find_t : t -> term -> repr
val add_seq : t -> term Iter.t -> unit
val all_classes : t -> repr Iter.t
val assert_lit : t -> lit -> unit
val assert_lits : t -> lit Iter.t -> unit
val explain_eq : t -> N.t -> N.t -> lit list
val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a
val n_true : t -> N.t
val n_false : t -> N.t
val n_bool : t -> bool -> N.t
val merge : t -> N.t -> N.t -> Expl.t -> unit
val merge_t : t -> term -> term -> Expl.t -> unit
val check : t -> actions -> unit
val new_merges : t -> bool
val push_level : t -> unit
val pop_levels : t -> int -> unit
val get_model : t -> N.t Iter.t Iter.t
module Debug_ : sig ... end
\ No newline at end of file diff --git a/dev/sidekick-base/Sidekick_base_solver/Th_lra/A/S/Solver_internal/CC/N/index.html b/dev/sidekick-base/Sidekick_base_solver/Th_lra/A/S/Solver_internal/CC/N/index.html index 5e2e116d..f8e323ac 100644 --- a/dev/sidekick-base/Sidekick_base_solver/Th_lra/A/S/Solver_internal/CC/N/index.html +++ b/dev/sidekick-base/Sidekick_base_solver/Th_lra/A/S/Solver_internal/CC/N/index.html @@ -1,2 +1,2 @@ -N (sidekick-base.Sidekick_base_solver.Th_lra.A.S.Solver_internal.CC.N)

Module CC.N

type t = Sidekick_msat_solver.Make(Solver_arg).Solver_internal.CC.N.t
val term : t -> term
val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
val is_root : t -> bool
val iter_class : t -> t Iter.t
val iter_parents : t -> t Iter.t
type bitfield = Sidekick_msat_solver.Make(Solver_arg).Solver_internal.CC.N.bitfield
val get_field : bitfield -> t -> bool
\ No newline at end of file +N (sidekick-base.Sidekick_base_solver.Th_lra.A.S.Solver_internal.CC.N)

Module CC.N

type t = Sidekick_msat_solver.Make(Solver_arg).Solver_internal.CC.N.t
val term : t -> term
val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
val is_root : t -> bool
val iter_class : t -> t Iter.t
val iter_parents : t -> t Iter.t
type bitfield = Sidekick_msat_solver.Make(Solver_arg).Solver_internal.CC.N.bitfield
\ No newline at end of file diff --git a/dev/sidekick-base/Sidekick_base_solver/Th_lra/A/S/Solver_internal/CC/index.html b/dev/sidekick-base/Sidekick_base_solver/Th_lra/A/S/Solver_internal/CC/index.html index 130ef288..e56e3640 100644 --- a/dev/sidekick-base/Sidekick_base_solver/Th_lra/A/S/Solver_internal/CC/index.html +++ b/dev/sidekick-base/Sidekick_base_solver/Th_lra/A/S/Solver_internal/CC/index.html @@ -1,2 +1,2 @@ -CC (sidekick-base.Sidekick_base_solver.Th_lra.A.S.Solver_internal.CC)

Module Solver_internal.CC

module T : sig ... end
module P : sig ... end
module Lit : sig ... end
module Actions : sig ... end
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t = Sidekick_msat_solver.Make(Solver_arg).Solver_internal.CC.t
module N : sig ... end
module Expl : sig ... end
type node = N.t
type repr = N.t
type explanation = Expl.t
val term_store : t -> term_store
val find : t -> node -> repr
val add_term : t -> term -> node
val mem_term : t -> term -> bool
type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit
type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit
type ev_on_new_term = t -> N.t -> term -> unit
type ev_on_conflict = t -> th:bool -> lit list -> unit
type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit
type ev_on_is_subterm = N.t -> term -> unit
val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Big | `Small ] -> term_store -> t
val allocate_bitfield : descr:string -> t -> N.bitfield
val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit
val on_pre_merge : t -> ev_on_pre_merge -> unit
val on_post_merge : t -> ev_on_post_merge -> unit
val on_new_term : t -> ev_on_new_term -> unit
val on_conflict : t -> ev_on_conflict -> unit
val on_propagate : t -> ev_on_propagate -> unit
val on_is_subterm : t -> ev_on_is_subterm -> unit
val set_as_lit : t -> N.t -> lit -> unit
val find_t : t -> term -> repr
val add_seq : t -> term Iter.t -> unit
val all_classes : t -> repr Iter.t
val assert_lit : t -> lit -> unit
val assert_lits : t -> lit Iter.t -> unit
val explain_eq : t -> N.t -> N.t -> lit list
val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a
val n_true : t -> N.t
val n_false : t -> N.t
val n_bool : t -> bool -> N.t
val merge : t -> N.t -> N.t -> Expl.t -> unit
val merge_t : t -> term -> term -> Expl.t -> unit
val check : t -> actions -> unit
val new_merges : t -> bool
val push_level : t -> unit
val pop_levels : t -> int -> unit
val get_model : t -> N.t Iter.t Iter.t
module Debug_ : sig ... end
\ No newline at end of file +CC (sidekick-base.Sidekick_base_solver.Th_lra.A.S.Solver_internal.CC)

Module Solver_internal.CC

module T : sig ... end
module P : sig ... end
module Lit : sig ... end
module Actions : sig ... end
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t = Sidekick_msat_solver.Make(Solver_arg).Solver_internal.CC.t
module N : sig ... end
module Expl : sig ... end
type node = N.t
type repr = N.t
type explanation = Expl.t
val term_store : t -> term_store
val find : t -> node -> repr
val add_term : t -> term -> node
val mem_term : t -> term -> bool
type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit
type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit
type ev_on_new_term = t -> N.t -> term -> unit
type ev_on_conflict = t -> th:bool -> lit list -> unit
type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit
type ev_on_is_subterm = N.t -> term -> unit
val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Big | `Small ] -> term_store -> t
val allocate_bitfield : descr:string -> t -> N.bitfield
val get_bitfield : t -> N.bitfield -> N.t -> bool
val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit
val on_pre_merge : t -> ev_on_pre_merge -> unit
val on_post_merge : t -> ev_on_post_merge -> unit
val on_new_term : t -> ev_on_new_term -> unit
val on_conflict : t -> ev_on_conflict -> unit
val on_propagate : t -> ev_on_propagate -> unit
val on_is_subterm : t -> ev_on_is_subterm -> unit
val set_as_lit : t -> N.t -> lit -> unit
val find_t : t -> term -> repr
val add_seq : t -> term Iter.t -> unit
val all_classes : t -> repr Iter.t
val assert_lit : t -> lit -> unit
val assert_lits : t -> lit Iter.t -> unit
val explain_eq : t -> N.t -> N.t -> lit list
val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a
val n_true : t -> N.t
val n_false : t -> N.t
val n_bool : t -> bool -> N.t
val merge : t -> N.t -> N.t -> Expl.t -> unit
val merge_t : t -> term -> term -> Expl.t -> unit
val check : t -> actions -> unit
val new_merges : t -> bool
val push_level : t -> unit
val pop_levels : t -> int -> unit
val get_model : t -> N.t Iter.t Iter.t
module Debug_ : sig ... end
\ No newline at end of file diff --git a/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/Solver_internal/CC/N/index.html b/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/Solver_internal/CC/N/index.html index 08f78f87..c8172811 100644 --- a/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/Solver_internal/CC/N/index.html +++ b/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/Solver_internal/CC/N/index.html @@ -1,2 +1,2 @@ -N (sidekick-bin.Sidekick_smtlib.Process.Solver.Solver_internal.CC.N)

Module CC.N

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

All information pertaining to the whole equivalence class is stored in this representative's node.

When two classes become equal (are "merged"), one of the two representatives is picked as the representative of the new class. The new class contains the union of the two old classes' nodes.

We also allow theories to store additional information in the representative. This information can be used when two classes are merged, to detect conflicts and solve equations à la Shostak.

type t

An equivalent class, containing terms that are proved to be equal.

A value of type t points to a particular term, but see find to get the representative of the class.

val term : t -> term
val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
val is_root : t -> bool

Is the node a root (ie the representative of its class)? See find to get the root.

val iter_class : t -> t Iter.t

Traverse the congruence class. Precondition: is_root n (see find below)

val iter_parents : t -> t Iter.t

Traverse the parents of the class. Precondition: is_root n (see find below)

type bitfield

A field in the bitfield of this node. This should only be allocated when a theory is initialized.

All fields are initially 0, are backtracked automatically, and are merged automatically when classes are merged.

val get_field : bitfield -> t -> bool

Access the bit field

\ No newline at end of file +N (sidekick-bin.Sidekick_smtlib.Process.Solver.Solver_internal.CC.N)

Module CC.N

Equivalence classes.

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

All information pertaining to the whole equivalence class is stored in this representative's node.

When two classes become equal (are "merged"), one of the two representatives is picked as the representative of the new class. The new class contains the union of the two old classes' nodes.

We also allow theories to store additional information in the representative. This information can be used when two classes are merged, to detect conflicts and solve equations à la Shostak.

type t

An equivalent class, containing terms that are proved to be equal.

A value of type t points to a particular term, but see find to get the representative of the class.

val term : t -> term

Term contained in this equivalence class. If is_root n, then term n is the class' representative term.

val equal : t -> t -> bool

Are two classes physically equal? To check for logical equality, use CC.N.equal (CC.find cc n1) (CC.find cc n2) which checks for equality of representatives.

val hash : t -> int

An opaque hash of this node.

val pp : t Sidekick_core.Fmt.printer

Unspecified printing of the node, for example its term, a unique ID, etc.

val is_root : t -> bool

Is the node a root (ie the representative of its class)? See find to get the root.

val iter_class : t -> t Iter.t

Traverse the congruence class. Precondition: is_root n (see find below)

val iter_parents : t -> t Iter.t

Traverse the parents of the class. Precondition: is_root n (see find below)

type bitfield

A field in the bitfield of this node. This should only be allocated when a theory is initialized.

Bitfields are accessed using preallocated keys. See Sidekick_core.CC_S.allocate_bitfield.

All fields are initially 0, are backtracked automatically, and are merged automatically when classes are merged.

\ No newline at end of file diff --git a/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/Solver_internal/CC/index.html b/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/Solver_internal/CC/index.html index 28d48ea8..b218eda2 100644 --- a/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/Solver_internal/CC/index.html +++ b/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/Solver_internal/CC/index.html @@ -1,2 +1,2 @@ -CC (sidekick-bin.Sidekick_smtlib.Process.Solver.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_store : t -> term_store
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_store -> t

Create a new congruence closure.

parameter term_store

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file +CC (sidekick-bin.Sidekick_smtlib.Process.Solver.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

The congruence closure object. It contains a fair amount of state and is mutable and backtrackable.

module N : sig ... end

Equivalence classes.

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_store : t -> term_store
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_store -> t

Create a new congruence closure.

parameter term_store

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new node field (see N.bitfield).

This field descriptor is henceforth reserved for all nodes in this congruence closure, and can be set using set_bitfield for each node individually. This can be used to efficiently store some metadata on nodes (e.g. "is there a numeric value in the class" or "is there a constructor term in the class").

There may be restrictions on how many distinct fields are allocated for a given congruence closure (e.g. at most Sys.int_size fields).

val get_bitfield : t -> N.bitfield -> N.t -> bool

Access the bit field of the given node

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file diff --git a/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/Solver_internal/CC/N/index.html b/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/Solver_internal/CC/N/index.html index 302f2422..1c388747 100644 --- a/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/Solver_internal/CC/N/index.html +++ b/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/Solver_internal/CC/N/index.html @@ -1,2 +1,2 @@ -N (sidekick-bin.Sidekick_smtlib__.Process.Solver.Solver_internal.CC.N)

Module CC.N

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

All information pertaining to the whole equivalence class is stored in this representative's node.

When two classes become equal (are "merged"), one of the two representatives is picked as the representative of the new class. The new class contains the union of the two old classes' nodes.

We also allow theories to store additional information in the representative. This information can be used when two classes are merged, to detect conflicts and solve equations à la Shostak.

type t

An equivalent class, containing terms that are proved to be equal.

A value of type t points to a particular term, but see find to get the representative of the class.

val term : t -> term
val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
val is_root : t -> bool

Is the node a root (ie the representative of its class)? See find to get the root.

val iter_class : t -> t Iter.t

Traverse the congruence class. Precondition: is_root n (see find below)

val iter_parents : t -> t Iter.t

Traverse the parents of the class. Precondition: is_root n (see find below)

type bitfield

A field in the bitfield of this node. This should only be allocated when a theory is initialized.

All fields are initially 0, are backtracked automatically, and are merged automatically when classes are merged.

val get_field : bitfield -> t -> bool

Access the bit field

\ No newline at end of file +N (sidekick-bin.Sidekick_smtlib__.Process.Solver.Solver_internal.CC.N)

Module CC.N

Equivalence classes.

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

All information pertaining to the whole equivalence class is stored in this representative's node.

When two classes become equal (are "merged"), one of the two representatives is picked as the representative of the new class. The new class contains the union of the two old classes' nodes.

We also allow theories to store additional information in the representative. This information can be used when two classes are merged, to detect conflicts and solve equations à la Shostak.

type t

An equivalent class, containing terms that are proved to be equal.

A value of type t points to a particular term, but see find to get the representative of the class.

val term : t -> term

Term contained in this equivalence class. If is_root n, then term n is the class' representative term.

val equal : t -> t -> bool

Are two classes physically equal? To check for logical equality, use CC.N.equal (CC.find cc n1) (CC.find cc n2) which checks for equality of representatives.

val hash : t -> int

An opaque hash of this node.

val pp : t Sidekick_core.Fmt.printer

Unspecified printing of the node, for example its term, a unique ID, etc.

val is_root : t -> bool

Is the node a root (ie the representative of its class)? See find to get the root.

val iter_class : t -> t Iter.t

Traverse the congruence class. Precondition: is_root n (see find below)

val iter_parents : t -> t Iter.t

Traverse the parents of the class. Precondition: is_root n (see find below)

type bitfield

A field in the bitfield of this node. This should only be allocated when a theory is initialized.

Bitfields are accessed using preallocated keys. See Sidekick_core.CC_S.allocate_bitfield.

All fields are initially 0, are backtracked automatically, and are merged automatically when classes are merged.

\ No newline at end of file diff --git a/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/Solver_internal/CC/index.html b/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/Solver_internal/CC/index.html index 6e22f9cc..360e4a86 100644 --- a/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/Solver_internal/CC/index.html +++ b/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/Solver_internal/CC/index.html @@ -1,2 +1,2 @@ -CC (sidekick-bin.Sidekick_smtlib__.Process.Solver.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_store : t -> term_store
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_store -> t

Create a new congruence closure.

parameter term_store

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file +CC (sidekick-bin.Sidekick_smtlib__.Process.Solver.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

The congruence closure object. It contains a fair amount of state and is mutable and backtrackable.

module N : sig ... end

Equivalence classes.

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_store : t -> term_store
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_store -> t

Create a new congruence closure.

parameter term_store

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new node field (see N.bitfield).

This field descriptor is henceforth reserved for all nodes in this congruence closure, and can be set using set_bitfield for each node individually. This can be used to efficiently store some metadata on nodes (e.g. "is there a numeric value in the class" or "is there a constructor term in the class").

There may be restrictions on how many distinct fields are allocated for a given congruence closure (e.g. at most Sys.int_size fields).

val get_bitfield : t -> N.bitfield -> N.t -> bool

Access the bit field of the given node

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file diff --git a/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/Solver_internal/CC/N/index.html b/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/Solver_internal/CC/N/index.html index 0d033b21..870d969a 100644 --- a/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/Solver_internal/CC/N/index.html +++ b/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/Solver_internal/CC/N/index.html @@ -1,2 +1,2 @@ -N (sidekick-bin.Sidekick_smtlib__Process.Solver.Solver_internal.CC.N)

Module CC.N

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

All information pertaining to the whole equivalence class is stored in this representative's node.

When two classes become equal (are "merged"), one of the two representatives is picked as the representative of the new class. The new class contains the union of the two old classes' nodes.

We also allow theories to store additional information in the representative. This information can be used when two classes are merged, to detect conflicts and solve equations à la Shostak.

type t

An equivalent class, containing terms that are proved to be equal.

A value of type t points to a particular term, but see find to get the representative of the class.

val term : t -> term
val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
val is_root : t -> bool

Is the node a root (ie the representative of its class)? See find to get the root.

val iter_class : t -> t Iter.t

Traverse the congruence class. Precondition: is_root n (see find below)

val iter_parents : t -> t Iter.t

Traverse the parents of the class. Precondition: is_root n (see find below)

type bitfield

A field in the bitfield of this node. This should only be allocated when a theory is initialized.

All fields are initially 0, are backtracked automatically, and are merged automatically when classes are merged.

val get_field : bitfield -> t -> bool

Access the bit field

\ No newline at end of file +N (sidekick-bin.Sidekick_smtlib__Process.Solver.Solver_internal.CC.N)

Module CC.N

Equivalence classes.

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

All information pertaining to the whole equivalence class is stored in this representative's node.

When two classes become equal (are "merged"), one of the two representatives is picked as the representative of the new class. The new class contains the union of the two old classes' nodes.

We also allow theories to store additional information in the representative. This information can be used when two classes are merged, to detect conflicts and solve equations à la Shostak.

type t

An equivalent class, containing terms that are proved to be equal.

A value of type t points to a particular term, but see find to get the representative of the class.

val term : t -> term

Term contained in this equivalence class. If is_root n, then term n is the class' representative term.

val equal : t -> t -> bool

Are two classes physically equal? To check for logical equality, use CC.N.equal (CC.find cc n1) (CC.find cc n2) which checks for equality of representatives.

val hash : t -> int

An opaque hash of this node.

val pp : t Sidekick_core.Fmt.printer

Unspecified printing of the node, for example its term, a unique ID, etc.

val is_root : t -> bool

Is the node a root (ie the representative of its class)? See find to get the root.

val iter_class : t -> t Iter.t

Traverse the congruence class. Precondition: is_root n (see find below)

val iter_parents : t -> t Iter.t

Traverse the parents of the class. Precondition: is_root n (see find below)

type bitfield

A field in the bitfield of this node. This should only be allocated when a theory is initialized.

Bitfields are accessed using preallocated keys. See Sidekick_core.CC_S.allocate_bitfield.

All fields are initially 0, are backtracked automatically, and are merged automatically when classes are merged.

\ No newline at end of file diff --git a/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/Solver_internal/CC/index.html b/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/Solver_internal/CC/index.html index 9afb439d..e70dc542 100644 --- a/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/Solver_internal/CC/index.html +++ b/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/Solver_internal/CC/index.html @@ -1,2 +1,2 @@ -CC (sidekick-bin.Sidekick_smtlib__Process.Solver.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_store : t -> term_store
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_store -> t

Create a new congruence closure.

parameter term_store

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file +CC (sidekick-bin.Sidekick_smtlib__Process.Solver.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

The congruence closure object. It contains a fair amount of state and is mutable and backtrackable.

module N : sig ... end

Equivalence classes.

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_store : t -> term_store
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_store -> t

Create a new congruence closure.

parameter term_store

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new node field (see N.bitfield).

This field descriptor is henceforth reserved for all nodes in this congruence closure, and can be set using set_bitfield for each node individually. This can be used to efficiently store some metadata on nodes (e.g. "is there a numeric value in the class" or "is there a constructor term in the class").

There may be restrictions on how many distinct fields are allocated for a given congruence closure (e.g. at most Sys.int_size fields).

val get_bitfield : t -> N.bitfield -> N.t -> bool

Access the bit field of the given node

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_arith_lra/Make/argument-1-A/S/Solver_internal/CC/N/index.html b/dev/sidekick/Sidekick_arith_lra/Make/argument-1-A/S/Solver_internal/CC/N/index.html index c472502c..f9ab13b5 100644 --- a/dev/sidekick/Sidekick_arith_lra/Make/argument-1-A/S/Solver_internal/CC/N/index.html +++ b/dev/sidekick/Sidekick_arith_lra/Make/argument-1-A/S/Solver_internal/CC/N/index.html @@ -1,2 +1,2 @@ -N (sidekick.Sidekick_arith_lra.Make.1-A.S.Solver_internal.CC.N)

Module CC.N

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

All information pertaining to the whole equivalence class is stored in this representative's node.

When two classes become equal (are "merged"), one of the two representatives is picked as the representative of the new class. The new class contains the union of the two old classes' nodes.

We also allow theories to store additional information in the representative. This information can be used when two classes are merged, to detect conflicts and solve equations à la Shostak.

type t

An equivalent class, containing terms that are proved to be equal.

A value of type t points to a particular term, but see find to get the representative of the class.

val term : t -> term
val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
val is_root : t -> bool

Is the node a root (ie the representative of its class)? See find to get the root.

val iter_class : t -> t Iter.t

Traverse the congruence class. Precondition: is_root n (see find below)

val iter_parents : t -> t Iter.t

Traverse the parents of the class. Precondition: is_root n (see find below)

type bitfield

A field in the bitfield of this node. This should only be allocated when a theory is initialized.

All fields are initially 0, are backtracked automatically, and are merged automatically when classes are merged.

val get_field : bitfield -> t -> bool

Access the bit field

\ No newline at end of file +N (sidekick.Sidekick_arith_lra.Make.1-A.S.Solver_internal.CC.N)

Module CC.N

Equivalence classes.

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

All information pertaining to the whole equivalence class is stored in this representative's node.

When two classes become equal (are "merged"), one of the two representatives is picked as the representative of the new class. The new class contains the union of the two old classes' nodes.

We also allow theories to store additional information in the representative. This information can be used when two classes are merged, to detect conflicts and solve equations à la Shostak.

type t

An equivalent class, containing terms that are proved to be equal.

A value of type t points to a particular term, but see find to get the representative of the class.

val term : t -> term

Term contained in this equivalence class. If is_root n, then term n is the class' representative term.

val equal : t -> t -> bool

Are two classes physically equal? To check for logical equality, use CC.N.equal (CC.find cc n1) (CC.find cc n2) which checks for equality of representatives.

val hash : t -> int

An opaque hash of this node.

val pp : t Sidekick_core.Fmt.printer

Unspecified printing of the node, for example its term, a unique ID, etc.

val is_root : t -> bool

Is the node a root (ie the representative of its class)? See find to get the root.

val iter_class : t -> t Iter.t

Traverse the congruence class. Precondition: is_root n (see find below)

val iter_parents : t -> t Iter.t

Traverse the parents of the class. Precondition: is_root n (see find below)

type bitfield

A field in the bitfield of this node. This should only be allocated when a theory is initialized.

Bitfields are accessed using preallocated keys. See Sidekick_core.CC_S.allocate_bitfield.

All fields are initially 0, are backtracked automatically, and are merged automatically when classes are merged.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_arith_lra/Make/argument-1-A/S/Solver_internal/CC/index.html b/dev/sidekick/Sidekick_arith_lra/Make/argument-1-A/S/Solver_internal/CC/index.html index 8be82bac..b263613a 100644 --- a/dev/sidekick/Sidekick_arith_lra/Make/argument-1-A/S/Solver_internal/CC/index.html +++ b/dev/sidekick/Sidekick_arith_lra/Make/argument-1-A/S/Solver_internal/CC/index.html @@ -1,2 +1,2 @@ -CC (sidekick.Sidekick_arith_lra.Make.1-A.S.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_store : t -> term_store
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_store -> t

Create a new congruence closure.

parameter term_store

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file +CC (sidekick.Sidekick_arith_lra.Make.1-A.S.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

The congruence closure object. It contains a fair amount of state and is mutable and backtrackable.

module N : sig ... end

Equivalence classes.

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_store : t -> term_store
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_store -> t

Create a new congruence closure.

parameter term_store

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new node field (see N.bitfield).

This field descriptor is henceforth reserved for all nodes in this congruence closure, and can be set using set_bitfield for each node individually. This can be used to efficiently store some metadata on nodes (e.g. "is there a numeric value in the class" or "is there a constructor term in the class").

There may be restrictions on how many distinct fields are allocated for a given congruence closure (e.g. at most Sys.int_size fields).

val get_bitfield : t -> N.bitfield -> N.t -> bool

Access the bit field of the given node

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_arith_lra/module-type-ARG/S/Solver_internal/CC/N/index.html b/dev/sidekick/Sidekick_arith_lra/module-type-ARG/S/Solver_internal/CC/N/index.html index d94bda0c..eed1c1c1 100644 --- a/dev/sidekick/Sidekick_arith_lra/module-type-ARG/S/Solver_internal/CC/N/index.html +++ b/dev/sidekick/Sidekick_arith_lra/module-type-ARG/S/Solver_internal/CC/N/index.html @@ -1,2 +1,2 @@ -N (sidekick.Sidekick_arith_lra.ARG.S.Solver_internal.CC.N)

Module CC.N

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

All information pertaining to the whole equivalence class is stored in this representative's node.

When two classes become equal (are "merged"), one of the two representatives is picked as the representative of the new class. The new class contains the union of the two old classes' nodes.

We also allow theories to store additional information in the representative. This information can be used when two classes are merged, to detect conflicts and solve equations à la Shostak.

type t

An equivalent class, containing terms that are proved to be equal.

A value of type t points to a particular term, but see find to get the representative of the class.

val term : t -> term
val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
val is_root : t -> bool

Is the node a root (ie the representative of its class)? See find to get the root.

val iter_class : t -> t Iter.t

Traverse the congruence class. Precondition: is_root n (see find below)

val iter_parents : t -> t Iter.t

Traverse the parents of the class. Precondition: is_root n (see find below)

type bitfield

A field in the bitfield of this node. This should only be allocated when a theory is initialized.

All fields are initially 0, are backtracked automatically, and are merged automatically when classes are merged.

val get_field : bitfield -> t -> bool

Access the bit field

\ No newline at end of file +N (sidekick.Sidekick_arith_lra.ARG.S.Solver_internal.CC.N)

Module CC.N

Equivalence classes.

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

All information pertaining to the whole equivalence class is stored in this representative's node.

When two classes become equal (are "merged"), one of the two representatives is picked as the representative of the new class. The new class contains the union of the two old classes' nodes.

We also allow theories to store additional information in the representative. This information can be used when two classes are merged, to detect conflicts and solve equations à la Shostak.

type t

An equivalent class, containing terms that are proved to be equal.

A value of type t points to a particular term, but see find to get the representative of the class.

val term : t -> term

Term contained in this equivalence class. If is_root n, then term n is the class' representative term.

val equal : t -> t -> bool

Are two classes physically equal? To check for logical equality, use CC.N.equal (CC.find cc n1) (CC.find cc n2) which checks for equality of representatives.

val hash : t -> int

An opaque hash of this node.

val pp : t Sidekick_core.Fmt.printer

Unspecified printing of the node, for example its term, a unique ID, etc.

val is_root : t -> bool

Is the node a root (ie the representative of its class)? See find to get the root.

val iter_class : t -> t Iter.t

Traverse the congruence class. Precondition: is_root n (see find below)

val iter_parents : t -> t Iter.t

Traverse the parents of the class. Precondition: is_root n (see find below)

type bitfield

A field in the bitfield of this node. This should only be allocated when a theory is initialized.

Bitfields are accessed using preallocated keys. See Sidekick_core.CC_S.allocate_bitfield.

All fields are initially 0, are backtracked automatically, and are merged automatically when classes are merged.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_arith_lra/module-type-ARG/S/Solver_internal/CC/index.html b/dev/sidekick/Sidekick_arith_lra/module-type-ARG/S/Solver_internal/CC/index.html index 31838fe8..918d48fb 100644 --- a/dev/sidekick/Sidekick_arith_lra/module-type-ARG/S/Solver_internal/CC/index.html +++ b/dev/sidekick/Sidekick_arith_lra/module-type-ARG/S/Solver_internal/CC/index.html @@ -1,2 +1,2 @@ -CC (sidekick.Sidekick_arith_lra.ARG.S.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_store : t -> term_store
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_store -> t

Create a new congruence closure.

parameter term_store

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file +CC (sidekick.Sidekick_arith_lra.ARG.S.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

The congruence closure object. It contains a fair amount of state and is mutable and backtrackable.

module N : sig ... end

Equivalence classes.

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_store : t -> term_store
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_store -> t

Create a new congruence closure.

parameter term_store

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new node field (see N.bitfield).

This field descriptor is henceforth reserved for all nodes in this congruence closure, and can be set using set_bitfield for each node individually. This can be used to efficiently store some metadata on nodes (e.g. "is there a numeric value in the class" or "is there a constructor term in the class").

There may be restrictions on how many distinct fields are allocated for a given congruence closure (e.g. at most Sys.int_size fields).

val get_bitfield : t -> N.bitfield -> N.t -> bool

Access the bit field of the given node

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_arith_lra/module-type-S/A/S/Solver_internal/CC/N/index.html b/dev/sidekick/Sidekick_arith_lra/module-type-S/A/S/Solver_internal/CC/N/index.html index 80917252..5ce5c666 100644 --- a/dev/sidekick/Sidekick_arith_lra/module-type-S/A/S/Solver_internal/CC/N/index.html +++ b/dev/sidekick/Sidekick_arith_lra/module-type-S/A/S/Solver_internal/CC/N/index.html @@ -1,2 +1,2 @@ -N (sidekick.Sidekick_arith_lra.S.A.S.Solver_internal.CC.N)

Module CC.N

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

All information pertaining to the whole equivalence class is stored in this representative's node.

When two classes become equal (are "merged"), one of the two representatives is picked as the representative of the new class. The new class contains the union of the two old classes' nodes.

We also allow theories to store additional information in the representative. This information can be used when two classes are merged, to detect conflicts and solve equations à la Shostak.

type t

An equivalent class, containing terms that are proved to be equal.

A value of type t points to a particular term, but see find to get the representative of the class.

val term : t -> term
val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
val is_root : t -> bool

Is the node a root (ie the representative of its class)? See find to get the root.

val iter_class : t -> t Iter.t

Traverse the congruence class. Precondition: is_root n (see find below)

val iter_parents : t -> t Iter.t

Traverse the parents of the class. Precondition: is_root n (see find below)

type bitfield

A field in the bitfield of this node. This should only be allocated when a theory is initialized.

All fields are initially 0, are backtracked automatically, and are merged automatically when classes are merged.

val get_field : bitfield -> t -> bool

Access the bit field

\ No newline at end of file +N (sidekick.Sidekick_arith_lra.S.A.S.Solver_internal.CC.N)

Module CC.N

Equivalence classes.

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

All information pertaining to the whole equivalence class is stored in this representative's node.

When two classes become equal (are "merged"), one of the two representatives is picked as the representative of the new class. The new class contains the union of the two old classes' nodes.

We also allow theories to store additional information in the representative. This information can be used when two classes are merged, to detect conflicts and solve equations à la Shostak.

type t

An equivalent class, containing terms that are proved to be equal.

A value of type t points to a particular term, but see find to get the representative of the class.

val term : t -> term

Term contained in this equivalence class. If is_root n, then term n is the class' representative term.

val equal : t -> t -> bool

Are two classes physically equal? To check for logical equality, use CC.N.equal (CC.find cc n1) (CC.find cc n2) which checks for equality of representatives.

val hash : t -> int

An opaque hash of this node.

val pp : t Sidekick_core.Fmt.printer

Unspecified printing of the node, for example its term, a unique ID, etc.

val is_root : t -> bool

Is the node a root (ie the representative of its class)? See find to get the root.

val iter_class : t -> t Iter.t

Traverse the congruence class. Precondition: is_root n (see find below)

val iter_parents : t -> t Iter.t

Traverse the parents of the class. Precondition: is_root n (see find below)

type bitfield

A field in the bitfield of this node. This should only be allocated when a theory is initialized.

Bitfields are accessed using preallocated keys. See Sidekick_core.CC_S.allocate_bitfield.

All fields are initially 0, are backtracked automatically, and are merged automatically when classes are merged.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_arith_lra/module-type-S/A/S/Solver_internal/CC/index.html b/dev/sidekick/Sidekick_arith_lra/module-type-S/A/S/Solver_internal/CC/index.html index f07cd5b5..335d3e6c 100644 --- a/dev/sidekick/Sidekick_arith_lra/module-type-S/A/S/Solver_internal/CC/index.html +++ b/dev/sidekick/Sidekick_arith_lra/module-type-S/A/S/Solver_internal/CC/index.html @@ -1,2 +1,2 @@ -CC (sidekick.Sidekick_arith_lra.S.A.S.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_store : t -> term_store
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_store -> t

Create a new congruence closure.

parameter term_store

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file +CC (sidekick.Sidekick_arith_lra.S.A.S.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

The congruence closure object. It contains a fair amount of state and is mutable and backtrackable.

module N : sig ... end

Equivalence classes.

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_store : t -> term_store
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_store -> t

Create a new congruence closure.

parameter term_store

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new node field (see N.bitfield).

This field descriptor is henceforth reserved for all nodes in this congruence closure, and can be set using set_bitfield for each node individually. This can be used to efficiently store some metadata on nodes (e.g. "is there a numeric value in the class" or "is there a constructor term in the class").

There may be restrictions on how many distinct fields are allocated for a given congruence closure (e.g. at most Sys.int_size fields).

val get_bitfield : t -> N.bitfield -> N.t -> bool

Access the bit field of the given node

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_cc/Make/N/index.html b/dev/sidekick/Sidekick_cc/Make/N/index.html index 597ac6e5..d56ba6b7 100644 --- a/dev/sidekick/Sidekick_cc/Make/N/index.html +++ b/dev/sidekick/Sidekick_cc/Make/N/index.html @@ -1,2 +1,2 @@ -N (sidekick.Sidekick_cc.Make.N)

Module Make.N

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

All information pertaining to the whole equivalence class is stored in this representative's node.

When two classes become equal (are "merged"), one of the two representatives is picked as the representative of the new class. The new class contains the union of the two old classes' nodes.

We also allow theories to store additional information in the representative. This information can be used when two classes are merged, to detect conflicts and solve equations à la Shostak.

type t

An equivalent class, containing terms that are proved to be equal.

A value of type t points to a particular term, but see find to get the representative of the class.

val term : t -> term
val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
val is_root : t -> bool

Is the node a root (ie the representative of its class)? See find to get the root.

val iter_class : t -> t Iter.t

Traverse the congruence class. Precondition: is_root n (see find below)

val iter_parents : t -> t Iter.t

Traverse the parents of the class. Precondition: is_root n (see find below)

type bitfield

A field in the bitfield of this node. This should only be allocated when a theory is initialized.

All fields are initially 0, are backtracked automatically, and are merged automatically when classes are merged.

val get_field : bitfield -> t -> bool

Access the bit field

\ No newline at end of file +N (sidekick.Sidekick_cc.Make.N)

Module Make.N

Equivalence classes.

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

All information pertaining to the whole equivalence class is stored in this representative's node.

When two classes become equal (are "merged"), one of the two representatives is picked as the representative of the new class. The new class contains the union of the two old classes' nodes.

We also allow theories to store additional information in the representative. This information can be used when two classes are merged, to detect conflicts and solve equations à la Shostak.

type t

An equivalent class, containing terms that are proved to be equal.

A value of type t points to a particular term, but see find to get the representative of the class.

val term : t -> term

Term contained in this equivalence class. If is_root n, then term n is the class' representative term.

val equal : t -> t -> bool

Are two classes physically equal? To check for logical equality, use CC.N.equal (CC.find cc n1) (CC.find cc n2) which checks for equality of representatives.

val hash : t -> int

An opaque hash of this node.

val pp : t Sidekick_core.Fmt.printer

Unspecified printing of the node, for example its term, a unique ID, etc.

val is_root : t -> bool

Is the node a root (ie the representative of its class)? See find to get the root.

val iter_class : t -> t Iter.t

Traverse the congruence class. Precondition: is_root n (see find below)

val iter_parents : t -> t Iter.t

Traverse the parents of the class. Precondition: is_root n (see find below)

type bitfield

A field in the bitfield of this node. This should only be allocated when a theory is initialized.

Bitfields are accessed using preallocated keys. See Sidekick_core.CC_S.allocate_bitfield.

All fields are initially 0, are backtracked automatically, and are merged automatically when classes are merged.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_cc/Make/index.html b/dev/sidekick/Sidekick_cc/Make/index.html index 936d3b33..4b3b9e21 100644 --- a/dev/sidekick/Sidekick_cc/Make/index.html +++ b/dev/sidekick/Sidekick_cc/Make/index.html @@ -1,2 +1,2 @@ -Make (sidekick.Sidekick_cc.Make)

Module Sidekick_cc.Make

Parameters

Signature

module T = A.T
module P = A.P
module Lit = A.Lit
module Actions = A.Actions
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_store : t -> term_store
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_store -> t

Create a new congruence closure.

parameter term_store

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file +Make (sidekick.Sidekick_cc.Make)

Module Sidekick_cc.Make

Parameters

Signature

module T = A.T
module P = A.P
module Lit = A.Lit
module Actions = A.Actions
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

The congruence closure object. It contains a fair amount of state and is mutable and backtrackable.

module N : sig ... end

Equivalence classes.

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_store : t -> term_store
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_store -> t

Create a new congruence closure.

parameter term_store

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new node field (see N.bitfield).

This field descriptor is henceforth reserved for all nodes in this congruence closure, and can be set using set_bitfield for each node individually. This can be used to efficiently store some metadata on nodes (e.g. "is there a numeric value in the class" or "is there a constructor term in the class").

There may be restrictions on how many distinct fields are allocated for a given congruence closure (e.g. at most Sys.int_size fields).

val get_bitfield : t -> N.bitfield -> N.t -> bool

Access the bit field of the given node

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_cc/module-type-S/N/index.html b/dev/sidekick/Sidekick_cc/module-type-S/N/index.html index b43380a8..ac0c8ccc 100644 --- a/dev/sidekick/Sidekick_cc/module-type-S/N/index.html +++ b/dev/sidekick/Sidekick_cc/module-type-S/N/index.html @@ -1,2 +1,2 @@ -N (sidekick.Sidekick_cc.S.N)

Module S.N

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

All information pertaining to the whole equivalence class is stored in this representative's node.

When two classes become equal (are "merged"), one of the two representatives is picked as the representative of the new class. The new class contains the union of the two old classes' nodes.

We also allow theories to store additional information in the representative. This information can be used when two classes are merged, to detect conflicts and solve equations à la Shostak.

type t

An equivalent class, containing terms that are proved to be equal.

A value of type t points to a particular term, but see find to get the representative of the class.

val term : t -> term
val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
val is_root : t -> bool

Is the node a root (ie the representative of its class)? See find to get the root.

val iter_class : t -> t Iter.t

Traverse the congruence class. Precondition: is_root n (see find below)

val iter_parents : t -> t Iter.t

Traverse the parents of the class. Precondition: is_root n (see find below)

type bitfield

A field in the bitfield of this node. This should only be allocated when a theory is initialized.

All fields are initially 0, are backtracked automatically, and are merged automatically when classes are merged.

val get_field : bitfield -> t -> bool

Access the bit field

\ No newline at end of file +N (sidekick.Sidekick_cc.S.N)

Module S.N

Equivalence classes.

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

All information pertaining to the whole equivalence class is stored in this representative's node.

When two classes become equal (are "merged"), one of the two representatives is picked as the representative of the new class. The new class contains the union of the two old classes' nodes.

We also allow theories to store additional information in the representative. This information can be used when two classes are merged, to detect conflicts and solve equations à la Shostak.

type t

An equivalent class, containing terms that are proved to be equal.

A value of type t points to a particular term, but see find to get the representative of the class.

val term : t -> term

Term contained in this equivalence class. If is_root n, then term n is the class' representative term.

val equal : t -> t -> bool

Are two classes physically equal? To check for logical equality, use CC.N.equal (CC.find cc n1) (CC.find cc n2) which checks for equality of representatives.

val hash : t -> int

An opaque hash of this node.

val pp : t Sidekick_core.Fmt.printer

Unspecified printing of the node, for example its term, a unique ID, etc.

val is_root : t -> bool

Is the node a root (ie the representative of its class)? See find to get the root.

val iter_class : t -> t Iter.t

Traverse the congruence class. Precondition: is_root n (see find below)

val iter_parents : t -> t Iter.t

Traverse the parents of the class. Precondition: is_root n (see find below)

type bitfield

A field in the bitfield of this node. This should only be allocated when a theory is initialized.

Bitfields are accessed using preallocated keys. See Sidekick_core.CC_S.allocate_bitfield.

All fields are initially 0, are backtracked automatically, and are merged automatically when classes are merged.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_cc/module-type-S/index.html b/dev/sidekick/Sidekick_cc/module-type-S/index.html index ec4c0e01..1274256a 100644 --- a/dev/sidekick/Sidekick_cc/module-type-S/index.html +++ b/dev/sidekick/Sidekick_cc/module-type-S/index.html @@ -1,2 +1,2 @@ -S (sidekick.Sidekick_cc.S)

Module type Sidekick_cc.S

module P : Sidekick_core.PROOF with type term = T.Term.t
module Lit : Sidekick_core.LIT with module T = T
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_store : t -> term_store
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_store -> t

Create a new congruence closure.

parameter term_store

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file +S (sidekick.Sidekick_cc.S)

Module type Sidekick_cc.S

module P : Sidekick_core.PROOF with type term = T.Term.t
module Lit : Sidekick_core.LIT with module T = T
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

The congruence closure object. It contains a fair amount of state and is mutable and backtrackable.

module N : sig ... end

Equivalence classes.

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_store : t -> term_store
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_store -> t

Create a new congruence closure.

parameter term_store

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new node field (see N.bitfield).

This field descriptor is henceforth reserved for all nodes in this congruence closure, and can be set using set_bitfield for each node individually. This can be used to efficiently store some metadata on nodes (e.g. "is there a numeric value in the class" or "is there a constructor term in the class").

There may be restrictions on how many distinct fields are allocated for a given congruence closure (e.g. at most Sys.int_size fields).

val get_bitfield : t -> N.bitfield -> N.t -> bool

Access the bit field of the given node

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/Monoid_of_repr/argument-1-M/SI/CC/N/index.html b/dev/sidekick/Sidekick_core/Monoid_of_repr/argument-1-M/SI/CC/N/index.html index 04c2234c..c1e2e38a 100644 --- a/dev/sidekick/Sidekick_core/Monoid_of_repr/argument-1-M/SI/CC/N/index.html +++ b/dev/sidekick/Sidekick_core/Monoid_of_repr/argument-1-M/SI/CC/N/index.html @@ -1,2 +1,2 @@ -N (sidekick.Sidekick_core.Monoid_of_repr.1-M.SI.CC.N)

Module CC.N

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

All information pertaining to the whole equivalence class is stored in this representative's node.

When two classes become equal (are "merged"), one of the two representatives is picked as the representative of the new class. The new class contains the union of the two old classes' nodes.

We also allow theories to store additional information in the representative. This information can be used when two classes are merged, to detect conflicts and solve equations à la Shostak.

type t

An equivalent class, containing terms that are proved to be equal.

A value of type t points to a particular term, but see find to get the representative of the class.

val term : t -> term
val equal : t -> t -> bool
val hash : t -> int
val pp : t Fmt.printer
val is_root : t -> bool

Is the node a root (ie the representative of its class)? See find to get the root.

val iter_class : t -> t Iter.t

Traverse the congruence class. Precondition: is_root n (see find below)

val iter_parents : t -> t Iter.t

Traverse the parents of the class. Precondition: is_root n (see find below)

type bitfield

A field in the bitfield of this node. This should only be allocated when a theory is initialized.

All fields are initially 0, are backtracked automatically, and are merged automatically when classes are merged.

val get_field : bitfield -> t -> bool

Access the bit field

\ No newline at end of file +N (sidekick.Sidekick_core.Monoid_of_repr.1-M.SI.CC.N)

Module CC.N

Equivalence classes.

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

All information pertaining to the whole equivalence class is stored in this representative's node.

When two classes become equal (are "merged"), one of the two representatives is picked as the representative of the new class. The new class contains the union of the two old classes' nodes.

We also allow theories to store additional information in the representative. This information can be used when two classes are merged, to detect conflicts and solve equations à la Shostak.

type t

An equivalent class, containing terms that are proved to be equal.

A value of type t points to a particular term, but see find to get the representative of the class.

val term : t -> term

Term contained in this equivalence class. If is_root n, then term n is the class' representative term.

val equal : t -> t -> bool

Are two classes physically equal? To check for logical equality, use CC.N.equal (CC.find cc n1) (CC.find cc n2) which checks for equality of representatives.

val hash : t -> int

An opaque hash of this node.

val pp : t Fmt.printer

Unspecified printing of the node, for example its term, a unique ID, etc.

val is_root : t -> bool

Is the node a root (ie the representative of its class)? See find to get the root.

val iter_class : t -> t Iter.t

Traverse the congruence class. Precondition: is_root n (see find below)

val iter_parents : t -> t Iter.t

Traverse the parents of the class. Precondition: is_root n (see find below)

type bitfield

A field in the bitfield of this node. This should only be allocated when a theory is initialized.

Bitfields are accessed using preallocated keys. See CC_S.allocate_bitfield.

All fields are initially 0, are backtracked automatically, and are merged automatically when classes are merged.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/Monoid_of_repr/argument-1-M/SI/CC/index.html b/dev/sidekick/Sidekick_core/Monoid_of_repr/argument-1-M/SI/CC/index.html index 817db53f..d73da31a 100644 --- a/dev/sidekick/Sidekick_core/Monoid_of_repr/argument-1-M/SI/CC/index.html +++ b/dev/sidekick/Sidekick_core/Monoid_of_repr/argument-1-M/SI/CC/index.html @@ -1,2 +1,2 @@ -CC (sidekick.Sidekick_core.Monoid_of_repr.1-M.SI.CC)

Module SI.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_store : t -> term_store
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_store -> t

Create a new congruence closure.

parameter term_store

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file +CC (sidekick.Sidekick_core.Monoid_of_repr.1-M.SI.CC)

Module SI.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

The congruence closure object. It contains a fair amount of state and is mutable and backtrackable.

module N : sig ... end

Equivalence classes.

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_store : t -> term_store
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_store -> t

Create a new congruence closure.

parameter term_store

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new node field (see N.bitfield).

This field descriptor is henceforth reserved for all nodes in this congruence closure, and can be set using set_bitfield for each node individually. This can be used to efficiently store some metadata on nodes (e.g. "is there a numeric value in the class" or "is there a constructor term in the class").

There may be restrictions on how many distinct fields are allocated for a given congruence closure (e.g. at most Sys.int_size fields).

val get_bitfield : t -> N.bitfield -> N.t -> bool

Access the bit field of the given node

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/index.html b/dev/sidekick/Sidekick_core/index.html index 03dc282c..437d6a16 100644 --- a/dev/sidekick/Sidekick_core/index.html +++ b/dev/sidekick/Sidekick_core/index.html @@ -1,2 +1,2 @@ -Sidekick_core (sidekick.Sidekick_core)

Module Sidekick_core

Main Signatures

Theories and concrete solvers rely on an environment that defines several important types:

  • sorts
  • terms (to represent logic expressions and formulas)
  • a congruence closure instance
  • a bridge to some SAT solver

In this module we define most of the main signatures used throughout Sidekick.

module Fmt = CCFormat
module CC_view : sig ... end

View terms through the lens of the Congruence Closure

module type TERM = sig ... end

Main representation of Terms and Types

module type PROOF = sig ... end

Proofs of unsatisfiability

module type LIT = sig ... end

Literals

module type CC_ACTIONS = sig ... end

Actions provided to the congruence closure.

module type CC_ARG = sig ... end

Arguments to a congruence closure's implementation

module type CC_S = sig ... end

Signature of the congruence closure

module type SOLVER_INTERNAL = sig ... end

A view of the solver from a theory's point of view.

module type SOLVER = sig ... end

User facing view of the solver

module type MONOID_ARG = sig ... end

Helper for the congruence closure

module Monoid_of_repr : functor (M : MONOID_ARG) -> sig ... end

State for a per-equivalence-class monoid.

\ No newline at end of file +Sidekick_core (sidekick.Sidekick_core)

Module Sidekick_core

Main Signatures

Theories and concrete solvers rely on an environment that defines several important types:

  • sorts
  • terms (to represent logic expressions and formulas)
  • a congruence closure instance
  • a bridge to some SAT solver

In this module we define most of the main signatures used throughout Sidekick.

module Fmt = CCFormat
module CC_view : sig ... end

View terms through the lens of the Congruence Closure

module type TERM = sig ... end

Main representation of Terms and Types

module type PROOF = sig ... end

Proofs of unsatisfiability

module type LIT = sig ... end

Literals

module type CC_ACTIONS = sig ... end

Actions provided to the congruence closure.

module type CC_ARG = sig ... end

Arguments to a congruence closure's implementation

module type CC_S = sig ... end

Main congruence closure.

module type SOLVER_INTERNAL = sig ... end

A view of the solver from a theory's point of view.

module type SOLVER = sig ... end

User facing view of the solver

module type MONOID_ARG = sig ... end

Helper for the congruence closure

module Monoid_of_repr : functor (M : MONOID_ARG) -> sig ... end

State for a per-equivalence-class monoid.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-CC_S/N/index.html b/dev/sidekick/Sidekick_core/module-type-CC_S/N/index.html index b8007f08..b83281f4 100644 --- a/dev/sidekick/Sidekick_core/module-type-CC_S/N/index.html +++ b/dev/sidekick/Sidekick_core/module-type-CC_S/N/index.html @@ -1,2 +1,2 @@ -N (sidekick.Sidekick_core.CC_S.N)

Module CC_S.N

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

All information pertaining to the whole equivalence class is stored in this representative's node.

When two classes become equal (are "merged"), one of the two representatives is picked as the representative of the new class. The new class contains the union of the two old classes' nodes.

We also allow theories to store additional information in the representative. This information can be used when two classes are merged, to detect conflicts and solve equations à la Shostak.

type t

An equivalent class, containing terms that are proved to be equal.

A value of type t points to a particular term, but see find to get the representative of the class.

val term : t -> term
val equal : t -> t -> bool
val hash : t -> int
val pp : t Fmt.printer
val is_root : t -> bool

Is the node a root (ie the representative of its class)? See find to get the root.

val iter_class : t -> t Iter.t

Traverse the congruence class. Precondition: is_root n (see find below)

val iter_parents : t -> t Iter.t

Traverse the parents of the class. Precondition: is_root n (see find below)

type bitfield

A field in the bitfield of this node. This should only be allocated when a theory is initialized.

All fields are initially 0, are backtracked automatically, and are merged automatically when classes are merged.

val get_field : bitfield -> t -> bool

Access the bit field

\ No newline at end of file +N (sidekick.Sidekick_core.CC_S.N)

Module CC_S.N

Equivalence classes.

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

All information pertaining to the whole equivalence class is stored in this representative's node.

When two classes become equal (are "merged"), one of the two representatives is picked as the representative of the new class. The new class contains the union of the two old classes' nodes.

We also allow theories to store additional information in the representative. This information can be used when two classes are merged, to detect conflicts and solve equations à la Shostak.

type t

An equivalent class, containing terms that are proved to be equal.

A value of type t points to a particular term, but see find to get the representative of the class.

val term : t -> term

Term contained in this equivalence class. If is_root n, then term n is the class' representative term.

val equal : t -> t -> bool

Are two classes physically equal? To check for logical equality, use CC.N.equal (CC.find cc n1) (CC.find cc n2) which checks for equality of representatives.

val hash : t -> int

An opaque hash of this node.

val pp : t Fmt.printer

Unspecified printing of the node, for example its term, a unique ID, etc.

val is_root : t -> bool

Is the node a root (ie the representative of its class)? See find to get the root.

val iter_class : t -> t Iter.t

Traverse the congruence class. Precondition: is_root n (see find below)

val iter_parents : t -> t Iter.t

Traverse the parents of the class. Precondition: is_root n (see find below)

type bitfield

A field in the bitfield of this node. This should only be allocated when a theory is initialized.

Bitfields are accessed using preallocated keys. See CC_S.allocate_bitfield.

All fields are initially 0, are backtracked automatically, and are merged automatically when classes are merged.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-CC_S/index.html b/dev/sidekick/Sidekick_core/module-type-CC_S/index.html index f15bbbfe..dc6e1850 100644 --- a/dev/sidekick/Sidekick_core/module-type-CC_S/index.html +++ b/dev/sidekick/Sidekick_core/module-type-CC_S/index.html @@ -1,2 +1,2 @@ -CC_S (sidekick.Sidekick_core.CC_S)

Module type Sidekick_core.CC_S

Signature of the congruence closure

module T : TERM
module P : PROOF with type term = T.Term.t
module Lit : LIT with module T = T
module Actions : CC_ACTIONS with module T = T and module Lit = Lit and module P = P
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_store : t -> term_store
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_store -> t

Create a new congruence closure.

parameter term_store

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file +CC_S (sidekick.Sidekick_core.CC_S)

Module type Sidekick_core.CC_S

Main congruence closure.

The congruence closure handles the theory QF_UF (uninterpreted function symbols). It is also responsible for theory combination, and provides a general framework for equality reasoning that other theories piggyback on.

For example, the theory of datatypes relies on the congruence closure to do most of the work, and "only" adds injectivity/disjointness/acyclicity lemmas when needed.

Similarly, a theory of arrays would hook into the congruence closure and assert (dis)equalities as needed.

module T : TERM
module P : PROOF with type term = T.Term.t
module Lit : LIT with module T = T
module Actions : CC_ACTIONS with module T = T and module Lit = Lit and module P = P
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

The congruence closure object. It contains a fair amount of state and is mutable and backtrackable.

module N : sig ... end

Equivalence classes.

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_store : t -> term_store
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_store -> t

Create a new congruence closure.

parameter term_store

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new node field (see N.bitfield).

This field descriptor is henceforth reserved for all nodes in this congruence closure, and can be set using set_bitfield for each node individually. This can be used to efficiently store some metadata on nodes (e.g. "is there a numeric value in the class" or "is there a constructor term in the class").

There may be restrictions on how many distinct fields are allocated for a given congruence closure (e.g. at most Sys.int_size fields).

val get_bitfield : t -> N.bitfield -> N.t -> bool

Access the bit field of the given node

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-MONOID_ARG/SI/CC/N/index.html b/dev/sidekick/Sidekick_core/module-type-MONOID_ARG/SI/CC/N/index.html index 1062cb57..653b931b 100644 --- a/dev/sidekick/Sidekick_core/module-type-MONOID_ARG/SI/CC/N/index.html +++ b/dev/sidekick/Sidekick_core/module-type-MONOID_ARG/SI/CC/N/index.html @@ -1,2 +1,2 @@ -N (sidekick.Sidekick_core.MONOID_ARG.SI.CC.N)

Module CC.N

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

All information pertaining to the whole equivalence class is stored in this representative's node.

When two classes become equal (are "merged"), one of the two representatives is picked as the representative of the new class. The new class contains the union of the two old classes' nodes.

We also allow theories to store additional information in the representative. This information can be used when two classes are merged, to detect conflicts and solve equations à la Shostak.

type t

An equivalent class, containing terms that are proved to be equal.

A value of type t points to a particular term, but see find to get the representative of the class.

val term : t -> term
val equal : t -> t -> bool
val hash : t -> int
val pp : t Fmt.printer
val is_root : t -> bool

Is the node a root (ie the representative of its class)? See find to get the root.

val iter_class : t -> t Iter.t

Traverse the congruence class. Precondition: is_root n (see find below)

val iter_parents : t -> t Iter.t

Traverse the parents of the class. Precondition: is_root n (see find below)

type bitfield

A field in the bitfield of this node. This should only be allocated when a theory is initialized.

All fields are initially 0, are backtracked automatically, and are merged automatically when classes are merged.

val get_field : bitfield -> t -> bool

Access the bit field

\ No newline at end of file +N (sidekick.Sidekick_core.MONOID_ARG.SI.CC.N)

Module CC.N

Equivalence classes.

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

All information pertaining to the whole equivalence class is stored in this representative's node.

When two classes become equal (are "merged"), one of the two representatives is picked as the representative of the new class. The new class contains the union of the two old classes' nodes.

We also allow theories to store additional information in the representative. This information can be used when two classes are merged, to detect conflicts and solve equations à la Shostak.

type t

An equivalent class, containing terms that are proved to be equal.

A value of type t points to a particular term, but see find to get the representative of the class.

val term : t -> term

Term contained in this equivalence class. If is_root n, then term n is the class' representative term.

val equal : t -> t -> bool

Are two classes physically equal? To check for logical equality, use CC.N.equal (CC.find cc n1) (CC.find cc n2) which checks for equality of representatives.

val hash : t -> int

An opaque hash of this node.

val pp : t Fmt.printer

Unspecified printing of the node, for example its term, a unique ID, etc.

val is_root : t -> bool

Is the node a root (ie the representative of its class)? See find to get the root.

val iter_class : t -> t Iter.t

Traverse the congruence class. Precondition: is_root n (see find below)

val iter_parents : t -> t Iter.t

Traverse the parents of the class. Precondition: is_root n (see find below)

type bitfield

A field in the bitfield of this node. This should only be allocated when a theory is initialized.

Bitfields are accessed using preallocated keys. See CC_S.allocate_bitfield.

All fields are initially 0, are backtracked automatically, and are merged automatically when classes are merged.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-MONOID_ARG/SI/CC/index.html b/dev/sidekick/Sidekick_core/module-type-MONOID_ARG/SI/CC/index.html index 8400f6aa..1ed4bbae 100644 --- a/dev/sidekick/Sidekick_core/module-type-MONOID_ARG/SI/CC/index.html +++ b/dev/sidekick/Sidekick_core/module-type-MONOID_ARG/SI/CC/index.html @@ -1,2 +1,2 @@ -CC (sidekick.Sidekick_core.MONOID_ARG.SI.CC)

Module SI.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_store : t -> term_store
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_store -> t

Create a new congruence closure.

parameter term_store

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file +CC (sidekick.Sidekick_core.MONOID_ARG.SI.CC)

Module SI.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

The congruence closure object. It contains a fair amount of state and is mutable and backtrackable.

module N : sig ... end

Equivalence classes.

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_store : t -> term_store
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_store -> t

Create a new congruence closure.

parameter term_store

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new node field (see N.bitfield).

This field descriptor is henceforth reserved for all nodes in this congruence closure, and can be set using set_bitfield for each node individually. This can be used to efficiently store some metadata on nodes (e.g. "is there a numeric value in the class" or "is there a constructor term in the class").

There may be restrictions on how many distinct fields are allocated for a given congruence closure (e.g. at most Sys.int_size fields).

val get_bitfield : t -> N.bitfield -> N.t -> bool

Access the bit field of the given node

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-SOLVER/Solver_internal/CC/N/index.html b/dev/sidekick/Sidekick_core/module-type-SOLVER/Solver_internal/CC/N/index.html index 02e94a5f..195534d8 100644 --- a/dev/sidekick/Sidekick_core/module-type-SOLVER/Solver_internal/CC/N/index.html +++ b/dev/sidekick/Sidekick_core/module-type-SOLVER/Solver_internal/CC/N/index.html @@ -1,2 +1,2 @@ -N (sidekick.Sidekick_core.SOLVER.Solver_internal.CC.N)

Module CC.N

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

All information pertaining to the whole equivalence class is stored in this representative's node.

When two classes become equal (are "merged"), one of the two representatives is picked as the representative of the new class. The new class contains the union of the two old classes' nodes.

We also allow theories to store additional information in the representative. This information can be used when two classes are merged, to detect conflicts and solve equations à la Shostak.

type t

An equivalent class, containing terms that are proved to be equal.

A value of type t points to a particular term, but see find to get the representative of the class.

val term : t -> term
val equal : t -> t -> bool
val hash : t -> int
val pp : t Fmt.printer
val is_root : t -> bool

Is the node a root (ie the representative of its class)? See find to get the root.

val iter_class : t -> t Iter.t

Traverse the congruence class. Precondition: is_root n (see find below)

val iter_parents : t -> t Iter.t

Traverse the parents of the class. Precondition: is_root n (see find below)

type bitfield

A field in the bitfield of this node. This should only be allocated when a theory is initialized.

All fields are initially 0, are backtracked automatically, and are merged automatically when classes are merged.

val get_field : bitfield -> t -> bool

Access the bit field

\ No newline at end of file +N (sidekick.Sidekick_core.SOLVER.Solver_internal.CC.N)

Module CC.N

Equivalence classes.

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

All information pertaining to the whole equivalence class is stored in this representative's node.

When two classes become equal (are "merged"), one of the two representatives is picked as the representative of the new class. The new class contains the union of the two old classes' nodes.

We also allow theories to store additional information in the representative. This information can be used when two classes are merged, to detect conflicts and solve equations à la Shostak.

type t

An equivalent class, containing terms that are proved to be equal.

A value of type t points to a particular term, but see find to get the representative of the class.

val term : t -> term

Term contained in this equivalence class. If is_root n, then term n is the class' representative term.

val equal : t -> t -> bool

Are two classes physically equal? To check for logical equality, use CC.N.equal (CC.find cc n1) (CC.find cc n2) which checks for equality of representatives.

val hash : t -> int

An opaque hash of this node.

val pp : t Fmt.printer

Unspecified printing of the node, for example its term, a unique ID, etc.

val is_root : t -> bool

Is the node a root (ie the representative of its class)? See find to get the root.

val iter_class : t -> t Iter.t

Traverse the congruence class. Precondition: is_root n (see find below)

val iter_parents : t -> t Iter.t

Traverse the parents of the class. Precondition: is_root n (see find below)

type bitfield

A field in the bitfield of this node. This should only be allocated when a theory is initialized.

Bitfields are accessed using preallocated keys. See CC_S.allocate_bitfield.

All fields are initially 0, are backtracked automatically, and are merged automatically when classes are merged.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-SOLVER/Solver_internal/CC/index.html b/dev/sidekick/Sidekick_core/module-type-SOLVER/Solver_internal/CC/index.html index fbe2ea3c..5f5ff8fb 100644 --- a/dev/sidekick/Sidekick_core/module-type-SOLVER/Solver_internal/CC/index.html +++ b/dev/sidekick/Sidekick_core/module-type-SOLVER/Solver_internal/CC/index.html @@ -1,2 +1,2 @@ -CC (sidekick.Sidekick_core.SOLVER.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_store : t -> term_store
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_store -> t

Create a new congruence closure.

parameter term_store

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file +CC (sidekick.Sidekick_core.SOLVER.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

The congruence closure object. It contains a fair amount of state and is mutable and backtrackable.

module N : sig ... end

Equivalence classes.

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_store : t -> term_store
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_store -> t

Create a new congruence closure.

parameter term_store

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new node field (see N.bitfield).

This field descriptor is henceforth reserved for all nodes in this congruence closure, and can be set using set_bitfield for each node individually. This can be used to efficiently store some metadata on nodes (e.g. "is there a numeric value in the class" or "is there a constructor term in the class").

There may be restrictions on how many distinct fields are allocated for a given congruence closure (e.g. at most Sys.int_size fields).

val get_bitfield : t -> N.bitfield -> N.t -> bool

Access the bit field of the given node

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-SOLVER_INTERNAL/CC/N/index.html b/dev/sidekick/Sidekick_core/module-type-SOLVER_INTERNAL/CC/N/index.html index b95daa94..105a3fa2 100644 --- a/dev/sidekick/Sidekick_core/module-type-SOLVER_INTERNAL/CC/N/index.html +++ b/dev/sidekick/Sidekick_core/module-type-SOLVER_INTERNAL/CC/N/index.html @@ -1,2 +1,2 @@ -N (sidekick.Sidekick_core.SOLVER_INTERNAL.CC.N)

Module CC.N

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

All information pertaining to the whole equivalence class is stored in this representative's node.

When two classes become equal (are "merged"), one of the two representatives is picked as the representative of the new class. The new class contains the union of the two old classes' nodes.

We also allow theories to store additional information in the representative. This information can be used when two classes are merged, to detect conflicts and solve equations à la Shostak.

type t

An equivalent class, containing terms that are proved to be equal.

A value of type t points to a particular term, but see find to get the representative of the class.

val term : t -> term
val equal : t -> t -> bool
val hash : t -> int
val pp : t Fmt.printer
val is_root : t -> bool

Is the node a root (ie the representative of its class)? See find to get the root.

val iter_class : t -> t Iter.t

Traverse the congruence class. Precondition: is_root n (see find below)

val iter_parents : t -> t Iter.t

Traverse the parents of the class. Precondition: is_root n (see find below)

type bitfield

A field in the bitfield of this node. This should only be allocated when a theory is initialized.

All fields are initially 0, are backtracked automatically, and are merged automatically when classes are merged.

val get_field : bitfield -> t -> bool

Access the bit field

\ No newline at end of file +N (sidekick.Sidekick_core.SOLVER_INTERNAL.CC.N)

Module CC.N

Equivalence classes.

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

All information pertaining to the whole equivalence class is stored in this representative's node.

When two classes become equal (are "merged"), one of the two representatives is picked as the representative of the new class. The new class contains the union of the two old classes' nodes.

We also allow theories to store additional information in the representative. This information can be used when two classes are merged, to detect conflicts and solve equations à la Shostak.

type t

An equivalent class, containing terms that are proved to be equal.

A value of type t points to a particular term, but see find to get the representative of the class.

val term : t -> term

Term contained in this equivalence class. If is_root n, then term n is the class' representative term.

val equal : t -> t -> bool

Are two classes physically equal? To check for logical equality, use CC.N.equal (CC.find cc n1) (CC.find cc n2) which checks for equality of representatives.

val hash : t -> int

An opaque hash of this node.

val pp : t Fmt.printer

Unspecified printing of the node, for example its term, a unique ID, etc.

val is_root : t -> bool

Is the node a root (ie the representative of its class)? See find to get the root.

val iter_class : t -> t Iter.t

Traverse the congruence class. Precondition: is_root n (see find below)

val iter_parents : t -> t Iter.t

Traverse the parents of the class. Precondition: is_root n (see find below)

type bitfield

A field in the bitfield of this node. This should only be allocated when a theory is initialized.

Bitfields are accessed using preallocated keys. See CC_S.allocate_bitfield.

All fields are initially 0, are backtracked automatically, and are merged automatically when classes are merged.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-SOLVER_INTERNAL/CC/index.html b/dev/sidekick/Sidekick_core/module-type-SOLVER_INTERNAL/CC/index.html index d4c43f44..de57f3b3 100644 --- a/dev/sidekick/Sidekick_core/module-type-SOLVER_INTERNAL/CC/index.html +++ b/dev/sidekick/Sidekick_core/module-type-SOLVER_INTERNAL/CC/index.html @@ -1,2 +1,2 @@ -CC (sidekick.Sidekick_core.SOLVER_INTERNAL.CC)

Module SOLVER_INTERNAL.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_store : t -> term_store
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_store -> t

Create a new congruence closure.

parameter term_store

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file +CC (sidekick.Sidekick_core.SOLVER_INTERNAL.CC)

Module SOLVER_INTERNAL.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

The congruence closure object. It contains a fair amount of state and is mutable and backtrackable.

module N : sig ... end

Equivalence classes.

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_store : t -> term_store
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_store -> t

Create a new congruence closure.

parameter term_store

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new node field (see N.bitfield).

This field descriptor is henceforth reserved for all nodes in this congruence closure, and can be set using set_bitfield for each node individually. This can be used to efficiently store some metadata on nodes (e.g. "is there a numeric value in the class" or "is there a constructor term in the class").

There may be restrictions on how many distinct fields are allocated for a given congruence closure (e.g. at most Sys.int_size fields).

val get_bitfield : t -> N.bitfield -> N.t -> bool

Access the bit field of the given node

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_msat_solver/Make/Solver_internal/CC/N/index.html b/dev/sidekick/Sidekick_msat_solver/Make/Solver_internal/CC/N/index.html index b76f7a95..6c3fd7d9 100644 --- a/dev/sidekick/Sidekick_msat_solver/Make/Solver_internal/CC/N/index.html +++ b/dev/sidekick/Sidekick_msat_solver/Make/Solver_internal/CC/N/index.html @@ -1,2 +1,2 @@ -N (sidekick.Sidekick_msat_solver.Make.Solver_internal.CC.N)

Module CC.N

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

All information pertaining to the whole equivalence class is stored in this representative's node.

When two classes become equal (are "merged"), one of the two representatives is picked as the representative of the new class. The new class contains the union of the two old classes' nodes.

We also allow theories to store additional information in the representative. This information can be used when two classes are merged, to detect conflicts and solve equations à la Shostak.

type t

An equivalent class, containing terms that are proved to be equal.

A value of type t points to a particular term, but see find to get the representative of the class.

val term : t -> term
val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
val is_root : t -> bool

Is the node a root (ie the representative of its class)? See find to get the root.

val iter_class : t -> t Iter.t

Traverse the congruence class. Precondition: is_root n (see find below)

val iter_parents : t -> t Iter.t

Traverse the parents of the class. Precondition: is_root n (see find below)

type bitfield

A field in the bitfield of this node. This should only be allocated when a theory is initialized.

All fields are initially 0, are backtracked automatically, and are merged automatically when classes are merged.

val get_field : bitfield -> t -> bool

Access the bit field

\ No newline at end of file +N (sidekick.Sidekick_msat_solver.Make.Solver_internal.CC.N)

Module CC.N

Equivalence classes.

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

All information pertaining to the whole equivalence class is stored in this representative's node.

When two classes become equal (are "merged"), one of the two representatives is picked as the representative of the new class. The new class contains the union of the two old classes' nodes.

We also allow theories to store additional information in the representative. This information can be used when two classes are merged, to detect conflicts and solve equations à la Shostak.

type t

An equivalent class, containing terms that are proved to be equal.

A value of type t points to a particular term, but see find to get the representative of the class.

val term : t -> term

Term contained in this equivalence class. If is_root n, then term n is the class' representative term.

val equal : t -> t -> bool

Are two classes physically equal? To check for logical equality, use CC.N.equal (CC.find cc n1) (CC.find cc n2) which checks for equality of representatives.

val hash : t -> int

An opaque hash of this node.

val pp : t Sidekick_core.Fmt.printer

Unspecified printing of the node, for example its term, a unique ID, etc.

val is_root : t -> bool

Is the node a root (ie the representative of its class)? See find to get the root.

val iter_class : t -> t Iter.t

Traverse the congruence class. Precondition: is_root n (see find below)

val iter_parents : t -> t Iter.t

Traverse the parents of the class. Precondition: is_root n (see find below)

type bitfield

A field in the bitfield of this node. This should only be allocated when a theory is initialized.

Bitfields are accessed using preallocated keys. See Sidekick_core.CC_S.allocate_bitfield.

All fields are initially 0, are backtracked automatically, and are merged automatically when classes are merged.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_msat_solver/Make/Solver_internal/CC/index.html b/dev/sidekick/Sidekick_msat_solver/Make/Solver_internal/CC/index.html index d779990e..d25407df 100644 --- a/dev/sidekick/Sidekick_msat_solver/Make/Solver_internal/CC/index.html +++ b/dev/sidekick/Sidekick_msat_solver/Make/Solver_internal/CC/index.html @@ -1,2 +1,2 @@ -CC (sidekick.Sidekick_msat_solver.Make.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_store : t -> term_store
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_store -> t

Create a new congruence closure.

parameter term_store

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file +CC (sidekick.Sidekick_msat_solver.Make.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

The congruence closure object. It contains a fair amount of state and is mutable and backtrackable.

module N : sig ... end

Equivalence classes.

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_store : t -> term_store
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_store -> t

Create a new congruence closure.

parameter term_store

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new node field (see N.bitfield).

This field descriptor is henceforth reserved for all nodes in this congruence closure, and can be set using set_bitfield for each node individually. This can be used to efficiently store some metadata on nodes (e.g. "is there a numeric value in the class" or "is there a constructor term in the class").

There may be restrictions on how many distinct fields are allocated for a given congruence closure (e.g. at most Sys.int_size fields).

val get_bitfield : t -> N.bitfield -> N.t -> bool

Access the bit field of the given node

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_msat_solver/module-type-S/Solver_internal/CC/N/index.html b/dev/sidekick/Sidekick_msat_solver/module-type-S/Solver_internal/CC/N/index.html index 46e3e606..dd3cd1c6 100644 --- a/dev/sidekick/Sidekick_msat_solver/module-type-S/Solver_internal/CC/N/index.html +++ b/dev/sidekick/Sidekick_msat_solver/module-type-S/Solver_internal/CC/N/index.html @@ -1,2 +1,2 @@ -N (sidekick.Sidekick_msat_solver.S.Solver_internal.CC.N)

Module CC.N

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

All information pertaining to the whole equivalence class is stored in this representative's node.

When two classes become equal (are "merged"), one of the two representatives is picked as the representative of the new class. The new class contains the union of the two old classes' nodes.

We also allow theories to store additional information in the representative. This information can be used when two classes are merged, to detect conflicts and solve equations à la Shostak.

type t

An equivalent class, containing terms that are proved to be equal.

A value of type t points to a particular term, but see find to get the representative of the class.

val term : t -> term
val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
val is_root : t -> bool

Is the node a root (ie the representative of its class)? See find to get the root.

val iter_class : t -> t Iter.t

Traverse the congruence class. Precondition: is_root n (see find below)

val iter_parents : t -> t Iter.t

Traverse the parents of the class. Precondition: is_root n (see find below)

type bitfield

A field in the bitfield of this node. This should only be allocated when a theory is initialized.

All fields are initially 0, are backtracked automatically, and are merged automatically when classes are merged.

val get_field : bitfield -> t -> bool

Access the bit field

\ No newline at end of file +N (sidekick.Sidekick_msat_solver.S.Solver_internal.CC.N)

Module CC.N

Equivalence classes.

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

All information pertaining to the whole equivalence class is stored in this representative's node.

When two classes become equal (are "merged"), one of the two representatives is picked as the representative of the new class. The new class contains the union of the two old classes' nodes.

We also allow theories to store additional information in the representative. This information can be used when two classes are merged, to detect conflicts and solve equations à la Shostak.

type t

An equivalent class, containing terms that are proved to be equal.

A value of type t points to a particular term, but see find to get the representative of the class.

val term : t -> term

Term contained in this equivalence class. If is_root n, then term n is the class' representative term.

val equal : t -> t -> bool

Are two classes physically equal? To check for logical equality, use CC.N.equal (CC.find cc n1) (CC.find cc n2) which checks for equality of representatives.

val hash : t -> int

An opaque hash of this node.

val pp : t Sidekick_core.Fmt.printer

Unspecified printing of the node, for example its term, a unique ID, etc.

val is_root : t -> bool

Is the node a root (ie the representative of its class)? See find to get the root.

val iter_class : t -> t Iter.t

Traverse the congruence class. Precondition: is_root n (see find below)

val iter_parents : t -> t Iter.t

Traverse the parents of the class. Precondition: is_root n (see find below)

type bitfield

A field in the bitfield of this node. This should only be allocated when a theory is initialized.

Bitfields are accessed using preallocated keys. See Sidekick_core.CC_S.allocate_bitfield.

All fields are initially 0, are backtracked automatically, and are merged automatically when classes are merged.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_msat_solver/module-type-S/Solver_internal/CC/index.html b/dev/sidekick/Sidekick_msat_solver/module-type-S/Solver_internal/CC/index.html index 3e7939ad..0658872a 100644 --- a/dev/sidekick/Sidekick_msat_solver/module-type-S/Solver_internal/CC/index.html +++ b/dev/sidekick/Sidekick_msat_solver/module-type-S/Solver_internal/CC/index.html @@ -1,2 +1,2 @@ -CC (sidekick.Sidekick_msat_solver.S.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_store : t -> term_store
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_store -> t

Create a new congruence closure.

parameter term_store

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file +CC (sidekick.Sidekick_msat_solver.S.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

The congruence closure object. It contains a fair amount of state and is mutable and backtrackable.

module N : sig ... end

Equivalence classes.

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_store : t -> term_store
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_store -> t

Create a new congruence closure.

parameter term_store

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new node field (see N.bitfield).

This field descriptor is henceforth reserved for all nodes in this congruence closure, and can be set using set_bitfield for each node individually. This can be used to efficiently store some metadata on nodes (e.g. "is there a numeric value in the class" or "is there a constructor term in the class").

There may be restrictions on how many distinct fields are allocated for a given congruence closure (e.g. at most Sys.int_size fields).

val get_bitfield : t -> N.bitfield -> N.t -> bool

Access the bit field of the given node

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/Solver_internal/CC/N/index.html b/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/Solver_internal/CC/N/index.html index 92329a5a..fa3d4e00 100644 --- a/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/Solver_internal/CC/N/index.html +++ b/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/Solver_internal/CC/N/index.html @@ -1,2 +1,2 @@ -N (sidekick.Sidekick_th_bool_static.Make.1-A.S.Solver_internal.CC.N)

Module CC.N

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

All information pertaining to the whole equivalence class is stored in this representative's node.

When two classes become equal (are "merged"), one of the two representatives is picked as the representative of the new class. The new class contains the union of the two old classes' nodes.

We also allow theories to store additional information in the representative. This information can be used when two classes are merged, to detect conflicts and solve equations à la Shostak.

type t

An equivalent class, containing terms that are proved to be equal.

A value of type t points to a particular term, but see find to get the representative of the class.

val term : t -> term
val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
val is_root : t -> bool

Is the node a root (ie the representative of its class)? See find to get the root.

val iter_class : t -> t Iter.t

Traverse the congruence class. Precondition: is_root n (see find below)

val iter_parents : t -> t Iter.t

Traverse the parents of the class. Precondition: is_root n (see find below)

type bitfield

A field in the bitfield of this node. This should only be allocated when a theory is initialized.

All fields are initially 0, are backtracked automatically, and are merged automatically when classes are merged.

val get_field : bitfield -> t -> bool

Access the bit field

\ No newline at end of file +N (sidekick.Sidekick_th_bool_static.Make.1-A.S.Solver_internal.CC.N)

Module CC.N

Equivalence classes.

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

All information pertaining to the whole equivalence class is stored in this representative's node.

When two classes become equal (are "merged"), one of the two representatives is picked as the representative of the new class. The new class contains the union of the two old classes' nodes.

We also allow theories to store additional information in the representative. This information can be used when two classes are merged, to detect conflicts and solve equations à la Shostak.

type t

An equivalent class, containing terms that are proved to be equal.

A value of type t points to a particular term, but see find to get the representative of the class.

val term : t -> term

Term contained in this equivalence class. If is_root n, then term n is the class' representative term.

val equal : t -> t -> bool

Are two classes physically equal? To check for logical equality, use CC.N.equal (CC.find cc n1) (CC.find cc n2) which checks for equality of representatives.

val hash : t -> int

An opaque hash of this node.

val pp : t Sidekick_core.Fmt.printer

Unspecified printing of the node, for example its term, a unique ID, etc.

val is_root : t -> bool

Is the node a root (ie the representative of its class)? See find to get the root.

val iter_class : t -> t Iter.t

Traverse the congruence class. Precondition: is_root n (see find below)

val iter_parents : t -> t Iter.t

Traverse the parents of the class. Precondition: is_root n (see find below)

type bitfield

A field in the bitfield of this node. This should only be allocated when a theory is initialized.

Bitfields are accessed using preallocated keys. See Sidekick_core.CC_S.allocate_bitfield.

All fields are initially 0, are backtracked automatically, and are merged automatically when classes are merged.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/Solver_internal/CC/index.html b/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/Solver_internal/CC/index.html index 74e8346e..9bb98651 100644 --- a/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/Solver_internal/CC/index.html +++ b/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/Solver_internal/CC/index.html @@ -1,2 +1,2 @@ -CC (sidekick.Sidekick_th_bool_static.Make.1-A.S.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_store : t -> term_store
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_store -> t

Create a new congruence closure.

parameter term_store

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file +CC (sidekick.Sidekick_th_bool_static.Make.1-A.S.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

The congruence closure object. It contains a fair amount of state and is mutable and backtrackable.

module N : sig ... end

Equivalence classes.

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_store : t -> term_store
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_store -> t

Create a new congruence closure.

parameter term_store

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new node field (see N.bitfield).

This field descriptor is henceforth reserved for all nodes in this congruence closure, and can be set using set_bitfield for each node individually. This can be used to efficiently store some metadata on nodes (e.g. "is there a numeric value in the class" or "is there a constructor term in the class").

There may be restrictions on how many distinct fields are allocated for a given congruence closure (e.g. at most Sys.int_size fields).

val get_bitfield : t -> N.bitfield -> N.t -> bool

Access the bit field of the given node

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/Solver_internal/CC/N/index.html b/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/Solver_internal/CC/N/index.html index e3e58347..9ddd4aaf 100644 --- a/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/Solver_internal/CC/N/index.html +++ b/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/Solver_internal/CC/N/index.html @@ -1,2 +1,2 @@ -N (sidekick.Sidekick_th_bool_static.ARG.S.Solver_internal.CC.N)

Module CC.N

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

All information pertaining to the whole equivalence class is stored in this representative's node.

When two classes become equal (are "merged"), one of the two representatives is picked as the representative of the new class. The new class contains the union of the two old classes' nodes.

We also allow theories to store additional information in the representative. This information can be used when two classes are merged, to detect conflicts and solve equations à la Shostak.

type t

An equivalent class, containing terms that are proved to be equal.

A value of type t points to a particular term, but see find to get the representative of the class.

val term : t -> term
val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
val is_root : t -> bool

Is the node a root (ie the representative of its class)? See find to get the root.

val iter_class : t -> t Iter.t

Traverse the congruence class. Precondition: is_root n (see find below)

val iter_parents : t -> t Iter.t

Traverse the parents of the class. Precondition: is_root n (see find below)

type bitfield

A field in the bitfield of this node. This should only be allocated when a theory is initialized.

All fields are initially 0, are backtracked automatically, and are merged automatically when classes are merged.

val get_field : bitfield -> t -> bool

Access the bit field

\ No newline at end of file +N (sidekick.Sidekick_th_bool_static.ARG.S.Solver_internal.CC.N)

Module CC.N

Equivalence classes.

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

All information pertaining to the whole equivalence class is stored in this representative's node.

When two classes become equal (are "merged"), one of the two representatives is picked as the representative of the new class. The new class contains the union of the two old classes' nodes.

We also allow theories to store additional information in the representative. This information can be used when two classes are merged, to detect conflicts and solve equations à la Shostak.

type t

An equivalent class, containing terms that are proved to be equal.

A value of type t points to a particular term, but see find to get the representative of the class.

val term : t -> term

Term contained in this equivalence class. If is_root n, then term n is the class' representative term.

val equal : t -> t -> bool

Are two classes physically equal? To check for logical equality, use CC.N.equal (CC.find cc n1) (CC.find cc n2) which checks for equality of representatives.

val hash : t -> int

An opaque hash of this node.

val pp : t Sidekick_core.Fmt.printer

Unspecified printing of the node, for example its term, a unique ID, etc.

val is_root : t -> bool

Is the node a root (ie the representative of its class)? See find to get the root.

val iter_class : t -> t Iter.t

Traverse the congruence class. Precondition: is_root n (see find below)

val iter_parents : t -> t Iter.t

Traverse the parents of the class. Precondition: is_root n (see find below)

type bitfield

A field in the bitfield of this node. This should only be allocated when a theory is initialized.

Bitfields are accessed using preallocated keys. See Sidekick_core.CC_S.allocate_bitfield.

All fields are initially 0, are backtracked automatically, and are merged automatically when classes are merged.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/Solver_internal/CC/index.html b/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/Solver_internal/CC/index.html index 8fb07d44..5b15d3ac 100644 --- a/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/Solver_internal/CC/index.html +++ b/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/Solver_internal/CC/index.html @@ -1,2 +1,2 @@ -CC (sidekick.Sidekick_th_bool_static.ARG.S.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_store : t -> term_store
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_store -> t

Create a new congruence closure.

parameter term_store

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file +CC (sidekick.Sidekick_th_bool_static.ARG.S.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

The congruence closure object. It contains a fair amount of state and is mutable and backtrackable.

module N : sig ... end

Equivalence classes.

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_store : t -> term_store
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_store -> t

Create a new congruence closure.

parameter term_store

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new node field (see N.bitfield).

This field descriptor is henceforth reserved for all nodes in this congruence closure, and can be set using set_bitfield for each node individually. This can be used to efficiently store some metadata on nodes (e.g. "is there a numeric value in the class" or "is there a constructor term in the class").

There may be restrictions on how many distinct fields are allocated for a given congruence closure (e.g. at most Sys.int_size fields).

val get_bitfield : t -> N.bitfield -> N.t -> bool

Access the bit field of the given node

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/Solver_internal/CC/N/index.html b/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/Solver_internal/CC/N/index.html index 953d41b7..4d37b439 100644 --- a/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/Solver_internal/CC/N/index.html +++ b/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/Solver_internal/CC/N/index.html @@ -1,2 +1,2 @@ -N (sidekick.Sidekick_th_bool_static.S.A.S.Solver_internal.CC.N)

Module CC.N

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

All information pertaining to the whole equivalence class is stored in this representative's node.

When two classes become equal (are "merged"), one of the two representatives is picked as the representative of the new class. The new class contains the union of the two old classes' nodes.

We also allow theories to store additional information in the representative. This information can be used when two classes are merged, to detect conflicts and solve equations à la Shostak.

type t

An equivalent class, containing terms that are proved to be equal.

A value of type t points to a particular term, but see find to get the representative of the class.

val term : t -> term
val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
val is_root : t -> bool

Is the node a root (ie the representative of its class)? See find to get the root.

val iter_class : t -> t Iter.t

Traverse the congruence class. Precondition: is_root n (see find below)

val iter_parents : t -> t Iter.t

Traverse the parents of the class. Precondition: is_root n (see find below)

type bitfield

A field in the bitfield of this node. This should only be allocated when a theory is initialized.

All fields are initially 0, are backtracked automatically, and are merged automatically when classes are merged.

val get_field : bitfield -> t -> bool

Access the bit field

\ No newline at end of file +N (sidekick.Sidekick_th_bool_static.S.A.S.Solver_internal.CC.N)

Module CC.N

Equivalence classes.

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

All information pertaining to the whole equivalence class is stored in this representative's node.

When two classes become equal (are "merged"), one of the two representatives is picked as the representative of the new class. The new class contains the union of the two old classes' nodes.

We also allow theories to store additional information in the representative. This information can be used when two classes are merged, to detect conflicts and solve equations à la Shostak.

type t

An equivalent class, containing terms that are proved to be equal.

A value of type t points to a particular term, but see find to get the representative of the class.

val term : t -> term

Term contained in this equivalence class. If is_root n, then term n is the class' representative term.

val equal : t -> t -> bool

Are two classes physically equal? To check for logical equality, use CC.N.equal (CC.find cc n1) (CC.find cc n2) which checks for equality of representatives.

val hash : t -> int

An opaque hash of this node.

val pp : t Sidekick_core.Fmt.printer

Unspecified printing of the node, for example its term, a unique ID, etc.

val is_root : t -> bool

Is the node a root (ie the representative of its class)? See find to get the root.

val iter_class : t -> t Iter.t

Traverse the congruence class. Precondition: is_root n (see find below)

val iter_parents : t -> t Iter.t

Traverse the parents of the class. Precondition: is_root n (see find below)

type bitfield

A field in the bitfield of this node. This should only be allocated when a theory is initialized.

Bitfields are accessed using preallocated keys. See Sidekick_core.CC_S.allocate_bitfield.

All fields are initially 0, are backtracked automatically, and are merged automatically when classes are merged.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/Solver_internal/CC/index.html b/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/Solver_internal/CC/index.html index 8cd877f6..6ea0eb16 100644 --- a/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/Solver_internal/CC/index.html +++ b/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/Solver_internal/CC/index.html @@ -1,2 +1,2 @@ -CC (sidekick.Sidekick_th_bool_static.S.A.S.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_store : t -> term_store
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_store -> t

Create a new congruence closure.

parameter term_store

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file +CC (sidekick.Sidekick_th_bool_static.S.A.S.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

The congruence closure object. It contains a fair amount of state and is mutable and backtrackable.

module N : sig ... end

Equivalence classes.

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_store : t -> term_store
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_store -> t

Create a new congruence closure.

parameter term_store

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new node field (see N.bitfield).

This field descriptor is henceforth reserved for all nodes in this congruence closure, and can be set using set_bitfield for each node individually. This can be used to efficiently store some metadata on nodes (e.g. "is there a numeric value in the class" or "is there a constructor term in the class").

There may be restrictions on how many distinct fields are allocated for a given congruence closure (e.g. at most Sys.int_size fields).

val get_bitfield : t -> N.bitfield -> N.t -> bool

Access the bit field of the given node

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/Solver_internal/CC/N/index.html b/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/Solver_internal/CC/N/index.html index 4d94d054..c13e947a 100644 --- a/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/Solver_internal/CC/N/index.html +++ b/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/Solver_internal/CC/N/index.html @@ -1,2 +1,2 @@ -N (sidekick.Sidekick_th_cstor.Make.1-A.S.Solver_internal.CC.N)

Module CC.N

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

All information pertaining to the whole equivalence class is stored in this representative's node.

When two classes become equal (are "merged"), one of the two representatives is picked as the representative of the new class. The new class contains the union of the two old classes' nodes.

We also allow theories to store additional information in the representative. This information can be used when two classes are merged, to detect conflicts and solve equations à la Shostak.

type t

An equivalent class, containing terms that are proved to be equal.

A value of type t points to a particular term, but see find to get the representative of the class.

val term : t -> term
val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
val is_root : t -> bool

Is the node a root (ie the representative of its class)? See find to get the root.

val iter_class : t -> t Iter.t

Traverse the congruence class. Precondition: is_root n (see find below)

val iter_parents : t -> t Iter.t

Traverse the parents of the class. Precondition: is_root n (see find below)

type bitfield

A field in the bitfield of this node. This should only be allocated when a theory is initialized.

All fields are initially 0, are backtracked automatically, and are merged automatically when classes are merged.

val get_field : bitfield -> t -> bool

Access the bit field

\ No newline at end of file +N (sidekick.Sidekick_th_cstor.Make.1-A.S.Solver_internal.CC.N)

Module CC.N

Equivalence classes.

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

All information pertaining to the whole equivalence class is stored in this representative's node.

When two classes become equal (are "merged"), one of the two representatives is picked as the representative of the new class. The new class contains the union of the two old classes' nodes.

We also allow theories to store additional information in the representative. This information can be used when two classes are merged, to detect conflicts and solve equations à la Shostak.

type t

An equivalent class, containing terms that are proved to be equal.

A value of type t points to a particular term, but see find to get the representative of the class.

val term : t -> term

Term contained in this equivalence class. If is_root n, then term n is the class' representative term.

val equal : t -> t -> bool

Are two classes physically equal? To check for logical equality, use CC.N.equal (CC.find cc n1) (CC.find cc n2) which checks for equality of representatives.

val hash : t -> int

An opaque hash of this node.

val pp : t Sidekick_core.Fmt.printer

Unspecified printing of the node, for example its term, a unique ID, etc.

val is_root : t -> bool

Is the node a root (ie the representative of its class)? See find to get the root.

val iter_class : t -> t Iter.t

Traverse the congruence class. Precondition: is_root n (see find below)

val iter_parents : t -> t Iter.t

Traverse the parents of the class. Precondition: is_root n (see find below)

type bitfield

A field in the bitfield of this node. This should only be allocated when a theory is initialized.

Bitfields are accessed using preallocated keys. See Sidekick_core.CC_S.allocate_bitfield.

All fields are initially 0, are backtracked automatically, and are merged automatically when classes are merged.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/Solver_internal/CC/index.html b/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/Solver_internal/CC/index.html index 3bbf3667..53dbfdef 100644 --- a/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/Solver_internal/CC/index.html +++ b/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/Solver_internal/CC/index.html @@ -1,2 +1,2 @@ -CC (sidekick.Sidekick_th_cstor.Make.1-A.S.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_store : t -> term_store
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_store -> t

Create a new congruence closure.

parameter term_store

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file +CC (sidekick.Sidekick_th_cstor.Make.1-A.S.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

The congruence closure object. It contains a fair amount of state and is mutable and backtrackable.

module N : sig ... end

Equivalence classes.

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_store : t -> term_store
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_store -> t

Create a new congruence closure.

parameter term_store

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new node field (see N.bitfield).

This field descriptor is henceforth reserved for all nodes in this congruence closure, and can be set using set_bitfield for each node individually. This can be used to efficiently store some metadata on nodes (e.g. "is there a numeric value in the class" or "is there a constructor term in the class").

There may be restrictions on how many distinct fields are allocated for a given congruence closure (e.g. at most Sys.int_size fields).

val get_bitfield : t -> N.bitfield -> N.t -> bool

Access the bit field of the given node

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/Solver_internal/CC/N/index.html b/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/Solver_internal/CC/N/index.html index 373654ab..d5b3ae77 100644 --- a/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/Solver_internal/CC/N/index.html +++ b/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/Solver_internal/CC/N/index.html @@ -1,2 +1,2 @@ -N (sidekick.Sidekick_th_cstor.ARG.S.Solver_internal.CC.N)

Module CC.N

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

All information pertaining to the whole equivalence class is stored in this representative's node.

When two classes become equal (are "merged"), one of the two representatives is picked as the representative of the new class. The new class contains the union of the two old classes' nodes.

We also allow theories to store additional information in the representative. This information can be used when two classes are merged, to detect conflicts and solve equations à la Shostak.

type t

An equivalent class, containing terms that are proved to be equal.

A value of type t points to a particular term, but see find to get the representative of the class.

val term : t -> term
val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
val is_root : t -> bool

Is the node a root (ie the representative of its class)? See find to get the root.

val iter_class : t -> t Iter.t

Traverse the congruence class. Precondition: is_root n (see find below)

val iter_parents : t -> t Iter.t

Traverse the parents of the class. Precondition: is_root n (see find below)

type bitfield

A field in the bitfield of this node. This should only be allocated when a theory is initialized.

All fields are initially 0, are backtracked automatically, and are merged automatically when classes are merged.

val get_field : bitfield -> t -> bool

Access the bit field

\ No newline at end of file +N (sidekick.Sidekick_th_cstor.ARG.S.Solver_internal.CC.N)

Module CC.N

Equivalence classes.

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

All information pertaining to the whole equivalence class is stored in this representative's node.

When two classes become equal (are "merged"), one of the two representatives is picked as the representative of the new class. The new class contains the union of the two old classes' nodes.

We also allow theories to store additional information in the representative. This information can be used when two classes are merged, to detect conflicts and solve equations à la Shostak.

type t

An equivalent class, containing terms that are proved to be equal.

A value of type t points to a particular term, but see find to get the representative of the class.

val term : t -> term

Term contained in this equivalence class. If is_root n, then term n is the class' representative term.

val equal : t -> t -> bool

Are two classes physically equal? To check for logical equality, use CC.N.equal (CC.find cc n1) (CC.find cc n2) which checks for equality of representatives.

val hash : t -> int

An opaque hash of this node.

val pp : t Sidekick_core.Fmt.printer

Unspecified printing of the node, for example its term, a unique ID, etc.

val is_root : t -> bool

Is the node a root (ie the representative of its class)? See find to get the root.

val iter_class : t -> t Iter.t

Traverse the congruence class. Precondition: is_root n (see find below)

val iter_parents : t -> t Iter.t

Traverse the parents of the class. Precondition: is_root n (see find below)

type bitfield

A field in the bitfield of this node. This should only be allocated when a theory is initialized.

Bitfields are accessed using preallocated keys. See Sidekick_core.CC_S.allocate_bitfield.

All fields are initially 0, are backtracked automatically, and are merged automatically when classes are merged.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/Solver_internal/CC/index.html b/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/Solver_internal/CC/index.html index 4c7c7ff2..54c1a825 100644 --- a/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/Solver_internal/CC/index.html +++ b/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/Solver_internal/CC/index.html @@ -1,2 +1,2 @@ -CC (sidekick.Sidekick_th_cstor.ARG.S.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_store : t -> term_store
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_store -> t

Create a new congruence closure.

parameter term_store

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file +CC (sidekick.Sidekick_th_cstor.ARG.S.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

The congruence closure object. It contains a fair amount of state and is mutable and backtrackable.

module N : sig ... end

Equivalence classes.

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_store : t -> term_store
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_store -> t

Create a new congruence closure.

parameter term_store

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new node field (see N.bitfield).

This field descriptor is henceforth reserved for all nodes in this congruence closure, and can be set using set_bitfield for each node individually. This can be used to efficiently store some metadata on nodes (e.g. "is there a numeric value in the class" or "is there a constructor term in the class").

There may be restrictions on how many distinct fields are allocated for a given congruence closure (e.g. at most Sys.int_size fields).

val get_bitfield : t -> N.bitfield -> N.t -> bool

Access the bit field of the given node

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/Solver_internal/CC/N/index.html b/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/Solver_internal/CC/N/index.html index aac8bc4b..f3c84753 100644 --- a/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/Solver_internal/CC/N/index.html +++ b/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/Solver_internal/CC/N/index.html @@ -1,2 +1,2 @@ -N (sidekick.Sidekick_th_cstor.S.A.S.Solver_internal.CC.N)

Module CC.N

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

All information pertaining to the whole equivalence class is stored in this representative's node.

When two classes become equal (are "merged"), one of the two representatives is picked as the representative of the new class. The new class contains the union of the two old classes' nodes.

We also allow theories to store additional information in the representative. This information can be used when two classes are merged, to detect conflicts and solve equations à la Shostak.

type t

An equivalent class, containing terms that are proved to be equal.

A value of type t points to a particular term, but see find to get the representative of the class.

val term : t -> term
val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
val is_root : t -> bool

Is the node a root (ie the representative of its class)? See find to get the root.

val iter_class : t -> t Iter.t

Traverse the congruence class. Precondition: is_root n (see find below)

val iter_parents : t -> t Iter.t

Traverse the parents of the class. Precondition: is_root n (see find below)

type bitfield

A field in the bitfield of this node. This should only be allocated when a theory is initialized.

All fields are initially 0, are backtracked automatically, and are merged automatically when classes are merged.

val get_field : bitfield -> t -> bool

Access the bit field

\ No newline at end of file +N (sidekick.Sidekick_th_cstor.S.A.S.Solver_internal.CC.N)

Module CC.N

Equivalence classes.

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

All information pertaining to the whole equivalence class is stored in this representative's node.

When two classes become equal (are "merged"), one of the two representatives is picked as the representative of the new class. The new class contains the union of the two old classes' nodes.

We also allow theories to store additional information in the representative. This information can be used when two classes are merged, to detect conflicts and solve equations à la Shostak.

type t

An equivalent class, containing terms that are proved to be equal.

A value of type t points to a particular term, but see find to get the representative of the class.

val term : t -> term

Term contained in this equivalence class. If is_root n, then term n is the class' representative term.

val equal : t -> t -> bool

Are two classes physically equal? To check for logical equality, use CC.N.equal (CC.find cc n1) (CC.find cc n2) which checks for equality of representatives.

val hash : t -> int

An opaque hash of this node.

val pp : t Sidekick_core.Fmt.printer

Unspecified printing of the node, for example its term, a unique ID, etc.

val is_root : t -> bool

Is the node a root (ie the representative of its class)? See find to get the root.

val iter_class : t -> t Iter.t

Traverse the congruence class. Precondition: is_root n (see find below)

val iter_parents : t -> t Iter.t

Traverse the parents of the class. Precondition: is_root n (see find below)

type bitfield

A field in the bitfield of this node. This should only be allocated when a theory is initialized.

Bitfields are accessed using preallocated keys. See Sidekick_core.CC_S.allocate_bitfield.

All fields are initially 0, are backtracked automatically, and are merged automatically when classes are merged.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/Solver_internal/CC/index.html b/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/Solver_internal/CC/index.html index 161f2850..86fb5272 100644 --- a/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/Solver_internal/CC/index.html +++ b/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/Solver_internal/CC/index.html @@ -1,2 +1,2 @@ -CC (sidekick.Sidekick_th_cstor.S.A.S.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_store : t -> term_store
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_store -> t

Create a new congruence closure.

parameter term_store

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file +CC (sidekick.Sidekick_th_cstor.S.A.S.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

The congruence closure object. It contains a fair amount of state and is mutable and backtrackable.

module N : sig ... end

Equivalence classes.

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_store : t -> term_store
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_store -> t

Create a new congruence closure.

parameter term_store

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new node field (see N.bitfield).

This field descriptor is henceforth reserved for all nodes in this congruence closure, and can be set using set_bitfield for each node individually. This can be used to efficiently store some metadata on nodes (e.g. "is there a numeric value in the class" or "is there a constructor term in the class").

There may be restrictions on how many distinct fields are allocated for a given congruence closure (e.g. at most Sys.int_size fields).

val get_bitfield : t -> N.bitfield -> N.t -> bool

Access the bit field of the given node

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/Solver_internal/CC/N/index.html b/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/Solver_internal/CC/N/index.html index 538b4560..9ae1a531 100644 --- a/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/Solver_internal/CC/N/index.html +++ b/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/Solver_internal/CC/N/index.html @@ -1,2 +1,2 @@ -N (sidekick.Sidekick_th_data.Make.1-A.S.Solver_internal.CC.N)

Module CC.N

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

All information pertaining to the whole equivalence class is stored in this representative's node.

When two classes become equal (are "merged"), one of the two representatives is picked as the representative of the new class. The new class contains the union of the two old classes' nodes.

We also allow theories to store additional information in the representative. This information can be used when two classes are merged, to detect conflicts and solve equations à la Shostak.

type t

An equivalent class, containing terms that are proved to be equal.

A value of type t points to a particular term, but see find to get the representative of the class.

val term : t -> term
val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
val is_root : t -> bool

Is the node a root (ie the representative of its class)? See find to get the root.

val iter_class : t -> t Iter.t

Traverse the congruence class. Precondition: is_root n (see find below)

val iter_parents : t -> t Iter.t

Traverse the parents of the class. Precondition: is_root n (see find below)

type bitfield

A field in the bitfield of this node. This should only be allocated when a theory is initialized.

All fields are initially 0, are backtracked automatically, and are merged automatically when classes are merged.

val get_field : bitfield -> t -> bool

Access the bit field

\ No newline at end of file +N (sidekick.Sidekick_th_data.Make.1-A.S.Solver_internal.CC.N)

Module CC.N

Equivalence classes.

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

All information pertaining to the whole equivalence class is stored in this representative's node.

When two classes become equal (are "merged"), one of the two representatives is picked as the representative of the new class. The new class contains the union of the two old classes' nodes.

We also allow theories to store additional information in the representative. This information can be used when two classes are merged, to detect conflicts and solve equations à la Shostak.

type t

An equivalent class, containing terms that are proved to be equal.

A value of type t points to a particular term, but see find to get the representative of the class.

val term : t -> term

Term contained in this equivalence class. If is_root n, then term n is the class' representative term.

val equal : t -> t -> bool

Are two classes physically equal? To check for logical equality, use CC.N.equal (CC.find cc n1) (CC.find cc n2) which checks for equality of representatives.

val hash : t -> int

An opaque hash of this node.

val pp : t Sidekick_core.Fmt.printer

Unspecified printing of the node, for example its term, a unique ID, etc.

val is_root : t -> bool

Is the node a root (ie the representative of its class)? See find to get the root.

val iter_class : t -> t Iter.t

Traverse the congruence class. Precondition: is_root n (see find below)

val iter_parents : t -> t Iter.t

Traverse the parents of the class. Precondition: is_root n (see find below)

type bitfield

A field in the bitfield of this node. This should only be allocated when a theory is initialized.

Bitfields are accessed using preallocated keys. See Sidekick_core.CC_S.allocate_bitfield.

All fields are initially 0, are backtracked automatically, and are merged automatically when classes are merged.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/Solver_internal/CC/index.html b/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/Solver_internal/CC/index.html index 1d76f654..d3c347ab 100644 --- a/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/Solver_internal/CC/index.html +++ b/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/Solver_internal/CC/index.html @@ -1,2 +1,2 @@ -CC (sidekick.Sidekick_th_data.Make.1-A.S.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_store : t -> term_store
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_store -> t

Create a new congruence closure.

parameter term_store

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file +CC (sidekick.Sidekick_th_data.Make.1-A.S.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

The congruence closure object. It contains a fair amount of state and is mutable and backtrackable.

module N : sig ... end

Equivalence classes.

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_store : t -> term_store
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_store -> t

Create a new congruence closure.

parameter term_store

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new node field (see N.bitfield).

This field descriptor is henceforth reserved for all nodes in this congruence closure, and can be set using set_bitfield for each node individually. This can be used to efficiently store some metadata on nodes (e.g. "is there a numeric value in the class" or "is there a constructor term in the class").

There may be restrictions on how many distinct fields are allocated for a given congruence closure (e.g. at most Sys.int_size fields).

val get_bitfield : t -> N.bitfield -> N.t -> bool

Access the bit field of the given node

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_data/module-type-ARG/S/Solver_internal/CC/N/index.html b/dev/sidekick/Sidekick_th_data/module-type-ARG/S/Solver_internal/CC/N/index.html index f3be4bbf..c731935c 100644 --- a/dev/sidekick/Sidekick_th_data/module-type-ARG/S/Solver_internal/CC/N/index.html +++ b/dev/sidekick/Sidekick_th_data/module-type-ARG/S/Solver_internal/CC/N/index.html @@ -1,2 +1,2 @@ -N (sidekick.Sidekick_th_data.ARG.S.Solver_internal.CC.N)

Module CC.N

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

All information pertaining to the whole equivalence class is stored in this representative's node.

When two classes become equal (are "merged"), one of the two representatives is picked as the representative of the new class. The new class contains the union of the two old classes' nodes.

We also allow theories to store additional information in the representative. This information can be used when two classes are merged, to detect conflicts and solve equations à la Shostak.

type t

An equivalent class, containing terms that are proved to be equal.

A value of type t points to a particular term, but see find to get the representative of the class.

val term : t -> term
val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
val is_root : t -> bool

Is the node a root (ie the representative of its class)? See find to get the root.

val iter_class : t -> t Iter.t

Traverse the congruence class. Precondition: is_root n (see find below)

val iter_parents : t -> t Iter.t

Traverse the parents of the class. Precondition: is_root n (see find below)

type bitfield

A field in the bitfield of this node. This should only be allocated when a theory is initialized.

All fields are initially 0, are backtracked automatically, and are merged automatically when classes are merged.

val get_field : bitfield -> t -> bool

Access the bit field

\ No newline at end of file +N (sidekick.Sidekick_th_data.ARG.S.Solver_internal.CC.N)

Module CC.N

Equivalence classes.

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

All information pertaining to the whole equivalence class is stored in this representative's node.

When two classes become equal (are "merged"), one of the two representatives is picked as the representative of the new class. The new class contains the union of the two old classes' nodes.

We also allow theories to store additional information in the representative. This information can be used when two classes are merged, to detect conflicts and solve equations à la Shostak.

type t

An equivalent class, containing terms that are proved to be equal.

A value of type t points to a particular term, but see find to get the representative of the class.

val term : t -> term

Term contained in this equivalence class. If is_root n, then term n is the class' representative term.

val equal : t -> t -> bool

Are two classes physically equal? To check for logical equality, use CC.N.equal (CC.find cc n1) (CC.find cc n2) which checks for equality of representatives.

val hash : t -> int

An opaque hash of this node.

val pp : t Sidekick_core.Fmt.printer

Unspecified printing of the node, for example its term, a unique ID, etc.

val is_root : t -> bool

Is the node a root (ie the representative of its class)? See find to get the root.

val iter_class : t -> t Iter.t

Traverse the congruence class. Precondition: is_root n (see find below)

val iter_parents : t -> t Iter.t

Traverse the parents of the class. Precondition: is_root n (see find below)

type bitfield

A field in the bitfield of this node. This should only be allocated when a theory is initialized.

Bitfields are accessed using preallocated keys. See Sidekick_core.CC_S.allocate_bitfield.

All fields are initially 0, are backtracked automatically, and are merged automatically when classes are merged.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_data/module-type-ARG/S/Solver_internal/CC/index.html b/dev/sidekick/Sidekick_th_data/module-type-ARG/S/Solver_internal/CC/index.html index 530ffa57..bac6435c 100644 --- a/dev/sidekick/Sidekick_th_data/module-type-ARG/S/Solver_internal/CC/index.html +++ b/dev/sidekick/Sidekick_th_data/module-type-ARG/S/Solver_internal/CC/index.html @@ -1,2 +1,2 @@ -CC (sidekick.Sidekick_th_data.ARG.S.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_store : t -> term_store
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_store -> t

Create a new congruence closure.

parameter term_store

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file +CC (sidekick.Sidekick_th_data.ARG.S.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

The congruence closure object. It contains a fair amount of state and is mutable and backtrackable.

module N : sig ... end

Equivalence classes.

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_store : t -> term_store
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_store -> t

Create a new congruence closure.

parameter term_store

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new node field (see N.bitfield).

This field descriptor is henceforth reserved for all nodes in this congruence closure, and can be set using set_bitfield for each node individually. This can be used to efficiently store some metadata on nodes (e.g. "is there a numeric value in the class" or "is there a constructor term in the class").

There may be restrictions on how many distinct fields are allocated for a given congruence closure (e.g. at most Sys.int_size fields).

val get_bitfield : t -> N.bitfield -> N.t -> bool

Access the bit field of the given node

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_data/module-type-S/A/S/Solver_internal/CC/N/index.html b/dev/sidekick/Sidekick_th_data/module-type-S/A/S/Solver_internal/CC/N/index.html index b6fc9910..5f842bfc 100644 --- a/dev/sidekick/Sidekick_th_data/module-type-S/A/S/Solver_internal/CC/N/index.html +++ b/dev/sidekick/Sidekick_th_data/module-type-S/A/S/Solver_internal/CC/N/index.html @@ -1,2 +1,2 @@ -N (sidekick.Sidekick_th_data.S.A.S.Solver_internal.CC.N)

Module CC.N

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

All information pertaining to the whole equivalence class is stored in this representative's node.

When two classes become equal (are "merged"), one of the two representatives is picked as the representative of the new class. The new class contains the union of the two old classes' nodes.

We also allow theories to store additional information in the representative. This information can be used when two classes are merged, to detect conflicts and solve equations à la Shostak.

type t

An equivalent class, containing terms that are proved to be equal.

A value of type t points to a particular term, but see find to get the representative of the class.

val term : t -> term
val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
val is_root : t -> bool

Is the node a root (ie the representative of its class)? See find to get the root.

val iter_class : t -> t Iter.t

Traverse the congruence class. Precondition: is_root n (see find below)

val iter_parents : t -> t Iter.t

Traverse the parents of the class. Precondition: is_root n (see find below)

type bitfield

A field in the bitfield of this node. This should only be allocated when a theory is initialized.

All fields are initially 0, are backtracked automatically, and are merged automatically when classes are merged.

val get_field : bitfield -> t -> bool

Access the bit field

\ No newline at end of file +N (sidekick.Sidekick_th_data.S.A.S.Solver_internal.CC.N)

Module CC.N

Equivalence classes.

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

All information pertaining to the whole equivalence class is stored in this representative's node.

When two classes become equal (are "merged"), one of the two representatives is picked as the representative of the new class. The new class contains the union of the two old classes' nodes.

We also allow theories to store additional information in the representative. This information can be used when two classes are merged, to detect conflicts and solve equations à la Shostak.

type t

An equivalent class, containing terms that are proved to be equal.

A value of type t points to a particular term, but see find to get the representative of the class.

val term : t -> term

Term contained in this equivalence class. If is_root n, then term n is the class' representative term.

val equal : t -> t -> bool

Are two classes physically equal? To check for logical equality, use CC.N.equal (CC.find cc n1) (CC.find cc n2) which checks for equality of representatives.

val hash : t -> int

An opaque hash of this node.

val pp : t Sidekick_core.Fmt.printer

Unspecified printing of the node, for example its term, a unique ID, etc.

val is_root : t -> bool

Is the node a root (ie the representative of its class)? See find to get the root.

val iter_class : t -> t Iter.t

Traverse the congruence class. Precondition: is_root n (see find below)

val iter_parents : t -> t Iter.t

Traverse the parents of the class. Precondition: is_root n (see find below)

type bitfield

A field in the bitfield of this node. This should only be allocated when a theory is initialized.

Bitfields are accessed using preallocated keys. See Sidekick_core.CC_S.allocate_bitfield.

All fields are initially 0, are backtracked automatically, and are merged automatically when classes are merged.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_data/module-type-S/A/S/Solver_internal/CC/index.html b/dev/sidekick/Sidekick_th_data/module-type-S/A/S/Solver_internal/CC/index.html index 89ef14b6..4e449831 100644 --- a/dev/sidekick/Sidekick_th_data/module-type-S/A/S/Solver_internal/CC/index.html +++ b/dev/sidekick/Sidekick_th_data/module-type-S/A/S/Solver_internal/CC/index.html @@ -1,2 +1,2 @@ -CC (sidekick.Sidekick_th_data.S.A.S.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_store : t -> term_store
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_store -> t

Create a new congruence closure.

parameter term_store

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file +CC (sidekick.Sidekick_th_data.S.A.S.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_store = T.Term.store
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

The congruence closure object. It contains a fair amount of state and is mutable and backtrackable.

module N : sig ... end

Equivalence classes.

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_store : t -> term_store
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_store -> t

Create a new congruence closure.

parameter term_store

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new node field (see N.bitfield).

This field descriptor is henceforth reserved for all nodes in this congruence closure, and can be set using set_bitfield for each node individually. This can be used to efficiently store some metadata on nodes (e.g. "is there a numeric value in the class" or "is there a constructor term in the class").

There may be restrictions on how many distinct fields are allocated for a given congruence closure (e.g. at most Sys.int_size fields).

val get_bitfield : t -> N.bitfield -> N.t -> bool

Access the bit field of the given node

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file