722 Now the last clause ensures that the order of the binders matters (since @{text as} |
722 Now the last clause ensures that the order of the binders matters (since @{text as} |
723 and @{text bs} are lists of atoms). |
723 and @{text bs} are lists of atoms). |
724 |
724 |
725 If we do not want to make any difference between the order of binders \emph{and} |
725 If we do not want to make any difference between the order of binders \emph{and} |
726 also allow vacuous binders, that means according to Pitts~\cite{Pitts04} |
726 also allow vacuous binders, that means according to Pitts~\cite{Pitts04} |
727 \emph{restrict} names, then we keep sets of binders, but drop |
727 \emph{restrict} atoms, then we keep sets of binders, but drop |
728 condition {\it (iv)} in Definition~\ref{alphaset}: |
728 condition {\it (iv)} in Definition~\ref{alphaset}: |
729 |
729 |
730 \begin{defi}[Alpha-Equivalence for Set+-Bindings]\label{alphares}\mbox{}\\ |
730 \begin{defi}[Alpha-Equivalence for Set+-Bindings]\label{alphares}\mbox{}\\ |
731 \begin{tabular}{@ {\hspace{10mm}}l@ {\hspace{5mm}}rl} |
731 \begin{tabular}{@ {\hspace{10mm}}l@ {\hspace{5mm}}rl} |
732 @{term "alpha_res_ex (as, x) R fa (bs, y)"}\hspace{2mm}@{text "\<equiv>"} & |
732 @{term "alpha_res_ex (as, x) R fa (bs, y)"}\hspace{2mm}@{text "\<equiv>"} & |
743 abstracting a set of atoms over types (as in type-schemes). We set |
743 abstracting a set of atoms over types (as in type-schemes). We set |
744 @{text R} to be the usual equality @{text "="} and for @{text "fa(T)"} we |
744 @{text R} to be the usual equality @{text "="} and for @{text "fa(T)"} we |
745 define |
745 define |
746 |
746 |
747 \[ |
747 \[ |
748 @{text "fa(x) \<equiv> {x}"} \hspace{5mm} @{text "fa(T\<^isub>1 \<rightarrow> T\<^isub>2) \<equiv> fa(T\<^isub>1) \<union> fa(T\<^isub>2)"} |
748 @{text "fa(x) \<equiv> {x}"} \hspace{10mm} @{text "fa(T\<^isub>1 \<rightarrow> T\<^isub>2) \<equiv> fa(T\<^isub>1) \<union> fa(T\<^isub>2)"} |
749 \]\smallskip |
749 \]\smallskip |
750 |
750 |
751 \noindent |
751 \noindent |
752 Now recall the examples shown in \eqref{ex1} and |
752 Now recall the examples shown in \eqref{ex1} and |
753 \eqref{ex3}. It can be easily checked that @{text "({x, y}, x \<rightarrow> y)"} and |
753 \eqref{ex3}. It can be easily checked that @{text "({x, y}, x \<rightarrow> y)"} and |
801 and @{text "\<pi>\<^isub>2"}, and for the proof obligation use @{text |
801 and @{text "\<pi>\<^isub>2"}, and for the proof obligation use @{text |
802 "\<pi>\<^isub>1 + \<pi>\<^isub>2"}. Equivariance means @{term "alpha_set_ex (\<pi> \<bullet> as, |
802 "\<pi>\<^isub>1 + \<pi>\<^isub>2"}. Equivariance means @{term "alpha_set_ex (\<pi> \<bullet> as, |
803 \<pi> \<bullet> x) equal supp (\<pi> \<bullet> bs, \<pi> \<bullet> y)"} holds provided \mbox{@{term |
803 \<pi> \<bullet> x) equal supp (\<pi> \<bullet> bs, \<pi> \<bullet> y)"} holds provided \mbox{@{term |
804 "alpha_set_ex (as, x) equal supp(bs, y)"}} holds. From the assumption we |
804 "alpha_set_ex (as, x) equal supp(bs, y)"}} holds. From the assumption we |
805 have a permutation @{text "\<pi>'"} and for the proof obligation use @{text "\<pi> \<bullet> |
805 have a permutation @{text "\<pi>'"} and for the proof obligation use @{text "\<pi> \<bullet> |
806 \<pi>'"}. To show then equivariance, we need to `pull out' the permutations, |
806 \<pi>'"}. To show equivariance, we need to `pull out' the permutations, |
807 which is possible since all operators, namely as @{text "#\<^sup>*, -, =, \<bullet>, |
807 which is possible since all operators, namely as @{text "#\<^sup>*, -, =, \<bullet>, |
808 set"} and @{text "supp"}, are equivariant (see |
808 set"} and @{text "supp"}, are equivariant (see |
809 \cite{HuffmanUrban10}). Finally, we apply the permutation operation on |
809 \cite{HuffmanUrban10}). Finally, we apply the permutation operation on |
810 booleans. |
810 booleans. |
811 \end{proof} |
811 \end{proof} |
921 \begin{equation}\label{halftwo} |
921 \begin{equation}\label{halftwo} |
922 @{thm (concl) Abs_supp_subset1(1)[no_vars]} |
922 @{thm (concl) Abs_supp_subset1(1)[no_vars]} |
923 \end{equation}\smallskip |
923 \end{equation}\smallskip |
924 |
924 |
925 \noindent |
925 \noindent |
926 This is because for every finite sets of atoms, say @{text "bs"}, we have |
926 This is because for every finite set of atoms, say @{text "bs"}, we have |
927 @{thm (concl) supp_finite_atom_set[where S="bs", no_vars]}. |
927 @{thm (concl) supp_finite_atom_set[where S="bs", no_vars]}. |
928 Finally, taking \eqref{halfone} and \eqref{halftwo} together establishes |
928 Finally, taking \eqref{halfone} and \eqref{halftwo} together establishes |
929 the first equation of Theorem~\ref{suppabs}. The others are similar. |
929 the first equation of Theorem~\ref{suppabs}. The others are similar. |
930 |
930 |
931 Recall the definition of support given in \eqref{suppdef}, and note the difference between |
931 Recall the definition of support given in \eqref{suppdef}, and note the difference between |
1924 @{text "\<forall>x\<^isub>1\<dots>x\<^isub>l. y = C\<AL>\<^isub>m x\<^isub>1 \<dots> x\<^isub>l \<Rightarrow> P"}\\ |
1924 @{text "\<forall>x\<^isub>1\<dots>x\<^isub>l. y = C\<AL>\<^isub>m x\<^isub>1 \<dots> x\<^isub>l \<Rightarrow> P"}\\ |
1925 \end{array}} |
1925 \end{array}} |
1926 \end{equation}\smallskip |
1926 \end{equation}\smallskip |
1927 |
1927 |
1928 \noindent |
1928 \noindent |
1929 where @{text "y"} is a variable of type @{text "ty"}$_i$ and @{text "P"} is the |
1929 where @{text "y"} is a variable of type @{text "ty\<AL>"}$_i$ and @{text "P"} is the |
1930 property that is established by the case analysis. Similarly, we have a (mutual) |
1930 property that is established by the case analysis. Similarly, we have a (mutual) |
1931 induction principle for the types @{text "ty\<AL>"}$_{1..n}$, which is of the |
1931 induction principle for the types @{text "ty\<AL>"}$_{1..n}$, which is of the |
1932 form |
1932 form |
1933 |
1933 |
1934 \begin{equation}\label{induct} |
1934 \begin{equation}\label{induct} |
1990 \end{array}} |
1990 \end{array}} |
1991 \end{tabular}} |
1991 \end{tabular}} |
1992 \end{equation}\smallskip |
1992 \end{equation}\smallskip |
1993 |
1993 |
1994 By working now completely on the alpha-equated level, we |
1994 By working now completely on the alpha-equated level, we |
1995 can first show using \eqref{calphaeqvt} that the support of each term |
1995 can first show using \eqref{calphaeqvt} and Property~\ref{swapfreshfresh} that the support of each term |
1996 constructor is included in the support of its arguments, |
1996 constructor is included in the support of its arguments, |
1997 namely |
1997 namely |
1998 |
1998 |
1999 \[ |
1999 \[ |
2000 @{text "(supp x\<^isub>1 \<union> \<dots> \<union> supp x\<^isub>r) supports (C\<^sup>\<alpha> x\<^isub>1 \<dots> x\<^isub>r)"} |
2000 @{text "(supp x\<^isub>1 \<union> \<dots> \<union> supp x\<^isub>r) supports (C\<^sup>\<alpha> x\<^isub>1 \<dots> x\<^isub>r)"} |
2110 hypothesis requires us to establish (under some assumptions) a property |
2110 hypothesis requires us to establish (under some assumptions) a property |
2111 @{text "P (C\<^sup>\<alpha> x\<^isub>1\<dots>x\<^isub>r)"} for \emph{all} @{text |
2111 @{text "P (C\<^sup>\<alpha> x\<^isub>1\<dots>x\<^isub>r)"} for \emph{all} @{text |
2112 "x"}$_{1..r}$. The problem with this is that in the presence of binders we cannot make |
2112 "x"}$_{1..r}$. The problem with this is that in the presence of binders we cannot make |
2113 any assumptions about the atoms that are bound---for example assuming the variable convention. |
2113 any assumptions about the atoms that are bound---for example assuming the variable convention. |
2114 One obvious way around this |
2114 One obvious way around this |
2115 problem is to rename them. Unfortunately, this leads to very clunky proofs |
2115 problem is to rename bound atoms. Unfortunately, this leads to very clunky proofs |
2116 and makes formalisations grievous experiences (especially in the context of |
2116 and makes formalisations grievous experiences (especially in the context of |
2117 multiple bound atoms). |
2117 multiple bound atoms). |
2118 |
2118 |
2119 For the older versions of Nominal Isabelle we described in \cite{Urban08} a |
2119 For the older versions of Nominal Isabelle we described in \cite{Urban08} a |
2120 method for automatically strengthening weak induction principles. These |
2120 method for automatically strengthening weak induction principles. These |
2156 for @{text "c"} (third line); for @{text "Let_pat\<^sup>\<alpha>"} we can assume |
2156 for @{text "c"} (third line); for @{text "Let_pat\<^sup>\<alpha>"} we can assume |
2157 all bound atoms from an assignment are fresh for @{text "c"} (fourth |
2157 all bound atoms from an assignment are fresh for @{text "c"} (fourth |
2158 line). In order to see how an instantiation for @{text "c"} in the |
2158 line). In order to see how an instantiation for @{text "c"} in the |
2159 conclusion `controls' the premises, one has to take into account that |
2159 conclusion `controls' the premises, one has to take into account that |
2160 Isabelle/HOL is a typed logic. That means if @{text "c"} is instantiated |
2160 Isabelle/HOL is a typed logic. That means if @{text "c"} is instantiated |
2161 with a pair, for example, then this type-constraint will be propagated to |
2161 with, for example, a pair, then this type-constraint will be propagated to |
2162 the premises. The main point is that if @{text "c"} is instantiated |
2162 the premises. The main point is that if @{text "c"} is instantiated |
2163 appropriately, then the user can mimic the usual `pencil-and-paper' |
2163 appropriately, then the user can mimic the usual `pencil-and-paper' |
2164 reasoning employing the variable convention about bound and free variables |
2164 reasoning employing the variable convention about bound and free variables |
2165 being distinct \cite{Urban08}. |
2165 being distinct \cite{Urban08}. |
2166 |
2166 |
2212 These stronger cases lemmas can be derived from the `weak' cases lemmas |
2212 These stronger cases lemmas can be derived from the `weak' cases lemmas |
2213 given in \eqref{inductex}. This is trivial in case of patterns (the one on |
2213 given in \eqref{inductex}. This is trivial in case of patterns (the one on |
2214 the right-hand side) since the weak and strong cases lemma coincide (there |
2214 the right-hand side) since the weak and strong cases lemma coincide (there |
2215 is no binding in patterns). Interesting are only the cases for @{text |
2215 is no binding in patterns). Interesting are only the cases for @{text |
2216 "Lam\<^sup>\<alpha>"} and @{text "Let_pat\<^sup>\<alpha>"}, where we have some binders and |
2216 "Lam\<^sup>\<alpha>"} and @{text "Let_pat\<^sup>\<alpha>"}, where we have some binders and |
2217 therefore have an addition assumption about avoiding @{text "c"}. Let us |
2217 therefore have an additional assumption about avoiding @{text "c"}. Let us |
2218 first establish the case for @{text "Lam\<^sup>\<alpha>"}. By the weak cases lemma |
2218 first establish the case for @{text "Lam\<^sup>\<alpha>"}. By the weak cases lemma |
2219 \eqref{inductex} we can assume that |
2219 \eqref{inductex} we can assume that |
2220 |
2220 |
2221 \begin{equation}\label{assm} |
2221 \begin{equation}\label{assm} |
2222 @{text "y = Lam\<^sup>\<alpha> x\<^isub>1 x\<^isub>2"} |
2222 @{text "y = Lam\<^sup>\<alpha> x\<^isub>1 x\<^isub>2"} |
2326 we define @{text "\<pi> \<bullet>\<^bsub>bn\<^esub> (C x\<^isub>1 \<dots> x\<^isub>r) \<equiv> C y\<^isub>1 \<dots> y\<^isub>r"} with @{text "y\<^isub>i"} determined as follows: |
2326 we define @{text "\<pi> \<bullet>\<^bsub>bn\<^esub> (C x\<^isub>1 \<dots> x\<^isub>r) \<equiv> C y\<^isub>1 \<dots> y\<^isub>r"} with @{text "y\<^isub>i"} determined as follows: |
2327 |
2327 |
2328 \[\mbox{ |
2328 \[\mbox{ |
2329 \begin{tabular}{c@ {\hspace{2mm}}p{0.9\textwidth}} |
2329 \begin{tabular}{c@ {\hspace{2mm}}p{0.9\textwidth}} |
2330 $\bullet$ & @{text "y\<^isub>i \<equiv> x\<^isub>i"} provided @{text "x\<^isub>i"} does not occur in @{text "rhs"}\\ |
2330 $\bullet$ & @{text "y\<^isub>i \<equiv> x\<^isub>i"} provided @{text "x\<^isub>i"} does not occur in @{text "rhs"}\\ |
2331 $\bullet$ & @{text "y\<^isub>i \<equiv> \<pi> \<bullet>\<^bsub>bn'\<^esub> x\<^isub>i"} provided @{text "bn' x\<^isub>i"} is in @{text "rhs"}\\ |
2331 $\bullet$ & @{text "y\<^isub>i \<equiv> \<pi> \<bullet>\<^bsub>bn\<^esub> x\<^isub>i"} provided @{text "bn x\<^isub>i"} is in @{text "rhs"}\\ |
2332 $\bullet$ & @{text "y\<^isub>i \<equiv> \<pi> \<bullet> x\<^isub>i"} otherwise |
2332 $\bullet$ & @{text "y\<^isub>i \<equiv> \<pi> \<bullet> x\<^isub>i"} otherwise |
2333 \end{tabular}} |
2333 \end{tabular}} |
2334 \]\smallskip |
2334 \]\smallskip |
2335 |
2335 |
2336 \noindent |
2336 \noindent |
2337 Using again the quotient package we can lift the auxiliary permutation operations |
2337 Using again the quotient package we can lift the auxiliary permutation operations |
2338 @{text "_ \<bullet>\<^bsub>bn\<^esub> _"} |
2338 @{text "_ \<bullet>\<^bsub>bn\<^esub> _"} |
2339 to alpha-equated terms. Moreover we can prove the following two properties |
2339 to alpha-equated terms. Moreover we can prove the following two properties: |
2340 |
2340 |
2341 \begin{lem}\label{permutebn} |
2341 \begin{lem}\label{permutebn} |
2342 Given a binding function @{text "bn\<^sup>\<alpha>"} and auxiliary equivalence @{text "\<approx>\<AL>\<^bsub>bn\<^esub>"} |
2342 Given a binding function @{text "bn\<^sup>\<alpha>"} and auxiliary equivalence @{text "\<approx>\<AL>\<^bsub>bn\<^esub>"} |
2343 then for all @{text "\<pi>"}\smallskip\\ |
2343 then for all @{text "\<pi>"}\smallskip\\ |
2344 {\it (i)} @{text "\<pi> \<bullet> (bn\<^sup>\<alpha> x) = bn\<^sup>\<alpha> (\<pi> \<bullet>\<AL>\<^bsub>bn\<^esub> x)"} and\\ |
2344 {\it (i)} @{text "\<pi> \<bullet> (bn\<^sup>\<alpha> x) = bn\<^sup>\<alpha> (\<pi> \<bullet>\<AL>\<^bsub>bn\<^esub> x)"} and\\ |
2382 holds. This allows us to use the implication from the strong cases |
2382 holds. This allows us to use the implication from the strong cases |
2383 lemma, and we are done. |
2383 lemma, and we are done. |
2384 |
2384 |
2385 Consequently, we can discharge all proof-obligations about having covered all |
2385 Consequently, we can discharge all proof-obligations about having covered all |
2386 cases. This completes the proof establishing that the weak induction principles imply |
2386 cases. This completes the proof establishing that the weak induction principles imply |
2387 the strong induction principles. These strong induction principles have proved |
2387 the strong induction principles. These strong induction principles have already proved |
2388 already to be very useful in practice, particularly for proving properties about |
2388 being very useful in practice, particularly for proving properties about |
2389 capture-avoiding substitution. |
2389 capture-avoiding substitution \cite{Urban08}. |
2390 *} |
2390 *} |
2391 |
2391 |
2392 |
2392 |
2393 section {* Related Work\label{related} *} |
2393 section {* Related Work\label{related} *} |
2394 |
2394 |
2453 any nominal techniques. To our knowledge there is no concrete mathematical |
2453 any nominal techniques. To our knowledge there is no concrete mathematical |
2454 result concerning this notion of alpha-equivalence and free variables. We |
2454 result concerning this notion of alpha-equivalence and free variables. We |
2455 have proved that our definitions lead to alpha-equated terms, whose support |
2455 have proved that our definitions lead to alpha-equated terms, whose support |
2456 is as expected (that means bound atoms are removed from the support). We |
2456 is as expected (that means bound atoms are removed from the support). We |
2457 also showed that our specifications lift from `raw' types to types of |
2457 also showed that our specifications lift from `raw' types to types of |
2458 alpha-equivalence classes. For this we had to establish (automatically) that every |
2458 alpha-equivalence classes. For this we have established (automatically) that every |
2459 term-constructor and function defined for `raw' types |
2459 term-constructor and function defined for `raw' types |
2460 is respectful w.r.t.~alpha-equivalence. |
2460 is respectful w.r.t.~alpha-equivalence. |
2461 |
2461 |
2462 Although we were heavily inspired by the syntax of Ott, its definition of |
2462 Although we were heavily inspired by the syntax of Ott, its definition of |
2463 alpha-equi\-valence is unsuitable for our extension of Nominal |
2463 alpha-equi\-valence is unsuitable for our extension of Nominal |
2614 it in others so that the definitions make sense in the context of alpha-equated |
2614 it in others so that the definitions make sense in the context of alpha-equated |
2615 terms. We also introduced two binding modes (set and set+) that do not exist |
2615 terms. We also introduced two binding modes (set and set+) that do not exist |
2616 in Ott. We have tried out the extension with calculi such as Core-Haskell, |
2616 in Ott. We have tried out the extension with calculi such as Core-Haskell, |
2617 type-schemes and approximately a dozen of other typical examples from |
2617 type-schemes and approximately a dozen of other typical examples from |
2618 programming language research~\cite{SewellBestiary}. The code will |
2618 programming language research~\cite{SewellBestiary}. The code will |
2619 eventually become part of the next Isabelle distribution.\footnote{It |
2619 eventually become part of the Isabelle distribution.\footnote{It |
2620 can be downloaded already from \href{http://isabelle.in.tum.de/nominal/download} |
2620 can be downloaded already from \href{http://isabelle.in.tum.de/nominal/download} |
2621 {http://isabelle.in.tum.de/nominal/download}.} |
2621 {http://isabelle.in.tum.de/nominal/download}.} |
2622 |
2622 |
2623 We have left out a discussion about how functions can be defined over |
2623 We have left out a discussion about how functions can be defined over |
2624 alpha-equated terms involving general binders. In earlier versions of |
2624 alpha-equated terms involving general binders. In earlier versions of |