Index: CSL16/feas-arith-wfm.tex
===================================================================
--- CSL16/feas-arith-wfm.tex	(revision 31)
+++ CSL16/feas-arith-wfm.tex	(revision 32)
@@ -280,14 +280,15 @@
 \vlinf{\rigrul{\exists}}{}{\Gamma \seqar \Delta, \exists x . A(x)}{ \Gamma \seqar \Delta, A(t)}
 &
 \vlinf{\rigrul{\forall}}{}{\Gamma \seqar \Delta, \forall x . A(x)}{ \Gamma \seqar \Delta, A(a) } \\
-\noalign{\bigskip}
- \vliinf{mix}{}{\Gamma, \Sigma \seqar \Delta , \Pi}{ \Gamma \seqar \Delta}{\Sigma \seqar \Pi} &&&
+%\noalign{\bigskip}
+% \vliinf{mix}{}{\Gamma, \Sigma \seqar \Delta , \Pi}{ \Gamma \seqar \Delta}{\Sigma \seqar \Pi} &&&
 \end{array}
 \end{array}
 \]
 where $p$ atomic, $i \in \{ 1,2 \}$ and the eigenvariable $a$ does not occur free in $\Gamma$ or $\Delta$.
 \end{definition}
- Note that this system is \textit{affine} in the sense that it includes general weakening rules $\rigrul{\wk}$ and  $\lefrul{\wk}$, while in linear logic   $\rigrul{\wk}$ (resp. $\lefrul{\wk}$) is restricted to formulas of the form $?A$ (resp. $!A$). The rule $mix$ is included so that this system admits cut elimination. In the following though, by linear logic we will mean affine linear logic.
+ Note that this system is \textit{affine} in the sense that it includes general weakening rules $\rigrul{\wk}$ and  $\lefrul{\wk}$, while in linear logic   $\rigrul{\wk}$ (resp. $\lefrul{\wk}$) is restricted to formulas of the form $?A$ (resp. $!A$). %The rule $mix$ is included so that this system admits cut elimination. 
+  In the following though, by linear logic we will mean affine linear logic.
  
   We will consider extensions of linear logic with a \textit{theory}  $\mathcal T$ consisting in a finite set of additional axioms and rules, depicted as:
 
@@ -300,7 +301,8 @@
  where in rule (R), $I$ is a finite set (indicating the number of premises) and we assume the following conditions:
  \begin{enumerate}
  \item  We have:$$ FV(\Sigma_i, \Delta_i) \cap FV(!\Gamma, ? \Pi)= FV(\Sigma_i, \Delta_i) \cap FV(\Sigma', \Delta')= \emptyset $$
