Paper/Paper.thy
changeset 2580 6b3e8602edcf
parent 2555 8cf5c3e58889
child 2604 431cf4e6a7e2
equal deleted inserted replaced
2573:6c131c089ce2 2580:6b3e8602edcf
   272   %``$\alpha$-equals-by-$\alpha$-equals'' in a representation based on raw terms
   272   %``$\alpha$-equals-by-$\alpha$-equals'' in a representation based on raw terms
   273   %requires a lot of extra reasoning work.
   273   %requires a lot of extra reasoning work.
   274 
   274 
   275   Although in informal settings a reasoning infrastructure for $\alpha$-equated
   275   Although in informal settings a reasoning infrastructure for $\alpha$-equated
   276   terms is nearly always taken for granted, establishing it automatically in
   276   terms is nearly always taken for granted, establishing it automatically in
   277   the Isabelle/HOL is a rather non-trivial task. For every
   277   Isabelle/HOL is a rather non-trivial task. For every
   278   specification we will need to construct type(s) containing as elements the
   278   specification we will need to construct type(s) containing as elements the
   279   $\alpha$-equated terms. To do so, we use the standard HOL-technique of defining
   279   $\alpha$-equated terms. To do so, we use the standard HOL-technique of defining
   280   a new type by identifying a non-empty subset of an existing type.  The
   280   a new type by identifying a non-empty subset of an existing type.  The
   281   construction we perform in Isabelle/HOL can be illustrated by the following picture:
   281   construction we perform in Isabelle/HOL can be illustrated by the following picture:
   282   %
   282   %
   439   Two central notions in the nominal logic work are sorted atoms and
   439   Two central notions in the nominal logic work are sorted atoms and
   440   sort-respecting permutations of atoms. We will use the letters @{text "a,
   440   sort-respecting permutations of atoms. We will use the letters @{text "a,
   441   b, c, \<dots>"} to stand for atoms and @{text "p, q, \<dots>"} to stand for
   441   b, c, \<dots>"} to stand for atoms and @{text "p, q, \<dots>"} to stand for
   442   permutations. The purpose of atoms is to represent variables, be they bound or free. 
   442   permutations. The purpose of atoms is to represent variables, be they bound or free. 
   443   The sorts of atoms can be used to represent different kinds of
   443   The sorts of atoms can be used to represent different kinds of
   444   variables.
   444   variables, such as the term-, coercion- and type-variables in Core-Haskell.
   445   %%, such as the term-, coercion- and type-variables in Core-Haskell.
       
   446   It is assumed that there is an infinite supply of atoms for each
   445   It is assumed that there is an infinite supply of atoms for each
   447   sort. However, in the interest of brevity, we shall restrict ourselves 
   446   sort. In the interest of brevity, we shall restrict ourselves 
   448   in what follows to only one sort of atoms.
   447   in what follows to only one sort of atoms.
   449 
   448 
   450   Permutations are bijective functions from atoms to atoms that are 
   449   Permutations are bijective functions from atoms to atoms that are 
   451   the identity everywhere except on a finite number of atoms. There is a 
   450   the identity everywhere except on a finite number of atoms. There is a 
   452   two-place permutation operation written
   451   two-place permutation operation written
   455   over which the permutation 
   454   over which the permutation 
   456   acts. In Nominal Isabelle, the identity permutation is written as @{term "0::perm"},
   455   acts. In Nominal Isabelle, the identity permutation is written as @{term "0::perm"},
   457   the composition of two permutations @{term p} and @{term q} as \mbox{@{term "p + q"}}, 
   456   the composition of two permutations @{term p} and @{term q} as \mbox{@{term "p + q"}}, 
   458   and the inverse permutation of @{term p} as @{text "- p"}. The permutation
   457   and the inverse permutation of @{term p} as @{text "- p"}. The permutation
   459   operation is defined over the type-hierarchy \cite{HuffmanUrban10};
   458   operation is defined over the type-hierarchy \cite{HuffmanUrban10};
   460   for example permutations acting on products, lists, sets, functions and booleans is
   459   for example permutations acting on products, lists, sets, functions and booleans are
   461   given by:
   460   given by:
   462   %
   461   %
   463   %\begin{equation}\label{permute}
   462   %\begin{equation}\label{permute}
   464   %\mbox{\begin{tabular}{@ {}c@ {\hspace{10mm}}c@ {}}
   463   %\mbox{\begin{tabular}{@ {}c@ {\hspace{10mm}}c@ {}}
   465   %\begin{tabular}{@ {}l@ {}}
   464   %\begin{tabular}{@ {}l@ {}}
  1427   %\end{center}
  1426   %\end{center}
  1428   %
  1427   %
  1429   %\noindent
  1428   %\noindent
  1430   for the binding functions @{text "bn"}$_{1..m}$, 
  1429   for the binding functions @{text "bn"}$_{1..m}$, 
  1431   To simplify our definitions we will use the following abbreviations for
  1430   To simplify our definitions we will use the following abbreviations for
  1432   \emph{compound equivalence relations} and \emph{compound free-atom functions} acting on tuples
  1431   \emph{compound equivalence relations} and \emph{compound free-atom functions} acting on tuples.
  1433   %
  1432   %
  1434   \begin{center}
  1433   \begin{center}
  1435   \begin{tabular}{r@ {\hspace{2mm}}c@ {\hspace{2mm}}l}
  1434   \begin{tabular}{r@ {\hspace{2mm}}c@ {\hspace{2mm}}l}
  1436   @{text "(x\<^isub>1,\<dots>, x\<^isub>n) (R\<^isub>1,\<dots>, R\<^isub>n) (x\<PRIME>\<^isub>1,\<dots>, x\<PRIME>\<^isub>n)"} & @{text "\<equiv>"} &
  1435   @{text "(x\<^isub>1,\<dots>, x\<^isub>n) (R\<^isub>1,\<dots>, R\<^isub>n) (x\<PRIME>\<^isub>1,\<dots>, x\<PRIME>\<^isub>n)"} & @{text "\<equiv>"} &
  1437   @{text "x\<^isub>1 R\<^isub>1 x\<PRIME>\<^isub>1 \<and> \<dots> \<and> x\<^isub>n R\<^isub>n x\<PRIME>\<^isub>n"}\\
  1436   @{text "x\<^isub>1 R\<^isub>1 x\<PRIME>\<^isub>1 \<and> \<dots> \<and> x\<^isub>n R\<^isub>n x\<PRIME>\<^isub>n"}\\
  1617 
  1616 
  1618   \noindent
  1617   \noindent
  1619   Note the difference between  $\approx_{\textit{assn}}$ and
  1618   Note the difference between  $\approx_{\textit{assn}}$ and
  1620   $\approx_{\textit{bn}}$: the latter only ``tracks'' $\alpha$-equivalence of 
  1619   $\approx_{\textit{bn}}$: the latter only ``tracks'' $\alpha$-equivalence of 
  1621   the components in an assignment that are \emph{not} bound. This is needed in the 
  1620   the components in an assignment that are \emph{not} bound. This is needed in the 
  1622   in the clause for @{text "Let"} (which is has
  1621   clause for @{text "Let"} (which has
  1623   a non-recursive binder). 
  1622   a non-recursive binder). 
  1624   %The underlying reason is that the terms inside an assignment are not meant 
  1623   %The underlying reason is that the terms inside an assignment are not meant 
  1625   %to be ``under'' the binder. Such a premise is \emph{not} needed in @{text "Let_rec"}, 
  1624   %to be ``under'' the binder. Such a premise is \emph{not} needed in @{text "Let_rec"}, 
  1626   %because there all components of an assignment are ``under'' the binder. 
  1625   %because there all components of an assignment are ``under'' the binder. 
  1627 *}
  1626 *}
  1832   term-constructors and then use the quasi-injectivity lemmas in order to complete the
  1831   term-constructors and then use the quasi-injectivity lemmas in order to complete the
  1833   proof. For the abstraction cases we use the facts derived in Theorem~\ref{suppabs}.
  1832   proof. For the abstraction cases we use the facts derived in Theorem~\ref{suppabs}.
  1834   \end{proof}
  1833   \end{proof}
  1835 
  1834 
  1836   \noindent
  1835   \noindent
  1837   To sum up this section, we can established automatically a reasoning infrastructure
  1836   To sum up this section, we can establish automatically a reasoning infrastructure
  1838   for the types @{text "ty\<AL>"}$_{1..n}$ 
  1837   for the types @{text "ty\<AL>"}$_{1..n}$ 
  1839   by first lifting definitions from the raw level to the quotient level and
  1838   by first lifting definitions from the raw level to the quotient level and
  1840   then by establishing facts about these lifted definitions. All necessary proofs
  1839   then by establishing facts about these lifted definitions. All necessary proofs
  1841   are generated automatically by custom ML-code. 
  1840   are generated automatically by custom ML-code. 
  1842 
  1841 
  1947   \end{center}
  1946   \end{center}
  1948 
  1947 
  1949   In \cite{UrbanTasson05} we showed how the weaker induction principles imply
  1948   In \cite{UrbanTasson05} we showed how the weaker induction principles imply
  1950   the stronger ones. This was done by some quite complicated, nevertheless automated,
  1949   the stronger ones. This was done by some quite complicated, nevertheless automated,
  1951   induction proofs. In this paper we simplify this work by leveraging the automated proof
  1950   induction proofs. In this paper we simplify this work by leveraging the automated proof
  1952   methods from the function package of Isabelle/HOL generates. 
  1951   methods from the function package of Isabelle/HOL. 
  1953   The reasoning principle these methods employ is well-founded induction. 
  1952   The reasoning principle these methods employ is well-founded induction. 
  1954   To use them in our setting, we have to discharge
  1953   To use them in our setting, we have to discharge
  1955   two proof obligations: one is that we have
  1954   two proof obligations: one is that we have
  1956   well-founded measures (for each type @{text "ty"}$^\alpha_{1..n}$) that decrease in 
  1955   well-founded measures (for each type @{text "ty"}$^\alpha_{1..n}$) that decrease in 
  1957   every induction step and the other is that we have covered all cases. 
  1956   every induction step and the other is that we have covered all cases. 
  2030   %\end{center}
  2029   %\end{center}
  2031   %
  2030   %
  2032   \noindent
  2031   \noindent
  2033   Now Properties \ref{supppermeq} and \ref{avoiding} give us a permutation @{text q} such that
  2032   Now Properties \ref{supppermeq} and \ref{avoiding} give us a permutation @{text q} such that
  2034   @{text "(set (bn (q \<bullet>\<^bsub>bn\<^esub> p)) \<FRESH>\<^sup>* c"} holds and such that @{text "[q \<bullet>\<^bsub>bn\<^esub> p]\<^bsub>list\<^esub>.(q \<bullet> t)"}
  2033   @{text "(set (bn (q \<bullet>\<^bsub>bn\<^esub> p)) \<FRESH>\<^sup>* c"} holds and such that @{text "[q \<bullet>\<^bsub>bn\<^esub> p]\<^bsub>list\<^esub>.(q \<bullet> t)"}
  2035   is equal to @{text "[p]\<^bsub>list\<^esub>. t"}. We can also show that @{text "(q \<bullet>\<^bsub>bn\<^esub> p) \<approx>\<^bsub>bn\<^esub> p"}. T
  2034   is equal to @{text "[p]\<^bsub>list\<^esub>. t"}. We can also show that @{text "(q \<bullet>\<^bsub>bn\<^esub> p) \<approx>\<^bsub>bn\<^esub> p"}. 
  2036   hese facts establish that @{text "Let (q \<bullet>\<^bsub>bn\<^esub> p) (p \<bullet> t) = Let p t"}, as we need. This
  2035   These facts establish that @{text "Let (q \<bullet>\<^bsub>bn\<^esub> p) (p \<bullet> t) = Let p t"}, as we need. This
  2037   completes the non-trivial cases in \eqref{letpat} for strengthening the corresponding induction
  2036   completes the non-trivial cases in \eqref{letpat} for strengthening the corresponding induction
  2038   principle.
  2037   principle.
  2039   
  2038   
  2040 
  2039 
  2041 
  2040 
  2201   de-Bruijn indices representation. Since type-schemes in W contain only a single
  2200   de-Bruijn indices representation. Since type-schemes in W contain only a single
  2202   place where variables are bound, different indices do not refer to different binders (as in the usual
  2201   place where variables are bound, different indices do not refer to different binders (as in the usual
  2203   de-Bruijn representation), but to different bound variables. A similar idea
  2202   de-Bruijn representation), but to different bound variables. A similar idea
  2204   has been recently explored for general binders in the locally nameless
  2203   has been recently explored for general binders in the locally nameless
  2205   approach to binding \cite{chargueraud09}.  There, de-Bruijn indices consist
  2204   approach to binding \cite{chargueraud09}.  There, de-Bruijn indices consist
  2206   of two numbers, one referring to the place where a variable is bound and the
  2205   of two numbers, one referring to the place where a variable is bound, and the
  2207   other to which variable is bound. The reasoning infrastructure for both
  2206   other to which variable is bound. The reasoning infrastructure for both
  2208   representations of bindings comes for free in theorem provers like Isabelle/HOL or
  2207   representations of bindings comes for free in theorem provers like Isabelle/HOL or
  2209   Coq, since the corresponding term-calculi can be implemented as ``normal''
  2208   Coq, since the corresponding term-calculi can be implemented as ``normal''
  2210   datatypes.  However, in both approaches it seems difficult to achieve our
  2209   datatypes.  However, in both approaches it seems difficult to achieve our
  2211   fine-grained control over the ``semantics'' of bindings (i.e.~whether the
  2210   fine-grained control over the ``semantics'' of bindings (i.e.~whether the
  2248   terms, and in Coq also a locally nameless representation. The developers of
  2247   terms, and in Coq also a locally nameless representation. The developers of
  2249   this tool have also put forward (on paper) a definition for
  2248   this tool have also put forward (on paper) a definition for
  2250   $\alpha$-equivalence of terms that can be specified in Ott.  This definition is
  2249   $\alpha$-equivalence of terms that can be specified in Ott.  This definition is
  2251   rather different from ours, not using any nominal techniques.  To our
  2250   rather different from ours, not using any nominal techniques.  To our
  2252   knowledge there is also no concrete mathematical result concerning this
  2251   knowledge there is also no concrete mathematical result concerning this
  2253   notion of $\alpha$-equivalence.  A definition for the notion of free variables
  2252   notion of $\alpha$-equivalence.  Also the definition for the 
  2254   is in Ott work in progress.
  2253   notion of free variables
       
  2254   is work in progress.
  2255 
  2255 
  2256   Although we were heavily inspired by the syntax of Ott,
  2256   Although we were heavily inspired by the syntax of Ott,
  2257   its definition of $\alpha$-equivalence is unsuitable for our extension of
  2257   its definition of $\alpha$-equivalence is unsuitable for our extension of
  2258   Nominal Isabelle. First, it is far too complicated to be a basis for
  2258   Nominal Isabelle. First, it is far too complicated to be a basis for
  2259   automated proofs implemented on the ML-level of Isabelle/HOL. Second, it
  2259   automated proofs implemented on the ML-level of Isabelle/HOL. Second, it