Statistiques
| Révision :

root / CSL16 / wfm.tex @ 67

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

1 33 adas
\section{Witness function method}
2 57 adas
We now prove the converse to the last section: any provably convergent function in $\arith$ is polynomial-time computable.
3 58 adas
To this end we use the so-called \emph{witness function method} (WFM), a common technique in {bounded arithmetic}.
4 59 adas
Usually, the idea is to rely on free-cut elimination to control the quantifer complexity of formulae occurring in a proof.
5 57 adas
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 33 adas
7 58 adas
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 57 adas
9 58 adas
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 33 adas
11 58 adas
%Some key features of this method are the following:
12 58 adas
%\begin{itemize}
13 58 adas
%	\item T
14 58 adas
%\end{itemize}
15 58 adas
%
16 58 adas
%Key features/differences from realisability:
17 58 adas
%\begin{itemize}
18 58 adas
%	\item De Morgan normal form: reduces type level to $0$, complementary to double-negation translation that \emph{increases} type level.
19 58 adas
%	\item Free-cut elimination: allows us to handles formulae of fixed logical complexity throughout the proof.
20 58 adas
%	\item Respects logical properties of formulae, e.g.\ quantifier complexity, exponential complexity.
21 58 adas
%\end{itemize}
22 58 adas
%
23 58 adas
%\todo{say some more here}
24 58 adas
%
25 58 adas
%\todo{compare with applicative theories}
26 58 adas
%
27 58 adas
%\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 33 adas
29 33 adas
\newcommand{\type}{\mathtt{t}}
30 33 adas
\newcommand{\norm}{\nu}
31 33 adas
\newcommand{\safe}{\sigma}
32 33 adas
33 33 adas
34 43 adas
35 43 adas
		\subsection{The translation}
36 43 adas
37 59 adas
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 59 adas
39 33 adas
		\begin{definition}
40 43 adas
			[Typing]
41 59 adas
			To each $\sigone$-formula $A$ we associate a sorted tuple of variables $\type (A)$, intended to range over $\Word$, as follows:
42 33 adas
			\[
43 33 adas
			\begin{array}{rcll}
44 43 adas
			\type (\nat (t)) & := & (;x^{\nat (t)} ) & \\
45 43 adas
			\type(s = t) & := & ( ; x^{s = t}) & \\
46 43 adas
			\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 43 adas
			\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 43 adas
			\type (! A) & : = & ( \vec u ,\vec x  ; ) & \text{if $\type(A) = (\vec u ; \vec x )$.} \\
49 43 adas
			\type (\exists x^\nat . A) & := & (\vec u ; \vec x , y) & \text{if $\type (A) = (\vec u ; \vec x)$.}
50 43 adas
			%	\type (\forall x^N . A) & := & \Nat \to \type(A)
51 33 adas
			\end{array}
52 33 adas
			\]
53 64 adas
			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 43 adas
			%	where $\nu$ designates that the inputs are normal.
55 33 adas
		\end{definition}
56 33 adas
57 33 adas
58 59 adas
%		\anupam{need to account for normality and safety somewhere. Attempting inlined and leaving types without this decoration.}
59 59 adas
%
60 59 adas
%		\begin{remark}
61 59 adas
%			[Distribution of $!$]
62 59 adas
%			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 59 adas
%
64 59 adas
%			On the other hand, since we are working in affine logic, we do in general have $!(A \land B) \cong !A \land !B$.
65 59 adas
%		\end{remark}
66 33 adas
67 59 adas
		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 33 adas
69 60 adas
70 64 adas
		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 59 adas
72 64 adas
		Our crucial use of free-cut elimination is in the following result, which yields strong regularity properties:
73 59 adas
74 64 adas
		\begin{proposition}
75 64 adas
			[Freedom]
76 64 adas
	A free-cut free $\closure{\eqspec} \cup \arith $ sequent proof of $\word (\vec x) \seqar \word (f (\vec x) )$ is:
77 64 adas
	\begin{enumerate}
78 64 adas
		\item Free of any negation symbols.
79 64 adas
		\item Free of any $\forall$ symbols.
80 64 adas
		\item Free of any $?$ symbols.
81 64 adas
	\end{enumerate}
82 64 adas
		\end{proposition}
