220 |
220 |
221 \noindent |
221 \noindent |
222 where no clause for variables is given. Arguably, such specifications make |
222 where no clause for variables is given. Arguably, such specifications make |
223 some sense in the context of Coq's type theory (which Ott supports), but not |
223 some sense in the context of Coq's type theory (which Ott supports), but not |
224 at all in a HOL-based environment where every datatype must have a non-empty |
224 at all in a HOL-based environment where every datatype must have a non-empty |
225 set-theoretic model. |
225 set-theoretic model \cite{Berghofer99}. |
226 |
226 |
227 Another reason is that we establish the reasoning infrastructure |
227 Another reason is that we establish the reasoning infrastructure |
228 for alpha-\emph{equated} terms. In contrast, Ott produces a reasoning |
228 for alpha-\emph{equated} terms. In contrast, Ott produces a reasoning |
229 infrastructure in Isabelle/HOL for |
229 infrastructure in Isabelle/HOL for |
230 \emph{non}-alpha-equated, or ``raw'', terms. While our alpha-equated terms |
230 \emph{non}-alpha-equated, or ``raw'', terms. While our alpha-equated terms |
842 \begin{equation}\label{halftwo} |
842 \begin{equation}\label{halftwo} |
843 @{thm (concl) supp_abs_subset1(1)[no_vars]} |
843 @{thm (concl) supp_abs_subset1(1)[no_vars]} |
844 \end{equation} |
844 \end{equation} |
845 |
845 |
846 \noindent |
846 \noindent |
847 since for finite sets, @{text "S"}, we have |
847 since for finite sets, @{text "S"}, we have @{thm (concl) supp_finite_atom_set[no_vars]}. |
848 @{thm (concl) supp_finite_atom_set[no_vars]}). |
848 |
849 |
849 Finally taking \eqref{halfone} and \eqref{halftwo} together provides us with a proof |
850 Finally taking \eqref{halfone} and \eqref{halftwo} provides us with a proof |
850 of Theorem~\ref{suppabs}. The point of these properties of abstractions is that we |
851 of Theorem~\ref{suppabs}. The point of these general lemmas about abstractions is that we |
851 can define and prove them aconveniently on the Isabelle/HOL level, |
852 can define and prove properties about them conveniently on the Isabelle/HOL level, |
852 but also use them in what follows next when we deal with binding in |
853 but also use them in what follows next when we deal with binding in specifications |
853 specifications of term-calculi. |
854 of term-calculi. |
|
855 *} |
854 *} |
856 |
855 |
857 section {* Alpha-Equivalence and Free Variables\label{sec:alpha} *} |
856 section {* Alpha-Equivalence and Free Variables\label{sec:alpha} *} |
858 |
857 |
859 text {* |
858 text {* |
860 Our choice of syntax for specifications of term-calculi is influenced by the existing |
859 Our choice of syntax for specifications of term-calculi is influenced by the existing |
861 datatype package of Isabelle/HOL and by the syntax of the Ott-tool |
860 datatype package of Isabelle/HOL \cite{Berghofer99} and by the syntax of the Ott-tool |
862 \cite{ott-jfp}. A specification is a collection of (possibly mutual |
861 \cite{ott-jfp}. A specification is a collection of (possibly mutual |
863 recursive) type declarations, say @{text "ty"}$^\alpha_1$, \ldots, |
862 recursive) type declarations, say @{text "ty"}$^\alpha_1$, \ldots, |
864 @{text ty}$^\alpha_n$, and an associated collection |
863 @{text ty}$^\alpha_n$, and an associated collection |
865 of binding functions, say @{text bn}$^\alpha_1$, \ldots, @{text |
864 of binding functions, say @{text bn}$^\alpha_1$, \ldots, @{text |
866 bn}$^\alpha_m$. The syntax in Nominal Isabelle for such specifications is |
865 bn}$^\alpha_m$. The syntax in Nominal Isabelle for such specifications is |
900 |
899 |
901 \noindent |
900 \noindent |
902 whereby some of the @{text ty}$'_{1..l}$ (or their components) are contained in the collection |
901 whereby some of the @{text ty}$'_{1..l}$ (or their components) are contained in the collection |
903 of @{text ty}$^\alpha_{1..n}$ declared in \eqref{scheme}. In this case we will call the |
902 of @{text ty}$^\alpha_{1..n}$ declared in \eqref{scheme}. In this case we will call the |
904 corresponding argument a \emph{recursive argument}. The labels annotated on |
903 corresponding argument a \emph{recursive argument}. The labels annotated on |
905 the types are optional and can be used in the (possibly empty) list of |
904 the types are optional. Their purpose is to be used in the (possibly empty) list of |
906 \emph{binding clauses}. These clauses indicate the binders and their scope of |
905 \emph{binding clauses}, which indicate the binders and their scope |
907 in a term-constructor. They come in three \emph{modes}: |
906 in a term-constructor. They come in three \emph{modes}: |
908 |
907 |
909 |
908 |
910 \begin{center} |
909 \begin{center} |
911 \begin{tabular}{l} |
910 \begin{tabular}{l} |
918 \noindent |
917 \noindent |
919 The first mode is for binding lists of atoms (the order of binders matters); the second is for sets |
918 The first mode is for binding lists of atoms (the order of binders matters); the second is for sets |
920 of binders (the order does not matter, but the cardinality does) and the last is for |
919 of binders (the order does not matter, but the cardinality does) and the last is for |
921 sets of binders (with vacuous binders preserving alpha-equivalence). |
920 sets of binders (with vacuous binders preserving alpha-equivalence). |
922 |
921 |
923 In addition we distinguish between \emph{shallow} binders and \emph{deep} |
922 In addition we distinguish between \emph{shallow} and \emph{deep} |
924 binders. Shallow binders are of the form \isacommand{bind}\; {\it label}\; |
923 binders. Shallow binders are of the form \isacommand{bind}\; {\it label}\; |
925 \isacommand{in}\; {\it label'} (similar for the other two modes). The |
924 \isacommand{in}\; {\it label'} (similar for the other two modes). The |
926 restriction we impose on shallow binders is that the {\it label} must either |
925 restriction we impose on shallow binders is that the {\it label} must either |
927 refer to a type that is an atom type or to a type that is a finite set or |
926 refer to a type that is an atom type or to a type that is a finite set or |
928 list of an atom type. Two examples for the use of shallow binders are the |
927 list of an atom type. Two examples for the use of shallow binders are the |
930 type-schemes, where a finite set of names is bound: |
929 type-schemes, where a finite set of names is bound: |
931 |
930 |
932 \begin{center} |
931 \begin{center} |
933 \begin{tabular}{@ {}cc@ {}} |
932 \begin{tabular}{@ {}cc@ {}} |
934 \begin{tabular}{@ {}l@ {\hspace{-1mm}}} |
933 \begin{tabular}{@ {}l@ {\hspace{-1mm}}} |
935 \isacommand{nominal\_datatype} {\it lam} =\\ |
934 \isacommand{nominal\_datatype} @{text lam} =\\ |
936 \hspace{5mm}\phantom{$\mid$} Var\;{\it name}\\ |
935 \hspace{5mm}\phantom{$\mid$}~@{text "Var name"}\\ |
937 \hspace{5mm}$\mid$ App\;{\it lam}\;{\it lam}\\ |
936 \hspace{5mm}$\mid$~@{text "App lam lam"}\\ |
938 \hspace{5mm}$\mid$ Lam\;{\it x::name}\;{\it t::lam}\\ |
937 \hspace{5mm}$\mid$~@{text "Lam x::name t::lam"}\\ |
939 \hspace{21mm}\isacommand{bind} {\it x} \isacommand{in} {\it t}\\ |
938 \hspace{21mm}\isacommand{bind} @{text x} \isacommand{in} @{text t}\\ |
940 \end{tabular} & |
939 \end{tabular} & |
941 \begin{tabular}{@ {}l@ {}} |
940 \begin{tabular}{@ {}l@ {}} |
942 \isacommand{nominal\_datatype} {\it ty} =\\ |
941 \isacommand{nominal\_datatype}~@{text ty} =\\ |
943 \hspace{5mm}\phantom{$\mid$} TVar\;{\it name}\\ |
942 \hspace{5mm}\phantom{$\mid$}~@{text "TVar name"}\\ |
944 \hspace{5mm}$\mid$ TFun\;{\it ty}\;{\it ty}\\ |
943 \hspace{5mm}$\mid$~@{text "TFun ty ty"}\\ |
945 \isacommand{and} {\it tsc} = All\;{\it xs::(name fset)}\;{\it T::ty}\\ |
944 \isacommand{and}~@{text "tsc = All xs::(name fset) T::ty"}\\ |
946 \hspace{24mm}\isacommand{bind\_res} {\it xs} \isacommand{in} {\it T}\\ |
945 \hspace{24mm}\isacommand{bind\_res} @{text xs} \isacommand{in} @{text T}\\ |
947 \end{tabular} |
946 \end{tabular} |
948 \end{tabular} |
947 \end{tabular} |
949 \end{center} |
948 \end{center} |
950 |
949 |
951 \noindent |
950 \noindent |
953 If we have shallow binders that ``share'' a body, for instance $t$ in |
952 If we have shallow binders that ``share'' a body, for instance $t$ in |
954 the following term-constructor |
953 the following term-constructor |
955 |
954 |
956 \begin{center} |
955 \begin{center} |
957 \begin{tabular}{ll} |
956 \begin{tabular}{ll} |
958 \it {\rm Foo} x::name y::name t::lam & \it |
957 @{text "Foo x::name y::name t::lam"} & |
959 \isacommand{bind}\;x\;\isacommand{in}\;t,\; |
958 \isacommand{bind} @{text x} \isacommand{in} @{text t},\; |
960 \isacommand{bind}\;y\;\isacommand{in}\;t |
959 \isacommand{bind} @{text y} \isacommand{in} @{text t} |
961 \end{tabular} |
960 \end{tabular} |
962 \end{center} |
961 \end{center} |
963 |
962 |
964 \noindent |
963 \noindent |
965 then we have to make sure the modes of the binders agree. We cannot |
964 then we have to make sure the modes of the binders agree. We cannot |
977 the scheme shown in \eqref{scheme}. For example for a calculus containing lets |
976 the scheme shown in \eqref{scheme}. For example for a calculus containing lets |
978 with tuple patterns, you might specify |
977 with tuple patterns, you might specify |
979 |
978 |
980 \begin{center} |
979 \begin{center} |
981 \begin{tabular}{l} |
980 \begin{tabular}{l} |
982 \isacommand{nominal\_datatype} {\it trm} =\\ |
981 \isacommand{nominal\_datatype} @{text trm} =\\ |
983 \hspace{5mm}\phantom{$\mid$} Var\;{\it name}\\ |
982 \hspace{5mm}\phantom{$\mid$}~@{term "Var name"}\\ |
984 \hspace{5mm}$\mid$ App\;{\it trm}\;{\it trm}\\ |
983 \hspace{5mm}$\mid$~@{term "App trm trm"}\\ |
985 \hspace{5mm}$\mid$ Lam\;{\it x::name}\;{\it t::trm} |
984 \hspace{5mm}$\mid$~@{text "Lam x::name t::trm"} |
986 \;\;\isacommand{bind} {\it x} \isacommand{in} {\it t}\\ |
985 \;\;\isacommand{bind} @{text x} \isacommand{in} @{text t}\\ |
987 \hspace{5mm}$\mid$ Let\;{\it p::pat}\;{\it trm}\; {\it t::trm} |
986 \hspace{5mm}$\mid$~@{text "Let p::pat trm t::trm"} |
988 \;\;\isacommand{bind} {\it bn(p)} \isacommand{in} {\it t}\\ |
987 \;\;\isacommand{bind} @{text "bn(p)"} \isacommand{in} @{text t}\\ |
989 \isacommand{and} {\it pat} =\\ |
988 \isacommand{and} @{text pat} =\\ |
990 \hspace{5mm}\phantom{$\mid$} PNil\\ |
989 \hspace{5mm}\phantom{$\mid$}~@{text PNil}\\ |
991 \hspace{5mm}$\mid$ PVar\;{\it name}\\ |
990 \hspace{5mm}$\mid$~@{text "PVar name"}\\ |
992 \hspace{5mm}$\mid$ PTup\;{\it pat}\;{\it pat}\\ |
991 \hspace{5mm}$\mid$~@{text "PTup pat pat"}\\ |
993 \isacommand{with} {\it bn::pat $\Rightarrow$ atom list}\\ |
992 \isacommand{with}~@{text "bn::pat \<Rightarrow> atom list"}\\ |
994 \isacommand{where} $\textit{bn}(\textrm{PNil}) = []$\\ |
993 \isacommand{where}~@{text "bn(PNil) = []"}\\ |
995 \hspace{5mm}$\mid$ $\textit{bn}(\textrm{PVar}\;x) = [\textit{atom}\; x]$\\ |
994 \hspace{5mm}$\mid$~@{text "bn(PVar x) = [atom x]"}\\ |
996 \hspace{5mm}$\mid$ $\textit{bn}(\textrm{PTup}\;p_1\;p_2) = \textit{bn}(p_1)\; @\;\textit{bn}(p_2)$\\ |
995 \hspace{5mm}$\mid$~@{text "bn(PTup p\<^isub>1 p\<^isub>2) = bn(p\<^isub>1) @ bn(p\<^isub>2)"}\\ |
997 \end{tabular} |
996 \end{tabular} |
998 \end{center} |
997 \end{center} |
999 |
998 |
1000 \noindent |
999 \noindent |
1001 In this specification the function @{text "bn"} determines which atoms of @{text p} are |
1000 In this specification the function @{text "bn"} determines which atoms of @{text p} are |
1002 bound in the argument @{text "t"}. Note that the second last clause the function @{text "atom"} |
1001 bound in the argument @{text "t"}. Note that in the second last clause the function @{text "atom"} |
1003 coerces a name into the generic atom type of Nominal Isabelle. This allows |
1002 coerces a name into the generic atom type of Nominal Isabelle. This allows |
1004 us to treat binders of different atom type uniformly. |
1003 us to treat binders of different atom type uniformly. |
1005 |
1004 |
1006 As will shortly become clear, we cannot return an atom in a binding function |
1005 As will shortly become clear, we cannot return an atom in a binding function |
1007 that is also bound in the corresponding term-constructor. That means in the |
1006 that is also bound in the corresponding term-constructor. That means in the |
1009 binding clause. In the present version of Nominal Isabelle, we also adopted |
1008 binding clause. In the present version of Nominal Isabelle, we also adopted |
1010 the restriction from the Ott-tool that binding functions can only return: |
1009 the restriction from the Ott-tool that binding functions can only return: |
1011 the empty set or empty list (as in case PNil), a singleton set or singleton |
1010 the empty set or empty list (as in case PNil), a singleton set or singleton |
1012 list containing an atom (case PVar), or unions of atom sets or appended atom |
1011 list containing an atom (case PVar), or unions of atom sets or appended atom |
1013 lists (case PTup). This restriction will simplify proofs later on. |
1012 lists (case PTup). This restriction will simplify proofs later on. |
1014 The the most drastic restriction we have to impose on deep binders is that |
1013 |
|
1014 The most drastic restriction we have to impose on deep binders is that |
1015 we cannot have ``overlapping'' deep binders. Consider for example the |
1015 we cannot have ``overlapping'' deep binders. Consider for example the |
1016 term-constructors: |
1016 term-constructors: |
1017 |
1017 |
1018 \begin{center} |
1018 \begin{center} |
1019 \begin{tabular}{ll} |
1019 \begin{tabular}{ll} |
1020 \it {\rm Foo} p::pat q::pat t::trm & \it \isacommand{bind}\;bn(p)\;\isacommand{in}\;t,\; |
1020 @{text "Foo p::pat q::pat t::trm"} & |
1021 \isacommand{bind}\;bn(q)\;\isacommand{in}\;t\\ |
1021 \isacommand{bind} @{text "bn(p)"} \isacommand{in} @{text t},\; |
1022 \it {\rm Foo}$'$x::name p::pat t::trm & \it \it \isacommand{bind}\;x\;\isacommand{in}\;t,\; |
1022 \isacommand{bind} @{text "bn(q)"} \isacommand{in} @{text t}\\ |
1023 \isacommand{bind}\;bn(p)\;\isacommand{in}\;t |
1023 @{text "Foo' x::name p::pat t::trm"} & |
|
1024 \isacommand{bind} @{text x} \isacommand{in} @{text t},\; |
|
1025 \isacommand{bind} @{text "bn(p)"} \isacommand{in} @{text t} |
1024 |
1026 |
1025 \end{tabular} |
1027 \end{tabular} |
1026 \end{center} |
1028 \end{center} |
1027 |
1029 |
1028 \noindent |
1030 \noindent |
1035 the general binders described in Section \ref{sec:binders}. However |
1037 the general binders described in Section \ref{sec:binders}. However |
1036 the following two term-constructors are allowed |
1038 the following two term-constructors are allowed |
1037 |
1039 |
1038 \begin{center} |
1040 \begin{center} |
1039 \begin{tabular}{ll} |
1041 \begin{tabular}{ll} |
1040 \it {\rm Bar} p::pat t::trm s::trm & \it \isacommand{bind}\;bn(p)\;\isacommand{in}\;t,\; |
1042 @{text "Bar p::pat t::trm s::trm"} & |
1041 \isacommand{bind}\;bn(p)\;\isacommand{in}\;s\\ |
1043 \isacommand{bind} @{text "bn(p)"} \isacommand{in} @{text t},\; |
1042 \it {\rm Bar}$'$p::pat t::trm & \it \isacommand{bind}\;bn(p)\;\isacommand{in}\;p,\; |
1044 \isacommand{bind} @{text "bn(p)"} \isacommand{in} @{text s}\\ |
1043 \isacommand{bind}\;bn(p)\;\isacommand{in}\;t\\ |
1045 @{text "Bar' p::pat t::trm"} & |
|
1046 \isacommand{bind} @{text "bn(p)"} \isacommand{in} @{text p},\; |
|
1047 \isacommand{bind} @{text "bn(p)"} \isacommand{in} @{text t}\\ |
1044 \end{tabular} |
1048 \end{tabular} |
1045 \end{center} |
1049 \end{center} |
1046 |
1050 |
1047 \noindent |
1051 \noindent |
1048 since there is no overlap of binders. |
1052 since there is no overlap of binders. |
1049 |
1053 |
1050 Note that in the last example we wrote {\it\isacommand{bind}\;bn(p)\;\isacommand{in}\;p}. |
1054 Note that in the last example we wrote {\it\isacommand{bind}\;bn(p)\;\isacommand{in}\;p}. |
1051 Whenever such a binding clause is present, we will call the binder \emph{recursive}. |
1055 Whenever such a binding clause is present, we will call the binder \emph{recursive}. |
1052 To see the purpose for this, consider ``plain'' Lets and Let\_recs: |
1056 To see the purpose for this, compare ``plain'' Lets and Let\_recs: |
1053 |
1057 |
1054 \begin{center} |
1058 \begin{center} |
1055 \begin{tabular}{@ {}l@ {}} |
1059 \begin{tabular}{@ {}l@ {}} |
1056 \isacommand{nominal\_datatype} {\it trm} =\\ |
1060 \isacommand{nominal\_datatype} {\it trm} =\\ |
1057 \hspace{5mm}\phantom{$\mid$}\ldots\\ |
1061 \hspace{5mm}\phantom{$\mid$}\ldots\\ |
1081 establish a reasoning infrastructure for them. Because of the problem |
1085 establish a reasoning infrastructure for them. Because of the problem |
1082 Pottier and Cheney pointed out, we cannot in general re-arrange arguments of |
1086 Pottier and Cheney pointed out, we cannot in general re-arrange arguments of |
1083 term-constructors so that binders and their bodies are next to each other, and |
1087 term-constructors so that binders and their bodies are next to each other, and |
1084 then use the type constructors @{text "abs_set"}, @{text "abs_res"} and |
1088 then use the type constructors @{text "abs_set"}, @{text "abs_res"} and |
1085 @{text "abs_list"} from Section \ref{sec:binders}. Therefore we will first |
1089 @{text "abs_list"} from Section \ref{sec:binders}. Therefore we will first |
1086 extract datatype definitions from the specification and then define an |
1090 extract datatype definitions from the specification and then define |
1087 alpha-equivalence relation over them. |
1091 independently an alpha-equivalence relation over them. |
1088 |
1092 |
1089 |
1093 |
1090 The datatype definition can be obtained by just stripping off the |
1094 The datatype definition can be obtained by just stripping off the |
1091 binding clauses and the labels on the types. We also have to invent |
1095 binding clauses and the labels on the types. We also have to invent |
1092 new names for the types @{text "ty\<^sup>\<alpha>"} and term-constructors @{text "C\<^sup>\<alpha>"} |
1096 new names for the types @{text "ty\<^sup>\<alpha>"} and term-constructors @{text "C\<^sup>\<alpha>"} |
1093 given by user. In our implementation we just use an affix like |
1097 given by user. In our implementation we just use an affix @{text "_raw"}. |
1094 |
1098 For the purpose of the paper we just use superscripts to indicate a |
1095 \begin{center} |
1099 notion defined over alpha-equivalence classes and leave out the superscript |
1096 @{text "ty\<^sup>\<alpha> \<mapsto> ty_raw"} \hspace{7mm} @{text "C\<^sup>\<alpha> \<mapsto> C_raw"} |
1100 for the corresponding notion on the ``raw'' level. So for example: |
|
1101 |
|
1102 \begin{center} |
|
1103 @{text "ty\<^sup>\<alpha> \<mapsto> ty"} \hspace{7mm} @{text "C\<^sup>\<alpha> \<mapsto> C"} |
1097 \end{center} |
1104 \end{center} |
1098 |
1105 |
1099 \noindent |
1106 \noindent |
1100 The resulting datatype definition is legal in Isabelle/HOL provided the datatypes are |
1107 The resulting datatype definition is legal in Isabelle/HOL provided the datatypes are |
1101 non-empty and the types in the constructors only occur in positive |
1108 non-empty and the types in the constructors only occur in positive |
1102 position (see \cite{} for an indepth explanation of the datatype package |
1109 position (see \cite{Berghofer99} for an indepth explanation of the datatype package |
1103 in Isabelle/HOL). We then define the user-specified binding |
1110 in Isabelle/HOL). We then define the user-specified binding |
1104 functions by primitive recursion over the raw datatypes. We can also |
1111 functions by primitive recursion over the raw datatypes. We can also |
1105 easily define a permutation operation by primitive recursion so that for each |
1112 easily define a permutation operation by primitive recursion so that for each |
1106 term constructor @{text "C_raw ty\<^isub>1 \<dots> ty\<^isub>n"} we have that |
1113 term constructor @{text "C ty\<^isub>1 \<dots> ty\<^isub>n"} we have that |
1107 |
1114 |
1108 \begin{center} |
1115 \begin{center} |
1109 @{text "p \<bullet> (C_raw x\<^isub>1 \<dots> x\<^isub>n) \<equiv> C_raw (p \<bullet> x\<^isub>1) \<dots> (p \<bullet> x\<^isub>n)"} |
1116 @{text "p \<bullet> (C x\<^isub>1 \<dots> x\<^isub>n) \<equiv> C (p \<bullet> x\<^isub>1) \<dots> (p \<bullet> x\<^isub>n)"} |
1110 \end{center} |
1117 \end{center} |
1111 |
1118 |
1112 \noindent |
1119 % TODO: we did not define permutation types |
1113 From this definition we can easily show that the raw datatypes are |
1120 %\noindent |
1114 all permutation types (Def ??) by a simple structural induction over |
1121 %From this definition we can easily show that the raw datatypes are |
1115 the @{text "ty_raw"}s. |
1122 %all permutation types (Def ??) by a simple structural induction over |
|
1123 %the @{text "ty"}s. |
1116 |
1124 |
1117 The first non-trivial step we have to perform is the generation free-variable |
1125 The first non-trivial step we have to perform is the generation free-variable |
1118 functions from the specifications. Given types @{text "ty\<^isub>1, \<dots>, ty\<^isub>n"} |
1126 functions from the specifications. Given types @{text "ty\<^isub>1, \<dots>, ty\<^isub>n"} |
1119 we need to define the free-variable functions |
1127 we need to define the free-variable functions |
1120 |
1128 |
1134 \noindent |
1142 \noindent |
1135 The basic idea behind these free-variable functions is to collect all atoms |
1143 The basic idea behind these free-variable functions is to collect all atoms |
1136 that are not bound in a term constructor, but because of the rather |
1144 that are not bound in a term constructor, but because of the rather |
1137 complicated binding mechanisms the details are somewhat involved. |
1145 complicated binding mechanisms the details are somewhat involved. |
1138 |
1146 |
1139 Given a term-constructor @{text "C_raw ty\<^isub>1 \<dots> ty\<^isub>n"}, of type @{text ty} together with |
1147 Given a term-constructor @{text "C ty\<^isub>1 \<dots> ty\<^isub>n"}, of type @{text ty} together with |
1140 some binding clauses, the function @{text "fv_ty (C_raw x\<^isub>1 \<dots> x\<^isub>n)"} will be |
1148 some binding clauses, the function @{text "fv_ty (C x\<^isub>1 \<dots> x\<^isub>n)"} will be |
1141 the union of the values defined below for each argument, say @{text "x\<^isub>i"} with type @{text "ty\<^isub>i"}. |
1149 the union of the values defined below for each argument, say @{text "x\<^isub>i"} with type @{text "ty\<^isub>i"}. |
1142 From the binding clause of this term constructor, we can determine whether the |
1150 From the binding clause of this term constructor, we can determine whether the |
1143 argument @{text "x\<^isub>i"} is a shallow or deep binder, and in the latter case also |
1151 argument @{text "x\<^isub>i"} is a shallow or deep binder, and in the latter case also |
1144 whether it is a recursive or non-recursive of a binder. In these cases the value is: |
1152 whether it is a recursive or non-recursive of a binder. In these cases the value is: |
1145 |
1153 |
1182 function is to compute all the free atoms under this binding |
1190 function is to compute all the free atoms under this binding |
1183 function. So given that @{text "bn"} is a binding function for type |
1191 function. So given that @{text "bn"} is a binding function for type |
1184 @{text "ty\<^isub>i"} it will be the same as @{text "fv_ty\<^isub>i"} with the |
1192 @{text "ty\<^isub>i"} it will be the same as @{text "fv_ty\<^isub>i"} with the |
1185 omission of the arguments present in @{text "bn"}. |
1193 omission of the arguments present in @{text "bn"}. |
1186 |
1194 |
1187 For a binding function clause @{text "bn (C_raw x\<^isub>1 \<dots> x\<^isub>n) = rhs"}, |
1195 For a binding function clause @{text "bn (C x\<^isub>1 \<dots> x\<^isub>n) = rhs"}, |
1188 we define @{text "fv_bn"} to be the union of the values calculated |
1196 we define @{text "fv_bn"} to be the union of the values calculated |
1189 for @{text "x\<^isub>j"} as follows: |
1197 for @{text "x\<^isub>j"} as follows: |
1190 |
1198 |
1191 \begin{center} |
1199 \begin{center} |
1192 \begin{tabular}{cp{7cm}} |
1200 \begin{tabular}{cp{7cm}} |
1217 functions for types @{text "bn\<^isub>1 :: ty\<^isub>i\<^isub>1 \<Rightarrow> \<dots> \<dots> bn\<^isub>m :: ty\<^isub>i\<^isub>m \<Rightarrow> \<dots>"} we need to define |
1225 functions for types @{text "bn\<^isub>1 :: ty\<^isub>i\<^isub>1 \<Rightarrow> \<dots> \<dots> bn\<^isub>m :: ty\<^isub>i\<^isub>m \<Rightarrow> \<dots>"} we need to define |
1218 \begin{center} |
1226 \begin{center} |
1219 @{text "\<approx>bn\<^isub>1 :: ty\<^isub>i\<^isub>1 \<Rightarrow> ty\<^isub>i\<^isub>1 \<Rightarrow> bool \<dots> \<approx>bn\<^isub>n :: ty\<^isub>i\<^isub>m \<Rightarrow> ty\<^isub>i\<^isub>m \<Rightarrow> bool"} |
1227 @{text "\<approx>bn\<^isub>1 :: ty\<^isub>i\<^isub>1 \<Rightarrow> ty\<^isub>i\<^isub>1 \<Rightarrow> bool \<dots> \<approx>bn\<^isub>n :: ty\<^isub>i\<^isub>m \<Rightarrow> ty\<^isub>i\<^isub>m \<Rightarrow> bool"} |
1220 \end{center} |
1228 \end{center} |
1221 |
1229 |
1222 Given a term-constructor @{text "C_raw ty\<^isub>1 \<dots> ty\<^isub>n"}, of a type @{text ty}, two instances |
1230 Given a term-constructor @{text "C ty\<^isub>1 \<dots> ty\<^isub>n"}, of a type @{text ty}, two instances |
1223 of this constructor are alpha-equivalent @{text "C_raw x\<^isub>1 \<dots> x\<^isub>n \<approx> C_raw y\<^isub>1 \<dots> y\<^isub>n"} if there |
1231 of this constructor are alpha-equivalent @{text "C x\<^isub>1 \<dots> x\<^isub>n \<approx> C y\<^isub>1 \<dots> y\<^isub>n"} if there |
1224 exist permutations @{text "\<pi>\<^isub>1 \<dots> \<pi>\<^isub>p"} (one for each bound argument) such that |
1232 exist permutations @{text "\<pi>\<^isub>1 \<dots> \<pi>\<^isub>p"} (one for each bound argument) such that |
1225 the conjunction of equivalences defined below for each argument pair @{text "x\<^isub>j"}, @{text "y\<^isub>j"} holds. |
1233 the conjunction of equivalences defined below for each argument pair @{text "x\<^isub>j"}, @{text "y\<^isub>j"} holds. |
1226 For an argument pair @{text "x\<^isub>j"}, @{text "y\<^isub>j"} this holds if: |
1234 For an argument pair @{text "x\<^isub>j"}, @{text "y\<^isub>j"} this holds if: |
1227 |
1235 |
1228 \begin{center} |
1236 \begin{center} |
1252 |
1260 |
1253 The alpha-equivalence relations for binding functions are similar to the alpha-equivalences |
1261 The alpha-equivalence relations for binding functions are similar to the alpha-equivalences |
1254 for their respective types, the difference is that they ommit checking the arguments that |
1262 for their respective types, the difference is that they ommit checking the arguments that |
1255 are bound. We assumed that there are no bindings in the type on which the binding function |
1263 are bound. We assumed that there are no bindings in the type on which the binding function |
1256 is defined so, there are no permutations involved. For a binding function clause |
1264 is defined so, there are no permutations involved. For a binding function clause |
1257 @{text "bn (C_raw x\<^isub>1 \<dots> x\<^isub>n) = rhs"}, two instances of the constructor are equivalent |
1265 @{text "bn (C x\<^isub>1 \<dots> x\<^isub>n) = rhs"}, two instances of the constructor are equivalent |
1258 @{text "C_raw x\<^isub>1 \<dots> x\<^isub>n \<approx> C_raw y\<^isub>1 \<dots> y\<^isub>n"} if: |
1266 @{text "C x\<^isub>1 \<dots> x\<^isub>n \<approx> C y\<^isub>1 \<dots> y\<^isub>n"} if: |
1259 \begin{center} |
1267 \begin{center} |
1260 \begin{tabular}{cp{7cm}} |
1268 \begin{tabular}{cp{7cm}} |
1261 $\bullet$ & @{text "x\<^isub>j"} is not of a type being defined and occurs in @{text "rhs"}\\ |
1269 $\bullet$ & @{text "x\<^isub>j"} is not of a type being defined and occurs in @{text "rhs"}\\ |
1262 $\bullet$ & @{text "x\<^isub>j = y\<^isub>j"} provided @{text "x\<^isub>j"} is not of a type being defined |
1270 $\bullet$ & @{text "x\<^isub>j = y\<^isub>j"} provided @{text "x\<^isub>j"} is not of a type being defined |
1263 and does not occur in @{text "rhs"}\\ |
1271 and does not occur in @{text "rhs"}\\ |