| author | wenzelm | 
| Tue, 20 Dec 2016 09:52:01 +0100 | |
| changeset 64612 | 08e4b1aeac50 | 
| parent 59936 | b8ffc3dc9e24 | 
| child 67632 | 3b94553353ae | 
| permissions | -rw-r--r-- | 
| 37744 | 1 | (* Title: HOL/Tools/Quotient/quotient_info.ML | 
| 35222 
4f1fba00f66d
Initial version of HOL quotient package.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: diff
changeset | 2 | Author: Cezary Kaliszyk and Christian Urban | 
| 
4f1fba00f66d
Initial version of HOL quotient package.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: diff
changeset | 3 | |
| 45279 | 4 | Context data for the quotient package. | 
| 35222 
4f1fba00f66d
Initial version of HOL quotient package.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: diff
changeset | 5 | *) | 
| 
4f1fba00f66d
Initial version of HOL quotient package.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: diff
changeset | 6 | |
| 
4f1fba00f66d
Initial version of HOL quotient package.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: diff
changeset | 7 | signature QUOTIENT_INFO = | 
| 
4f1fba00f66d
Initial version of HOL quotient package.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: diff
changeset | 8 | sig | 
| 47094 | 9 |   type quotmaps = {relmap: string, quot_thm: thm}
 | 
| 45280 | 10 | val lookup_quotmaps: Proof.context -> string -> quotmaps option | 
| 45340 
98ec8b51af9c
prefer global Quotient_Info lookup to accomodate Quotient_Term, which is not quite localized yet (cf. 9fd6fce8a230);
 wenzelm parents: 
45294diff
changeset | 11 | val lookup_quotmaps_global: theory -> string -> quotmaps option | 
| 45279 | 12 | val print_quotmaps: Proof.context -> unit | 
| 35222 
4f1fba00f66d
Initial version of HOL quotient package.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: diff
changeset | 13 | |
| 45534 
4ab21521b393
adding database of abs and rep terms to the quotient package; registering abs and rep terms in quotient_type and using them in quotient_definition
 bulwahn parents: 
45350diff
changeset | 14 |   type abs_rep = {abs : term, rep : term}
 | 
| 
4ab21521b393
adding database of abs and rep terms to the quotient package; registering abs and rep terms in quotient_type and using them in quotient_definition
 bulwahn parents: 
45350diff
changeset | 15 | val transform_abs_rep: morphism -> abs_rep -> abs_rep | 
| 
4ab21521b393
adding database of abs and rep terms to the quotient package; registering abs and rep terms in quotient_type and using them in quotient_definition
 bulwahn parents: 
45350diff
changeset | 16 | val lookup_abs_rep: Proof.context -> string -> abs_rep option | 
| 
4ab21521b393
adding database of abs and rep terms to the quotient package; registering abs and rep terms in quotient_type and using them in quotient_definition
 bulwahn parents: 
45350diff
changeset | 17 | val lookup_abs_rep_global: theory -> string -> abs_rep option | 
| 59157 | 18 | val update_abs_rep: string * abs_rep -> Context.generic -> Context.generic | 
| 45534 
4ab21521b393
adding database of abs and rep terms to the quotient package; registering abs and rep terms in quotient_type and using them in quotient_definition
 bulwahn parents: 
45350diff
changeset | 19 | val print_abs_rep: Proof.context -> unit | 
| 59157 | 20 | |
| 47093 | 21 |   type quotients = {qtyp: typ, rtyp: typ, equiv_rel: term, equiv_thm: thm, quot_thm: thm}
 | 
| 45279 | 22 | val transform_quotients: morphism -> quotients -> quotients | 
| 45280 | 23 | val lookup_quotients: Proof.context -> string -> quotients option | 
| 45340 
98ec8b51af9c
prefer global Quotient_Info lookup to accomodate Quotient_Term, which is not quite localized yet (cf. 9fd6fce8a230);
 wenzelm parents: 
45294diff
changeset | 24 | val lookup_quotients_global: theory -> string -> quotients option | 
| 59157 | 25 | val update_quotients: string * quotients -> Context.generic -> Context.generic | 
| 45279 | 26 | val dest_quotients: Proof.context -> quotients list | 
| 27 | val print_quotients: Proof.context -> unit | |
| 35222 
4f1fba00f66d
Initial version of HOL quotient package.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: diff
changeset | 28 | |
| 45279 | 29 |   type quotconsts = {qconst: term, rconst: term, def: thm}
 | 
