Index: CSL16/wfm.tex
===================================================================
--- CSL16/wfm.tex	(revision 68)
+++ CSL16/wfm.tex	(revision 69)
@@ -163,7 +163,7 @@
 		\right)
 		\] 
 		
-		We will continue with a similar notational convention as above in the remainder of this argument.
+		We will continue with similar notational conventions in the remainder of this argument.
 		
 		%	\anupam{bad notation since need to include free variables of sequent too. (also of theory.) Reconsider.}
 		
@@ -174,6 +174,83 @@
 		
 		By assumption, there are no $\bot$, $?$ or $\forall$ steps occurring in $\pi$.
 		
+		
+			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 }}
+					}
+				}
+				\]
+				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:
+				\[
+				\vec f^\pi (\vec u ; \vec x , y)
+				\quad := \quad
+				\left( 
+				\vec f^\Delta (\vec u ; \vec x) ,
+				{\id (;y)},
+				\vec f^{A(t)} (\vec u; \vec x)  
+				\right)
+				\]
+		%		(The identity function on $y$ is defined from successor, predecessor and safe composition).
+				
+				
+				%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 ) )
+				%\]
+				
+				
+				If $\pi$ ends with a $\lefrul{\exists}$ step,
+				\[
+				\vlderivation{
+					\vlin{\lefrul{\exists}}{}{ \Gamma, \exists x^N . A(x) \seqar \Delta }{
+						\vltr{\pi'}{ \Gamma , A(a),  N(a) \seqar \Delta  }{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
+					}
+				}
+				\]
+				then $\vec f^{\pi}$ is exactly the same as $\vec f^{\pi'}$.
+				%
+				%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 ;  )
+				%\]
+				
+%				\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 )
+				%\]
+			
+			
+			
+					%	\[
+					%	\vlderivation{
+					%	\vliin{\rigrul{\laand}}{}{\Gamma \seqar \Delta, A \laand B}{
+					%	\vltr{\pi_1}{  \Gamma \seqar \Delta, A}{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
+					%	}{
+					%	\vltr{\pi_2}{  \Gamma \seqar \Delta, B}{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
+					%	}
+					%	}
+					%	\]
+					%	
+					%	Suppose we have $\vec f^i (\vec x , \vec a ; \vec y , \vec b)$ from $\pi_i$.
+					%	
+					%	\anupam{problem: does this require many tests, just like for contraction? Can we isolate a different complexity class? e.g.\ PH or Grzegorzyck?}
+					%	\anupam{skip this case and consider later.}
+					
+			%		\anupam{commented stuff on additives. To remark later perhaps.}
+					
+					
+			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.		
+				
+			Since there are no $?$ symbols in $\pi$, we can assume also that there are no $\rigrul{\cntr}$ steps in $\pi$.
+						
+		%		\anupam{This is important, so expand on this here or in a remark before/after.}
+				
 		Suppose $\pi$ ends with a $\lefrul{\cntr}$ step,
 		\[
 		\vlderivation{
@@ -182,7 +259,7 @@
 			}
 		}
 		\]
-		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'$, respectively, and $\type (\Gamma) = (\vec v; \vec x)$. 
+		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)$. 
 %		(Recall that the typing corresponding to $!$ means that all inputs for each $!A$ are normal). 
 		We define $\vec f^\pi$ by duplicating the arguments for $!A$:
 		\[
@@ -211,76 +288,10 @@
 		%	
 		%	\anupam{this is actually the main point.}
 		
-		From the assumption that there are no $?$ symbols in $\pi$, we can assume also that there are no $\rigrul{\cntr}$ steps in $\pi$.
-				
-%		\anupam{This is important, so expand on this here or in a remark before/after.}
+	
 		
+	
 		
-		%	\[
-		%	\vlderivation{
-		%	\vliin{\rigrul{\laand}}{}{\Gamma \seqar \Delta, A \laand B}{
-		%	\vltr{\pi_1}{  \Gamma \seqar \Delta, A}{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
-		%	}{
-		%	\vltr{\pi_2}{  \Gamma \seqar \Delta, B}{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
-		%	}
-		%	}
-		%	\]
-		%	
-		%	Suppose we have $\vec f^i (\vec x , \vec a ; \vec y , \vec b)$ from $\pi_i$.
-		%	
-		%	\anupam{problem: does this require many tests, just like for contraction? Can we isolate a different complexity class? e.g.\ PH or Grzegorzyck?}
-		%	\anupam{skip this case and consider later.}
-		
-%		\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 }}
-			}
-		}
-		\]
-		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:
-		\[
-		\vec f^\pi (\vec u ; \vec x , y)
-		\quad := \quad
-		\left( \vec f^\Delta (\vec u ; \vec x) , \id (;y), \vec{ f}^{A(t)} (\vec u; \vec x)  \right)
-		\]
-		(The identity function on $y$ is defined from successor, predecessor and safe composition).
-		
-		
-		%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 ) )
-		%\]
-		
-		
-		Suppose $\pi$ ends with a $\lefrul{\exists}$ step:
-		\[
-		\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 }}
-			}
-		}
-		\]
-		%
-		%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 ;  )
-		%\]
-		
-		\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:
 		\[
 		\vlderivation{
@@ -303,63 +314,66 @@
 	\vec h ( \vec v ; \vec y , \vec g^A ( \vec u ; \vec x ) )
 	\right)
 	\]
-	(Notice that all safe inputs are hereditarily safe in these expressions, so they are definable by safe composition and projection).
+	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}.
 	
 	
 	
 	
-	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 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)$. 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:
+	In the other case, where $A$ may be modal, it must be of the form $!\nat (t)$ since it must directly descend from an induction step on one side.
+%	 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)$. 
+	 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:
 	
