# HG changeset patch # User Christian Urban # Date 1276443632 -7200 # Node ID ad725de6e39be8ee6cbb51d743abbd6589298806 # Parent 8035515bbbc6df9f0854bb4fc0b9ed57439182ce more on the constant lifting section diff -r 8035515bbbc6 -r ad725de6e39b Quotient-Paper/Paper.thy --- a/Quotient-Paper/Paper.thy Sun Jun 13 17:01:15 2010 +0200 +++ b/Quotient-Paper/Paper.thy Sun Jun 13 17:40:32 2010 +0200 @@ -305,42 +305,59 @@ type, say @{text "\\<^isub>q"}, and an equivalence relation defined over a raw type, say @{text "\"}. The equivalence relation for the quotient construction, lets say @{text "R"}, must then be of type @{text "\ \ \ \ - bool"}. Given this data, we can automatically declare the quotient type as + bool"}. The user-visible part of the declaration is therefore + \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% + \isacommand{quotient\_type}~~@{text "\s \\<^isub>q = \ / R"} + \end{isabelle} + + \noindent + and a proof that @{text "R"} is indeed an equivalence relation. + Given this data, we can internally declare the quotient type as \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% \isacommand{typedef}~~@{text "\s \\<^isub>q = {c. \x. c = R x}"} \end{isabelle} \noindent - being the set of equivalence classes of @{text "R"}. The restriction in this declaration - is that the type variables in the raw type @{text "\"} must be included in the - type variables @{text "\s"} declared for @{text "\\<^isub>q"}. HOL will provide us - with abstraction and representation functions having the type + being the (non-empty) set of equivalence classes of @{text "R"}. The + restriction in this declaration is that the type variables in the raw type + @{text "\"} must be included in the type variables @{text "\s"} declared for + @{text "\\<^isub>q"}. HOL will provide us with abstraction and + representation functions having the type \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% @{text "abs_\\<^isub>q :: \ set \ \s \\<^isub>q"}\hspace{10mm}@{text "rep_\\<^isub>q :: \s \\<^isub>q \ \ set"} \end{isabelle} - \noindent - relating the new quotient type and raw type. However, as Homeier noted, it is easier - to work with the following derived definitions - + \noindent + and relating the new quotient type and equivalence classes of the raw + type. However, as Homeier \cite{Homeier05} noted, it is much more convenient + to work with the following derived abstraction and representation functions + \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% @{text "Abs_\\<^isub>q x \ abs_\\<^isub>q (R x)"}\hspace{10mm}@{text "Rep_\\<^isub>q x \ \ (rep_\\<^isub>q x)"} \end{isabelle} \noindent - on the expense of having to use Hilbert's choice operator @{text "\"}. With these - definitions the abstraction and representation functions relate directly the - quotient and raw types (their type is @{text "\ \ \s \\<^isub>q"} and @{text "\s \\<^isub>q \ \"}, - respectively). We can show that the property + on the expense of having to use Hilbert's choice operator @{text "\"} in the + definition of @{text "Rep_\\<^isub>q"}. These derived notions relate the quotient type + and the raw type directly, as can be seen from their type, namely @{text "\ + \ \s \\<^isub>q"} and @{text "\s \\<^isub>q \ \"}, respectively. Given that + @{text "R"} is an equivalence relation, the following property @{text [display, indent=10] "Quotient R Abs_\\<^isub>q Rep_\\<^isub>q"} \noindent holds (for the proof see \cite{Homeier05}). + The next step is to lift definitions over the raw type to definitions over the + quotient type. For this we providing the declaration + + \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% + \isacommand{quotient\_definition}~~@{text "c :: \"}~\isacommand{is}~@{text "c' :: \"} + \end{isabelle} + To define a constant on the lifted type, an aggregate abstraction function is applied to the raw constant. Below we describe the operation that generates @@ -415,7 +432,7 @@ where we already performed some @{text "\"}-simplifications. In our implementation we further simplified this by noticing the usual laws about @{text "map"}s and @{text "id"}, namely @{term "map id = id"} and - @{text "f \ id = id \ f = f"}. This gives us the simplified abstarction function + @{text "f \ id = id \ f = f"}. This gives us the simplified abstraction function @{text [display, indent=10] "(map Rep_fset \ Rep_fset) \ Abs_fset"} @@ -439,7 +456,7 @@ For every type map function we require the property that @{term "map id = id"}. With this we can compactify the term, removing the identity mappings, - obtaining a definition that is the same as the one privided by Homeier + obtaining a definition that is the same as the one provided by Homeier in the cases where the internal type does not change. {\it we should be able to prove}