Module Logtk__Term
Terms
Term
type t= private Logtk.InnerTerm.ttype term= ttype var= Logtk.Type.t Logtk.HVar.tVariables are typed with
Type.t
type view= private|AppBuiltin of Logtk.Builtin.t * t list|DB of intBound variable (De Bruijn index)
|Var of varTerm variable
|Const of Logtk.ID.tTyped constant
|App of t * t listApplication to a list of terms (cannot be left-nested)
|Fun of Logtk.Type.t * tLambda abstraction
module Classic : sig ... end
val ty : t -> Logtk.Type.tObtain the type of a term..
module IntMap : Stdlib.Map.S with type IntMap.key = intval hash_mod_alpha : t -> intHash invariant w.r.t variable renaming
Constructors
val var : var -> tval var_of_int : ty:Logtk.Type.t -> int -> tval bvar : ty:Logtk.Type.t -> int -> tCreate a bound variable. Providing a type is mandatory. Warning: be careful and try not to use this function directly.
- raises InnerTerm.IllFormedTerm
if the index is < 0
val builtin : ty:Logtk.Type.t -> Logtk.Builtin.t -> tval app_builtin : ty:Logtk.Type.t -> Logtk.Builtin.t -> t list -> tval const : ty:Logtk.Type.t -> Logtk.ID.t -> tCreate a typed constant
val tyapp : t -> Logtk.Type.t list -> tApply a term to types
- raises Type.Error
if types do not match.
val app : t -> t list -> tApply a term to a list of terms
- raises Type.ApplyError
if types do not match.
val app_w_ty : ty:Logtk.Type.t -> t -> t list -> tApply a term to a list of terms
- raises Type.ApplyError
if types do not match.
val app_full : t -> Logtk.Type.t list -> t list -> tApply the term to types, then to terms
val true_ : tval false_ : tval fun_ : Logtk.Type.t -> t -> tval fun_l : Logtk.Type.t list -> t -> tval fun_of_fvars : var list -> t -> tBuild a function from a list of free vars + the body. This performs the De Bruijn transformation, and shifts the body.
val open_fun : t -> Logtk.Type.t list * tval open_fun_offset : offset:int -> t -> var list * t * intopen_fun ~offset (λxy. F)returns[v1,v2], F[v1/x,v2/y], offset+2wherev1andv2are fresh variables starting from offset
val grounding : Logtk.Type.t -> tgrounding tyis a unique constant of typety
val is_var : t -> boolval is_appbuiltin : t -> boolval is_bvar : t -> boolval is_formula : t -> boolval is_app : t -> boolval is_const : t -> boolval is_fun : t -> boolval is_app_var : t -> boolval is_type : t -> boolDoes it have type
tType?
val in_pfho_fragment : t -> boolval in_lfho_fragment : t -> boolval is_fo_term : t -> boolval in_fool_fragment : t -> bool * boolval is_true_or_false : t -> boolval lambda_depth : t -> int optionIf term has no lambdas reutrn None; otherwise, return Some d where d is the maximal level of lambda nestings
val comb_depth : t -> int optioncombinatory equivalent to lambda_depth
val hd_is_comb : Logtk.Builtin.t -> boolval is_comb : t -> boolval mk_fresh_skolem : ?prefix:string -> var list -> Logtk.Type.t -> (Logtk.ID.t * Logtk.Type.t) * tval as_const : t -> Logtk.ID.t optionval as_const_exn : t -> Logtk.ID.tval as_var : t -> var optionval as_var_exn : t -> varval as_bvar_exn : t -> intval as_app : t -> t * t listas_app tdecomposestinto a head (non-application) and arguments, such as(let f,l = as_app t in app f l) = t
val as_app_mono : t -> t * t listas_app tdecomposestinto a head (possibly applied to type arguments) and arguments, such as(let f,l = as_app t in app f l) = t
val as_fun : t -> Logtk.Type.t list * tOpen functions
val as_app_mono : t -> t * t listhead term, but still with type arguments and the remaining arguments
val of_term_unsafe : Logtk.InnerTerm.t -> tNOTE: this can break the invariants and make
viewfail. Only apply with caution.
val of_term_unsafe_l : Logtk.InnerTerm.t list -> t listval of_ty : Logtk.Type.t -> tUpcast from type
val mk_tmp_cst : counter:int Stdlib.ref -> ty:Logtk.Type.t -> t
Iters
module Seq : sig ... endval is_ground : t -> boolis the term ground? (no free vars)
val is_linear : t -> boolis the term ground? (no free vars)
is the term linear? (no vars occurring multiple times)
val monomorphic : t -> boolis the term linear? (no vars occurring multiple times)
true if the term contains no type var
val is_beta_reducible : t -> boolval has_lambda : t -> boolval max_var : VarSet.t -> intfind the maximum variable
val min_var : VarSet.t -> intminimum variable
val depth : t -> intdepth of the term
val head : t -> Logtk.ID.t optionhead ID.t
val head_exn : t -> Logtk.ID.thead ID.t (or Invalid_argument)
val size : t -> intSize (number of nodes)
val normalize_bools : t -> tval cover_with_terms : ?depth:int -> ?recurse:bool -> t -> t option list -> t listval max_cover : t -> t option list -> tval weight : ?var:int -> ?sym:(Logtk.ID.t -> int) -> t -> intCompute the weight of a term, given a weight for variables and one for ID.ts.
- parameter var
unique weight for every variable (default 1)
- parameter sym
function from ID.ts to their weight (default
const 1)
- since
- 0.5.3
val ho_weight : t -> intval ty_vars : t -> Logtk.Type.VarSet.tSet of free type variables
val is_ho_var : t -> boolval is_ho_app : t -> boolis_ho_app (F t1…tn)is true, whenFis a variable (of any function type)
val as_ho_app : t -> (Logtk.Type.t Logtk.HVar.t * t list) optionas_ho_app (F t1…tn) = Some (F, [t1…tn])
val is_ho_pred : t -> boolis_ho_pred (F t1…tn)is true, whenFis a predicate variable
val is_ho_at_root : t -> boolis_ho_at_root treturnstrueif the termtis a higher-order variable, possibly applied (i.e.is_ho_var t || is_ho_app t)
Subterms and Positions
module Pos : sig ... endHigh-level operations
val symbols : ?init:Logtk.ID.Set.t -> t -> Logtk.ID.Set.tSymbols of the term (keys of signature)
val contains_symbol : Logtk.ID.t -> t -> boolDoes the term contain this given ID.t?
Fold
val all_positions : ?vars:bool -> ?ty_args:bool -> ?var_args:bool -> ?fun_bodies:bool -> ?pos:Logtk.Position.t -> t -> t Logtk.Position.With.t Iter.tIterate on all sub-terms with their position.
- parameter vars
specifies whether variables are folded on (default false).
- parameter ty_args
specifies whether type arguments are folded on (default true).
- parameter var_args
specifies whether arguments of applied variables are folded on (default true).
- parameter fun_bodies
specifies whether bodies of lambda-expressions are folded on (default true).
- parameter pos
the initial position (default empty)
Some AC-utils
module type AC_SPEC = sig ... endPrinting/parsing
val print_all_types : bool Stdlib.refIf true,
ppwill print the types of all annotated terms
include Logtk.Interfaces.PRINT with type t := t
include Logtk.Interfaces.PRINT_DE_BRUIJN with type t := t and type term := t
type ttype termtype print_hook= int -> term CCFormat.printer -> Stdlib.Format.formatter -> term -> boolUser-provided hook that can be used to print terms (for composite cases) before the default printing occurs. The int argument is the De Bruijn depth in the term. A hook takes as arguments the depth and the recursive printing function that it can use to print subterms. A hook should return
trueif it fired,falseto fall back on the default printing.
val pp_depth : ?hooks:print_hook list -> int -> t CCFormat.printer
val pp_var : Logtk.Type.t Logtk.HVar.t CCFormat.printerval add_hook : print_hook -> unitHook used by default for printing
val default_hooks : unit -> print_hook listList of default hooks
val debugf : Stdlib.Format.formatter -> t -> unitdebugf printing, with sorts
Formulas
module Form : sig ... endArith
module Arith : sig ... endval close_quantifier : Logtk.Builtin.t -> Logtk.Type.t list -> t -> tval has_ho_subterm : t -> bool
module DB : sig ... end
TPTP
module TPTP : sig ... endmodule ZF : sig ... endval pp_in : Logtk.Output_format.t -> t CCFormat.printer
module Conv : sig ... end