In Girard's Proofs and Types, under item 11.3.5, second-order existential quantification is encoded in System F using universal quantification as follows:
$$ \Sigma X.V \equiv \Pi Y. (\Pi X.(V \to Y)) \to Y $$
Is it possible to prove this encoding is correct using natural deduction or sequent calculus? In other words, is it possible to prove the following in System F extended with existentials?
$$ (1)\quad \Sigma X.V \vdash \Pi Y. (\Pi X.(V \to Y)) \to Y \\ (2)\quad \Pi Y. (\Pi X.(V \to Y)) \to Y \vdash \Sigma X.V $$
I think I can prove (1), but not (2).
In case these propositions are invalid, how can we be sure the encoding is correct?
Thank you.
PS.
I understand intuitively why the encoding makes sense, but would like to understand the formal reasons.
This encoding is widespread, but I can't find a proof of its validity. In Haskell, for example, it is used to simulate existential types and in similar questions such as this one the explanation is informal. In this self-answered question, which attempts to produce a proof, I think there are errors involving invalid variable capturing.
Edit: Proof attempt of (2) based on Andrej's answer
I. $$ { \Pi Y. (\Pi X.(VX \to Y)) \to Y \over (\Pi X.(VX \to (\Sigma Z. V Z))) \to (\Sigma Z. V Z) } \, \Pi E $$
II. $$ { \hspace{8em} \over VT } u \\ { \hspace{8em} \over \Sigma Z. VZ } \Sigma I \\ { \hspace{10em} \over V T \to (\Sigma Z. VZ) } \to I_u \\ { \hspace{10em} \over \Pi X. (V X \to (\Sigma Z. VZ)) } \Pi I_T $$
III. From I and II: $$ { \quad (\Pi X. (V X \to (\Sigma Z. V Z))) \to (\Sigma Z. V Z) \qquad \Pi X. (V X \to (\Sigma Z. V Z)) \quad \over \Sigma Z. VZ } \to E $$
For second-order logic with Natural Deduction, you can see :
or :
Both prove :
See van Dalen, page 150, Theorem 5.5 (e) :
Proof
$${ [∀X^n(\varphi→X)] \over (\varphi→X) } \, (\forall^2E)$$
$${ [\varphi] \quad (\varphi→X) \over X } \, (\rightarrow E)$$
$${ ∀X^n(\varphi→X)→X \over (\varphi→X) } \, (\rightarrow I) \, \text{(discharging the 1st assumption)}$$
$${ \exists X^n \varphi \quad ∀X^n(\varphi→X)→X \over ∀X^n(\varphi→X)→X } \, (\exists^2E) \, \text{(discharging the 2nd assumption)}$$
$${ ∀X^n(\varphi→X)→X \over \forall X(∀X^n(\varphi→X)→X) } \, (\forall^2I) $$
Thus :
For the other direction :
$${ [\varphi] \over \exists X^n \varphi } \, (\exists^2I)$$
$${ \varphi \rightarrow \exists X^n \varphi \over \forall X^n (\varphi \rightarrow \exists X^n \varphi) } \, (\forall^2I)$$
In parallel :
$${∀X^0(∀X^n(\varphi \rightarrow X^0) \rightarrow X^0) \over ∀X^n(\varphi \rightarrow \exists X^n \varphi ) \rightarrow \exists X^n \varphi } \, (\forall^2E)$$
$${ \forall X^n (\varphi \rightarrow \exists X^n \varphi) \quad ∀X^n(\varphi \rightarrow \exists X^n \varphi ) \rightarrow \exists X^n \varphi \over \exists X^n \varphi} \, (\rightarrow E)$$
Thus :
Note
For the rules, see page 147; in particular :
and :
where