Révision 19

CSL16/feas-arith-wfm.tex (revision 19)
54 54
	
55 55
	
56 56
	%terms
57
	\newcommand{\cond}{C}
58
	\newcommand{\pred}{p}
57 59
	\renewcommand{\succ}{s}
58 60
	\renewcommand{\epsilon}{\varepsilon}
59 61
	
......
634 636
\subsection{$\nat$-hierarchy}
635 637

  
636 638
\begin{definition}
637

  
638
\todo{replace N with nat.}
639

  
640
	Let us define the quantifiers $\exists x^N . A$ and $\forall x^N . A$ as $\exists x . (N(x) \land A)$ and $\forall x . (N(x) \limp A) $ respectively.
639
	Let us define the quantifiers $\exists x^\nat . A$ and $\forall x^\nat . A$ as $\exists x . (\nat(x) \land A)$ and $\forall x . (\nat (x) \limp A) $ respectively.
641 640
	
642
	We define $\Sigma^N_0 = \Pi^N_0 $ as the class of formulae that are free of quantifiers. For $i\geq 0$ we define:
641
	We define $\Sigma^N_0 = \Pi^N_0 $ as the class of formulae that are free of quantifiers. For $i> 0$ we define $\Sigma^\nat_i$ and $\Pi^\nat_i$ as follows:
643 642
	\begin{itemize}
644
		\item $\Sigma^N_{i+1}$ is the class of formulae $\exists x^N . A$ where $A \in \Pi^N_i$.
645
		\item $\Pi^N_{i+1}$ is the class of formulae $\forall x^N . A$ where $A \in \Sigma^N_i$.
646
		\item ($\Delta^N_i$ is the class $\Sigma^N_i \cap \Pi^N_i$.)
643
		\item If $A \in \Sigma^\nat_{i-1} \cup \Pi^\nat_{i-1}$ then $A \in \Sigma^\nat_i$ and $A \in \Pi^\nat_i$.
644
		\item If $A \in \Sigma^\nat_i$ then $\exists x^\nat . A \in \Sigma^\nat_i$.
645
		\item If $A \in \Pi^\nat_i$ then $\forall x^\nat . A \in \Pi^\nat_i$.
646
		\item If $A,B \in \Sigma^\nat_i$ then $A \lor B$ and $A\land B \in \Sigma^\nat_i$.
647
		\item If $A,B \in \Pi^\nat_i$ then $A \lor B$ and $A\land B \in \Pi^\nat_i$.
647 648
	\end{itemize}
648 649
\end{definition}
649 650

  
650
\todo{allow closure under positive Boolean operations?}
651 651

  
652 652
\todo{What about prenexing rules? Should not change provably total functions!}
653 653

  
......
668 668
\end{array}
669 669
\]
670 670

  
671
CHECK THESE!
672 671

  
673
\todo{Also include rules for contraction and weakening.}
674

  
675 672
\section{Convergence of Bellantoni-Cook programs}
676 673

  
677 674
\subsection{Bellantoni-Cook programs}
678
We first recall the notion of safe recursion on notation from BC. TODO
675
We first recall the notion of safe recursion on notation from BC.
679 676

  
677
\todo{reformulate below for binary words, not natural numbers?}
678

  
679
\begin{definition}
680
	[BC functions]
681
	BC is the set of functions generated by the following initial functions and closure schemes.
682
	
683
%	\paragraph{Initial functions}
684
	There are the following initial functions:
685
	\begin{enumerate}
686
		\item The constant function $0$ which takes no arguments and outputs $0 \in \Nat$.
687
		\item The projection functions $\pi^{m,n}_k ( x_1 , \dots , x_m ; x_{m+1} , \dots, x_{m+n} )  := x_k$ for $n,m \in \Nat$ and $1 \leq k \leq m+n$.
688
		\item The successor functions $\succ_i ( ; x) := xi$ for $i = 0,1$.
689
		\item The predecessor function $\pred (; x) := \begin{cases}
690
		0 & x = 0 \\
691
		x' & x = x'i
692
		\end{cases}$.
