Paper/Paper.thy
changeset 2163 5dc48e1af733
parent 2156 029f8aabed12
child 2175 f11dd09fa3a7
equal deleted inserted replaced
2156:029f8aabed12 2163:5dc48e1af733
     7   fv :: "'a \<Rightarrow> 'b"
     7   fv :: "'a \<Rightarrow> 'b"
     8   abs_set :: "'a \<Rightarrow> 'b \<Rightarrow> 'c"
     8   abs_set :: "'a \<Rightarrow> 'b \<Rightarrow> 'c"
     9   alpha_bn :: "'a \<Rightarrow> 'a \<Rightarrow> bool"
     9   alpha_bn :: "'a \<Rightarrow> 'a \<Rightarrow> bool"
    10   abs_set2 :: "'a \<Rightarrow> perm \<Rightarrow> 'b \<Rightarrow> 'c"
    10   abs_set2 :: "'a \<Rightarrow> perm \<Rightarrow> 'b \<Rightarrow> 'c"
    11   Abs_dist :: "'a \<Rightarrow> 'b \<Rightarrow> 'c" 
    11   Abs_dist :: "'a \<Rightarrow> 'b \<Rightarrow> 'c" 
    12   
    12   Abs_print :: "'a \<Rightarrow> 'b \<Rightarrow> 'c" 
    13 
    13 
    14 definition
    14 definition
    15  "equal \<equiv> (op =)" 
    15  "equal \<equiv> (op =)" 
    16 
    16 
    17 notation (latex output)
    17 notation (latex output)
    31   alpha_abs ("_ \<approx>\<^raw:{$\,_{\textit{abs\_set}}$}> _") and 
    31   alpha_abs ("_ \<approx>\<^raw:{$\,_{\textit{abs\_set}}$}> _") and 
    32   Abs ("[_]\<^raw:$\!$>\<^bsub>set\<^esub>._" [20, 101] 999) and
    32   Abs ("[_]\<^raw:$\!$>\<^bsub>set\<^esub>._" [20, 101] 999) and
    33   Abs_lst ("[_]\<^raw:$\!$>\<^bsub>list\<^esub>._") and
    33   Abs_lst ("[_]\<^raw:$\!$>\<^bsub>list\<^esub>._") and
    34   Abs_dist ("[_]\<^raw:$\!$>\<^bsub>#list\<^esub>._") and
    34   Abs_dist ("[_]\<^raw:$\!$>\<^bsub>#list\<^esub>._") and
    35   Abs_res ("[_]\<^raw:$\!$>\<^bsub>res\<^esub>._") and
    35   Abs_res ("[_]\<^raw:$\!$>\<^bsub>res\<^esub>._") and
       
    36   Abs_print ("_\<^raw:$\!$>\<^bsub>set\<^esub>._") and
    36   Cons ("_::_" [78,77] 73) and
    37   Cons ("_::_" [78,77] 73) and
    37   supp_gen ("aux _" [1000] 10) and
    38   supp_gen ("aux _" [1000] 10) and
    38   alpha_bn ("_ \<approx>bn _")
    39   alpha_bn ("_ \<approx>bn _")
    39 (*>*)
    40 (*>*)
    40 
    41 
    50   \begin{center}
    51   \begin{center}
    51   @{text "t ::= x | t t | \<lambda>x. t"}
    52   @{text "t ::= x | t t | \<lambda>x. t"}
    52   \end{center}
    53   \end{center}
    53 
    54 
    54   \noindent
    55   \noindent
    55   where free and bound variables have names.  For such alpha-equated terms,  Nominal Isabelle
    56   where free and bound variables have names.  For such alpha-equated terms,
    56   derives automatically a reasoning infrastructure that has been used
    57   Nominal Isabelle derives automatically a reasoning infrastructure that has
    57   successfully in formalisations of an equivalence checking algorithm for LF
    58   been used successfully in formalisations of an equivalence checking
    58   \cite{UrbanCheneyBerghofer08}, Typed
    59   algorithm for LF \cite{UrbanCheneyBerghofer08}, Typed
    59   Scheme~\cite{TobinHochstadtFelleisen08}, several calculi for concurrency
    60   Scheme~\cite{TobinHochstadtFelleisen08}, several calculi for concurrency
    60   \cite{BengtsonParow09} and a strong normalisation result
    61   \cite{BengtsonParow09} and a strong normalisation result for cut-elimination
    61   for cut-elimination in classical logic \cite{UrbanZhu08}. It has also been
    62   in classical logic \cite{UrbanZhu08}. It has also been used by Pollack for
    62   used by Pollack for formalisations in the locally-nameless approach to
    63   formalisations in the locally-nameless approach to binding
    63   binding \cite{SatoPollack10}.
    64   \cite{SatoPollack10}.
    64 
    65 
    65   However, Nominal Isabelle has fared less well in a formalisation of
    66   However, Nominal Isabelle has fared less well in a formalisation of
    66   the algorithm W \cite{UrbanNipkow09}, where types and type-schemes are,
    67   the algorithm W \cite{UrbanNipkow09}, where types and type-schemes are,
    67   respectively, of the form
    68   respectively, of the form
    68   %
    69   %
   544   @{term "\<forall>p. p \<bullet> f = f"}
   545   @{term "\<forall>p. p \<bullet> f = f"}
   545   \end{equation}
   546   \end{equation}
   546 
   547 
   547   \noindent or equivalently that a permutation applied to the application
   548   \noindent or equivalently that a permutation applied to the application
   548   @{text "f x"} can be moved to the argument @{text x}. That means for equivariant
   549   @{text "f x"} can be moved to the argument @{text x}. That means for equivariant
   549   functions @{text f} we have for all permutations @{text p}
   550   functions @{text f}, we have for all permutations @{text p}
   550   %
   551   %
   551   \begin{equation}\label{equivariance}
   552   \begin{equation}\label{equivariance}
   552   @{text "p \<bullet> f = f"} \;\;\;\textit{if and only if}\;\;\;
   553   @{text "p \<bullet> f = f"} \;\;\;\textit{if and only if}\;\;\;
   553   @{text "p \<bullet> (f x) = f (p \<bullet> x)"}
   554   @{text "p \<bullet> (f x) = f (p \<bullet> x)"}
   554   \end{equation}
   555   \end{equation}
   796   the assumptions give us @{term "(a \<rightleftharpoons> b) \<bullet> (supp x - as) = (supp x - as)"}.
   797   the assumptions give us @{term "(a \<rightleftharpoons> b) \<bullet> (supp x - as) = (supp x - as)"}.
   797   Moreover @{text supp} and set difference are equivariant (see \cite{HuffmanUrban10}).
   798   Moreover @{text supp} and set difference are equivariant (see \cite{HuffmanUrban10}).
   798   \end{proof}
   799   \end{proof}
   799 
   800 
   800   \noindent
   801   \noindent
   801   This lemma together with \eqref{absperm} allows us to show
   802   Assuming that @{text "x"} has finite support, this lemma together 
       
   803   with \eqref{absperm} allows us to show
   802   %
   804   %
   803   \begin{equation}\label{halfone}
   805   \begin{equation}\label{halfone}
   804   @{thm abs_supports(1)[no_vars]}
   806   @{thm abs_supports(1)[no_vars]}
   805   \end{equation}
   807   \end{equation}
   806   
   808   
   916   \noindent
   918   \noindent
   917   The first mode is for binding lists of atoms (the order of binders matters);
   919   The first mode is for binding lists of atoms (the order of binders matters);
   918   the second is for sets of binders (the order does not matter, but the
   920   the second is for sets of binders (the order does not matter, but the
   919   cardinality does) and the last is for sets of binders (with vacuous binders
   921   cardinality does) and the last is for sets of binders (with vacuous binders
   920   preserving alpha-equivalence). The ``\isacommand{in}-part'' of a binding
   922   preserving alpha-equivalence). The ``\isacommand{in}-part'' of a binding
   921   clause will be called \emph{bodies} (there can be more than one); the 
   923   clause will be called \emph{bodies} (there can be more than one); the
   922   ``\isacommand{bind}-part'' will be called \emph{binders}. 
   924   ``\isacommand{bind}-part'' will be called \emph{binders}. In contrast to
   923 
   925   Ott, we allow multiple labels in binders and bodies. For example we allow
   924   In contrast to Ott, we allow multiple labels in binders and bodies. For example
   926   binding clauses of the form:
   925   we allow binding clauses of the form:
       
   926 
   927 
   927   \begin{center}
   928   \begin{center}
   928   \begin{tabular}{@ {}ll@ {}}
   929   \begin{tabular}{@ {}ll@ {}}
   929   @{text "Foo\<^isub>1 x::name y::name t::lam s::lam"} &  
   930   @{text "Foo\<^isub>1 x::name y::name t::lam s::lam"} &  
   930       \isacommand{bind} @{text "x y"} \isacommand{in} @{text "t s"}\\
   931       \isacommand{bind} @{text "x y"} \isacommand{in} @{text "t s"}\\
   934   \end{tabular}
   935   \end{tabular}
   935   \end{center}
   936   \end{center}
   936 
   937 
   937   \noindent
   938   \noindent
   938   Similarly for the other binding modes. Interestingly, in case of \isacommand{bind\_set}
   939   Similarly for the other binding modes. Interestingly, in case of \isacommand{bind\_set}
   939   and \isacommand{bind\_res} the binding clauses will make a difference in
   940   and \isacommand{bind\_res} the binding clauses will make a difference to the semantics
   940   terms of the corresponding alpha-equivalence. We will show this later with an example.
   941   of the specification (the corresponding alpha-equivalence will differ). We will 
       
   942   show this later with an example.
   941   
   943   
   942   There are some restrictions we need to impose: First, a body can only occur
   944   There are some restrictions we need to impose: First, a body can only occur
   943   in \emph{one} binding clause of a term constructor. For binders we
   945   in \emph{one} binding clause of a term constructor. For binders we
   944   distinguish between \emph{shallow} and \emph{deep} binders.  Shallow binders
   946   distinguish between \emph{shallow} and \emph{deep} binders.  Shallow binders
   945   are just labels. The restriction we need to impose on them is that in case
   947   are just labels. The restriction we need to impose on them is that in case
   970   \end{center}
   972   \end{center}
   971 
   973 
   972   \noindent
   974   \noindent
   973   Note that for @{text lam} it does not matter which binding mode we use. The
   975   Note that for @{text lam} it does not matter which binding mode we use. The
   974   reason is that we bind only a single @{text name}. However, having
   976   reason is that we bind only a single @{text name}. However, having
   975   \isacommand{bind\_set} or \isacommand{bind} in the second case again makes a
   977   \isacommand{bind\_set} or \isacommand{bind} in the second case makes again a
   976   difference to the underlying notion of alpha-equivalence. Note also that in
   978   difference to the semantics of the specification. Note also that in
   977   these specifications @{text "name"} refers to an atom type, and @{text
   979   these specifications @{text "name"} refers to an atom type, and @{text
   978   "fset"} to the type of finite sets.
   980   "fset"} to the type of finite sets.
   979 
   981 
   980 
   982 
   981   A \emph{deep} binder uses an auxiliary binding function that ``picks'' out
   983   A \emph{deep} binder uses an auxiliary binding function that ``picks'' out
  1030   \noindent
  1032   \noindent
  1031   where the argument of the deep binder is also in the body. We call such
  1033   where the argument of the deep binder is also in the body. We call such
  1032   binders \emph{recursive}.  To see the purpose of such recursive binders,
  1034   binders \emph{recursive}.  To see the purpose of such recursive binders,
  1033   compare ``plain'' @{text "Let"}s and @{text "Let_rec"}s in the following
  1035   compare ``plain'' @{text "Let"}s and @{text "Let_rec"}s in the following
  1034   specification:
  1036   specification:
  1035   %
  1037 
  1036   \begin{equation}\label{letrecs}
  1038   \begin{equation}\label{letrecs}
  1037   \mbox{%
  1039   \mbox{%
  1038   \begin{tabular}{@ {}l@ {}}
  1040   \begin{tabular}{@ {}l@ {}}
  1039   \isacommand{nominal\_datatype}~@{text "trm ="}\\
  1041   \isacommand{nominal\_datatype}~@{text "trm ="}\\
  1040   \hspace{5mm}\phantom{$\mid$}\ldots\\
  1042   \hspace{5mm}\phantom{$\mid$}\ldots\\
  1053 
  1055 
  1054   \noindent
  1056   \noindent
  1055   The difference is that with @{text Let} we only want to bind the atoms @{text
  1057   The difference is that with @{text Let} we only want to bind the atoms @{text
  1056   "bn(as)"} in the term @{text t}, but with @{text "Let_rec"} we also want to bind the atoms
  1058   "bn(as)"} in the term @{text t}, but with @{text "Let_rec"} we also want to bind the atoms
  1057   inside the assignment. This difference has consequences for the free-variable 
  1059   inside the assignment. This difference has consequences for the free-variable 
  1058   function and alpha-equivalence relation, which we are going to describe in the 
  1060   function and alpha-equivalence relation, which we are going to define below.
  1059   rest of this section.
  1061   
  1060   
  1062   For this definition, we have to impose some restrictions on deep binders. First,
  1061   The restriction we have to impose on deep binders is that we cannot have
  1063   we cannot have more than one binding function for one binder. So we exclude:
  1062   more than one binding function for one binder. So we exclude:
       
  1063 
  1064 
  1064   \begin{center}
  1065   \begin{center}
  1065   \begin{tabular}{ll}
  1066   \begin{tabular}{ll}
  1066   @{text "Baz p::pat t::trm"} & 
  1067   @{text "Baz p::pat t::trm"} & 
  1067      \isacommand{bind} @{text "bn\<^isub>1(p) bn\<^isub>2(p)"} \isacommand{in} @{text t}\\
  1068      \isacommand{bind} @{text "bn\<^isub>1(p) bn\<^isub>2(p)"} \isacommand{in} @{text t}\\
  1088   later on.
  1089   later on.
  1089   
  1090   
  1090   In order to simplify our definitions, we shall assume specifications 
  1091   In order to simplify our definitions, we shall assume specifications 
  1091   of term-calculi are \emph{completed}. By this we mean that  
  1092   of term-calculi are \emph{completed}. By this we mean that  
  1092   for every argument of a term-constructor that is \emph{not} 
  1093   for every argument of a term-constructor that is \emph{not} 
  1093   already part of a binding clause, we add implicitly a special \emph{empty} binding
  1094   already part of a binding clause given by the user, we add implicitly a special \emph{empty} binding
  1094   clause, written \isacommand{bind}~@{term "{}"}~\isacommand{in}~@{text "label"}. In case
  1095   clause, written \isacommand{bind}~@{term "{}"}~\isacommand{in}~@{text "labels"}. In case
  1095   of the lambda-calculus, the completion produces
  1096   of the lambda-calculus, the completion produces
  1096 
  1097 
  1097   \begin{center}
  1098   \begin{center}
  1098   \begin{tabular}{@ {}l@ {\hspace{-1mm}}}
  1099   \begin{tabular}{@ {}l@ {\hspace{-1mm}}}
  1099   \isacommand{nominal\_datatype} @{text lam} =\\
  1100   \isacommand{nominal\_datatype} @{text lam} =\\
  1100   \hspace{5mm}\phantom{$\mid$}~@{text "Var x::name"}
  1101   \hspace{5mm}\phantom{$\mid$}~@{text "Var x::name"}
  1101     \;\;\isacommand{bind}~@{term "{}"}~\isacommand{in}~@{text "x"}\\
  1102     \;\;\isacommand{bind}~@{term "{}"}~\isacommand{in}~@{text "x"}\\
  1102   \hspace{5mm}$\mid$~@{text "App t\<^isub>1::lam t\<^isub>2::lam"}
  1103   \hspace{5mm}$\mid$~@{text "App t\<^isub>1::lam t\<^isub>2::lam"}
  1103     \;\;\isacommand{bind}~@{term "{}"}~\isacommand{in}~@{text "t\<^isub>1"},
  1104     \;\;\isacommand{bind}~@{term "{}"}~\isacommand{in}~@{text "t\<^isub>1 t\<^isub>2"}\\
  1104         \isacommand{bind}~@{term "{}"}~\isacommand{in}~@{text "t\<^isub>2"}\\
       
  1105   \hspace{5mm}$\mid$~@{text "Lam x::name t::lam"}
  1105   \hspace{5mm}$\mid$~@{text "Lam x::name t::lam"}
  1106     \;\;\isacommand{bind}~@{text x} \isacommand{in} @{text t}\\
  1106     \;\;\isacommand{bind}~@{text x} \isacommand{in} @{text t}\\
  1107   \end{tabular}
  1107   \end{tabular}
  1108   \end{center}
  1108   \end{center}
  1109 
  1109 
  1911   de-Bruijn representation), but to different bound variables. A similar idea
  1911   de-Bruijn representation), but to different bound variables. A similar idea
  1912   has been recently explored for general binders in the locally nameless
  1912   has been recently explored for general binders in the locally nameless
  1913   approach to binding \cite{chargueraud09}.  There, de-Bruijn indices consist
  1913   approach to binding \cite{chargueraud09}.  There, de-Bruijn indices consist
  1914   of two numbers, one referring to the place where a variable is bound and the
  1914   of two numbers, one referring to the place where a variable is bound and the
  1915   other to which variable is bound. The reasoning infrastructure for both
  1915   other to which variable is bound. The reasoning infrastructure for both
  1916   representations of bindings comes for free in the theorem provers, like Isabelle/HOL or
  1916   representations of bindings comes for free in theorem provers like Isabelle/HOL or
  1917   Coq, as the corresponding term-calculi can be implemented as ``normal''
  1917   Coq, as the corresponding term-calculi can be implemented as ``normal''
  1918   datatypes.  However, in both approaches it seems difficult to achieve our
  1918   datatypes.  However, in both approaches it seems difficult to achieve our
  1919   fine-grained control over the ``semantics'' of bindings (i.e.~whether the
  1919   fine-grained control over the ``semantics'' of bindings (i.e.~whether the
  1920   order of binders should matter, or vacuous binders should be taken into
  1920   order of binders should matter, or vacuous binders should be taken into
  1921   account). To do so, one would require additional predicates that filter out
  1921   account). To do so, one would require additional predicates that filter out
  1922   unwanted terms. Our guess is that such predicates results in rather
  1922   unwanted terms. Our guess is that such predicates result in rather
  1923   intricate formal reasoning.
  1923   intricate formal reasoning.
  1924 
  1924 
  1925   Another representation technique for binding is higher-order abstract syntax
  1925   Another representation technique for binding is higher-order abstract syntax
  1926   (HOAS), which for example is implemented in the Twelf system. This representation
  1926   (HOAS), which for example is implemented in the Twelf system. This representation
  1927   technique supports very elegantly many aspects of \emph{single} binding, and
  1927   technique supports very elegantly many aspects of \emph{single} binding, and
  1934   patterns that bind multiple variables at once. In such situations, HOAS
  1934   patterns that bind multiple variables at once. In such situations, HOAS
  1935   representations have to resort to the iterated-single-binders-approach with
  1935   representations have to resort to the iterated-single-binders-approach with
  1936   all the unwanted consequences when reasoning about the resulting terms.
  1936   all the unwanted consequences when reasoning about the resulting terms.
  1937 
  1937 
  1938   Two formalisations involving general binders have also been performed in older
  1938   Two formalisations involving general binders have also been performed in older
  1939   versions of Nominal Isabelle \cite{BengtsonParow09, UrbanNipkow09}.  Both
  1939   versions of Nominal Isabelle (one about Psi-calculi and one about alpgorithm W 
       
  1940   \cite{BengtsonParow09, UrbanNipkow09}).  Both
  1940   use the approach based on iterated single binders. Our experience with
  1941   use the approach based on iterated single binders. Our experience with
  1941   the latter formalisation has been disappointing. The major pain arose from
  1942   the latter formalisation has been disappointing. The major pain arose from
  1942   the need to ``unbind'' variables. This can be done in one step with our
  1943   the need to ``unbind'' variables. This can be done in one step with our
  1943   general binders, for example @{term "Abs as x"}, but needs a cumbersome
  1944   general binders, but needs a cumbersome
  1944   iteration with single binders. The resulting formal reasoning turned out to
  1945   iteration with single binders. The resulting formal reasoning turned out to
  1945   be rather unpleasant. The hope is that the extension presented in this paper
  1946   be rather unpleasant. The hope is that the extension presented in this paper
  1946   is a substantial improvement.
  1947   is a substantial improvement.
  1947  
  1948  
  1948   The most closely related work to the one presented here is the Ott-tool \cite{ott-jfp}. This tool is a
  1949   The most closely related work to the one presented here is the Ott-tool
  1949   nifty front-end for creating \LaTeX{} documents from specifications of
  1950   \cite{ott-jfp} and the C$\alpha$ml language \cite{Pottier06}. Ott is a nifty
  1950   term-calculi involving general binders. For a subset of the specifications, Ott can also generate
  1951   front-end for creating \LaTeX{} documents from specifications of
  1951   theorem prover code using a raw representation of terms, and in Coq also a
  1952   term-calculi involving general binders. For a subset of the specifications,
  1952   locally nameless representation. The developers of this tool have also put
  1953   Ott can also generate theorem prover code using a raw representation of
  1953   forward (on paper) a definition for alpha-equivalence of terms that can be
  1954   terms, and in Coq also a locally nameless representation. The developers of
  1954   specified in Ott.  This definition is rather different from ours, not using
  1955   this tool have also put forward (on paper) a definition for
  1955   any nominal techniques. Although we were heavily inspired by their syntax,
  1956   alpha-equivalence of terms that can be specified in Ott.  This definition is
       
  1957   rather different from ours, not using any nominal techniques.  To our
       
  1958   knowledge there is also no concrete mathematical result concerning this
       
  1959   notion of alpha-equivalence.  A definition for the notion of free variables
       
  1960   in a term are work in progress in Ott.
       
  1961 
       
  1962   Although we were heavily inspired by their syntax,
  1956   their definition of alpha-equivalence is unsuitable for our extension of
  1963   their definition of alpha-equivalence is unsuitable for our extension of
  1957   Nominal Isabelle. First, it is far too complicated to be a basis for
  1964   Nominal Isabelle. First, it is far too complicated to be a basis for
  1958   automated proofs implemented on the ML-level of Isabelle/HOL. Second, it
  1965   automated proofs implemented on the ML-level of Isabelle/HOL. Second, it
  1959   covers cases of binders depending on other binders, which just do not make
  1966   covers cases of binders depending on other binders, which just do not make
  1960   sense for our alpha-equated terms. Third, it allows empty types that have no
  1967   sense for our alpha-equated terms. Third, it allows empty types that have no
  1961   meaning in a HOL-based theorem prover.
  1968   meaning in a HOL-based theorem prover. We also had to generalise slightly their 
       
  1969   binding clauses. In Ott you specify binding clauses with a single body; we 
       
  1970   allow more than one. We have to do this, because this makes a difference 
       
  1971   for our notion of alpha-equivalence in case of \isacommand{bind\_set} and 
       
  1972   \isacommand{bind\_res}. This makes 
       
  1973 
       
  1974   \begin{center}
       
  1975   \begin{tabular}{@ {}ll@ {}}
       
  1976   @{text "Foo\<^isub>1 xs::name fset x::name y::name"} &  
       
  1977       \isacommand{bind\_set} @{text "xs"} \isacommand{in} @{text "x y"}\\
       
  1978   @{text "Foo\<^isub>2 xs::name fset x::name y::name"} &  
       
  1979       \isacommand{bind\_set} @{text "xs"} \isacommand{in} @{text "x"}, 
       
  1980       \isacommand{bind\_set} @{text "xs"} \isacommand{in} @{text "y"}\\
       
  1981   \end{tabular}
       
  1982   \end{center}
       
  1983 
       
  1984   \noindent
       
  1985   behave differently. To see this, consider the following equations 
       
  1986 
       
  1987   \begin{center}
       
  1988   \begin{tabular}{c}
       
  1989   @{term "Abs_print [a,b] (a, b) = Abs_print [a,b] (b, a)"}\\
       
  1990   @{term "Abs_print [a,b] (a, b) = Abs_print [a,b] (a, b)"}\\
       
  1991   \end{tabular}
       
  1992   \end{center}
       
  1993   
       
  1994   \noindent
       
  1995   The interesting point is that they do not imply
       
  1996 
       
  1997    \begin{center}
       
  1998   \begin{tabular}{c}
       
  1999   @{term "Abs_print [a,b] ((a, b), (a, b)) = Abs_print [a,b] ((a, b), (b, a))"}\\
       
  2000   \end{tabular}
       
  2001   \end{center}
  1962 
  2002 
  1963   Because of how we set up our definitions, we had to impose restrictions,
  2003   Because of how we set up our definitions, we had to impose restrictions,
  1964   like excluding overlapping deep binders, that are not present in Ott. Our
  2004   like a single binding function for a deep binder, that are not present in Ott. Our
  1965   expectation is that we can still cover many interesting term-calculi from
  2005   expectation is that we can still cover many interesting term-calculi from
  1966   programming language research, for example Core-Haskell. For providing support
  2006   programming language research, for example Core-Haskell. For providing support
  1967   of neat features in Ott, such as subgrammars, the existing datatype
  2007   of neat features in Ott, such as subgrammars, the existing datatype
  1968   infrastructure in Isabelle/HOL is unfortunately not powerful enough. On the
  2008   infrastructure in Isabelle/HOL is unfortunately not powerful enough. On the
  1969   other hand, we are not aware that Ott can make the distinction between our
  2009   other hand, we are not aware that Ott can make the distinction between our
  1970   three different binding modes. Also, definitions for notions like the free
  2010   three different binding modes.
  1971   variables of a term are work in progress in Ott.
  2011 
       
  2012   Pottier presents in \cite{Pottier06} a language, called C$\alpha$ml, for 
       
  2013   representing terms with general binders inside OCaml. This language is
       
  2014   implemented as a front-end that can be translated to OCaml with a help of
       
  2015   a library. He presents a type-system in which the scope of general binders
       
  2016   can be indicated with some special constructs, written @{text "inner"} and 
       
  2017   @{text "outer"}. With this, it seems, our and his specifications can be
       
  2018   inter-translated, but we have not proved this. However, we believe the
       
  2019   binding specifications in the style of Ott are a more natural way for 
       
  2020   representing terms involving bindings. Pottier gives a definition for 
       
  2021   alpha-equivalence, which is similar to our binding mod \isacommand{bind}. 
       
  2022   Although he uses also a permutation in case of abstractions, his
       
  2023   definition is rather different from ours. He proves that his notion
       
  2024   of alpha-equivalence is indeed a equivalence relation, but a complete
       
  2025   reasoning infrastructure is well beyond the purposes of his language. 
  1972 *}
  2026 *}
  1973 
  2027 
  1974 section {* Conclusion *}
  2028 section {* Conclusion *}
  1975 
  2029 
  1976 text {*
  2030 text {*
  2000   datatype definitions allow one to specify, for instance, the function kinds
  2054   datatype definitions allow one to specify, for instance, the function kinds
  2001   in Core-Haskell as @{text "TFun string (ty list)"} instead of the unfolded
  2055   in Core-Haskell as @{text "TFun string (ty list)"} instead of the unfolded
  2002   version @{text "TFun string ty_list"} in Figure~\ref{nominalcorehas}. For
  2056   version @{text "TFun string ty_list"} in Figure~\ref{nominalcorehas}. For
  2003   them we need a more clever implementation than we have at the moment. 
  2057   them we need a more clever implementation than we have at the moment. 
  2004 
  2058 
  2005   More
  2059   More interesting line of investigation is whether we can go beyond the 
  2006   interesting is lifting our restriction about overlapping deep binders. Given
       
  2007   our current setup, we cannot deal with specifications such as
       
  2008 
       
  2009  
       
  2010   \begin{center}
       
  2011   \begin{tabular}{ll}
       
  2012   @{text "Foo r::pat s::pat t::trm"} & 
       
  2013      \isacommand{bind} @{text "bn(r)"} \isacommand{in} @{text t},\;
       
  2014      \isacommand{bind} @{text "bn(s)"} \isacommand{in} @{text t}
       
  2015   \end{tabular}
       
  2016   \end{center}
       
  2017   
       
  2018   \noindent
       
  2019   where the deep binders @{text "bn(r)"} and @{text "bn(s)"} overlap. 
       
  2020   The difficulty is that we would need to implement such overlapping bindings 
       
  2021   with alpha-equivalences like
       
  2022 
       
  2023   \begin{center}
       
  2024   @{term "\<exists>p q. abs_set2 (bn r\<^isub>1, t\<^isub>1) p (bn r\<^isub>2, t\<^isub>2) \<and> abs_set2 (bn s\<^isub>1, t\<^isub>1) q (bn s\<^isub>2, t\<^isub>2)"}
       
  2025   \end{center}
       
  2026 
       
  2027   \noindent
       
  2028   or
       
  2029 
       
  2030   \begin{center}
       
  2031   @{term "\<exists>p q. abs_set2 (bn r\<^isub>1 \<union> bn s\<^isub>1, t\<^isub>1) (p + q)  (bn r\<^isub>2 \<union> bn s\<^isub>2, t\<^isub>2)"}
       
  2032   \end{center}
       
  2033 
       
  2034   \noindent
       
  2035   Both versions require two permutations (for each binding). But unfortunately the 
       
  2036   first version cannot work since it leaves some atoms unbound that should be 
       
  2037   bound by the respective other binder. This problem is avoided in the second
       
  2038   version, but at the expense that the two permutations can interfere with each 
       
  2039   other. We have not yet been able to find a way to avoid such interferences. 
       
  2040   On the other hand, such bindings can be made sense of informally \cite{SewellBestiary}.
       
  2041   This suggest there should be an approriate notion of alpha-equivalence.
       
  2042 
       
  2043   Another interesting line of investigation is whether we can go beyond the 
       
  2044   simple-minded form for binding functions that we adopted from Ott. At the moment, binding
  2060   simple-minded form for binding functions that we adopted from Ott. At the moment, binding
  2045   functions can only return the empty set, a singleton atom set or unions
  2061   functions can only return the empty set, a singleton atom set or unions
  2046   of atom sets (similarly for lists). It remains to be seen whether 
  2062   of atom sets (similarly for lists). It remains to be seen whether 
  2047   properties like \eqref{bnprop} provide us with means to support more interesting
  2063   properties like \eqref{bnprop} provide us with means to support more interesting
  2048   binding functions. 
  2064   binding functions.