Statistiques
| Révision :

root / CSL16 / wfm.tex @ 89

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

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