| 30 | val transform_quotconsts: morphism -> quotconsts -> quotconsts | |
| 45340 
98ec8b51af9c
prefer global Quotient_Info lookup to accomodate Quotient_Term, which is not quite localized yet (cf. 9fd6fce8a230);
 wenzelm parents: 
45294diff
changeset | 31 | val lookup_quotconsts_global: theory -> term -> quotconsts option | 
| 59157 | 32 | val update_quotconsts: string * quotconsts -> Context.generic -> Context.generic | 
| 45350 
257d0b179f0d
more use of global operations (see 98ec8b51af9c)
 Christian Urban <urbanc@in.tum.de> parents: 
45340diff
changeset | 33 | val dest_quotconsts_global: theory -> quotconsts list | 
| 45279 | 34 | val dest_quotconsts: Proof.context -> quotconsts list | 
| 35 | val print_quotconsts: Proof.context -> unit | |
| 35222 
4f1fba00f66d
Initial version of HOL quotient package.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: diff
changeset | 36 | end; | 
| 
4f1fba00f66d
Initial version of HOL quotient package.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: diff
changeset | 37 | |
| 
4f1fba00f66d
Initial version of HOL quotient package.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: diff
changeset | 38 | structure Quotient_Info: QUOTIENT_INFO = | 
| 
4f1fba00f66d
Initial version of HOL quotient package.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: diff
changeset | 39 | struct | 
| 
4f1fba00f66d
Initial version of HOL quotient package.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: diff
changeset | 40 | |
| 
4f1fba00f66d
Initial version of HOL quotient package.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: diff
changeset | 41 | (** data containers **) | 
| 
4f1fba00f66d
Initial version of HOL quotient package.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: diff
changeset | 42 | |
| 59157 | 43 | (*info about map- and rel-functions for a type*) | 
| 47094 | 44 | type quotmaps = {relmap: string, quot_thm: thm}
 | 
| 35222 
4f1fba00f66d
Initial version of HOL quotient package.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: diff
changeset | 45 | |
| 59157 | 46 | (*info about abs/rep terms*) | 
| 47 | type abs_rep = {abs : term, rep : term}
 | |
| 48 | fun transform_abs_rep phi {abs, rep} : abs_rep =
 | |
| 49 |   {abs = Morphism.term phi abs, rep = Morphism.term phi rep}
 | |
| 50 | ||
| 51 | (*info about quotient types*) | |
| 52 | type quotients = {qtyp: typ, rtyp: typ, equiv_rel: term, equiv_thm: thm, quot_thm: thm}
 | |
| 53 | fun transform_quotients phi {qtyp, rtyp, equiv_rel, equiv_thm, quot_thm} : quotients =
 | |
| 54 |   {qtyp = Morphism.typ phi qtyp,
 | |
| 55 | rtyp = Morphism.typ phi rtyp, | |
| 56 | equiv_rel = Morphism.term phi equiv_rel, | |
| 57 | equiv_thm = Morphism.thm phi equiv_thm, | |
| 58 | quot_thm = Morphism.thm phi quot_thm} | |
| 59 | ||
| 60 | (*info about quotient constants*) | |
| 61 | (*We need to be able to lookup instances of lifted constants, | |
| 62 | for example given "nat fset" we need to find "'a fset"; | |
| 63 | but overloaded constants share the same name.*) | |
| 64 | type quotconsts = {qconst: term, rconst: term, def: thm}
 | |
| 65 | fun eq_quotconsts (x: quotconsts, y: quotconsts) = #qconst x = #qconst y | |
| 66 | fun transform_quotconsts phi {qconst, rconst, def} : quotconsts =
 | |
| 67 |   {qconst = Morphism.term phi qconst,
 | |
| 68 | rconst = Morphism.term phi rconst, | |
| 69 | def = Morphism.thm phi def} | |
| 70 | ||
| 71 | structure Data = Generic_Data | |
| 38759 
37a9092de102
simplification/standardization of some theory data;
 wenzelm parents: 
