Index: wfm.tex
===================================================================
--- wfm.tex	(revision 108)
+++ wfm.tex	(revision 109)
@@ -41,18 +41,56 @@
 			[Typing]
 			To each $(\forall, ?)$-free $\word^+$-formula $A$ we associate a sorted tuple of variables $\type (A)$, intended to range over $\Word$, as follows:
 			\[
+%			\begin{array}{rcll}
+%			\type (\word (t)) & := & (;x^{\word (t)} ) & \\
+%			\type(s = t) & := & ( ; x^{s = t}) & \\
+%			\type (s \neq t) & := & ( ;x^{s\neq t} )\\
+%%			\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 \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 \}$.} \\
+%			\type (! A) & : = & ( \vec u ,\vec x  ; ) & \text{if $\type(A) = (\vec u ; \vec x )$.} \\
+%			\type (\exists x^\word . A) & := & (\vec u ; \vec x , y) & \text{if $\type (A) = (\vec u ; \vec x)$.}
+%			%	\type (\forall x^N . A) & := & \Nat \to \type(A)
+%			\end{array}
+%
 			\begin{array}{rcll}
 			\type (\word (t)) & := & (;x^{\word (t)} ) & \\
-			\type(s = t) & := & ( ; x^{s = t}) & \\
-			\type (s \neq t) & := & ( ;x^{s\neq t} )\\
-%			\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 \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 \}$.} \\
-			\type (! A) & : = & ( \vec u ,\vec x  ; ) & \text{if $\type(A) = (\vec u ; \vec x )$.} \\
-			\type (\exists x^\word . A) & := & (\vec u ; \vec x , y) & \text{if $\type (A) = (\vec u ; \vec x)$.}
-			%	\type (\forall x^N . A) & := & \Nat \to \type(A)
+			\type(s = t) & := & ( ; x^{s = t}) & 
+%			\\
+%			\type (s \neq t) & := & ( ;x^{s\neq t} )\\
+%%			\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 \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 \}$.} \\
+%			\type (! A) & : = & ( \vec u ,\vec x  ; ) & \text{if $\type(A) = (\vec u ; \vec x )$.} \\
+%			\type (\exists x^\word . A) & := & (\vec u ; \vec x , y) & \text{if $\type (A) = (\vec u ; \vec x)$.}
+%			%	\type (\forall x^N . A) & := & \Nat \to \type(A)
 			\end{array}
+			\quad
+						\begin{array}{rcll}
+%						\type (\word (t)) & := & (;x^{\word (t)} ) & \\
+%						\type(s = t) & := & ( ; x^{s = t}) & \\
+						\type (s \neq t) & := & ( ;x^{s\neq t} )\\
+			%			\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 \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 \}$.} \\
+						\type (! A) & : = & ( \vec u ,\vec x  ; ) & 
+%						\text{if $\type(A) = (\vec u ; \vec x )$.} \\
+%						\type (\exists x^\word . A) & := & (\vec u ; \vec x , y) & \text{if $\type (A) = (\vec u ; \vec x)$.}
+%						%	\type (\forall x^N . A) & := & \Nat \to \type(A)
+						\end{array}
+						\quad
+									\begin{array}{rcll}
+%									\type (\word (t)) & := & (;x^{\word (t)} ) & \\
+%									\type(s = t) & := & ( ; x^{s = t}) & \\
+%									\type (s \neq t) & := & ( ;x^{s\neq t} )\\
+%						%			\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 \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 \}$.} 
+									\\
+%									\type (! A) & : = & ( \vec u ,\vec x  ; ) & \text{if $\type(A) = (\vec u ; \vec x )$.} \\
+									\type (\exists x^\word . A) & := & (\vec u ; \vec x , y) & 
+%									\text{if $\type (A) = (\vec u ; \vec x)$.}
+									%	\type (\forall x^N . A) & := & \Nat \to \type(A)
+									\end{array}
 			\]
-			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$.
+			where $\type(A)  = (\vec u ; \vec x)$ and $\star \in \{ \lor , \land, \laor, \laand \}$.
 			%	where $\nu$ designates that the inputs are normal.
 		\end{definition}
 		
