Quotient-Paper/Paper.thy
changeset 2277 816204c76e90
parent 2276 0d561216f1f9
child 2278 337569f85398
equal deleted inserted replaced
2276:0d561216f1f9 2277:816204c76e90
   255 
   255 
   256 
   256 
   257   The paper is organised as follows: Section \ref{sec:prelims} presents briefly
   257   The paper is organised as follows: Section \ref{sec:prelims} presents briefly
   258   some necessary preliminaries; Section \ref{sec:type} describes the definitions 
   258   some necessary preliminaries; Section \ref{sec:type} describes the definitions 
   259   of quotient types and shows how definitions of constants can be made over 
   259   of quotient types and shows how definitions of constants can be made over 
   260   quotient types. Section \ref{sec:resp} introduces the notions of respectfullness
   260   quotient types. Section \ref{sec:resp} introduces the notions of respectfulness
   261   and preservation; Section \ref{sec:lift} describes the lifting of theorems;
   261   and preservation; Section \ref{sec:lift} describes the lifting of theorems;
   262   Section \ref{sec:examples} presents some examples
   262   Section \ref{sec:examples} presents some examples
   263   and Section \ref{sec:conc} concludes and compares our results to existing 
   263   and Section \ref{sec:conc} concludes and compares our results to existing 
   264   work.
   264   work.
   265 *}
   265 *}
   656   \noindent
   656   \noindent
   657   We can generate a definition for this constant using @{text ABS} and @{text REP}.
   657   We can generate a definition for this constant using @{text ABS} and @{text REP}.
   658   But this constant does \emph{not} respect @{text "\<alpha>"}-equivalence and 
   658   But this constant does \emph{not} respect @{text "\<alpha>"}-equivalence and 
   659   consequently no theorem involving this constant can be lifted to @{text
   659   consequently no theorem involving this constant can be lifted to @{text
   660   "\<alpha>"}-equated lambda terms. Homeier formulates the restrictions in terms of
   660   "\<alpha>"}-equated lambda terms. Homeier formulates the restrictions in terms of
   661   the properties of \emph{respectfullness} and \emph{preservation}. We have
   661   the properties of \emph{respectfulness} and \emph{preservation}. We have
   662   to slightly extend Homeier's definitions in order to deal with quotient
   662   to slightly extend Homeier's definitions in order to deal with quotient
   663   compositions. 
   663   compositions. 
   664 
   664 
   665   To formally define what respectfulness is, we have to first define 
   665   To formally define what respectfulness is, we have to first define 
   666   the notion of \emph{aggregate equivalence relations} using @{text REL}:
   666   the notion of \emph{aggregate equivalence relations} using @{text REL}:
   690   we throw the following proof obligation
   690   we throw the following proof obligation
   691 
   691 
   692   @{text [display, indent=10] "REL (\<sigma>, \<tau>) c\<^isub>r c\<^isub>r"}
   692   @{text [display, indent=10] "REL (\<sigma>, \<tau>) c\<^isub>r c\<^isub>r"}
   693 
   693 
   694   %%% PROBLEM I do not yet completely understand the 
   694   %%% PROBLEM I do not yet completely understand the 
   695   %%% form of respectfullness theorems
   695   %%% form of respectfulness theorems
   696   %%%\noindent
   696   %%%\noindent
   697   %%%if @ {text \<sigma>} and @ {text \<tau>} have no type variables. In case they have, then
   697   %%%if @ {text \<sigma>} and @ {text \<tau>} have no type variables. In case they have, then
   698   %%%the proof obligation is of the form
   698   %%%the proof obligation is of the form
   699   %%% 
   699   %%% 
   700   %%%@ {text [display, indent=10] "Quotient R\<^bsub>\<alpha>s\<^esub> Abs\<^bsub>\<alpha>s\<^esub> Rep\<^bsub>\<alpha>s\<^esub>  implies  REL (\<sigma>, \<tau>) c\<^isub>r c\<^isub>r"}
   700   %%%@ {text [display, indent=10] "Quotient R\<^bsub>\<alpha>s\<^esub> Abs\<^bsub>\<alpha>s\<^esub> Rep\<^bsub>\<alpha>s\<^esub>  implies  REL (\<sigma>, \<tau>) c\<^isub>r c\<^isub>r"}
   701 
   701 
       
   702   %%% ANSWER: The respectfulness theorems never have any quotient assumptions,
       
   703   %%% So the commited version is ok.
       
   704 
   702   \noindent
   705   \noindent
   703   %%%where @ {text "\<alpha>s"} are the type variables in @{text \<sigma>} and @{text \<tau>}.
   706   %%%where @ {text "\<alpha>s"} are the type variables in @{text \<sigma>} and @{text \<tau>}.
   704   Homeier calls these proof obligations \emph{respectfullness
   707   Homeier calls these proof obligations \emph{respectfulness
   705   theorems}. Before lifting a theorem, we require the user to discharge
   708   theorems}. Before lifting a theorem, we require the user to discharge
   706   them. And the point with @{text bn} is that the respectfullness theorem
   709   them. And the point with @{text bn} is that the respectfulness theorem
   707   looks as follows
   710   looks as follows
   708 
   711 
   709   @{text [display, indent=10] "(\<approx>\<^isub>\<alpha> \<doublearr> =) bn bn"}
   712   @{text [display, indent=10] "(\<approx>\<^isub>\<alpha> \<doublearr> =) bn bn"}
   710 
   713 
   711   \noindent
   714   \noindent
   753   @{text [display, indent=10] "(Rep ---> map Rep ---> map Abs) cons = cons"}
   756   @{text [display, indent=10] "(Rep ---> map Rep ---> map Abs) cons = cons"}
   754 
   757 
   755   \noindent
   758   \noindent
   756   under the assumption @{text "Quotient R Abs Rep"}.
   759   under the assumption @{text "Quotient R Abs Rep"}.
   757 
   760 
       
   761   %%% ANSWER
       
   762   %%% There are 3 things needed to lift things that involve composition of quotients
       
   763   %%% - The compositional quotient theorem
       
   764   %%% - Compositional respectfullness theorems
       
   765   %%% - and compositional preservation theorems.
       
   766   %%% And the case of preservation for nil is special, because we prove some property
       
   767   %%% of all elements in an empty list, so any property is true so we can write it
       
   768   %%% more general, but a version restricted to the particular quotient is true as well
   758 
   769 
   759   %%% PROBLEM I do not understand this
   770   %%% PROBLEM I do not understand this
   760   %%%This is not enough to lift theorems that talk about quotient compositions.
   771   %%%This is not enough to lift theorems that talk about quotient compositions.
   761   %%%For some constants (for example empty list) it is possible to show a
   772   %%%For some constants (for example empty list) it is possible to show a
   762   %%%general compositional theorem, but for @ {term "op #"} it is necessary
   773   %%%general compositional theorem, but for @ {term "op #"} it is necessary
   949   The injection proof starts with an equality between the regularized theorem
   960   The injection proof starts with an equality between the regularized theorem
   950   and the injected version. The proof again follows by the structure of the
   961   and the injected version. The proof again follows by the structure of the
   951   two terms, and is defined for a goal being a relation between these two terms.
   962   two terms, and is defined for a goal being a relation between these two terms.
   952 
   963 
   953   \begin{itemize}
   964   \begin{itemize}
   954   \item For two constants, an appropriate constant respectfullness assumption is used.
   965   \item For two constants, an appropriate constant respectfulness assumption is used.
   955   \item For two variables, we use the assumptions proved in regularization.
   966   \item For two variables, we use the assumptions proved in regularization.
   956   \item For two abstractions, they are eta-expanded and beta-reduced.
   967   \item For two abstractions, they are eta-expanded and beta-reduced.
   957   \item For two applications, if the right side is an application of
   968   \item For two applications, if the right side is an application of
   958     @{term Rep} to an @{term Abs} and @{term "Quotient R Rep Abs"} we
   969     @{term Rep} to an @{term Abs} and @{term "Quotient R Rep Abs"} we
   959     can reduce the injected pair using the theorem:
   970     can reduce the injected pair using the theorem:
  1111   Our quotient package for the first time explore the notion of
  1122   Our quotient package for the first time explore the notion of
  1112   composition of quotients, which allows lifting constants like @{term
  1123   composition of quotients, which allows lifting constants like @{term
  1113   "concat"} and theorems about it. We defined the composition of
  1124   "concat"} and theorems about it. We defined the composition of
  1114   relations and showed examples of compositions of quotients which
  1125   relations and showed examples of compositions of quotients which
  1115   allows lifting polymorphic types with subtypes quotiented as well.
  1126   allows lifting polymorphic types with subtypes quotiented as well.
  1116   We extended the notions of respectfullness and preservation;
  1127   We extended the notions of respectfulness and preservation;
  1117   with quotient compositions there is more than one condition needed
  1128   with quotient compositions there is more than one condition needed
  1118   for a constant.
  1129   for a constant.
  1119 
  1130 
  1120   Our package is modularized, so that single definitions, single
  1131   Our package is modularized, so that single definitions, single
  1121   theorems or single respectfullness conditions etc can be added,
  1132   theorems or single respectfulness conditions etc can be added,
  1122   which allows the use of the quotient package together with
  1133   which allows the use of the quotient package together with
  1123   type-classes and locales. This has the advantage over packages
  1134   type-classes and locales. This has the advantage over packages
  1124   requiring big lists as input for the user of being able to develop
  1135   requiring big lists as input for the user of being able to develop
  1125   a theory progressively.
  1136   a theory progressively.
  1126 
  1137 
  1133   has not been presented before.
  1144   has not been presented before.
  1134 
  1145 
  1135   \medskip
  1146   \medskip
  1136   \noindent
  1147   \noindent
  1137   {\bf Acknowledgements:} We would like to thank Peter Homeier for the
  1148   {\bf Acknowledgements:} We would like to thank Peter Homeier for the
  1138   discussions about his HOL4 quotient package and explaining to us 
  1149   discussions about his HOL4 quotient package and explaining to us
  1139   some its finer points in the implementation.
  1150   some of its finer points in the implementation.
  1140 
  1151 
  1141 *}
  1152 *}
  1142 
  1153 
  1143 
  1154 
  1144 
  1155