38756diff
changeset | 72 | ( | 
| 59157 | 73 | type T = | 
| 74 | quotmaps Symtab.table * | |
| 75 | abs_rep Symtab.table * | |
| 76 | quotients Symtab.table * | |
| 77 | quotconsts list Symtab.table | |
| 78 | val empty: T = (Symtab.empty, Symtab.empty, Symtab.empty, Symtab.empty) | |
| 38759 
37a9092de102
simplification/standardization of some theory data;
 wenzelm parents: 
38756diff
changeset | 79 | val extend = I | 
| 59157 | 80 | fun merge | 
| 81 | ((quotmaps1, abs_rep1, quotients1, quotconsts1), | |
| 82 | (quotmaps2, abs_rep2, quotients2, quotconsts2)) : T = | |
| 83 | (Symtab.merge (K true) (quotmaps1, quotmaps2), | |
| 84 | Symtab.merge (K true) (abs_rep1, abs_rep2), | |
| 85 | Symtab.merge (K true) (quotients1, quotients2), | |
| 86 | Symtab.merge_list eq_quotconsts (quotconsts1, quotconsts2)) | |
| 38759 
37a9092de102
simplification/standardization of some theory data;
 wenzelm parents: 
38756diff
changeset | 87 | ) | 
| 35222 
4f1fba00f66d
Initial version of HOL quotient package.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: diff
changeset | 88 | |
| 59157 | 89 | val get_quotmaps = #1 o Data.get | 
| 90 | val get_abs_rep = #2 o Data.get | |
| 91 | val get_quotients = #3 o Data.get | |
| 92 | val get_quotconsts = #4 o Data.get | |
| 93 | ||
| 94 | val map_quotmaps = Data.map o @{apply 4(1)}
 | |
| 95 | val map_abs_rep = Data.map o @{apply 4(2)}
 | |
| 96 | val map_quotients = Data.map o @{apply 4(3)}
 | |
| 97 | val map_quotconsts = Data.map o @{apply 4(4)}
 | |
| 98 | ||
| 99 | ||
| 100 | (* quotmaps *) | |
| 101 | ||
| 102 | val lookup_quotmaps = Symtab.lookup o get_quotmaps o Context.Proof | |
| 103 | val lookup_quotmaps_global = Symtab.lookup o get_quotmaps o Context.Theory | |
| 35222 
4f1fba00f66d
Initial version of HOL quotient package.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: diff
changeset | 104 | |
| 45281 | 105 | (* FIXME export proper internal update operation!? *) | 
| 35222 
4f1fba00f66d
Initial version of HOL quotient package.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: diff
changeset | 106 | |
| 57960 | 107 | val _ = | 
| 108 | Theory.setup | |
| 109 |    (Attrib.setup @{binding mapQ3}
 | |
| 110 |       ((Args.type_name {proper = true, strict = true} --| Scan.lift @{keyword "="}) --
 | |
| 111 |         (Scan.lift @{keyword "("} |--
 | |
| 112 |           Args.const {proper = true, strict = true} --| Scan.lift @{keyword ","} --
 | |
| 113 |           Attrib.thm --| Scan.lift @{keyword ")"}) >>
 | |
| 114 | (fn (tyname, (relname, qthm)) => | |
| 115 |           let val minfo = {relmap = relname, quot_thm = qthm}
 | |
| 59157 | 116 | in Thm.declaration_attribute (fn _ => map_quotmaps (Symtab.update (tyname, minfo))) end)) | 
| 57960 | 117 | "declaration of map information") | 
| 35222 
4f1fba00f66d
Initial version of HOL quotient package.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: diff
changeset | 118 | |
| 45279 | 119 | fun print_quotmaps ctxt = | 
| 41444 | 120 | let | 
| 47094 | 121 |     fun prt_map (ty_name, {relmap, quot_thm}) =
 | 
| 41445 | 122 | Pretty.block (separate (Pretty.brk 2) | 
| 59157 | 123 | [Pretty.str "type:", | 
| 47094 | 124 | Pretty.str ty_name, | 
| 59157 | 125 | Pretty.str "relation map:", | 
| 47094 | 126 | Pretty.str relmap, | 
| 59157 | 127 | Pretty.str "quot. theorem:", | 
| 59582 | 128 | Syntax.pretty_term ctxt (Thm.prop_of quot_thm)]) | 
| 41444 | 129 | in | 
| 59157 | 130 | map prt_map (Symtab.dest (get_quotmaps (Context.Proof ctxt))) | 
| 41444 | 131 | |> Pretty.big_list "maps for type constructors:" | 
| 132 | |> Pretty.writeln | |
| 133 | end | |
| 35222 
4f1fba00f66d
Initial version of HOL quotient package.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: diff
changeset | 134 | |
| 59157 | 135 | |
| 136 | (* abs_rep *) | |
| 45534 
4ab21521b393
adding database of abs and rep terms to the quotient package; registering abs and rep terms in quotient_type and using them in quotient_definition
 bulwahn parents: 
