112 \begin{isabelle}\ \ \ \ \ %%% |
112 \begin{isabelle}\ \ \ \ \ %%% |
113 @{text "(n\<^isub>1, n\<^isub>2) \<approx> (m\<^isub>1, m\<^isub>2) \<equiv> n\<^isub>1 + m\<^isub>2 = m\<^isub>1 + n\<^isub>2"}\hfill\numbered{natpairequiv} |
113 @{text "(n\<^isub>1, n\<^isub>2) \<approx> (m\<^isub>1, m\<^isub>2) \<equiv> n\<^isub>1 + m\<^isub>2 = m\<^isub>1 + n\<^isub>2"}\hfill\numbered{natpairequiv} |
114 \end{isabelle} |
114 \end{isabelle} |
115 |
115 |
116 \noindent |
116 \noindent |
117 This constructions yields the new type @{typ int} and definitions for @{text |
117 This constructions yields the new type @{typ int}, and definitions for @{text |
118 "0"} and @{text "1"} of type @{typ int} can be given in terms of pairs of |
118 "0"} and @{text "1"} of type @{typ int} can be given in terms of pairs of |
119 natural numbers (namely @{text "(0, 0)"} and @{text "(1, 0)"}). Operations |
119 natural numbers (namely @{text "(0, 0)"} and @{text "(1, 0)"}). Operations |
120 such as @{text "add"} with type @{typ "int \<Rightarrow> int \<Rightarrow> int"} can be defined in |
120 such as @{text "add"} with type @{typ "int \<Rightarrow> int \<Rightarrow> int"} can be defined in |
121 terms of operations on pairs of natural numbers (namely @{text |
121 terms of operations on pairs of natural numbers (namely @{text |
122 "add_pair (n\<^isub>1, m\<^isub>1) (n\<^isub>2, |
122 "add_pair (n\<^isub>1, m\<^isub>1) (n\<^isub>2, |
123 m\<^isub>2) \<equiv> (n\<^isub>1 + n\<^isub>2, m\<^isub>1 + m\<^isub>2)"}). |
123 m\<^isub>2) \<equiv> (n\<^isub>1 + n\<^isub>2, m\<^isub>1 + m\<^isub>2)"}). |
124 Similarly one can construct the type of finite sets, written @{term "\<alpha> fset"}, |
124 Similarly one can construct %%the type of |
|
125 finite sets, written @{term "\<alpha> fset"}, |
125 by quotienting the type @{text "\<alpha> list"} according to the equivalence relation |
126 by quotienting the type @{text "\<alpha> list"} according to the equivalence relation |
126 |
127 |
127 \begin{isabelle}\ \ \ \ \ %%% |
128 \begin{isabelle}\ \ \ \ \ %%% |
128 @{text "xs \<approx> ys \<equiv> (\<forall>x. memb x xs \<longleftrightarrow> memb x ys)"}\hfill\numbered{listequiv} |
129 @{text "xs \<approx> ys \<equiv> (\<forall>x. memb x xs \<longleftrightarrow> memb x ys)"}\hfill\numbered{listequiv} |
129 \end{isabelle} |
130 \end{isabelle} |
135 @{text "\<union>"}, as list append. |
136 @{text "\<union>"}, as list append. |
136 |
137 |
137 Quotients are important in a variety of areas, but they are really ubiquitous in |
138 Quotients are important in a variety of areas, but they are really ubiquitous in |
138 the area of reasoning about programming language calculi. A simple example |
139 the area of reasoning about programming language calculi. A simple example |
139 is the lambda-calculus, whose raw terms are defined as |
140 is the lambda-calculus, whose raw terms are defined as |
140 |
141 % |
141 |
142 %\begin{isabelle}\ \ \ \ \ %%% |
142 \begin{isabelle}\ \ \ \ \ %%% |
143 @{text "t ::= x | t t | \<lambda>x.t"}%\hfill\numbered{lambda} |
143 @{text "t ::= x | t t | \<lambda>x.t"}\hfill\numbered{lambda} |
144 %\end{isabelle} |
144 \end{isabelle} |
145 % |
145 |
146 %\noindent |
146 \noindent |
|
147 The problem with this definition arises, for instance, when one attempts to |
147 The problem with this definition arises, for instance, when one attempts to |
148 prove formally the substitution lemma \cite{Barendregt81} by induction |
148 prove formally the substitution lemma \cite{Barendregt81} by induction |
149 over the structure of terms. This can be fiendishly complicated (see |
149 over the structure of terms. This can be fiendishly complicated (see |
150 \cite[Pages 94--104]{CurryFeys58} for some ``rough'' sketches of a proof |
150 \cite[Pages 94--104]{CurryFeys58} for some ``rough'' sketches of a proof |
151 about raw lambda-terms). In contrast, if we reason about |
151 about raw lambda-terms). In contrast, if we reason about |
179 |
179 |
180 %%% Cezary: I like the diagram, maybe 'new type' could be outside, but otherwise |
180 %%% Cezary: I like the diagram, maybe 'new type' could be outside, but otherwise |
181 %%% I wouldn't change it. |
181 %%% I wouldn't change it. |
182 |
182 |
183 \begin{center} |
183 \begin{center} |
184 \mbox{}\hspace{20mm}\begin{tikzpicture} |
184 \mbox{}\hspace{20mm}\begin{tikzpicture}[scale=0.9] |
185 %%\draw[step=2mm] (-4,-1) grid (4,1); |
185 %%\draw[step=2mm] (-4,-1) grid (4,1); |
186 |
186 |
187 \draw[very thick] (0.7,0.3) circle (4.85mm); |
187 \draw[very thick] (0.7,0.3) circle (4.85mm); |
188 \draw[rounded corners=1mm, very thick] ( 0.0,-0.9) rectangle ( 1.8, 0.9); |
188 \draw[rounded corners=1mm, very thick] ( 0.0,-0.9) rectangle ( 1.8, 0.9); |
189 \draw[rounded corners=1mm, very thick] (-1.95,0.8) rectangle (-2.9,-0.195); |
189 \draw[rounded corners=1mm, very thick] (-1.95,0.8) rectangle (-2.9,-0.195); |
199 |
199 |
200 \draw[->, very thick] (-1.8, 0.36) -- (-0.1,0.36); |
200 \draw[->, very thick] (-1.8, 0.36) -- (-0.1,0.36); |
201 \draw[<-, very thick] (-1.8, 0.16) -- (-0.1,0.16); |
201 \draw[<-, very thick] (-1.8, 0.16) -- (-0.1,0.16); |
202 \draw (-0.95, 0.26) node[above=0.4mm] {@{text Rep}}; |
202 \draw (-0.95, 0.26) node[above=0.4mm] {@{text Rep}}; |
203 \draw (-0.95, 0.26) node[below=0.4mm] {@{text Abs}}; |
203 \draw (-0.95, 0.26) node[below=0.4mm] {@{text Abs}}; |
204 |
|
205 \end{tikzpicture} |
204 \end{tikzpicture} |
206 \end{center} |
205 \end{center} |
207 |
206 |
208 \noindent |
207 \noindent |
209 The starting point is an existing type, to which we refer as the |
208 The starting point is an existing type, to which we refer as the |
210 \emph{raw type} and over which an equivalence relation given by the user is |
209 \emph{raw type} and over which an equivalence relation is given by the user. |
211 defined. With this input the package introduces a new type, to which we |
210 With this input the package introduces a new type, to which we |
212 refer as the \emph{quotient type}. This type comes with an |
211 refer as the \emph{quotient type}. This type comes with an |
213 \emph{abstraction} and a \emph{representation} function, written @{text Abs} |
212 \emph{abstraction} and a \emph{representation} function, written @{text Abs} |
214 and @{text Rep}.\footnote{Actually slightly more basic functions are given; |
213 and @{text Rep}.\footnote{Actually slightly more basic functions are given; |
215 the functions @{text Abs} and @{text Rep} need to be derived from them. We |
214 the functions @{text Abs} and @{text Rep} need to be derived from them. We |
216 will show the details later. } They relate elements in the |
215 will show the details later. } They relate elements in the |
217 existing type to elements in the new type and vice versa, and can be uniquely |
216 existing type to elements in the new type, % and vice versa, |
|
217 and can be uniquely |
218 identified by their quotient type. For example for the integer quotient construction |
218 identified by their quotient type. For example for the integer quotient construction |
219 the types of @{text Abs} and @{text Rep} are |
219 the types of @{text Abs} and @{text Rep} are |
220 |
220 |
221 |
221 |
222 \begin{isabelle}\ \ \ \ \ %%% |
222 \begin{isabelle}\ \ \ \ \ %%% |
260 @{thm concat.simps(1)[THEN eq_reflection]}\hspace{10mm} |
260 @{thm concat.simps(1)[THEN eq_reflection]}\hspace{10mm} |
261 @{thm concat.simps(2)[THEN eq_reflection, no_vars]} |
261 @{thm concat.simps(2)[THEN eq_reflection, no_vars]} |
262 \end{isabelle} |
262 \end{isabelle} |
263 |
263 |
264 \noindent |
264 \noindent |
265 where @{text "@"} is the usual list append. We expect that the corresponding |
265 where @{text "@"} is %the usual |
|
266 list append. We expect that the corresponding |
266 operator on finite sets, written @{term "fconcat"}, |
267 operator on finite sets, written @{term "fconcat"}, |
267 builds finite unions of finite sets: |
268 builds finite unions of finite sets: |
268 |
269 |
269 \begin{isabelle}\ \ \ \ \ %%% |
270 \begin{isabelle}\ \ \ \ \ %%% |
270 @{thm concat_empty_fset[THEN eq_reflection, no_vars]}\hspace{10mm} |
271 @{thm concat_empty_fset[THEN eq_reflection, no_vars]}\hspace{10mm} |
288 existing quotient packages by introducing an intermediate step and reasoning |
289 existing quotient packages by introducing an intermediate step and reasoning |
289 about flattening of lists of finite sets. However, this remedy is rather |
290 about flattening of lists of finite sets. However, this remedy is rather |
290 cumbersome and inelegant in light of our work, which can deal with such |
291 cumbersome and inelegant in light of our work, which can deal with such |
291 definitions directly. The solution is that we need to build aggregate |
292 definitions directly. The solution is that we need to build aggregate |
292 representation and abstraction functions, which in case of @{text "\<Union>"} |
293 representation and abstraction functions, which in case of @{text "\<Union>"} |
293 generate the following definition |
294 generate the %%%following |
|
295 definition |
294 |
296 |
295 \begin{isabelle}\ \ \ \ \ %%% |
297 \begin{isabelle}\ \ \ \ \ %%% |
296 @{text "\<Union> S \<equiv> Abs_fset (flat ((map_list Rep_fset \<circ> Rep_fset) S))"} |
298 @{text "\<Union> S \<equiv> Abs_fset (flat ((map_list Rep_fset \<circ> Rep_fset) S))"} |
297 \end{isabelle} |
299 \end{isabelle} |
298 |
300 |
389 |
391 |
390 It will also be necessary to have operators, referred to as @{text "rel_\<kappa>"}, |
392 It will also be necessary to have operators, referred to as @{text "rel_\<kappa>"}, |
391 which define equivalence relations in terms of constituent equivalence |
393 which define equivalence relations in terms of constituent equivalence |
392 relations. For example given two equivalence relations @{text "R\<^isub>1"} |
394 relations. For example given two equivalence relations @{text "R\<^isub>1"} |
393 and @{text "R\<^isub>2"}, we can define an equivalence relations over |
395 and @{text "R\<^isub>2"}, we can define an equivalence relations over |
394 products as follows |
396 products as %% follows |
395 |
397 |
396 \begin{isabelle}\ \ \ \ \ %%% |
398 \begin{isabelle}\ \ \ \ \ %%% |
397 @{text "(R\<^isub>1 \<tripple> R\<^isub>2) (x\<^isub>1, x\<^isub>2) (y\<^isub>1, y\<^isub>2) \<equiv> R\<^isub>1 x\<^isub>1 y\<^isub>1 \<and> R\<^isub>2 x\<^isub>2 y\<^isub>2"} |
399 @{text "(R\<^isub>1 \<tripple> R\<^isub>2) (x\<^isub>1, x\<^isub>2) (y\<^isub>1, y\<^isub>2) \<equiv> R\<^isub>1 x\<^isub>1 y\<^isub>1 \<and> R\<^isub>2 x\<^isub>2 y\<^isub>2"} |
398 \end{isabelle} |
400 \end{isabelle} |
399 |
401 |
479 with @{text R} being an equivalence relation, then |
481 with @{text R} being an equivalence relation, then |
480 |
482 |
481 \begin{isabelle}\ \ \ \ \ %%% |
483 \begin{isabelle}\ \ \ \ \ %%% |
482 \begin{tabular}{r@ {\hspace{1mm}}l} |
484 \begin{tabular}{r@ {\hspace{1mm}}l} |
483 @{text "Quot"} & @{text "(rel_list R \<circ>\<circ>\<circ> \<approx>\<^bsub>list\<^esub>)"}\\ |
485 @{text "Quot"} & @{text "(rel_list R \<circ>\<circ>\<circ> \<approx>\<^bsub>list\<^esub>)"}\\ |
484 & @{text "(Abs_fset \<circ> map_list Abs)"}\\ |
486 & @{text "(Abs_fset \<circ> map_list Abs)"} @{text "(map_list Rep \<circ> Rep_fset)"}\\ |
485 & @{text "(map_list Rep \<circ> Rep_fset)"}\\ |
|
486 \end{tabular} |
487 \end{tabular} |
487 \end{isabelle} |
488 \end{isabelle} |
488 *} |
489 *} |
489 |
490 |
490 section {* Quotient Types and Quotient\\ Definitions\label{sec:type} *} |
491 section {* Quotient Types and Quotient\\ Definitions\label{sec:type} *} |
604 % |
605 % |
605 \begin{center} |
606 \begin{center} |
606 \hfill |
607 \hfill |
607 \begin{tabular}{@ {\hspace{2mm}}l@ {}} |
608 \begin{tabular}{@ {\hspace{2mm}}l@ {}} |
608 \multicolumn{1}{@ {}l}{equal types:}\\ |
609 \multicolumn{1}{@ {}l}{equal types:}\\ |
609 @{text "ABS (\<sigma>, \<sigma>)"} $\dn$ @{text "id :: \<sigma> \<Rightarrow> \<sigma>"}\\ |
610 @{text "ABS (\<sigma>, \<sigma>)"} $\dn$ @{text "id :: \<sigma> \<Rightarrow> \<sigma>"}\hspace{5mm}%\\ |
610 @{text "REP (\<sigma>, \<sigma>)"} $\dn$ @{text "id :: \<sigma> \<Rightarrow> \<sigma>"}\smallskip\\ |
611 @{text "REP (\<sigma>, \<sigma>)"} $\dn$ @{text "id :: \<sigma> \<Rightarrow> \<sigma>"}\smallskip\\ |
611 \multicolumn{1}{@ {}l}{function types:}\\ |
612 \multicolumn{1}{@ {}l}{function types:}\\ |
612 @{text "ABS (\<sigma>\<^isub>1 \<Rightarrow> \<sigma>\<^isub>2, \<tau>\<^isub>1 \<Rightarrow> \<tau>\<^isub>2)"} $\dn$ @{text "REP (\<sigma>\<^isub>1, \<tau>\<^isub>1) \<singlearr> ABS (\<sigma>\<^isub>2, \<tau>\<^isub>2)"}\\ |
613 @{text "ABS (\<sigma>\<^isub>1 \<Rightarrow> \<sigma>\<^isub>2, \<tau>\<^isub>1 \<Rightarrow> \<tau>\<^isub>2)"} $\dn$ @{text "REP (\<sigma>\<^isub>1, \<tau>\<^isub>1) \<singlearr> ABS (\<sigma>\<^isub>2, \<tau>\<^isub>2)"}\\ |
613 @{text "REP (\<sigma>\<^isub>1 \<Rightarrow> \<sigma>\<^isub>2, \<tau>\<^isub>1 \<Rightarrow> \<tau>\<^isub>2)"} $\dn$ @{text "ABS (\<sigma>\<^isub>1, \<tau>\<^isub>1) \<singlearr> REP (\<sigma>\<^isub>2, \<tau>\<^isub>2)"}\smallskip\\ |
614 @{text "REP (\<sigma>\<^isub>1 \<Rightarrow> \<sigma>\<^isub>2, \<tau>\<^isub>1 \<Rightarrow> \<tau>\<^isub>2)"} $\dn$ @{text "ABS (\<sigma>\<^isub>1, \<tau>\<^isub>1) \<singlearr> REP (\<sigma>\<^isub>2, \<tau>\<^isub>2)"}\smallskip\\ |
614 \multicolumn{1}{@ {}l}{equal type constructors:}\\ |
615 \multicolumn{1}{@ {}l}{equal type constructors:}\\ |
706 Note that by using the operator @{text "\<singlearr>"} and special clauses |
707 Note that by using the operator @{text "\<singlearr>"} and special clauses |
707 for function types in \eqref{ABSREP}, we do not have to |
708 for function types in \eqref{ABSREP}, we do not have to |
708 distinguish between arguments and results, but can deal with them uniformly. |
709 distinguish between arguments and results, but can deal with them uniformly. |
709 Consequently, all definitions in the quotient package |
710 Consequently, all definitions in the quotient package |
710 are of the general form |
711 are of the general form |
711 |
712 % |
712 \begin{isabelle}\ \ \ \ \ %%% |
713 %\begin{isabelle}\ \ \ \ \ %%% |
713 @{text "c \<equiv> ABS (\<sigma>, \<tau>) t"} |
714 \mbox{@{text "c \<equiv> ABS (\<sigma>, \<tau>) t"}} |
714 \end{isabelle} |
715 %\end{isabelle} |
715 |
716 % |
716 \noindent |
717 %\noindent |
717 where @{text \<sigma>} is the type of the definiens @{text "t"} and @{text "\<tau>"} the |
718 where @{text \<sigma>} is the type of the definiens @{text "t"} and @{text "\<tau>"} the |
718 type of the defined quotient constant @{text "c"}. This data can be easily |
719 type of the defined quotient constant @{text "c"}. This data can be easily |
719 generated from the declaration given by the user. |
720 generated from the declaration given by the user. |
720 To increase the confidence in this way of making definitions, we can prove |
721 To increase the confidence in this way of making definitions, we can prove |
721 that the terms involved are all typable. |
722 that the terms involved are all typable. |
755 involving constants over the raw type to theorems involving constants over |
756 involving constants over the raw type to theorems involving constants over |
756 the quotient type. Before we can describe this lifting process, we need to impose |
757 the quotient type. Before we can describe this lifting process, we need to impose |
757 two restrictions in form of proof obligations that arise during the |
758 two restrictions in form of proof obligations that arise during the |
758 lifting. The reason is that even if definitions for all raw constants |
759 lifting. The reason is that even if definitions for all raw constants |
759 can be given, \emph{not} all theorems can be lifted to the quotient type. Most |
760 can be given, \emph{not} all theorems can be lifted to the quotient type. Most |
760 notable is the bound variable function, that is the constant @{text bn}, defined |
761 notable is the bound variable function %%, that is the constant @{text bn}, |
|
762 defined |
761 for raw lambda-terms as follows |
763 for raw lambda-terms as follows |
762 |
764 |
763 \begin{isabelle} |
765 \begin{isabelle} |
764 \begin{center} |
766 \begin{center} |
765 @{text "bn (x) \<equiv> \<emptyset>"}\hspace{4mm} |
767 @{text "bn (x) \<equiv> \<emptyset>"}\hspace{4mm} |
788 elsewhere. |
790 elsewhere. |
789 |
791 |
790 \begin{center} |
792 \begin{center} |
791 \hfill |
793 \hfill |
792 \begin{tabular}{l} |
794 \begin{tabular}{l} |
793 \multicolumn{1}{@ {}l}{equal types:}\\ |
795 \multicolumn{1}{@ {}l}{equal types:} |
794 @{text "REL (\<sigma>, \<sigma>)"} $\dn$ @{text "= :: \<sigma> \<Rightarrow> \<sigma> \<Rightarrow> bool"}\smallskip\\ |
796 @{text "REL (\<sigma>, \<sigma>)"} $\dn$ @{text "= :: \<sigma> \<Rightarrow> \<sigma> \<Rightarrow> bool"}\smallskip\\ |
795 \multicolumn{1}{@ {}l}{equal type constructors:}\\ |
797 \multicolumn{1}{@ {}l}{equal type constructors:}\\ |
796 @{text "REL (\<sigma>s \<kappa>, \<tau>s \<kappa>)"} $\dn$ @{text "rel_\<kappa> (REL (\<sigma>s, \<tau>s))"}\smallskip\\ |
798 @{text "REL (\<sigma>s \<kappa>, \<tau>s \<kappa>)"} $\dn$ @{text "rel_\<kappa> (REL (\<sigma>s, \<tau>s))"}\smallskip\\ |
797 \multicolumn{1}{@ {}l}{unequal type constructors:}\\ |
799 \multicolumn{1}{@ {}l}{unequal type constructors:}\\ |
798 @{text "REL (\<sigma>s \<kappa>, \<tau>s \<kappa>\<^isub>q)"} $\dn$ @{text "rel_\<kappa>\<^isub>q (REL (\<sigma>s', \<tau>s))"}\\ |
800 @{text "REL (\<sigma>s \<kappa>, \<tau>s \<kappa>\<^isub>q)"} $\dn$ @{text "rel_\<kappa>\<^isub>q (REL (\<sigma>s', \<tau>s))"}\\ |
808 Let us return to the lifting procedure of theorems. Assume we have a theorem |
810 Let us return to the lifting procedure of theorems. Assume we have a theorem |
809 that contains the raw constant @{text "c\<^isub>r :: \<sigma>"} and which we want to |
811 that contains the raw constant @{text "c\<^isub>r :: \<sigma>"} and which we want to |
810 lift to a theorem where @{text "c\<^isub>r"} is replaced by the corresponding |
812 lift to a theorem where @{text "c\<^isub>r"} is replaced by the corresponding |
811 constant @{text "c\<^isub>q :: \<tau>"} defined over a quotient type. In this situation |
813 constant @{text "c\<^isub>q :: \<tau>"} defined over a quotient type. In this situation |
812 we generate the following proof obligation |
814 we generate the following proof obligation |
813 |
815 % |
814 \begin{isabelle}\ \ \ \ \ %%% |
816 %\begin{isabelle}\ \ \ \ \ %%% |
815 @{text "REL (\<sigma>, \<tau>) c\<^isub>r c\<^isub>r"} |
817 @{text "REL (\<sigma>, \<tau>) c\<^isub>r c\<^isub>r"}. |
816 \end{isabelle} |
818 %\end{isabelle} |
817 |
819 % |
818 \noindent |
820 %\noindent |
819 Homeier calls these proof obligations \emph{respectfulness |
821 Homeier calls these proof obligations \emph{respectfulness |
820 theorems}. However, unlike his quotient package, we might have several |
822 theorems}. However, unlike his quotient package, we might have several |
821 respectfulness theorems for one constant---he has at most one. |
823 respectfulness theorems for one constant---he has at most one. |
822 The reason is that because of our quotient compositions, the types |
824 The reason is that because of our quotient compositions, the types |
823 @{text \<sigma>} and @{text \<tau>} are not completely determined by @{text "c\<^bsub>r\<^esub>"}. |
825 @{text \<sigma>} and @{text \<tau>} are not completely determined by @{text "c\<^bsub>r\<^esub>"}. |
824 And for every instantiation of the types, a corresponding |
826 And for every instantiation of the types, a corresponding |
825 respectfulness theorem is necessary. |
827 respectfulness theorem is necessary. |
826 |
828 |
827 Before lifting a theorem, we require the user to discharge |
829 Before lifting a theorem, we require the user to discharge |
828 respectfulness proof obligations. In case of @{text bn} |
830 respectfulness proof obligations. In case of @{text bn} |
829 this obligation is as follows |
831 this obligation is %%as follows |
830 |
832 % |
831 \begin{isabelle}\ \ \ \ \ %%% |
833 %\begin{isabelle}\ \ \ \ \ %%% |
832 @{text "(\<approx>\<^isub>\<alpha> \<doublearr> =) bn bn"} |
834 @{text "(\<approx>\<^isub>\<alpha> \<doublearr> =) bn bn"} |
833 \end{isabelle} |
835 %\end{isabelle} |
834 |
836 % |
835 \noindent |
837 %\noindent |
836 and the point is that the user cannot discharge it: because it is not true. To see this, |
838 and the point is that the user cannot discharge it: because it is not true. To see this, |
837 we can just unfold the definition of @{text "\<doublearr>"} \eqref{relfun} |
839 we can just unfold the definition of @{text "\<doublearr>"} \eqref{relfun} |
838 using extensionality to obtain the false statement |
840 using extensionality to obtain the false statement |
839 |
841 |
840 \begin{isabelle}\ \ \ \ \ %%% |
842 \begin{isabelle}\ \ \ \ \ %%% |
841 @{text "\<forall>t\<^isub>1 t\<^isub>2. if t\<^isub>1 \<approx>\<^isub>\<alpha> t\<^isub>2 then bn(t\<^isub>1) = bn(t\<^isub>2)"} |
843 @{text "\<forall>t\<^isub>1 t\<^isub>2. if t\<^isub>1 \<approx>\<^isub>\<alpha> t\<^isub>2 then bn(t\<^isub>1) = bn(t\<^isub>2)"} |
842 \end{isabelle} |
844 \end{isabelle} |
843 |
845 |
844 \noindent |
846 \noindent |
845 In contrast, if we lift a theorem about @{text "append"} to a theorem describing |
847 In contrast, lifting a theorem about @{text "append"} to a theorem describing |
846 the union of finite sets, then we need to discharge the proof obligation |
848 the union of finite sets will mean to discharge the proof obligation |
847 |
849 |
848 \begin{isabelle}\ \ \ \ \ %%% |
850 \begin{isabelle}\ \ \ \ \ %%% |
849 @{text "(\<approx>\<^bsub>list\<^esub> \<doublearr> \<approx>\<^bsub>list\<^esub> \<doublearr> \<approx>\<^bsub>list\<^esub>) append append"} |
851 @{text "(\<approx>\<^bsub>list\<^esub> \<doublearr> \<approx>\<^bsub>list\<^esub> \<doublearr> \<approx>\<^bsub>list\<^esub>) append append"} |
850 \end{isabelle} |
852 \end{isabelle} |
851 |
853 |
1005 equivalence relations. It is defined by simultaneous recursion on |
1007 equivalence relations. It is defined by simultaneous recursion on |
1006 the structure of the terms of @{text "raw_thm"} and @{text "quot_thm"} as follows: |
1008 the structure of the terms of @{text "raw_thm"} and @{text "quot_thm"} as follows: |
1007 % |
1009 % |
1008 \begin{center} |
1010 \begin{center} |
1009 \begin{tabular}{@ {}l@ {}} |
1011 \begin{tabular}{@ {}l@ {}} |
1010 \multicolumn{1}{@ {}l@ {}}{abstractions:}\smallskip\\ |
1012 \multicolumn{1}{@ {}l@ {}}{abstractions:}\\%%\smallskip\\ |
1011 @{text "REG (\<lambda>x\<^sup>\<sigma>. t, \<lambda>x\<^sup>\<tau>. s)"} $\dn$ |
1013 @{text "REG (\<lambda>x\<^sup>\<sigma>. t, \<lambda>x\<^sup>\<tau>. s)"} $\dn$ |
1012 $\begin{cases} |
1014 $\begin{cases} |
1013 @{text "\<lambda>x\<^sup>\<sigma>. REG (t, s)"} \quad\mbox{provided @{text "\<sigma> = \<tau>"}}\\ |
1015 @{text "\<lambda>x\<^sup>\<sigma>. REG (t, s)"} \quad\mbox{provided @{text "\<sigma> = \<tau>"}}\\ |
1014 @{text "\<lambda>x\<^sup>\<sigma> \<in> Resp (REL (\<sigma>, \<tau>)). REG (t, s)"} |
1016 @{text "\<lambda>x\<^sup>\<sigma> \<in> Resp (REL (\<sigma>, \<tau>)). REG (t, s)"} |
1015 \end{cases}$\smallskip\\ |
1017 \end{cases}$\\%%\smallskip\\ |
1016 \multicolumn{1}{@ {}l@ {}}{universal quantifiers:}\\ |
1018 \multicolumn{1}{@ {}l@ {}}{universal quantifiers:}\\ |
1017 @{text "REG (\<forall>x\<^sup>\<sigma>. t, \<forall>x\<^sup>\<tau>. s)"} $\dn$ |
1019 @{text "REG (\<forall>x\<^sup>\<sigma>. t, \<forall>x\<^sup>\<tau>. s)"} $\dn$ |
1018 $\begin{cases} |
1020 $\begin{cases} |
1019 @{text "\<forall>x\<^sup>\<sigma>. REG (t, s)"} \quad\mbox{provided @{text "\<sigma> = \<tau>"}}\\ |
1021 @{text "\<forall>x\<^sup>\<sigma>. REG (t, s)"} \quad\mbox{provided @{text "\<sigma> = \<tau>"}}\\ |
1020 @{text "\<forall>x\<^sup>\<sigma> \<in> Resp (REL (\<sigma>, \<tau>)). REG (t, s)"} |
1022 @{text "\<forall>x\<^sup>\<sigma> \<in> Resp (REL (\<sigma>, \<tau>)). REG (t, s)"} |
1021 \end{cases}$\smallskip\\ |
1023 \end{cases}$\\%%\smallskip\\ |
1022 \multicolumn{1}{@ {}l@ {}}{equality:}\smallskip\\ |
1024 \multicolumn{1}{@ {}l@ {}}{equality: \hspace{3mm}%%}\smallskip\\ |
1023 %% REL of two equal types is the equality so we do not need a separate case |
1025 %% REL of two equal types is the equality so we do not need a separate case |
1024 @{text "REG (=\<^bsup>\<sigma>\<Rightarrow>\<sigma>\<Rightarrow>bool\<^esup>, =\<^bsup>\<tau>\<Rightarrow>\<tau>\<Rightarrow>bool\<^esup>)"} $\dn$ @{text "REL (\<sigma>, \<tau>)"}\smallskip\\ |
1026 @{text "REG (=\<^bsup>\<sigma>\<Rightarrow>\<sigma>\<Rightarrow>bool\<^esup>, =\<^bsup>\<tau>\<Rightarrow>\<tau>\<Rightarrow>bool\<^esup>)"} $\dn$ @{text "REL (\<sigma>, \<tau>)"}}\smallskip\\ |
1025 \multicolumn{1}{@ {}l@ {}}{applications, variables and constants:}\\ |
1027 \multicolumn{1}{@ {}l@ {}}{applications, variables and constants:}\\ |
1026 @{text "REG (t\<^isub>1 t\<^isub>2, s\<^isub>1 s\<^isub>2)"} $\dn$ @{text "REG (t\<^isub>1, s\<^isub>1) REG (t\<^isub>2, s\<^isub>2)"}\\ |
1028 @{text "REG (t\<^isub>1 t\<^isub>2, s\<^isub>1 s\<^isub>2)"} $\dn$ @{text "REG (t\<^isub>1, s\<^isub>1) REG (t\<^isub>2, s\<^isub>2)"}\\ |
1027 @{text "REG (x\<^isub>1, x\<^isub>2)"} $\dn$ @{text "x\<^isub>1"}\\ |
1029 @{text "REG (x\<^isub>1, x\<^isub>2)"} $\dn$ @{text "x\<^isub>1"}\\ |
1028 @{text "REG (c\<^isub>1, c\<^isub>2)"} $\dn$ @{text "c\<^isub>1"}\\ |
1030 @{text "REG (c\<^isub>1, c\<^isub>2)"} $\dn$ @{text "c\<^isub>1"}\\ |
1029 \end{tabular} |
1031 \end{tabular} |
1234 useful in the new version of Nominal Isabelle, where such a choice is |
1236 useful in the new version of Nominal Isabelle, where such a choice is |
1235 required to generate a reasoning infrastructure for alpha-equated terms. |
1237 required to generate a reasoning infrastructure for alpha-equated terms. |
1236 %% |
1238 %% |
1237 %% give an example for this |
1239 %% give an example for this |
1238 %% |
1240 %% |
1239 \medskip |
1241 \smallskip |
1240 |
1242 |
1241 \noindent |
1243 \noindent |
1242 {\bf Acknowledgements:} We would like to thank Peter Homeier for the many |
1244 {\bf Acknowledgements:} We would like to thank Peter Homeier for the many |
1243 discussions about his HOL4 quotient package and explaining to us |
1245 discussions about his HOL4 quotient package.\\[-5mm]% and explaining to us |
1244 some of its finer points in the implementation. Without his patient |
1246 %some of its finer points in the implementation. Without his patient |
1245 help, this work would have been impossible. |
1247 %help, this work would have been impossible. |
1246 |
1248 |
1247 % \appendix |
1249 % \appendix |
1248 |
1250 |
1249 *} |
1251 *} |
1250 |
1252 |