Statistiques
| Révision :

root / CSL16 / draft / wfm.tex @ 249

Historique | Voir | Annoter | Télécharger (29,97 ko)

1 101 adas
\section{Witness function method}
2 101 adas
\label{sect:wfm}
3 101 adas
We now prove the converse to the last section: any provably convergent function in $\arith$ is polynomial-time computable.
4 101 adas
To this end we use the \emph{witness function method} (WFM), a common technique in {bounded arithmetic} \cite{Buss86book}.
5 101 adas
6 101 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 on classical logic.
7 101 adas
Free-cut elimination is employed to control the quantifer complexity of formulae occurring in a proof, although here we furthermore use it to control the presence of \emph{contraction} in a proof, to which we have access via the modalities of linear logic.
8 101 adas
%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.
9 101 adas
10 101 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 combinatory terms (as in applicative theories), so we cannot in general decide atomic formulae.
11 101 adas
12 101 adas
%Some key features of this method are the following:
13 101 adas
%\begin{itemize}
14 101 adas
%	\item T
15 101 adas
%\end{itemize}
16 101 adas
%
17 101 adas
%Key features/differences from realisability:
18 101 adas
%\begin{itemize}
19 101 adas
%	\item De Morgan normal form: reduces type level to $0$, complementary to double-negation translation that \emph{increases} type level.
20 101 adas
%	\item Free-cut elimination: allows us to handles formulae of fixed logical complexity throughout the proof.
21 101 adas
%	\item Respects logical properties of formulae, e.g.\ quantifier complexity, exponential complexity.
22 101 adas
%\end{itemize}
23 101 adas
%
24 101 adas
%\todo{say some more here}
25 101 adas
%
26 101 adas
%\todo{compare with applicative theories}
27 101 adas
%
28 101 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.}
29 101 adas
30 101 adas
\newcommand{\type}{\mathtt{t}}
31 101 adas
\newcommand{\norm}{\nu}
32 101 adas
\newcommand{\safe}{\sigma}
33 101 adas
34 101 adas
35 101 adas
36 101 adas
		\subsection{The translation}
37 101 adas
38 101 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.\footnote{Strictly speaking, we will also require the equational specification at hand to be coherent, cf.\ Prop.~\ref{prop:eq-spec-model}.}
39 101 adas
40 101 adas
		\begin{definition}
41 101 adas
			[Typing]
42 101 adas
			To each $(\forall, ?)$-free $\word^+$-formula $A$ we associate a sorted tuple of variables $\type (A)$, intended to range over $\Word$, as follows:
43 101 adas
			\[
44 101 adas
			\begin{array}{rcll}
45 101 adas
			\type (\word (t)) & := & (;x^{\word (t)} ) & \\
46 101 adas
			\type(s = t) & := & ( ; x^{s = t}) & \\
47 101 adas
			\type (s \neq t) & := & ( ;x^{s\neq t} )\\
48 101 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)$.} \\
49 101 adas
			\type (A \star B)  & : = & (\vec u , \vec v ; \vec x , \vec y) & \text{if $\type(A) = (\vec u ; \vec x)$, $\type(B) = (\vec v ; \vec y)$ and $\star \in \{ \lor, \land, \laor, \laand \}$.} \\
50 101 adas
			\type (! A) & : = & ( \vec u ,\vec x  ; ) & \text{if $\type(A) = (\vec u ; \vec x )$.} \\
51 101 adas
			\type (\exists x^\word . A) & := & (\vec u ; \vec x , y) & \text{if $\type (A) = (\vec u ; \vec x)$.}
52 101 adas
			%	\type (\forall x^N . A) & := & \Nat \to \type(A)
53 101 adas
			\end{array}
54 101 adas
			\]
55 101 adas
			For a sorted tuple $(u_1 , \dots u_m ; x_1 , \dots ,x_n )$ we write $|(\vec u ; \vec x)|$ to denote its length, i.e.\ $m+n$.
56 101 adas
			%	where $\nu$ designates that the inputs are normal.
57 101 adas
		\end{definition}
58 101 adas
59 101 adas
60 101 adas
%		\anupam{need to account for normality and safety somewhere. Attempting inlined and leaving types without this decoration.}
61 101 adas
%
62 101 adas
%		\begin{remark}
63 101 adas
%			[Distribution of $!$]
64 101 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.
65 101 adas
%
66 101 adas
%			On the other hand, since we are working in affine logic, we do in general have $!(A \land B) \cong !A \land !B$.
67 101 adas
%		\end{remark}
68 101 adas
69 101 adas
		This sorted tuple corresponds to the input variables, normal and safe respectively, for the BC programs that we will define.