45350diff
changeset | 137 | |
| 59157 | 138 | val lookup_abs_rep = Symtab.lookup o get_abs_rep o Context.Proof | 
| 139 | val lookup_abs_rep_global = Symtab.lookup o get_abs_rep o Context.Theory | |
| 45534 
4ab21521b393
adding database of abs and rep terms to the quotient package; registering abs and rep terms in quotient_type and using them in quotient_definition
 bulwahn parents: 
45350diff
changeset | 140 | |
| 59157 | 141 | val update_abs_rep = map_abs_rep o Symtab.update | 
| 45534 
4ab21521b393
adding database of abs and rep terms to the quotient package; registering abs and rep terms in quotient_type and using them in quotient_definition
 bulwahn parents: 
45350diff
changeset | 142 | |
| 
4ab21521b393
adding database of abs and rep terms to the quotient package; registering abs and rep terms in quotient_type and using them in quotient_definition
 bulwahn parents: 
45350diff
changeset | 143 | fun print_abs_rep ctxt = | 
| 
4ab21521b393
adding database of abs and rep terms to the quotient package; registering abs and rep terms in quotient_type and using them in quotient_definition
 bulwahn parents: 
45350diff
changeset | 144 | let | 
| 
4ab21521b393
adding database of abs and rep terms to the quotient package; registering abs and rep terms in quotient_type and using them in quotient_definition
 bulwahn parents: 
45350diff
changeset | 145 |     fun prt_abs_rep (s, {abs, rep}) =
 | 
| 
4ab21521b393
adding database of abs and rep terms to the quotient package; registering abs and rep terms in quotient_type and using them in quotient_definition
 bulwahn parents: 
45350diff
changeset | 146 | Pretty.block (separate (Pretty.brk 2) | 
| 
4ab21521b393
adding database of abs and rep terms to the quotient package; registering abs and rep terms in quotient_type and using them in quotient_definition
 bulwahn parents: 
45350diff
changeset | 147 | [Pretty.str "type constructor:", | 
| 
4ab21521b393
adding database of abs and rep terms to the quotient package; registering abs and rep terms in quotient_type and using them in quotient_definition
 bulwahn parents: 
45350diff
changeset | 148 | Pretty.str s, | 
| 
4ab21521b393
adding database of abs and rep terms to the quotient package; registering abs and rep terms in quotient_type and using them in quotient_definition
 bulwahn parents: 
45350diff
changeset | 149 | Pretty.str "abs term:", | 
| 
4ab21521b393
adding database of abs and rep terms to the quotient package; registering abs and rep terms in quotient_type and using them in quotient_definition
 bulwahn parents: 
45350diff
changeset | 150 | Syntax.pretty_term ctxt abs, | 
| 
4ab21521b393
adding database of abs and rep terms to the quotient package; registering abs and rep terms in quotient_type and using them in quotient_definition
 bulwahn parents: 
45350diff
changeset | 151 | Pretty.str "rep term:", | 
| 
4ab21521b393
adding database of abs and rep terms to the quotient package; registering abs and rep terms in quotient_type and using them in quotient_definition
 bulwahn parents: 
45350diff
changeset | 152 | Syntax.pretty_term ctxt rep]) | 
| 
4ab21521b393
adding database of abs and rep terms to the quotient package; registering abs and rep terms in quotient_type and using them in quotient_definition
 bulwahn parents: 
45350diff
changeset | 153 | in | 
| 59157 | 154 | map prt_abs_rep (Symtab.dest (get_abs_rep (Context.Proof ctxt))) | 
| 45534 
4ab21521b393
adding database of abs and rep terms to the quotient package; registering abs and rep terms in quotient_type and using them in quotient_definition
 bulwahn parents: 
45350diff
changeset | 155 | |> Pretty.big_list "abs/rep terms:" | 
| 
4ab21521b393
adding database of abs and rep terms to the quotient package; registering abs and rep terms in quotient_type and using them in quotient_definition
 bulwahn parents: 
