module Type:sig
..end
Types are represented using InnerTerm, with kind Type. Therefore, they are hashconsed and scoped.
Common representation of types, including higher-order and polymorphic types. All type variables are assumed to be universally quantified in the outermost possible scope (outside any other quantifier).
See TypeInference
for inferring types from terms and formulas,
and Signature
to associate types with symbols.
TODO: think of a good way of representating AC operators (+, ...)
typet = private
InnerTerm.t
typety =
t
type
builtin =
| |
TType |
| |
Prop |
| |
Term |
| |
Rat |
| |
Int |
val pp_builtin : builtin CCFormat.printer
val builtin_conv : builtin -> Builtin.t
type
view = private
| |
Builtin of |
|||
| |
Var of |
|||
| |
DB of |
|||
| |
App of |
(* |
parametrized type
| *) |
| |
Fun of |
(* |
Function type (left to right, no left-nesting)
| *) |
| |
Forall of |
(* |
explicit quantification using De Bruijn index
| *) |
val view : t -> view
Assert_failure
if the argument is not a typeinclude Interfaces.HASH
include Interfaces.ORD
val is_tType : t -> bool
val is_var : t -> bool
val is_bvar : t -> bool
val is_app : t -> bool
val is_fun : t -> bool
val is_forall : t -> bool
val tType : t
val prop : t
val term : t
val int : t
val rat : t
val var : t HVar.t -> t
val var_of_int : int -> t
val app : ID.t -> t list -> t
val builtin : builtin -> t
val const : ID.t -> t
val arrow : t list -> t -> t
arrow l r
is the type l -> r
.val forall : t -> t
val forall_n : int -> t -> t
n
type variable. Careful with the De Bruijn indices!val bvar : int -> t
val (==>) : t list -> t -> t
l ==> x
is the same as x
if l
is empty. Invariant: the return type is never a function type.val of_term_unsafe : InnerTerm.t -> t
Type.view
fail. Only
use with caution.val of_terms_unsafe : InnerTerm.t list -> t list
val cast_var_unsafe : InnerTerm.t HVar.t -> t HVar.t
module Set:CCSet.S
with type elt = t
module Map:CCMap.S
with type key = t
module Tbl:CCHashtbl.S
with type key = t
module Seq:sig
..end
module VarSet:CCSet.S
with type elt = t HVar.t
module VarMap:CCMap.S
with type key = t HVar.t
module VarTbl:CCHashtbl.S
with type key = t HVar.t
val vars_set : VarSet.t -> t -> VarSet.t
val vars : t -> t HVar.t list
val close_forall : t -> t
type
arity_result =
| |
Arity of |
| |
NoArity |
val arity : t -> arity_result
arity ty
returns Arity (a, b)
that means that it
expects a
arguments to be used as arguments of Forall, and
b
arguments to be used for function application. If
it returns NoArity
then the arity is unknown (variable)val expected_args : t -> t list
ty
. The length of the
list expected_args ty
is the same as snd (arity ty)
.val expected_ty_vars : t -> int
val is_ground : t -> bool
val size : t -> int
val depth : t -> int
val open_poly_fun : t -> int * t list * t
open_poly_fun ty
"unrolls" polymorphic function arrows from the left, so that
open_fun (forall a b. f a -> (g b -> (c -> d)))
returns 2; [f a;g b;c], d
.val open_fun : t -> t list * t
open_fun ty
"unrolls" function arrows from the left, so that
open_fun (a -> (b -> (c -> d)))
returns [a;b;c], d
.exception ApplyError of string
Type.apply
failsval apply : t -> t list -> t
ApplyError
if the types do not matchval apply1 : t -> t -> t
apply1 a b
is short for apply a [b]
.val apply_unsafe : t -> InnerTerm.t list -> t
Type.apply
, but assumes its arguments are well-formed
types without more ado.ApplyError
if types do not matchAssert_failure
if the arguments are not proper typesinclude Interfaces.PRINT_DE_BRUIJN
include Interfaces.PRINT
val pp_surrounded : t CCFormat.printer
val pp_typed_var : t HVar.t CCFormat.printer
module TPTP:sig
..end
module Conv:sig
..end