This paper introduces λ , a simply typed lambda calculus supporting inductive types and recursive function definitions with termination ensured by types. The system is shown to enjoy subject reduction, strong normalisation of typable terms and to be stronger than a related system λ G in which termination is ensured by a syntactic guard condition. The system can, at will, be extended to support coinductive types and corecursive function definitions also.Type-based termination of recursive definitions 103 2 ι-reduction → ι is defined as the compatible closure of the rulewhere # a = ar(c i ). 3 µ-reduction → µ is defined as the compatible closure of the ruleRemark 2.4. Our formulation of the β-and µ-reduction rules relies on a variable convention: in the β-rule, the bound variables of e are assumed to be different from the free variables of e ; in the µ-rule, the bound and the free variables of e are assumed to be different.The mechanics of the reduction calculus is illustrated by the following example. Example 2.5. Consider the inductive type of natural numbers Nat with C(Nat) = {o, s}. Let plus ≡ (letrec plus = λx. λy. case x of {o ⇒ y | s ⇒ λx . s (plus x y)}). The following is a reduction sequence that computes one plus two, where, as usual, β denotes the reflexive and transitive closure of → β . plus (s o) (s (s o)) → µ (λx. λy. case x of {o ⇒ y | s ⇒ λx . s (plus x y)}) (s o) (s (s o)) β case s o of {o ⇒ s (s o) | s ⇒ λx . s (plus x (s (s o)))} → ι (λx . s (plus x (s (s o)))) o → β s (plus o (s (s o))) → µ s ((λx. λy. case x of {o ⇒ y | s ⇒ λx . s (plus x y)}) o (s(s o))) β s (case o of {o ⇒ s (s o) | s ⇒ λx . s (plus x (s (s o)))}) → ι s (s (s o))
Types and typing systemWe now assume we are given two denumerable sets V T of type variables and V S of stage variables, and adopt the naming convention that α, α , α i , β, δ, . . . range over V T , and ı, , . . . range over V S . Proceeding from these, we define stage and type expressions. Stage expressions are built of stage variables, a symbol for the successor function on stages, and a symbol for the limit stage. A type expression is either a type variable, a function type expression or a datatype approximation expression.
Definition 2.6 (Stages and types).1 The set S of stage expressions is given by the abstract syntax: s, r ::= ı | ∞ | s.