Statistiques
| Révision :

root / CSL16 / wfm.tex @ 68

Historique | Voir | Annoter | Télécharger (23,77 ko)

1
\section{Witness function method}
2
We now prove the converse to the last section: any provably convergent function in $\arith$ is polynomial-time computable.
3
To this end we use the so-called \emph{witness function method} (WFM), a common technique in {bounded arithmetic}.
4
Usually, the idea is to rely on free-cut elimination to control the quantifer complexity of formulae occurring in a proof.
5
Here we furthermore rely on free-cut elimination to control the use of contraction in a proof, to which we have access via the modalities of linear logic.
6

    
7
The WFM differs from realisability and Dialectica style witnessing arguments mainly since it does not require functionals at higher type. Instead a translation is conducted directly from a proof in De Morgan normal form, i.e.\ with negation pushed to the atoms, relying crucially on classical logic. Free-cut elimination is employed to control the logical complexity of formulae occurring in a proof, and a formal `witness' predicate plays a similar role to the realisability predicate.
8

    
9
The combination of De Morgan normalisation and free-cut elimination plays a similar role to the double negation translation, and this is even more evident in our setting where the transformation of a classical proof to anchored form can be seen to be a partial `constructivisation' of the proof. As well as eliminating the (nonconstructive) occurrences of the $\forall$-right rule, as usual for the WFM, the linear logic refinement of the logical connectives means that right-contraction steps is also eliminated. This is important due to the fact that we are in a setting where programs are equational specifications, not formulae (as in bounded arithmetic) or $\lambda$-terms (as in applicative theories), so we cannot in general evaluate atomic formulae.
10

    
11
%Some key features of this method are the following:
12
%\begin{itemize}
13
%	\item T
14
%\end{itemize}
15
%
16
%Key features/differences from realisability:
17
%\begin{itemize}
18
%	\item De Morgan normal form: reduces type level to $0$, complementary to double-negation translation that \emph{increases} type level.
19
%	\item Free-cut elimination: allows us to handles formulae of fixed logical complexity throughout the proof. 
20
%	\item Respects logical properties of formulae, e.g.\ quantifier complexity, exponential complexity.
21
%\end{itemize}
22
%
23
%\todo{say some more here}
24
%
25
%\todo{compare with applicative theories}
26
%
27
%\anupam{in particular, need to point out that this argument is actually something in between, since usually the WFM requires programs to be defined by formulae, not equational specifications.}
28

    
29
\newcommand{\type}{\mathtt{t}}
30
\newcommand{\norm}{\nu}
31
\newcommand{\safe}{\sigma}
32

    
33

    
34
		
35
		\subsection{The translation}
36
		
37
We will associate to each (free-cut free) proof of a convergence statement in $\arith$ a function on $\Word$ defined by a BC program. In the next section we will show that this function satisfies the equational specification of the convergence statement, hence showing that any provably convergent function of $\arith$ is polynomial-time computable.
38
		
39
		\begin{definition}
40
			[Typing]
41
			To each $\sigone$-formula $A$ we associate a sorted tuple of variables $\type (A)$, intended to range over $\Word$, as follows:
42
			\[
43
			\begin{array}{rcll}
44
			\type (\nat (t)) & := & (;x^{\nat (t)} ) & \\
45
			\type(s = t) & := & ( ; x^{s = t}) & \\
46
			\type (A \lor B)  & : = & (\vec u , \vec v ; \vec x , \vec y) & \text{if $\type(A) = (\vec u ; \vec x)$ and $\type(B) = (\vec v ; \vec y)$.} \\
47
			\type (A \land B)  & : = & (\vec u , \vec v ; \vec x , \vec y) & \text{if $\type(A) = (\vec u ; \vec x)$ and $\type(B) = (\vec v ; \vec y)$.} \\
48
			\type (! A) & : = & ( \vec u ,\vec x  ; ) & \text{if $\type(A) = (\vec u ; \vec x )$.} \\
49
			\type (\exists x^\nat . A) & := & (\vec u ; \vec x , y) & \text{if $\type (A) = (\vec u ; \vec x)$.}
50
			%	\type (\forall x^N . A) & := & \Nat \to \type(A)
51
			\end{array}
52
			\]
