]> matita.cs.unibo.it Git - helm.git/blob - helm/papers/system_T/t.tex
fix
[helm.git] / helm / papers / system_T / t.tex
1 \documentclass[a4paper]{article}
2 \pagestyle{headings}
3 %\usepackage{graphicx}
4 \usepackage{amssymb,amsmath,mathrsfs,stmaryrd,amsthm}
5 %\usepackage{hyperref}
6 %\usepackage{picins}
7
8 \newcommand{\semT}[1]{\ensuremath{\llbracket #1 \rrbracket}}
9 \newcommand{\sem}[1]{\llbracket \ensuremath{#1} \rrbracket}
10 \newcommand{\R}{\;\mathscr{R}\;}
11 \newcommand{\N}{\,\mathbb{N}\,}
12 \newcommand{\NT}{\,\mathbb{N}\,}
13 \newcommand{\NH}{\,\mathbb{N}\,}
14 \renewcommand{\star}{\ast}
15 \renewcommand{\vec}{\overrightarrow}
16 \newcommand{\one}{\mathscr{1}}
17 \newcommand{\mult}{\cdot}
18 \newcommand{\ind}{Ind(X)}
19 \newcommand{\Xind}{\ensuremath{X_{ind}}}
20 \renewcommand{\|}{\ensuremath{\quad | \quad}}
21 \newcommand{\triUP}{\ensuremath{\Delta}}
22 \newcommand{\triDOWN}{\ensuremath{\nabla}}
23 \newcommand{\Rx}{\ensuremath{R_X}}
24
25 \newtheorem{thm}{Theorem}[subsection]
26
27 \title{Modified Realizability and Inductive Types}
28 \author{...}
29
30
31 \begin{document}
32 \maketitle
33
34 \begin{abstract}
35 ...
36 \end{abstract}
37
38 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
39 \section{Introduction}
40 The characterization of the provable recursive functions of 
41 Peano Arithmetic as the terms of system T is a well known
42 result of G\"odel \cite{Godel58,Godel90}. Although several authors acknowledge 
43 that the functional interpretation of the Dialectica paper
44 is not among the major achievements of the author (see e.g. \cite{Girard87}), 
45 the result has been extensively investigated and there is a wide 
46 literature on the 
47 topic (see e.g. \cite{Howard68,Troelstra,Girard87}. 
48
49 A different, more neglected, but for many respects much more 
50 direct relation between Peano (or Heyting) Arithmetics and 
51 G\"odel System T is provided
52 by the so called {\em modified realizability}. Modified realizability
53 was first introduced by Kreisel in \cite{Kreisel59} - although it will take you
54 a bit of effort to recognize it in the few lines of paragraph 3.52 -
55 and later in \cite{Kreisel62} under the name of generalized realizability.
56 The name of modified realizability seems to be due to Troelstra 
57 \cite{Troelstra}
58 - who contested Kreisel's name but unfortunately failed in proposing 
59 a valid alternative; we shall reluctantly adopt this latter name 
60 to avoid further confusion. Modified realizability is a typed variant of 
61 realizability, essentially providing interpretations 
62 of $HA^{\omega}$ into itself: each theorem is realized by a typed function
63 of system T, that also gives the actual computational content extracted 
64 from the proof. 
65 In spite of the simplicity and the elegance of the proof, it is extremely
66 difficult to find a modern discussion of this result; the most recent
67 exposition we are aware of is in the encyclopedic (typewritten!) work by
68 Troelstra \cite{Troelstra} (pp.213-229). Even modern introductory books
69 to Type Theory and Proof Theory devoting much space to system T
70 such as \cite{GLT} and \cite{TS} surprisingly leave out this simple and 
71 illuminating result. Both \cite{GLT} and \cite{TS}
72 prefer to focus on higher order arithmetics and its relation with 
73 Girard's System $F$ \cite{Girard86}, but the technical complexity and
74 the didactical value of the two proofs is not comparable: when you 
75 prove that the Induction Principle is realized by the recursor $R$ 
76 of system $T$ you catch a sudden gleam of understanding in the 
77 students eyes; usually, the same does not happen when you show, say, 
78 that the ``forgetful'' interpretation of the higher order predicate defining
79 the natural numbers is the system $F$ encoding 
80 $\forall X.(X\to X) \to X \to X$ of $\N$. 
81 Moreover, after a first period of enthusiasm, the impredicative 
82 encoding of inductive types in Logical Frameworks has shown several 
83 problems and limitations (see e.g. \cite{Werner} pp.24-25) mostly
84 solved by assuming inductive types as a primitive logical notion
85 (leading e.g. form the Calculus of Constructions to the Calculus
86 of Inductive Constructions - CIC). Even the extraction algorithm of
87 CIC, strictly based on realizability principles, and in a first time
88 still oriented towards System F \cite{Paulin87,Paulin89} has been 
89 recently rewritten \cite{Letouzey04}
90 to take advantage of concrete types and pattern matching of ML-like
91 languages. Unfortunately, systems like the Calculus of Inductive 
92 Constructions are so complex, from the logical point of view, to 
93 substantially prevent a really neat theoretical exposition (at present, 
94 it does not
95 even exists a truly complete consistency proofs covering all aspects
96 of such systems); moreover, not everybody may be interested in all the features
97 offered by these frameworks, from polymorphism to types depending on 
98 proofs. Our program is to restart the analysis of logical systems with
99 primitive inductive types in a smooth way, starting form first order
100 logic and adding little by little small bits of logical power.
101 This paper is the first step in this direction.
102
103 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
104 \section{Heyting's arithmetics}
105
106 {\bf Axioms}
107
108 \begin{itemize}
109 \item $nat\_ind: P(0) \to (\forall x.P(x) \to P(S(x))) \to \forall x.P(x)$ 
110 \item $ex\_ind: (\forall x.P(x) \to Q) \to \exists x.P(x) \to Q$
111 \item $ex\_intro: \forall x.(P \to \exists x.P)$
112 \item $fst: P \land Q \to P$
113 \item $snd: P \land Q \to Q$
114 \item $conj: P \to Q \to P \land Q$
115 \item $false\_ind: \bot \to Q$
116 \item $discriminate:\forall x.0 = S(x) \to \bot$
117 \item $injS: \forall x,y.S(x) = S(y) \to x=y$
118 \item $plus\_O:\forall x.x+0=x$
119 \item $plus\_S:\forall x,y.x+S(y)=S(x+y)$ 
120 \item $times\_O:\forall x.x\mult0=0$
121 \item $times\_S:\forall x,y.x\mult S(y)=x+(x\mult y)$ 
122 \end{itemize}
123
124 \noindent
125 {\bf Inference Rules}
126
127 say that ax:AX refers to the previous Axioms list...
128
129 \[
130   (Proj)\hspace{0.2cm} \Gamma, x:A, \Delta \vdash x:A
131   \hspace{2cm}
132   (Const)\hspace{0.2cm} \Gamma \vdash ax : AX
133 \]
134
135 \[ 
136    (\to_i)\hspace{0.2cm}\frac{\Gamma,x:A \vdash M:Q}{\Gamma \vdash \lambda x:A.M: A \to Q} \hspace{2cm}
137    (\to_e)\hspace{0.2cm}\frac{\Gamma \vdash M: A \to Q \hspace{1cm}\Gamma \vdash N: A}
138     {\Gamma \vdash M N: Q} 
139 \]
140
141 %\[ 
142 %   (\land_i)\frac{\Gamma \vdash M:A \hspace{1cm}\Gamma \vdash N:B}
143 %   {\Gamma \vdash <M,N> : A \land B} 
144 %\hspace{2cm}
145 %   (\land_{el})\frac{\Gamma \vdash A \land B}{\Gamma \vdash A}
146 %\hspace{2cm}
147 %   (\land_{er})\frac{\Gamma \vdash A \land B}{\Gamma \vdash B}  
148 %\]
149
150 \[ 
151    (\forall_i)\hspace{0.2cm}\frac{\Gamma \vdash M:P}{\Gamma \vdash 
152    \lambda x:\N.M: \forall x.P}(*) \hspace{2cm}
153    (\forall_e)\hspace{0.2cm}\frac{\Gamma \vdash M :\forall x.P}{\Gamma \vdash M t: P[t/x]} 
154 \]
155
156
157 %\[ 
158 %   (\exists_i)\frac{\Gamma \vdash P[t/x]}{\Gamma \vdash \exists x.P}\hspace{2cm}
159 %   (\exists_e)\frac{\Gamma \vdash \exists x.P\hspace{1cm}\Gamma \vdash \forall x.P \to Q}
160 %{\Gamma \vdash Q} 
161 %\]
162
163 \section{Extraction}
164
165 The formulae to types translation function 
166 $\sem{\cdot}$ takes in input formulae in HA and returns types in T.
167
168 \begin{enumerate}
169 \item $\sem{A} = \one$ if A is atomic
170 \item $\sem{A \land B} = \sem{A}\times \sem{B}$
171 \item $\sem{A \to B} = \sem{A}\to \sem{B}$
172 \item $\sem{\forall x:\N.P} = \N \to \sem{P}$
173 \item $\sem{\exists x:\N.P} = \N \times \sem{P}$
174 \end{enumerate}
175
176 definition.
177 For any type T of system T $\bot_T: \one \to T$  is inductively defined as follows:
178 \begin{enumerate}
179 \item $\bot_\one = \lambda x:\one.x$
180 \item $\bot_N = \lambda x:\one.0$
181 \item $\bot_{U\times V} = \lambda x:\one.<\bot_{U} x,\bot_{V} x>$
182 \item $\bot_{U\to V} = \lambda x:\one.\lambda \_:U. \bot_{V} x$
183 \end{enumerate}
184
185 \begin{itemize}
186 \item $\sem{nat\_ind} = R$
187 \item $\sem{ex\_ind} = (\lambda f:(\N \to \sem{P} \to \sem{Q}).
188 \lambda p:\N\times \sem{P}.f (fst \,p) (snd \,p)$. 
189 \item $\sem{ex\_intro} = \lambda x:\N.\lambda f:\sem{P}.<x,f>$
190 \item $\sem{fst} = \pi_1$
191 \item $\sem{snd} = \pi_2$
192 \item $\sem{conj} = \lambda x:\sem{P}.\lambda y:\sem{Q}.<x,y>$
193 \item $\sem{false\_ind} = \bot_{\sem{Q}}$
194 \item $\sem{discriminate} = \lambda \_:\N.\lambda \_:\one.\star$
195 \item $\sem{injS}= \lambda \_:\N. \lambda \_:\N.\lambda \_:\one.\star$
196 \item $\sem{plus\_O} = \sem{times\_O} = \lambda \_:\N.\star$
197 \item $\sem{plus\_S} = \sem{times_S} = \lambda \_:\N. \lambda \_:\N.\star$
198 \end{itemize}
199
200 In the case of structured proofs:
201 \begin{itemize}
202 \item $\semT{M N} = \semT{M} \semT{N}$
203 \item $\semT{\lambda x:A.M} = \lambda x:\sem{A}.\semT{M}$
204 \item $\semT{\lambda x:\N.M} = \lambda x:\N.\semT{M}$
205 \item $\semT{M t} = \semT{M} \semT{t}$
206 \end{itemize}
207
208 \section{Realizability}
209 The realizability relation is a relation $f \R P$ where $f: \sem{P}$, and
210 $P$ is a closed formula.
211 In particular:
212 \begin{itemize}
213 \item $\neg (\star \R \bot)$
214 \item $* \R (t_1=t_2)$ iff $t_1=t_2$ is true ...
215 \item $<f,g> \R (P\land Q)$ iff $f \R P$ and $g \R Q$
216 \item $f \R (P\to Q)$ iff for any $m$ such that $m \R P$, $(f \,m) \R Q$
217 \item $f \R (\forall x.P)$ iff for any natural number $n$ $(f n) \R P[\underline{n}/x]$
218 \item $<n,g> \R (\exists x.P)$ iff $g \R P[\underline{n}/x]$
219 \end{itemize}
220 %We need to generalize the notion of realizability to sequents.
221 %Given a sequent $B_1, \ldots, B_n \vdash A$ with free variables in 
222 %$\vec{x} = x_1,\ldots, x_m$, we say that $f \R B1, \ldots, B_n \vdash A$ iff 
223 %forall natural numbers $n_1, \ldots, n_m$, 
224 %if forall $i \in {1,\ldots,n}$ 
225 %$m_i \R B_i[\vec{\underline{n}}/\vec{x}]$ then
226 %$$f <m_1, \ldots, m_n> \R A[\vec{\underline{n}}/\vec{x}]$$.
227 %
228 \noindent
229 We need to generalize the notion of realizability to sequents.\\
230 Let $\vec{x} = FV_{\N}( B_1, \ldots, B_n, P)$ a vector of variables of type
231 $\N$ that occur free in $B_1, \ldots, B_n, P$. Let $\vec{b:B}$ the vector
232 $b_1:B_1, \ldots, b_n:B_n$.\\ 
233 We say that $f \R B_1, \ldots, B_n \vdash A:P$ iff
234 $$\lambda \vec{x:\N}. \lambda \vec{b:B}.f \R 
235 \forall \vec{x}. B_1 \to \ldots \to B_n \to P$$
236 Note that $\forall \vec{x}. B_1 \to \ldots \to B_n \to P$ is a closed formula,
237 so we can use the previous definition of realizability on it.
238
239 \noindent
240 We proceed to prove that all axioms $ax:Ax$ are realized by $\sem{ax}$.
241
242 \begin{itemize}
243 \item $nat\_ind$. 
244   We must prove that the recursion schema $R$ realizes the induction principle.
245   To this aim we must prove that for any $a$ and $f$ such that $a \R P(0)$ and
246   $f \R \forall x.(P(x) \to P(S(x)))$, and any natural number $n$, $(R \,a \,f
247   \,n) \R P(\underline{n})$.\\ 
248   We proceed by induction on n.\\ 
249   If $n=O$, $(R \,a \,f \,O) = a$ and by hypothesis $a \R P(0)$.\\ 
250   Suppose by induction that
251   $(R \,a \,f \,n) \R P(\underline{n})$, and let us prove that the relation
252   still holds for $n+1$.  By definition 
253   $(R \,a \,f \,(n+1)) = f \,n \,(R \,a \,f \,n)$, 
254   and since $f \R \forall x.(P(x) \to P(S(x)))$,  
255   $(f n (R a f n)) \R P(S(\underline{n}))=P(\underline{n+1})$.
256
257 \item $ex\_ind$. 
258   We must prove that $$\underline{ex\_ind} \R (\forall x:(P x)
259   \to Q) \to (\exists x:(P x)) \to Q$$ Following the definition of $\R$ we have
260   to prove that given\\ $f~\R~\forall~x:((P~x)~\to~Q)$ and
261   $p~\R~\exists~x:(P~x)$, then $\underline{ex\_ind}~f~p \R Q$.\\ 
262   $p$ is a couple $<n_p,g_p>$ such that $g_p \R P[\underline{n_p}/x]$, while
263   $f$ is a function such that forall $n$ and for all $m \R P[\underline{n}/x]$
264   then $f~n~m \R Q$ (note that $x$ is not free in $Q$ so $[\underline{n}/x]$
265   affects only $P$).\\
266   Expanding the definition of $\underline{ex\_ind}$, $fst$
267   and $snd$ we obtain $f~n_p~g_p$ that we know is in relation $\R$ with $Q$
268   since $g_p \R P[\underline{n_p}/x]$.
269
270 \item $ex\_intro$.
271   We must prove that 
272   $$\lambda x:\N.\lambda f:\sem{P}.<x,f> \R \forall x.(P\to\exists x.P(x)$$
273   that leads to prove that for each n
274   $\underline{ex\_into}~n \R (P\to\exists x.P(x))[\underline{n}/x]$.\\
275   Evaluating the substitution we have 
276   $\underline{ex\_into}~n \R (P[\underline{n}/x]\to\exists x.P(x))$.\\
277   Again by definition of $\R$ we have to prove that given a 
278   $m \R P[\underline{n}/x]$ then $\underline{ex\_into}~n~m \R \exists x.P(x)$.
279   Expanding the definition of $\underline{ex\_intro}$ we have
280   $<n,m> \R \exists x.P(x)$ that is true since $m \R P[\underline{n}/x]$.
281
282 \item $fst$.
283   We have to prove that $\pi_1 \R P \land Q \to P$, that is equal to proving
284   that for each $m \R P \land Q$ then $\pi_1~m \R P$ .
285   $m$ must be a couple $<f_m,g_m>$ such that $f_m \R P$ and $g_m \R Q$.
286   So we conclude that $\pi_1~m$ reduces to $f_m$ that is in relation $\R$
287   with $P$.
288
289 \item $snd$. The same for $fst$.
290
291 \item $conj$. 
292   We have to prove that 
293   $$\lambda x:\sem{P}. \lambda y:\sem{Q}.<x,y> \R P \to Q \to P \land Q$$
294   Following the definition of $\R$ we have to show that 
295   for each $m \R P$ and for each $n \R Q$ then 
296   $(\lambda x:\sem{P}. \lambda y:\sem{Q}.<x,y>)~m~n \R P \land Q$.\\
297   This is the same of $<m,n> \R P \land Q$ that is verified since 
298   $m \R P$ and $n \R Q$.
299
300
301 \item $false\_ind$. 
302   We have to prove that $\bot_{\sem{Q}} \R \bot \to Q$. 
303   Trivial, since there is no $m \R \bot$.
304
305 \item $discriminate$. 
306   Since there is no $n$ such that $0 = S n$ is true... \\
307   $\underline{discriminate}~n \R 0 = S~\underline{n} \to \bot$ for each n.
308
309 \item $injS$.
310   We have to prove that for each $n_1$ and $n_2$\\
311   $\lambda \_:\N. \lambda \_:\N.\lambda \_:\one.*~n_1~n_2 \R 
312   (S(x)=S(y)\to x=y)[n_1/x][n_2/y]$.\\
313   We assume that $m \R S(n_1)=S(n_2)$ and we have to show that 
314   $\lambda \_:\N. \lambda \_:\N.\lambda \_:\one.*~n_1~n_2~m$ that reduces to
315   $*$ is in relation $\R$ with $n_1=n_2$. Since in the standard model of 
316   natural numbers  $S(n_1)=S(n_2)$ implies $n_1=n_2$ we have that 
317   $* \R n_1=n_2$.
318
319 \item $plus\_O$. 
320   Since in the standard model for natural numbers $0$ is the neutral element
321   for addition $\lambda \_:\N.\star \R \forall x.x + 0 = x$.
322
323 \item $plus\_S$.
324   In the standard model of natural numbers the addition of two numbers is the 
325   operation of counting the second starting from the first. So
326   $$\lambda \_:\N. \lambda \_:\N. \star \R \forall x,y.x+S(y)=S(x+y)$$.
327
328 \item $times\_O$.
329   Since in the standard model for natural numbers $0$ is the absorbing element
330   for multiplication $\lambda \_:\N.\star \R \forall x.x \mult 0 = 0$.
331   
332 \item $times\_S$.
333   In the standard model of natural numbers the multiplications of two 
334   numbers is the operation of adding the first to himself a number of times
335   equal to the second number. So
336   $$\lambda \_:\N. \lambda \_:\N. \star \R \forall x,y.x+S(y)=S(x+y)$$.
337   
338 \end{itemize}
339
340 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
341 \section{Inductive types}
342 The notation we will use is similar to the one used in 
343 \cite{Werner} and \cite{Paulin89} but we prefer
344 giving a label to each constructor and use that label instead of the
345 longer $Constr(n,\ind\{\ldots\})$ to indicate the $n^{th}$ constructor.
346 We adopt the vector notation to make things more readable.
347 $\vec{m}$ has to be intended as $m_1~\ldots~m_n$ where $n$ may
348 be equal to 0 (we use $m_1~\vec{m}$ when we want to give a
349 name to the first $m$ and assert $n>0$). If the vector notation is
350 used inside an arrow type it has a slightly different meaning, 
351 $A \to \vec{B} \to C$ is a shortcut for 
352 $A \to B_1 \to \ldots \to B_n \to C$.
353
354 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
355 \subsection{Extensions to the logic framework}
356 To talk about arbitrary inductive types (and not hard coded natural numbers) we
357 have to extend a bit our framework.
358
359 First we admit quantification over inductive types $T$, thus $\forall x:T.A$
360 and $\exists x:T.A$ are allowed. Then rules 4 and 5 of the $\sem{\cdot}$
361 definition are replaced by $\sem{\forall x:T.P} = T \to \sem{P}$ and
362 $\sem{\exists x:T.P} = T \times \sem{P}$.
363
364 For each inductive type we will describe the formation rules and the
365 corresponding induction principle schema.
366
367 Symmetrically we have to extend System T with arbitrary inductive types and 
368 we will see how theyr recursors are defined in the following sections. 
369
370 The definition of $\R$ is modified substituting each occurrence of $\N$ with 
371 a generic inductive type $T$.
372
373 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
374 \subsection{Type definition}
375 $$\ind\{c_1:C(X); \ldots ; c_n:C(X)\}$$
376 $$C(X) ::= X \| T \to C(X) \| X \to C(X)$$
377 In the second case we mean $T \neq X$.
378
379 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
380 \subsection{Induction principle}
381 The induction principle for an inductive type $X$ and a predicate $Q$ 
382 is a constant with the following type
383 $$\Xind:\vec{\triUP\{C(X), c\}} \to \forall t:X.Q(x)$$
384 $\triUP$ takes a constructor type $C(X)$ and a term $c$ (initially $c$ is a
385 constructor of X, and $c:C(X)$) and is defined by recursion as follows:
386 \begin{eqnarray}
387 \triUP\{X, c\} & = & Q(c) \nonumber\\
388 \triUP\{T \to C(X), c\} & = & 
389         \forall m:T.\triUP\{C(X),c~m\} \nonumber\\
390 \triUP\{X \to C(X), c\} & = & 
391         \forall t:X.Q(t) \to \triUP\{C(X), c~t\} \nonumber
392 \end{eqnarray}
393
394 %%%%%%%%%%%%%%%%%%%%%
395 \subsection{Recursor}
396 \subsubsection{Type}
397 The type of the recursor $\Rx$ on an inductive type $X$ is
398 $$\Rx : \vec{\square\{C(X)\}} \to X \to \alpha$$
399 $\square$ is defined by recursion on the constructor type $C(X)$.
400 \begin{eqnarray}
401 \square\{X\} & = & \alpha \nonumber \\
402 \square\{T \to C(X)\} & = & T \to \square\{C(X)\}\nonumber \\
403 \square\{X \to C(X)\} & = & X \to \alpha \to \square\{C(X)\}\nonumber 
404 \end{eqnarray}
405 \subsubsection{Reduction rules}
406 We say that 
407 $$\Rx~\vec{f}~(c_i~\vec{m}) \leadsto
408 \triDOWN\{C(X)_i, f_i, \vec{m}\}$$
409 $\triDOWN$ takes a constructor type $C(X)$, a term $f$ 
410 (of type $\square\{C(X)\}$) and is defined by recursion as follows:
411 \begin{eqnarray}
412 \triDOWN\{X, f, \} & = & f\nonumber \\
413 \triDOWN\{T \to C(X), f, m_1~\vec{m}\} & = &
414         \triDOWN\{C(X), f~m_1, \vec{m}\}\nonumber \\
415 \triDOWN\{X \to C(X), f, m_1~\vec{m}\} & = & 
416         \triDOWN\{C(X), f~m_1~(\Rx~\vec{f}~m_1),
417         \vec{m}\}\nonumber
418 \end{eqnarray}
419 We assume $\Rx~\vec{f}~(c_i~\vec{m})$ is well typed, so in the first case we
420 can omit $\vec{m}$ since it is an empty sequence.
421
422 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
423 \subsection{Realizability of the induction principle}
424 Once we have inductive types and their induction principle we want to show that
425 the recursor $\Rx$ realizes $\Xind$, that is that $\Rx$ has type 
426 $\sem{\Xind}$ and is in relation $\R$ with $\Xind$. 
427
428 \begin{thm}$\Rx : \sem{\Xind}$\end{thm}
429 \begin{proof}
430 We have to compare the definition of $\square$ and $\triUP$
431 since they play the same role in constructing respectively the types of 
432 $\Rx$ and
433 $\Xind$. If we assume $\alpha = \sem{Q}$ and we apply the $\sem{\cdot}$
434 function to each right side of the $\triUP$ definition we obtain
435 exactly $\square$. The last two elements of the arrows $\Rx$ and
436 $\Xind$ are again the same up to $\sem{\cdot}$.
437 \end{proof}
438
439 \begin{thm}$\Rx\R \Xind$\end{thm}
440 \begin{proof}
441 To prove that $\Rx\R \Xind$ we must assume that for each $i$ index
442 of a constructor of $X$, $f_i \R \triUP\{C(X)_i, c_i\}$ and we
443 have to prove that for each $t:X$
444 $$\Rx~\vec{f}~t \R Q(t)$$
445 \noindent
446 We proceed by induction on the structure of $t$.
447 \\
448 The base case is when the
449 type of the head constructor of $t$ has no recursive arguments (i.e. the type
450 is generated using only the first two rules $C(X)$), so
451 $(\Rx~\vec{f}~(c_i~\vec{m}))$ reduces in one step to $(f_i~\vec{m})$.  $f_i$
452 realizes $\triUP\{C(X)_i, c_i\}$ by assumption and since we are in the base
453 case $\triUP\{C(X)_i, c_i\}$ is of the form $\vec{\forall t:T}.Q(c_i~\vec{t})$.
454 Thus $f_i~\vec{m} \R Q(c_i~\vec{m})$.
455 \\ 
456 In the induction step we have as induction hypothesis that for each recursive
457 argument $t_i$ of the head constructor $c_i$, $r_i\equiv
458 \Rx~\vec{f}~t_i \R Q(t_i)$. By the third rule of $\triDOWN$ we obtain the reduct
459 $f_i~\vec{m}~\vec{t~r}$ (here we write first all the non recursive arguments,
460 then all the recursive one. In general they can be mixed and the proof is
461 exactly the same but the notation is really heavier). We know by hypothesis
462 that $f_i \R \triUP\{C(X)_i, c_i\} \equiv \vec{\forall m:T}.\vec{\forall
463 t:X.Q(t)} \to Q(c_i~\vec{m}~\vec{t})$, thus $f_i~\vec{m}~\vec{t~r} \R
464 Q(c_i~\vec{m}~\vec{t})$.
465 \end{proof}
466
467
468 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
469 \begin{thebibliography}{}
470 \bibitem{Girard86}G.Y.Girard. The system F of variable types, fifteen
471 years later. Theoretical Computer Science 45, 1986.
472 \bibitem{Girard87}G.Y.Girard. Proof Theory and Logical Complexity. 
473 Bibliopolis, Napoli, 1987.
474 \bibitem{GLT}G.Y.Girard, Y.Lafont, P.Tailor. Proofs and Types.
475 Cambridge Tracts in Theoretical Computer Science 7.Cambridge University
476 Press, 1989.
477 \bibitem{Godel58}K.G\"odel. \"Uber eine bisher noch nicht ben\"utzte Erweiterung
478 des finiten Standpunktes. Dialectica, 12, pp.34-38, 1958.
479 \bibitem{Godel90}K.G\"odel. Collected Works. Vol.II, Oxford University Press,
480 1990.
481 \bibitem{Howard68}W.A.Howard. Functional interpretation of bar induction
482 by bar recursion. Compositio Mathematica 20, pp.107-124. 1958
483 \bibitem{Howard80}W.A.Howard. The formulae-as-types notion of constructions.
484 in J.P.Seldin and j.R.Hindley editors, to H.B.Curry: Essays on Combinatory 
485 Logic, Lambda calculus and Formalism. Acedemic Press, 1980.
486 \bibitem{Kreisel59} G.Kreisel. Interpretation of analysis by means of
487 constructive functionals of finite type. In. A.Heyting ed. 
488 {\em Constructivity in mathematics}. North Holland, Amsterdam,1959.
489  \bibitem{Kreisel62} G.Kreisel. On weak completeness of intuitionistic 
490 predicatelogic. Journal of Symbolic Logic 27, pp. 139-158. 1962.
491 \bibitem{Letouzey04}P.Letouzey. Programmation fonctionnelle 
492 certifi\'ee; l'extraction
493 de programmes dans l'assistant Coq. Ph.D. Thesis, Universit\'e de 
494 Paris XI-Orsay, 2004.
495 \bibitem{Loef}P.Martin-L\"of. Intuitionistic Type Theory.
496 Bibliopolis, Napoli, 1984.
497 \bibitem{Paulin87}C.Paulin-Mohring. Extraction de programme dans le Calcul de
498 Constructions. Ph.D. Thesis, Universit\'e de 
499 Paris 7, 1987.
500 \bibitem{Paulin89}C.Paulin-Mohring. Extracting $F_{\omega}$ programs 
501 from proofs in the Calculus of Constructions. In proc. of the Sixteenth Annual 
502 ACM Symposium on 
503 Principles of Programming Languages, Austin, January, ACML Press 1989.
504 \bibitem{Sch}K.Sch\"utte. Proof Theory. Grundlehren der mathematischen 
505 Wissenschaften 225, Springer Verlag, Berlin, 1977.
506 \bibitem{Troelstra}A.S.Troelstra. Metamathemtical Investigation of 
507 Intuitionistic
508 Arithmetic and Analysis. Lecture Notes in Mathematics 344, Springer Verlag,
509 Berlin, 1973.
510 \bibitem{TS}A.S.Troelstra, H.Schwichtenberg. Basic Proof Theory.
511 Cambridge Tracts in Theoretical Computer Science 43.Cambridge University
512 Press, 1996.
513 \bibitem{Werner}B.Werner. Une Th\'eorie des Constructions Inductives.
514 Ph.D.Thesis, Universit\'e de Paris 7, 1994.
515
516
517 \end{thebibliography}
518
519 \end{document}
520