Legend:
Library
Module
Module type
Parameter
Class
Class type
Types
Main Type representation
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 representing AC operators (+, ...)
Number of arguments the type expects. If 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)
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.
returns
the return type, the number of type variables, and the list of all its arguments
Given a function/forall type, and arguments, return the type that results from applying the function/forall to the arguments. No unification is done, types must check exactly.
User-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.