-	\anupam{need to check this assumption against free-cut elimination conditions. To discuss.}
+%	\anupam{need to check this assumption against free-cut elimination conditions. To discuss.}
 	
 \[
 \vlderivation{
 	\vliin{\cut}{}{!\Gamma , !\Sigma  , A(\epsilon) \seqar A(t)  }{
-%		\vlin{\rigrul{!}}{}{!\Gamma \seqar ?\Delta, !\nat(t)}{
-			\vltr{\pi_1}{!\Gamma \seqar  !\nat(t)}{\vlhy{\quad}}{\vlhy{}}{\vlhy{\quad}}
-%			}
+		\vlin{\rigrul{!}}{}{!\Gamma \seqar  !\nat(t)}{
+			\vltr{\pi_1'}{!\Gamma \seqar  \nat(t)}{\vlhy{\quad}}{\vlhy{}}{\vlhy{\quad}}
+			}
 		}{
 		\vltr{\pi_2}{ !\Sigma, !\nat(t) , A(\epsilon)\seqar A(t)  }{\vlhy{\quad}}{\vlhy{}}{\vlhy{\quad}}
 		}
 	}
 \]
-where $\pi_1$ ends with a $\rigrul{!}$ step for which $!\nat (t)$ is principal, $\pi_2$ ends with a $\pind$ step where $A(x)$ is the induction formula, and we assume there are no side-formulae on the right of both conclusions for the same reason as $\rigrul{\cntr}$: a free-cut free proof of a convergence statement contains no $?$ symbol.
-
-So by the inductive hypothesis we have functions $ g( \vec u ; )$ and $\vec h ( \vec v , w ; \vec x)$ from $\pi_1$ and $\pi_2$ respectively, where $\vec u$, $\vec v$, $w$ and $\vec x$ correspond to $!\Gamma$, $!\Sigma$, $!\nat(t)$ (in $\pi_2$) and $A(\epsilon)$ respectively. We construct the functions $\vec f^\pi $ as follows:
+ where $\pi_2$ ends with a $\ind$ step for which  $A(x)$ is the induction formula, and we assume there are no side-formulae on the right of both end-sequents 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 ( \vec v , w ; \vec x)$ from $\pi_1'$ and $\pi_2$ respectively, where $\vec u$, $\vec v$, $w$ and $\vec x$ correspond to $!\Gamma$, $!\Sigma$, $!\nat(t)$ (in $\pi_2$) and $A(\epsilon)$ respectively. We construct the functions $\vec f^\pi $ as follows:
 \[
 \vec f^\pi (\vec u , \vec v ; \vec x)
 \quad := \quad
 \vec h (  \vec v , g(\vec u ; ) ; \vec x)
 \]
-(Notice that this is definable by safe composition and projection since all safe inputs $\vec x$ are hereditarily safe on the right.)
+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}.
+
+
 	
+%	Suppose $\pi$ ends with a $\lefrul{!}$ step:
+%	\[
+%	\vlderivation{
+%		\vlin{!}{}{\Gamma, !A \seqar \Delta}{
+%			\vltr{\pi'}{ \Gamma , A \seqar \Delta  }{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
+%		}
+%	}
+%	\]
+%	\todo{finish this case, just passing a safe input to a normal input.}
+%	
+%	
+%	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{!}$ step:
-	\[
-	\vlderivation{
-		\vlin{!}{}{\Gamma, !A \seqar \Delta}{
-			\vltr{\pi'}{ \Gamma , A \seqar \Delta  }{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
-		}
-	}
-	\]
-	\todo{finish this case, just passing a safe input to a normal input.}
+	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.
 	
+%	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 $\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:
+	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$ has the following form:
 	\[
 	\vlderivation{
 		\vliin{\pind}{}{ !\nat (t), !\Gamma  ,  A(\epsilon) \seqar A(t) }{
@@ -369,9 +383,9 @@
 	}
 }
 \]
-\anupam{is this better with a premiss for the base case?}
+%\anupam{is this better with a premiss for the base case?}
 
-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:
+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:
 \[
 \begin{array}{rcll}
 \vec f^\pi ( \epsilon, \vec v ; \vec x ) & := & \vec x & \\
@@ -379,16 +393,18 @@
 \end{array}
 \]
 
-\anupam{check this}
+%\anupam{check this}
+%
+%\todo{simultaneous PRN.}
 
-\todo{simultaneous PRN.}
 
-
 \end{definition}
 
+The induction step above is the reason why we enrich the usual BC framework with a simultaneous version of PRN.
+
 \subsection{Witness predicate and extensional equivalence of functions}
 
-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.
+Now that we have defined how to extract BC functions from proofs, we show that these functions satisfy the appropriate semantic properties.
 
 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.
 
Index: CSL16/bc-convergence.tex
===================================================================
--- CSL16/bc-convergence.tex	(revision 68)
+++ CSL16/bc-convergence.tex	(revision 69)
@@ -97,6 +97,21 @@
 
 \anupam{simultaneous recursion?}
 
+\anupam{also identity, hereditarily safe, expressions, etc.}
+
+
+\begin{proposition}
+[Properties of BC programs]
+\label{prop:bc-properties}
+We have the following properties:
+\begin{enumerate}
+\item Hereditarily safe expressions over BC programs are BC definable.
+\item Can pass safe input to normal input.
+\end{enumerate}
+
+\todo{finish this, add properties as required.}
+\end{proposition}
+
 \subsection{Convergence in arithmetic}
 
 %\begin{theorem}