693
		\item The conditional function $\cond (;x,y,z) := \begin{cases}
694
		y & x \mod{2} = 0 \\
695
		z & \text{otherwise}
696
		\end{cases}$.
697
	\end{enumerate}
698
	
699
	There are the following closure properties.
700
	\begin{enumerate}
701
	\setcounter{enumi}{5}
702
	\item Predicative recursion on notation. If $g, h_0, h_1 $ are in BC then so is the function $f$ defined by,
703
	\[
704
	\begin{array}{rcl}
705
	f(0, \vec v ; \vec x) & := & g(\vec v ; \vec x) \\
706
	f (\succ_i u , \vec v ; \vec x ) & := & h_i ( u , \vec v ; \vec x , f (u , \vec v ; \vec x) )
707
	\end{array}
708
	\]
709
	for $i = 0,1$, so long as the expressions are well-formed (i.e.\ in number/sort of arguments).
710
	\item Safe composition. If $g, \vec h, \vec h'$ are in BC then so is $f$ defined by,
711
	\[
712
	f (\vec u ; \vec x) \quad := \quad g ( \vec h(\vec u ; ) ; \vec h' (\vec u ; \vec x) )
713
	\]
714
	so long as the expression is well-formed.
715
	\end{enumerate}
716
	\end{definition}
717

  
718

  
719

  
680 720
\subsection{Convergence in arithmetic}
681 721
\begin{theorem}
682 722
	[Convergence]
683
	If $\Phi(f)$ is an equational specification corresponding to a BC-program defining $f()$, then $\cax{\Sigma^N_1}{\pind} \proves  \ !\Phi(f) \limp \forall \vec{x}^{!N} . N(f(\vec x))$.
723
	If $\Phi(f)$ is an equational specification corresponding to a BC-program defining $f$, then $\cax{\Sigma^N_1}{\pind} \proves  \ !\Phi(f) \limp \forall \vec{x}^{!N} . N(f(\vec x))$.
684 724
\end{theorem}
685 725
\begin{proof}
686 726
	We show by induction on the structure of a BC-program for $f(\vec x ; \vec y)$ that:
......
749 789

  
750 790
\todo{say some more here}
751 791

  
792
\todo{compare with applicative theories}
793

  
794
\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.}
795

  
752 796
\newcommand{\type}{\mathtt{t}}
753 797
\newcommand{\norm}{\nu}
754 798
\newcommand{\safe}{\sigma}
755 799

  
756
\subsection{Typing}
800
\subsection{Witness/realisability predicate}
757 801

  
758 802
\begin{definition}
759
	[Types]
760
	To each formula we associate a tuple type as follows:
803
	[Typing]
804
	To each $\Sigma^\nat_1$-formula $A$ we associate a sorted tuple of variables $\type (A)$, intended to range over $\Nat$, as follows:
761 805
	\[
762 806
	\begin{array}{rcll}
763
	\type (\nat (t)) & := & \Nat & \\
764
	\type(s = t) & := & \Nat & \\
765
	\type (A \star B)  & : = & \type (A) \times \type (B) & \text{for $\star \in \{ \lor, \land, \laor, \laand \} $.} \\
766
	\type (! A) & : = & \type_\norm (A) & \\
767
	\type (\exists x^N . A) & := & \Nat \times \type (A) & \\
807
	\type (\nat (t)) & := & (;x^{\nat (t)} ) & \\
808
	\type(s = t) & := & ( ; x^{s = t}) & \\
809
	\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)$.} \\
810
		\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)$.} \\
811
	\type (! A) & : = & ( \vec u ,\vec x  ; ) & \text{if $\type(A) = (\vec u ; \vec x )$.} \\
812
	\type (\exists x^\nat . A) & := & (\vec u ; \vec x , y) & \text{if $\type (A) = (\vec u ; \vec x)$.}
768 813
%	\type (\forall x^N . A) & := & \Nat \to \type(A)
769 814
	\end{array}
770 815
	\]
771
	where $\nu$ designates that the inputs are normal.