@@ -66,7 +104,7 @@
 %			On the other hand, since we are working in affine logic, we do in general have $!(A \land B) \cong !A \land !B$.
 %		\end{remark}
 		
-		This sorted tuple corresponds to the input variables, normal and safe respectively, for the BC programs that we will define.
+					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 the input variables, normal and safe respectively, for the BC programs that we will define.
 %		\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.}
 		
 	
@@ -117,24 +155,29 @@
 		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'}$.
 			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.
 		
-			Suppose $\pi$ ends with a $\rigrul{\exists}$ step,
+			Suppose $\pi$ consists of a subproof $\pi'$ followed by a $\rigrul{\exists}$ step,
 				\[
 				\vlderivation{
 					\vlin{\rigrul{\exists}}{}{ \Gamma, \word(t) \seqar \Delta , \exists x^\word . A(x) }{
-						\vltr{\pi'}{ \Gamma \seqar \Delta , A(t) }{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
+%						\vltr{\pi'}{ \Gamma \seqar \Delta , A(t) }{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
+\vlhy{ \Gamma \seqar \Delta , A(t) }
 					}
 				}
 				\]
-				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:
-				\[
+				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
+%				\quad := \quad
+				$ as $
 				\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).
 				
 				
@@ -217,16 +260,18 @@
 \vlderivation{
 	\vliin{\cut}{}{!\Gamma , \Sigma  \seqar \Delta }{
 		\vlin{\rigrul{!}}{}{!\Gamma \seqar  !\word(t)}{
-			\vltr{\pi_1'}{!\Gamma \seqar  \word(t)}{\vlhy{\quad}}{\vlhy{}}{\vlhy{\quad}}
+%			\vltr{\pi_1'}{!\Gamma \seqar  \word(t)}{\vlhy{\quad}}{\vlhy{}}{\vlhy{\quad}}
+\vlhy{!\Gamma \seqar  \word(t)}
 			}
 		}{
-		\vltr{\pi_2}{ !\word(t), \Sigma\seqar \Delta}{\vlhy{\quad}}{\vlhy{}}{\vlhy{\quad}}
+%		\vltr{\pi_2}{ !\word(t), \Sigma\seqar \Delta}{\vlhy{\quad}}{\vlhy{}}{\vlhy{\quad}}
+\vlhy{ !\word(t), \Sigma\seqar \Delta}
 		}
 	}
 \]
  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 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$,  $!\word(t)$ and $\Sigma$ respectively. We construct the functions $\vec f^\pi $ as follows:
+ 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:
 \[
 \vec f^\pi (\vec u , \vec w ; \vec x)
 \quad := \quad
@@ -267,9 +312,11 @@
 	\[
 	\vlderivation{
 		\vliin{\ind}{}{ !\word (t), !\Gamma  ,  A(\epsilon) \seqar A(t) }{
-			\vltr{\pi_0}{!\word(a) , !\Gamma ,  A(a) \seqar A(\succ_0 a)}{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
+%			\vltr{\pi_0}{!\word(a) , !\Gamma ,  A(a) \seqar A(\succ_0 a)}{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
+\vlhy{!\word(a) , !\Gamma ,  A(a) \seqar A(\succ_0 a)}
 		}{
-		\vltr{\pi_1}{!\word(a), !\Gamma ,  A(a)\seqar A(\succ_1 a) }{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
+%		\vltr{\pi_1}{!\word(a), !\Gamma ,  A(a)\seqar A(\succ_1 a) }{\vlhy{\quad }}{\vlhy{ }}{\vlhy{\quad }}
+\vlhy{!\word(a), !\Gamma ,  A(a)\seqar A(\succ_1 a)}
 	}
 }
 \]
@@ -277,10 +324,12 @@
 
 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:
 \[
-\begin{array}{rcll}
-\vec f^\pi ( \epsilon, \vec v ; \vec x ) & := & \vec x & \\
-\vec f^\pi ( \succ_i u , \vec v ; \vec x) & := & \vec g^i ( u, \vec v ; \vec f^\pi ( u, \vec v ; \vec x ) )
-\end{array}
+%\begin{array}{rcll}
+%\vec f^\pi ( \epsilon, \vec v ; \vec x ) & := & \vec x & \\
+%\vec f^\pi ( \succ_i u , \vec v ; \vec x) & := & \vec g^i ( u, \vec v ; \vec f^\pi ( u, \vec v ; \vec x ) )
+%\end{array}
+\vec f^\pi ( \epsilon, \vec v ; \vec x ) := \vec x  \qquad
+\vec f^\pi ( \succ_i u , \vec v ; \vec x) :=  \vec g^i ( u, \vec v ; \vec f^\pi ( u, \vec v ; \vec x ) )
 \]
 
 %\anupam{check this}
@@ -313,7 +362,7 @@
 	
 %	\todo{add cases for $\laor$ and $\neq$.}
 	
-		\newcommand{\witness}[2]{\mathit{Witness}^{#1}_{#2}}
+		\newcommand{\witness}[2]{\mathit{Wit}^{#1}_{#2}}
 		\begin{definition}
 			[Witness predicate]
 			For formulae $A, B$ 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$:
@@ -321,21 +370,70 @@
 		
 		\renewcommand{\sigma}{a}
 			\[
-			\begin{array}{rcll}
-			\witness{}{A} (\sigma) & := & \sigma = t & \text{if $A$ is $\word (t)$.} \\
-			\witness{}{A} (\sigma) & := & s=t & \text{if $A$ is $s=t$.} \\
-						\witness{}{A} (\sigma) & := & s\neq t & \text{if $A$ is $s\neq t$.} \\
-			\witness{}{A \star B} ( \vec \sigma^A , \vec \sigma^B) & := &  \witness{}{A} (\vec \sigma^A) \cor \witness{}{B} (\vec \sigma^B) & 
-						\text{for $\star \in \{ \lor,\laor\}$.} 
+%			\begin{array}{rcll}
+%			\witness{}{A} (\sigma) & := & \sigma = t & \text{if $A$ is $\word (t)$.} \\
+%			\witness{}{A} (\sigma) & := & s=t & \text{if $A$ is $s=t$.} \\
+%						\witness{}{A} (\sigma) & := & s\neq t & \text{if $A$ is $s\neq t$.} \\
+%			\witness{}{A \star B} ( \vec \sigma^A , \vec \sigma^B) & := &  \witness{}{A} (\vec \sigma^A) \cor \witness{}{B} (\vec \sigma^B) & 
+%						\text{for $\star \in \{ \lor,\laor\}$.} 
+%			\\
+%			\witness{}{A \star B} ( \vec \sigma^A , \vec \sigma^B) & := &  \witness{}{A} (\vec \sigma^A ) \cand \witness{}{B} (\vec \sigma^B ) & 
+%						\text{for $\star \in \{ \land, \laand \}$.} 
+%			\\
+%			\witness{}{\exists x^\word A} ( \sigma, \vec \sigma^A  ) & := & \witness{}{A}(\vec \sigma^A , \sigma ) & \\
+%			\witness{}{!A} (\vec \sigma^A) & := & \witness{}{A} (\vec \sigma^A)
+%			\end{array}
+			\begin{array}{rcl}
+			\witness{}{\word (t)} (\sigma) & := & \sigma = t 
+%			\text{if $A$ is $\word (t)$.} 
 			\\
-			\witness{}{A \star B} ( \vec \sigma^A , \vec \sigma^B) & := &  \witness{}{A} (\vec \sigma^A ) \cand \witness{}{B} (\vec \sigma^B ) & 
-						\text{for $\star \in \{ \land, \laand \}$.} 
+			\witness{}{s=t} (\sigma) & := & s=t 
+%			\text{if $A$ is $s=t$.} 
 			\\
-			\witness{}{\exists x^\word A} ( \sigma, \vec \sigma^A  ) & := & \witness{}{A}(\vec \sigma^A , \sigma ) & \\
+			\witness{}{s \neq t} (\sigma) & := & s\neq t 
+%			\text{if $A$ is $s\neq t$.} 
+\\
+%			\witness{}{A \star B} ( \vec \sigma^A , \vec \sigma^B) & := &  \witness{}{A} (\vec \sigma^A) \cor \witness{}{B} (\vec \sigma^B) & 
+%			\text{for $\star \in \{ \lor,\laor\}$.} 
+%			\\
+%			\witness{}{A \star B} ( \vec \sigma^A , \vec \sigma^B) & := &  \witness{}{A} (\vec \sigma^A ) \cand \witness{}{B} (\vec \sigma^B ) & 
+%			\text{for $\star \in \{ \land, \laand \}$.} 
+%			\\
+%			\witness{}{\exists x^\word A} ( \sigma, \vec \sigma^A  ) & := & \witness{}{A}(\vec \sigma^A , \sigma ) & \\
 			\witness{}{!A} (\vec \sigma^A) & := & \witness{}{A} (\vec \sigma^A)
 			\end{array}
+			\quad
+						\begin{array}{rcl}
+%						\witness{}{\word (t)} (\sigma) & := & \sigma = t & \text{if $A$ is $\word (t)$.} \\
+%						\witness{}{s=t} (\sigma) & := & s=t & \text{if $A$ is $s=t$.} \\
+%						\witness{}{s \neq t} (\sigma) & := & s\neq t & 
+%						\text{if $A$ is $s\neq t$.} 
+%						\\
+						\witness{}{A \bullet B} ( \vec \sigma^A , \vec \sigma^B) & := &  \witness{}{A} (\vec \sigma^A) \cor \witness{}{B} (\vec \sigma^B) 
+%						\text{for $\star \in \{ \lor,\laor\}$.} 
+						\\
+						\witness{}{A \circ B} ( \vec \sigma^A , \vec \sigma^B) & := &  \witness{}{A} (\vec \sigma^A ) \cand \witness{}{B} (\vec \sigma^B )  
+%						\text{for $\star \in \{ \land, \laand \}$.} 
+						\\
+						\witness{}{\exists x^\word A} ( \sigma, \vec \sigma^A  ) & := & \witness{}{A}(\vec \sigma^A , \sigma ) 
+%						 \\
+%						\witness{}{!A} (\vec \sigma^A) & := & \witness{}{A} (\vec \sigma^A)
+						\end{array}
+%						\begin{array}{rcl}
+%%						\witness{}{\word (t)} (\sigma) & := & \sigma = t & \text{if $A$ is $\word (t)$.} \\
+%%						\witness{}{s=t} (\sigma) & := & s=t & \text{if $A$ is $s=t$.} \\
+%%						\witness{}{s \neq t} (\sigma) & := & s\neq t & \text{if $A$ is $s\neq t$.} \\
+%%						\witness{}{A \star B} ( \vec \sigma^A , \vec \sigma^B) & := &  \witness{}{A} (\vec \sigma^A) \cor \witness{}{B} (\vec \sigma^B) & 
+%%						\text{for $\star \in \{ \lor,\laor\}$.} 
+%%						\\
+%%						\witness{}{A \star B} ( \vec \sigma^A , \vec \sigma^B) & := &  \witness{}{A} (\vec \sigma^A ) \cand \witness{}{B} (\vec \sigma^B ) & 
+%%						\text{for $\star \in \{ \land, \laand \}$.} 
+%%						\\
+%						\witness{}{\exists x^\word A} ( \sigma, \vec \sigma^A  ) & := & \witness{}{A}(\vec \sigma^A , \sigma )  \\
+%						\witness{}{!A} (\vec \sigma^A) & := & \witness{}{A} (\vec \sigma^A)
+%						\end{array}			
 			\]
-			where $|\vec \sigma^A| = |\type (A)|$ and $|\vec \sigma^B| = |\type (B)| $.
+			where $\bullet \in \{ \lor, \laor \}$, $\circ \in \{ \land,\laand \}$, $|\vec \sigma^A| = |\type (A)|$ and $|\vec \sigma^B| = |\type (B)| $.
 		\end{definition}
 		%	\todo{problem: what about complexity of checking equality? }
 		
