Quotient-Paper/Paper.thy
changeset 2429 b29eb13d3f9d
parent 2423 f5cbf74d4ec5
child 2437 319f469b8b67
equal deleted inserted replaced
2428:58e60df1ff79 2429:b29eb13d3f9d
   149 
   149 
   150 %%% FIXME: Referee 1 says:
   150 %%% FIXME: Referee 1 says:
   151 %%% Diagram is unclear.  Firstly, isn't an existing type a "set (not sets) of raw elements"?
   151 %%% Diagram is unclear.  Firstly, isn't an existing type a "set (not sets) of raw elements"?
   152 %%% Secondly, isn't the _set of_ equivalence classes mapped to and from the new type?
   152 %%% Secondly, isn't the _set of_ equivalence classes mapped to and from the new type?
   153 %%% Thirdly, what do the words "non-empty subset" refer to ?
   153 %%% Thirdly, what do the words "non-empty subset" refer to ?
       
   154 
       
   155 %%% Cezary: I like the diagram, maybe 'new type' could be outside, but otherwise
       
   156 %%% I wouldn't change it.
   154 
   157 
   155   \begin{center}
   158   \begin{center}
   156   \mbox{}\hspace{20mm}\begin{tikzpicture}
   159   \mbox{}\hspace{20mm}\begin{tikzpicture}
   157   %%\draw[step=2mm] (-4,-1) grid (4,1);
   160   %%\draw[step=2mm] (-4,-1) grid (4,1);
   158   
   161   
   594   The need for aggregate map-functions can be seen in cases where we build quotients, 
   597   The need for aggregate map-functions can be seen in cases where we build quotients, 
   595   say @{text "(\<alpha>, \<beta>) \<kappa>\<^isub>q"}, out of compound raw types, say @{text "(\<alpha> list) \<times> \<beta>"}. 
   598   say @{text "(\<alpha>, \<beta>) \<kappa>\<^isub>q"}, out of compound raw types, say @{text "(\<alpha> list) \<times> \<beta>"}. 
   596   In this case @{text MAP} generates  the 
   599   In this case @{text MAP} generates  the 
   597   aggregate map-function:
   600   aggregate map-function:
   598 
   601 
       
   602 %%% FIXME: Reviewer 2 asks: last two lines defining ABS and REP for
       
   603 %%% unequal type constructors: How are the $\varrho$s defined? The
       
   604 %%% following paragraph mentions them, but this paragraph is unclear,
       
   605 %%% since it then mentions $\alpha$s, which do not seem to be defined
       
   606 %%% either. As a result, I do not understand the first two sentences
       
   607 %%% in this paragraph. I can imagine roughly what the following
       
   608 %%% sentence `The $\sigma$s' are given by the matchers for the
       
   609 %%% $\alpha$s$ when matching $\varrho$s $\kappa$ against $\sigma$s
       
   610 %%% $\kappa$.' means, but also think that it is too vague.
       
   611 
   599   @{text [display, indent=10] "\<lambda>a b. map_prod (map_list a) b"}
   612   @{text [display, indent=10] "\<lambda>a b. map_prod (map_list a) b"}
   600   
   613   
   601   \noindent
   614   \noindent
   602   which is essential in order to define the corresponding aggregate 
   615   which is essential in order to define the corresponding aggregate 
   603   abstraction and representation functions.
   616   abstraction and representation functions.
   691   "\<alpha>"}-equated lambda terms. Homeier formulates the restrictions in terms of
   704   "\<alpha>"}-equated lambda terms. Homeier formulates the restrictions in terms of
   692   the properties of \emph{respectfulness} and \emph{preservation}. We have
   705   the properties of \emph{respectfulness} and \emph{preservation}. We have
   693   to slightly extend Homeier's definitions in order to deal with quotient
   706   to slightly extend Homeier's definitions in order to deal with quotient
   694   compositions. 
   707   compositions. 
   695 
   708 
       
   709 %%% FIXME: Reviewer 3 asks why are the definitions that follow enough to deal
       
   710 %%% with quotient composition.
       
   711 
   696   To formally define what respectfulness is, we have to first define 
   712   To formally define what respectfulness is, we have to first define 
   697   the notion of \emph{aggregate equivalence relations} using the function @{text "REL(\<sigma>, \<tau>)"}
   713   the notion of \emph{aggregate equivalence relations} using the function @{text "REL(\<sigma>, \<tau>)"}
   698   The idea behind this function is to simultaneously descend into the raw types
   714   The idea behind this function is to simultaneously descend into the raw types
   699   @{text \<sigma>} and quotient types @{text \<tau>}, and generate the appropriate
   715   @{text \<sigma>} and quotient types @{text \<tau>}, and generate the appropriate
   700   quotient equivalence relations in places where the types differ and equalities
   716   quotient equivalence relations in places where the types differ and equalities
   775   to lift such theorems, we need a \emph{preservation property} for @{text
   791   to lift such theorems, we need a \emph{preservation property} for @{text
   776   cons}. Assuming we have a polymorphic raw constant @{text "c\<^isub>r :: \<sigma>"}
   792   cons}. Assuming we have a polymorphic raw constant @{text "c\<^isub>r :: \<sigma>"}
   777   and a corresponding quotient constant @{text "c\<^isub>q :: \<tau>"}, then a
   793   and a corresponding quotient constant @{text "c\<^isub>q :: \<tau>"}, then a
   778   preservation property is as follows
   794   preservation property is as follows
   779 
   795 
       
   796 %%% FIXME: Reviewer 2 asks: You say what a preservation theorem is,
       
   797 %%% but not which preservation theorems you assume. Do you generate a
       
   798 %%% proof obligation for a preservation theorem for each raw constant
       
   799 %%% and its corresponding lifted constant?
       
   800 
       
   801 %%% Cezary: I think this would be a nice thing to do but we have not
       
   802 %%% done it, the theorems need to be 'guessed' from the remaining obligations
   780 
   803 
   781   @{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"}
   804   @{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"}
   782 
   805 
   783   \noindent
   806   \noindent
   784   where the @{text "\<alpha>s"} stand for the type variables in the type of @{text "c\<^isub>r"}.
   807   where the @{text "\<alpha>s"} stand for the type variables in the type of @{text "c\<^isub>r"}.
   824 
   847 
   825 section {* Lifting of Theorems\label{sec:lift} *}
   848 section {* Lifting of Theorems\label{sec:lift} *}
   826 
   849 
   827 text {*
   850 text {*
   828 
   851 
       
   852 %%% FIXME Reviewer 3 asks: Section 5 shows the technicalities of
       
   853 %%% lifting theorems. But there is no clarification about the
       
   854 %%% correctness. A reader would also be interested in seeing some
       
   855 %%% discussions about the generality and limitation of the approach
       
   856 %%% proposed there
       
   857 
   829   The main benefit of a quotient package is to lift automatically theorems over raw
   858   The main benefit of a quotient package is to lift automatically theorems over raw
   830   types to theorems over quotient types. We will perform this lifting in
   859   types to theorems over quotient types. We will perform this lifting in
   831   three phases, called \emph{regularization},
   860   three phases, called \emph{regularization},
   832   \emph{injection} and \emph{cleaning} according to procedures in Homeier's ML-code.
   861   \emph{injection} and \emph{cleaning} according to procedures in Homeier's ML-code.
   833 
   862 
   837   and @{term Abs} of appropriate types in front of constants and variables
   866   and @{term Abs} of appropriate types in front of constants and variables
   838   of the raw type so that they can be replaced by the corresponding constants from the
   867   of the raw type so that they can be replaced by the corresponding constants from the
   839   quotient type. The purpose of cleaning is to bring the theorem derived in the
   868   quotient type. The purpose of cleaning is to bring the theorem derived in the
   840   first two phases into the form the user has specified. Abstractly, our
   869   first two phases into the form the user has specified. Abstractly, our
   841   package establishes the following three proof steps:
   870   package establishes the following three proof steps:
       
   871 
       
   872 %%% FIXME: Reviewer 1 complains that the reader needs to guess the
       
   873 %%% meaning of reg_thm and inj_thm, as well as the arguments of REG
       
   874 %%% which are given above. I wouldn't change it.
   842 
   875 
   843   \begin{center}
   876   \begin{center}
   844   \begin{tabular}{l@ {\hspace{4mm}}l}
   877   \begin{tabular}{l@ {\hspace{4mm}}l}
   845   1.) Regularization & @{text "raw_thm \<longrightarrow> reg_thm"}\\
   878   1.) Regularization & @{text "raw_thm \<longrightarrow> reg_thm"}\\
   846   2.) Injection & @{text "reg_thm \<longleftrightarrow> inj_thm"}\\
   879   2.) Injection & @{text "reg_thm \<longleftrightarrow> inj_thm"}\\
   949 
   982 
   950   \noindent 
   983   \noindent 
   951   In this definition we again omitted the cases for existential and unique existential
   984   In this definition we again omitted the cases for existential and unique existential
   952   quantifiers. 
   985   quantifiers. 
   953 
   986 
       
   987 %%% FIXME: Reviewer2 citing following sentence: You mention earlier
       
   988 %%% that this implication may fail to be true. Does that meant that
       
   989 %%% the `first proof step' is a heuristic that proves the implication
       
   990 %%% raw_thm \implies reg_thm in some instances, but fails in others?
       
   991 %%% You should clarify under which circumstances the implication is
       
   992 %%% being proved here.
       
   993 %%% Cezary: It would be nice to cite Homeiers discussions in the
       
   994 %%% Quotient Package manual from HOL (the longer paper), do you agree?
       
   995 
   954   In the first proof step, establishing @{text "raw_thm \<longrightarrow> reg_thm"}, we always 
   996   In the first proof step, establishing @{text "raw_thm \<longrightarrow> reg_thm"}, we always 
   955   start with an implication. Isabelle provides \emph{mono} rules that can split up 
   997   start with an implication. Isabelle provides \emph{mono} rules that can split up 
   956   the implications into simpler implicational subgoals. This succeeds for every
   998   the implications into simpler implicational subgoals. This succeeds for every
   957   monotone connective, except in places where the function @{text REG} replaced,
   999   monotone connective, except in places where the function @{text REG} replaced,
   958   for instance, a quantifier by a bounded quantifier. In this case we have 
  1000   for instance, a quantifier by a bounded quantifier. In this case we have 
   968 
  1010 
   969   @{text [display, indent=10] "\<forall>x \<in> Respects R. P x = \<forall>x. P x"}    
  1011   @{text [display, indent=10] "\<forall>x \<in> Respects R. P x = \<forall>x. P x"}    
   970 
  1012 
   971   \noindent
  1013   \noindent
   972   If @{term R\<^isub>2} is an equivalence relation, we can prove that for any predicate @{term P}
  1014   If @{term R\<^isub>2} is an equivalence relation, we can prove that for any predicate @{term P}
       
  1015 
       
  1016 %%% FIXME Reviewer 1 claims the theorem is obviously false so maybe we
       
  1017 %%% should include a proof sketch?
   973 
  1018 
   974   @{thm [display, indent=10] (concl) ball_reg_eqv_range[of R\<^isub>1 R\<^isub>2, no_vars]}
  1019   @{thm [display, indent=10] (concl) ball_reg_eqv_range[of R\<^isub>1 R\<^isub>2, no_vars]}
   975 
  1020 
   976   \noindent
  1021   \noindent
   977   The last theorem is new in comparison with Homeier's package. There the
  1022   The last theorem is new in comparison with Homeier's package. There the
  1028   *}
  1073   *}
  1029 
  1074 
  1030 
  1075 
  1031 section {* Examples \label{sec:examples} *}
  1076 section {* Examples \label{sec:examples} *}
  1032 
  1077 
  1033 (* Mention why equivalence *)
       
  1034 
       
  1035 text {*
  1078 text {*
       
  1079 
       
  1080 %%% FIXME Reviewer 1 would like an example of regularized and injected
       
  1081 %%% statements. He asks for the examples twice, but I would still ignore
       
  1082 %%% it due to lack of space...
  1036 
  1083 
  1037   In this section we will show a sequence of declarations for defining the 
  1084   In this section we will show a sequence of declarations for defining the 
  1038   type of integers by quotienting pairs of natural numbers, and
  1085   type of integers by quotienting pairs of natural numbers, and
  1039   lifting one theorem. 
  1086   lifting one theorem. 
  1040 
  1087 
  1159   only exist in \cite{Homeier05} as ML-code, not included in the paper.
  1206   only exist in \cite{Homeier05} as ML-code, not included in the paper.
  1160   Like Homeier's, our quotient package can deal with partial equivalence
  1207   Like Homeier's, our quotient package can deal with partial equivalence
  1161   relations, but for lack of space we do not describe the mechanisms
  1208   relations, but for lack of space we do not describe the mechanisms
  1162   needed for this kind of quotient constructions.
  1209   needed for this kind of quotient constructions.
  1163 
  1210 
       
  1211 %%% FIXME Reviewer 3 would like to know more about the lifting in Coq and PVS,
       
  1212 %%% and some comparison. I don't think we have the space for any additions...
  1164 
  1213 
  1165   One feature of our quotient package is that when lifting theorems, the user
  1214   One feature of our quotient package is that when lifting theorems, the user
  1166   can precisely specify what the lifted theorem should look like. This feature
  1215   can precisely specify what the lifted theorem should look like. This feature
  1167   is necessary, for example, when lifting an induction principle for two
  1216   is necessary, for example, when lifting an induction principle for two
  1168   lists.  Assuming this principle has as the conclusion a predicate of the
  1217   lists.  Assuming this principle has as the conclusion a predicate of the