70 101 adas
%		\footnote{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.}
71 101 adas
72 101 adas
73 101 adas
		Let us fix a particular (coherent) 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}.
74 101 adas
%
75 101 adas
		Our crucial use of free-cut elimination is in the following result, which yields strong regularity properties:
76 101 adas
77 101 adas
		\begin{proposition}
78 101 adas
			[Freedom]
79 101 adas
			\label{prop:freedom}
80 101 adas
	A free-cut free $\closure{\eqspec} \cup \arith $ sequent proof of $!\word (\vec x) \seqar \word (f (\vec x) )$ is:
81 101 adas
	\begin{enumerate}
82 101 adas
		\item\label{item:no-neg-word} Free of any negative occurrences of $\word$.
83 101 adas
		\item\label{item:no-forall} Free of any $\forall$ symbols.
84 101 adas
		\item\label{item:no-quest} Free of any $?$ symbols.
85 101 adas
				\item\label{item:no-laor-step} Free of any $\laor$ or $\laand$ steps.\footnote{Because of the $\surj$ rule, the proof may still contain $\laor$ symbols, but these must be direct ancestors of some cut-step by free-cut freeness.}
86 101 adas
	\end{enumerate}
87 101 adas
		\end{proposition}
88 101 adas
89 101 adas
90 101 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.
91 101 adas
92 101 adas
		\begin{definition}
93 101 adas
			[Translation]
94 101 adas
			We give a translation from a free-cut free $\closure{\eqspec} \cup \arith $ proof $\pi$, satisfying properties \ref{item:no-neg-word}, \ref{item:no-forall}, \ref{item:no-quest}, \ref{item:no-laor-step} of Prop.~\ref{prop:freedom} above, of a sequent $\Gamma \seqar \Delta$ to BC programs for a tuple of functions $\vec f^\pi$ with arguments $\type \left(\bigotimes\Gamma\right)$ such that $|\vec f^\pi | = | \type\left(\bigparr\Delta\right)|$.
95 101 adas
96 101 adas
97 101 adas
			The translation is by induction on the size of $\pi$, so we proceed by inspection of its final step.
98 101 adas
99 101 adas
			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 (in)equalities can be seen to carry no computational content.}
100 101 adas
			The other initial steps of $\arith$ are translated as follows:
101 101 adas
			\[
102 101 adas
			\begin{array}{ccc}
103 101 adas
%			\vlinf{\word_\epsilon}{}{\seqar \word (\epsilon)}{}
104 101 adas
%			& : &
105 101 adas
%			\epsilon
106 101 adas
%			\\
107 101 adas
			\vlinf{\genzer}{}{\word(t) \seqar \word(\succ_0 t)}{}
108 101 adas
			& \quad :\quad  &
109 101 adas
			\succ_0 ( ;x)
110 101 adas
			\\
111 101 adas
			\vlinf{\genone}{}{\word(t) \seqar \word(\succ_1 t)}{}
112 101 adas
			& \quad : \quad &
113 101 adas
			\succ_1 (; x)
114 101 adas
			\\
115 101 adas
%			\vlinf{\epsilon^0}{}{ \word (t)  , \epsilon = \succ_0 t \seqar }{}
116 101 adas
%			& : &
117 101 adas
%			\epsilon
118 101 adas
%			\\
119 101 adas
%			\vlinf{\epsilon^1}{}{ \word (t)  , \epsilon = \succ_1 t \seqar }{}
120 101 adas
%			& : &
121 101 adas
%			\epsilon
122 101 adas
%			\\
123 101 adas
%			\vlinf{\succ_0}{}{\word (s) , \word (t)  , \succ_0 s = \succ_0 t\seqar s = t }{}
124 101 adas
%			& : &
125 101 adas
%			\epsilon
126 101 adas
%			\\
127 101 adas
%			\vlinf{\succ_1}{}{\word (s) , \word (t)  , \succ_1 s = \succ_1 t\seqar s = t }{}
128 101 adas
%			& : &
129 101 adas
%			\epsilon
130 101 adas
%			\\
131 101 adas
%			\vlinf{\inj}{}{\word(t), \succ_0 t = \succ_1 t \seqar}{}
132 101 adas
%			& : &
133 101 adas
%			\epsilon
134 101 adas
%			\\
135 101 adas
			\vlinf{\surj}{}{\word (t) \seqar t = \epsilon \laor \exists y^\word . t = \succ_0 y \laor \exists y^\word. t = \succ_1 y }{}
136 101 adas
			&\quad : \quad  &
137 101 adas
			( \epsilon , \pred (  ;x) , \pred (;x ) )
138 101 adas
			\\
139 101 adas
				\vlinf{\wordcntr}{}{\word(t) \seqar \word(t) \land \word(t) }{}
140 101 adas
				& \quad  : \quad &
141 101 adas
				( \id (;x) , \id (;x) )
142 101 adas
			\end{array}
143 101 adas
			\]
