26 alpha_abs ("_ \<approx>\<^raw:{$\,_{\textit{abs\_set}}$}> _") and |
26 alpha_abs ("_ \<approx>\<^raw:{$\,_{\textit{abs\_set}}$}> _") and |
27 Abs ("[_]\<^raw:$\!$>\<^bsub>set\<^esub>._" [20, 101] 999) and |
27 Abs ("[_]\<^raw:$\!$>\<^bsub>set\<^esub>._" [20, 101] 999) and |
28 Abs_lst ("[_]\<^raw:$\!$>\<^bsub>list\<^esub>._") and |
28 Abs_lst ("[_]\<^raw:$\!$>\<^bsub>list\<^esub>._") and |
29 Abs_res ("[_]\<^raw:$\!$>\<^bsub>res\<^esub>._") and |
29 Abs_res ("[_]\<^raw:$\!$>\<^bsub>res\<^esub>._") and |
30 Cons ("_::_" [78,77] 73) and |
30 Cons ("_::_" [78,77] 73) and |
31 supp_gen ("aux _" [1000] 100) |
31 supp_gen ("aux _" [1000] 10) |
32 (*>*) |
32 (*>*) |
33 |
33 |
34 |
34 |
35 section {* Introduction *} |
35 section {* Introduction *} |
36 |
36 |
554 \begin{property}\label{supppermeq} |
554 \begin{property}\label{supppermeq} |
555 @{thm[mode=IfThen] supp_perm_eq[no_vars]} |
555 @{thm[mode=IfThen] supp_perm_eq[no_vars]} |
556 \end{property} |
556 \end{property} |
557 |
557 |
558 \begin{property} |
558 \begin{property} |
559 For a finite set @{text xs} and a finitely supported @{text x} with |
559 For a finite set @{text as} and a finitely supported @{text x} with |
560 @{term "xs \<sharp>* x"} and also a finitely supported @{text c}, there |
560 @{term "as \<sharp>* x"} and also a finitely supported @{text c}, there |
561 exists a permutation @{text p} such that @{term "(p \<bullet> xs) \<sharp>* c"} and |
561 exists a permutation @{text p} such that @{term "(p \<bullet> as) \<sharp>* c"} and |
562 @{term "supp x \<sharp>* p"}. |
562 @{term "supp x \<sharp>* p"}. |
563 \end{property} |
563 \end{property} |
564 |
564 |
565 \noindent |
565 \noindent |
566 The idea behind the second property is that given a finite set @{text xs} |
566 The idea behind the second property is that given a finite set @{text as} |
567 of binders (being bound in @{text x} which is ensured by the |
567 of binders (being bound in @{text x} which is ensured by the |
568 assumption @{term "xs \<sharp>* x"}), then there exists a permutation @{text p} such that |
568 assumption @{term "as \<sharp>* x"}), then there exists a permutation @{text p} such that |
569 the renamed binders @{term "p \<bullet> xs"} avoid the @{text c} (which can be arbitrarily chosen |
569 the renamed binders @{term "p \<bullet> as"} avoid the @{text c} (which can be arbitrarily chosen |
570 as long as it is finitely supported) and also does not affect anything |
570 as long as it is finitely supported) and also does not affect anything |
571 in the support of @{text x} (that is @{term "supp x \<sharp>* p"}). The last |
571 in the support of @{text x} (that is @{term "supp x \<sharp>* p"}). The last |
572 fact and Property~\ref{supppermeq} allow us to ``rename'' just the binders |
572 fact and Property~\ref{supppermeq} allow us to ``rename'' just the binders |
573 in @{text x}, because @{term "p \<bullet> x = x"}. |
573 in @{text x}, because @{term "p \<bullet> x = x"}. |
574 |
574 |
623 "p"}. Alpha-equivalence between two pairs is then the relation where we |
623 "p"}. Alpha-equivalence between two pairs is then the relation where we |
624 existentially quantify over this @{text "p"}. Also note that the relation is |
624 existentially quantify over this @{text "p"}. Also note that the relation is |
625 dependent on a free-variable function @{text "fv"} and a relation @{text |
625 dependent on a free-variable function @{text "fv"} and a relation @{text |
626 "R"}. The reason for this extra generality is that we will use |
626 "R"}. The reason for this extra generality is that we will use |
627 $\approx_{\textit{set}}$ for both ``raw'' terms and alpha-equated terms. In |
627 $\approx_{\textit{set}}$ for both ``raw'' terms and alpha-equated terms. In |
628 the latter case, $R$ will be replaced by equality @{text "="} and for raw terms we |
628 the latter case, $R$ will be replaced by equality @{text "="} and we |
629 will prove that @{text "fv"} is equal to the support of @{text |
629 will prove that @{text "fv"} is equal to the support of @{text |
630 x} and @{text y}. |
630 x} and @{text y}. |
631 |
631 |
632 The definition in \eqref{alphaset} does not make any distinction between the |
632 The definition in \eqref{alphaset} does not make any distinction between the |
633 order of abstracted variables. If we want this, then we can define alpha-equivalence |
633 order of abstracted variables. If we want this, then we can define alpha-equivalence |
757 @{term "Abs_lst as x"} \hspace{5mm} |
757 @{term "Abs_lst as x"} \hspace{5mm} |
758 @{term "Abs_res as x"} |
758 @{term "Abs_res as x"} |
759 \end{center} |
759 \end{center} |
760 |
760 |
761 \noindent |
761 \noindent |
762 indicating that a set or list is abstracted in @{text x}. We will call the types |
762 indicating that a set or list @{text as} is abstracted in @{text x}. We will |
763 \emph{abstraction types} and their elements \emph{abstractions}. The important |
763 call the types \emph{abstraction types} and their elements |
764 property we need is a characterisation for the support of abstractions, namely |
764 \emph{abstractions}. The important property we need is a characterisation |
|
765 for the support of abstractions, namely: |
765 |
766 |
766 \begin{thm}[Support of Abstractions]\label{suppabs} |
767 \begin{thm}[Support of Abstractions]\label{suppabs} |
767 Assuming @{text x} has finite support, then\\[-6mm] |
768 Assuming @{text x} has finite support, then\\[-6mm] |
768 \begin{center} |
769 \begin{center} |
769 \begin{tabular}{l@ {\hspace{2mm}}c@ {\hspace{2mm}}l} |
770 \begin{tabular}{l@ {\hspace{2mm}}c@ {\hspace{2mm}}l} |
770 @{thm (lhs) supp_abs(1)[no_vars]} & $=$ & @{thm (rhs) supp_abs(1)[no_vars]}\\ |
771 @{thm (lhs) supp_abs(1)[no_vars]} & $=$ & @{thm (rhs) supp_abs(1)[no_vars]}\\ |
771 @{thm (lhs) supp_abs(2)[no_vars]} & $=$ & @{thm (rhs) supp_abs(2)[no_vars]}\\ |
772 @{thm (lhs) supp_abs(2)[no_vars]} & $=$ & @{thm (rhs) supp_abs(2)[no_vars]}\\ |
772 @{thm (lhs) supp_abs(3)[no_vars]} & $=$ & @{thm (rhs) supp_abs(3)[no_vars]} |
773 @{thm (lhs) supp_abs(3)[where bs="as", no_vars]} & $=$ & @{thm (rhs) supp_abs(3)[where bs="as", no_vars]} |
773 \end{tabular} |
774 \end{tabular} |
774 \end{center} |
775 \end{center} |
775 \end{thm} |
776 \end{thm} |
776 |
777 |
777 \noindent |
778 \noindent |
778 We will only show the first equation as the others |
779 We will show below the first equation as the others |
779 follow similar arguments. By definition of the abstraction type @{text "abs_set"} |
780 follow similar arguments. By definition of the abstraction type @{text "abs_set"} |
780 we have |
781 we have |
781 % |
782 % |
782 \begin{equation}\label{abseqiff} |
783 \begin{equation}\label{abseqiff} |
783 @{thm (lhs) abs_eq_iff(1)[where bs="as" and cs="bs", no_vars]} \;\;\text{if and only if}\;\; |
784 @{thm (lhs) abs_eq_iff(1)[where bs="as" and cs="bs", no_vars]} \;\;\text{if and only if}\;\; |
790 \begin{equation} |
791 \begin{equation} |
791 @{thm permute_Abs[no_vars]} |
792 @{thm permute_Abs[no_vars]} |
792 \end{equation} |
793 \end{equation} |
793 |
794 |
794 \noindent |
795 \noindent |
795 The last fact derives from the definition of permutations acting on pairs |
796 The second fact derives from the definition of permutations acting on pairs |
796 (see \eqref{permute}) and alpha-equivalence being equivariant (see Lemma~\ref{alphaeq}). |
797 (see \eqref{permute}) and alpha-equivalence being equivariant |
797 |
798 (see Lemma~\ref{alphaeq}). With these two facts at our disposal, we can show |
798 With these two facts at our disposal, we can show the following lemma |
799 the following lemma about swapping two atoms. |
799 about swapping two atoms. |
|
800 |
800 |
801 \begin{lemma} |
801 \begin{lemma} |
802 @{thm[mode=IfThen] abs_swap1(1)[no_vars]} |
802 @{thm[mode=IfThen] abs_swap1(1)[where bs="as", no_vars]} |
803 \end{lemma} |
803 \end{lemma} |
804 |
804 |
805 \begin{proof} |
805 \begin{proof} |
806 By using \eqref{abseqiff}, this lemma is straightforward when observing that |
806 By using \eqref{abseqiff}, this lemma is straightforward when observing that |
807 the assumptions give us |
807 the assumptions give us @{term "(a \<rightleftharpoons> b) \<bullet> (supp x - as) = (supp x - as)"} |
808 @{term "(a \<rightleftharpoons> b) \<bullet> (supp x - bs) = (supp x - bs)"} and that @{text supp} |
808 and that @{text supp} and set difference are equivariant. |
809 and set difference are equivariant. |
|
810 \end{proof} |
809 \end{proof} |
811 |
810 |
812 \noindent |
811 \noindent |
813 This lemma gives us |
812 This lemma allows us to show |
814 % |
813 % |
815 \begin{equation}\label{halfone} |
814 \begin{equation}\label{halfone} |
816 @{thm abs_supports(1)[no_vars]} |
815 @{thm abs_supports(1)[no_vars]} |
817 \end{equation} |
816 \end{equation} |
818 |
817 |
819 \noindent |
818 \noindent |
820 which with Property~\ref{supportsprop} gives us one half of |
819 which by Property~\ref{supportsprop} gives us ``one half'' of |
821 Thm~\ref{suppabs}. The other half is a bit more involved. For this we use a |
820 Thm~\ref{suppabs}. The ``other half'' is a bit more involved. To establish |
822 trick from \cite{Pitts04} and first define an auxiliary function |
821 it, we use a trick from \cite{Pitts04} and first define an auxiliary |
|
822 function taking an abstraction as argument |
823 % |
823 % |
824 \begin{center} |
824 \begin{center} |
825 @{thm supp_gen.simps[THEN eq_reflection, no_vars]} |
825 @{thm supp_gen.simps[THEN eq_reflection, no_vars]} |
826 \end{center} |
826 \end{center} |
827 |
827 |
828 \noindent |
828 \noindent |
829 Using the second equation in \eqref{equivariance}, we can show that |
829 Using the second equation in \eqref{equivariance}, we can show that |
830 @{term "supp_gen"} is equivariant and therefore has empty support. This |
830 @{text "aux"} is equivariant (since @{term "p \<bullet> (supp x - as) = |
831 in turn means |
831 (supp (p \<bullet> x)) - (p \<bullet> as)"}) and therefore has empty support. |
832 % |
832 This in turn means |
833 \begin{center} |
833 % |
834 @{thm (prem 1) aux_fresh(1)[where bs="as", no_vars]} |
834 \begin{center} |
835 \;\;implies\;\; |
835 @{term "supp (supp_gen (Abs as x)) \<subseteq> supp (Abs as x)"} |
836 @{thm (concl) aux_fresh(1)[where bs="as", no_vars]} |
836 \end{center} |
837 \end{center} |
837 |
838 |
838 \noindent |
839 \noindent |
839 using \eqref{suppfun}. Assuming @{term "supp x - as"} is a finite set |
840 using \eqref{suppfun}. Since @{term "supp x"} is by definition equal |
840 we further obtain |
841 to @{term "{a. \<not> a \<sharp> x}"} we can establish that |
|
842 % |
841 % |
843 \begin{equation}\label{halftwo} |
842 \begin{equation}\label{halftwo} |
844 @{thm (concl) supp_abs_subset1(1)[no_vars]} |
843 @{thm (concl) supp_abs_subset1(1)[no_vars]} |
845 \end{equation} |
844 \end{equation} |
846 |
845 |
847 \noindent |
846 \noindent |
848 provided @{text x} has finite support (the precondition we need in order to show |
847 since for finite sets, @{text "S"}, we have |
849 that for a finite set of atoms, we have @{thm (concl) supp_finite_atom_set[where S="bs", no_vars]}). |
848 @{thm (concl) supp_finite_atom_set[no_vars]}). |
850 |
849 |
851 Finally taking \eqref{halfone} and \eqref{halftwo} provides us with a proof |
850 Finally taking \eqref{halfone} and \eqref{halftwo} provides us with a proof |
852 of Theorem~\ref{suppabs}. The point of these general lemmas about abstractions is that we |
851 of Theorem~\ref{suppabs}. The point of these general lemmas about abstractions is that we |
853 can define and prove properties about them conveniently on the Isabelle/HOL level, |
852 can define and prove properties about them conveniently on the Isabelle/HOL level, |
854 and in addition can use them in what |
853 but also use them in what follows next when we deal with binding in specifications |
855 follows next when we have to deal with binding in specifications of term-calculi. |
854 of term-calculi. |
856 *} |
855 *} |
857 |
856 |
858 section {* Alpha-Equivalence and Free Variables *} |
857 section {* Alpha-Equivalence and Free Variables *} |
859 |
858 |
860 text {* |
859 text {* |