83 64 adas
84 64 adas
85 64 adas
		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 64 adas
87 33 adas
		\begin{definition}
88 33 adas
			[Translation]
89 64 adas
			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 33 adas
91 33 adas
92 33 adas
			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 33 adas
94 64 adas
			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 64 adas
			The other initial steps of $\arith$ are translated as follows:
96 39 adas
			\[
97 42 adas
			\begin{array}{ccc}
98 64 adas
%			\vlinf{\nat_\epsilon}{}{\seqar \nat (\epsilon)}{}
99 64 adas
%			& : &
100 64 adas
%			\epsilon
101 64 adas
%			\\
102 64 adas
			\vlinf{\genzer}{}{\word(t) \seqar \word(\succ_0 t)}{}
103 64 adas
			& \quad :\quad  &
104 42 adas
			\succ_0 ( ;x)
105 42 adas
			\\
106 64 adas
			\vlinf{\genone}{}{\word(t) \seqar \word(\succ_1 t)}{}
107 64 adas
			& \quad : \quad &
108 42 adas
			\succ_1 (; x)
109 42 adas
			\\
110 64 adas
%			\vlinf{\epsilon^0}{}{ \nat (t)  , \epsilon = \succ_0 t \seqar }{}
111 64 adas
%			& : &
112 64 adas
%			\epsilon
113 64 adas
%			\\
114 64 adas
%			\vlinf{\epsilon^1}{}{ \nat (t)  , \epsilon = \succ_1 t \seqar }{}
115 64 adas
%			& : &
116 64 adas
%			\epsilon
117 64 adas
%			\\
118 64 adas
%			\vlinf{\succ_0}{}{\nat (s) , \nat (t)  , \succ_0 s = \succ_0 t\seqar s = t }{}
119 64 adas
%			& : &
120 64 adas
%			\epsilon
121 64 adas
%			\\
122 64 adas
%			\vlinf{\succ_1}{}{\nat (s) , \nat (t)  , \succ_1 s = \succ_1 t\seqar s = t }{}
123 64 adas
%			& : &
124 64 adas
%			\epsilon
125 64 adas
%			\\
126 64 adas
%			\vlinf{\inj}{}{\nat(t), \succ_0 t = \succ_1 t \seqar}{}
127 64 adas
%			& : &
128 64 adas
%			\epsilon
129 64 adas
%			\\
130 64 adas
			\vlinf{\surj}{}{\word (t) \seqar t = \epsilon \laor \exists y^\word . t = \succ_0 y \laor \exists y^\word. t = \succ_1 y }{}
131 64 adas
			&\quad : \quad  &
132 64 adas
			( \epsilon , \pred (  ;x) , \pred (;x ) )
133 42 adas
			\\
134 64 adas
				\vlinf{\wordcntr}{}{\word(t) \seqar \word(t) \land \word(t) }{}
135 64 adas
				& \quad  : \quad &
136 64 adas
				( \id (;x) , \id (;x) )
137 42 adas
			\end{array}
138 39 adas
			\]
139 64 adas
			Finally an $\closure{\eqspec}$ initial step is also translated simply to $\epsilon$.
140 39 adas
141 64 adas
142 42 adas
143 42 adas
144 64 adas
			Now we consider the inductive cases.
145 33 adas
			Suppose $\pi$ ends with a $\rigrul{\land}$ step:
