Statistiques
| Révision :

root / CSL16 / final-version / wfm.tex @ 118

Historique | Voir | Annoter | Télécharger (32,25 ko)

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