| 17 |
17 |
\newcommand{\norm}{\nu}
|
| 18 |
18 |
\newcommand{\safe}{\sigma}
|
| 19 |
19 |
|
| 20 |
|
\subsection{Witness/realisability predicate}
|
| 21 |
20 |
|
| 22 |
|
\begin{definition}
|
| 23 |
|
[Typing]
|
| 24 |
|
To each $\Sigma^\nat_1$-formula $A$ we associate a sorted tuple of variables $\type (A)$, intended to range over $\Nat$, as follows:
|
| 25 |
|
\[
|
| 26 |
|
\begin{array}{rcll}
|
| 27 |
|
\type (\nat (t)) & := & (;x^{\nat (t)} ) & \\
|
| 28 |
|
\type(s = t) & := & ( ; x^{s = t}) & \\
|
| 29 |
|
\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)$.} \\
|
| 30 |
|
\type (A \land B) & : = & (\vec u , \vec v ; \vec x , \vec y) & \text{if $\type(A) = (\vec u ; \vec x)$ and $\type(B) = (\vec v ; \vec y)$.} \\
|
| 31 |
|
\type (! A) & : = & ( \vec u ,\vec x ; ) & \text{if $\type(A) = (\vec u ; \vec x )$.} \\
|
| 32 |
|
\type (\exists x^\nat . A) & := & (\vec u ; \vec x , y) & \text{if $\type (A) = (\vec u ; \vec x)$.}
|
| 33 |
|
% \type (\forall x^N . A) & := & \Nat \to \type(A)
|
| 34 |
|
\end{array}
|
| 35 |
|
\]
|
| 36 |
|
% where $\nu$ designates that the inputs are normal.
|
| 37 |
|
\end{definition}
|
| 38 |
|
|
| 39 |
|
|
| 40 |
|
\anupam{need to account for normality and safety somewhere. Attempting inlined and leaving types without this decoration.}
|
| 41 |
|
|
| 42 |
|
\begin{remark}
|
| 43 |
|
[Distribution of $!$]
|
| 44 |
|
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.
|
| 45 |
|
|
| 46 |
|
On the other hand, since we are working in affine logic, we do in general have $!(A \land B) \cong !A \land !B$.
|
| 47 |
|
\end{remark}
|
| 48 |
|
|
| 49 |
|
|
| 50 |
|
\newcommand{\witness}[2]{\mathit{Witness}^{#1}_{#2}}
|
|
21 |
|
|
22 |
\subsection{The translation}
|
|
23 |
|
| 51 |
24 |
\begin{definition}
|
| 52 |
|
[Witness predicate]
|
| 53 |
|
We define the following `witness' predicate for $\Sigma^\nat_1$-formulae $A$ with free variables amongst $\vec a$:
|
|
25 |
[Typing]
|
|
26 |
To each $\Sigma^\nat_1$-formula $A$ we associate a sorted tuple of variables $\type (A)$, intended to range over $\Nat$, as follows:
|
| 54 |
27 |
\[
|
| 55 |
28 |
\begin{array}{rcll}
|
| 56 |
|
\witness{\vec a}{A} (w, \vec b) & := & w = t(\vec b) & \text{if $A(\vec a)$ is $\nat (t(\vec a))$.} \\
|
| 57 |
|
\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)$.} \\
|
| 58 |
|
\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) &
|
| 59 |
|
% \text{for $\star \in \{ \land, \lor, \laand , \laor\}$.}
|
| 60 |
|
\\
|
| 61 |
|
\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) &
|
| 62 |
|
% \text{for $\star \in \{ \land, \lor, \laand , \laor\}$.}
|
| 63 |
|
\\
|
| 64 |
|
\witness{\vec a}{\exists x^\nat . A(x)} ( w, \vec w , \vec b) & := & \witness{\vec{a}, a}{A(a)}(\vec w , \vec b, w ) & \\
|
|
29 |
\type (\nat (t)) & := & (;x^{\nat (t)} ) & \\
|
|
30 |
\type(s = t) & := & ( ; x^{s = t}) & \\
|
|
31 |
\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)$.} \\
|
|
32 |
\type (A \land B) & : = & (\vec u , \vec v ; \vec x , \vec y) & \text{if $\type(A) = (\vec u ; \vec x)$ and $\type(B) = (\vec v ; \vec y)$.} \\
|
|
33 |
\type (! A) & : = & ( \vec u ,\vec x ; ) & \text{if $\type(A) = (\vec u ; \vec x )$.} \\
|
|
34 |
\type (\exists x^\nat . A) & := & (\vec u ; \vec x , y) & \text{if $\type (A) = (\vec u ; \vec x)$.}
|
|
35 |
% \type (\forall x^N . A) & := & \Nat \to \type(A)
|
| 65 |
36 |
\end{array}
|
| 66 |
37 |
\]
|
| 67 |
|
where $|\vec w^1| = |\type (A)|$ and $|\vec w^2| = |\type (B)| $.
|
|
38 |
% where $\nu$ designates that the inputs are normal.
|
| 68 |
39 |
\end{definition}
|
| 69 |
|
% \todo{problem: what about complexity of checking equality? }
|
| 70 |
40 |
|
| 71 |
|
\todo{Reformulate above later if necessary.}
|
| 72 |
41 |
|
| 73 |
|
% \todo{What about $\nat (t)$? What does it mean? Replace with true?}
|
|
42 |
\anupam{need to account for normality and safety somewhere. Attempting inlined and leaving types without this decoration.}
|
| 74 |
43 |
|
| 75 |
|
% \todo{either use the witness predicate above, or use realizability predicate at meta-level and a model theory, like BH.}
|
|
44 |
\begin{remark}
|
|
45 |
[Distribution of $!$]
|
|
46 |
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.
|
|
47 |
|
|
48 |
On the other hand, since we are working in affine logic, we do in general have $!(A \land B) \cong !A \land !B$.
|
|
49 |
\end{remark}
|
| 76 |
50 |
|
| 77 |
|
% \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.}
|
| 78 |
|
|
| 79 |
|
\anupam{to consider/remark: formally, is witness predicate checked in model or some logical theory?}
|
| 80 |
|
|
| 81 |
|
\subsection{The translation}
|
| 82 |
|
|
| 83 |
51 |
\begin{definition}
|
| 84 |
52 |
[Translation]
|
| 85 |
|
We give a translation of free-cut free $\Sigma^\nat_1$-$\pind$ proofs $\pi$ of sequents $\Gamma(\vec a) \seqar \Delta(\vec a)$ to BC-programs for a vector of functions $\vec f^\pi$ with argument of type $\type \left(\bigotimes\Gamma\right)$ such that $|\vec f^\pi | = | \type\left(\bigparr\Delta\right)|$ and:
|
| 86 |
|
\[
|
| 87 |
|
\witness{\vec a}{\bigotimes \Gamma} (\vec w , \vec b) \implies \witness{\vec a}{\bigparr \Delta } (\vec f^\pi(\vec w , \vec b), \vec b)
|
| 88 |
|
\]
|
|
53 |
We give a translation of free-cut free $\Sigma^\nat_1$-$\pind$ proofs $\pi$ of sequents $\Gamma(\vec a) \seqar \Delta(\vec a)$ to BC-programs for a vector of functions $\vec f^\pi$ with argument of type $\type \left(\bigotimes\Gamma\right)$ such that $|\vec f^\pi | = | \type\left(\bigparr\Delta\right)|$.
|
| 89 |
54 |
|
| 90 |
|
\anupam{to consider: do we need parameters $\vec a$ in argument of $f$? Or does $\nat$ predicate take care of this?}
|
| 91 |
55 |
|
| 92 |
|
% 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.
|
| 93 |
|
|
| 94 |
|
We often suppress the parameters $\vec a$ when it is not important.
|
| 95 |
|
|
| 96 |
|
\anupam{Is this implication provable in Bellantoni's version of PV based on BC?}
|
| 97 |
|
|
| 98 |
|
% \anupam{for moment try ignore decoration on right? what about negation?}
|
| 99 |
|
|
| 100 |
|
|
| 101 |
|
|
| 102 |
56 |
The translation is by induction on the size of a free-cut free proof, so we proceed by analysis of the final step of a proof.
|
| 103 |
57 |
|
| 104 |
58 |
If $\pi$ is simply an axiom, we construct $\vec f^\pi$ as follows:
|
| ... | ... | |
| 389 |
343 |
|
| 390 |
344 |
\end{definition}
|
| 391 |
345 |
|
|
346 |
\subsection{Witness predicate and extensional equivalence of functions}
|
|
347 |
|
|
348 |
Now that we have defined how to extract a function from a proof, we need to show that the function satisfies the appropriate semantic properties.
|
|
349 |
|
|
350 |
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.
|
|
351 |
|
|
352 |
(This is similar to the role of PV in the witnessing argument for $S^1_2$ and system $T$ for witnessing $I\Sigma_1$.)
|
|
353 |
|
|
354 |
|
|
355 |
\newcommand{\witness}[2]{\mathit{Witness}^{#1}_{#2}}
|
|
356 |
\begin{definition}
|
|
357 |
[Witness predicate]
|
|
358 |
We define the following `witness' predicate for $\Sigma^\nat_1$-formulae $A$ with free variables amongst $\vec a$:
|
|
359 |
\[
|
|
360 |
\begin{array}{rcll}
|
|
361 |
\witness{\vec a}{A} (w, \vec b) & := & w = t(\vec b) & \text{if $A(\vec a)$ is $\nat (t(\vec a))$.} \\
|
|
362 |
\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)$.} \\
|
|
363 |
\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) &
|
|
364 |
% \text{for $\star \in \{ \land, \lor, \laand , \laor\}$.}
|
|
365 |
\\
|
|
366 |
\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) &
|
|
367 |
% \text{for $\star \in \{ \land, \lor, \laand , \laor\}$.}
|
|
368 |
\\
|
|
369 |
\witness{\vec a}{\exists x^\nat . A(x)} ( w, \vec w , \vec b) & := & \witness{\vec{a}, a}{A(a)}(\vec w , \vec b, w ) & \\
|
|
370 |
\end{array}
|
|
371 |
\]
|
|
372 |
where $|\vec w^1| = |\type (A)|$ and $|\vec w^2| = |\type (B)| $.
|
|
373 |
\end{definition}
|
|
374 |
% \todo{problem: what about complexity of checking equality? }
|
|
375 |
|
|
376 |
\todo{Reformulate above later if necessary.}
|
|
377 |
|
|
378 |
% \todo{What about $\nat (t)$? What does it mean? Replace with true?}
|
|
379 |
|
|
380 |
% \todo{either use the witness predicate above, or use realizability predicate at meta-level and a model theory, like BH.}
|
|
381 |
|
|
382 |
% \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.}
|
|
383 |
|
|
384 |
\anupam{to consider/remark: formally, is witness predicate checked in model or some logical theory?}
|
|
385 |
|
|
386 |
|
|
387 |
|
|
388 |
|
|
389 |
\begin{lemma}
|
|
390 |
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:
|
|
391 |
\[
|
|
392 |
\witness{\vec a}{\bigotimes \Gamma} (\vec w , \vec b) \implies \witness{\vec a}{\bigparr \Delta } (\vec f^\pi(\vec w , \vec b), \vec b)
|
|
393 |
\]
|
|
394 |
\end{lemma}
|
|
395 |
|
|
396 |
|
|
397 |
\anupam{to consider: do we need parameters $\vec a$ in argument of $f$? Or does $\nat$ predicate take care of this?}
|
|
398 |
|
|
399 |
% 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.
|
|
400 |
|
|
401 |
% We often suppress the parameters $\vec a$ when it is not important.
|
|
402 |
|
|
403 |
\anupam{Is this implication provable in Bellantoni's version of PV based on BC?}
|
|
404 |
|
|
405 |
% \anupam{for moment try ignore decoration on right? what about negation?}
|
|
406 |
|
|
407 |
|
|
408 |
\begin{proof}
|
|
409 |
By structural induction on $\pi$, again, following the definition of $\vec f^\pi$.
|
|
410 |
\todo{}
|
|
411 |
\end{proof}
|
|
412 |
|
|
413 |
\begin{theorem}
|
|
414 |
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:
|
|
415 |
\begin{equation}
|
|
416 |
\label{eqn:spec-implies-program}
|
|
417 |
\Phi(f) \implies f (\vec x) = \mathbf{f} (\vec x)
|
|
418 |
\end{equation}
|
|
419 |
\begin{equation}
|
|
420 |
\label{eqn:program-satisfies-spec}
|
|
421 |
\Phi(\mathbf f)
|
|
422 |
\end{equation}
|
|
423 |
\end{theorem}
|
|
424 |
\begin{proof}
|
|
425 |
Notice that a convergence statement has the following form:
|
|
426 |
\[
|
|
427 |
!\Phi(f) , !\nat(\vec a) \seqar \nat(f (\vec a) )
|
|
428 |
\]
|
|
429 |
By the lemma above, and by inspection of the definition of the witness predicate, this means we have that,
|
|
430 |
\[
|
|
431 |
(\Phi(f) \cand \vec x = \vec a ) \implies \mathbf f (\vec x) = f(\vec a)
|
|
432 |
\]
|
|
433 |
whence we arrive at \eqref{eqn:spec-implies-program}.
|
|
434 |
|
|
435 |
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.
|
|
436 |
\end{proof}
|
|
437 |
|
|
438 |
\anupam{rephrase above proof to make more sense.}
|
|
439 |
|
|
440 |
|
| 392 |
441 |
\newcommand{\concat}{\mathit{concat}}
|
| 393 |
442 |
\paragraph{Some points on concatenation \anupam{if necessary}}
|
| 394 |
443 |
We can define the concatenation operation by PRN:
|