TermTerm representation
Terms are hashconsed for maximal sharing, comparison with physical equality and to store type information.
Terms are lambda trees, see Ltree, with symbols of type Symbol.t, free variables of type Var.t and types Type.t.
The type t is private and cannot be constructed outside this module in order to ensure that all equal subterms are physically equal for hashconsing.
Use the constructor functions like mk_true, mk_num etc. to construct terms. An exception will be raised if an incorrectly typed term is constructed.
type t = T.tTerms are hashconsed abstract syntax trees
type lambda = T.lambdaTerms are hashconsed abstract syntax trees
val hash : t -> intHashing function on terms
val tag : t -> intUnique identifier for terms
Import a term from a different instance into this hashcons table
val is_lambda_identity : lambda -> boolReturns true if the lamda expression is the identity, i.e. lambda x.x
val mk_true : unit -> tCreate the propositional constant true
val mk_false : unit -> tCreate the propositional constant false
val mk_num_of_int : int -> tCreate an integer numeral
val mk_constr : string -> tCreate a constructor encoded as a numeral
val mk_ubv : Bitvector.t -> tCreate a constant unsigned bitvector
val mk_bv : Bitvector.t -> tCreate a constant bitvector
Negates a term by modifying the top node if it is a bvneg or an machine integer constant.
Return an integer representing a bit width sufficiently large to store the input as an unsigned machine integer.
Uniquely name a term with an integer and return a named term and its name
set_inter_group t g associates term t with interpolation group g and return the corresponing interpolation group term
Name term with the given integer in a given namespace
This is a basic function, the caller has to generate the name, and ensure the name is used only once. Use with caution, or better only use mk_named, which will create a unique name.
The namespace "t" will be rejected, because this is the namespace used by mk_named.
val mk_uf : UfSymbol.t -> t list -> tCreate an uninterpreted constant or function
Return a hashconsed existentially quantified term
val t_true : tThe propositional constant true
val t_false : tThe propositional constant false
module Abbrev : sig ... endval mk_bool : bool -> tCreate the propositional constant true or false
val mk_const_of_symbol_node : Symbol.symbol -> tCreate a constant
val mk_app_of_symbol_node : Symbol.symbol -> t list -> tCreate a function application
Negates a term by modifying the top node if it is a not, true, false, or an arithmetic inequality.
val has_quantifier : t -> boolReturns true if the term has quantifiers
val get_atoms : t -> TermSet.tval is_atom : t -> boolReturn true if the term is a simple Boolean atom, that is, has type Boolean and does not contain subterms of type Boolean
val is_negated : t -> boolReturn true if the top symbol of the term is a negation
val is_free_var : t -> boolReturn true if the term is a free variable
val is_bound_var : t -> boolReturn true if the term is a bound variable
val is_leaf : t -> boolReturn true if the term is a leaf symbol
val is_node : t -> boolReturn true if the term is a function application
val is_let : t -> boolReturn true if the term is a let binding
val is_exists : t -> boolReturn true if the term is an existential quantifier
val is_forall : t -> boolReturn true if the term is a universal quantifier
val is_named : t -> boolReturn true if the term is a named term
val name_of_named : t -> intReturn the name of a named term
val is_interp_group : t -> boolReturn true if the term is an interpolation group term
val name_of_interp_group : t -> stringReturn the name of an interpolation group term
val is_numeral : t -> boolReturn true if the term is an integer constant
val is_negative_numeral : t -> boolReturn true if the term is a negative integer constant
val bitvector_of_term : t -> Bitvector.tReturn bitvector constant of a term (sign-agnostic)
val sbitvector_of_term : t -> Bitvector.tReturn signed bitvector constant of a term
val ubitvector_of_term : t -> Bitvector.tReturn unsigned bitvector constant of a term
val is_bitvector : t -> boolReturn true if the term is a (sign-agnostic) bitvector consant
val is_sbitvector : t -> boolReturn true if the term is a signed bitvector constant
val is_ubitvector : t -> boolReturn true if the term is an unsigned bitvector constant
val is_decimal : t -> boolReturn true if the term is a decimal constant
val is_bool : t -> boolReturn true if the term is a Boolean constant
val bool_of_term : t -> boolReturn Boolean constant of a term
val is_select : t -> boolReturn true if the term is an application of the select operator
val is_store : t -> boolReturn true if the term is an application of the store operator
val is_ite : t -> boolReturn true if the term is an application of the ite operator
Return the indexes and the array variable of the select operator
The array argument of a select is either another select operation or a variable. For the expression (select (select A j) k) return the pair A and [j; k].
val pp_print_term : Stdlib.Format.formatter -> t -> unitPretty-print a term
val print_term : t -> unitPretty-print a term to the standard formatter
val string_of_term : t -> stringReturn a string representation of a term
val pp_print_lambda : Stdlib.Format.formatter -> lambda -> unitPretty-print a lambda abstraction
val print_lambda : lambda -> unitPretty-print a lambda abstraction to the standard formatter
val string_of_lambda : lambda -> stringReturn a string representation of a lambda abstraction
Evaluate the term bottom-up and right-to-left. The evaluation function is called at each node of the term with the the term being evaluated, and the list of values computed for the subterms. Let bindings are lazily unfolded.
Tail-recursive bottom-up right-to-left map on the term
Not every subterm is a proper term, since the de Bruijn indexes are shifted. Therefore, the function f is called with the number of let bindings the subterm is under as first argument, so that the indexes can be adjusted in the subterm if necessary.
val map_state_vars : (StateVar.t -> StateVar.t) -> t -> tReturn a new term with each state variable replaced
map_state_vars t f returns a new term of t with each occurring state variable s replaced by the result of the evaluation f s.
Convert (= 0 (mod t n)) to (divisble n t)
The term n must be an integer numeral.
Convert negative numerals and decimals to negations of their absolute value
Add to offset of state variable instances
Negative values are allowed
Apply function to term for instants 0..k
val state_vars_of_term : t -> StateVar.StateVarSet.tReturn the state variables occurring in the term
val vars_of_term : t -> Var.VarSet.tReturn the variables occurring in the term
val state_vars_at_offset_of_term : Numeral.t -> t -> StateVar.StateVarSet.tReturn the state variables at given offset in term
Return the state variables at given offset in term
Return the minimal and maximal offset of state variable instances
Return (None, None) if there are no state variable instances in the term.
val select_symbols_of_term : t -> Symbol.SymbolSet.tReturn the select symbols occurring in the term
val select_terms : t -> TermSet.tReturn the terms of the form (select ...) that appear in a term
Convert terms of the form (select (select a i) j) to (select a i j) for multi-dimensional arrays
val partial_selects : t -> t * UfSymbol.t listUse fresh function symbols to encode partial select applications and add constraint that forall i, fresh a i = select a i, returns the modified term and the list of new fresh symbols to declare. This is only useful when using the fun-rec option of cvc5, it does nothing otherwise.
val indexes_of_state_var : StateVar.t -> t -> t list listReturn (array) indexes of a state variable appearing in a term
Return a term where the top-level select of the given term has been pushed until reaching a subterm that is not an ITE. If the top-level symbol is not a select, then the given term is returned unaltered