Module Logtk.Ind_ty
Inductive Types
val section : Util.Section.t
type constructor
= private
{
cstor_name : ID.t;
cstor_ty : Type.t;
cstor_args : (Type.t * projector) list;
}
Constructor for an inductive type
and projector
= private
{
p_id : ID.t;
p_ty : Type.t;
p_index : int;
p_cstor : constructor lazy_t;
}
A projector for a given constructor and argument position
Inductive Types
type t
= private
{
ty_id : ID.t;
ty_vars : Type.t HVar.t list;
ty_pattern : Type.t;
ty_constructors : constructor list;
ty_is_rec : bool lazy_t;
ty_proof : Proof.t;
}
An inductive type, along with its set of constructors
val pp : t CCFormat.printer
exception
InvalidDecl of string
exception
NotAnInductiveType of ID.t
exception
NotAnInductiveConstructor of ID.t
val declare_ty : ID.t -> ty_vars:Type.t HVar.t list -> constructor list -> proof:Proof.t -> t
Declare the given inductive type.
- raises InvalidDecl
if the type is already declared, or the list of constructors is empty
val as_inductive_ty : ID.t -> t option
val as_inductive_ty_exn : ID.t -> t
Unsafe version of
as_inductive_ty
- raises NotAnInductiveType
if the ID is not an inductive type
val is_inductive_ty : ID.t -> bool
val as_inductive_type : Type.t -> (t * Type.t list) option
as_inductive_ty (list int)
will returnlist, [int]
as an inductive type applied to some arguments
val as_inductive_type_exn : Type.t -> t * Type.t list
val is_inductive_type : Type.t -> bool
is_inductive_type ty
holds iffty
is an instance of some registered type (registered withdeclare_ty
).
val is_inductive_simple_type : TypedSTerm.t -> bool
val is_recursive : t -> bool
val proof : t -> Proof.t
Constructors
val mk_constructor : ID.t -> Type.t -> (Type.t * (ID.t * Type.t)) list -> constructor
val is_constructor : ID.t -> bool
true if the symbol is an inductive constructor (zero, successor...)
val as_constructor : ID.t -> (constructor * t) option
if
id
is a constructor ofity
, thenas_constructor id
returnsSome (cstor, ity)
val as_constructor_exn : ID.t -> constructor * t
Unsafe version of
as_constructor
- raises NotAnInductiveConstructor
if it fails
val contains_inductive_types : Term.t -> bool
true
iff the term contains at least one subterm with an inductive type