# HG changeset patch # User Christian Urban # Date 1279377864 -3600 # Node ID 34af7f2ca490efa033b580308d5959651cec77d0 # Parent 46be4145b922304c22459df3eb902cb159cbd227 some minor changes diff -r 46be4145b922 -r 34af7f2ca490 Quotient-Paper/Paper.thy --- a/Quotient-Paper/Paper.thy Sat Jul 17 12:01:04 2010 +0100 +++ b/Quotient-Paper/Paper.thy Sat Jul 17 15:44:24 2010 +0100 @@ -243,10 +243,10 @@ representation and abstraction functions, which in case of @{text "\"} generate the following definition - @{text [display, indent=10] "\ S \ Abs_fset (flat ((map Rep_fset \ Rep_fset) S))"} + @{text [display, indent=10] "\ S \ Abs_fset (flat ((map_list Rep_fset \ Rep_fset) S))"} \noindent - where @{term map} is the usual mapping function for lists. In this paper we + where @{term map_list} is the usual mapping function for lists. In this paper we will present a formal definition of our aggregate abstraction and representation functions (this definition was omitted in \cite{Homeier05}). They generate definitions, like the one above for @{text "\"}, @@ -312,7 +312,7 @@ underlying the first theorem. Like Homeier's, our work relies on map-functions defined for every type - constructor taking some arguments, for example @{text map} for lists. Homeier + constructor taking some arguments, for example @{text map_list} for lists. Homeier describes in \cite{Homeier05} map-functions for products, sums, options and also the following map for function types @@ -414,7 +414,7 @@ composing @{text "\\<^bsub>list\<^esub>"} will be necessary: given @{term "Quotient R Abs Rep"} with @{text R} being an equivalence relation, then - @{text [display, indent=10] "Quotient (rel_list R \\\ \\<^bsub>list\<^esub>) (Abs_fset \ map Abs) (map Rep \ Rep_fset)"} + @{text [display, indent=2] "Quotient (rel_list R \\\ \\<^bsub>list\<^esub>) (Abs_fset \ map_list Abs) (map_list Rep \ Rep_fset)"} \vspace{-.5mm} *} @@ -543,20 +543,21 @@ \multicolumn{3}{@ {\hspace{-4mm}}l}{equal type constructors:}\\ @{text "ABS (\s \, \s \)"} & $\dn$ & @{text "map_\ (ABS (\s, \s))"}\\ @{text "REP (\s \, \s \)"} & $\dn$ & @{text "map_\ (REP (\s, \s))"}\smallskip\\ - \multicolumn{3}{@ {\hspace{-4mm}}l}{unequal type constructors:}\\ + \multicolumn{3}{@ {\hspace{-4mm}}l}{unequal type constructors with @{text "\s + \\<^isub>q"} being the quotient of the raw type @{text "\s \"}:}\\ @{text "ABS (\s \, \s \\<^isub>q)"} & $\dn$ & @{text "Abs_\\<^isub>q \ (MAP(\s \) (ABS (\s', \s)))"}\\ @{text "REP (\s \, \s \\<^isub>q)"} & $\dn$ & @{text "(MAP(\s \) (REP (\s', \s))) \ Rep_\\<^isub>q"} \end{tabular}\hfill\numbered{ABSREP} \end{center} % \noindent - In the last two clauses we have that the type @{text "\s + In the last two clauses we rely on the fact that the type @{text "\s \\<^isub>q"} is the quotient of the raw type @{text "\s \"} (for example @{text "int"} and @{text "nat \ nat"}, or @{text "\ fset"} and @{text "\ list"}). The quotient construction ensures that the type variables in @{text - "\s"} must be among the @{text "\s"}. The @{text "\s'"} are given by the - matchers for the @{text "\s"} when matching @{text "\s \"} against - @{text "\s \"}. The + "\s \"} must be among the @{text "\s"}. The @{text "\s'"} are given by the + substitutions for the @{text "\s"} when matching @{text "\s \"} against + @{text "\s \"}. The function @{text "MAP"} calculates an \emph{aggregate map-function} for a raw type as follows: % @@ -579,7 +580,7 @@ In this case @{text MAP} generates the aggregate map-function: - @{text [display, indent=10] "\a b. map_prod (map a) b"} + @{text [display, indent=10] "\a b. map_prod (map_list a) b"} \noindent which is essential in order to define the corresponding aggregate @@ -591,20 +592,20 @@ fset"}. Feeding these types into @{text ABS} gives us (after some @{text "\"}-simplifications) the abstraction function - @{text [display, indent=10] "(map (map id \ Rep_fset) \ Rep_fset) \ Abs_fset \ map id"} + @{text [display, indent=10] "(map_list (map_list id \ Rep_fset) \ Rep_fset) \ Abs_fset \ map_list id"} \noindent In our implementation we further simplify this function by rewriting with the usual laws about @{text - "map"}s and @{text "id"}, namely @{term "map id = id"} and @{text "f \ id = + "map"}s and @{text "id"}, for example @{term "map_list id = id"} and @{text "f \ id = id \ f = f"}. This gives us the simpler abstraction function - @{text [display, indent=10] "(map Rep_fset \ Rep_fset) \ Abs_fset"} + @{text [display, indent=10] "(map_list Rep_fset \ Rep_fset) \ Abs_fset"} \noindent which we can use for defining @{term "fconcat"} as follows - @{text [display, indent=10] "\ \ ((map Rep_fset \ Rep_fset) \ Abs_fset) flat"} + @{text [display, indent=10] "\ \ ((map_list Rep_fset \ Rep_fset) \ Abs_fset) flat"} \noindent Note that by using the operator @{text "\"} and special clauses @@ -686,7 +687,8 @@ @{text "REL (\, \)"} & $\dn$ & @{text "= :: \ \ \ \ bool"}\smallskip\\ \multicolumn{3}{@ {\hspace{-4mm}}l}{equal type constructors:}\\ @{text "REL (\s \, \s \)"} & $\dn$ & @{text "rel_\ (REL (\s, \s))"}\smallskip\\ - \multicolumn{3}{@ {\hspace{-4mm}}l}{unequal type constructors:}\smallskip\\ + \multicolumn{3}{@ {\hspace{-4mm}}l}{unequal type constructors with @{text "\s + \\<^isub>q"} being the quotient of the raw type @{text "\s \"}:}\smallskip\\ @{text "REL (\s \, \s \\<^isub>q)"} & $\dn$ & @{text "rel_\\<^isub>q (REL (\s', \s))"}\\ \end{tabular}\hfill\numbered{REL} \end{center} @@ -694,7 +696,7 @@ \noindent The @{text "\s'"} in the last clause are calculated as in \eqref{ABSREP}: we know that type @{text "\s \\<^isub>q"} is the quotient of the raw type - @{text "\s \"}. The @{text "\s'"} are determined by matching + @{text "\s \"}. The @{text "\s'"} are the substitutions for @{text "\s"} obtained by matching @{text "\s \"} and @{text "\s \"}. Let us return to the lifting procedure of theorems. Assume we have a theorem @@ -762,7 +764,7 @@ where the @{text "\s"} stand for the type variables in the type of @{text "c\<^isub>r"}. In case of @{text cons} (which has type @{text "\ \ \ list \ \ list"}) we have - @{text [display, indent=10] "(Rep ---> map Rep ---> map Abs) cons = cons"} + @{text [display, indent=10] "(Rep ---> map_list Rep ---> map_list Abs) cons = cons"} \noindent under the assumption @{text "Quotient R Abs Rep"}. Interestingly, if we have @@ -792,7 +794,7 @@ %If @ {term R} is an equivalence relation and @ {term "Quotient R Abs Rep"} %then % - %@ {text [display, indent=10] "Quotient (list_rel R \\\ \\<^bsub>list\<^esub>) (abs_fset \ map Abs) (map Rep o rep_fset)"} + %@ {text [display, indent=10] "Quotient (list_rel R \\\ \\<^bsub>list\<^esub>) (abs_fset \ map_list Abs) (map_list Rep o rep_fset)"} %%% %%%\noindent %%%this theorem will then instantiate the quotients needed in the