In System F, the type exists a. P
can be encoded as forall b. (forall a. P -> b) -> b
in the sense that any System F term using an existential can be expressed in terms of this encoding respecting the typing and reduction rules.
In "Types and Programming Languages", the following exercise appears:
Can we encode universal types in terms of existential types?
My intuition says that this isn't possible because in some way the "existential packaging" mechanism simply isn't as powerful as the "type abstraction" mechanism. How do I formally show this?
I am not even sure what I need to prove to formally show this result.
T ~ (forall a. (T->a)->a)
where we can takeT = exists b. f b
and exploit the type isomorphism(T->a) ~ (forall b. f b -> a)
, leading to the encoding above. The analogous strategy would be using co-YonedaT ~ (exists a. a * (a -> T))
, but hereT
is in positive (covariant) position, so choosingT ~ (forall b. f b)
does not allow to turnforall
into someexists
. – Assertion∃xφ(x)↔¬∀x¬φ(x)
, ◦∃x(φ(x)→∀yφ(y))
, ◦∀x(φ(x)∨¬φ(x))
. In intuitionistic logic these formulas do not hold, although the following do. ◦∃xφ(x)→¬∀x¬φ(x)
, ◦∀x¬¬(φ(x)∨¬φ(x))
.² See: ¹cs.nott.ac.uk/~psznza/papers/Alechina++:01a.pdf ²phil.uu.nl/~iemhoff/Mijn/Slides/seattle17.pdf – Sultanate