1087 \noindent |
1087 \noindent |
1088 Otherwise it is possible that @{text "bn\<^isub>1"} and @{text "bn\<^isub>2"} pick |
1088 Otherwise it is possible that @{text "bn\<^isub>1"} and @{text "bn\<^isub>2"} pick |
1089 out different atoms to become bound, respectively be free, in @{text "p"}. |
1089 out different atoms to become bound, respectively be free, in @{text "p"}. |
1090 |
1090 |
1091 We also need to restrict the form of the binding functions in order |
1091 We also need to restrict the form of the binding functions in order |
1092 to ensure the @{text "bn"}-functions can be lifted defined for $\alpha$-equated |
1092 to ensure the @{text "bn"}-functions can be defined for $\alpha$-equated |
1093 terms. As a result we cannot return an atom in a binding function that is also |
1093 terms. As a result we cannot return an atom in a binding function that is also |
1094 bound in the corresponding term-constructor. That means in the example |
1094 bound in the corresponding term-constructor. That means in the example |
1095 \eqref{letpat} that the term-constructors @{text PVar} and @{text PTup} may |
1095 \eqref{letpat} that the term-constructors @{text PVar} and @{text PTup} may |
1096 not have a binding clause (all arguments are used to define @{text "bn"}). |
1096 not have a binding clause (all arguments are used to define @{text "bn"}). |
1097 In contrast, in case of \eqref{letrecs} the term-constructor @{text ACons} |
1097 In contrast, in case of \eqref{letrecs} the term-constructor @{text ACons} |
1098 may have a binding clause involving the argument @{text t} (the only one that |
1098 may have a binding clause involving the argument @{text t} (the only one that |
1099 is \emph{not} used in the definition of the binding function). This restriction |
1099 is \emph{not} used in the definition of the binding function). This restriction |
1100 means that we can lift the binding function to $\alpha$-equated terms. |
1100 is sufficient for defining the binding function over $\alpha$-equated terms. |
1101 |
1101 |
1102 In the version of |
1102 In the version of |
1103 Nominal Isabelle described here, we also adopted the restriction from the |
1103 Nominal Isabelle described here, we also adopted the restriction from the |
1104 Ott-tool that binding functions can only return: the empty set or empty list |
1104 Ott-tool that binding functions can only return: the empty set or empty list |
1105 (as in case @{text PNil}), a singleton set or singleton list containing an |
1105 (as in case @{text PNil}), a singleton set or singleton list containing an |
1169 non-empty and the types in the constructors only occur in positive |
1169 non-empty and the types in the constructors only occur in positive |
1170 position (see \cite{Berghofer99} for an indepth description of the datatype package |
1170 position (see \cite{Berghofer99} for an indepth description of the datatype package |
1171 in Isabelle/HOL). We then define the user-specified binding |
1171 in Isabelle/HOL). We then define the user-specified binding |
1172 functions @{term "bn"} by recursion over the corresponding |
1172 functions @{term "bn"} by recursion over the corresponding |
1173 raw datatype. We can also easily define permutation operations by |
1173 raw datatype. We can also easily define permutation operations by |
1174 recursion so that for each term constructor @{text "C"} with |
1174 recursion so that for each term constructor @{text "C"} we have that |
1175 arguments @{text "z"}$_{1..n}$ we have that |
|
1176 % |
1175 % |
1177 \begin{equation}\label{ceqvt} |
1176 \begin{equation}\label{ceqvt} |
1178 @{text "p \<bullet> (C z\<^isub>1 \<dots> z\<^isub>n) = C (p \<bullet> z\<^isub>1) \<dots> (p \<bullet> z\<^isub>n)"} |
1177 @{text "p \<bullet> (C z\<^isub>1 \<dots> z\<^isub>n) = C (p \<bullet> z\<^isub>1) \<dots> (p \<bullet> z\<^isub>n)"} |
1179 \end{equation} |
1178 \end{equation} |
1180 |
1179 |
1181 The first non-trivial step we have to perform is the generation of |
1180 The first non-trivial step we have to perform is the generation of |
1182 free-variable functions from the specifications. For the |
1181 free-variable functions from the specifications. For the |
1183 \emph{raw} types @{text "ty"}$_{1..n}$ of a specification, |
1182 \emph{raw} types @{text "ty"}$_{1..n}$ extracted from a specification, |
1184 we define the free-variable functions |
1183 we define the free-variable functions |
1185 % |
1184 % |
1186 \begin{equation}\label{fvars} |
1185 \begin{equation}\label{fvars} |
1187 @{text "fv_ty\<^isub>1, \<dots>, fv_ty\<^isub>n"} |
1186 @{text "fv_ty\<^isub>1, \<dots>, fv_ty\<^isub>n"} |
1188 \end{equation} |
1187 \end{equation} |
1189 |
1188 |
1190 \noindent |
1189 \noindent |
1191 We define them together with auxiliary free-variable functions for |
1190 by recursion over the types @{text "ty"}$_{1..n}$. |
|
1191 We define these functions together with auxiliary free-variable functions for |
1192 the binding functions. Given raw binding functions @{text "bn"}$_{1..m}$ |
1192 the binding functions. Given raw binding functions @{text "bn"}$_{1..m}$ |
1193 we define |
1193 we define |
1194 % |
1194 % |
1195 \begin{center} |
1195 \begin{center} |
1196 @{text "fv_bn\<^isub>1, \<dots>, fv_bn\<^isub>m"} |
1196 @{text "fv_bn\<^isub>1, \<dots>, fv_bn\<^isub>m"} |
1201 bound, as we saw in the example with ``plain'' @{text Let}s. We need therefore a function |
1201 bound, as we saw in the example with ``plain'' @{text Let}s. We need therefore a function |
1202 that calculates those unbound atoms in a deep binder. |
1202 that calculates those unbound atoms in a deep binder. |
1203 |
1203 |
1204 While the idea behind these free-variable functions is clear (they just |
1204 While the idea behind these free-variable functions is clear (they just |
1205 collect all atoms that are not bound), because of our rather complicated |
1205 collect all atoms that are not bound), because of our rather complicated |
1206 binding mechanisms their definitions are somewhat involved. The functions |
1206 binding mechanisms their definitions are somewhat involved. Given |
1207 are defined by recursion defining a clause for each term-constructor. Given |
|
1208 the term-constructor @{text "C"} of type @{text ty} and some associated |
1207 the term-constructor @{text "C"} of type @{text ty} and some associated |
1209 binding clauses @{text "bc\<^isub>1\<dots>bc\<^isub>k"}, the result of @{text |
1208 binding clauses @{text "bc\<^isub>1\<dots>bc\<^isub>k"}, the result of @{text |
1210 "fv_ty (C z\<^isub>1 \<dots> z\<^isub>n)"} will be the union @{text |
1209 "fv_ty (C z\<^isub>1 \<dots> z\<^isub>n)"} will be the union @{text |
1211 "fv(bc\<^isub>1) \<union> \<dots> \<union> fv(bc\<^isub>k)"}. Given the binding clause @{text |
1210 "fv(bc\<^isub>1) \<union> \<dots> \<union> fv(bc\<^isub>k)"} where we define below what @{text "fv"} of a binding |
1212 bc\<^isub>i} is of the form |
1211 clause with mode \isacommand{bin\_set} means (similarly for the other modes). |
|
1212 Suppose the binding clause @{text bc\<^isub>i} is of the form |
1213 % |
1213 % |
1214 \begin{equation} |
1214 \begin{equation} |
1215 \mbox{\isacommand{bind\_set} @{text "b\<^isub>1\<dots>b\<^isub>p"} \isacommand{in} @{text "d\<^isub>1\<dots>d\<^isub>q"}} |
1215 \mbox{\isacommand{bind\_set} @{text "b\<^isub>1\<dots>b\<^isub>p"} \isacommand{in} @{text "d\<^isub>1\<dots>d\<^isub>q"}} |
1216 \end{equation} |
1216 \end{equation} |
1217 |
1217 |
1218 \noindent |
1218 \noindent |
1219 in which the body-labels @{text "d"}$_{1..q}$ refer to types @{text ty}$_{1..q}$, |
1219 in which the body-labels @{text "d"}$_{1..q}$ refer to types @{text ty}$_{1..q}$, |
1220 and the binders @{text b}$_{1..p}$ |
1220 and the binders @{text b}$_{1..p}$ |
1221 either refer to labels of atom types (in case of shallow binders) or to binding |
1221 either refer to labels of atom types (in case of shallow binders) or to binding |
1222 functions taking a single label as argument (in case of deep binders). Assuming the |
1222 functions taking a single label as argument (in case of deep binders). Assuming the |
1223 set @{text "D"} stands for the free atoms in the bodies, @{text B} for the |
1223 set @{text "D"} stands for the free atoms in the bodies, the set @{text B} for the |
1224 binding atoms in the binders and @{text "B'"} for the free atoms in |
1224 binding atoms in the binders and @{text "B'"} for the free atoms in |
1225 non-recursive deep binders, |
1225 non-recursive deep binders, |
1226 then the free atoms of the binding clause @{text bc\<^isub>i} are given by |
1226 then the free atoms of the binding clause @{text bc\<^isub>i} are given by |
1227 % |
1227 % |
1228 \begin{center} |
1228 \begin{center} |
1229 @{text "fv(bc\<^isub>i) \<equiv> (D - B) \<union> B'"} |
1229 @{text "fv(bc\<^isub>i) \<equiv> (D - B) \<union> B'"} |
1230 \end{center} |
1230 \end{center} |
1231 |
1231 |
1232 \noindent |
1232 \noindent |
1233 The set @{text D} is defined as |
1233 The set @{text D} is formally defined as |
1234 % |
1234 % |
1235 \begin{center} |
1235 \begin{center} |
1236 @{text "D \<equiv> fv_ty\<^isub>1 d\<^isub>1 \<union> ... \<union> fv_ty\<^isub>q d\<^isub>q"} |
1236 @{text "D \<equiv> fv_ty\<^isub>1 d\<^isub>1 \<union> ... \<union> fv_ty\<^isub>q d\<^isub>q"} |
1237 \end{center} |
1237 \end{center} |
1238 |
1238 |
1239 \noindent |
1239 \noindent |
1240 whereby the functions @{text "fv_ty\<^isub>i"} are the ones we are defining by recursion |
1240 whereby the functions @{text "fv_ty\<^isub>i"} are the ones we are defining by recursion |
1241 (see \eqref{fvars}) provided the @{text "d\<^isub>i"} refers to one of the types |
1241 (see \eqref{fvars}) provided the @{text "d\<^isub>i"} refers to one of the raw types |
1242 @{text "ty"}$_{1..n}$; otherwise we set @{text "fv_ty\<^isub>i d\<^isub>i = supp d\<^isub>i"}. |
1242 @{text "ty"}$_{1..n}$ from a specification; otherwise we set @{text "fv_ty\<^isub>i d\<^isub>i = supp d\<^isub>i"}. |
1243 In order to define the set @{text B} we use the following auxiliary bn-functions |
1243 In order to define the set @{text B} we use the following auxiliary @{text "bn"}-functions |
1244 for atom types to which shallow binders have to refer |
1244 for atom types to which shallow binders have to refer |
1245 % |
1245 % |
1246 \begin{center} |
1246 \begin{center} |
1247 \begin{tabular}{r@ {\hspace{2mm}}c@ {\hspace{2mm}}l} |
1247 \begin{tabular}{r@ {\hspace{2mm}}c@ {\hspace{2mm}}l} |
1248 @{text "bn_atom a"} & @{text "="} & @{text "{atom a}"}\\ |
1248 @{text "bn_atom a"} & @{text "\<equiv>"} & @{text "{atom a}"}\\ |
1249 @{text "bn_atom_set as"} & @{text "="} & @{text "atoms as"}\\ |
1249 @{text "bn_atom_set as"} & @{text "\<equiv>"} & @{text "atoms as"}\\ |
1250 @{text "bn_atom_list as"} & @{text "="} & @{text "atoms (set as)"} |
1250 @{text "bn_atom_list as"} & @{text "\<equiv>"} & @{text "atoms (set as)"} |
1251 \end{tabular} |
1251 \end{tabular} |
1252 \end{center} |
1252 \end{center} |
1253 |
1253 |
1254 \noindent |
1254 \noindent |
1255 In these functions, @{text "atoms"}, like @{text "atom"}, coerces |
1255 The function @{text "atoms"} coerces |
1256 the set of atoms to a set of the generic atom type. It is defined as |
1256 the set of atoms to a set of the generic atom type. It is defined as |
1257 @{text "atoms as \<equiv> {atom a | a \<in> as}"}. |
1257 @{text "atoms as \<equiv> {atom a | a \<in> as}"}. |
1258 The set @{text B} is then defined as |
1258 The set @{text B} is then formally defined as |
1259 % |
1259 % |
1260 \begin{center} |
1260 \begin{center} |
1261 @{text "B \<equiv> bn_ty\<^isub>1 b\<^isub>1 \<union> ... \<union> bn_ty\<^isub>p b\<^isub>p"} |
1261 @{text "B \<equiv> bn_ty\<^isub>1 b\<^isub>1 \<union> ... \<union> bn_ty\<^isub>p b\<^isub>p"} |
1262 \end{center} |
1262 \end{center} |
1263 |
1263 |
1269 @{text "bn\<^isub>1 a\<^isub>1, \<dots>, bn\<^isub>r a\<^isub>r"} |
1269 @{text "bn\<^isub>1 a\<^isub>1, \<dots>, bn\<^isub>r a\<^isub>r"} |
1270 \end{center} |
1270 \end{center} |
1271 |
1271 |
1272 \noindent |
1272 \noindent |
1273 with none of the @{text "a"}$_{1..r}$ being among the bodies @{text |
1273 with none of the @{text "a"}$_{1..r}$ being among the bodies @{text |
1274 "d"}$_{1..q}$. The set @{text "B'"} is then defined as |
1274 "d"}$_{1..q}$. The set @{text "B'"} is defined as |
1275 % |
1275 % |
1276 \begin{center} |
1276 \begin{center} |
1277 @{text "B' \<equiv> fv_bn\<^isub>1 a\<^isub>1 \<union> ... \<union> fv_bn\<^isub>r a\<^isub>r"} |
1277 @{text "B' \<equiv> fv_bn\<^isub>1 a\<^isub>1 \<union> ... \<union> fv_bn\<^isub>r a\<^isub>r"} |
1278 \end{center} |
1278 \end{center} |
1279 |
1279 |
1280 \noindent |
1280 \noindent |
1281 Similarly for the other binding modes. |
1281 This completes the definition of the free-variable functions. |
1282 |
1282 |
1283 Note that for non-recursive deep binders, we have to add all atoms that are left |
1283 Note that for non-recursive deep binders, we have to add all atoms that are left |
1284 unbound by the binding function @{text "bn"}. This is the purpose of the functions |
1284 unbound by the binding function @{text "bn"}. This is the purpose of the functions |
1285 @{text "fv_bn"}, also defined by recursion. Assume the user has specified |
1285 @{text "fv_bn"}, also defined by recursion. Assume the user specified |
1286 a @{text bn}-clause of the form |
1286 a @{text bn}-clause of the form |
1287 % |
1287 % |
1288 \begin{center} |
1288 \begin{center} |
1289 @{text "bn (C z\<^isub>1 \<dots> z\<^isub>n) = rhs"} |
1289 @{text "bn (C z\<^isub>1 \<dots> z\<^isub>n) = rhs"} |
1290 \end{center} |
1290 \end{center} |
1291 |
1291 |
1292 \noindent |
1292 \noindent |
1293 where the @{text "z"}$_{1..n}$ are of types @{text "ty"}$_{1..n}$. For each of |
1293 where the @{text "z"}$_{1..n}$ are of types @{text "ty"}$_{1..n}$. For each of |
1294 the arguments we calculate the free atoms as follows |
1294 the arguments we calculate the free atoms as follows: |
1295 % |
1295 % |
1296 \begin{center} |
1296 \begin{center} |
1297 \begin{tabular}{c@ {\hspace{2mm}}p{7cm}} |
1297 \begin{tabular}{c@ {\hspace{2mm}}p{7cm}} |
1298 $\bullet$ & @{term "fv_ty\<^isub>i z\<^isub>i"} provided @{text "z\<^isub>i"} does not occur in @{text "rhs"}\\ |
1298 $\bullet$ & @{term "fv_ty\<^isub>i z\<^isub>i"} provided @{text "z\<^isub>i"} does not occur in @{text "rhs"} |
|
1299 (nothing gets bound in @{text "z\<^isub>i"}),\\ |
1299 $\bullet$ & @{term "fv_bn\<^isub>i z\<^isub>i"} provided @{text "z\<^isub>i"} occurs in @{text "rhs"} |
1300 $\bullet$ & @{term "fv_bn\<^isub>i z\<^isub>i"} provided @{text "z\<^isub>i"} occurs in @{text "rhs"} |
1300 with the recursive call @{text "bn\<^isub>i z\<^isub>i"}\\ |
1301 with the recursive call @{text "bn\<^isub>i z\<^isub>i"}, and\\ |
1301 $\bullet$ & @{term "{}"} provided @{text "z\<^isub>i"} occurs in @{text "rhs"}, |
1302 $\bullet$ & @{term "{}"} provided @{text "z\<^isub>i"} occurs in @{text "rhs"}, |
1302 but without a recursive call |
1303 but without a recursive call |
1303 \end{tabular} |
1304 \end{tabular} |
1304 \end{center} |
1305 \end{center} |
1305 |
1306 |
1306 \noindent |
1307 \noindent |
1307 For defining @{text "fv_bn (C z\<^isub>1 \<dots> z\<^isub>n)"}, we just union up all these values. |
1308 For defining @{text "fv_bn (C z\<^isub>1 \<dots> z\<^isub>n)"} we just union up all these values. |
1308 |
1309 |
1309 To see how these definitions work in practice, let us reconsider the term-constructors |
1310 To see how these definitions work in practice, let us reconsider the term-constructors |
1310 @{text "Let"} and @{text "Let_rec"} from the example shown in \eqref{letrecs}. |
1311 @{text "Let"} and @{text "Let_rec"}, as well as @{text "ANil"} and @{text "ACons"} |
1311 For them we consider three free-variable functions, namely |
1312 from the example shown in \eqref{letrecs}. |
1312 @{text "fv\<^bsub>trm\<^esub>"}, @{text "fv\<^bsub>assn\<^esub>"} and @{text "fv\<^bsub>bn\<^esub>"}: |
1313 For them we define three free-variable functions, namely |
|
1314 @{text "fv\<^bsub>trm\<^esub>"}, @{text "fv\<^bsub>assn\<^esub>"} and @{text "fv\<^bsub>bn\<^esub>"} as follows: |
1313 % |
1315 % |
1314 \begin{center} |
1316 \begin{center} |
1315 \begin{tabular}{@ {}l@ {\hspace{1mm}}c@ {\hspace{1mm}}l@ {}} |
1317 \begin{tabular}{@ {}l@ {\hspace{1mm}}c@ {\hspace{1mm}}l@ {}} |
1316 @{text "fv\<^bsub>trm\<^esub> (Let as t)"} & @{text "="} & @{text "(fv\<^bsub>trm\<^esub> t - set (bn as)) \<union> fv\<^bsub>bn\<^esub> as"}\\ |
1318 @{text "fv\<^bsub>trm\<^esub> (Let as t)"} & @{text "="} & @{text "(fv\<^bsub>trm\<^esub> t - set (bn as)) \<union> fv\<^bsub>bn\<^esub> as"}\\ |
1317 @{text "fv\<^bsub>trm\<^esub> (Let_rec as t)"} & @{text "="} & @{text "(fv\<^bsub>assn\<^esub> as \<union> fv\<^bsub>trm\<^esub> t) - set (bn as)"}\\[1mm] |
1319 @{text "fv\<^bsub>trm\<^esub> (Let_rec as t)"} & @{text "="} & @{text "(fv\<^bsub>assn\<^esub> as \<union> fv\<^bsub>trm\<^esub> t) - set (bn as)"}\\[1mm] |
1318 |
1320 |
1319 @{text "fv\<^bsub>assn\<^esub> (ANil)"} & @{text "="} & @{term "{}"}\\ |
1321 @{text "fv\<^bsub>assn\<^esub> (ANil)"} & @{text "="} & @{term "{}"}\\ |
1320 @{text "fv\<^bsub>assn\<^esub> (ACons a t as)"} & @{text "="} & @{text "{atom a} \<union> (fv\<^bsub>trm\<^esub> t) \<union> (fv\<^bsub>assn\<^esub> as)"}\\[1mm] |
1322 @{text "fv\<^bsub>assn\<^esub> (ACons a t as)"} & @{text "="} & @{text "(supp a) \<union> (fv\<^bsub>trm\<^esub> t) \<union> (fv\<^bsub>assn\<^esub> as)"}\\[1mm] |
1321 |
1323 |
1322 @{text "fv\<^bsub>bn\<^esub> (ANil)"} & @{text "="} & @{term "{}"}\\ |
1324 @{text "fv\<^bsub>bn\<^esub> (ANil)"} & @{text "="} & @{term "{}"}\\ |
1323 @{text "fv\<^bsub>bn\<^esub> (ACons a t as)"} & @{text "="} & @{text "(fv\<^bsub>trm\<^esub> t) \<union> (fv\<^bsub>bn\<^esub> as)"} |
1325 @{text "fv\<^bsub>bn\<^esub> (ACons a t as)"} & @{text "="} & @{text "(fv\<^bsub>trm\<^esub> t) \<union> (fv\<^bsub>bn\<^esub> as)"} |
1324 \end{tabular} |
1326 \end{tabular} |
1325 \end{center} |
1327 \end{center} |
1326 |
1328 |
1327 \noindent |
1329 \noindent |
1328 Since there are only (implicit) empty binding clauses for the term-constructors @{text ANil} |
1330 To see the ``pattern'', recall that @{text ANil} and @{text "ACons"} have no |
1329 and @{text "ACons"}, the corresponding free-variable function @{text |
1331 binding clause in the specification. The corresponding free-variable |
1330 "fv\<^bsub>assn\<^esub>"} returns all atoms occurring in an assignment. The |
1332 function @{text "fv\<^bsub>assn\<^esub>"} therefore returns all atoms |
1331 binding only takes place in @{text Let} and @{text "Let_rec"}. In the @{text |
1333 occurring in an assignment. The binding only takes place in @{text Let} and |
1332 "Let"}-clause we want to bind all atoms given by @{text "set (bn as)"} in |
1334 @{text "Let_rec"}. In the @{text "Let"}-clause, the binding clause specifies |
1333 @{text t}. Therefore we have to subtract @{text "set (bn as)"} from @{text |
1335 that all atoms given by @{text "set (bn as)"} have to be bound in @{text |
|
1336 t}. Therefore we have to subtract @{text "set (bn as)"} from @{text |
1334 "fv\<^bsub>trm\<^esub> t"}. However, we also need to add all atoms that are |
1337 "fv\<^bsub>trm\<^esub> t"}. However, we also need to add all atoms that are |
1335 free in @{text "as"}. This is what the purpose of the function @{text |
1338 free in @{text "as"}. In contrast, in @{text "Let_rec"} we have a recursive |
1336 "fv\<^bsub>bn\<^esub>"} is. In contrast, in @{text "Let_rec"} we have a |
1339 binder where we want to also bind all occurrences of the atoms in @{text |
1337 recursive binder where we want to also bind all occurrences of the atoms |
1340 "set (bn as)"} also inside @{text "as"}. Therefore we have to subtract |
1338 in @{text "set (bn as)"} inside @{text "as"}. Therefore we have to subtract @{text |
1341 @{text "set (bn as)"} from the union @{text "fv\<^bsub>trm\<^esub> t"} and @{text "fv\<^bsub>assn\<^esub> as"}. |
1339 "set (bn as)"} from @{text "fv\<^bsub>trm\<^esub> t"}, as well as from |
1342 |
1340 @{text "fv\<^bsub>assn\<^esub> as"}. An interesting point in this example is |
1343 An interesting point in this |
1341 that an assignment ``alone'' does not have any bound variables. Only in the |
1344 example is that a ``naked'' assignment does not bind any |
1342 context of a @{text Let} or @{text "Let_rec"} will some atoms become bound. |
1345 atoms. Only in the context of a @{text Let} or @{text "Let_rec"} will |
1343 This is a phenomenon |
1346 some atoms from an assignment become bound. This is a phenomenon that has also been pointed |
1344 that has also been pointed out in \cite{ott-jfp}. For us it is crucial, because |
1347 out in \cite{ott-jfp}. For us this observation is crucial, because we would |
1345 we would not be able to lift a @{text "bn"}-function that is defined over |
1348 not be able to lift the @{text "bn"}-function if it was defined over assignments |
1346 arguments that are either binders or bodies. In that case @{text "bn"} would |
1349 where some atoms are bound. In that case @{text "bn"} would \emph{not} respect |
1347 not respect $\alpha$-equivalence. We can also see that |
1350 $\alpha$-equivalence. |
1348 % |
1351 |
1349 \begin{equation}\label{bnprop} |
1352 Next we define $\alpha$-equivalence relations for the raw types @{text |
1350 @{text "fv_ty x = bn x \<union> fv_bn x"}. |
1353 "ty"}$_{1..n}$. We call them |
1351 \end{equation} |
1354 % |
1352 |
1355 \begin{center} |
1353 \noindent |
1356 @{text "\<approx>ty\<^isub>1, \<dots>, \<approx>ty\<^isub>n"}. |
1354 holds for any @{text "bn"}-function defined for the type @{text "ty"}. |
1357 \end{center} |
1355 |
1358 |
1356 TBD below. |
1359 \noindent |
1357 |
1360 Like with the free-variable functions, we also need to |
1358 Next we define $\alpha$-equivalence relations for the types @{text "ty\<^isub>1, \<dots>, ty\<^isub>n"}. We call them |
1361 define auxiliary $\alpha$-equivalence relations |
1359 @{text "\<approx>ty\<^isub>1, \<dots>, \<approx>ty\<^isub>n"}. Like with the free-variable functions, |
1362 % |
1360 we also need to define auxiliary $\alpha$-equivalence relations for the binding functions. |
1363 \begin{center} |
1361 Say we have binding functions @{text "bn\<^isub>1, \<dots>, bn\<^isub>m"}, then we also define @{text "\<approx>bn\<^isub>1, \<dots>, \<approx>bn\<^isub>m"}. |
1364 @{text "\<approx>bn\<^isub>1, \<dots>, \<approx>bn\<^isub>m"} |
1362 To simplify our definitions we will use the following abbreviations for |
1365 \end{center} |
1363 relations and free-variable acting on products. |
1366 |
|
1367 \noindent |
|
1368 for the binding functions @{text "bn"}$_{1..m}$, |
|
1369 To simplify our definitions we will use the following abbreviations for |
|
1370 equivalence relations and free-variable functions acting on pairs |
|
1371 |
1364 % |
1372 % |
1365 \begin{center} |
1373 \begin{center} |
1366 \begin{tabular}{r@ {\hspace{2mm}}c@ {\hspace{2mm}}l} |
1374 \begin{tabular}{r@ {\hspace{2mm}}c@ {\hspace{2mm}}l} |
1367 @{text "(x\<^isub>1, y\<^isub>1) (R\<^isub>1 \<otimes> R\<^isub>2) (x\<^isub>2, y\<^isub>2)"} & @{text "\<equiv>"} & @{text "x\<^isub>1 R\<^isub>1 y\<^isub>1 \<and> x\<^isub>2 R\<^isub>2 y\<^isub>2"}\\ |
1375 @{text "(x\<^isub>1, y\<^isub>1) (R\<^isub>1 \<otimes> R\<^isub>2) (x\<^isub>2, y\<^isub>2)"} & @{text "\<equiv>"} & @{text "x\<^isub>1 R\<^isub>1 y\<^isub>1 \<and> x\<^isub>2 R\<^isub>2 y\<^isub>2"}\\ |
1368 @{text "(fv\<^isub>1 \<oplus> fv\<^isub>2) (x, y)"} & @{text "\<equiv>"} & @{text "fv\<^isub>1 x \<union> fv\<^isub>2 y"}\\ |
1376 @{text "(fv\<^isub>1 \<oplus> fv\<^isub>2) (x, y)"} & @{text "\<equiv>"} & @{text "fv\<^isub>1 x \<union> fv\<^isub>2 y"}\\ |
1369 \end{tabular} |
1377 \end{tabular} |
1370 \end{center} |
1378 \end{center} |
1371 |
1379 |
1372 |
1380 |
1373 The relations for $\alpha$-equivalence are inductively defined predicates, whose clauses have |
1381 The relations for $\alpha$-equivalence are inductively defined |
1374 conclusions of the form |
1382 predicates, whose clauses have the form |
1375 % |
1383 % |
1376 \begin{center} |
1384 \begin{center} |
1377 \mbox{\infer{@{text "C x\<^isub>1 \<dots> x\<^isub>n \<approx>ty C y\<^isub>1 \<dots> y\<^isub>n"}} |
1385 \mbox{\infer{@{text "C z\<^isub>1 \<dots> z\<^isub>n \<approx>ty C z\<PRIME>\<^isub>1 \<dots> z\<PRIME>\<^isub>n"}} |
1378 {@{text "prems(bc\<^isub>1)"} & @{text "\<dots>"} & @{text "prems(bc\<^isub>p)"}}} |
1386 {@{text "prems(bc\<^isub>1) \<and> \<dots> \<and> prems(bc\<^isub>k)"}}} |
1379 \end{center} |
1387 \end{center} |
1380 |
1388 |
1381 \noindent |
1389 \noindent |
1382 For what follows, let us assume @{text C} is of type @{text ty}. The task |
1390 assuming the term-constructor @{text C} is of type @{text ty} and has |
|
1391 the binding clauses @{term "bc"}$_{1..k}$. The task |
1383 is to specify what the premises of these clauses are. Again for this we |
1392 is to specify what the premises of these clauses are. Again for this we |
1384 analyse the binding clauses and produce a corresponding premise. |
1393 analyse the binding clauses and produce a corresponding premise. |
1385 *} |
1394 *} |
1386 (*<*) |
1395 (*<*) |
1387 consts alpha_ty ::'a |
1396 consts alpha_ty ::'a |