I would like to ask if the following proof is correct:
$\exists X.B\Leftrightarrow \forall Y. (\forall X. B\to Y)\to Y$
Starting with a $B\in\Gamma$ in the sequent set and:
$\exists X.B\Rightarrow \forall Y. (\forall X. B\to Y)\to Y$
Applying the $\Rightarrow_i$ rule, I'll obtain $\Gamma=\Gamma\cup\{\exists X.B\}$ and:
$\forall Y. (\forall X. B\to Y)\to Y$
Hereby, using $\forall_i$ with a $C\notin \Gamma$, I will obtain:
$(\forall X. B\to C)\to C$
Using again $\Rightarrow_i$ and $\Gamma=\Gamma\cup\{\forall X. B\to C\}$ I will now have to provide a proof for $C$ (*). Now i will start from the shared hypothesis
$(\forall X. B\to C)$
and using $\forall_e$ with $D$ as $X$ I will obtain the $B\to C$ hypothesis (H1). From the shared hypothesis:
$\exists X.B.$
and applying the $\exists_e$ rule with $D$ as $X$, I will obtain the $B$ hypothesis (H2). Hence, I could use H1 and H2 to obtain the $C$ (*):
$\frac{B\to C\;(H1)\qquad B\;(H2)}{C\;(*)}$
Now I believe that this demonstration is wrong in the elimination of the existential but, how could I proof the vice versa (the right to left implication)? Thanks in advance.
Edit:
I would like then to proof that the existential Type could be expressed with an universal form, hence my proof given above. In fact, using the Curry-Howard isomorphism, I could also express some connectives as conjunction, disjunction of formulas with this encoding, so:
$A\wedge B\equiv\forall X.(A\to B\to X)\to X$.
and for disjunction:
$A\vee B\equiv\forall X.(A\to X)\to (B\to X)\to X$
If you read the "Types and programming languages" by Benjamin Pierce at chapter 24, section 3, page 377 it states that: “The encoding of pairs as a polymorphic type... suggests a similar encoding for existential types in terms of universal types, using the intuition that an lement of an existential type is a pair of a type and a value”:
$\{\exists X,T\}\equiv\forall Y.(\forall X.T\to Y)\to Y$
So, the whole construction will be defined as:
$\{S^\ast,t\}\;as\;\{\exists X,T\}\equiv \lambda Y.\lambda f:(\forall X.T\to Y).\;f\;[S]\;t$
The unpacking funtion could be defined as:
$let\{X,x\}=t_1\;in\;t_2\equiv t_1[T_2](\lambda X.\lambda x:T_{11}.t_2) $
Infact, using the Matita Interactive Theorem Prover, the existential type is encoded as:
inductive ex (A:Type[0]) (P:A → Prop) : Prop ≝ ex_intro: ∀ x:A. P x → ex A P.
that has the following type:
$(\forall A: Type[0] .(A\to Prop)\to Prop)$
In particular, i could give the following proofs of what I want:
lemma test: ∀B:Prop. (∃X:Prop. B)→(∀Y:Prop. (∀X:Prop. B→Y)→Y).
#B * #e #b #Y #H lapply (H B) #H2 lapply (H2 b) #H @H qed.
lemma test2: ∀B:Prop. (∀Y:Prop. (∀X:Prop. B→Y)→Y)→(∃X:Prop. B).
#B #H lapply (H B) #H2 % [ 2: @H2 #H3 #I @I | @False]
My problem hence is giving the former proofs in a natural deduction way. Thanks again.
