307 of terms that are constructed specially (namely through axioms and proof |
309 of terms that are constructed specially (namely through axioms and proof |
308 rules). As a result we are able to define automatic proof |
310 rules). As a result we are able to define automatic proof |
309 procedures showing that one theorem implies another by decomposing the term |
311 procedures showing that one theorem implies another by decomposing the term |
310 underlying the first theorem. |
312 underlying the first theorem. |
311 |
313 |
312 Like Homeier, our work relies on map-functions defined for every type |
314 Like Homeier's, our work relies on map-functions defined for every type |
313 constructor taking some arguments, for example @{text map} for lists. Homeier |
315 constructor taking some arguments, for example @{text map} for lists. Homeier |
314 describes in \cite{Homeier05} map-functions for products, sums, options and |
316 describes in \cite{Homeier05} map-functions for products, sums, options and |
315 also the following map for function types |
317 also the following map for function types |
316 |
318 |
317 @{thm [display, indent=10] fun_map_def[no_vars, THEN eq_reflection]} |
319 @{thm [display, indent=10] fun_map_def[no_vars, THEN eq_reflection]} |
743 \end{isabelle} |
745 \end{isabelle} |
744 |
746 |
745 \noindent |
747 \noindent |
746 which is straightforward given the definition shown in \eqref{listequiv}. |
748 which is straightforward given the definition shown in \eqref{listequiv}. |
747 |
749 |
748 The second restriction we have to impose arises from |
750 The second restriction we have to impose arises from non-lifted polymorphic |
749 non-lifted polymorphic constants, which are instantiated to a |
751 constants, which are instantiated to a type being quotient. For example, |
750 type being quotient. For example, take the @{term "cons"}-constructor to |
752 take the @{term "cons"}-constructor to add a pair of natural numbers to a |
751 add a pair of natural numbers to a list, whereby the pair of natural numbers |
753 list, whereby we assume the pair of natural numbers turns into an integer in |
752 turns into an integer in the quotient construction. The point is that we |
754 the quotient construction. The point is that we still want to use @{text |
753 still want to use @{text cons} for |
755 cons} for adding integers to lists---just with a different type. To be able |
754 adding integers to lists---just with a different type. |
756 to lift such theorems, we need a \emph{preservation property} for @{text |
755 To be able to lift such theorems, we need a \emph{preservation property} |
757 cons}. Assuming we have a polymorphic raw constant @{text "c\<^isub>r :: \<sigma>"} |
756 for @{text cons}. Assuming we have a polymorphic raw constant |
758 and a corresponding quotient constant @{text "c\<^isub>q :: \<tau>"}, then a |
757 @{text "c\<^isub>r :: \<sigma>"} and a corresponding quotient constant @{text "c\<^isub>q :: \<tau>"}, |
759 preservation property is as follows |
758 then a preservation property is as follows |
760 |
759 |
761 |
760 @{text [display, indent=10] "Quotient R\<^bsub>\<alpha>s\<^esub> Abs\<^bsub>\<alpha>s\<^esub> Rep\<^bsub>\<alpha>s\<^esub> implies ABS (\<sigma>, \<tau>) c\<^isub>r = c\<^isub>r"} |
762 @{text [display, indent=10] "Quotient R\<^bsub>\<alpha>s\<^esub> Abs\<^bsub>\<alpha>s\<^esub> Rep\<^bsub>\<alpha>s\<^esub> implies ABS (\<sigma>, \<tau>) c\<^isub>r = c\<^isub>r"} |
761 |
763 |
762 \noindent |
764 \noindent |
763 where the @{text "\<alpha>s"} stand for the type variables in the type of @{text "c\<^isub>r"}. |
765 where the @{text "\<alpha>s"} stand for the type variables in the type of @{text "c\<^isub>r"}. |
1088 Both methods give the same result, namely |
1090 Both methods give the same result, namely |
1089 |
1091 |
1090 @{text [display, indent=10] "0 + x = x"} |
1092 @{text [display, indent=10] "0 + x = x"} |
1091 |
1093 |
1092 \noindent |
1094 \noindent |
|
1095 where @{text x} is of type integer. |
1093 Although seemingly simple, arriving at this result without the help of a quotient |
1096 Although seemingly simple, arriving at this result without the help of a quotient |
1094 package requires a substantial reasoning effort. |
1097 package requires a substantial reasoning effort (see \cite{Paulson06}). |
1095 *} |
1098 *} |
1096 |
1099 |
1097 section {* Conclusion and Related Work\label{sec:conc}*} |
1100 section {* Conclusion and Related Work\label{sec:conc}*} |
1098 |
1101 |
1099 text {* |
1102 text {* |
1100 |
1103 |
1101 The code of the quotient package and the examples described here are |
1104 The code of the quotient package and the examples described here are already |
1102 already included in the |
1105 included in the standard distribution of Isabelle.\footnote{Available from |
1103 standard distribution of Isabelle.\footnote{Available from |
1106 \href{http://isabelle.in.tum.de/}{http://isabelle.in.tum.de/}.} The package is |
1104 \href{http://isabelle.in.tum.de/}{http://isabelle.in.tum.de/}.} It is |
1107 heavily used in the new version of Nominal Isabelle, which provides a |
1105 heavily used in the new version of Nominal Isabelle, which provides a convenient reasoning |
1108 convenient reasoning infrastructure for programming language calculi |
1106 infrastructure for programming language calculi involving general binders. |
1109 involving general binders. To achieve this, it builds types representing |
1107 To achieve this, it builds types representing @{text \<alpha>}-equivalent terms. |
1110 @{text \<alpha>}-equivalent terms. Earlier versions of Nominal Isabelle have been |
1108 Earlier |
1111 used successfully in formalisations of an equivalence checking algorithm for |
1109 versions of Nominal Isabelle have been used successfully in formalisations |
1112 LF \cite{UrbanCheneyBerghofer08}, Typed |
1110 of an equivalence checking algorithm for LF \cite{UrbanCheneyBerghofer08}, |
1113 Scheme~\cite{TobinHochstadtFelleisen08}, several calculi for concurrency |
1111 Typed Scheme~\cite{TobinHochstadtFelleisen08}, several calculi for |
1114 \cite{BengtsonParow09} and a strong normalisation result for cut-elimination |
1112 concurrency \cite{BengtsonParow09} and a strong normalisation result for |
1115 in classical logic \cite{UrbanZhu08}. |
1113 cut-elimination in classical logic \cite{UrbanZhu08}. |
1116 |
1114 |
1117 |
1115 There is a wide range of existing of literature for dealing with |
1118 There is a wide range of existing literature for dealing with quotients |
1116 quotients in theorem provers. |
1119 in theorem provers. Slotosch~\cite{Slotosch97} implemented a mechanism that |
1117 Slotosch~\cite{Slotosch97} implemented a mechanism that automatically |
1120 automatically defines quotient types for Isabelle/HOL. But he did not |
1118 defines quotient types for Isabelle/HOL. But he did not include theorem lifting. |
1121 include theorem lifting. Harrison's quotient package~\cite{harrison-thesis} |
1119 Harrison's quotient package~\cite{harrison-thesis} is the first one that is |
1122 is the first one that is able to automatically lift theorems, however only |
1120 able to automatically lift theorems, however only first-order theorems (that is theorems |
1123 first-order theorems (that is theorems where abstractions, quantifiers and |
1121 where abstractions, quantifiers and variables do not involve functions that |
1124 variables do not involve functions that include the quotient type). There is |
1122 include the quotient type). |
1125 also some work on quotient types in non-HOL based systems and logical |
1123 There is also some work on quotient types in |
1126 frameworks, including theory interpretations in |
1124 non-HOL based systems and logical frameworks, including theory interpretations |
1127 PVS~\cite{PVS:Interpretations}, new types in MetaPRL~\cite{Nogin02}, and |
1125 in PVS~\cite{PVS:Interpretations}, new types in MetaPRL~\cite{Nogin02}, |
1128 setoids in Coq \cite{ChicliPS02}. Paulson showed a construction of |
1126 and setoids in Coq \cite{ChicliPS02}. |
1129 quotients that does not require the Hilbert Choice operator, but also only |
1127 Paulson showed a construction of quotients that does not require the |
1130 first-order theorems can be lifted~\cite{Paulson06}. The most related work |
1128 Hilbert Choice operator, but also only first-order theorems can be lifted~\cite{Paulson06}. |
1131 to our package is the package for HOL4 by Homeier~\cite{Homeier05}. He |
1129 The most related work to our package is the package for HOL4 by Homeier~\cite{Homeier05}. |
1132 introduced most of the abstract notions about quotients and also deals with |
1130 He introduced most of the abstract notions about quotients and also deals with |
1133 lifting of higher-order theorems. However, he cannot deal with quotient |
1131 lifting of higher-order theorems. However, he cannot deal with quotient compositions (needed |
1134 compositions (needed for lifting theorems about @{text flat}). Also, a |
1132 for lifting theorems about @{text flat}). Also, a number of his definitions, like @{text ABS}, |
1135 number of his definitions, like @{text ABS}, @{text REP} and @{text INJ} etc |
1133 @{text REP} and @{text INJ} etc only exist in \cite{Homeier05} as ML-code, not included |
1136 only exist in \cite{Homeier05} as ML-code, not included in the paper. |
1134 in the paper. |
1137 |
1135 |
1138 |
1136 One feature of our quotient package is that when lifting theorems, the user can |
1139 One feature of our quotient package is that when lifting theorems, the user |
1137 precisely specify what the lifted theorem should look like. This feature is |
1140 can precisely specify what the lifted theorem should look like. This feature |
1138 necessary, for example, when lifting an induction principle for two lists. |
1141 is necessary, for example, when lifting an induction principle for two |
1139 Assuming this principle has as the conclusion a predicate of the form @{text "P xs ys"}, |
1142 lists. Assuming this principle has as the conclusion a predicate of the |
1140 then we can precisely specify whether we want to quotient @{text "xs"} or @{text "ys"}, |
1143 form @{text "P xs ys"}, then we can precisely specify whether we want to |
1141 or both. We found this feature very useful in the new version of Nominal |
1144 quotient @{text "xs"} or @{text "ys"}, or both. We found this feature very |
1142 Isabelle, where such a choice is required to generate a resoning infrastructure |
1145 useful in the new version of Nominal Isabelle, where such a choice is |
1143 for alpha-equated terms. |
1146 required to generate a reasoning infrastructure for alpha-equated terms. |
1144 %% |
1147 %% |
1145 %% give an example for this |
1148 %% give an example for this |
1146 %% |
1149 %% |
1147 \medskip |
1150 \medskip |
1148 |
1151 |