Usually, in Pure Type Systems, the type of a λ/∀
-bound variable is only accessible on its body. That is, on λ (X : A) -> B
, X
is free inside A
and bound in B
. But what if X
was also bound in A
? The typing rules should be updated accordingly, i.e., instead of:
$$ \frac{Γ \vdash A : * \quad Γ, x : A \vdash B : *}{Γ \vdash ∀ (x : A) \rightarrow B : *}$$ $$ \frac{Γ \vdash f : ∀ (x : A) \rightarrow B \quad Γ \vdash a : A}{Γ \vdash f a : [a/x]B}$$
we'd have:
$$ \frac{Γ, x : A \vdash A : * \quad Γ, x : A \vdash B : *}{Γ \vdash ∀ (x : A) \rightarrow B : *}$$ $$ \frac{Γ \vdash f : ∀ (x : A) \rightarrow B \quad Γ \vdash a : [a/x]A}{Γ \vdash f a : [a/x]B}$$
In other words, on the ∀ (x : A) -> B
case, in order to infer the type of A
, we extend the context with x : A
, which is possible, because we know the value of A
. On the application case f a
with f : ∀ (x : A) -> B
, we substitute x
by a
in A
before checking for equality. I have never seen such an approach, though. My question is: was this explored before? If so, is there a name for it so I can look up? If not, is there an obvious reason for it to be undesirable?
(The reason I initially asked this question is I've previously asked if it is possible to implement a halting definition of ind
on the calculus of constructions with equi-recursion. I've noticed one can do so in a setting with mutually recursive definitions, as long as we also allow a λ/∀-bound variable to refer to itself on its type. Here is an example.)
ind
, so that's perhaps a bit too much :-) But don't delete the question. I think the idea still leads to non-terminating terms, I just have to find one that goes around your latest restriction. $\endgroup$