$\begingroup$

Suppose we extended the CoC with primitive recursion; that is, we added a term µ x . t such that equality allowed unrolling recursive terms:

Γ |- µ x . a : * Γ |- b : * Γ |- a [a/x] == b --------------------------------------------------- Γ |- a == b

And such that applying a recursive term to an argument unrolled it:

((µ x . a : T) q) ~> (a[a/x] q)

It seems that even that way, deriving induction wouldn't be possible. I've attempted the following (using Morteish syntax):

NAT = ∀ (P : *) -> ∀ (Zero : P) -> ∀ (Succ : NAT -> P) -> P Zero = λ (P : *) -> λ (Zero : P) -> λ (Succ : NAT -> P) -> Zero Succ = λ (n : NAT) -> λ (P : *) -> λ (Zero : P) -> λ (Succ : NAT -> P) -> Succ n induction = λ (P : NAT -> *) -> λ (Z : P Zero) -> λ (S : ∀ (n : NAT) -> P n -> P (Succ n)) -> λ (n : NAT) -> n (P n) Z (λ (pred : NAT) -> S n (induction P Z S pred))

The problem here is that, when pattern-matching n on the definition of induction , we need to specify a return type. By specifying it to be P n , we get an error because, on the first case,

Z : P Zero

But should be:

Z : P n

And, on the second case,

(λ (p : NAT) -> S p (induction P Z S p)) : ∀ (p : NAT) -> P (Succ p)

But should be:

(λ (p : NAT) -> S p (induction P Z S p)) : ∀ (x : NAT) -> P n

The source of the problem seems to be that the system doesn't recognize that the following holds:

case n of Zero -> ... here, n == Zero ... Succ p -> ... here, n == Succ p ...