144 101 adas
			If $\pi$ is an $\closure{\eqspec}$ initial step it is also translated simply to $\epsilon$.
145 101 adas
146 101 adas
		Finally, suppose $\pi$ is a logical initial step. If $\pi $ is an instance of $\id$, i.e.\ $p \seqar p$, then we translate it to $\id$. Notice that, if $\pi$ is an instance of $\lefrul{\bot}$ (i.e.\ $p, p^\bot \seqar $ ) or $\rigrul{\bot}$ (i.e.\ $\seqar p, p^\bot$) then $p$ must be an equality $s=t$ for some terms $s,t$, since $p$ must be atomic and, by assumption, $\word$ does not occur negatively. Therefore $\pi$ is translated to tuples of $\epsilon$ as appropriate.
147 101 adas
148 101 adas
149 101 adas
150 101 adas
151 101 adas
			Now we consider the inductive cases.
152 101 adas
			Suppose $\pi$ ends with a $\rigrul{\land}$ step:
153 101 adas
			\[
154 101 adas
			\vlderivation{
155 101 adas
				\vliin{\land}{}{ \Gamma, \Sigma \seqar \Delta, \Pi, A\land B }{
156 101 adas
					\vltr{\pi_1}{ \Gamma \seqar \Delta, A }{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
157 101 adas
				}{
158 101 adas
				\vltr{\pi_2}{ \Sigma \seqar \Pi, B }{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
159 101 adas
			}
160 101 adas
		}
161 101 adas
		\]
162 101 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$.
163 101 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.
164 101 adas
		We construct $\vec f^\pi$ by simply rearranging these tuples of functions:
165 101 adas
		\[
166 101 adas
		\vec f^\pi (\vec u , \vec v ; \vec x , \vec y)
167 101 adas
		\quad := \quad
168 101 adas
		\left(
169 101 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)
170 101 adas
		\right)
171 101 adas
		\]
172 101 adas
173 101 adas
		We will continue with similar notational conventions in the remainder of this argument.
174 101 adas
175 101 adas
		%	\anupam{bad notation since need to include free variables of sequent too. (also of theory.) Reconsider.}
176 101 adas
177 101 adas
		The case when $\pi$ ends with a $\lefrul{\lor}$ step is analogous to the $\rigrul{\land}$ case above.
178 101 adas
179 101 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'}$.
180 101 adas
181 101 adas
182 101 adas
		By assumption, there are no $\laor$, $\laand$, $?$ or $\forall$ steps occurring in $\pi$.
183 101 adas
184 101 adas
185 101 adas
			Suppose $\pi$ ends with a $\rigrul{\exists}$ step,
186 101 adas
				\[
187 101 adas
				\vlderivation{
188 101 adas
					\vlin{\rigrul{\exists}}{}{ \Gamma, \word(t) \seqar \Delta , \exists x^\word . A(x) }{
189 101 adas
						\vltr{\pi'}{ \Gamma \seqar \Delta , A(t) }{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
190 101 adas
					}
191 101 adas
				}
192 101 adas
				\]
193 101 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:
194 101 adas
				\[
195 101 adas
				\vec f^\pi (\vec u ; \vec x , y)
196 101 adas
				\quad := \quad
197 101 adas
				\left(
198 101 adas
				\vec f^\Delta (\vec u ; \vec x) ,
199 101 adas
				{\id (;y)},
200 101 adas
				\vec f^{A(t)} (\vec u; \vec x)
201 101 adas
				\right)
202 101 adas
				\]
203 101 adas
		%		(The identity function on $y$ is defined from successor, predecessor and safe composition).
204 101 adas
205 101 adas
206 101 adas
				%Suppose we have functions $\vec f^X (\vec x ; \vec y)$ from $\pi'$ for $X = \Delta$ or $ X=A$.
207 101 adas
				%\[
208 101 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 ) )
209 101 adas
				%\]
210 101 adas
211 101 adas
212 101 adas
				If $\pi$ ends with a $\lefrul{\exists}$ step,