816
%	where $\nu$ designates that the inputs are normal.
772 817
	\end{definition}
773 818
	
774
	\todo{compatibility with safety. To consider.}
775 819
	
820
	\anupam{need to account for normality and safety somewhere. Attempting inlined and leaving types without this decoration.}
776 821
	
822
	\begin{remark}
823
		[Distribution of $!$]
824
		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.
825
		
826
		On the other hand, since we are working in affine logic, we do in general have $!(A \land B) \cong !A \land !B$.
827
		\end{remark}
777 828
	
778 829
	
779 830
	\newcommand{\witness}[2]{\mathit{Witness}^{#1}_{#2}}
780 831
	\begin{definition}
781 832
		[Witness predicate]
782
		We define the following formula:
833
		We define the predicate $\witness{\vec a}{A} (\vec x , \vec b)$ for a $\Sigma^\nat_1$-formula $A(\vec a)$, such that $|\vec b| = |\vec a |$ and $|\vec x | = |\type (A)|$, as follows:
783 834
		\[
784 835
		\begin{array}{rcll}
785
		\witness{\vec a}{A} (w, \vec a) & := & A(\vec a) & \text{for $A$ quantifier-free.} \\
786
		\witness{\vec a}{\exists x . A} (w, \vec w , \vec a) & := & \witness{\vec{a}, a}{A(a)}(\vec w , \vec a, w ) & \\
787
		\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\}$.} \\
836
		\witness{\vec a}{A} (x, \vec b) & := & A(\vec b) & \text{$A(\vec a)$ is $s(\vec a) = t(\vec a)$.} \\
837
		\witness{\vec a}{A} (x, \vec b) & := & x = t(\vec b) & \text{$A(\vec{a})$ is $\nat(t(\vec a))$.} \\
838
				\witness{\vec a}{A \land B} ( \vec x^1 , \vec x^2 , \vec b ) & := &  \witness{\vec a}{A} (\vec x^1 , \vec b) \cand \witness{\vec a}{B} (\vec x^2 , \vec b) &  \\
839
								\witness{\vec a}{A \lor B} ( \vec x^1 , \vec x^2 , \vec b ) & := &  \witness{\vec a}{A} (\vec x^1 , \vec b) \cor \witness{\vec a}{B} (\vec x^2 , \vec b) &  \\
840
		\witness{\vec a}{\exists x^\nat . A} (x, \vec x , \vec b) & := & \witness{\vec{a}, a}{A(a)}(\vec x, \vec b, x ) & \\
788 841
		\end{array}
789 842
		\]
790 843
	\end{definition}
791
	\todo{problem: what about complexity of checking equality? }
792 844
	
793
	\todo{What about $\nat (t)$? What does it mean? Replace with true?}
794 845
	
795 846
	\todo{either use the witness predicate above, or use realizability predicate at meta-level and a model theory, like BH.}
796 847
	
797
	\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.}
798 848
	
799 849
	\subsection{The translation}
800 850
	Need witness predicate so that we know what is being preserved.
801 851

  
802 852
\begin{definition}
803 853
	[Translation]
804
	We give a translation of proofs $\pi$ of sequents $\Gamma(\vec a) \seqar \Delta(\vec a)$ to BC-programs for a vector of functions $\vec f^\pi : \type(\bigotimes\Gamma) \times \Nat^{|\vec a|} \to \type(\bigparr\Delta)$ such that:
854
	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 : \type \left(\bigotimes\Gamma\right) \to \type\left(\bigparr\Delta\right)$ such that:
805 855
	\[
806 856
	\witness{\vec a}{\bigotimes \Gamma} (\vec w , \vec a) \implies \witness{\vec a}{\bigparr \Delta } (\vec f(\vec w , \vec a), \vec a)
807 857
	\]
......
813 863
	
814 864
	\anupam{for moment try ignore decoration on right? what about negation?}
815 865
	
816

  
866
\todo{Consider these points at end, this should just be a choice of implementation.}
817 867
	
818 868
	\[
819 869
	\vlderivation{

Formats disponibles : Unified diff