Statistiques
| Révision :

root / CSL16 / wfm.tex @ 117

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

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