53
			For a sorted tuple $(\vec u ; \vec x)$ we write $|(\vec u ; \vec x)|$ to denote its length, i.e.\ $|\vec u| + |\vec x|$.
54
			%	where $\nu$ designates that the inputs are normal.
55
		\end{definition}
56
		
57
		
58
%		\anupam{need to account for normality and safety somewhere. Attempting inlined and leaving types without this decoration.}
59
%		
60
%		\begin{remark}
61
%			[Distribution of $!$]
62
%			There is a potential issue that the $!$ contains $\lor$ symbols in its scope, whence we do not in general have $!(A \lor B) \cong !A \lor !B$. However this will not be a problem here by inspection of a convergence statement: there are no $\lor$ symbols in the scope of a $!$. Therefore, after free-cut elimination, no formula in the proof will have this property either.
63
%			
64
%			On the other hand, since we are working in affine logic, we do in general have $!(A \land B) \cong !A \land !B$.
65
%		\end{remark}
66
		
67
		This sorted tuple corresponds to the input variables, normal and safe, for the BC programs that we will define. It becomes important here that we are considering proofs of a convergence statement, since a free-cut free $\arith$-proof of a convergence statement cannot contain any $\lor$ symbols in the scope of a $!$. This could cause an issue in the above definition since we do not in general have the equivalence $!(A \lor B) \equiv !A \lor !B$. On the other hand, the equivalence $!(A\land B) \equiv !A \land !B$ follows since we are in the affine setting.
68
		
69
	
70
		Let us fix a particular equational specification $\eqspec(f)$. Rather than directly considering $\arith$-proofs of $\conv ( f , \eqspec )$, we will consider a $\closure{\eqspec} \cup \arith $ sequent proof of $\word (\vec x) \seqar \word (f (\vec x) )$, under Lemma~\ref{lemma:spec-norm-form}. 
71
		
72
		Our crucial use of free-cut elimination is in the following result, which yields strong regularity properties:
73
		
74
		\begin{proposition}
75
			[Freedom]
76
	A free-cut free $\closure{\eqspec} \cup \arith $ sequent proof of $\word (\vec x) \seqar \word (f (\vec x) )$ is:
77
	\begin{enumerate}
78
		\item Free of any negation symbols.
79
		\item Free of any $\forall$ symbols.
80
		\item Free of any $?$ symbols.
81
	\end{enumerate}
82
		\end{proposition}
83
		
84
		
85
		For this reason we can assume that $\type$ is well-defined for all formulae occurring in a free-cut free proof of convergence, and so we can proceed with the translation from proofs to BC programs.
86
		
87
		\begin{definition}
88
			[Translation]
89
			We give a translation from a free-cut free $\closure{\eqspec}$ proof $\pi$, containing no $\bot,?,\forall$ symbols, of a sequent $\Gamma \seqar \Delta$, to BC programs for a vector of functions $\vec f^\pi$ with argument of type $\type \left(\bigotimes\Gamma\right)$ such that $|\vec f^\pi | = | \type\left(\bigparr\Delta\right)|$.
90
			
91
			
92
			The translation is by induction on the size of a free-cut free proof, so we proceed by analysis of the final step of a proof.
93
			
94
			First we consider the base cases. If $\pi$ is an instance of the initial rules $\geneps, \sepeps^0 , \sepeps^1, \sepzer, \sepone$ or $\inj$ then $\vec f^\pi$ is simply the constant function $\epsilon$ (possibly with dummy inputs as required by $\type$).\footnote{This is because proofs of equality can be seen to carry no computational content.}
95
			The other initial steps of $\arith$ are translated as follows:
