264
|
1 |
signature QUOTIENT_INFO =
|
|
2 |
sig
|
549
|
3 |
exception NotFound
|
|
4 |
|
784
|
5 |
type maps_info = {mapfun: string, relmap: string}
|
805
d193e2111811
added a warning to the quotient_type definition, if a map function is missing
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
6 |
val maps_exists: theory -> string -> bool
|
784
|
7 |
val maps_lookup: theory -> string -> maps_info (* raises NotFound *)
|
264
|
8 |
val maps_update_thy: string -> maps_info -> theory -> theory
|
|
9 |
val maps_update: string -> maps_info -> Proof.context -> Proof.context
|
699
|
10 |
val print_mapsinfo: Proof.context -> unit
|
264
|
11 |
|
786
|
12 |
type quotdata_info = {qtyp: typ, rtyp: typ, equiv_rel: term, equiv_thm: thm}
|
799
|
13 |
val transform_quotdata: morphism -> quotdata_info -> quotdata_info
|
786
|
14 |
val quotdata_lookup: theory -> string -> quotdata_info (* raises NotFound *)
|
|
15 |
val quotdata_update_thy: string -> quotdata_info -> theory -> theory
|
|
16 |
val quotdata_update_gen: string -> quotdata_info -> Context.generic -> Context.generic
|
699
|
17 |
val print_quotinfo: Proof.context -> unit
|
268
4d58c02289ca
simplified the quotient_def code; type of the defined constant must now be given; for-part eliminated
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
18 |
|
496
|
19 |
type qconsts_info = {qconst: term, rconst: term, def: thm}
|
799
|
20 |
val transform_qconsts: morphism -> qconsts_info -> qconsts_info
|
784
|
21 |
val qconsts_lookup: theory -> term -> qconsts_info (* raises NotFound *)
|
663
0dd10a900cae
Different syntax for definitions that allows overloading and retrieving of definitions by matching whole constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
22 |
val qconsts_update_thy: string -> qconsts_info -> theory -> theory
|
497
b663bc007d00
Added qoutient_consts dest for getting all the constant definitions in the cleaning step.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
23 |
val qconsts_update_gen: string -> qconsts_info -> Context.generic -> Context.generic
|
b663bc007d00
Added qoutient_consts dest for getting all the constant definitions in the cleaning step.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
24 |
val qconsts_dest: theory -> qconsts_info list
|
310
fec6301a1989
added a container for quotient constants (does not work yet though)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
25 |
val print_qconstinfo: Proof.context -> unit
|
450
2dc708ddb93a
introduced a global list of respectfulness lemmas; the attribute is [quot_rsp]
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
26 |
|
582
|
27 |
val equiv_rules_get: Proof.context -> thm list
|
|
28 |
val equiv_rules_add: attribute
|
450
2dc708ddb93a
introduced a global list of respectfulness lemmas; the attribute is [quot_rsp]
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
29 |
val rsp_rules_get: Proof.context -> thm list
|
636
|
30 |
val prs_rules_get: Proof.context -> thm list
|
614
|
31 |
val id_simps_get: Proof.context -> thm list
|
503
d2c9a72e52e0
first version of internalised quotient theorems; added FIXME-TODO
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
32 |
val quotient_rules_get: Proof.context -> thm list
|
d2c9a72e52e0
first version of internalised quotient theorems; added FIXME-TODO
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
33 |
val quotient_rules_add: attribute
|
264
|
34 |
end;
|
|
35 |
|
798
|
36 |
|
|
37 |
functor Filtered_Named_Thms (val name: string val description: string val filter: thm -> thm): NAMED_THMS =
|
797
35436401f00d
added a functor that allows checking what is added to the theorem lists
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
38 |
struct
|
35436401f00d
added a functor that allows checking what is added to the theorem lists
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
39 |
|
35436401f00d
added a functor that allows checking what is added to the theorem lists
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
40 |
structure Data = Generic_Data
|
798
|
41 |
( type T = thm Item_Net.T;
|
797
35436401f00d
added a functor that allows checking what is added to the theorem lists
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
42 |
val empty = Thm.full_rules;
|
35436401f00d
added a functor that allows checking what is added to the theorem lists
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
43 |
val extend = I;
|
798
|
44 |
val merge = Item_Net.merge);
|
797
35436401f00d
added a functor that allows checking what is added to the theorem lists
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
45 |
|
35436401f00d
added a functor that allows checking what is added to the theorem lists
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
46 |
val content = Item_Net.content o Data.get;
|
35436401f00d
added a functor that allows checking what is added to the theorem lists
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
47 |
val get = content o Context.Proof;
|
35436401f00d
added a functor that allows checking what is added to the theorem lists
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
48 |
|
35436401f00d
added a functor that allows checking what is added to the theorem lists
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
49 |
val add_thm = Data.map o Item_Net.update o filter;
|
35436401f00d
added a functor that allows checking what is added to the theorem lists
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
50 |
val del_thm = Data.map o Item_Net.remove;
|
35436401f00d
added a functor that allows checking what is added to the theorem lists
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
51 |
|
35436401f00d
added a functor that allows checking what is added to the theorem lists
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
52 |
val add = Thm.declaration_attribute add_thm;
|
35436401f00d
added a functor that allows checking what is added to the theorem lists
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
53 |
val del = Thm.declaration_attribute del_thm;
|
35436401f00d
added a functor that allows checking what is added to the theorem lists
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
54 |
|
35436401f00d
added a functor that allows checking what is added to the theorem lists
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
55 |
val setup =
|
35436401f00d
added a functor that allows checking what is added to the theorem lists
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
56 |
Attrib.setup (Binding.name name) (Attrib.add_del add del) ("declaration of " ^ description) #>
|
35436401f00d
added a functor that allows checking what is added to the theorem lists
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
57 |
PureThy.add_thms_dynamic (Binding.name name, content);
|
35436401f00d
added a functor that allows checking what is added to the theorem lists
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
58 |
|
35436401f00d
added a functor that allows checking what is added to the theorem lists
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
59 |
end;
|
35436401f00d
added a functor that allows checking what is added to the theorem lists
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
60 |
|
35436401f00d
added a functor that allows checking what is added to the theorem lists
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
61 |
|
35436401f00d
added a functor that allows checking what is added to the theorem lists
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
62 |
|
264
|
63 |
structure Quotient_Info: QUOTIENT_INFO =
|
|
64 |
struct
|
|
65 |
|
549
|
66 |
exception NotFound
|
268
4d58c02289ca
simplified the quotient_def code; type of the defined constant must now be given; for-part eliminated
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
67 |
|
850
|
68 |
|
|
69 |
(** data containers **)
|
264
|
70 |
|
759
|
71 |
(* info about map- and rel-functions for a type *)
|
784
|
72 |
type maps_info = {mapfun: string, relmap: string}
|
264
|
73 |
|
306
|
74 |
structure MapsData = Theory_Data
|
264
|
75 |
(type T = maps_info Symtab.table
|
|
76 |
val empty = Symtab.empty
|
|
77 |
val extend = I
|
306
|
78 |
val merge = Symtab.merge (K true))
|
264
|
79 |
|
805
d193e2111811
added a warning to the quotient_type definition, if a map function is missing
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
80 |
fun maps_exists thy s =
|
d193e2111811
added a warning to the quotient_type definition, if a map function is missing
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
81 |
case (Symtab.lookup (MapsData.get thy) s) of
|
d193e2111811
added a warning to the quotient_type definition, if a map function is missing
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
82 |
SOME _ => true
|
d193e2111811
added a warning to the quotient_type definition, if a map function is missing
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
83 |
| NONE => false
|
d193e2111811
added a warning to the quotient_type definition, if a map function is missing
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
84 |
|
760
c1989de100b4
various tunings; map_lookup now raises an exception; addition to FIXME-TODO
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
85 |
fun maps_lookup thy s =
|
c1989de100b4
various tunings; map_lookup now raises an exception; addition to FIXME-TODO
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
86 |
case (Symtab.lookup (MapsData.get thy) s) of
|
c1989de100b4
various tunings; map_lookup now raises an exception; addition to FIXME-TODO
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
87 |
SOME map_fun => map_fun
|
c1989de100b4
various tunings; map_lookup now raises an exception; addition to FIXME-TODO
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
88 |
| NONE => raise NotFound
|
264
|
89 |
|
|
90 |
fun maps_update_thy k minfo = MapsData.map (Symtab.update (k, minfo))
|
|
91 |
fun maps_update k minfo = ProofContext.theory (maps_update_thy k minfo)
|
|
92 |
|
|
93 |
fun maps_attribute_aux s minfo = Thm.declaration_attribute
|
786
|
94 |
(fn _ => Context.mapping (maps_update_thy s minfo) (maps_update s minfo))
|
264
|
95 |
|
|
96 |
(* attribute to be used in declare statements *)
|
|
97 |
fun maps_attribute (ctxt, (tystr, (mapstr, relstr))) =
|
|
98 |
let
|
|
99 |
val thy = ProofContext.theory_of ctxt
|
|
100 |
val tyname = Sign.intern_type thy tystr
|
|
101 |
val mapname = Sign.intern_const thy mapstr
|
|
102 |
val relname = Sign.intern_const thy relstr
|
613
|
103 |
|
675
|
104 |
fun sanity_check s = (Const (s, dummyT) |> Syntax.check_term ctxt)
|
|
105 |
val _ = map sanity_check [mapname, relname]
|
264
|
106 |
in
|
784
|
107 |
maps_attribute_aux tyname {mapfun = mapname, relmap = relname}
|
264
|
108 |
end
|
|
109 |
|
|
110 |
val maps_attr_parser =
|
|
111 |
Args.context -- Scan.lift
|
|
112 |
((Args.name --| OuterParse.$$$ "=") --
|
|
113 |
(OuterParse.$$$ "(" |-- Args.name --| OuterParse.$$$ "," --
|
|
114 |
Args.name --| OuterParse.$$$ ")"))
|
|
115 |
|
|
116 |
val _ = Context.>> (Context.map_theory
|
|
117 |
(Attrib.setup @{binding "map"} (maps_attr_parser >> maps_attribute)
|
|
118 |
"declaration of map information"))
|
|
119 |
|
699
|
120 |
fun print_mapsinfo ctxt =
|
|
121 |
let
|
784
|
122 |
fun prt_map (ty_name, {mapfun, relmap}) =
|
699
|
123 |
Pretty.block (Library.separate (Pretty.brk 2)
|
778
|
124 |
(map Pretty.str
|
|
125 |
["type:", ty_name,
|
784
|
126 |
"map:", mapfun,
|
|
127 |
"relation map:", relmap]))
|
699
|
128 |
in
|
|
129 |
MapsData.get (ProofContext.theory_of ctxt)
|
|
130 |
|> Symtab.dest
|
|
131 |
|> map (prt_map)
|
786
|
132 |
|> Pretty.big_list "maps for type constructors:"
|
699
|
133 |
|> Pretty.writeln
|
|
134 |
end
|
|
135 |
|
778
|
136 |
|
329
|
137 |
(* info about quotient types *)
|
786
|
138 |
type quotdata_info = {qtyp: typ, rtyp: typ, equiv_rel: term, equiv_thm: thm}
|
264
|
139 |
|
306
|
140 |
structure QuotData = Theory_Data
|
786
|
141 |
(type T = quotdata_info Symtab.table
|
311
|
142 |
val empty = Symtab.empty
|
264
|
143 |
val extend = I
|
311
|
144 |
val merge = Symtab.merge (K true))
|
264
|
145 |
|
799
|
146 |
fun transform_quotdata phi {qtyp, rtyp, equiv_rel, equiv_thm} =
|
786
|
147 |
{qtyp = Morphism.typ phi qtyp,
|
|
148 |
rtyp = Morphism.typ phi rtyp,
|
|
149 |
equiv_rel = Morphism.term phi equiv_rel,
|
|
150 |
equiv_thm = Morphism.thm phi equiv_thm}
|
|
151 |
|
|
152 |
fun quotdata_lookup thy str =
|
|
153 |
case Symtab.lookup (QuotData.get thy) str of
|
784
|
154 |
SOME qinfo => qinfo
|
|
155 |
| NONE => raise NotFound
|
320
7d3d86beacd6
started regularize of rtrm/qtrm version; looks quite promising
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
156 |
|
786
|
157 |
fun quotdata_update_thy str qinfo = QuotData.map (Symtab.update (str, qinfo))
|
|
158 |
fun quotdata_update_gen str qinfo = Context.mapping (quotdata_update_thy str qinfo) I
|
264
|
159 |
|
310
fec6301a1989
added a container for quotient constants (does not work yet though)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
160 |
fun print_quotinfo ctxt =
|
264
|
161 |
let
|
784
|
162 |
fun prt_quot {qtyp, rtyp, equiv_rel, equiv_thm} =
|
264
|
163 |
Pretty.block (Library.separate (Pretty.brk 2)
|
324
|
164 |
[Pretty.str "quotient type:",
|
264
|
165 |
Syntax.pretty_typ ctxt qtyp,
|
324
|
166 |
Pretty.str "raw type:",
|
264
|
167 |
Syntax.pretty_typ ctxt rtyp,
|
324
|
168 |
Pretty.str "relation:",
|
784
|
169 |
Syntax.pretty_term ctxt equiv_rel,
|
324
|
170 |
Pretty.str "equiv. thm:",
|
264
|
171 |
Syntax.pretty_term ctxt (prop_of equiv_thm)])
|
|
172 |
in
|
|
173 |
QuotData.get (ProofContext.theory_of ctxt)
|
311
|
174 |
|> Symtab.dest
|
|
175 |
|> map (prt_quot o snd)
|
264
|
176 |
|> Pretty.big_list "quotients:"
|
|
177 |
|> Pretty.writeln
|
|
178 |
end
|
|
179 |
|
268
4d58c02289ca
simplified the quotient_def code; type of the defined constant must now be given; for-part eliminated
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
180 |
|
450
2dc708ddb93a
introduced a global list of respectfulness lemmas; the attribute is [quot_rsp]
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
181 |
(* info about quotient constants *)
|
496
|
182 |
type qconsts_info = {qconst: term, rconst: term, def: thm}
|
310
fec6301a1989
added a container for quotient constants (does not work yet though)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
183 |
|
fec6301a1989
added a container for quotient constants (does not work yet though)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
184 |
structure QConstsData = Theory_Data
|
fec6301a1989
added a container for quotient constants (does not work yet though)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
185 |
(type T = qconsts_info Symtab.table
|
fec6301a1989
added a container for quotient constants (does not work yet though)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
186 |
val empty = Symtab.empty
|
fec6301a1989
added a container for quotient constants (does not work yet though)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
187 |
val extend = I
|
fec6301a1989
added a container for quotient constants (does not work yet though)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
188 |
val merge = Symtab.merge (K true))
|
fec6301a1989
added a container for quotient constants (does not work yet though)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
189 |
|
799
|
190 |
fun transform_qconsts phi {qconst, rconst, def} =
|
318
|
191 |
{qconst = Morphism.term phi qconst,
|
496
|
192 |
rconst = Morphism.term phi rconst,
|
|
193 |
def = Morphism.thm phi def}
|
318
|
194 |
|
786
|
195 |
fun qconsts_update_thy str qcinfo = QConstsData.map (Symtab.update (str, qcinfo))
|
|
196 |
fun qconsts_update_gen str qcinfo = Context.mapping (qconsts_update_thy str qcinfo) I
|
310
fec6301a1989
added a container for quotient constants (does not work yet though)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
197 |
|
497
b663bc007d00
Added qoutient_consts dest for getting all the constant definitions in the cleaning step.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
198 |
fun qconsts_dest thy =
|
663
0dd10a900cae
Different syntax for definitions that allows overloading and retrieving of definitions by matching whole constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
199 |
map snd (Symtab.dest (QConstsData.get thy))
|
0dd10a900cae
Different syntax for definitions that allows overloading and retrieving of definitions by matching whole constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
200 |
|
751
|
201 |
(* FIXME / TODO : better implementation of the lookup datastructure *)
|
|
202 |
(* for example symtabs to alist; or tables with string type key *)
|
663
0dd10a900cae
Different syntax for definitions that allows overloading and retrieving of definitions by matching whole constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
203 |
fun qconsts_lookup thy t =
|
0dd10a900cae
Different syntax for definitions that allows overloading and retrieving of definitions by matching whole constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
204 |
let
|
0dd10a900cae
Different syntax for definitions that allows overloading and retrieving of definitions by matching whole constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
205 |
val smt = Symtab.dest (QConstsData.get thy);
|
0dd10a900cae
Different syntax for definitions that allows overloading and retrieving of definitions by matching whole constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
206 |
val (name, qty) = dest_Const t
|
0dd10a900cae
Different syntax for definitions that allows overloading and retrieving of definitions by matching whole constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
207 |
fun matches (_, x) =
|
0dd10a900cae
Different syntax for definitions that allows overloading and retrieving of definitions by matching whole constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
208 |
let
|
0dd10a900cae
Different syntax for definitions that allows overloading and retrieving of definitions by matching whole constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
209 |
val (name', qty') = dest_Const (#qconst x);
|
0dd10a900cae
Different syntax for definitions that allows overloading and retrieving of definitions by matching whole constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
210 |
in
|
0dd10a900cae
Different syntax for definitions that allows overloading and retrieving of definitions by matching whole constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
211 |
name = name' andalso Sign.typ_instance thy (qty, qty')
|
0dd10a900cae
Different syntax for definitions that allows overloading and retrieving of definitions by matching whole constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
212 |
end
|
0dd10a900cae
Different syntax for definitions that allows overloading and retrieving of definitions by matching whole constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
213 |
in
|
0dd10a900cae
Different syntax for definitions that allows overloading and retrieving of definitions by matching whole constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
214 |
case (find_first matches smt) of
|
0dd10a900cae
Different syntax for definitions that allows overloading and retrieving of definitions by matching whole constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
215 |
SOME (_, x) => x
|
0dd10a900cae
Different syntax for definitions that allows overloading and retrieving of definitions by matching whole constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
216 |
| _ => raise NotFound
|
0dd10a900cae
Different syntax for definitions that allows overloading and retrieving of definitions by matching whole constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
217 |
end
|
497
b663bc007d00
Added qoutient_consts dest for getting all the constant definitions in the cleaning step.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
218 |
|
310
fec6301a1989
added a container for quotient constants (does not work yet though)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
219 |
fun print_qconstinfo ctxt =
|
fec6301a1989
added a container for quotient constants (does not work yet though)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
220 |
let
|
496
|
221 |
fun prt_qconst {qconst, rconst, def} =
|
318
|
222 |
Pretty.block (separate (Pretty.brk 1)
|
310
fec6301a1989
added a container for quotient constants (does not work yet though)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
223 |
[Syntax.pretty_term ctxt qconst,
|
318
|
224 |
Pretty.str ":=",
|
760
c1989de100b4
various tunings; map_lookup now raises an exception; addition to FIXME-TODO
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
225 |
Syntax.pretty_term ctxt rconst,
|
c1989de100b4
various tunings; map_lookup now raises an exception; addition to FIXME-TODO
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
226 |
Pretty.str "as",
|
c1989de100b4
various tunings; map_lookup now raises an exception; addition to FIXME-TODO
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
227 |
Syntax.pretty_term ctxt (prop_of def)])
|
310
fec6301a1989
added a container for quotient constants (does not work yet though)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
228 |
in
|
fec6301a1989
added a container for quotient constants (does not work yet though)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
229 |
QConstsData.get (ProofContext.theory_of ctxt)
|
fec6301a1989
added a container for quotient constants (does not work yet though)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
230 |
|> Symtab.dest
|
fec6301a1989
added a container for quotient constants (does not work yet though)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
231 |
|> map (prt_qconst o snd)
|
fec6301a1989
added a container for quotient constants (does not work yet though)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
232 |
|> Pretty.big_list "quotient constants:"
|
fec6301a1989
added a container for quotient constants (does not work yet though)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
233 |
|> Pretty.writeln
|
fec6301a1989
added a container for quotient constants (does not work yet though)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
234 |
end
|
fec6301a1989
added a container for quotient constants (does not work yet though)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
235 |
|
614
|
236 |
(* FIXME/TODO: check the various lemmas conform *)
|
|
237 |
(* with the required shape *)
|
|
238 |
|
582
|
239 |
(* equivalence relation theorems *)
|
|
240 |
structure EquivRules = Named_Thms
|
636
|
241 |
(val name = "quot_equiv"
|
582
|
242 |
val description = "Equivalence relation theorems.")
|
|
243 |
|
|
244 |
val equiv_rules_get = EquivRules.get
|
|
245 |
val equiv_rules_add = EquivRules.add
|
|
246 |
|
|
247 |
(* respectfulness theorems *)
|
798
|
248 |
structure RspRules = Filtered_Named_Thms
|
636
|
249 |
(val name = "quot_respect"
|
797
35436401f00d
added a functor that allows checking what is added to the theorem lists
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
250 |
val description = "Respectfulness theorems."
|
798
|
251 |
val filter = I)
|
450
2dc708ddb93a
introduced a global list of respectfulness lemmas; the attribute is [quot_rsp]
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
252 |
|
2dc708ddb93a
introduced a global list of respectfulness lemmas; the attribute is [quot_rsp]
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
253 |
val rsp_rules_get = RspRules.get
|
2dc708ddb93a
introduced a global list of respectfulness lemmas; the attribute is [quot_rsp]
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
254 |
|
636
|
255 |
(* preservation theorems *)
|
|
256 |
structure PrsRules = Named_Thms
|
|
257 |
(val name = "quot_preserve"
|
777
2f72662d21f3
added a print_maps command; updated the keyword file accordingly
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
258 |
val description = "Preservation theorems.")
|
636
|
259 |
|
|
260 |
val prs_rules_get = PrsRules.get
|
|
261 |
|
759
|
262 |
(* id simplification theorems *)
|
614
|
263 |
structure IdSimps = Named_Thms
|
|
264 |
(val name = "id_simps"
|
|
265 |
val description = "Identity simp rules for maps.")
|
|
266 |
|
|
267 |
val id_simps_get = IdSimps.get
|
|
268 |
|
582
|
269 |
(* quotient theorems *)
|
503
d2c9a72e52e0
first version of internalised quotient theorems; added FIXME-TODO
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
270 |
structure QuotientRules = Named_Thms
|
636
|
271 |
(val name = "quot_thm"
|
503
d2c9a72e52e0
first version of internalised quotient theorems; added FIXME-TODO
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
272 |
val description = "Quotient theorems.")
|
d2c9a72e52e0
first version of internalised quotient theorems; added FIXME-TODO
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
273 |
|
d2c9a72e52e0
first version of internalised quotient theorems; added FIXME-TODO
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
274 |
val quotient_rules_get = QuotientRules.get
|
582
|
275 |
val quotient_rules_add = QuotientRules.add
|
503
d2c9a72e52e0
first version of internalised quotient theorems; added FIXME-TODO
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
276 |
|
d2c9a72e52e0
first version of internalised quotient theorems; added FIXME-TODO
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
277 |
(* setup of the theorem lists *)
|
778
|
278 |
|
503
d2c9a72e52e0
first version of internalised quotient theorems; added FIXME-TODO
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
279 |
val _ = Context.>> (Context.map_theory
|
582
|
280 |
(EquivRules.setup #>
|
|
281 |
RspRules.setup #>
|
643
|
282 |
PrsRules.setup #>
|
614
|
283 |
IdSimps.setup #>
|
503
d2c9a72e52e0
first version of internalised quotient theorems; added FIXME-TODO
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
284 |
QuotientRules.setup))
|
450
2dc708ddb93a
introduced a global list of respectfulness lemmas; the attribute is [quot_rsp]
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
285 |
|
778
|
286 |
(* setup of the printing commands *)
|
|
287 |
|
|
288 |
fun improper_command (pp_fn, cmd_name, descr_str) =
|
|
289 |
OuterSyntax.improper_command cmd_name descr_str
|
|
290 |
OuterKeyword.diag (Scan.succeed (Toplevel.keep (pp_fn o Toplevel.context_of)))
|
|
291 |
|
|
292 |
val _ = map improper_command
|
|
293 |
[(print_mapsinfo, "print_maps", "prints out all map functions"),
|
|
294 |
(print_quotinfo, "print_quotients", "prints out all quotients"),
|
|
295 |
(print_qconstinfo, "print_quotconsts", "prints out all quotient constants")]
|
|
296 |
|
|
297 |
|
264
|
298 |
end; (* structure *)
|
|
299 |
|