39 \begin{center} |
39 \begin{center} |
40 @{text "t ::= x | t t | \<lambda>x. t"} |
40 @{text "t ::= x | t t | \<lambda>x. t"} |
41 \end{center} |
41 \end{center} |
42 |
42 |
43 \noindent |
43 \noindent |
44 where free and bound variables have names. For such terms Nominal Isabelle |
44 where free and bound variables have names. For such alpha-equated terms, Nominal Isabelle |
45 derives automatically a reasoning infrastructure that has been used |
45 derives automatically a reasoning infrastructure that has been used |
46 successfully in formalisations of an equivalence checking algorithm for LF |
46 successfully in formalisations of an equivalence checking algorithm for LF |
47 \cite{UrbanCheneyBerghofer08}, Typed |
47 \cite{UrbanCheneyBerghofer08}, Typed |
48 Scheme~\cite{TobinHochstadtFelleisen08}, several calculi for concurrency |
48 Scheme~\cite{TobinHochstadtFelleisen08}, several calculi for concurrency |
49 \cite{BengtsonParrow07,BengtsonParow09} and a strong normalisation result |
49 \cite{BengtsonParrow07,BengtsonParow09} and a strong normalisation result |
50 for cut-elimination in classical logic \cite{UrbanZhu08}. It has also been |
50 for cut-elimination in classical logic \cite{UrbanZhu08}. It has also been |
51 used by Pollack for formalisations in the locally-nameless approach to |
51 used by Pollack for formalisations in the locally-nameless approach to |
52 binding \cite{SatoPollack10}. |
52 binding \cite{SatoPollack10}. |
53 |
53 |
54 However, Nominal Isabelle has fared less well in a formalisation of |
54 However, Nominal Isabelle has fared less well in a formalisation of |
55 the algorithm W \cite{UrbanNipkow09}, where types and type-schemes |
55 the algorithm W \cite{UrbanNipkow09}, where types and type-schemes, |
56 are of the form |
56 respectively, are of the form |
57 % |
57 % |
58 \begin{equation}\label{tysch} |
58 \begin{equation}\label{tysch} |
59 \begin{array}{l} |
59 \begin{array}{l} |
60 @{text "T ::= x | T \<rightarrow> T"}\hspace{5mm} |
60 @{text "T ::= x | T \<rightarrow> T"}\hspace{5mm} |
61 @{text "S ::= \<forall>{x\<^isub>1,\<dots>, x\<^isub>n}. T"} |
61 @{text "S ::= \<forall>{x\<^isub>1,\<dots>, x\<^isub>n}. T"} |
236 \noindent |
237 \noindent |
237 are not just alpha-equal, but actually \emph{equal}. As a result, we can |
238 are not just alpha-equal, but actually \emph{equal}. As a result, we can |
238 only support specifications that make sense on the level of alpha-equated |
239 only support specifications that make sense on the level of alpha-equated |
239 terms (offending specifications, which for example bind a variable according |
240 terms (offending specifications, which for example bind a variable according |
240 to a variable bound somewhere else, are not excluded by Ott, but we have |
241 to a variable bound somewhere else, are not excluded by Ott, but we have |
241 to). Our insistence on reasoning with alpha-equated terms comes from the |
242 to). |
|
243 |
|
244 Our insistence on reasoning with alpha-equated terms comes from the |
242 wealth of experience we gained with the older version of Nominal Isabelle: |
245 wealth of experience we gained with the older version of Nominal Isabelle: |
243 for non-trivial properties, reasoning about alpha-equated terms is much |
246 for non-trivial properties, reasoning about alpha-equated terms is much |
244 easier than reasoning with raw terms. The fundamental reason for this is |
247 easier than reasoning with raw terms. The fundamental reason for this is |
245 that the HOL-logic underlying Nominal Isabelle allows us to replace |
248 that the HOL-logic underlying Nominal Isabelle allows us to replace |
246 ``equals-by-equals''. In contrast, replacing |
249 ``equals-by-equals''. In contrast, replacing |
323 |
326 |
324 \noindent |
327 \noindent |
325 (Note that this means also the term-constructors for variables, applications |
328 (Note that this means also the term-constructors for variables, applications |
326 and lambda are lifted to the quotient level.) This construction, of course, |
329 and lambda are lifted to the quotient level.) This construction, of course, |
327 only works if alpha-equivalence is indeed an equivalence relation, and the lifted |
330 only works if alpha-equivalence is indeed an equivalence relation, and the lifted |
328 definitions and theorems are respectful w.r.t.~alpha-equivalence. Accordingly, we |
331 definitions and theorems are respectful w.r.t.~alpha-equivalence. For exmple, we |
329 will not be able to lift a bound-variable function, which can be defined for |
332 will not be able to lift a bound-variable function, which can be defined for |
330 raw terms, to alpha-equated terms |
333 raw terms. The reason is that this function does not respect alpha-equivalence. |
331 (since it does not respect alpha-equivalence). To sum up, every lifting of |
334 To sum up, every lifting of |
332 theorems to the quotient level needs proofs of some respectfulness |
335 theorems to the quotient level needs proofs of some respectfulness |
333 properties. In the paper we show that we are able to automate these |
336 properties (see \cite{Homeier05}). In the paper we show that we are able to |
|
337 automate these |
334 proofs and therefore can establish a reasoning infrastructure for |
338 proofs and therefore can establish a reasoning infrastructure for |
335 alpha-equated terms. |
339 alpha-equated terms. |
336 |
340 |
337 The examples we have in mind where our reasoning infrastructure will be |
341 The examples we have in mind where our reasoning infrastructure will be |
338 immeasurably helpful is what is often referred to as Core-Haskell (see |
342 helpful is the term language of System @{text "F\<^isub>C"}, also known as |
339 Figure~\ref{corehas}). There terms include patterns which include a list of |
343 Core-Haskell (see Figure~\ref{corehas}). This term language has patterns |
|
344 which include lists of |
340 type- and term- variables (the arguments of constructors) all of which are |
345 type- and term- variables (the arguments of constructors) all of which are |
341 bound in case expressions. One difficulty is that each of these variables |
346 bound in case expressions. One difficulty is that each of these variables |
342 come with a kind or type annotation. Representing such binders with single |
347 come with a kind or type annotation. Representing such binders with single |
343 binders and reasoning about them in a theorem prover would be a major pain. |
348 binders and reasoning about them in a theorem prover would be a major pain. |
344 \medskip |
349 \medskip |
353 conditions for alpha-equated terms. We are also able to derive, at the moment |
358 conditions for alpha-equated terms. We are also able to derive, at the moment |
354 only manually, strong induction principles that |
359 only manually, strong induction principles that |
355 have the variable convention already built in. |
360 have the variable convention already built in. |
356 |
361 |
357 \begin{figure} |
362 \begin{figure} |
358 |
363 \begin{boxedminipage}{\linewidth} |
359 \caption{Core Haskell.\label{corehas}} |
364 \begin{center} |
|
365 \begin{tabular}{l} |
|
366 Type Kinds\\ |
|
367 @{text "\<kappa> ::= \<star> | \<kappa>\<^isub>1 \<rightarrow> \<kappa>\<^isub>2"}\\ |
|
368 Coercion Kinds\\ |
|
369 @{text "\<iota> ::= \<sigma>\<^isub>1 \<sim> \<sigma>\<^isub>2"}\\ |
|
370 Types\\ |
|
371 @{text "\<sigma> ::= a | T | \<sigma>\<^isub>1 \<sigma>\<^isub>2 | S\<^isub>n"}$\;\overline{@{text "\<sigma>"}}$@{text "\<^sup>n"}\\ |
|
372 @{text "| \<forall>a:\<kappa>. \<sigma> "}\\ |
|
373 ??? Type equality\\ |
|
374 Coercion Types\\ |
|
375 @{text "\<gamma> ::= a | C | S\<^isub>n"}$\;\overline{@{text "\<gamma>"}}$@{text "\<^sup>n"}\\ |
|
376 @{text "| \<forall>a:\<iota>. \<gamma>"}\\ |
|
377 ??? Coercion Type equality\\ |
|
378 @{text "| sym \<gamma> | \<gamma>\<^isub>1 \<circ> \<gamma>\<^isub>2 | left \<gamma> | right \<gamma> | \<gamma>\<^isub>1 \<sim> \<gamma>\<^isub>2 "}\\ |
|
379 @{text "| rightc \<gamma> | leftc \<gamma> | \<gamma>\<^isub>1 \<triangleright> \<gamma>\<^isub>2"}\\ |
|
380 Terms\\ |
|
381 @{text "e ::= x | K | \<Lambda>a:\<kappa>. e | \<Lambda>a:\<iota>. e | e \<sigma> | e \<gamma>"}\\ |
|
382 @{text "| \<lambda>x:\<sigma>.e | e\<^isub>1 e\<^isub>2"}\\ |
|
383 @{text "| \<LET> x:\<sigma> = e\<^isub>1 \<IN> e\<^isub>2"}\\ |
|
384 @{text "| \<CASE> e\<^isub>1 \<OF>"}$\;\overline{@{text "p \<rightarrow> e\<^isub>2"}}$\\ |
|
385 @{text "| e \<triangleright> \<gamma>"}\\ |
|
386 Patterns\\ |
|
387 @{text "p ::= K"}$\;\overline{@{text "a:\<kappa>"}}\;\overline{@{text "x:\<sigma>"}}$\\ |
|
388 Constants\\ |
|
389 @{text C} coercion constant\\ |
|
390 @{text T} value type constructor\\ |
|
391 @{text "S\<^isub>n"} n-ary type function\\ |
|
392 @{text K} data constructor\\ |
|
393 Variables\\ |
|
394 @{text a} type variable\\ |
|
395 @{text x} term variable\\ |
|
396 \end{tabular} |
|
397 \end{center} |
|
398 \end{boxedminipage} |
|
399 \caption{The term-language of System @{text "F\<^isub>C"}, also often referred to as Core-Haskell, |
|
400 according to \cite{CoreHaskell}. We only made an issential modification by |
|
401 separating the grammars for type kinds and coercion types.\label{corehas}} |
360 \end{figure} |
402 \end{figure} |
361 *} |
403 *} |
362 |
404 |
363 section {* A Short Review of the Nominal Logic Work *} |
405 section {* A Short Review of the Nominal Logic Work *} |
364 |
406 |
453 the notion of alpha-equivalence that is \emph{not} preserved by adding |
495 the notion of alpha-equivalence that is \emph{not} preserved by adding |
454 vacuous binders.) To answer this, we identify four conditions: {\it i)} |
496 vacuous binders.) To answer this, we identify four conditions: {\it i)} |
455 given a free-variable function @{text "fv"} of type \mbox{@{text "\<beta> \<Rightarrow> atom |
497 given a free-variable function @{text "fv"} of type \mbox{@{text "\<beta> \<Rightarrow> atom |
456 set"}}, then @{text x} and @{text y} need to have the same set of free |
498 set"}}, then @{text x} and @{text y} need to have the same set of free |
457 variables; moreover there must be a permutation @{text p} such that {\it |
499 variables; moreover there must be a permutation @{text p} such that {\it |
458 ii)} it leaves the free variables of @{text x} and @{text y} unchanged, but |
500 ii)} @{text p} leaves the free variables of @{text x} and @{text y} unchanged, but |
459 {\it iii)} ``moves'' their bound names so that we obtain modulo a relation, |
501 {\it iii)} ``moves'' their bound names so that we obtain modulo a relation, |
460 say \mbox{@{text "_ R _"}}, two equivalent terms. We also require {\it iv)} that |
502 say \mbox{@{text "_ R _"}}, two equivalent terms. We also require {\it iv)} that |
461 @{text p} makes the sets of abstracted atoms @{text as} and @{text bs} equal. The |
503 @{text p} makes the sets of abstracted atoms @{text as} and @{text bs} equal. The |
462 requirements {\it i)} to {\it iv)} can be stated formally as follows: |
504 requirements {\it i)} to {\it iv)} can be stated formally as follows: |
463 % |
505 % |
464 \begin{equation}\label{alphaset} |
506 \begin{equation}\label{alphaset} |
465 \begin{array}{@ {\hspace{10mm}}r@ {\hspace{2mm}}l} |
507 \begin{array}{@ {\hspace{10mm}}r@ {\hspace{2mm}}l} |
466 \multicolumn{2}{l}{@{term "(as, x) \<approx>gen R fv p (bs, y)"} @{text "\<equiv>"}\hspace{30mm}}\\ |
508 \multicolumn{2}{l}{@{term "(as, x) \<approx>gen R fv p (bs, y)"}\hspace{2mm}@{text "\<equiv>"}\hspace{30mm}}\\[1mm] |
467 & @{term "fv(x) - as = fv(y) - bs"}\\ |
509 & @{term "fv(x) - as = fv(y) - bs"}\\ |
468 @{text "\<and>"} & @{term "(fv(x) - as) \<sharp>* p"}\\ |
510 @{text "\<and>"} & @{term "(fv(x) - as) \<sharp>* p"}\\ |
469 @{text "\<and>"} & @{text "(p \<bullet> x) R y"}\\ |
511 @{text "\<and>"} & @{text "(p \<bullet> x) R y"}\\ |
470 @{text "\<and>"} & @{term "(p \<bullet> as) = bs"}\\ |
512 @{text "\<and>"} & @{term "(p \<bullet> as) = bs"}\\ |
471 \end{array} |
513 \end{array} |
505 also allow vacuous binders, then we keep sets of binders, but drop the fourth |
547 also allow vacuous binders, then we keep sets of binders, but drop the fourth |
506 condition in \eqref{alphaset}: |
548 condition in \eqref{alphaset}: |
507 % |
549 % |
508 \begin{equation}\label{alphares} |
550 \begin{equation}\label{alphares} |
509 \begin{array}{@ {\hspace{10mm}}r@ {\hspace{2mm}}l} |
551 \begin{array}{@ {\hspace{10mm}}r@ {\hspace{2mm}}l} |
510 \multicolumn{2}{l}{@{term "(as, x) \<approx>res R fv p (bs, y)"} @{text "\<equiv>"}\hspace{30mm}}\\[1mm] |
552 \multicolumn{2}{l}{@{term "(as, x) \<approx>res R fv p (bs, y)"}\hspace{2mm}@{text "\<equiv>"}\hspace{30mm}}\\[1mm] |
511 & @{term "fv(x) - as = fv(y) - bs"}\\ |
553 & @{term "fv(x) - as = fv(y) - bs"}\\ |
512 \wedge & @{term "(fv(x) - as) \<sharp>* p"}\\ |
554 \wedge & @{term "(fv(x) - as) \<sharp>* p"}\\ |
513 \wedge & @{text "(p \<bullet> x) R y"}\\ |
555 \wedge & @{text "(p \<bullet> x) R y"}\\ |
514 \end{array} |
556 \end{array} |
515 \end{equation} |
557 \end{equation} |
516 |
558 |
517 \begin{exmple}\rm |
|
518 It might be useful to consider some examples for how these definitions of alpha-equivalence |
559 It might be useful to consider some examples for how these definitions of alpha-equivalence |
519 pan out in practise. |
560 pan out in practise. |
520 For this consider the case of abstracting a set of variables over types (as in type-schemes). |
561 For this consider the case of abstracting a set of variables over types (as in type-schemes). |
521 We set @{text R} to be the equality and for @{text "fv(T)"} we define |
562 We set @{text R} to be the equality and for @{text "fv(T)"} we define |
522 |
563 |
524 @{text "fv(x) = {x}"} \hspace{5mm} @{text "fv(T\<^isub>1 \<rightarrow> T\<^isub>2) = fv(T\<^isub>1) \<union> fv(T\<^isub>2)"} |
565 @{text "fv(x) = {x}"} \hspace{5mm} @{text "fv(T\<^isub>1 \<rightarrow> T\<^isub>2) = fv(T\<^isub>1) \<union> fv(T\<^isub>2)"} |
525 \end{center} |
566 \end{center} |
526 |
567 |
527 \noindent |
568 \noindent |
528 Now recall the examples shown in \eqref{ex1}, \eqref{ex2} and |
569 Now recall the examples shown in \eqref{ex1}, \eqref{ex2} and |
529 \eqref{ex3}. It can be easily checked that @{text "({x,y}, x \<rightarrow> y)"} and |
570 \eqref{ex3}. It can be easily checked that @{text "({x, y}, x \<rightarrow> y)"} and |
530 @{text "({y,x}, y \<rightarrow> x)"} are equal according to $\approx_{\textit{set}}$ and |
571 @{text "({y, x}, y \<rightarrow> x)"} are equal according to $\approx_{\textit{set}}$ and |
531 $\approx_{\textit{res}}$ by taking @{text p} to be the swapping @{term "(x \<rightleftharpoons> |
572 $\approx_{\textit{res}}$ by taking @{text p} to be the swapping @{term "(x \<rightleftharpoons> |
532 y)"}. In case of @{text "x \<noteq> y"}, then @{text "([x, y], x \<rightarrow> y)"} |
573 y)"}. In case of @{text "x \<noteq> y"}, then @{text "([x, y], x \<rightarrow> y)"} |
533 $\not\approx_{\textit{list}}$ @{text "([y,x], x \<rightarrow> y)"} since there is no permutation |
574 $\not\approx_{\textit{list}}$ @{text "([y, x], x \<rightarrow> y)"} since there is no permutation |
534 that makes the lists @{text "[x, y]"} and @{text "[y, x]"} equal, and also |
575 that makes the lists @{text "[x, y]"} and @{text "[y, x]"} equal, and also |
535 leaves the type \mbox{@{text "x \<rightarrow> y"}} unchanged. Another example is |
576 leaves the type \mbox{@{text "x \<rightarrow> y"}} unchanged. Another example is |
536 @{text "({x}, x)"} $\approx_{\textit{res}}$ @{text "({x,y}, x)"} which holds by |
577 @{text "({x}, x)"} $\approx_{\textit{res}}$ @{text "({x, y}, x)"} which holds by |
537 taking @{text p} to be the |
578 taking @{text p} to be the |
538 identity permutation. However, if @{text "x \<noteq> y"}, then @{text "({x}, x)"} |
579 identity permutation. However, if @{text "x \<noteq> y"}, then @{text "({x}, x)"} |
539 $\not\approx_{\textit{set}}$ @{text "({x,y}, x)"} since there is no permutation |
580 $\not\approx_{\textit{set}}$ @{text "({x, y}, x)"} since there is no permutation |
540 that makes the |
581 that makes the |
541 sets @{text "{x}"} and @{text "{x,y}"} equal (similarly for $\approx_{\textit{list}}$). |
582 sets @{text "{x}"} and @{text "{x, y}"} equal (similarly for $\approx_{\textit{list}}$). |
542 \end{exmple} |
583 It can also relatively easily be shown that all tree notions of alpha-equivalence |
|
584 coincide, if we only abstract a single atom. |
543 |
585 |
544 % looks too ugly |
586 % looks too ugly |
545 %\noindent |
587 %\noindent |
546 %Let $\star$ range over $\{set, res, list\}$. We prove next under which |
588 %Let $\star$ range over $\{set, res, list\}$. We prove next under which |
547 %conditions the $\approx\hspace{0.05mm}_\star^{\fv, R, p}$ are equivalence |
589 %conditions the $\approx\hspace{0.05mm}_\star^{\fv, R, p}$ are equivalence |
567 %\begin{proof} |
609 %\begin{proof} |
568 %All properties are by unfolding the definitions and simple calculations. |
610 %All properties are by unfolding the definitions and simple calculations. |
569 %\end{proof} |
611 %\end{proof} |
570 |
612 |
571 |
613 |
572 In the rest of this section we are going to introduce a type- and term-constructor |
614 In the rest of this section we are going to introduce a type- and term-constructors |
573 for abstractions. For this we define (similarly for $\approx_{\textit{abs\_list}}$ |
615 for abstraction. For this we define |
574 and $\approx_{\textit{abs\_res}}$) |
|
575 % |
616 % |
576 \begin{equation} |
617 \begin{equation} |
577 @{term "abs_set (as, x) (bs, x) \<equiv> \<exists>p. alpha_gen (as, x) equal supp p (bs, x)"} |
618 @{term "abs_set (as, x) (bs, x) \<equiv> \<exists>p. alpha_gen (as, x) equal supp p (bs, x)"} |
578 \end{equation} |
619 \end{equation} |
579 |
620 |
580 \noindent |
621 \noindent |
581 We can show that these relations are equivalence relations and equivariant |
622 (similarly for $\approx_{\textit{abs\_list}}$ |
582 (we only show the $\approx_{\textit{abs\_set}}$-case). |
623 and $\approx_{\textit{abs\_res}}$). We can show that these relations are equivalence |
583 |
624 relations and equivariant. |
584 \begin{lemma}\label{alphaeq} |
625 |
585 $\approx_{\textit{abs\_set}}$ is an equivalence |
626 \begin{lemma}\label{alphaeq} The relations |
|
627 $\approx_{\textit{abs\_set}}$, |
|
628 $\approx_{\textit{abs\_list}}$ |
|
629 and $\approx_{\textit{abs\_res}}$ |
|
630 are equivalence |
586 relations, and if @{term "abs_set (as, x) (bs, y)"} then also |
631 relations, and if @{term "abs_set (as, x) (bs, y)"} then also |
587 @{term "abs_set (p \<bullet> as, p \<bullet> x) (p \<bullet> bs, p \<bullet> y)"}. |
632 @{term "abs_set (p \<bullet> as, p \<bullet> x) (p \<bullet> bs, p \<bullet> y)"} (similarly for |
|
633 the other two relations). |
588 \end{lemma} |
634 \end{lemma} |
589 |
635 |
590 \begin{proof} |
636 \begin{proof} |
591 Reflexivity is by taking @{text "p"} to be @{text "0"}. For symmetry we have |
637 Reflexivity is by taking @{text "p"} to be @{text "0"}. For symmetry we have |
592 a permutation @{text p} and for the proof obligation take @{term "-p"}. In case |
638 a permutation @{text p} and for the proof obligation take @{term "-p"}. In case |
593 of transitivity, we have two permutations @{text p} and @{text q}, and for the |
639 of transitivity, we have two permutations @{text p} and @{text q}, and for the |
594 proof obligation use @{text "q + p"}. All conditions are then by simple |
640 proof obligation use @{text "q + p"}. All conditions are then by simple |
595 calculations. |
641 calculations. |
596 \end{proof} |
642 \end{proof} |
597 |
643 |
598 \noindent |
644 \noindent |
599 We are also define the following two auxiliary functions taking a pair |
645 This lemma allows us to use our quotient package and introduce |
600 as argument. |
|
601 % |
|
602 \begin{equation}\label{aux} |
|
603 \begin{array}{r@ {\hspace{2mm}}c@ {\hspace{2mm}}l} |
|
604 @{text "aux (as, x)"} & @{text "\<equiv>"} & @{text "supp x - as"}\\ |
|
605 @{text "aux_list (bs, x)"} & @{text "\<equiv>"} & @{text "supp x - set bs"} |
|
606 \end{array} |
|
607 \end{equation} |
|
608 |
|
609 \noindent |
|
610 The point of these two functions is that they are preserved under |
|
611 alpha-equivalence, that means for instance |
|
612 % |
|
613 \begin{equation}\label{auxpreserved} |
|
614 @{term "abs_set (as, x) (bs, y)"} \;\;\text{implies}\;\; |
|
615 @{term "aux (as, x) = aux (bs, y)"} |
|
616 \end{equation} |
|
617 |
|
618 Lemma \ref{alphaeq} allows us to use our quotient package and introduce |
|
619 new types @{text "\<beta> abs_set"}, @{text "\<beta> abs_res"} and @{text "\<beta> abs_list"} |
646 new types @{text "\<beta> abs_set"}, @{text "\<beta> abs_res"} and @{text "\<beta> abs_list"} |
620 representing the alpha-equivalence classes. Elements in these types |
647 representing alpha-equivalence classes of pairs. The elements in these types |
621 we will, respectively, write as: |
648 we will, respectively, write as: |
622 |
649 |
623 \begin{center} |
650 \begin{center} |
624 @{term "Abs as x"} \hspace{5mm} |
651 @{term "Abs as x"} \hspace{5mm} |
625 @{term "Abs_lst as x"} \hspace{5mm} |
652 @{term "Abs_lst as x"} \hspace{5mm} |
626 @{term "Abs_res as x"} |
653 @{term "Abs_res as x"} |
627 \end{center} |
654 \end{center} |
628 |
655 |
629 \noindent |
656 \noindent |
630 By definition we have |
657 indicating that a set or list is abstracted in @{text x}. We will call the types |
631 |
658 \emph{abstraction types} and their elements \emph{abstractions}. The important |
632 \begin{center} |
659 property we need is a characterisation for the support of abstractions, namely |
633 @{thm (lhs) abs_eq_iff(1)[where bs="as" and cs="bs", no_vars]} \;iff\; |
660 |
|
661 \begin{thm}[Support of Abstractions]\label{suppabs} |
|
662 Assuming @{text x} has finite support, then |
|
663 \begin{center} |
|
664 \begin{tabular}{l@ {\hspace{2mm}}c@ {\hspace{2mm}}l} |
|
665 @{thm (lhs) supp_abs(1)[no_vars]} & $=$ & @{thm (rhs) supp_abs(1)[no_vars]}\\ |
|
666 @{thm (lhs) supp_abs(2)[no_vars]} & $=$ & @{thm (rhs) supp_abs(2)[no_vars]}\\ |
|
667 @{thm (lhs) supp_abs(3)[no_vars]} & $=$ & @{thm (rhs) supp_abs(3)[no_vars]} |
|
668 \end{tabular} |
|
669 \end{center} |
|
670 \end{thm} |
|
671 |
|
672 \noindent |
|
673 We will only show in the rest of the section the first equation, as the others |
|
674 follow similar arguments. By definition of the abstraction type @{text "abs_set"} |
|
675 we have |
|
676 % |
|
677 \begin{equation}\label{abseqiff} |
|
678 @{thm (lhs) abs_eq_iff(1)[where bs="as" and cs="bs", no_vars]} \;\text{if and only if}\; |
634 @{thm (rhs) abs_eq_iff(1)[where bs="as" and cs="bs", no_vars]} |
679 @{thm (rhs) abs_eq_iff(1)[where bs="as" and cs="bs", no_vars]} |
635 \end{center} |
680 \end{equation} |
636 |
681 |
637 |
682 \noindent |
638 \noindent |
683 With this, we can show the following lemma about swapping two atoms (the permutation |
639 The following lemma (and similar ones for $\approx_{\textit{abs\_list}}$ and |
684 operation for abstractions is the one lifted for pairs).\footnote{metion this in the nominal |
640 $\approx_{\textit{abs\_res}}$) will be crucial below: |
685 logic section} |
641 |
686 |
642 \begin{lemma} |
687 \begin{lemma} |
643 @{thm[mode=IfThen] abs_swap1(1)[no_vars]} |
688 @{thm[mode=IfThen] abs_swap1(1)[no_vars]} |
644 \end{lemma} |
689 \end{lemma} |
645 |
690 |
646 \begin{proof} |
691 \begin{proof} |
647 This lemma is straightforward by observing that the assumptions give us |
692 By using \eqref{abseqiff}, this lemma is straightforward when observing that |
|
693 the assumptions give us |
648 @{term "(a \<rightleftharpoons> b) \<bullet> (supp x - bs) = (supp x - bs)"} and that @{text supp} |
694 @{term "(a \<rightleftharpoons> b) \<bullet> (supp x - bs) = (supp x - bs)"} and that @{text supp} |
649 is equivariant. |
695 and set difference are equivariant. |
650 \end{proof} |
696 \end{proof} |
|
697 |
|
698 \noindent |
|
699 This lemma gives us |
|
700 % |
|
701 \begin{equation}\label{halfone} |
|
702 @{thm abs_supports(1)[no_vars]} |
|
703 \end{equation} |
|
704 |
|
705 \noindent |
|
706 which with \ref{} gives us one half of Thm~\ref{suppabs}. The other half is |
|
707 a bit more involved. We first define an auxiliary function |
|
708 % |
|
709 \begin{center} |
|
710 @{thm supp_res.simps[THEN eq_reflection, no_vars]} |
|
711 \end{center} |
|
712 |
651 |
713 |
652 \begin{lemma} |
714 \begin{lemma} |
653 $supp ([as]set. x) = supp x - as$ |
715 $supp ([as]set. x) = supp x - as$ |
654 \end{lemma} |
716 \end{lemma} |
|
717 |
|
718 \noindent |
|
719 The point of these general lemmas about pairs is that we can define and prove properties |
|
720 about them conveninently on the Isabelle level, and in addition can use them in what |
|
721 follows next when we have to deal with specific instances of term-specification. |
655 *} |
722 *} |
656 |
723 |
657 section {* Alpha-Equivalence and Free Variables *} |
724 section {* Alpha-Equivalence and Free Variables *} |
658 |
725 |
659 text {* |
726 text {* |