96
			\[
97
			\begin{array}{ccc}
98
%			\vlinf{\nat_\epsilon}{}{\seqar \nat (\epsilon)}{}
99
%			& : &
100
%			\epsilon
101
%			\\ 
102
			\vlinf{\genzer}{}{\word(t) \seqar \word(\succ_0 t)}{}
103
			& \quad :\quad  &
104
			\succ_0 ( ;x) 
105
			\\
106
			\vlinf{\genone}{}{\word(t) \seqar \word(\succ_1 t)}{}
107
			& \quad : \quad & 
108
			\succ_1 (; x)
109
			\\
110
%			\vlinf{\epsilon^0}{}{ \nat (t)  , \epsilon = \succ_0 t \seqar }{} 
111
%			& : &
112
%			\epsilon
113
%			\\
114
%			\vlinf{\epsilon^1}{}{ \nat (t)  , \epsilon = \succ_1 t \seqar }{}
115
%			& : &
116
%			\epsilon
117
%			\\
118
%			\vlinf{\succ_0}{}{\nat (s) , \nat (t)  , \succ_0 s = \succ_0 t\seqar s = t }{}
119
%			& : &
120
%			\epsilon
121
%			\\
122
%			\vlinf{\succ_1}{}{\nat (s) , \nat (t)  , \succ_1 s = \succ_1 t\seqar s = t }{}
123
%			& : &
124
%			\epsilon
125
%			\\
126
%			\vlinf{\inj}{}{\nat(t), \succ_0 t = \succ_1 t \seqar}{}
127
%			& : &
128
%			\epsilon
129
%			\\
130
			\vlinf{\surj}{}{\word (t) \seqar t = \epsilon \laor \exists y^\word . t = \succ_0 y \laor \exists y^\word. t = \succ_1 y }{}
131
			&\quad : \quad  &
132
			( \epsilon , \pred (  ;x) , \pred (;x ) )
133
			\\
134
				\vlinf{\wordcntr}{}{\word(t) \seqar \word(t) \land \word(t) }{}
135
				& \quad  : \quad &
136
				( \id (;x) , \id (;x) )
137
			\end{array}
138
			\]
139
			Finally an $\closure{\eqspec}$ initial step is also translated simply to $\epsilon$.
140
			
141
		
142
			
143
			
144
			Now we consider the inductive cases.
145
			Suppose $\pi$ ends with a $\rigrul{\land}$ step:
