AltErgoLib.ExprData structures
include Container_types.S_plus_stdlib with type t := tmodule T : Container_types_intf.Thing with type t = tmodule Set : Container_types_intf.Set_plus_stdlib with type elt = tmodule Tbl : Container_types_intf.Tbl_plus_stdlib with type key = tmodule Table = Tbltype term_view = private {f : Symbols.t;xs : t list;ty : Ty.t;bind : bind_kind;tag : int;vars : (Ty.t * int) Var.Map.t;Map of free term variables in the term to their type and number of occurrences.
*)vty : AltErgoLib.Ty.TvSet.t;Map of free type variables in the term.
*)depth : int;nb_nodes : int;pure : bool;mutable neg : t option;}and quantified = private {name : string;Name of the lemma. This field is used by printers.
*)main : t;The underlying formula.
*)prenex : bool;Determine if the quantified formula is in prenex position, i.e. if it is the root of a formula introduced by an assertion, a goal or a function definition (possibly under quantifiers over type variables only).
For instance, ∀y:int. G(y) is in prenex position in the asserted formula ∀y:int. G(y), but neither in ¬(∀y:int. G(y)) nor in P ∧ ∀y:int. G(y).
Notice that quantifiers of the same kind are packed as much as possible. For instance, if we assert the formula: ∀α. ∀x:list α. ∃y:α. F(x, y) Then the two universal quantifiers are packed in a same prenex formula but the subformula ∃y:α. F(x, y) is not in prenex position.
This flag is important for the prenex polymorphism.
true, all the free type variables of main are implicitely considered as quantified.main and are stored in the field sko_vty.user_trs : trigger list;List of the triggers defined by the user.
The solver doesn't generate multi-triggers if the user has defined some multi-triggers.
*)binders : binders;The ordered list of quantified term variables of main.
This list has to be ordered for the skolemization.
*)sko_v : t list;Set of all the free variables of the quantified formula. In other words, this set is always the complementary of binders in the set of free variables of main.
The purpose of this field is to retrieve these variables quickly while performing the lazy skolemization in the SAT solver (see skolemize).
sko_vty : Ty.t list;The set of free type variables. In particular this set is always empty if we are the top level.
*)loc : Loc.t;Location of the "GLOBAL" axiom containing this quantified formula. It forms with name a unique identifier.
*)kind : decl_kind;Kind of declaration.
*)}and semantic_trigger = | Interval of t * Symbols.bound * Symbols.bound| MapsTo of Var.t * t| NotTheoryConst of t| IsTheoryConst of t| LinearDependency of t * tand trigger = private {content : t list;List of terms that must be present for this trigger to match.
Sorted using matching heuristics; the first term is estimated as the least likely to match.
*)semantic : semantic_trigger list;hyp : t list;t_depth : int;from_user : bool;}module Labeled : sig ... enddifferent views of an expression
constant casts
val int_view : t -> intExtracts the integer value of the expression, if there is one.
The returned value may be negative or null.
val rounding_mode_view : t -> Fpa_rounding.rounding_mode optionExtracts the rounding mode value of the expression, if there is one. Return None if the expression is not a constant rounding mode.
pretty printing
val print_list : Stdlib.Format.formatter -> t list -> unitval print_list_sep : string -> Stdlib.Format.formatter -> t list -> unitval print_triggers : Stdlib.Format.formatter -> trigger list -> unitval pp_smtlib : t Fmt.tpp_smtlib ppf e prints the expression e on the formatter ppf using the SMT-LIB standard.
Comparison and hashing functions
val uid : t -> intval compare_quant : quantified -> quantified -> intval free_type_vars : t -> AltErgoLib.Ty.TvSet.tval is_ground : t -> boolval size : t -> intval depth : t -> intval is_positive : t -> boolval is_int : t -> boolval is_real : t -> boolLabeling and models
val name_of_lemma : t -> stringval name_of_lemma_opt : t option -> stringval print_tagged_classes : Stdlib.Format.formatter -> Set.t list -> unitsmart constructors for terms
mk_uninterpreted_term name args ret_ty builds an application of the uninterpreted symbol name to args, of type ret_ty.
val vrai : tThe boolean constant true with neg vrai == faux.
val faux : tThe boolean constant false with neg faux == vrai.
val int : string -> tval real : string -> tval float : Fp_value.t -> int -> int -> tSpecial names used for AC(X) abstraction. These corresponds to the K sort in the AC(X) paper.
val is_fresh_ac_name : t -> boolmk_abstract ty creates an abstract model term of type ty. This function is intended to be used only in models.
smart constructors for literals
mk_distinct ~iff l builds distinct l, where l has at least two elements. With at least three non-boolean arguments, it is a single n-ary literal.
The negation of this literal means that at least two of its arguments are equal. The theories ignore it, as this is a disjunction, instead, the SAT solvers add the disjunction of the equalities between the arguments when the literal is false.
val mk_builtin : is_pos:bool -> Symbols.builtin -> t list -> tsimple smart constructors for formulas
smart constructor for datatypes.
mk_constr c args ty converts the Dolmen constructor c into an expression with arguments args.
Substitutions
Subterms, and related stuff
sub_term acc e returns the acc augmented with the term and all its sub-terms. Returns the acc if e is not a term. Does not go through literals (except positive uninterpreted predicates application) and formulas
max_pure_subterms e returns the maximal pure terms of the given expression
returns the maximal terms of the given literal. Assertion failure if not a literal (should replace the assertion failure with a better error) *
returns the maximal ground terms of the given literal. Assertion failure if not a literal *
traverses a formula recursively and collects its atoms. Only ground atoms are kept if ~only_ground is true
traverses a formula recursively and collects its maximal ground terms
skolemization and other smart constructors for formulas *
val make_triggers :
name:string ->
loc:Loc.t ->
t ->
binders ->
decl_kind ->
Util.triggers_env ->
trigger listmake_triggers ~name ~loc f binders decl menv generate multi-triggers for the formula f and binders binders. name and loc are the name and location of the quantified formula, used in warnings.
An escaped variable of a pattern is a variable that is not in binders (but the variable is bound by an inner quantified formula). We can replace escaped variables by the underscore variable Var.underscore.
For instance, if binders is the set {x, y} and g(x, y, z) is a pattern where {(x, y, z)} are free term variables, we can replace z by _.
Our strategy for multi-trigger generations depends on the matching environment menv as follows:
If menv.greedy is false, we try to generate in order:
If menv.greedy is true, we try to generate in order:
If menv.triggers_var is true, we allow variables as valid triggers.
Note: Mono-trigger with `Sy.Plus` or `Sy.Minus` top symbols are ignored if other mono-triggers have been generated.
The matching environment env is used to limit the number of multi-triggers generated per axiom.
clean trigger: remove useless terms in multi-triggers after inlining of lets
val resolution_triggers : is_back:bool -> quantified -> trigger listval skolemize : quantified -> ttype th_elt = {th_name : string;ax_name : string;ax_form : t;extends : Util.theories_extensions;axiom_kind : Util.axiom_kind;}val print_th_elt : Stdlib.Format.formatter -> th_elt -> unitval is_pure : t -> boolval is_model_term : t -> boolis_model_term e checks if the expression e is a model terms. A model term can be:
The definition of model term maps to value terms in the SMT-LIB standard.
module Core : sig ... endConstructors from the smtlib core theory. https://smtlib.cs.uiowa.edu/theories-Core.shtml
module Ints : sig ... endConstructors from the smtlib theory of integers. https://smtlib.cs.uiowa.edu/theories-Ints.shtml
module Reals : sig ... endConstructors from the smtlib theory of reals. https://smtlib.cs.uiowa.edu/theories-Reals.shtml
module BV : sig ... endConstructors from the smtlib theory of fixed-size bit-vectors and the QF_BV logic.
module FP : sig ... endConstructors from the smtlib theory of floating-point numbers.
module ArraysEx : sig ... endConstructors from the smtlib theory of functional arrays with extensionality logic.