- \item $ \Sigma', \Delta'$ does not contain any formula of the shape $!A$ or $?A$. 
+ \item $ \Sigma'$ (resp. $\Delta'$) does not contain any formula of the shape $?A$ (resp. $!A$).  
+ %  \item $ \Sigma', \Delta'$ does not contain any formula of the shape $!A$ or $?A$. 
  \end{enumerate}
   
   \patrick{Anupam: note that I had to strengthen the conditions for the rules (R). Condition (1) is needed 
@@ -320,9 +322,10 @@
    Let us give an example of a possible rule (R) of a theory $\mathcal T$:
    
    \[
-	\vlinf{(ind)}{(x \notin \FV(\Gamma, \Delta))}{ !\Gamma , A(0) \seqar A(t) , ?\Delta }{ !\Gamma , A(x) \seqar A(s x ), ?\Delta }
+	\vlinf{(ind)}{(x \notin \FV(\Gamma, \Delta))}{ !\Gamma , N(t), A(0) \seqar A(t) , ?\Delta }{ !\Gamma , A(x) \seqar A(s x ), ?\Delta }
 	\]
 
+So here we have $I=\{1\}$ (one premise), $\Sigma_1=A(x)$, $\Delta_1= A(s x )$, $\Sigma'= N(t), A(0)$, $\Delta'= A(t)$. So conditions 1 and 2 are satisfied provided $x\notin FV(!\Gamma, ?\Pi)$ and $x\notin FV(t)$. 
 %\[
 %	\vliinf{}{(x \notin \FV(\Gamma, \Delta))}{ !\Gamma , A(\epsilon) \seqar A(t) , ?\Delta }{ !\Gamma , A(x) \seqar A(s_0 x ), ?\Delta }{ !\Gamma, A(x) \seqar A( s_1 x ) , ?\Delta}
 %	\]
@@ -615,10 +618,10 @@
       
       If one of the premises is an axiom $\lefrul{\bot}$, $\id$ or $\rigrul{\bot}$, then $\pi$ can be rewritten to a suitable proof $\pi'$ by removing $c$ and the axiom rule. Otherwise both premises introduce the same connective, either  $\land$, $\lor$, $\laor$, $\laand$, $\forall$ or $\exists$. In each case a specific rewriting rule replaces the cut $c$ with one cut of strictly lower degree. See the Appendix.
       
-      \item \textbf{weakening sub-case}: the remaining case is when one of the premises of $c$ is a $wk$ rule and the other one is a rule distinct from $cntr$, $\rigrul{?}$ or $\lefrul{!}$. W.l.o.g. assume that the left premise of $c$ is conclusion of $\lefrul{\wk}$. If the right premise is conclusion of say rule $\rigrul{\land}$ on a formula $A_1\land A_2$, then $c$ is replaced by two cuts $c_i$ ($i=1,2$) on a formula $A_i$ obtained (on the left) by a $\lefrul{\wk}$ rule. These two cuts are of strictly lower degree than $c$, so we are done. We proceed in a similar way in the cases of rules introducing connectives $\lor$, $\laand$, $\laor$, $\forall$, $\exists$. Now,there remains the case where the right premise is a $\rigrul{\wk}$: then the cut can be eliminated by erasing the two $wk$ rules and using instead a $mix$ rule. In this case also the degree has decreased.
+      \item \textbf{weakening sub-case}: the remaining case is when one of the premises of $c$ is a $wk$ rule and the other one is a rule distinct from $cntr$, $\rigrul{?}$ or $\lefrul{!}$. W.l.o.g. assume that the left premise of $c$ is conclusion of $\lefrul{\wk}$, with principal formula $A$. If the right premise is conclusion of say rule $\rigrul{\land}$ on the formula $A=A_1\land A_2$, then $c$ is replaced by two cuts $c_i$ ($i=1,2$) on a formula $A_i$ obtained (on the left) by a $\lefrul{\wk}$ rule. These two cuts are of strictly lower degree than $c$, so we are done. We proceed in a similar way in the cases of rules introducing connectives $\lor$, $\laand$, $\laor$, $\forall$, $\exists$. Now, there remains the case where the right premise is a $\rigrul{\wk}$: then the cut can be eliminated by keeping only the l.h.s. proof $\pi_1$, removing the last cut $c$ and last    $\rigrul{\wk}$ rule    on $A$, and by adding enough
+        $\rigrul{\wk}$, $\lefrul{\wk}$ rules to introduce all the new formulas in the final sequent. 
+
       
-      \patrick{Display the rewriting step here}.
-      
      \end{itemize}
      
       
@@ -722,6 +725,8 @@
 
 CHECK THESE!
 
+\todo{prove that free-cut elimination can be done with these rules}
+
 \todo{Also include rules for contraction and weakening.}
 
 \section{Convergence of Bellantoni-Cook programs}
@@ -862,10 +867,11 @@
 	\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)$.} \\
 		\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)$.} \\
 	\type (! A) & : = & (\vec u , \vec x ;) & \text{if $\type (A) = (\vec u ; \vec x)$.} \\