146
			\[
147
			\vlderivation{
148
				\vliin{\land}{}{ \Gamma, \Sigma \seqar \Delta, \Pi, A\land B }{
149
					\vltr{\pi_1}{ \Gamma \seqar \Delta, A }{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
150
				}{
151
				\vltr{\pi_2}{ \Sigma \seqar \Pi, B }{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
152
			}
153
		}
154
		\]
155
		By the inductive hypothesis let us suppose we have functions $\vec g (\vec u; \vec x)$ and $\vec h (\vec v ; \vec y)$ from $\pi_1$ and $\pi_2$ respectively, where $\type\left( \bigotimes\Gamma \right) = (\vec u; \vec x)$ and $\type \left( \bigotimes \Sigma \right) = (\vec v ; \vec y)$. Let us write $\vec g = (\vec g^\Delta , \vec g^A)$ and $\vec h = (\vec h^\Pi , \vec h^B)$, to denote the $\Delta$ and $A$ parts of $\vec g$ and the $\Pi$ and $B$ parts of $\vec h$.
156
		%	So we have $\vec f^{1} (\vec x ; \vec a)$ and $\vec f^2 (\vec y ; \vec b)$ for $\pi_1 $ and $\pi_2$ respectively, by the inductive hypothesis. 
157
		We construct $\vec f^\pi$ by simply rearranging these tuples of functions:
158
		\[
159
		\vec f^\pi (\vec u , \vec v ; \vec x , \vec y)
160
		\quad := \quad
161
		\left(
162
		\vec g^\Delta (\vec u ; \vec x) , \vec h^\Pi (\vec v ; \vec y)  , \vec g^A (\vec u ; \vec x) , \vec h^B (\vec v ; \vec y)
163
		\right)
164
		\] 
165
		
166
		We will continue with a similar notational convention as above in the remainder of this argument.
167
		
168
		%	\anupam{bad notation since need to include free variables of sequent too. (also of theory.) Reconsider.}
169
		
170
		The case when $\pi$ ends with a $\lefrul{\lor}$ step is analogous to the $\rigrul{\land}$ case above.
171
		
172
		If $\pi$ consists of a subproof $\pi'$ ending with a $\lefrul{\land}$ or $\rigrul{\lor}$-step, then $\vec f^\pi$ is exactly $\vec f^{\pi'}$.
173
		
174
		
175
		By assumption, there are no $\bot$, $?$ or $\forall$ steps occurring in $\pi$.
176
		
177
		Suppose $\pi$ ends with a $\lefrul{\cntr}$ step,
178
		\[
179
		\vlderivation{
180
			\vlin{\lefrul{\cntr}}{}{ !A , \Gamma \seqar \Delta }{
181
				\vltr{\pi'}{  !A, !A , \Gamma \seqar \Delta}{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
182
			}
183
		}
184
		\]
185
		so we have functions $\vec f' ( \vec u^1, \vec u^2 , \vec v ; \vec x)$ with $\vec u^1$ and $\vec u^2$ corresponding to the two copies of $!A$ in the conclusion of $\pi'$, respectively, and $\type (\Gamma) = (\vec v; \vec x)$. 
186
%		(Recall that the typing corresponding to $!$ means that all inputs for each $!A$ are normal). 
187
		We define $\vec f^\pi$ by duplicating the arguments for $!A$:
188
		\[
189
		\vec f^\pi (\vec u , \vec v ; \vec x)
190
		\quad := \quad
191
		\vec f' (\vec u, \vec u , \vec v ; \vec x)
192
		\]
193
%		(Notice that this is obtainable in BC by a trivial instance of safe composition.)
194
		
195
		
196
		%	cntr right
197
		%	\[
198
		%	\vlderivation{
199
		%	\vlin{\rigrul{\cntr}}{}{\Gamma \seqar \Delta, ?A}{
200
		%	\vltr{\pi'}{  \Gamma \seqar \Delta, ?A, ?A}{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
201
		%	}
202
		%	}
203
		%	\]
204
		%	(need test function against witness predicate?)
205
		%	
206
		%	\anupam{problem: how to test even equality of two terms? Maybe treat $?$ as $!$ on left?}
207
		%	
208
		%	\anupam{Not a problem by free-cut elimination! Can assume there are no $?$ in the proof! Is this equivalent to treaing $?$ as $!$ on left?}
209
		%	
210
		%	\anupam{Yes I think so. We can work in a left-sided calculus. only problem is for induction. But this can never be a problem for modalities since induction formulae are modality-free.}
211
		%	
212
		%	\anupam{this is actually the main point.}
213
		
214
		From the assumption that there are no $?$ symbols in $\pi$, we can assume also that there are no $\rigrul{\cntr}$ steps in $\pi$.
215
				
216
%		\anupam{This is important, so expand on this here or in a remark before/after.}
217
		
218
		
219
		%	\[
220
		%	\vlderivation{
221
		%	\vliin{\rigrul{\laand}}{}{\Gamma \seqar \Delta, A \laand B}{
222
		%	\vltr{\pi_1}{  \Gamma \seqar \Delta, A}{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
223
		%	}{
224
		%	\vltr{\pi_2}{  \Gamma \seqar \Delta, B}{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
225
		%	}
226
		%	}
227
		%	\]
228
		%	
229
		%	Suppose we have $\vec f^i (\vec x , \vec a ; \vec y , \vec b)$ from $\pi_i$.
230
		%	
231
		%	\anupam{problem: does this require many tests, just like for contraction? Can we isolate a different complexity class? e.g.\ PH or Grzegorzyck?}
232
		%	\anupam{skip this case and consider later.}
233
		
234
%		\anupam{commented stuff on additives. To remark later perhaps.}
235
		
236
		
237
		
238
		Suppose $\pi$ ends with a $\rigrul{\exists}$ step,
239
		\[
240
		\vlderivation{
241
			\vlin{\rigrul{\exists}}{}{ \Gamma, \nat(t) \seqar \Delta , \exists x^\nat . A(x) }{
242
				\vltr{\pi'}{ \Gamma \seqar \Delta , A(t) }{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
243
			}
244
		}
245
		\]
246
		so by the inductive hypothesis we have functions $\vec f^\Delta , \vec f^{A(t)}$ with arguments $(\vec u ; \vec x )= \type(\bigotimes \Gamma)$. We define $\vec f^\pi$ as follows:
247
		\[
248
		\vec f^\pi (\vec u ; \vec x , y)
249
		\quad := \quad
250
		\left( \vec f^\Delta (\vec u ; \vec x) , \id (;y), \vec{ f}^{A(t)} (\vec u; \vec x)  \right)
251
		\]
252
		(The identity function on $y$ is defined from successor, predecessor and safe composition).
253
		
254
		
255
		%Suppose we have functions $\vec f^X (\vec x ; \vec y)$ from $\pi'$ for $X = \Delta$ or $ X=A$. 
256
		%\[
257
		%\vec f(\vec x ; \vec y , z) \quad := \quad ( \vec f^\Delta (\vec x ; \vec y)   ,  z , \vec f^A ( \vec x ; \vec y ) )
258
		%\]
259
		
260
		
261
		Suppose $\pi$ ends with a $\lefrul{\exists}$ step:
262
		\[
263
		\vlderivation{
264
			\vlin{\lefrul{\exists}}{}{ \Gamma, \exists x^N . A(x) \seqar \Delta }{
265
				\vltr{\pi'(a)}{ \Gamma , A(a),  N(a) \seqar \Delta  }{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
266
			}
267
		}
268
		\]
269
		%
270
		%Suppose we have functions $\vec f' (\vec u , \vec v ; x , \vec y , \vec z)$ from $\pi'$ with $(\vec u ; \vec x )$ corresponding to $\Gamma$, $(;x)$ corresponding to $N(a)$ and $(\vec v ; \vec z)$ corresponding to $A(a)$. We define:
271
		%\[
272
		%\vec f ( \vec u , \vec v ;  )
273
		%\]
274
		
275
		\anupam{should just be same? Consider variable naming, just in case.}
276
		\anupam{This is probably where the consideration for free variables is.}
277
		
278
		%Suppose we have functions $\vec g (\vec v  , \vec w ; \vec x , y , \vec z)$ where $(\vec v ; \vec x) $ corresponds to $\Gamma$, $y$ corresponds to $\nat(a)$ and $(\vec w ; \vec z) $ corresponds to $A(a)$. Then we define:
279
		%\[
280
		%\vec f ( \vec v , \vec w ; \vec x , y , \vec z )
281
		%\]
282
		
283
		
284
		Suppose $\pi$ ends with a $\cut$ step:
285
		\[
286
		\vlderivation{
287
			\vliin{\cut}{}{\Gamma , \Sigma \seqar \Delta , \Pi}{
288
				\vltr{\pi_1}{ \Gamma \seqar \Delta, A }{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
289
			}{
290
			\vltr{\pi_2}{\Sigma , A \seqar \Pi}{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
291
		}
292
	}
293
	\]
294
	
295
	We have two cases. First, if $A$ is free of modalities, then $\type (A)$ consists of only safe inputs. Therefore we have functions $\vec g (\vec u; \vec x)$ and $\vec h (\vec v ; \vec y, \vec z)$ from $\pi_1$ and $\pi_2 $ respectively, such that $\type(\Gamma) = (\vec u ; \vec x)$, $\type(\Sigma) = (\vec v ; \vec y )$ and $\type (A) = (;\vec z)$. Let us write $\vec g = (\vec g^\Delta , \vec g^A)$ as before, and we define $\vec f^\pi$ as follows:
296
	
297
	\[
298
	\vec f^\pi ( \vec u , \vec v ; \vec x, \vec y)
299
	\quad := \quad
300
	\left(
301
	\vec g^\Delta (\vec u ; \vec x) 
302
	,
303
	\vec h ( \vec v ; \vec y , \vec g^A ( \vec u ; \vec x ) )
304
	\right)
305
	\]
306
	(Notice that all safe inputs are hereditarily safe in these expressions, so they are definable by safe composition and projection).
307
	
308
	
309
	
310
	
311
	In the other case, where $A$ may be modal, it must be of the form $!\nat (t)$ since it is a cut formula, and so must directly descend from an induction step or axiom on one side. The only such occurrence of a modality is in the conclusion of an induction step, whence such a formula has the form $!\nat (t)$. By free-cut elimination we can also assume that this cut formula is principal on \emph{both} sides, i.e.\ $\pi$ is of the form:
312
	
313
	\anupam{need to check this assumption against free-cut elimination conditions. To discuss.}
314
	
315
\[
316
\vlderivation{
317
	\vliin{\cut}{}{!\Gamma , !\Sigma  , A(\epsilon) \seqar A(t)  }{
318
%		\vlin{\rigrul{!}}{}{!\Gamma \seqar ?\Delta, !\nat(t)}{
319
			\vltr{\pi_1}{!\Gamma \seqar  !\nat(t)}{\vlhy{\quad}}{\vlhy{}}{\vlhy{\quad}}
320
%			}
321
		}{
322
		\vltr{\pi_2}{ !\Sigma, !\nat(t) , A(\epsilon)\seqar A(t)  }{\vlhy{\quad}}{\vlhy{}}{\vlhy{\quad}}
323
		}
324
	}
325
\]
326
where $\pi_1$ ends with a $\rigrul{!}$ step for which $!\nat (t)$ is principal, $\pi_2$ ends with a $\pind$ step where $A(x)$ is the induction formula, and we assume there are no side-formulae on the right of both conclusions for the same reason as $\rigrul{\cntr}$: a free-cut free proof of a convergence statement contains no $?$ symbol.
327

    
328
So by the inductive hypothesis we have functions $ g( \vec u ; )$ and $\vec h ( \vec v , w ; \vec x)$ from $\pi_1$ and $\pi_2$ respectively, where $\vec u$, $\vec v$, $w$ and $\vec x$ correspond to $!\Gamma$, $!\Sigma$, $!\nat(t)$ (in $\pi_2$) and $A(\epsilon)$ respectively. We construct the functions $\vec f^\pi $ as follows:
329
\[
330
\vec f^\pi (\vec u , \vec v ; \vec x)
331
\quad := \quad
332
\vec h (  \vec v , g(\vec u ; ) ; \vec x)
333
\]
334
(Notice that this is definable by safe composition and projection since all safe inputs $\vec x$ are hereditarily safe on the right.)
335
	
336
	
337
	Suppose $\pi$ ends with a $\lefrul{!}$ step:
338
	\[
339
	\vlderivation{
340
		\vlin{!}{}{\Gamma, !A \seqar \Delta}{
341
			\vltr{\pi'}{ \Gamma , A \seqar \Delta  }{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
342
		}
343
	}
344
	\]
345
	\todo{finish this case, just passing a safe input to a normal input.}
346
	
347
	
348
	Suppose $\pi$ ends with a $\rigrul{!}$ step:
349
	
350
	\todo{finish this case, should not change function at all, but maybe there is a consideration.}
351
	
352
	Suppose $\pi$ ends with a $\lefrul{\wk}$ step:
353
	
354
	\todo{finish this case, just add a dummy input.}
355
	
356
	Suppose $\pi$ ends with a $\rigrul{\wk}$ step:
357
	
358
	\todo{finish this case, just add a dummy function.}
359
	
360
	
361
	
362
	Suppose $\pi$ ends with a $\pind$ step. For the same reason as $\rigrul{\cntr}$ we can assume there are no $?$ formulae and so no side formulae on the right. Thus a $\pi$ has the following form:
363
	\[
364
	\vlderivation{
365
		\vliin{\pind}{}{ !\nat (t), !\Gamma  ,  A(\epsilon) \seqar A(t) }{
366
			\vltr{\pi_0}{!\nat(a) , !\Gamma ,  A(a) \seqar A(\succ_0 a)}{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
367
		}{
368
		\vltr{\pi_1}{!\nat(a), !\Gamma ,  A(a)\seqar A(\succ_1 a) }{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
369
	}
370
}
371
\]
372
\anupam{is this better with a premiss for the base case?}
373

    
374
By the inductive hypothesis we have functions $\vec g^0 (u , \vec v ; \vec x)$ and $\vec g^1 (u , \vec v ; \vec x)$ with $u$, $\vec v$ and $\vec x$ corresponding to $!\nat(a)$, $!\Gamma$ and $A(a)$ respectively. We define $\vec f^\pi$ by (simultaneous) predicative recursion on notation as follows:
375
\[
376
\begin{array}{rcll}
377
\vec f^\pi ( \epsilon, \vec v ; \vec x ) & := & \vec x & \\
378
\vec f^\pi ( \succ_i u , \vec v ; \vec x) & := & \vec g^i ( u, \vec v ; \vec f^\pi ( u, \vec v ; \vec x ) )
379
\end{array}
380
\]
381

    
382
\anupam{check this}
383

    
384
\todo{simultaneous PRN.}
385

    
386

    
387
\end{definition}
388

    
389
\subsection{Witness predicate and extensional equivalence of functions}
390

    
391
Now that we have defined how to extract a function from a proof, we need to show that the function satisfies the appropriate semantic properties.
392

    
393
For this we work in a quantifier-free logic whose atoms are equations between terms of our arithmetic and whose (sound) rules are simply the axioms of our arithmetic.
394

    
395
(This is similar to the role of PV in the witnessing argument for $S^1_2$ and system $T$ for witnessing $I\Sigma_1$.)
396

    
397
	
398
		\newcommand{\witness}[2]{\mathit{Witness}^{#1}_{#2}}
399
		\begin{definition}
400
			[Witness predicate]
401
			We define the following `witness' predicate for $\Sigma^\nat_1$-formulae $A$ with free variables amongst $\vec a$:
402
			\[
403
			\begin{array}{rcll}
404
			\witness{\vec a}{A} (w, \vec b) & := & w = t(\vec b) & \text{if $A(\vec a)$ is $\nat (t(\vec a))$.} \\
405
			\witness{\vec a}{A} (w, \vec b) & := & s(\vec b) = t(\vec b) & \text{if $A(\vec a)$ is $s(\vec a) = t (\vec a)$.} \\
406
			\witness{\vec a}{A \lor B} ( \vec w^1 , \vec w^2, \vec b ) & := &  \witness{\vec a}{A} (\vec w^1 , \vec b) \cor \witness{\vec a}{B} (\vec w^2 , \vec b) & 
407
			%			\text{for $\star \in \{ \land, \lor, \laand , \laor\}$.} 
408
			\\
409
			\witness{\vec a}{A \land B} ( \vec w^1 , \vec w^2, \vec b ) & := &  \witness{\vec a}{A} (\vec w^1 , \vec b) \cand \witness{\vec a}{B} (\vec w^2 , \vec b) & 
410
			%			\text{for $\star \in \{ \land, \lor, \laand , \laor\}$.} 
411
			\\
412
			\witness{\vec a}{\exists x^\nat . A(x)} ( w, \vec w  , \vec b) & := & \witness{\vec{a}, a}{A(a)}(\vec w , \vec b, w ) & \\
413
			\end{array}
414
			\]
415
			where $|\vec w^1| = |\type (A)|$ and $|\vec w^2| = |\type (B)| $.
416
		\end{definition}
417
		%	\todo{problem: what about complexity of checking equality? }
418
		
419
		\todo{Reformulate above later if necessary.}
420
		
421
		%	\todo{What about $\nat (t)$? What does it mean? Replace with true?}
422
		
423
		%	\todo{either use the witness predicate above, or use realizability predicate at meta-level and a model theory, like BH.}
424
		
425
		%	\anupam{Need to check above properly. $N(t)$ should be witnessed by the value of $t $ in the model. For equality of terms the witness should not do anything.}
426
		
427
		\anupam{to consider/remark: formally, is witness predicate checked in model or some logical theory?}
428

    
429

    
430

    
431

    
432
\begin{lemma}
433
Suppose $\pi$ is a free-cut free $\Sigma^\nat_1$-$\pind$ proof of a sequent $\Gamma (\vec a) \seqar \Delta (\vec a)$, with $\vec f^\pi$ defined as above. Then:
434
	\[
435
			\witness{\vec a}{\bigotimes \Gamma} (\vec w , \vec b) \implies \witness{\vec a}{\bigparr \Delta } (\vec f^\pi(\vec w , \vec b), \vec b)
436
			\]
437
\end{lemma}
438
		
439
			
440
			\anupam{to consider: do we need parameters $\vec a$ in argument of $f$? Or does $\nat$ predicate take care of this?}
441
			
442
			%	We will be explicit about normal and safe inputs when necessary, for the most part we will simply rearrange inputs into lists $(\vec u; \vec a)$ as in BC framework.
443
			
444
%			We often suppress the parameters $\vec a$ when it is not important.	
445
			
446
			\anupam{Is this implication provable in Bellantoni's version of PV based on BC?}
447
			
448
			%	\anupam{for moment try ignore decoration on right? what about negation?}
449
	
450
	
451
	\begin{proof}
452
	By structural induction on $\pi$, again, following the definition of $\vec f^\pi$.
453
	\todo{}
454
	\end{proof}	
455
		
456
		\begin{theorem}
457
		If we can prove a convergence statement for a function $f$ under a specification $\Phi(f)$ then there is a BC-program for a function $\mathbf f$ such that:
458
		\begin{equation}
459
		\label{eqn:spec-implies-program}
460
\Phi(f) \implies f (\vec x) = \mathbf{f} (\vec x)
461
		\end{equation}
462
		\begin{equation}
463
		\label{eqn:program-satisfies-spec}
464
		\Phi(\mathbf f)
465
		\end{equation}
466
		\end{theorem}
467
			\begin{proof}
468
			Notice that a convergence statement has the following form:
469
			\[
470
			!\Phi(f) , !\nat(\vec a) \seqar \nat(f (\vec a) )
471
			\]
472
			By the lemma above, and by inspection of the definition of the witness predicate, this means we have that,
473
			\[
474
			(\Phi(f) \cand \vec x = \vec a ) \implies \mathbf f (\vec x) = f(\vec a)
475
			\]
476
			whence we arrive at \eqref{eqn:spec-implies-program}.
477
			
478
			Finally, notice that $\Phi(f)$ has \emph{some} model, since it is a monotone inductive definition so some fixed point must exist. Therefore we obtain \eqref{eqn:program-satisfies-spec} as well.
479
			\end{proof}
480
			
481
			\anupam{rephrase above proof to make more sense.}
482
			
483
%
484
%\newcommand{\concat}{\mathit{concat}}
485
%\paragraph{Some points on concatenation \anupam{if necessary}}
486
%We can define the concatenation operation by PRN:
487
%\[
488
%\begin{array}{rcl}
489
%\concat (\epsilon ; y) & : = & x \\
490
%\concat (\succ_i x ; y) & := & \succ_i \concat (x ; y)
491
%\end{array}
492
%\]
493
%
494
%From here we can define iterated concatenation:
495
%\[
496
%\concat (x_1 , \dots x_n ; y) \quad := \quad \concat (x_n ; \concat (x_{n-1} ; \vldots \concat (x_1 ; y) \vldots ) )
497
%\]
498
%
499
%(notice all safe inputs are hereditarily to the right of $;$ so this is definable by safe composition and projection.)