122 where @{text z} does not occur freely in the type. In this paper we will |
122 where @{text z} does not occur freely in the type. In this paper we will |
123 give a general binding mechanism and associated notion of alpha-equivalence |
123 give a general binding mechanism and associated notion of alpha-equivalence |
124 that can be used to faithfully represent this kind of binding in Nominal |
124 that can be used to faithfully represent this kind of binding in Nominal |
125 Isabelle. The difficulty of finding the right notion for alpha-equivalence |
125 Isabelle. The difficulty of finding the right notion for alpha-equivalence |
126 can be appreciated in this case by considering that the definition given by |
126 can be appreciated in this case by considering that the definition given by |
127 Leroy in \cite[Page ???]{Leroy92} is incorrect (it omits a side-condition). |
127 Leroy in \cite[Page 18--19]{Leroy92} is incorrect (it omits a side-condition). |
128 |
128 |
129 However, the notion of alpha-equivalence that is preserved by vacuous |
129 However, the notion of alpha-equivalence that is preserved by vacuous |
130 binders is not always wanted. For example in terms like |
130 binders is not always wanted. For example in terms like |
131 |
131 |
132 \begin{equation}\label{one} |
132 \begin{equation}\label{one} |
317 task. To ease it, we re-implemented in Isabelle/HOL \cite{KaliszykUrban11} |
317 task. To ease it, we re-implemented in Isabelle/HOL \cite{KaliszykUrban11} |
318 the quotient package described by Homeier \cite{Homeier05} for the HOL4 |
318 the quotient package described by Homeier \cite{Homeier05} for the HOL4 |
319 system. This package allows us to lift definitions and theorems involving |
319 system. This package allows us to lift definitions and theorems involving |
320 raw terms to definitions and theorems involving alpha-equated terms. For |
320 raw terms to definitions and theorems involving alpha-equated terms. For |
321 example if we define the free-variable function over raw lambda-terms |
321 example if we define the free-variable function over raw lambda-terms |
|
322 as follows |
322 |
323 |
323 \[ |
324 \[ |
324 \mbox{\begin{tabular}{l@ {\hspace{1mm}}r@ {\hspace{1mm}}l} |
325 \mbox{\begin{tabular}{l@ {\hspace{1mm}}r@ {\hspace{1mm}}l} |
325 @{text "fv(x)"} & @{text "\<equiv>"} & @{text "{x}"}\\ |
326 @{text "fv(x)"} & @{text "\<equiv>"} & @{text "{x}"}\\ |
326 @{text "fv(t\<^isub>1 t\<^isub>2)"} & @{text "\<equiv>"} & @{text "fv(t\<^isub>1) \<union> fv(t\<^isub>2)"}\\ |
327 @{text "fv(t\<^isub>1 t\<^isub>2)"} & @{text "\<equiv>"} & @{text "fv(t\<^isub>1) \<union> fv(t\<^isub>2)"}\\ |
354 properties (see \cite{Homeier05}). In the paper we show that we are able to |
355 properties (see \cite{Homeier05}). In the paper we show that we are able to |
355 automate these proofs and as a result can automatically establish a reasoning |
356 automate these proofs and as a result can automatically establish a reasoning |
356 infrastructure for alpha-equated terms.\smallskip |
357 infrastructure for alpha-equated terms.\smallskip |
357 |
358 |
358 The examples we have in mind where our reasoning infrastructure will be |
359 The examples we have in mind where our reasoning infrastructure will be |
359 helpful includes the term language of Core-Haskell. This term language |
360 helpful includes the term language of Core-Haskell (see |
360 involves patterns that have lists of type-, coercion- and term-variables, |
361 Figure~\ref{corehas}). This term language involves patterns that have lists |
361 all of which are bound in @{text "\<CASE>"}-expressions. In these |
362 of type-, coercion- and term-variables, all of which are bound in @{text |
362 patterns we do not know in advance how many variables need to |
363 "\<CASE>"}-expressions. In these patterns we do not know in advance how many |
363 be bound. Another example is the specification of SML, which includes |
364 variables need to be bound. Another example is the specification of SML, |
364 includes bindings as in type-schemes.\medskip |
365 which includes includes bindings as in type-schemes.\medskip |
365 |
366 |
366 \noindent |
367 \noindent |
367 {\bf Contributions:} We provide three new definitions for when terms |
368 {\bf Contributions:} We provide three new definitions for when terms |
368 involving general binders are alpha-equivalent. These definitions are |
369 involving general binders are alpha-equivalent. These definitions are |
369 inspired by earlier work of Pitts \cite{Pitts04}. By means of automatic |
370 inspired by earlier work of Pitts \cite{Pitts04}. By means of automatic |
378 (only one is present in Ott), provide formalised definitions for alpha-equivalence and |
379 (only one is present in Ott), provide formalised definitions for alpha-equivalence and |
379 for free variables of our terms, and also derive a reasoning infrastructure |
380 for free variables of our terms, and also derive a reasoning infrastructure |
380 for our specifications from ``first principles''. |
381 for our specifications from ``first principles''. |
381 |
382 |
382 |
383 |
383 %\begin{figure} |
384 \begin{figure} |
384 %\begin{boxedminipage}{\linewidth} |
385 \begin{boxedminipage}{\linewidth} |
385 %%\begin{center} |
386 \begin{center} |
386 %\begin{tabular}{r@ {\hspace{1mm}}r@ {\hspace{2mm}}l} |
387 \begin{tabular}{@ {\hspace{8mm}}r@ {\hspace{2mm}}r@ {\hspace{2mm}}l} |
387 %\multicolumn{3}{@ {}l}{Type Kinds}\\ |
388 \multicolumn{3}{@ {}l}{Type Kinds}\\ |
388 %@{text "\<kappa>"} & @{text "::="} & @{text "\<star> | \<kappa>\<^isub>1 \<rightarrow> \<kappa>\<^isub>2"}\smallskip\\ |
389 @{text "\<kappa>"} & @{text "::="} & @{text "\<star> | \<kappa>\<^isub>1 \<rightarrow> \<kappa>\<^isub>2"}\smallskip\\ |
389 %\multicolumn{3}{@ {}l}{Coercion Kinds}\\ |
390 \multicolumn{3}{@ {}l}{Coercion Kinds}\\ |
390 %@{text "\<iota>"} & @{text "::="} & @{text "\<sigma>\<^isub>1 \<sim> \<sigma>\<^isub>2"}\smallskip\\ |
391 @{text "\<iota>"} & @{text "::="} & @{text "\<sigma>\<^isub>1 \<sim> \<sigma>\<^isub>2"}\smallskip\\ |
391 %\multicolumn{3}{@ {}l}{Types}\\ |
392 \multicolumn{3}{@ {}l}{Types}\\ |
392 %@{text "\<sigma>"} & @{text "::="} & @{text "a | T | \<sigma>\<^isub>1 \<sigma>\<^isub>2 | S\<^isub>n"}$\;\overline{@{text "\<sigma>"}}$@{text "\<^sup>n"} |
393 @{text "\<sigma>"} & @{text "::="} & @{text "a | T | \<sigma>\<^isub>1 \<sigma>\<^isub>2 | S\<^isub>n"}$\;\overline{@{text "\<sigma>"}}$@{text "\<^sup>n"} |
393 %@{text "| \<forall>a:\<kappa>. \<sigma> | \<iota> \<Rightarrow> \<sigma>"}\smallskip\\ |
394 @{text "| \<forall>a:\<kappa>. \<sigma> | \<iota> \<Rightarrow> \<sigma>"}\smallskip\\ |
394 %\multicolumn{3}{@ {}l}{Coercion Types}\\ |
395 \multicolumn{3}{@ {}l}{Coercion Types}\\ |
395 %@{text "\<gamma>"} & @{text "::="} & @{text "c | C | \<gamma>\<^isub>1 \<gamma>\<^isub>2 | S\<^isub>n"}$\;\overline{@{text "\<gamma>"}}$@{text "\<^sup>n"} |
396 @{text "\<gamma>"} & @{text "::="} & @{text "c | C | \<gamma>\<^isub>1 \<gamma>\<^isub>2 | S\<^isub>n"}$\;\overline{@{text "\<gamma>"}}$@{text "\<^sup>n"} |
396 %@{text "| \<forall>c:\<iota>. \<gamma> | \<iota> \<Rightarrow> \<gamma> "}\\ |
397 @{text "| \<forall>c:\<iota>. \<gamma> | \<iota> \<Rightarrow> \<gamma> | refl \<sigma> | sym \<gamma> | \<gamma>\<^isub>1 \<circ> \<gamma>\<^isub>2"}\\ |
397 %& @{text "|"} & @{text "refl \<sigma> | sym \<gamma> | \<gamma>\<^isub>1 \<circ> \<gamma>\<^isub>2 | \<gamma> @ \<sigma> | left \<gamma> | right \<gamma>"}\\ |
398 & @{text "|"} & @{text "\<gamma> @ \<sigma> | left \<gamma> | right \<gamma> | \<gamma>\<^isub>1 \<sim> \<gamma>\<^isub>2 | rightc \<gamma> | leftc \<gamma> | \<gamma>\<^isub>1 \<triangleright> \<gamma>\<^isub>2"}\smallskip\\ |
398 %& @{text "|"} & @{text "\<gamma>\<^isub>1 \<sim> \<gamma>\<^isub>2 | rightc \<gamma> | leftc \<gamma> | \<gamma>\<^isub>1 \<triangleright> \<gamma>\<^isub>2"}\smallskip\\ |
399 \multicolumn{3}{@ {}l}{Terms}\\ |
399 %\multicolumn{3}{@ {}l}{Terms}\\ |
400 @{text "e"} & @{text "::="} & @{text "x | K | \<Lambda>a:\<kappa>. e | \<Lambda>c:\<iota>. e | e \<sigma> | e \<gamma> | \<lambda>x:\<sigma>. e | e\<^isub>1 e\<^isub>2"}\\ |
400 %@{text "e"} & @{text "::="} & @{text "x | K | \<Lambda>a:\<kappa>. e | \<Lambda>c:\<iota>. e | e \<sigma> | e \<gamma>"}\\ |
401 & @{text "|"} & @{text "\<LET> x:\<sigma> = e\<^isub>1 \<IN> e\<^isub>2 | \<CASE> e\<^isub>1 \<OF>"}$\;\overline{@{text "p \<rightarrow> e\<^isub>2"}}$ @{text "| e \<triangleright> \<gamma>"}\smallskip\\ |
401 %& @{text "|"} & @{text "\<lambda>x:\<sigma>. e | e\<^isub>1 e\<^isub>2 | \<LET> x:\<sigma> = e\<^isub>1 \<IN> e\<^isub>2"}\\ |
402 \multicolumn{3}{@ {}l}{Patterns}\\ |
402 %& @{text "|"} & @{text "\<CASE> e\<^isub>1 \<OF>"}$\;\overline{@{text "p \<rightarrow> e\<^isub>2"}}$ @{text "| e \<triangleright> \<gamma>"}\smallskip\\ |
403 @{text "p"} & @{text "::="} & @{text "K"}$\;\overline{@{text "a:\<kappa>"}}\;\overline{@{text "c:\<iota>"}}\;\overline{@{text "x:\<sigma>"}}$\smallskip\\ |
403 %\multicolumn{3}{@ {}l}{Patterns}\\ |
404 \multicolumn{3}{@ {}l}{Constants}\\ |
404 %@{text "p"} & @{text "::="} & @{text "K"}$\;\overline{@{text "a:\<kappa>"}}\;\overline{@{text "c:\<iota>"}}\;\overline{@{text "x:\<sigma>"}}$\smallskip\\ |
405 & @{text C} & coercion constants\\ |
405 %\multicolumn{3}{@ {}l}{Constants}\\ |
406 & @{text T} & value type constructors\\ |
406 %& @{text C} & coercion constants\\ |
407 & @{text "S\<^isub>n"} & n-ary type functions (which need to be fully applied)\\ |
407 %& @{text T} & value type constructors\\ |
408 & @{text K} & data constructors\smallskip\\ |
408 %& @{text "S\<^isub>n"} & n-ary type functions (which need to be fully applied)\\ |
409 \multicolumn{3}{@ {}l}{Variables}\\ |
409 %& @{text K} & data constructors\smallskip\\ |
410 & @{text a} & type variables\\ |
410 %\multicolumn{3}{@ {}l}{Variables}\\ |
411 & @{text c} & coercion variables\\ |
411 %& @{text a} & type variables\\ |
412 & @{text x} & term variables\\ |
412 %& @{text c} & coercion variables\\ |
413 \end{tabular} |
413 %& @{text x} & term variables\\ |
414 \end{center} |
414 %\end{tabular} |
415 \end{boxedminipage} |
415 %\end{center} |
416 \caption{The System @{text "F\<^isub>C"} |
416 %\end{boxedminipage} |
417 \cite{CoreHaskell}, also often referred to as \emph{Core-Haskell}. In this |
417 %\caption{The System @{text "F\<^isub>C"} |
418 version of @{text "F\<^isub>C"} we made a modification by separating the |
418 %\cite{CoreHaskell}, also often referred to as \emph{Core-Haskell}. In this |
419 grammars for type kinds and coercion kinds, as well as for types and coercion |
419 %version of @{text "F\<^isub>C"} we made a modification by separating the |
420 types. For this paper the interesting term-constructor is @{text "\<CASE>"}, |
420 %grammars for type kinds and coercion kinds, as well as for types and coercion |
421 which binds multiple type-, coercion- and term-variables.\label{corehas}} |
421 %types. For this paper the interesting term-constructor is @{text "\<CASE>"}, |
422 \end{figure} |
422 %which binds multiple type-, coercion- and term-variables.\label{corehas}} |
|
423 %\end{figure} |
|
424 *} |
423 *} |
425 |
424 |
426 section {* A Short Review of the Nominal Logic Work *} |
425 section {* A Short Review of the Nominal Logic Work *} |
427 |
426 |
428 text {* |
427 text {* |