45350diff
changeset | 156 | |> Pretty.writeln | 
| 
4ab21521b393
adding database of abs and rep terms to the quotient package; registering abs and rep terms in quotient_type and using them in quotient_definition
 bulwahn parents: 
45350diff
changeset | 157 | end | 
| 35222 
4f1fba00f66d
Initial version of HOL quotient package.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: diff
changeset | 158 | |
| 
4f1fba00f66d
Initial version of HOL quotient package.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: diff
changeset | 159 | |
| 59157 | 160 | (* quotients *) | 
| 35222 
4f1fba00f66d
Initial version of HOL quotient package.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: diff
changeset | 161 | |
| 59157 | 162 | val lookup_quotients = Symtab.lookup o get_quotients o Context.Proof | 
| 163 | val lookup_quotients_global = Symtab.lookup o get_quotients o Context.Theory | |
| 35222 
4f1fba00f66d
Initial version of HOL quotient package.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: diff
changeset | 164 | |
| 59157 | 165 | val update_quotients = map_quotients o Symtab.update | 
| 35222 
4f1fba00f66d
Initial version of HOL quotient package.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: diff
changeset | 166 | |
| 59157 | 167 | fun dest_quotients ctxt = | 
| 168 | map snd (Symtab.dest (get_quotients (Context.Proof ctxt))) | |
| 35222 
4f1fba00f66d
Initial version of HOL quotient package.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: diff
changeset | 169 | |
| 45279 | 170 | fun print_quotients ctxt = | 
| 41444 | 171 | let | 
| 47093 | 172 |     fun prt_quot {qtyp, rtyp, equiv_rel, equiv_thm, quot_thm} =
 | 
| 41445 | 173 | Pretty.block (separate (Pretty.brk 2) | 
| 41444 | 174 | [Pretty.str "quotient type:", | 
| 175 | Syntax.pretty_typ ctxt qtyp, | |
| 176 | Pretty.str "raw type:", | |
| 177 | Syntax.pretty_typ ctxt rtyp, | |
| 178 | Pretty.str "relation:", | |
| 179 | Syntax.pretty_term ctxt equiv_rel, | |
| 180 | Pretty.str "equiv. thm:", | |
| 59582 | 181 | Syntax.pretty_term ctxt (Thm.prop_of equiv_thm), | 
| 47093 | 182 | Pretty.str "quot. thm:", | 
| 59582 | 183 | Syntax.pretty_term ctxt (Thm.prop_of quot_thm)]) | 
| 41444 | 184 | in | 
| 59157 | 185 | map (prt_quot o snd) (Symtab.dest (get_quotients (Context.Proof ctxt))) | 
| 41444 | 186 | |> Pretty.big_list "quotients:" | 
| 187 | |> Pretty.writeln | |
| 188 | end | |
| 35222 
4f1fba00f66d
Initial version of HOL quotient package.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: diff
changeset | 189 | |
| 
4f1fba00f66d
Initial version of HOL quotient package.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: diff
changeset | 190 | |
| 59157 | 191 | (* quotconsts *) | 
| 35222 
4f1fba00f66d
Initial version of HOL quotient package.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: diff
changeset | 192 | |
| 59157 | 193 | val update_quotconsts = map_quotconsts o Symtab.cons_list | 
| 45280 | 194 | |
| 195 | fun dest_quotconsts ctxt = | |
| 59157 | 196 | maps snd (Symtab.dest (get_quotconsts (Context.Proof ctxt))) | 
| 35222 
4f1fba00f66d
Initial version of HOL quotient package.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: diff
changeset | 197 | |
| 45350 
257d0b179f0d
more use of global operations (see 98ec8b51af9c)
 Christian Urban <urbanc@in.tum.de> parents: 
45340diff
changeset | 198 | fun dest_quotconsts_global thy = | 
| 59157 | 199 | maps snd (Symtab.dest (get_quotconsts (Context.Theory thy))) | 
| 45350 
257d0b179f0d
more use of global operations (see 98ec8b51af9c)
 Christian Urban <urbanc@in.tum.de> parents: 
45340diff
changeset | 200 | |
| 45340 
98ec8b51af9c
prefer global Quotient_Info lookup to accomodate Quotient_Term, which is not quite localized yet (cf. 9fd6fce8a230);
 wenzelm parents: 
