Logtk.InnerTermThose terms are not designed to be used directly, but rather to provide a generic backend (implementing De Bruijn indices, subterms, substitutions, etc.) for other more specific representations like Type.t and Term.t.
The point is that we only have to do substitution, hashconsing, and De Bruijn indices manipulation in one place; it also makes it easy to make terms and types occur in one another (types as parameters to terms, etc.)
NOTE: this should be used with a lot of caution. Few checks are performed (even typing checks) and it is easy to obtain non-closed terms or ill-typed terms by manipulating this carelessly.
module I = Int32type 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
type term = tval ty : t -> type_resultType of the term, if any
include Interfaces.ORD with type t := tval hash_mod_alpha : t -> intHash invariant w.r.t variable renaming
Physical equality on lists of terms, roughly the same as List.forall2(==)
Physical equality on lists of terms, roughly the same as List.forall2(==),
toleratesdifferentlengths
val ho_weight : t -> intSome 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 tType : tThe root of the type system. It doesn't have a type. It has kind Kind.Type
val is_var : t -> boolval is_bvar : t -> boolval is_const : t -> boolval is_bind : t -> boolval is_app : t -> boolval is_tType : t -> boolval is_lambda : t -> boolval is_beta_reducible : t -> boolval has_lambda : t -> boolval payload : t -> exnval set_payload : t -> exn -> unitSet payload.
val set_payload_erase : t -> exn -> unitSet payload, ignoring the previous payload.
module Tbl : CCHashtbl.S with type key = termmodule VarTbl : CCHashtbl.S with type key = t HVar.tmodule DB : sig ... endmodule Seq : sig ... endmodule Pos : sig ... endreplace t ~old ~by syntactically replaces all occurrences of old in t by the term by.
bind_vars ~ty b vars t binds each v in vars with the binder b, with body t, and each intermediate result has type ty (not suitable for functions)
Close all free variables of the term using the binding symbol
Build a function from a list of free vars + the body. This performs the De Bruijn transformation, and shifts the body.
val expected_ty_vars : t -> intopen_bind_fresh λ (λxy. F) returns [v1,v2], F[v1/x,v2/y] where v1 and v2 are fresh variables using HVar.fresh
open_bind_free2 λ (λxy. F) (λxyz. G) returns [v1,v2], F[v1/x,v2/y], λz.G[v1/x,v2/y] where v1 and v2 are fresh variables using HVar.fresh
open_fun ty "unrolls" function arrows from the left, so that open_fun (a -> (b -> (c -> d))) returns [a;b;c], d.
open_poly_fun ty "unrolls" polymorphic function arrows from the left, so that open_poly_fun (forall a b. f a -> (g b -> (c -> d))) returns 2; [f a;g b;c], d.
val is_ground : t -> booltrue if the term contains no free variables
val size : t -> intval depth : t -> intval type_is_unifiable : t -> boolCan we (syntactically) unify terms of this type?
val type_non_unifiable_tags : t -> Builtin.Tag.t listTheory tags that justify this type not being unifiable
val type_is_prop : t -> boolIs is equal to prop
as_app t decomposes t into a head (non-application) and arguments, such as (let f,l = as_app t in app f l) = t
val as_bvar_exn : t -> intval is_bvar_i : int -> t -> boolis_bvar_i n t is true iff t = bvar i
val print_hashconsing_ids : bool refif enabled, every term will be printed with its unique ID
val print_all_types : bool refif enabled, print all types
val show_type_arguments : bool refParameter for printing/hiding type arguments in terms
include Interfaces.PRINT_DE_BRUIJN with type t := t and type term := ttype print_hook = int -> t CCFormat.printer -> Format.formatter -> t -> 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 true if it fired, false to fall back on the default printing.
val pp_depth : ?hooks:print_hook list -> int -> t CCFormat.printerval pp_var : t 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 : Output_format.t -> t CCFormat.printer