Statistiques
| Révision :

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

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

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