45294diff
changeset | 201 | fun lookup_quotconsts_global thy t = | 
| 45280 | 202 | let | 
| 35222 
4f1fba00f66d
Initial version of HOL quotient package.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: diff
changeset | 203 | val (name, qty) = dest_Const t | 
| 45279 | 204 | fun matches (x: quotconsts) = | 
| 45280 | 205 | let val (name', qty') = dest_Const (#qconst x); | 
| 206 | in name = name' andalso Sign.typ_instance thy (qty, qty') end | |
| 35222 
4f1fba00f66d
Initial version of HOL quotient package.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: diff
changeset | 207 | in | 
| 59157 | 208 | (case Symtab.lookup (get_quotconsts (Context.Theory thy)) name of | 
| 45274 
252cd58847e0
respecting isabelle's programming style in the quotient package by simplifying qconsts_lookup function for data access; removing odd NotFound exception
 bulwahn parents: 
45273diff
changeset | 209 | NONE => NONE | 
| 
252cd58847e0
respecting isabelle's programming style in the quotient package by simplifying qconsts_lookup function for data access; removing odd NotFound exception
 bulwahn parents: 
45273diff
changeset | 210 | | SOME l => find_first matches l) | 
| 35222 
4f1fba00f66d
Initial version of HOL quotient package.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: diff
changeset | 211 | end | 
| 
4f1fba00f66d
Initial version of HOL quotient package.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: diff
changeset | 212 | |
| 45279 | 213 | fun print_quotconsts ctxt = | 
| 41444 | 214 | let | 
| 215 |     fun prt_qconst {qconst, rconst, def} =
 | |
| 216 | Pretty.block (separate (Pretty.brk 1) | |
| 217 | [Syntax.pretty_term ctxt qconst, | |
| 218 | Pretty.str ":=", | |
| 219 | Syntax.pretty_term ctxt rconst, | |
| 220 | Pretty.str "as", | |
| 59582 | 221 | Syntax.pretty_term ctxt (Thm.prop_of def)]) | 
| 41444 | 222 | in | 
| 59157 | 223 | map prt_qconst (maps snd (Symtab.dest (get_quotconsts (Context.Proof ctxt)))) | 
| 41444 | 224 | |> Pretty.big_list "quotient constants:" | 
| 225 | |> Pretty.writeln | |
| 226 | end | |
| 35222 
4f1fba00f66d
Initial version of HOL quotient package.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: diff
changeset | 227 | |
| 
4f1fba00f66d
Initial version of HOL quotient package.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: diff
changeset | 228 | |
| 41452 | 229 | (* outer syntax commands *) | 
| 230 | ||
| 231 | val _ = | |
| 59936 
b8ffc3dc9e24
@{command_spec} is superseded by @{command_keyword};
 wenzelm parents: 
59582diff
changeset | 232 |   Outer_Syntax.command @{command_keyword print_quotmapsQ3} "print quotient map functions"
 | 
| 45279 | 233 | (Scan.succeed (Toplevel.keep (print_quotmaps o Toplevel.context_of))) | 
| 35222 
4f1fba00f66d
Initial version of HOL quotient package.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: diff
changeset | 234 | |
| 41452 | 235 | val _ = | 
| 59936 
b8ffc3dc9e24
@{command_spec} is superseded by @{command_keyword};
 wenzelm parents: 
59582diff
changeset | 236 |   Outer_Syntax.command @{command_keyword print_quotientsQ3} "print quotients"
 | 
| 45279 | 237 | (Scan.succeed (Toplevel.keep (print_quotients o Toplevel.context_of))) | 
| 35222 
4f1fba00f66d
Initial version of HOL quotient package.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: diff
changeset | 238 | |
| 41452 | 239 | val _ = | 
| 59936 
b8ffc3dc9e24
@{command_spec} is superseded by @{command_keyword};
 wenzelm parents: 
59582diff
changeset | 240 |   Outer_Syntax.command @{command_keyword print_quotconsts} "print quotient constants"
 | 
| 45279 | 241 | (Scan.succeed (Toplevel.keep (print_quotconsts o Toplevel.context_of))) | 
| 35222 
4f1fba00f66d
Initial version of HOL quotient package.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: diff
changeset | 242 | |
| 45279 | 243 | end; |