Quotient-Paper-jv/Paper.thy
changeset 3095 9e7047159f43
parent 3094 8bad9887ad90
child 3114 a9a4baa7779f
equal deleted inserted replaced
3091:578e0265b235 3095:9e7047159f43
   126   \noindent
   126   \noindent
   127   This constructions yields the new type @{typ int}, and definitions for @{text
   127   This constructions yields the new type @{typ int}, and definitions for @{text
   128   "0"} and @{text "1"} of type @{typ int} can be given in terms of pairs of
   128   "0"} and @{text "1"} of type @{typ int} can be given in terms of pairs of
   129   natural numbers (namely @{text "(0, 0)"} and @{text "(1, 0)"}). Operations
   129   natural numbers (namely @{text "(0, 0)"} and @{text "(1, 0)"}). Operations
   130   such as @{text "add"} with type @{typ "int \<Rightarrow> int \<Rightarrow> int"} can be defined in
   130   such as @{text "add"} with type @{typ "int \<Rightarrow> int \<Rightarrow> int"} can be defined in
   131   terms of operations on pairs of natural numbers (namely @{text
   131   terms of operations on pairs of natural numbers:
   132   "add_pair (n\<^isub>1, m\<^isub>1) (n\<^isub>2,
   132 
   133   m\<^isub>2) \<equiv> (n\<^isub>1 + n\<^isub>2, m\<^isub>1 + m\<^isub>2)"}).
   133   \begin{isabelle}\ \ \ \ \ %%%
   134   Similarly one can construct %%the type of
   134   @{text "add_pair (n\<^isub>1, m\<^isub>1) (n\<^isub>2, m\<^isub>2) \<equiv> (n\<^isub>1 + n\<^isub>2, m\<^isub>1 + m\<^isub>2)"}
       
   135   \end{isabelle}
       
   136 
       
   137   \noindent
       
   138   Similarly one can construct the type of
   135   finite sets, written @{term "\<alpha> fset"},
   139   finite sets, written @{term "\<alpha> fset"},
   136   by quotienting the type @{text "\<alpha> list"} according to the equivalence relation
   140   by quotienting the type @{text "\<alpha> list"} according to the equivalence relation
   137 
   141 
   138   \begin{isabelle}\ \ \ \ \ %%%
   142   \begin{isabelle}\ \ \ \ \ %%%
   139   @{text "xs \<approx> ys \<equiv> (\<forall>x. memb x xs \<longleftrightarrow> memb x ys)"}\hfill\numbered{listequiv}
   143   @{text "xs \<approx> ys \<equiv> (\<forall>x. memb x xs \<longleftrightarrow> memb x ys)"}\hfill\numbered{listequiv}
   162   $\alpha$-equated lambda-terms, that means terms quotient according to
   166   $\alpha$-equated lambda-terms, that means terms quotient according to
   163   $\alpha$-equivalence, then the reasoning infrastructure provided,
   167   $\alpha$-equivalence, then the reasoning infrastructure provided,
   164   for example, by Nominal Isabelle %%\cite{UrbanKaliszyk11}
   168   for example, by Nominal Isabelle %%\cite{UrbanKaliszyk11}
   165   makes the formal
   169   makes the formal
   166   proof of the substitution lemma almost trivial.
   170   proof of the substitution lemma almost trivial.
       
   171 
       
   172   {\bf MAYBE AN EAMPLE FOR PARTIAL QUOTIENTS?}
       
   173 
   167 
   174 
   168   The difficulty is that in order to be able to reason about integers, finite
   175   The difficulty is that in order to be able to reason about integers, finite
   169   sets or $\alpha$-equated lambda-terms one needs to establish a reasoning
   176   sets or $\alpha$-equated lambda-terms one needs to establish a reasoning
   170   infrastructure by transferring, or \emph{lifting}, definitions and theorems
   177   infrastructure by transferring, or \emph{lifting}, definitions and theorems
   171   from the raw type @{typ "nat \<times> nat"} to the quotient type @{typ int}
   178   from the raw type @{typ "nat \<times> nat"} to the quotient type @{typ int}
   316   according to the type of the raw constant and the type
   323   according to the type of the raw constant and the type
   317   of the quotient constant. This means we also have to extend the notions
   324   of the quotient constant. This means we also have to extend the notions
   318   of \emph{aggregate equivalence relation}, \emph{respectfulness} and \emph{preservation}
   325   of \emph{aggregate equivalence relation}, \emph{respectfulness} and \emph{preservation}
   319   from Homeier \cite{Homeier05}.
   326   from Homeier \cite{Homeier05}.
   320 
   327 
       
   328   {\bf EXAMPLE BY HUFFMAN ABOUT @{thm map_concat}}
       
   329 
   321   In addition we are able to clearly specify what is involved
   330   In addition we are able to clearly specify what is involved
   322   in the lifting process (this was only hinted at in \cite{Homeier05} and
   331   in the lifting process (this was only hinted at in \cite{Homeier05} and
   323   implemented as a ``rough recipe'' in ML-code). A pleasing side-result
   332   implemented as a ``rough recipe'' in ML-code). A pleasing side-result
   324   is that our procedure for lifting theorems is completely deterministic
   333   is that our procedure for lifting theorems is completely deterministic
   325   following the structure of the theorem being lifted and the theorem
   334   following the structure of the theorem being lifted and the theorem
   326   on the quotient level. Space constraints, unfortunately, allow us to only
   335   on the quotient level. {\it Space constraints, unfortunately, allow us to only
   327   sketch this part of our work in Section 5 and we defer the reader to a longer
   336   sketch this part of our work in Section 5 and we defer the reader to a longer
   328   version for the details. However, we will give in Section 3 and 4 all
   337   version for the details.} However, we will give in Section 3 and 4 all
   329   definitions that specify the input and output data of our three-step
   338   definitions that specify the input and output data of our three-step
   330   lifting procedure. Appendix A gives an example how our quotient
   339   lifting procedure. Appendix A gives an example how our quotient
   331   package works in practise.
   340   package works in practise.
   332 *}
   341 *}
   333 
   342 
   334 section {* Preliminaries and General\\ Quotients\label{sec:prelims} *}
   343 section {* Preliminaries and General Quotients\label{sec:prelims} *}
   335 
   344 
   336 text {*
   345 text {*
   337   \noindent
   346   \noindent
   338   We will give in this section a crude overview of HOL and describe the main
   347   We will give in this section a crude overview of HOL and describe the main
   339   definitions given by Homeier for quotients \cite{Homeier05}.
   348   definitions given by Homeier for quotients \cite{Homeier05}.
   496                   & @{text "(Abs_fset \<circ> map_list Abs)"} @{text "(map_list Rep \<circ> Rep_fset)"}\\
   505                   & @{text "(Abs_fset \<circ> map_list Abs)"} @{text "(map_list Rep \<circ> Rep_fset)"}\\
   497   \end{tabular}
   506   \end{tabular}
   498   \end{isabelle}
   507   \end{isabelle}
   499 *}
   508 *}
   500 
   509 
   501 section {* Quotient Types and Quotient\\ Definitions\label{sec:type} *}
   510 section {* Quotient Types and Quotient Definitions\label{sec:type} *}
   502 
   511 
   503 text {*
   512 text {*
   504   \noindent
   513   \noindent
   505   The first step in a quotient construction is to take a name for the new
   514   The first step in a quotient construction is to take a name for the new
   506   type, say @{text "\<kappa>\<^isub>q"}, and an equivalence relation, say @{text R},
   515   type, say @{text "\<kappa>\<^isub>q"}, and an equivalence relation, say @{text R},
   756   equivalent to @{text "\<sigma>s \<kappa> \<Rightarrow> \<rho>s[\<tau>s] \<kappa>"}, which we just have to compose with
   765   equivalent to @{text "\<sigma>s \<kappa> \<Rightarrow> \<rho>s[\<tau>s] \<kappa>"}, which we just have to compose with
   757   @{text "\<rho>s[\<tau>s] \<kappa> \<Rightarrow> \<tau>s \<kappa>\<^isub>q"} according to the type of @{text "\<circ>"}.\qed
   766   @{text "\<rho>s[\<tau>s] \<kappa> \<Rightarrow> \<tau>s \<kappa>\<^isub>q"} according to the type of @{text "\<circ>"}.\qed
   758   \end{proof}
   767   \end{proof}
   759 *}
   768 *}
   760 
   769 
   761 section {* Respectfulness and\\ Preservation \label{sec:resp} *}
   770 section {* Respectfulness and Preservation \label{sec:resp} *}
   762 
   771 
   763 text {*
   772 text {*
   764   \noindent
   773   \noindent
   765   The main point of the quotient package is to automatically ``lift'' theorems
   774   The main point of the quotient package is to automatically ``lift'' theorems
   766   involving constants over the raw type to theorems involving constants over
   775   involving constants over the raw type to theorems involving constants over
  1208   LF \cite{UrbanCheneyBerghofer08}, Typed
  1217   LF \cite{UrbanCheneyBerghofer08}, Typed
  1209   Scheme~\cite{TobinHochstadtFelleisen08}, several calculi for concurrency
  1218   Scheme~\cite{TobinHochstadtFelleisen08}, several calculi for concurrency
  1210   \cite{BengtsonParow09} and a strong normalisation result for cut-elimination
  1219   \cite{BengtsonParow09} and a strong normalisation result for cut-elimination
  1211   in classical logic \cite{UrbanZhu08}.
  1220   in classical logic \cite{UrbanZhu08}.
  1212 
  1221 
       
  1222   {\bf INSTEAD OF NOMINAL WORK, GIVE WORK BY BULWAHN ET AL?}
  1213 
  1223 
  1214   There is a wide range of existing literature for dealing with quotients
  1224   There is a wide range of existing literature for dealing with quotients
  1215   in theorem provers.  Slotosch~\cite{Slotosch97} implemented a mechanism that
  1225   in theorem provers.  Slotosch~\cite{Slotosch97} implemented a mechanism that
  1216   automatically defines quotient types for Isabelle/HOL. But he did not
  1226   automatically defines quotient types for Isabelle/HOL. But he did not
  1217   include theorem lifting.  Harrison's quotient package~\cite{harrison-thesis}
  1227   include theorem lifting.  Harrison's quotient package~\cite{harrison-thesis}
  1353   \noindent
  1363   \noindent
  1354   Both methods give the same result, namely @{text "0 + x = x"}
  1364   Both methods give the same result, namely @{text "0 + x = x"}
  1355   where @{text x} is of type integer.
  1365   where @{text x} is of type integer.
  1356   Although seemingly simple, arriving at this result without the help of a quotient
  1366   Although seemingly simple, arriving at this result without the help of a quotient
  1357   package requires a substantial reasoning effort (see \cite{Paulson06}).
  1367   package requires a substantial reasoning effort (see \cite{Paulson06}).
       
  1368 
       
  1369   {\bf \begin{itemize}
       
  1370   \item Type maps and Relation maps (show the case for functions)
       
  1371   \item Quotient extensions
       
  1372   \item Respectfulness and preservation
       
  1373   - Show special cases for quantifiers and lambda
       
  1374   \item Quotient-type locale
       
  1375   - Show the proof as much simpler than Homeier's one
       
  1376   \item ??? Infrastructure for storing theorems (rsp, prs, eqv, quot and idsimp)
       
  1377   \item Lifting vs Descending vs quot\_lifted
       
  1378   - automatic theorem translation heuristic
       
  1379   \item Partial equivalence quotients
       
  1380   - Bounded abstraction
       
  1381   - Respects
       
  1382   - partial descending
       
  1383   \item The heuristics for automatic regularization, injection and cleaning.
       
  1384   \item A complete example of a lifted theorem together with the regularized
       
  1385   injected and cleaned statement
       
  1386   \item Examples of quotients and properties that we used the package for.
       
  1387   \item co/contra-variance from Ondrej should be taken into account
       
  1388   \end{itemize}}
  1358 *}
  1389 *}
  1359 
  1390 
  1360 
  1391 
  1361 
  1392 
  1362 (*<*)
  1393 (*<*)