146 33 adas
			\[
147 33 adas
			\vlderivation{
148 33 adas
				\vliin{\land}{}{ \Gamma, \Sigma \seqar \Delta, \Pi, A\land B }{
149 33 adas
					\vltr{\pi_1}{ \Gamma \seqar \Delta, A }{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
150 33 adas
				}{
151 33 adas
				\vltr{\pi_2}{ \Sigma \seqar \Pi, B }{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
152 33 adas
			}
153 33 adas
		}
154 33 adas
		\]
155 33 adas
		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 33 adas
		%	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 67 adas
		We construct $\vec f^\pi$ by simply rearranging these tuples of functions:
158 33 adas
		\[
159 33 adas
		\vec f^\pi (\vec u , \vec v ; \vec x , \vec y)
160 33 adas
		\quad := \quad
161 33 adas
		\left(
162 33 adas
		\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 33 adas
		\right)
164 33 adas
		\]
165 33 adas
166 33 adas
		We will continue with a similar notational convention as above in the remainder of this argument.
167 33 adas
168 33 adas
		%	\anupam{bad notation since need to include free variables of sequent too. (also of theory.) Reconsider.}
169 33 adas
170 33 adas
		The case when $\pi$ ends with a $\lefrul{\lor}$ step is analogous to the $\rigrul{\land}$ case above.
171 33 adas
172 33 adas
		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 33 adas
174 67 adas
175 67 adas
		By assumption, there are no $\bot$, $?$ or $\forall$ steps occurring in $\pi$.
176 67 adas
177 33 adas
		Suppose $\pi$ ends with a $\lefrul{\cntr}$ step,
178 33 adas
		\[
179 33 adas
		\vlderivation{
180 33 adas
			\vlin{\lefrul{\cntr}}{}{ !A , \Gamma \seqar \Delta }{
181 33 adas
				\vltr{\pi'}{  !A, !A , \Gamma \seqar \Delta}{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
182 33 adas
			}
183 33 adas
		}
184 33 adas
		\]
185 67 adas
		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 67 adas
%		(Recall that the typing corresponding to $!$ means that all inputs for each $!A$ are normal).
187 67 adas
		We define $\vec f^\pi$ by duplicating the arguments for $!A$:
188 33 adas
		\[
189 33 adas
		\vec f^\pi (\vec u , \vec v ; \vec x)
190 33 adas
		\quad := \quad
191 67 adas
		\vec f' (\vec u, \vec u , \vec v ; \vec x)
192 33 adas
		\]
193 67 adas
%		(Notice that this is obtainable in BC by a trivial instance of safe composition.)
194 33 adas
195 33 adas
196 33 adas
		%	cntr right
197 33 adas
		%	\[
198 33 adas
		%	\vlderivation{
199 33 adas
		%	\vlin{\rigrul{\cntr}}{}{\Gamma \seqar \Delta, ?A}{
200 33 adas
		%	\vltr{\pi'}{  \Gamma \seqar \Delta, ?A, ?A}{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
201 33 adas
		%	}
202 33 adas
		%	}
203 33 adas
		%	\]
204 33 adas
		%	(need test function against witness predicate?)
205 33 adas
		%
206 33 adas
		%	\anupam{problem: how to test even equality of two terms? Maybe treat $?$ as $!$ on left?}
207 33 adas
		%
208 33 adas
		%	\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 33 adas
		%
210 33 adas
		%	\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 33 adas
		%
212 33 adas
		%	\anupam{this is actually the main point.}
213 33 adas
214 67 adas
		From the assumption that there are no $?$ symbols in $\pi$, we can assume also that there are no $\rigrul{\cntr}$ steps in $\pi$.
215 67 adas
216 67 adas
%		\anupam{This is important, so expand on this here or in a remark before/after.}
217 33 adas
218 33 adas
219 33 adas
		%	\[
220 33 adas
		%	\vlderivation{
221 33 adas
		%	\vliin{\rigrul{\laand}}{}{\Gamma \seqar \Delta, A \laand B}{
222 33 adas
		%	\vltr{\pi_1}{  \Gamma \seqar \Delta, A}{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
223 33 adas
		%	}{
224 33 adas
		%	\vltr{\pi_2}{  \Gamma \seqar \Delta, B}{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
225 33 adas
		%	}
226 33 adas
		%	}
227 33 adas
		%	\]
228 33 adas
		%
229 33 adas
		%	Suppose we have $\vec f^i (\vec x , \vec a ; \vec y , \vec b)$ from $\pi_i$.
230 33 adas
		%
231 33 adas
		%	\anupam{problem: does this require many tests, just like for contraction? Can we isolate a different complexity class? e.g.\ PH or Grzegorzyck?}
232 33 adas
		%	\anupam{skip this case and consider later.}
233 33 adas
234 67 adas
%		\anupam{commented stuff on additives. To remark later perhaps.}
235 33 adas
236 33 adas
237 33 adas
238 33 adas
		Suppose $\pi$ ends with a $\rigrul{\exists}$ step,
239 33 adas
		\[
240 33 adas
		\vlderivation{
241 33 adas
			\vlin{\rigrul{\exists}}{}{ \Gamma, \nat(t) \seqar \Delta , \exists x^\nat . A(x) }{
242 33 adas
				\vltr{\pi'}{ \Gamma \seqar \Delta , A(t) }{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
243 33 adas
			}
244 33 adas
		}
245 33 adas
		\]
246 33 adas
		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 33 adas
		\[
248 33 adas
		\vec f^\pi (\vec u ; \vec x , y)
249 33 adas
		\quad := \quad
250 33 adas
		\left( \vec f^\Delta (\vec u ; \vec x) , \id (;y), \vec{ f}^{A(t)} (\vec u; \vec x)  \right)
251 33 adas
		\]
252 33 adas
		(The identity function on $y$ is defined from successor, predecessor and safe composition).
253 33 adas
254 33 adas
255 33 adas
		%Suppose we have functions $\vec f^X (\vec x ; \vec y)$ from $\pi'$ for $X = \Delta$ or $ X=A$.
256 33 adas
		%\[
257 33 adas
		%\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 33 adas
		%\]
259 33 adas
260 33 adas
261 33 adas
		Suppose $\pi$ ends with a $\lefrul{\exists}$ step:
262 33 adas
		\[
263 33 adas
		\vlderivation{
264 33 adas
			\vlin{\lefrul{\exists}}{}{ \Gamma, \exists x^N . A(x) \seqar \Delta }{
265 33 adas
				\vltr{\pi'(a)}{ \Gamma , A(a),  N(a) \seqar \Delta  }{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
266 33 adas
			}
267 33 adas
		}
268 33 adas
		\]
269 33 adas
		%
270 33 adas
		%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 33 adas
		%\[
272 33 adas
		%\vec f ( \vec u , \vec v ;  )
273 33 adas
		%\]
274 33 adas
275 33 adas
		\anupam{should just be same? Consider variable naming, just in case.}
276 33 adas
		\anupam{This is probably where the consideration for free variables is.}
277 33 adas
278 33 adas
		%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 33 adas
		%\[
280 33 adas
		%\vec f ( \vec v , \vec w ; \vec x , y , \vec z )
281 33 adas
		%\]
282 33 adas
283 33 adas
284 33 adas
		Suppose $\pi$ ends with a $\cut$ step:
285 33 adas
		\[
286 33 adas
		\vlderivation{
287 33 adas
			\vliin{\cut}{}{\Gamma , \Sigma \seqar \Delta , \Pi}{
288 33 adas
				\vltr{\pi_1}{ \Gamma \seqar \Delta, A }{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
289 33 adas
			}{
290 33 adas
			\vltr{\pi_2}{\Sigma , A \seqar \Pi}{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
291 33 adas
		}
292 33 adas
	}
293 33 adas
	\]
294 33 adas
295 33 adas
	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 33 adas
297 33 adas
	\[
298 33 adas
	\vec f^\pi ( \vec u , \vec v ; \vec x, \vec y)
299 33 adas
	\quad := \quad
300 33 adas
	\left(
301 33 adas
	\vec g^\Delta (\vec u ; \vec x)
302 33 adas
	,
303 33 adas
	\vec h ( \vec v ; \vec y , \vec g^A ( \vec u ; \vec x ) )
304 33 adas
	\right)
305 33 adas
	\]
306 33 adas
	(Notice that all safe inputs are hereditarily safe in these expressions, so they are definable by safe composition and projection).
307 33 adas
308 33 adas
309 33 adas
310 33 adas
311 36 adas
	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 33 adas
313 36 adas
	\anupam{need to check this assumption against free-cut elimination conditions. To discuss.}
314 33 adas
315 36 adas
\[
316 36 adas
\vlderivation{
317 36 adas
	\vliin{\cut}{}{!\Gamma , !\Sigma  , A(\epsilon) \seqar A(t)  }{
318 36 adas
%		\vlin{\rigrul{!}}{}{!\Gamma \seqar ?\Delta, !\nat(t)}{
319 36 adas
			\vltr{\pi_1}{!\Gamma \seqar  !\nat(t)}{\vlhy{\quad}}{\vlhy{}}{\vlhy{\quad}}
320 36 adas
%			}
321 36 adas
		}{
322 36 adas
		\vltr{\pi_2}{ !\Sigma, !\nat(t) , A(\epsilon)\seqar A(t)  }{\vlhy{\quad}}{\vlhy{}}{\vlhy{\quad}}
323 36 adas
		}
324 36 adas
	}
325 36 adas
\]
326 36 adas
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 36 adas
328 36 adas
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 36 adas
\[
330 36 adas
\vec f^\pi (\vec u , \vec v ; \vec x)
331 36 adas
\quad := \quad
332 36 adas
\vec h (  \vec v , g(\vec u ; ) ; \vec x)
333 36 adas
\]
334 36 adas
(Notice that this is definable by safe composition and projection since all safe inputs $\vec x$ are hereditarily safe on the right.)
335 33 adas
336 33 adas
337 33 adas
	Suppose $\pi$ ends with a $\lefrul{!}$ step:
338 33 adas
	\[
339 33 adas
	\vlderivation{
340 33 adas
		\vlin{!}{}{\Gamma, !A \seqar \Delta}{
341 33 adas
			\vltr{\pi'}{ \Gamma , A \seqar \Delta  }{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
342 33 adas
		}
343 33 adas
	}
344 33 adas
	\]
345 33 adas
	\todo{finish this case, just passing a safe input to a normal input.}
346 33 adas
347 33 adas
348 33 adas
	Suppose $\pi$ ends with a $\rigrul{!}$ step:
349 33 adas
350 33 adas
	\todo{finish this case, should not change function at all, but maybe there is a consideration.}
351 33 adas
352 33 adas
	Suppose $\pi$ ends with a $\lefrul{\wk}$ step:
353 33 adas
354 33 adas
	\todo{finish this case, just add a dummy input.}
355 33 adas
356 33 adas
	Suppose $\pi$ ends with a $\rigrul{\wk}$ step:
357 33 adas
358 33 adas
	\todo{finish this case, just add a dummy function.}
359 33 adas
360 33 adas
361 33 adas
362 33 adas
	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 33 adas
	\[
364 33 adas
	\vlderivation{
365 37 adas
		\vliin{\pind}{}{ !\nat (t), !\Gamma  ,  A(\epsilon) \seqar A(t) }{
366 37 adas
			\vltr{\pi_0}{!\nat(a) , !\Gamma ,  A(a) \seqar A(\succ_0 a)}{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
367 33 adas
		}{
368 37 adas
		\vltr{\pi_1}{!\nat(a), !\Gamma ,  A(a)\seqar A(\succ_1 a) }{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
369 33 adas
	}
370 33 adas
}
371 33 adas
\]
372 37 adas
\anupam{is this better with a premiss for the base case?}
373 33 adas
374 37 adas
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 33 adas
\[
376 37 adas
\begin{array}{rcll}
377 37 adas
\vec f^\pi ( \epsilon, \vec v ; \vec x ) & := & \vec x & \\
378 37 adas
\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 33 adas
\end{array}
380 33 adas
\]
381 33 adas
382 37 adas
\anupam{check this}
383 33 adas
384 37 adas
\todo{simultaneous PRN.}
385 33 adas
386 33 adas
387 33 adas
\end{definition}
388 33 adas
389 43 adas
\subsection{Witness predicate and extensional equivalence of functions}
390 43 adas
391 43 adas
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 43 adas
393 43 adas
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 43 adas
395 43 adas
(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 43 adas
397 43 adas
398 43 adas
		\newcommand{\witness}[2]{\mathit{Witness}^{#1}_{#2}}
399 43 adas
		\begin{definition}
400 43 adas
			[Witness predicate]
401 43 adas
			We define the following `witness' predicate for $\Sigma^\nat_1$-formulae $A$ with free variables amongst $\vec a$:
402 43 adas
			\[
403 43 adas
			\begin{array}{rcll}
404 43 adas
			\witness{\vec a}{A} (w, \vec b) & := & w = t(\vec b) & \text{if $A(\vec a)$ is $\nat (t(\vec a))$.} \\
405 43 adas
			\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 43 adas
			\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 43 adas
			%			\text{for $\star \in \{ \land, \lor, \laand , \laor\}$.}
408 43 adas
			\\
409 43 adas
			\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 43 adas
			%			\text{for $\star \in \{ \land, \lor, \laand , \laor\}$.}
411 43 adas
			\\
412 43 adas
			\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 43 adas
			\end{array}
414 43 adas
			\]
415 43 adas
			where $|\vec w^1| = |\type (A)|$ and $|\vec w^2| = |\type (B)| $.
416 43 adas
		\end{definition}
417 43 adas
		%	\todo{problem: what about complexity of checking equality? }
418 43 adas
419 43 adas
		\todo{Reformulate above later if necessary.}
420 43 adas
421 43 adas
		%	\todo{What about $\nat (t)$? What does it mean? Replace with true?}
422 43 adas
423 43 adas
		%	\todo{either use the witness predicate above, or use realizability predicate at meta-level and a model theory, like BH.}
424 43 adas
425 43 adas
		%	\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 43 adas
427 43 adas
		\anupam{to consider/remark: formally, is witness predicate checked in model or some logical theory?}
428 43 adas
429 43 adas
430 43 adas
431 43 adas
432 43 adas
\begin{lemma}
433 43 adas
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 43 adas
	\[
435 43 adas
			\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 43 adas
			\]
437 43 adas
\end{lemma}
438 43 adas
439 43 adas
440 43 adas
			\anupam{to consider: do we need parameters $\vec a$ in argument of $f$? Or does $\nat$ predicate take care of this?}
441 43 adas
442 43 adas
			%	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 43 adas
444 43 adas
%			We often suppress the parameters $\vec a$ when it is not important.
445 43 adas
446 43 adas
			\anupam{Is this implication provable in Bellantoni's version of PV based on BC?}
447 43 adas
448 43 adas
			%	\anupam{for moment try ignore decoration on right? what about negation?}
449 43 adas
450 43 adas
451 43 adas
	\begin{proof}
452 43 adas
	By structural induction on $\pi$, again, following the definition of $\vec f^\pi$.
453 43 adas
	\todo{}
454 43 adas
	\end{proof}
455 43 adas
456 43 adas
		\begin{theorem}
457 43 adas
		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 43 adas
		\begin{equation}
459 43 adas
		\label{eqn:spec-implies-program}
460 43 adas
\Phi(f) \implies f (\vec x) = \mathbf{f} (\vec x)
461 43 adas
		\end{equation}
462 43 adas
		\begin{equation}
463 43 adas
		\label{eqn:program-satisfies-spec}
464 43 adas
		\Phi(\mathbf f)
465 43 adas
		\end{equation}
466 43 adas
		\end{theorem}
467 43 adas
			\begin{proof}
468 43 adas
			Notice that a convergence statement has the following form:
469 43 adas
			\[
470 43 adas
			!\Phi(f) , !\nat(\vec a) \seqar \nat(f (\vec a) )
471 43 adas
			\]
472 43 adas
			By the lemma above, and by inspection of the definition of the witness predicate, this means we have that,
473 43 adas
			\[
474 43 adas
			(\Phi(f) \cand \vec x = \vec a ) \implies \mathbf f (\vec x) = f(\vec a)
475 43 adas
			\]
476 43 adas
			whence we arrive at \eqref{eqn:spec-implies-program}.
477 43 adas
478 43 adas
			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 43 adas
			\end{proof}
480 43 adas
481 43 adas
			\anupam{rephrase above proof to make more sense.}
482 43 adas
483 47 adas
%
484 47 adas
%\newcommand{\concat}{\mathit{concat}}
485 47 adas
%\paragraph{Some points on concatenation \anupam{if necessary}}
486 47 adas
%We can define the concatenation operation by PRN:
487 47 adas
%\[
488 47 adas
%\begin{array}{rcl}
489 47 adas
%\concat (\epsilon ; y) & : = & x \\
490 47 adas
%\concat (\succ_i x ; y) & := & \succ_i \concat (x ; y)
491 47 adas
%\end{array}
492 47 adas
%\]
493 47 adas
%
494 47 adas
%From here we can define iterated concatenation:
495 47 adas
%\[
496 47 adas
%\concat (x_1 , \dots x_n ; y) \quad := \quad \concat (x_n ; \concat (x_{n-1} ; \vldots \concat (x_1 ; y) \vldots ) )
497 47 adas
%\]
498 47 adas
%
499 47 adas
%(notice all safe inputs are hereditarily to the right of $;$ so this is definable by safe composition and projection.)