-	\type (\exists x^N . A) & := & (\vec u ; \vec x , y) & \text{if $\type(A) = (\vec u ; \vec x)$.} \\
+	\type (\exists x^N . A) & := & \Nat \times \type (A) & \\
 %	\type (\forall x^N . A) & := & \Nat \to \type(A)
 	\end{array}
 	\]
+	where $\nu$ designates that the inputs are normal.
 	\end{definition}
 	
 
@@ -880,41 +886,30 @@
 	\newcommand{\witness}[2]{\mathit{Witness}^{#1}_{#2}}
 	\begin{definition}
 		[Witness predicate]
-		We define the following `witness' predicate for $\Sigma^\nat_1$-formulae $A$ with free variables amongst $\vec a$:
+		We define the following formula:
 		\[
 		\begin{array}{rcll}
-		\witness{\vec a}{A} (w, \vec b) & := & w = t(\vec b) & \text{if $A(\vec a)$ is $\nat (t(\vec a))$.} \\
-			\witness{\vec a}{A} (w, \vec b) & := & s(\vec b) = t(\vec b) & \text{if $A(\vec a)$ is $s(\vec a) = t (\vec b)$.} \\
-			\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) & 
-%			\text{for $\star \in \{ \land, \lor, \laand , \laor\}$.} 
-			\\
-				\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) & 
-				%			\text{for $\star \in \{ \land, \lor, \laand , \laor\}$.} 
-				\\
-		\witness{\vec a}{\exists x^\nat . A(x)} ( w, \vec w  , \vec b) & := & \witness{\vec{a}, a}{A(a)}(\vec w , \vec b, w ) & \\
+		\witness{\vec a}{A} (w, \vec a) & := & A(\vec a) & \text{for $A$ quantifier-free.} \\
+		\witness{\vec a}{\exists x . A} (w, \vec w , \vec a) & := & \witness{\vec{a}, a}{A(a)}(\vec w , \vec a, w ) & \\
+		\witness{\vec a}{A \star B} ( \vec w^1 , \vec w^2 ) & := &  \witness{\vec a}{A} (\vec w^1) \star \witness{\vec a}{B} (\vec w^2) & \text{for $\star \in \{ \land, \lor, \laand , \laor\}$.} \\
 		\end{array}
 		\]
-		where $|\vec w^1| = |\type (A)|$ and $|\vec w^2| = |\type (B)| $.
 	\end{definition}
-%	\todo{problem: what about complexity of checking equality? }
+	\todo{problem: what about complexity of checking equality? }
 	
-\todo{Reformulate above later if necessary.}
+	\todo{What about $\nat (t)$? What does it mean? Replace with true?}
 	
-%	\todo{What about $\nat (t)$? What does it mean? Replace with true?}
+	\todo{either use the witness predicate above, or use realizability predicate at meta-level and a model theory, like BH.}
 	
-%	\todo{either use the witness predicate above, or use realizability predicate at meta-level and a model theory, like BH.}
+	\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.}
 	
-%	\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.}
-	
-	\anupam{to consider/remark: formally, is witness predicate checked in model or some logical theory?}
-	
 	\subsection{The translation}
 
 \begin{definition}
 	[Translation]
 	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:
 	\[
-	\witness{\vec a}{\bigotimes \Gamma} (\vec w , \vec b) \implies \witness{\vec a}{\bigparr \Delta } (\vec f(\vec w , \vec b), \vec b)
+	\witness{\vec a}{\bigotimes \Gamma} (\vec w , \vec a) \implies \witness{\vec a}{\bigparr \Delta } (\vec f(\vec w , \vec a), \vec a)
 	\]
 	
 	\anupam{to consider: do we need parameters $\vec a$ in argument of $f$? Or does $\nat$ predicate take care of this?}
@@ -925,7 +920,7 @@
 	
 	\anupam{Is this implication provable in Bellantoni's version of PV based on BC?}
 	
-%	\anupam{for moment try ignore decoration on right? what about negation?}
+	\anupam{for moment try ignore decoration on right? what about negation?}
 	
 
 	
@@ -1017,88 +1012,84 @@
 
 \anupam{commented stuff on additives. To remark later perhaps.}
 
-
-
-Suppose $\pi$ ends with a $\rigrul{\exists}$ step,
 \[
 \vlderivation{
-	\vlin{\rigrul{\exists}}{}{ \Gamma, \nat(t) \seqar \Delta , \exists x^\nat . A(x) }{
-		\vltr{\pi'}{ \Gamma \seqar \Delta , A(t) }{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
-	}
+\vliin{\cut}{}{\Gamma , \Sigma \seqar \Delta , \Pi}{
+\vltr{\pi_1}{ \Gamma \seqar \Delta, A }{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
+}{
+\vltr{\pi_2}{\Sigma , A \seqar \Pi}{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
 }
+}
+	\]
+	
+We can assume that $A$ in the conclusion of $\pi_2$ is free of modalities, since one of the $A$s must be directly descended from an induction formula, and so consists of only safe inputs. Therefore we have functions $\vec f^1 (\vec w; \vec x)$ and $\vec f^2 (\vec y ; \vec z , \vec u)$ for $\pi_1$ and $\pi_2 $ respectively (free variable parameters are suppressed), with $\vec u$ corresponding to the (safe) inputs for $A$. 
+
+Let us write:
+\[
+\begin{array}{rcl}
+\vec f^1 & = & ( \vec f^1_i )^{|\Delta|+1}_{i=1} \\
+\vec f^2 & = & ( \vec f^2_i )^{|\Pi|}_{i=1}
+\end{array}
 \]
-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:
+to denote the parts of $\vec f^i$ corresponding to formulae in their sequents.
+
+
+We define:
 \[
-\vec f^\pi (\vec u ; \vec x , y)
+\vec f (\vec w , \vec y ; \vec x , \vec z)
 \quad := \quad
-\left( \vec f^\Delta (\vec u ; \vec x) , \id (;y), \vec{ f}^{A(t)} (\vec u; \vec x)  \right)
+(
+( \vec f^1_i (\vec w ; \vec x) )_{i \leq |\Delta|}
+,
+\vec f^2 ( \vec y ; \vec z , \vec f^1_{|\Delta| +1 } (\vec w ; \vec x) )
+)
 \]
-(The identity function on $y$ is defined from successor, predecessor and safe composition).
 
+Notice that all safe inputs are hereditarily right of a $;$, and so these terms are definable by safe composition and projection.
 
-%Suppose we have functions $\vec f^X (\vec x ; \vec y)$ from $\pi'$ for $X = \Delta$ or $ X=A$. 
-%\[
-%\vec f(\vec x ; \vec y , z) \quad := \quad ( \vec f^\Delta (\vec x ; \vec y)   ,  z , \vec f^A ( \vec x ; \vec y ) )
-%\]
+\todo{another case for $!\nat(x)$ cut formula.}
 
+\anupam{should work for arbitrary $!$-cuts due to principal case for $!$}
 
-Suppose $\pi$ ends with a $\lefrul{\exists}$ step:
+
+Right existential:
 \[
 \vlderivation{
-	\vlin{\lefrul{\exists}}{}{ \Gamma, \exists x^N . A(x) \seqar \Delta }{
-		\vltr{\pi'(a)}{ \Gamma , A(a),  N(a) \seqar \Delta  }{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
-	}
+\vlin{\rigrul{\exists}}{}{ \Gamma, \nat(t) \seqar \Delta , \exists x^\nat . A(x) }{
+\vltr{\pi'}{ \Gamma \seqar \Delta , A(t) }{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
 }
+}
 \]
-%
-%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:
-%\[
-%\vec f ( \vec u , \vec v ;  )
-%\]
+Suppose we have functions $\vec f^X (\vec x ; \vec y)$ from $\pi'$ for $X = \Delta$ or $ X=A$. 
+\[
+\vec f(\vec x ; \vec y , z) \quad := \quad ( \vec f^\Delta (\vec x ; \vec y)   ,  z , \vec f^A ( \vec x ; \vec y ) )
+\]
 
-\anupam{should just be same? Consider variable naming, just in case.}
-\anupam{This is probably where the consideration for free variables is.}
 
-%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:
-%\[
-%\vec f ( \vec v , \vec w ; \vec x , y , \vec z )
-%\]
-
-
-Suppose $\pi$ ends with a $\cut$ step:
+Left existential:
 \[
 \vlderivation{
-\vliin{\cut}{}{\Gamma , \Sigma \seqar \Delta , \Pi}{
-\vltr{\pi_1}{ \Gamma \seqar \Delta, A }{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
-}{
-\vltr{\pi_2}{\Sigma , A \seqar \Pi}{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
+\vlin{\lefrul{\exists}}{}{ \Gamma, \exists x^N . A(x) \seqar \Delta }{
+\vltr{\pi'(a)}{ \Gamma,  N(a) , A(a) \seqar \Delta  }{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
 }
 }
-	\]
-	
-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:
+\]
 
+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:
 \[
-\vec f^\pi ( \vec u , \vec v ; \vec x, \vec y)
-\quad := \quad
-\left(
-\vec g^\Delta (\vec u ; \vec x) 
-,
-\vec h ( \vec v ; \vec y , \vec g^A ( \vec u ; \vec x ) )
-\right)
+\vec f ( \vec u , \vec v ;  )
 \]
-(Notice that all safe inputs are hereditarily safe in these expressions, so they are definable by safe composition and projection).
 
+\anupam{should just be same, no? To consider.}
 
+%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:
+%\[
+%\vec f ( \vec v , \vec w ; \vec x , y , \vec z )
+%\]
 
+\todo{finish}
 
-In the other case, where $A$ may be modal, it must be of the form $!\nat (t)$ since it is a cut formula, and so must directly descend from an induction step or axiom. The only such occurrence of a modality is in the conclusion of an induction step, whence such a formula has the form $!\nat (t)$. By free-cut elimination we can also assume that this cut formula is principal on \emph{both} sides, i.e.\ $\pi$ is of the form:
-
-\todo{finish this case}
-
-
-
-Suppose $\pi$ ends with a $\lefrul{!}$ step:
+!:
 \[
 \vlderivation{
 \vlin{!}{}{\Gamma, !A \seqar \Delta}{
@@ -1106,24 +1097,10 @@
 }
 }
 \]
-\todo{finish this case, just passing a safe input to a normal input.}
+\anupam{Again, use free-cut elimination to get rid of this case. We know $!$-ed formulae in advance, so just fix those as normal inputs in advance.}
 
 
-Suppose $\pi$ ends with a $\rigrul{!}$ step:
-
-\todo{finish this case, should not change function at all, but maybe there is a consideration.}
-
-Suppose $\pi$ ends with a $\lefrul{\wk}$ step:
-
-\todo{finish this case, just add a dummy input.}
-
-Suppose $\pi$ ends with a $\rigrul{\wk}$ step:
-
-\todo{finish this case, just add a dummy function.}
-
-
-
-Suppose $\pi$ ends with a $\pind$ step. For the same reason as $\rigrul{\cntr}$ we can assume there are no $?$ formulae and so no side formulae on the right. Thus a $\pi$ has the following form:
+Induction: (can assume no side-formulae on right for same reason as no contraction.)
 \[
 \vlderivation{
 \vliin{\ind}{}{ !\Gamma , !\nat (t) ,  A(\epsilon) \seqar A(t) }{
@@ -1134,8 +1111,6 @@
 }
 \]
 
-By the inductive hypothesis we have functions:
-
 Suppose we have functions $\vec f^i (\vec x , y ; \vec u)$ from proofs $\pi_i$ where $\vec x $ corresponds to $!\Gamma$, $y$ corresponds to $!N(a)$ and $\vec u$ corresponds to $A(a)$.
 
 
