Module Logtk__InnerTerm
Inner Terms
type t= private{term : view;ty : type_result;mutable id : int;mutable payload : exn;props : I.t;ho_weight : int lazy_t;}Abstract type of term
and view= private|Var of t Logtk.HVar.tFree variable
|DB of int|Bind of Logtk.Binder.t * t * tType, sub-term
|Const of Logtk.ID.tConstant
|App of t * t listUncurried application
|AppBuiltin of Logtk.Builtin.t * t listFor representing special constructors
and type_result=|NoType|HasType of ttype term= t
val ty : t -> type_resultType of the term, if any
val ty_exn : t -> tSame as
ty, but fails if the term has no type- raises Invalid_argument
if the type is
NoType
val hash_mod_alpha : t -> intHash invariant w.r.t variable renaming
val same_l : t list -> t list -> boolPhysical equality on lists of terms, roughly the same as
List.forall2 (==)
val same_l_gen : t list -> t list -> boolPhysical equality on lists of terms, roughly the same as
List.forall2 (==), tolerates different lengths
val ho_weight : t -> int
Constructors
Some constructors, such as record, may raise IllFormedTermif the arguments are ill-formed (several occurrences of a key), or, for variables, if the number is negative
val const : ty:t -> Logtk.ID.t -> tval app : ty:t -> t -> t list -> tval bind : ty:t -> varty:t -> Logtk.Binder.t -> t -> tval var : t Logtk.HVar.t -> tval bvar : ty:t -> nat -> tval app_builtin : ty:t -> Logtk.Builtin.t -> t list -> tval builtin : ty:t -> Logtk.Builtin.t -> tval tType : tThe root of the type system. It doesn't have a type. It has kind
Kind.Type
Payload
val payload : t -> exnval set_payload : t -> exn -> unitSet payload.
- raises Invalid_argument
if there is already a payload
val set_payload_erase : t -> exn -> unitSet payload, ignoring the previous payload.
Containers
module VarMap : CCMap.S with type VarMap.key = t Logtk.HVar.tmodule VarSet : CCSet.S with type VarSet.elt = t Logtk.HVar.tmodule VarTbl : CCHashtbl.S with type VarTbl.key = t Logtk.HVar.tDe Bruijn indices handling
module DB : sig ... endIterators
module Seq : sig ... endPositions
module Pos : sig ... endVariables
val bind_vars : ty:t -> Logtk.Binder.t -> t Logtk.HVar.t list -> t -> tbind_vars ~ty b vars tbinds eachv in varswith the binderb, with bodyt, and each intermediate result has typety(not suitable for functions)
val close_vars : ty:t -> Logtk.Binder.t -> t -> tClose all free variables of the term using the binding symbol
val fun_ : t -> t -> tval fun_l : t list -> t -> tval fun_of_fvars : t Logtk.HVar.t 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 -> t list * topen_fun ty"unrolls" function arrows from the left, so thatopen_fun (a -> (b -> (c -> d)))returns[a;b;c], d.- returns
the return type and the list of all its arguments
val open_poly_fun : t -> int * t list * topen_poly_fun ty"unrolls" polymorphic function arrows from the left, so thatopen_poly_fun (forall a b. f a -> (g b -> (c -> d)))returns2; [f a;g b;c], d.- returns
the return type, the number of type variables, and the list of all its arguments
val expected_ty_vars : t -> int- returns
the number of type variables that a type requires.
val open_bind : Logtk.Binder.t -> t -> t list * tval open_bind_fresh : Logtk.Binder.t -> t -> t Logtk.HVar.t list * topen_bind_fresh λ (λxy. F)returns[v1,v2], F[v1/x,v2/y]wherev1andv2are fresh variables usingHVar.fresh
val open_bind_fresh2 : ?eq_ty:(t -> t -> bool) -> Logtk.Binder.t -> t -> t -> t Logtk.HVar.t list * t * topen_bind_free2 λ (λxy. F) (λxyz. G)returns[v1,v2], F[v1/x,v2/y], λz.G[v1/x,v2/y]wherev1andv2are fresh variables usingHVar.fresh- parameter eq_ty
checks whether type of bound variables are compatible
val open_fun : t -> t list * topen_fun ty"unrolls" function arrows from the left, so thatopen_fun (a -> (b -> (c -> d)))returns[a;b;c], d.- returns
the return type and the list of all its arguments
val open_poly_fun : t -> int * t list * topen_poly_fun ty"unrolls" polymorphic function arrows from the left, so thatopen_poly_fun (forall a b. f a -> (g b -> (c -> d)))returns2; [f a;g b;c], d.- returns
the return type, the number of type variables, and the list of all its arguments
val open_bind : Logtk.Binder.t -> t -> t list * tval open_bind2 : Logtk.Binder.t -> t -> t -> t list * t * t list * tval mk_fun : ty_l:t list -> t -> tmk_fun ~ty_l bodycloses over body for DB indices of typety_l
val is_ground : t -> booltrueif the term contains no free variables
Misc
val size : t -> intval depth : t -> intval head : t -> Logtk.ID.t optionHead symbol, or None if the term is a (bound) variable
val type_is_unifiable : t -> boolCan we (syntactically) unify terms of this type?
val type_non_unifiable_tags : t -> Logtk.Builtin.Tag.t listTheory tags that justify this type not being unifiable
val type_is_prop : t -> boolIs is equal to
prop
val 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_var : t -> t Logtk.HVar.t optionval as_var_exn : t -> t Logtk.HVar.tval as_const : t -> Logtk.ID.t optionval as_const_exn : t -> Logtk.ID.tval as_bvar_exn : t -> intval is_bvar_i : int -> t -> boolis_bvar_i n tistrueifft = bvar i
IO
val print_hashconsing_ids : bool Stdlib.refif enabled, every term will be printed with its unique ID
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 : t Logtk.HVar.t CCFormat.printerval add_default_hook : print_hook -> unitAdd a print hook that will be used from now on
val default_hooks : unit -> print_hook listval debugf : t CCFormat.printerval pp_zf : t CCFormat.printerval pp_in : Logtk.Output_format.t -> t CCFormat.printer