pub fn infer_type(ctx: &Context, term: &Term) -> KernelResult<Term>Expand description
Infer the type of a term in a context.
This is the main entry point for type checking. It implements bidirectional type inference for the Calculus of Constructions.
§Type Rules
Type n : Type (n+1)- Universes form a hierarchyx : Aifx : Ain context - Variable lookupΠ(x:A). B : Type max(i,j)ifA : Type iandB : Type jλ(x:A). t : Π(x:A). Bift : Bin extended contextf a : B[x := a]iff : Π(x:A). Banda : A
§Errors
Returns KernelError variants for:
- Unbound variables
- Type mismatches in applications
- Invalid match constructs
- Termination check failures for fixpoints