213 101 adas
				\[
214 101 adas
				\vlderivation{
215 101 adas
					\vlin{\lefrul{\exists}}{}{ \Gamma, \exists x^\word . A(x) \seqar \Delta }{
216 101 adas
						\vltr{\pi'}{ \Gamma , A(a),  \word(a) \seqar \Delta  }{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
217 101 adas
					}
218 101 adas
				}
219 101 adas
				\]
220 101 adas
				then $\vec f^{\pi}$ is exactly the same as $\vec f^{\pi'}$.
221 101 adas
				%
222 101 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:
223 101 adas
				%\[
224 101 adas
				%\vec f ( \vec u , \vec v ;  )
225 101 adas
				%\]
226 101 adas
227 101 adas
%				\anupam{should just be same? Consider variable naming, just in case.}
228 101 adas
%				\anupam{This is probably where the consideration for free variables is.}
229 101 adas
230 101 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 $\word(a)$ and $(\vec w ; \vec z) $ corresponds to $A(a)$. Then we define:
231 101 adas
				%\[
232 101 adas
				%\vec f ( \vec v , \vec w ; \vec x , y , \vec z )
233 101 adas
				%\]
234 101 adas
235 101 adas
236 101 adas
237 101 adas
					%	\[
238 101 adas
					%	\vlderivation{
239 101 adas
					%	\vliin{\rigrul{\laand}}{}{\Gamma \seqar \Delta, A \laand B}{
240 101 adas
					%	\vltr{\pi_1}{  \Gamma \seqar \Delta, A}{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
241 101 adas
					%	}{
242 101 adas
					%	\vltr{\pi_2}{  \Gamma \seqar \Delta, B}{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
243 101 adas
					%	}
244 101 adas
					%	}
245 101 adas
					%	\]
246 101 adas
					%
247 101 adas
					%	Suppose we have $\vec f^i (\vec x , \vec a ; \vec y , \vec b)$ from $\pi_i$.
248 101 adas
					%
249 101 adas
					%	\anupam{problem: does this require many tests, just like for contraction? Can we isolate a different complexity class? e.g.\ PH or Grzegorzyck?}
250 101 adas
					%	\anupam{skip this case and consider later.}
251 101 adas
252 101 adas
			%		\anupam{commented stuff on additives. To remark later perhaps.}
253 101 adas
254 101 adas
255 101 adas
			If $\pi$ consists of a subproof $\pi'$ followed by a $\rigrul{!}$ step then $\vec f^\pi$ is exactly the same as $\vec f^{\pi'}$. If $\pi$ ends with a $\lefrul{!}$ step then we just appeal to Prop.~\ref{prop:bc-properties} to turn a safe input into a normal input.
256 101 adas
257 101 adas
			Since there are no $?$ symbols in $\pi$, we can assume also that there are no $\rigrul{\cntr}$ steps in $\pi$.
258 101 adas
259 101 adas
		%		\anupam{This is important, so expand on this here or in a remark before/after.}
260 101 adas
261 101 adas
		Suppose $\pi$ ends with a $\lefrul{\cntr}$ step,
262 101 adas
		\[
263 101 adas
		\vlderivation{
264 101 adas
			\vlin{\lefrul{\cntr}}{}{ !A , \Gamma \seqar \Delta }{
265 101 adas
				\vltr{\pi'}{  !A, !A , \Gamma \seqar \Delta}{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
266 101 adas
			}
267 101 adas
		}
268 101 adas
		\]
269 101 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'$ and $\type (\Gamma) = (\vec v; \vec x)$.
270 101 adas
%		(Recall that the typing corresponding to $!$ means that all inputs for each $!A$ are normal).
271 101 adas
		We define $\vec f^\pi$ by duplicating the arguments for $!A$:
272 101 adas
		\[
273 101 adas
		\vec f^\pi (\vec u , \vec v ; \vec x)
274 101 adas
		\quad := \quad
275 101 adas
		\vec f' (\vec u, \vec u , \vec v ; \vec x)
276 101 adas
		\]
277 101 adas
%		(Notice that this is obtainable in BC by a trivial instance of safe composition.)
278 101 adas
279 101 adas
280 101 adas
		%	cntr right
281 101 adas
		%	\[
282 101 adas
		%	\vlderivation{
283 101 adas
		%	\vlin{\rigrul{\cntr}}{}{\Gamma \seqar \Delta, ?A}{
284 101 adas
		%	\vltr{\pi'}{  \Gamma \seqar \Delta, ?A, ?A}{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
285 101 adas
		%	}
286 101 adas
		%	}
287 101 adas
		%	\]
288 101 adas
		%	(need test function against witness predicate?)
289 101 adas
		%
290 101 adas
		%	\anupam{problem: how to test even equality of two terms? Maybe treat $?$ as $!$ on left?}
291 101 adas
		%
292 101 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?}
293 101 adas
		%
294 101 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.}
295 101 adas
		%
296 101 adas
		%	\anupam{this is actually the main point.}
297 101 adas
298 101 adas
299 101 adas
300 101 adas
301 101 adas
302 101 adas
		Suppose $\pi$ ends with a $\cut$ step:
303 101 adas
		\[
304 101 adas
		\vlderivation{
305 101 adas
			\vliin{\cut}{}{\Gamma , \Sigma \seqar \Delta , \Pi}{
306 101 adas
				\vltr{\pi_1}{ \Gamma \seqar \Delta, A }{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
307 101 adas
			}{
308 101 adas
			\vltr{\pi_2}{\Sigma , A \seqar \Pi}{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
309 101 adas
		}
310 101 adas
	}
311 101 adas
	\]
312 101 adas
313 101 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:
314 101 adas
315 101 adas
	\[
316 101 adas
	\vec f^\pi ( \vec u , \vec v ; \vec x, \vec y)
317 101 adas
	\quad := \quad
318 101 adas
	\left(
319 101 adas
	\vec g^\Delta (\vec u ; \vec x)
320 101 adas
	,
321 101 adas
	\vec h ( \vec v ; \vec y , \vec g^A ( \vec u ; \vec x ) )
322 101 adas
	\right)
323 101 adas
	\]
324 101 adas
	Notice that all safe inputs on the left occur hereditarily safe on the right, and so these expressions are definable in BC by Prop.~\ref{prop:bc-properties}.
325 101 adas
326 101 adas
327 101 adas
328 101 adas
329 101 adas
	In the other case, where $A$ may be modal, it must be of the form $!\word (t)$ since it must directly descend from the left-hand side of an induction step, by free-cut freeness.
330 101 adas
%	 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 $!\word (t)$.
331 101 adas
	 Since the cut is anchored, we can also assume that the cut formula is principal on the other side, i.e.\ $\pi$ is of the form:
332 101 adas
333 101 adas
%	\anupam{need to check this assumption against free-cut elimination conditions. To discuss.}
334 101 adas
335 101 adas
\[
336 101 adas
\vlderivation{
337 101 adas
	\vliin{\cut}{}{!\Gamma , \Sigma  \seqar \Delta }{
338 101 adas
		\vlin{\rigrul{!}}{}{!\Gamma \seqar  !\word(t)}{
339 101 adas
			\vltr{\pi_1'}{!\Gamma \seqar  \word(t)}{\vlhy{\quad}}{\vlhy{}}{\vlhy{\quad}}
340 101 adas
			}
341 101 adas
		}{
342 101 adas
		\vltr{\pi_2}{ !\word(t), \Sigma\seqar \Delta}{\vlhy{\quad}}{\vlhy{}}{\vlhy{\quad}}
343 101 adas
		}
344 101 adas
	}
345 101 adas
\]
346 101 adas
 where
347 101 adas
% $\pi_2$ ends with a $\ind$ step for which  $A(x)$ is the induction formula, and
348 101 adas
 we assume there are no side-formulae on the right of the end-sequent of $\pi_1$ for the same reason as $\rigrul{\cntr}$: $\pi$ does not contain any occurrences of $?$. By the inductive hypothesis we have functions $ g( \vec u ; )$ and $\vec h (  v , \vec w ; \vec x)$ from $\pi_1'$ and $\pi_2$ respectively, where $\vec u$, $ v$ and $(\vec w ; \vec x)$ correspond to $!\Gamma$,  $!\word(t)$ and $\Sigma$ respectively. We construct the functions $\vec f^\pi $ as follows:
349 101 adas
\[
350 101 adas
\vec f^\pi (\vec u , \vec w ; \vec x)
351 101 adas
\quad := \quad
352 101 adas
\vec h (   g(\vec u ; ), \vec w  ; \vec x)
353 101 adas
\]
354 101 adas
Notice, again, that all safe inputs on the left occur hereditarily safe on the right, and so these expressions are definable in BC by Prop.~\ref{prop:bc-properties}.
355 101 adas
356 101 adas
357 101 adas
358 101 adas
%	Suppose $\pi$ ends with a $\lefrul{!}$ step:
359 101 adas
%	\[
360 101 adas
%	\vlderivation{
361 101 adas
%		\vlin{!}{}{\Gamma, !A \seqar \Delta}{
362 101 adas
%			\vltr{\pi'}{ \Gamma , A \seqar \Delta  }{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
363 101 adas
%		}
364 101 adas
%	}
365 101 adas
%	\]
366 101 adas
%	\todo{finish this case, just passing a safe input to a normal input.}
367 101 adas
%
368 101 adas
%
369 101 adas
%	Suppose $\pi$ ends with a $\rigrul{!}$ step:
370 101 adas
%
371 101 adas
%	\todo{finish this case, should not change function at all, but maybe there is a consideration.}
372 101 adas
373 101 adas
	If $\pi$ ends with a $\rigrul{\wk}$ step then we just add a tuple of constant functions $\vec \epsilon$ of appropriate length as dummy functions. If $\pi$ ends with a $\lefrul{\wk}$ step then we just add dummy inputs of appropriate length.
374 101 adas
375 101 adas
%	Suppose $\pi$ ends with a $\lefrul{\wk}$ step:
376 101 adas
%
377 101 adas
%	\todo{finish this case, just add a dummy input.}
378 101 adas
%
379 101 adas
%	Suppose $\pi$ ends with a $\rigrul{\wk}$ step:
380 101 adas
%
381 101 adas
%	\todo{finish this case, just add a dummy function.}
382 101 adas
%
383 101 adas
384 101 adas
385 101 adas
	Finally, suppose $\pi$ ends with an $\ind$ step. Since there are no occurrences of $?$ in $\pi$ we can again assume that there are no side formulae on the right of any induction step. Thus $\pi$ is of the form:
386 101 adas
	\[
387 101 adas
	\vlderivation{
388 101 adas
		\vliin{\ind}{}{ !\word (t), !\Gamma  ,  A(\epsilon) \seqar A(t) }{
389 101 adas
			\vltr{\pi_0}{!\word(a) , !\Gamma ,  A(a) \seqar A(\succ_0 a)}{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
390 101 adas
		}{
391 101 adas
		\vltr{\pi_1}{!\word(a), !\Gamma ,  A(a)\seqar A(\succ_1 a) }{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
392 101 adas
	}
393 101 adas
}
394 101 adas
\]
395 101 adas
%\anupam{is this better with a premiss for the base case?}
396 101 adas
397 101 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 $!\word(a)$, $!\Gamma$ and $A(a)$ respectively. We define $\vec f^\pi$ by simultaneous predicative recursion on notation as follows:
398 101 adas
\[
399 101 adas
\begin{array}{rcll}
400 101 adas
\vec f^\pi ( \epsilon, \vec v ; \vec x ) & := & \vec x & \\
401 101 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 ) )
402 101 adas
\end{array}
403 101 adas
\]
404 101 adas
405 101 adas
%\anupam{check this}
406 101 adas
%
407 101 adas
%\todo{simultaneous PRN.}
408 101 adas
409 101 adas
410 101 adas
\end{definition}
411 101 adas
412 101 adas
The induction step above is the reason why we enrich the usual BC framework with a simultaneous version of PRN.
413 101 adas
414 101 adas
\newcommand{\qfindth}{\mathit{IQF}}
415 101 adas
416 101 adas
\subsection{Witness predicate and extensional equivalence of functions}
417 101 adas
418 101 adas
%\anupam{need to mention that this predicate is similar to realisability predicate in absence, and indeed is presented like that for applicative theories, which also rely on free-cut elimination.}
419 101 adas
420 101 adas
Now that we have seen how to extract BC functions from proofs, we show that these functions satisfy the appropriate semantic properties, namely the equational program $\eqspec$ we started with. For this we turn to a quantifier-free classical theory, in a similar fashion to $\mathit{PV}$ for $S^1_2$ in \cite{Buss86book} or system $T$ in G\"odel's Dialectica interpretation. This is adequate since we only care about extensional properties of extracted functions at this stage, the complexity properties already handled by the BC programs we just constructed.
421 101 adas
422 101 adas
We point out that we could equally use a realisability approach, as done in e.g.\ \cite{Cantini02} and other works in applicative theories, since the formulae we deal with are essentially positive and so there is not much difference between the two approaches. Indeed here the witness predicate plays the same role as the realisability predicate in other works.
423 101 adas
424 101 adas
%The witness predicate of the WFM is similar to the realisability predicate, and this is even more true in out setting
425 101 adas
426 101 adas
Let $\qfindth$ be the classical theory over the language $\{ \epsilon, \succ_0, \succ_1 , (f^k_i )\}$ obtained from the axioms $\sepeps, \sepzer, \sepone, \inj, \surj$ and $\ind$ by dropping all relativisations to $\word$ (or $!\word$), replacing all linear connectives by their classical counterparts, and restricting induction to only quantifier-free formulae.
427 101 adas
428 101 adas
%For this we work in a quantifier-free classical logic whose atoms are equations between terms of our arithmetic and whose (sound) rules are simply the axioms of our arithmetic.
429 101 adas
%
430 101 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$.)
431 101 adas
432 101 adas
433 101 adas
%	\todo{add cases for $\laor$ and $\neq$.}
434 101 adas
435 101 adas
		\newcommand{\witness}[2]{\mathit{Witness}^{#1}_{#2}}
436 101 adas
		\begin{definition}
437 101 adas
			[Witness predicate]
438 101 adas
			For formulae $A, B$ satisfying properties \ref{item:no-neg-word}, \ref{item:no-forall}, \ref{item:no-quest} of Prop.~\ref{prop:freedom}, we define the following `witness' predicate as a quantifier-free formula of $\qfindth$:
439 101 adas
%			 $A$ with free variables amongst $\vec a$:
440 101 adas
441 101 adas
		\renewcommand{\sigma}{a}
442 101 adas
			\[
443 101 adas
			\begin{array}{rcll}
444 101 adas
			\witness{}{A} (\sigma) & := & \sigma = t & \text{if $A$ is $\word (t)$.} \\
445 101 adas
			\witness{}{A} (\sigma) & := & s=t & \text{if $A$ is $s=t$.} \\
446 101 adas
						\witness{}{A} (\sigma) & := & s\neq t & \text{if $A$ is $s\neq t$.} \\
447 101 adas
			\witness{}{A \star B} ( \vec \sigma^A , \vec \sigma^B) & := &  \witness{}{A} (\vec \sigma^A) \cor \witness{}{B} (\vec \sigma^B) &
448 101 adas
						\text{for $\star \in \{ \lor,\laor\}$.}
449 101 adas
			\\
450 101 adas
			\witness{}{A \star B} ( \vec \sigma^A , \vec \sigma^B) & := &  \witness{}{A} (\vec \sigma^A ) \cand \witness{}{B} (\vec \sigma^B ) &
451 101 adas
						\text{for $\star \in \{ \land, \laand \}$.}
452 101 adas
			\\
453 101 adas
			\witness{}{\exists x^\word A} ( \sigma, \vec \sigma^A  ) & := & \witness{}{A}(\vec \sigma^A , \sigma ) & \\
454 101 adas
			\witness{}{!A} (\vec \sigma^A) & := & \witness{}{A} (\vec \sigma^A)
455 101 adas
			\end{array}
456 101 adas
			\]
457 101 adas
			where $|\vec \sigma^A| = |\type (A)|$ and $|\vec \sigma^B| = |\type (B)| $.
458 101 adas
		\end{definition}
459 101 adas
		%	\todo{problem: what about complexity of checking equality? }
460 101 adas
461 101 adas
		\begin{remark}
462 101 adas
		Notice that, unlike in the bounded arithmetic setting where the $\word$ predicate is redundant (since variables are tacitly assumed to range over $\word$), we do not parametrise the witness predicate by an assignment to the free variables of a formula. Instead these dependencies are taken care of by the explicit occurrences of the $\word$ predicate in $\arith$.
463 101 adas
		\end{remark}
464 101 adas
465 101 adas
%		\todo{Reformulate above later if necessary.}
466 101 adas
467 101 adas
		%	\todo{What about $\nat (t)$? What does it mean? Replace with true?}
468 101 adas
469 101 adas
		%	\todo{either use the witness predicate above, or use realizability predicate at meta-level and a model theory, like BH.}
470 101 adas
471 101 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.}
472 101 adas
473 101 adas
%		\anupam{to consider/remark: formally, is witness predicate checked in model or some logical theory?}
474 101 adas
475 101 adas
476 101 adas
477 101 adas
478 101 adas
\begin{lemma}
479 101 adas
\label{lemma:witness-invariant}
480 101 adas
Let $\pi$ be a free-cut free proof in $\closure{\eqspec}\cup \arith$, satisfying properties \ref{item:no-neg-word}, \ref{item:no-forall}, \ref{item:no-quest}, \ref{item:no-laor-step} of Prop.~\ref{prop:freedom}, of a sequent $\Gamma \seqar \Delta $. Let $\eqspec^\pi$ denote the equational specification induced by the BC program for $\vec f^\pi$.\footnote{We assume that the function symbols occurring in $\eqspec^\pi$ are distinct from those occurring in $\eqspec$.} Then $\qfindth$ proves:
481 101 adas
\[
482 101 adas
\left(\forall \eqspec \cand \forall \eqspec^\pi \cand \witness{}{\bigotimes \Gamma} (\vec a)\right) \cimp \witness{}{\bigparr \Delta } (\vec f^\pi(\vec a))
483 101 adas
\]
484 101 adas
where $\forall \eqspec$ and $\forall \eqspec^\pi$ denote the universal closures of $\eqspec$ and $\eqspec^\pi$ respectively.
485 101 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:
486 101 adas
%	\[
487 101 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)
488 101 adas
%			\]
489 101 adas
\end{lemma}
490 101 adas
491 101 adas
492 101 adas
%			\anupam{to consider: do we need parameters $\vec a$ in argument of $f$? Or does $\nat$ predicate take care of this?}
493 101 adas
%
494 101 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.
495 101 adas
%
496 101 adas
%%			We often suppress the parameters $\vec a$ when it is not important.
497 101 adas
%
498 101 adas
%			\anupam{Is this implication provable in Bellantoni's version of PV based on BC?}
499 101 adas
500 101 adas
			%	\anupam{for moment try ignore decoration on right? what about negation?}
501 101 adas
502 101 adas
503 101 adas
	\begin{proof}[Proof sketch]
504 101 adas
	By structural induction on $\pi$, again, following the definition of $\vec f^\pi$.
505 101 adas
	\end{proof}
506 101 adas
	Notice that, since we are in a classical theory, the proof of the above lemma can be carried out in an arbitrary model, by the completeness theorem, greatly easing the exposition.
507 101 adas
508 101 adas
	Finally, we arrive at our main result, providing a converse to Thm.~\ref{thm:arith-proves-bc-conv}.
509 101 adas
510 101 adas
		\begin{theorem}
511 101 adas
		\label{thm:main-result}
512 101 adas
		For any coherent equational specification $\eqspec$, if $\arith $ proves $\conv (f , \eqspec)$ then there is a polynomial-time function $g $ on $\Word$ (of same arity as $f$) such that $\eqspec [  g/ f ]$.
513 101 adas
514 101 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:
515 101 adas
%		\begin{equation}
516 101 adas
%		\label{eqn:spec-implies-program}
517 101 adas
%\Phi(f) \implies f (\vec x) = \mathbf{f} (\vec x)
518 101 adas
%		\end{equation}
519 101 adas
%		\begin{equation}
520 101 adas
%		\label{eqn:program-satisfies-spec}
521 101 adas
%		\Phi(\mathbf f)
522 101 adas
%		\end{equation}
523 101 adas
		\end{theorem}
524 101 adas
		\begin{proof}
525 101 adas
%		[Proof sketch]
526 101 adas
		By Thm.~\ref{thm:free-cut-elim} and Lemma~\ref{lemma:spec-norm-form} we have a free-cut free proof $\pi$ in $\closure{\eqspec} \cup \arith$ of $!\word (\vec x ) \seqar \word (f (\vec x))$. By Lemma~\ref{lemma:witness-invariant} above this means that $\vec a = \vec x \cimp f^\pi (\vec a) = f(\vec x)$ is true in any model of $\qfindth$ satisfying $\eqspec$ and $\eqspec^\pi$.
527 101 adas
%		Since some model must exist by coherence (cf.\ Prop.~\ref{prop:eq-spec-model}), we have that
528 101 adas
		Using the fact that $\eqspec \cup \eqspec^\pi$ is coherent we can construct such a model, similarly to Prop.~\ref{prop:eq-spec-model}, which will contain $\Word$ as an initial segment, in which we must have $f^\pi (\vec x) = f (\vec x)$ for every $\vec x \in \Word$, as required.\todo{polish}
529 101 adas
		\end{proof}
530 101 adas
531 101 adas
%			\begin{proof}
532 101 adas
%			Notice that a convergence statement has the following form:
533 101 adas
%			\[
534 101 adas
%			!\Phi(f) , !\nat(\vec a) \seqar \nat(f (\vec a) )
535 101 adas
%			\]
536 101 adas
%			By the lemma above, and by inspection of the definition of the witness predicate, this means we have that,
537 101 adas
%			\[
538 101 adas
%			(\Phi(f) \cand \vec x = \vec a ) \implies \mathbf f (\vec x) = f(\vec a)
539 101 adas
%			\]
540 101 adas
%			whence we arrive at \eqref{eqn:spec-implies-program}.
541 101 adas
%
542 101 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.
543 101 adas
%			\end{proof}
544 101 adas
%
545 101 adas
%			\anupam{rephrase above proof to make more sense.}
546 101 adas
%
547 101 adas
%%
548 101 adas
%\newcommand{\concat}{\mathit{concat}}
549 101 adas
%\paragraph{Some points on concatenation \anupam{if necessary}}
550 101 adas
%We can define the concatenation operation by PRN:
551 101 adas
%\[
552 101 adas
%\begin{array}{rcl}
553 101 adas
%\concat (\epsilon ; y) & : = & x \\
554 101 adas
%\concat (\succ_i x ; y) & := & \succ_i \concat (x ; y)
555 101 adas
%\end{array}
556 101 adas
%\]
557 101 adas
%
558 101 adas
%From here we can define iterated concatenation:
559 101 adas
%\[
560 101 adas
%\concat (x_1 , \dots x_n ; y) \quad := \quad \concat (x_n ; \concat (x_{n-1} ; \vldots \concat (x_1 ; y) \vldots ) )
561 101 adas
%\]
562 101 adas
%
563 101 adas
%(notice all safe inputs are hereditarily to the right of $;$ so this is definable by safe composition and projection.)