author | Christian Urban <urbanc@in.tum.de> |
Mon, 19 Jul 2010 07:49:10 +0100 | |
changeset 2372 | 06574b438b8f |
parent 1438 | 61671de8a545 |
permissions | -rw-r--r-- |
1438
61671de8a545
synchronised with main hg-repository; used add_typedef_global in nominal_atoms
Christian Urban <urbanc@in.tum.de>
parents:
1260
diff
changeset
|
1 |
(* Title: HOL/Tools/Quotient/quotient_info.thy |
952
9c3b3eaecaff
use of equiv_relation_chk in quotient_term
Christian Urban <urbanc@in.tum.de>
parents:
886
diff
changeset
|
2 |
Author: Cezary Kaliszyk and Christian Urban |
9c3b3eaecaff
use of equiv_relation_chk in quotient_term
Christian Urban <urbanc@in.tum.de>
parents:
886
diff
changeset
|
3 |
|
1438
61671de8a545
synchronised with main hg-repository; used add_typedef_global in nominal_atoms
Christian Urban <urbanc@in.tum.de>
parents:
1260
diff
changeset
|
4 |
Data slots for the quotient package. |
952
9c3b3eaecaff
use of equiv_relation_chk in quotient_term
Christian Urban <urbanc@in.tum.de>
parents:
886
diff
changeset
|
5 |
*) |
9c3b3eaecaff
use of equiv_relation_chk in quotient_term
Christian Urban <urbanc@in.tum.de>
parents:
886
diff
changeset
|
6 |
|
264
d0581fbc096c
split quotient.ML into two files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
7 |
signature QUOTIENT_INFO = |
d0581fbc096c
split quotient.ML into two files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
8 |
sig |
549
f178958d3d81
not yet quite functional treatment of constants
Christian Urban <urbanc@in.tum.de>
parents:
506
diff
changeset
|
9 |
exception NotFound |
f178958d3d81
not yet quite functional treatment of constants
Christian Urban <urbanc@in.tum.de>
parents:
506
diff
changeset
|
10 |
|
784
da75568e7f12
renamed some fields in the info records
Christian Urban <urbanc@in.tum.de>
parents:
778
diff
changeset
|
11 |
type maps_info = {mapfun: string, relmap: string} |
866
f537d570fff8
one more item in the list of Markus
Christian Urban <urbanc@in.tum.de>
parents:
862
diff
changeset
|
12 |
val maps_defined: theory -> string -> bool |
784
da75568e7f12
renamed some fields in the info records
Christian Urban <urbanc@in.tum.de>
parents:
778
diff
changeset
|
13 |
val maps_lookup: theory -> string -> maps_info (* raises NotFound *) |
1128
17ca92ab4660
Main renaming + fixes for new Isabelle in IntEx2.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1126
diff
changeset
|
14 |
val maps_update_thy: string -> maps_info -> theory -> theory |
17ca92ab4660
Main renaming + fixes for new Isabelle in IntEx2.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1126
diff
changeset
|
15 |
val maps_update: string -> maps_info -> Proof.context -> Proof.context |
699
aa157e957655
added maps-printout and tuned some comments
Christian Urban <urbanc@in.tum.de>
parents:
675
diff
changeset
|
16 |
val print_mapsinfo: Proof.context -> unit |
264
d0581fbc096c
split quotient.ML into two files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
17 |
|
786
d6407afb913c
used Local_Theory.declaration for storing quotdata
Christian Urban <urbanc@in.tum.de>
parents:
784
diff
changeset
|
18 |
type quotdata_info = {qtyp: typ, rtyp: typ, equiv_rel: term, equiv_thm: thm} |
799
0755f8fd56b3
renamed transfer to transform (Markus)
Christian Urban <urbanc@in.tum.de>
parents:
798
diff
changeset
|
19 |
val transform_quotdata: morphism -> quotdata_info -> quotdata_info |
875
cc951743c5e2
Simplified matches_typ.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
871
diff
changeset
|
20 |
val quotdata_lookup_raw: theory -> string -> quotdata_info option |
786
d6407afb913c
used Local_Theory.declaration for storing quotdata
Christian Urban <urbanc@in.tum.de>
parents:
784
diff
changeset
|
21 |
val quotdata_lookup: theory -> string -> quotdata_info (* raises NotFound *) |
d6407afb913c
used Local_Theory.declaration for storing quotdata
Christian Urban <urbanc@in.tum.de>
parents:
784
diff
changeset
|
22 |
val quotdata_update_thy: string -> quotdata_info -> theory -> theory |
d6407afb913c
used Local_Theory.declaration for storing quotdata
Christian Urban <urbanc@in.tum.de>
parents:
784
diff
changeset
|
23 |
val quotdata_update_gen: string -> quotdata_info -> Context.generic -> Context.generic |
1064
0391abfc6246
Quotdata_dest needed for lifting theorem translation.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
952
diff
changeset
|
24 |
val quotdata_dest: Proof.context -> quotdata_info list |
699
aa157e957655
added maps-printout and tuned some comments
Christian Urban <urbanc@in.tum.de>
parents:
675
diff
changeset
|
25 |
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>
parents:
264
diff
changeset
|
26 |
|
496
8f1bf5266ebc
Added the definition to quotient constant data.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
460
diff
changeset
|
27 |
type qconsts_info = {qconst: term, rconst: term, def: thm} |
799
0755f8fd56b3
renamed transfer to transform (Markus)
Christian Urban <urbanc@in.tum.de>
parents:
798
diff
changeset
|
28 |
val transform_qconsts: morphism -> qconsts_info -> qconsts_info |
784
da75568e7f12
renamed some fields in the info records
Christian Urban <urbanc@in.tum.de>
parents:
778
diff
changeset
|
29 |
val qconsts_lookup: theory -> term -> qconsts_info (* raises NotFound *) |
868
09d5b7f0e55d
Undid changes from symtab to termtab, since we need to lookup specialized types.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
866
diff
changeset
|
30 |
val qconsts_update_thy: string -> qconsts_info -> theory -> theory |
09d5b7f0e55d
Undid changes from symtab to termtab, since we need to lookup specialized types.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
866
diff
changeset
|
31 |
val qconsts_update_gen: string -> qconsts_info -> Context.generic -> Context.generic |
871
4163fe3dbf8c
produce defs with lthy, like prs and ids
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
869
diff
changeset
|
32 |
val qconsts_dest: Proof.context -> qconsts_info list |
310
fec6301a1989
added a container for quotient constants (does not work yet though)
Christian Urban <urbanc@in.tum.de>
parents:
306
diff
changeset
|
33 |
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>
parents:
406
diff
changeset
|
34 |
|
582
a082e2d138ab
added a theorem list for equivalence theorems
Christian Urban <urbanc@in.tum.de>
parents:
549
diff
changeset
|
35 |
val equiv_rules_get: Proof.context -> thm list |
a082e2d138ab
added a theorem list for equivalence theorems
Christian Urban <urbanc@in.tum.de>
parents:
549
diff
changeset
|
36 |
val equiv_rules_add: attribute |
1128
17ca92ab4660
Main renaming + fixes for new Isabelle in IntEx2.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1126
diff
changeset
|
37 |
val rsp_rules_get: Proof.context -> thm list |
1222
0d059450a3fa
Looking at proving the rsp rules automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1128
diff
changeset
|
38 |
val rsp_rules_add: attribute |
1128
17ca92ab4660
Main renaming + fixes for new Isabelle in IntEx2.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1126
diff
changeset
|
39 |
val prs_rules_get: Proof.context -> thm list |
1222
0d059450a3fa
Looking at proving the rsp rules automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1128
diff
changeset
|
40 |
val prs_rules_add: attribute |
614
51a4208162ed
added a thm list for ids
Christian Urban <urbanc@in.tum.de>
parents:
613
diff
changeset
|
41 |
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>
parents:
460
diff
changeset
|
42 |
val quotient_rules_get: Proof.context -> thm list |
d2c9a72e52e0
first version of internalised quotient theorems; added FIXME-TODO
Christian Urban <urbanc@in.tum.de>
parents:
460
diff
changeset
|
43 |
val quotient_rules_add: attribute |
264
d0581fbc096c
split quotient.ML into two files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
44 |
end; |
d0581fbc096c
split quotient.ML into two files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
45 |
|
798 | 46 |
|
264
d0581fbc096c
split quotient.ML into two files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
47 |
structure Quotient_Info: QUOTIENT_INFO = |
d0581fbc096c
split quotient.ML into two files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
48 |
struct |
d0581fbc096c
split quotient.ML into two files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
49 |
|
549
f178958d3d81
not yet quite functional treatment of constants
Christian Urban <urbanc@in.tum.de>
parents:
506
diff
changeset
|
50 |
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>
parents:
264
diff
changeset
|
51 |
|
850 | 52 |
|
53 |
(** data containers **) |
|
264
d0581fbc096c
split quotient.ML into two files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
54 |
|
759 | 55 |
(* info about map- and rel-functions for a type *) |
784
da75568e7f12
renamed some fields in the info records
Christian Urban <urbanc@in.tum.de>
parents:
778
diff
changeset
|
56 |
type maps_info = {mapfun: string, relmap: string} |
264
d0581fbc096c
split quotient.ML into two files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
57 |
|
306
e7279efbe3dd
updated to new Theory_Data and to new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
268
diff
changeset
|
58 |
structure MapsData = Theory_Data |
264
d0581fbc096c
split quotient.ML into two files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
59 |
(type T = maps_info Symtab.table |
d0581fbc096c
split quotient.ML into two files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
60 |
val empty = Symtab.empty |
d0581fbc096c
split quotient.ML into two files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
61 |
val extend = I |
1438
61671de8a545
synchronised with main hg-repository; used add_typedef_global in nominal_atoms
Christian Urban <urbanc@in.tum.de>
parents:
1260
diff
changeset
|
62 |
fun merge data = Symtab.merge (K true) data) |
264
d0581fbc096c
split quotient.ML into two files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
63 |
|
1128
17ca92ab4660
Main renaming + fixes for new Isabelle in IntEx2.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1126
diff
changeset
|
64 |
fun maps_defined thy s = |
866
f537d570fff8
one more item in the list of Markus
Christian Urban <urbanc@in.tum.de>
parents:
862
diff
changeset
|
65 |
Symtab.defined (MapsData.get thy) s |
805
d193e2111811
added a warning to the quotient_type definition, if a map function is missing
Christian Urban <urbanc@in.tum.de>
parents:
799
diff
changeset
|
66 |
|
1128
17ca92ab4660
Main renaming + fixes for new Isabelle in IntEx2.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1126
diff
changeset
|
67 |
fun maps_lookup thy s = |
760
c1989de100b4
various tunings; map_lookup now raises an exception; addition to FIXME-TODO
Christian Urban <urbanc@in.tum.de>
parents:
759
diff
changeset
|
68 |
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>
parents:
759
diff
changeset
|
69 |
SOME map_fun => map_fun |
c1989de100b4
various tunings; map_lookup now raises an exception; addition to FIXME-TODO
Christian Urban <urbanc@in.tum.de>
parents:
759
diff
changeset
|
70 |
| NONE => raise NotFound |
264
d0581fbc096c
split quotient.ML into two files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
71 |
|
d0581fbc096c
split quotient.ML into two files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
72 |
fun maps_update_thy k minfo = MapsData.map (Symtab.update (k, minfo)) |
d0581fbc096c
split quotient.ML into two files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
73 |
fun maps_update k minfo = ProofContext.theory (maps_update_thy k minfo) |
d0581fbc096c
split quotient.ML into two files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
74 |
|
1128
17ca92ab4660
Main renaming + fixes for new Isabelle in IntEx2.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1126
diff
changeset
|
75 |
fun maps_attribute_aux s minfo = Thm.declaration_attribute |
786
d6407afb913c
used Local_Theory.declaration for storing quotdata
Christian Urban <urbanc@in.tum.de>
parents:
784
diff
changeset
|
76 |
(fn _ => Context.mapping (maps_update_thy s minfo) (maps_update s minfo)) |
264
d0581fbc096c
split quotient.ML into two files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
77 |
|
d0581fbc096c
split quotient.ML into two files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
78 |
(* attribute to be used in declare statements *) |
1128
17ca92ab4660
Main renaming + fixes for new Isabelle in IntEx2.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1126
diff
changeset
|
79 |
fun maps_attribute (ctxt, (tystr, (mapstr, relstr))) = |
17ca92ab4660
Main renaming + fixes for new Isabelle in IntEx2.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1126
diff
changeset
|
80 |
let |
264
d0581fbc096c
split quotient.ML into two files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
81 |
val thy = ProofContext.theory_of ctxt |
d0581fbc096c
split quotient.ML into two files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
82 |
val tyname = Sign.intern_type thy tystr |
d0581fbc096c
split quotient.ML into two files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
83 |
val mapname = Sign.intern_const thy mapstr |
d0581fbc096c
split quotient.ML into two files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
84 |
val relname = Sign.intern_const thy relstr |
613
018aabbffd08
removed a fixme: map_info is now checked
Christian Urban <urbanc@in.tum.de>
parents:
598
diff
changeset
|
85 |
|
866
f537d570fff8
one more item in the list of Markus
Christian Urban <urbanc@in.tum.de>
parents:
862
diff
changeset
|
86 |
fun sanity_check s = (Const (s, dummyT) |> Syntax.check_term ctxt; ()) |
1100
2fb07e01c57b
'exc' -> 'exn' and more name and space cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1097
diff
changeset
|
87 |
val _ = List.app sanity_check [mapname, relname] |
264
d0581fbc096c
split quotient.ML into two files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
88 |
in |
784
da75568e7f12
renamed some fields in the info records
Christian Urban <urbanc@in.tum.de>
parents:
778
diff
changeset
|
89 |
maps_attribute_aux tyname {mapfun = mapname, relmap = relname} |
264
d0581fbc096c
split quotient.ML into two files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
90 |
end |
d0581fbc096c
split quotient.ML into two files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
91 |
|
1128
17ca92ab4660
Main renaming + fixes for new Isabelle in IntEx2.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1126
diff
changeset
|
92 |
val maps_attr_parser = |
1097
551eacf071d7
More indentation, names and todo cleaning in the quotient package
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1064
diff
changeset
|
93 |
Args.context -- Scan.lift |
1128
17ca92ab4660
Main renaming + fixes for new Isabelle in IntEx2.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1126
diff
changeset
|
94 |
((Args.name --| OuterParse.$$$ "=") -- |
17ca92ab4660
Main renaming + fixes for new Isabelle in IntEx2.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1126
diff
changeset
|
95 |
(OuterParse.$$$ "(" |-- Args.name --| OuterParse.$$$ "," -- |
1097
551eacf071d7
More indentation, names and todo cleaning in the quotient package
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1064
diff
changeset
|
96 |
Args.name --| OuterParse.$$$ ")")) |
264
d0581fbc096c
split quotient.ML into two files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
97 |
|
d0581fbc096c
split quotient.ML into two files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
98 |
val _ = Context.>> (Context.map_theory |
1128
17ca92ab4660
Main renaming + fixes for new Isabelle in IntEx2.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1126
diff
changeset
|
99 |
(Attrib.setup @{binding "map"} (maps_attr_parser >> maps_attribute) |
1097
551eacf071d7
More indentation, names and todo cleaning in the quotient package
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1064
diff
changeset
|
100 |
"declaration of map information")) |
264
d0581fbc096c
split quotient.ML into two files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
101 |
|
699
aa157e957655
added maps-printout and tuned some comments
Christian Urban <urbanc@in.tum.de>
parents:
675
diff
changeset
|
102 |
fun print_mapsinfo ctxt = |
aa157e957655
added maps-printout and tuned some comments
Christian Urban <urbanc@in.tum.de>
parents:
675
diff
changeset
|
103 |
let |
1128
17ca92ab4660
Main renaming + fixes for new Isabelle in IntEx2.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1126
diff
changeset
|
104 |
fun prt_map (ty_name, {mapfun, relmap}) = |
1097
551eacf071d7
More indentation, names and todo cleaning in the quotient package
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1064
diff
changeset
|
105 |
Pretty.block (Library.separate (Pretty.brk 2) |
1128
17ca92ab4660
Main renaming + fixes for new Isabelle in IntEx2.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1126
diff
changeset
|
106 |
(map Pretty.str |
1097
551eacf071d7
More indentation, names and todo cleaning in the quotient package
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1064
diff
changeset
|
107 |
["type:", ty_name, |
551eacf071d7
More indentation, names and todo cleaning in the quotient package
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1064
diff
changeset
|
108 |
"map:", mapfun, |
551eacf071d7
More indentation, names and todo cleaning in the quotient package
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1064
diff
changeset
|
109 |
"relation map:", relmap])) |
699
aa157e957655
added maps-printout and tuned some comments
Christian Urban <urbanc@in.tum.de>
parents:
675
diff
changeset
|
110 |
in |
aa157e957655
added maps-printout and tuned some comments
Christian Urban <urbanc@in.tum.de>
parents:
675
diff
changeset
|
111 |
MapsData.get (ProofContext.theory_of ctxt) |
aa157e957655
added maps-printout and tuned some comments
Christian Urban <urbanc@in.tum.de>
parents:
675
diff
changeset
|
112 |
|> Symtab.dest |
aa157e957655
added maps-printout and tuned some comments
Christian Urban <urbanc@in.tum.de>
parents:
675
diff
changeset
|
113 |
|> map (prt_map) |
1128
17ca92ab4660
Main renaming + fixes for new Isabelle in IntEx2.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1126
diff
changeset
|
114 |
|> Pretty.big_list "maps for type constructors:" |
699
aa157e957655
added maps-printout and tuned some comments
Christian Urban <urbanc@in.tum.de>
parents:
675
diff
changeset
|
115 |
|> Pretty.writeln |
aa157e957655
added maps-printout and tuned some comments
Christian Urban <urbanc@in.tum.de>
parents:
675
diff
changeset
|
116 |
end |
aa157e957655
added maps-printout and tuned some comments
Christian Urban <urbanc@in.tum.de>
parents:
675
diff
changeset
|
117 |
|
1128
17ca92ab4660
Main renaming + fixes for new Isabelle in IntEx2.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1126
diff
changeset
|
118 |
|
329 | 119 |
(* info about quotient types *) |
786
d6407afb913c
used Local_Theory.declaration for storing quotdata
Christian Urban <urbanc@in.tum.de>
parents:
784
diff
changeset
|
120 |
type quotdata_info = {qtyp: typ, rtyp: typ, equiv_rel: term, equiv_thm: thm} |
264
d0581fbc096c
split quotient.ML into two files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
121 |
|
306
e7279efbe3dd
updated to new Theory_Data and to new Isabelle
Christian Urban <urbanc@in.tum.de>
parents:
268
diff
changeset
|
122 |
structure QuotData = Theory_Data |
786
d6407afb913c
used Local_Theory.declaration for storing quotdata
Christian Urban <urbanc@in.tum.de>
parents:
784
diff
changeset
|
123 |
(type T = quotdata_info Symtab.table |
311
77fc6f3c0343
changed the quotdata to be a symtab table (needs fixing)
Christian Urban <urbanc@in.tum.de>
parents:
310
diff
changeset
|
124 |
val empty = Symtab.empty |
264
d0581fbc096c
split quotient.ML into two files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
125 |
val extend = I |
1438
61671de8a545
synchronised with main hg-repository; used add_typedef_global in nominal_atoms
Christian Urban <urbanc@in.tum.de>
parents:
1260
diff
changeset
|
126 |
fun merge data = Symtab.merge (K true) data) |
264
d0581fbc096c
split quotient.ML into two files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
127 |
|
799
0755f8fd56b3
renamed transfer to transform (Markus)
Christian Urban <urbanc@in.tum.de>
parents:
798
diff
changeset
|
128 |
fun transform_quotdata phi {qtyp, rtyp, equiv_rel, equiv_thm} = |
1097
551eacf071d7
More indentation, names and todo cleaning in the quotient package
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1064
diff
changeset
|
129 |
{qtyp = Morphism.typ phi qtyp, |
551eacf071d7
More indentation, names and todo cleaning in the quotient package
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1064
diff
changeset
|
130 |
rtyp = Morphism.typ phi rtyp, |
551eacf071d7
More indentation, names and todo cleaning in the quotient package
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1064
diff
changeset
|
131 |
equiv_rel = Morphism.term phi equiv_rel, |
551eacf071d7
More indentation, names and todo cleaning in the quotient package
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1064
diff
changeset
|
132 |
equiv_thm = Morphism.thm phi equiv_thm} |
786
d6407afb913c
used Local_Theory.declaration for storing quotdata
Christian Urban <urbanc@in.tum.de>
parents:
784
diff
changeset
|
133 |
|
875
cc951743c5e2
Simplified matches_typ.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
871
diff
changeset
|
134 |
fun quotdata_lookup_raw thy str = Symtab.lookup (QuotData.get thy) str |
cc951743c5e2
Simplified matches_typ.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
871
diff
changeset
|
135 |
|
cc951743c5e2
Simplified matches_typ.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
871
diff
changeset
|
136 |
fun quotdata_lookup thy str = |
786
d6407afb913c
used Local_Theory.declaration for storing quotdata
Christian Urban <urbanc@in.tum.de>
parents:
784
diff
changeset
|
137 |
case Symtab.lookup (QuotData.get thy) str of |
784
da75568e7f12
renamed some fields in the info records
Christian Urban <urbanc@in.tum.de>
parents:
778
diff
changeset
|
138 |
SOME qinfo => qinfo |
da75568e7f12
renamed some fields in the info records
Christian Urban <urbanc@in.tum.de>
parents:
778
diff
changeset
|
139 |
| NONE => raise NotFound |
320
7d3d86beacd6
started regularize of rtrm/qtrm version; looks quite promising
Christian Urban <urbanc@in.tum.de>
parents:
318
diff
changeset
|
140 |
|
786
d6407afb913c
used Local_Theory.declaration for storing quotdata
Christian Urban <urbanc@in.tum.de>
parents:
784
diff
changeset
|
141 |
fun quotdata_update_thy str qinfo = QuotData.map (Symtab.update (str, qinfo)) |
d6407afb913c
used Local_Theory.declaration for storing quotdata
Christian Urban <urbanc@in.tum.de>
parents:
784
diff
changeset
|
142 |
fun quotdata_update_gen str qinfo = Context.mapping (quotdata_update_thy str qinfo) I |
264
d0581fbc096c
split quotient.ML into two files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
143 |
|
1064
0391abfc6246
Quotdata_dest needed for lifting theorem translation.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
952
diff
changeset
|
144 |
fun quotdata_dest lthy = |
0391abfc6246
Quotdata_dest needed for lifting theorem translation.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
952
diff
changeset
|
145 |
map snd (Symtab.dest (QuotData.get (ProofContext.theory_of lthy))) |
0391abfc6246
Quotdata_dest needed for lifting theorem translation.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
952
diff
changeset
|
146 |
|
310
fec6301a1989
added a container for quotient constants (does not work yet though)
Christian Urban <urbanc@in.tum.de>
parents:
306
diff
changeset
|
147 |
fun print_quotinfo ctxt = |
264
d0581fbc096c
split quotient.ML into two files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
148 |
let |
1097
551eacf071d7
More indentation, names and todo cleaning in the quotient package
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1064
diff
changeset
|
149 |
fun prt_quot {qtyp, rtyp, equiv_rel, equiv_thm} = |
551eacf071d7
More indentation, names and todo cleaning in the quotient package
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1064
diff
changeset
|
150 |
Pretty.block (Library.separate (Pretty.brk 2) |
551eacf071d7
More indentation, names and todo cleaning in the quotient package
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1064
diff
changeset
|
151 |
[Pretty.str "quotient type:", |
551eacf071d7
More indentation, names and todo cleaning in the quotient package
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1064
diff
changeset
|
152 |
Syntax.pretty_typ ctxt qtyp, |
551eacf071d7
More indentation, names and todo cleaning in the quotient package
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1064
diff
changeset
|
153 |
Pretty.str "raw type:", |
551eacf071d7
More indentation, names and todo cleaning in the quotient package
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1064
diff
changeset
|
154 |
Syntax.pretty_typ ctxt rtyp, |
551eacf071d7
More indentation, names and todo cleaning in the quotient package
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1064
diff
changeset
|
155 |
Pretty.str "relation:", |
551eacf071d7
More indentation, names and todo cleaning in the quotient package
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1064
diff
changeset
|
156 |
Syntax.pretty_term ctxt equiv_rel, |
551eacf071d7
More indentation, names and todo cleaning in the quotient package
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1064
diff
changeset
|
157 |
Pretty.str "equiv. thm:", |
551eacf071d7
More indentation, names and todo cleaning in the quotient package
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1064
diff
changeset
|
158 |
Syntax.pretty_term ctxt (prop_of equiv_thm)]) |
264
d0581fbc096c
split quotient.ML into two files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
159 |
in |
d0581fbc096c
split quotient.ML into two files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
160 |
QuotData.get (ProofContext.theory_of ctxt) |
311
77fc6f3c0343
changed the quotdata to be a symtab table (needs fixing)
Christian Urban <urbanc@in.tum.de>
parents:
310
diff
changeset
|
161 |
|> Symtab.dest |
77fc6f3c0343
changed the quotdata to be a symtab table (needs fixing)
Christian Urban <urbanc@in.tum.de>
parents:
310
diff
changeset
|
162 |
|> map (prt_quot o snd) |
1128
17ca92ab4660
Main renaming + fixes for new Isabelle in IntEx2.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1126
diff
changeset
|
163 |
|> Pretty.big_list "quotients:" |
264
d0581fbc096c
split quotient.ML into two files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
164 |
|> Pretty.writeln |
d0581fbc096c
split quotient.ML into two files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
165 |
end |
d0581fbc096c
split quotient.ML into two files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
166 |
|
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>
parents:
264
diff
changeset
|
167 |
|
450
2dc708ddb93a
introduced a global list of respectfulness lemmas; the attribute is [quot_rsp]
Christian Urban <urbanc@in.tum.de>
parents:
406
diff
changeset
|
168 |
(* info about quotient constants *) |
496
8f1bf5266ebc
Added the definition to quotient constant data.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
460
diff
changeset
|
169 |
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>
parents:
306
diff
changeset
|
170 |
|
869
ce5f78f0eac5
Finished organising an efficient datastructure for qconst_info.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
868
diff
changeset
|
171 |
fun qconsts_info_eq (x : qconsts_info, y : qconsts_info) = #qconst x = #qconst y |
ce5f78f0eac5
Finished organising an efficient datastructure for qconst_info.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
868
diff
changeset
|
172 |
|
868
09d5b7f0e55d
Undid changes from symtab to termtab, since we need to lookup specialized types.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
866
diff
changeset
|
173 |
(* We need to be able to lookup instances of lifted constants, |
09d5b7f0e55d
Undid changes from symtab to termtab, since we need to lookup specialized types.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
866
diff
changeset
|
174 |
for example given "nat fset" we need to find "'a fset"; |
09d5b7f0e55d
Undid changes from symtab to termtab, since we need to lookup specialized types.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
866
diff
changeset
|
175 |
but overloaded constants share the same name *) |
310
fec6301a1989
added a container for quotient constants (does not work yet though)
Christian Urban <urbanc@in.tum.de>
parents:
306
diff
changeset
|
176 |
structure QConstsData = Theory_Data |
869
ce5f78f0eac5
Finished organising an efficient datastructure for qconst_info.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
868
diff
changeset
|
177 |
(type T = (qconsts_info list) Symtab.table |
868
09d5b7f0e55d
Undid changes from symtab to termtab, since we need to lookup specialized types.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
866
diff
changeset
|
178 |
val empty = Symtab.empty |
310
fec6301a1989
added a container for quotient constants (does not work yet though)
Christian Urban <urbanc@in.tum.de>
parents:
306
diff
changeset
|
179 |
val extend = I |
869
ce5f78f0eac5
Finished organising an efficient datastructure for qconst_info.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
868
diff
changeset
|
180 |
val merge = Symtab.merge_list qconsts_info_eq) |
310
fec6301a1989
added a container for quotient constants (does not work yet though)
Christian Urban <urbanc@in.tum.de>
parents:
306
diff
changeset
|
181 |
|
799
0755f8fd56b3
renamed transfer to transform (Markus)
Christian Urban <urbanc@in.tum.de>
parents:
798
diff
changeset
|
182 |
fun transform_qconsts phi {qconst, rconst, def} = |
1097
551eacf071d7
More indentation, names and todo cleaning in the quotient package
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1064
diff
changeset
|
183 |
{qconst = Morphism.term phi qconst, |
551eacf071d7
More indentation, names and todo cleaning in the quotient package
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1064
diff
changeset
|
184 |
rconst = Morphism.term phi rconst, |
551eacf071d7
More indentation, names and todo cleaning in the quotient package
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1064
diff
changeset
|
185 |
def = Morphism.thm phi def} |
318
746b17e1d6d8
fixed the storage of qconst definitions
Christian Urban <urbanc@in.tum.de>
parents:
314
diff
changeset
|
186 |
|
869
ce5f78f0eac5
Finished organising an efficient datastructure for qconst_info.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
868
diff
changeset
|
187 |
fun qconsts_update_thy name qcinfo = QConstsData.map (Symtab.cons_list (name, qcinfo)) |
868
09d5b7f0e55d
Undid changes from symtab to termtab, since we need to lookup specialized types.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
866
diff
changeset
|
188 |
fun qconsts_update_gen name qcinfo = Context.mapping (qconsts_update_thy name qcinfo) I |
310
fec6301a1989
added a container for quotient constants (does not work yet though)
Christian Urban <urbanc@in.tum.de>
parents:
306
diff
changeset
|
189 |
|
871
4163fe3dbf8c
produce defs with lthy, like prs and ids
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
869
diff
changeset
|
190 |
fun qconsts_dest lthy = |
4163fe3dbf8c
produce defs with lthy, like prs and ids
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
869
diff
changeset
|
191 |
flat (map snd (Symtab.dest (QConstsData.get (ProofContext.theory_of lthy)))) |
663
0dd10a900cae
Different syntax for definitions that allows overloading and retrieving of definitions by matching whole constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
643
diff
changeset
|
192 |
|
0dd10a900cae
Different syntax for definitions that allows overloading and retrieving of definitions by matching whole constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
643
diff
changeset
|
193 |
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>
parents:
643
diff
changeset
|
194 |
let |
0dd10a900cae
Different syntax for definitions that allows overloading and retrieving of definitions by matching whole constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
643
diff
changeset
|
195 |
val (name, qty) = dest_Const t |
1438
61671de8a545
synchronised with main hg-repository; used add_typedef_global in nominal_atoms
Christian Urban <urbanc@in.tum.de>
parents:
1260
diff
changeset
|
196 |
fun matches (x: qconsts_info) = |
663
0dd10a900cae
Different syntax for definitions that allows overloading and retrieving of definitions by matching whole constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
643
diff
changeset
|
197 |
let |
0dd10a900cae
Different syntax for definitions that allows overloading and retrieving of definitions by matching whole constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
643
diff
changeset
|
198 |
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>
parents:
643
diff
changeset
|
199 |
in |
0dd10a900cae
Different syntax for definitions that allows overloading and retrieving of definitions by matching whole constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
643
diff
changeset
|
200 |
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>
parents:
643
diff
changeset
|
201 |
end |
0dd10a900cae
Different syntax for definitions that allows overloading and retrieving of definitions by matching whole constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
643
diff
changeset
|
202 |
in |
869
ce5f78f0eac5
Finished organising an efficient datastructure for qconst_info.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
868
diff
changeset
|
203 |
case Symtab.lookup (QConstsData.get thy) name of |
ce5f78f0eac5
Finished organising an efficient datastructure for qconst_info.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
868
diff
changeset
|
204 |
NONE => raise NotFound |
ce5f78f0eac5
Finished organising an efficient datastructure for qconst_info.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
868
diff
changeset
|
205 |
| SOME l => |
ce5f78f0eac5
Finished organising an efficient datastructure for qconst_info.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
868
diff
changeset
|
206 |
(case (find_first matches l) of |
ce5f78f0eac5
Finished organising an efficient datastructure for qconst_info.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
868
diff
changeset
|
207 |
SOME x => x |
886 | 208 |
| NONE => raise NotFound) |
663
0dd10a900cae
Different syntax for definitions that allows overloading and retrieving of definitions by matching whole constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
643
diff
changeset
|
209 |
end |
497
b663bc007d00
Added qoutient_consts dest for getting all the constant definitions in the cleaning step.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
496
diff
changeset
|
210 |
|
310
fec6301a1989
added a container for quotient constants (does not work yet though)
Christian Urban <urbanc@in.tum.de>
parents:
306
diff
changeset
|
211 |
fun print_qconstinfo ctxt = |
fec6301a1989
added a container for quotient constants (does not work yet though)
Christian Urban <urbanc@in.tum.de>
parents:
306
diff
changeset
|
212 |
let |
496
8f1bf5266ebc
Added the definition to quotient constant data.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
460
diff
changeset
|
213 |
fun prt_qconst {qconst, rconst, def} = |
1097
551eacf071d7
More indentation, names and todo cleaning in the quotient package
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1064
diff
changeset
|
214 |
Pretty.block (separate (Pretty.brk 1) |
551eacf071d7
More indentation, names and todo cleaning in the quotient package
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1064
diff
changeset
|
215 |
[Syntax.pretty_term ctxt qconst, |
551eacf071d7
More indentation, names and todo cleaning in the quotient package
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1064
diff
changeset
|
216 |
Pretty.str ":=", |
551eacf071d7
More indentation, names and todo cleaning in the quotient package
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1064
diff
changeset
|
217 |
Syntax.pretty_term ctxt rconst, |
551eacf071d7
More indentation, names and todo cleaning in the quotient package
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1064
diff
changeset
|
218 |
Pretty.str "as", |
551eacf071d7
More indentation, names and todo cleaning in the quotient package
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1064
diff
changeset
|
219 |
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>
parents:
306
diff
changeset
|
220 |
in |
fec6301a1989
added a container for quotient constants (does not work yet though)
Christian Urban <urbanc@in.tum.de>
parents:
306
diff
changeset
|
221 |
QConstsData.get (ProofContext.theory_of ctxt) |
868
09d5b7f0e55d
Undid changes from symtab to termtab, since we need to lookup specialized types.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
866
diff
changeset
|
222 |
|> Symtab.dest |
869
ce5f78f0eac5
Finished organising an efficient datastructure for qconst_info.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
868
diff
changeset
|
223 |
|> map snd |
ce5f78f0eac5
Finished organising an efficient datastructure for qconst_info.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
868
diff
changeset
|
224 |
|> flat |
ce5f78f0eac5
Finished organising an efficient datastructure for qconst_info.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
868
diff
changeset
|
225 |
|> map prt_qconst |
1128
17ca92ab4660
Main renaming + fixes for new Isabelle in IntEx2.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1126
diff
changeset
|
226 |
|> Pretty.big_list "quotient constants:" |
310
fec6301a1989
added a container for quotient constants (does not work yet though)
Christian Urban <urbanc@in.tum.de>
parents:
306
diff
changeset
|
227 |
|> Pretty.writeln |
fec6301a1989
added a container for quotient constants (does not work yet though)
Christian Urban <urbanc@in.tum.de>
parents:
306
diff
changeset
|
228 |
end |
fec6301a1989
added a container for quotient constants (does not work yet though)
Christian Urban <urbanc@in.tum.de>
parents:
306
diff
changeset
|
229 |
|
582
a082e2d138ab
added a theorem list for equivalence theorems
Christian Urban <urbanc@in.tum.de>
parents:
549
diff
changeset
|
230 |
(* equivalence relation theorems *) |
a082e2d138ab
added a theorem list for equivalence theorems
Christian Urban <urbanc@in.tum.de>
parents:
549
diff
changeset
|
231 |
structure EquivRules = Named_Thms |
636
520a4084d064
changed names of attributes
Christian Urban <urbanc@in.tum.de>
parents:
614
diff
changeset
|
232 |
(val name = "quot_equiv" |
582
a082e2d138ab
added a theorem list for equivalence theorems
Christian Urban <urbanc@in.tum.de>
parents:
549
diff
changeset
|
233 |
val description = "Equivalence relation theorems.") |
a082e2d138ab
added a theorem list for equivalence theorems
Christian Urban <urbanc@in.tum.de>
parents:
549
diff
changeset
|
234 |
|
a082e2d138ab
added a theorem list for equivalence theorems
Christian Urban <urbanc@in.tum.de>
parents:
549
diff
changeset
|
235 |
val equiv_rules_get = EquivRules.get |
a082e2d138ab
added a theorem list for equivalence theorems
Christian Urban <urbanc@in.tum.de>
parents:
549
diff
changeset
|
236 |
val equiv_rules_add = EquivRules.add |
a082e2d138ab
added a theorem list for equivalence theorems
Christian Urban <urbanc@in.tum.de>
parents:
549
diff
changeset
|
237 |
|
a082e2d138ab
added a theorem list for equivalence theorems
Christian Urban <urbanc@in.tum.de>
parents:
549
diff
changeset
|
238 |
(* respectfulness theorems *) |
1126 | 239 |
structure RspRules = Named_Thms |
636
520a4084d064
changed names of attributes
Christian Urban <urbanc@in.tum.de>
parents:
614
diff
changeset
|
240 |
(val name = "quot_respect" |
1126 | 241 |
val description = "Respectfulness theorems.") |
450
2dc708ddb93a
introduced a global list of respectfulness lemmas; the attribute is [quot_rsp]
Christian Urban <urbanc@in.tum.de>
parents:
406
diff
changeset
|
242 |
|
2dc708ddb93a
introduced a global list of respectfulness lemmas; the attribute is [quot_rsp]
Christian Urban <urbanc@in.tum.de>
parents:
406
diff
changeset
|
243 |
val rsp_rules_get = RspRules.get |
1222
0d059450a3fa
Looking at proving the rsp rules automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1128
diff
changeset
|
244 |
val rsp_rules_add = RspRules.add |
450
2dc708ddb93a
introduced a global list of respectfulness lemmas; the attribute is [quot_rsp]
Christian Urban <urbanc@in.tum.de>
parents:
406
diff
changeset
|
245 |
|
636
520a4084d064
changed names of attributes
Christian Urban <urbanc@in.tum.de>
parents:
614
diff
changeset
|
246 |
(* preservation theorems *) |
520a4084d064
changed names of attributes
Christian Urban <urbanc@in.tum.de>
parents:
614
diff
changeset
|
247 |
structure PrsRules = Named_Thms |
520a4084d064
changed names of attributes
Christian Urban <urbanc@in.tum.de>
parents:
614
diff
changeset
|
248 |
(val name = "quot_preserve" |
777
2f72662d21f3
added a print_maps command; updated the keyword file accordingly
Christian Urban <urbanc@in.tum.de>
parents:
762
diff
changeset
|
249 |
val description = "Preservation theorems.") |
636
520a4084d064
changed names of attributes
Christian Urban <urbanc@in.tum.de>
parents:
614
diff
changeset
|
250 |
|
520a4084d064
changed names of attributes
Christian Urban <urbanc@in.tum.de>
parents:
614
diff
changeset
|
251 |
val prs_rules_get = PrsRules.get |
1222
0d059450a3fa
Looking at proving the rsp rules automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1128
diff
changeset
|
252 |
val prs_rules_add = PrsRules.add |
636
520a4084d064
changed names of attributes
Christian Urban <urbanc@in.tum.de>
parents:
614
diff
changeset
|
253 |
|
759 | 254 |
(* id simplification theorems *) |
614
51a4208162ed
added a thm list for ids
Christian Urban <urbanc@in.tum.de>
parents:
613
diff
changeset
|
255 |
structure IdSimps = Named_Thms |
51a4208162ed
added a thm list for ids
Christian Urban <urbanc@in.tum.de>
parents:
613
diff
changeset
|
256 |
(val name = "id_simps" |
51a4208162ed
added a thm list for ids
Christian Urban <urbanc@in.tum.de>
parents:
613
diff
changeset
|
257 |
val description = "Identity simp rules for maps.") |
51a4208162ed
added a thm list for ids
Christian Urban <urbanc@in.tum.de>
parents:
613
diff
changeset
|
258 |
|
51a4208162ed
added a thm list for ids
Christian Urban <urbanc@in.tum.de>
parents:
613
diff
changeset
|
259 |
val id_simps_get = IdSimps.get |
51a4208162ed
added a thm list for ids
Christian Urban <urbanc@in.tum.de>
parents:
613
diff
changeset
|
260 |
|
582
a082e2d138ab
added a theorem list for equivalence theorems
Christian Urban <urbanc@in.tum.de>
parents:
549
diff
changeset
|
261 |
(* quotient theorems *) |
503
d2c9a72e52e0
first version of internalised quotient theorems; added FIXME-TODO
Christian Urban <urbanc@in.tum.de>
parents:
460
diff
changeset
|
262 |
structure QuotientRules = Named_Thms |
636
520a4084d064
changed names of attributes
Christian Urban <urbanc@in.tum.de>
parents:
614
diff
changeset
|
263 |
(val name = "quot_thm" |
503
d2c9a72e52e0
first version of internalised quotient theorems; added FIXME-TODO
Christian Urban <urbanc@in.tum.de>
parents:
460
diff
changeset
|
264 |
val description = "Quotient theorems.") |
d2c9a72e52e0
first version of internalised quotient theorems; added FIXME-TODO
Christian Urban <urbanc@in.tum.de>
parents:
460
diff
changeset
|
265 |
|
d2c9a72e52e0
first version of internalised quotient theorems; added FIXME-TODO
Christian Urban <urbanc@in.tum.de>
parents:
460
diff
changeset
|
266 |
val quotient_rules_get = QuotientRules.get |
582
a082e2d138ab
added a theorem list for equivalence theorems
Christian Urban <urbanc@in.tum.de>
parents:
549
diff
changeset
|
267 |
val quotient_rules_add = QuotientRules.add |
503
d2c9a72e52e0
first version of internalised quotient theorems; added FIXME-TODO
Christian Urban <urbanc@in.tum.de>
parents:
460
diff
changeset
|
268 |
|
d2c9a72e52e0
first version of internalised quotient theorems; added FIXME-TODO
Christian Urban <urbanc@in.tum.de>
parents:
460
diff
changeset
|
269 |
(* setup of the theorem lists *) |
778
54f186bb5e3e
added "Highest Priority" category; and tuned slightly code
Christian Urban <urbanc@in.tum.de>
parents:
777
diff
changeset
|
270 |
|
1128
17ca92ab4660
Main renaming + fixes for new Isabelle in IntEx2.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1126
diff
changeset
|
271 |
val _ = Context.>> (Context.map_theory |
1097
551eacf071d7
More indentation, names and todo cleaning in the quotient package
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1064
diff
changeset
|
272 |
(EquivRules.setup #> |
551eacf071d7
More indentation, names and todo cleaning in the quotient package
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1064
diff
changeset
|
273 |
RspRules.setup #> |
551eacf071d7
More indentation, names and todo cleaning in the quotient package
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1064
diff
changeset
|
274 |
PrsRules.setup #> |
551eacf071d7
More indentation, names and todo cleaning in the quotient package
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1064
diff
changeset
|
275 |
IdSimps.setup #> |
551eacf071d7
More indentation, names and todo cleaning in the quotient package
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1064
diff
changeset
|
276 |
QuotientRules.setup)) |
450
2dc708ddb93a
introduced a global list of respectfulness lemmas; the attribute is [quot_rsp]
Christian Urban <urbanc@in.tum.de>
parents:
406
diff
changeset
|
277 |
|
778
54f186bb5e3e
added "Highest Priority" category; and tuned slightly code
Christian Urban <urbanc@in.tum.de>
parents:
777
diff
changeset
|
278 |
(* setup of the printing commands *) |
54f186bb5e3e
added "Highest Priority" category; and tuned slightly code
Christian Urban <urbanc@in.tum.de>
parents:
777
diff
changeset
|
279 |
|
1097
551eacf071d7
More indentation, names and todo cleaning in the quotient package
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1064
diff
changeset
|
280 |
fun improper_command (pp_fn, cmd_name, descr_str) = |
551eacf071d7
More indentation, names and todo cleaning in the quotient package
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1064
diff
changeset
|
281 |
OuterSyntax.improper_command cmd_name descr_str |
778
54f186bb5e3e
added "Highest Priority" category; and tuned slightly code
Christian Urban <urbanc@in.tum.de>
parents:
777
diff
changeset
|
282 |
OuterKeyword.diag (Scan.succeed (Toplevel.keep (pp_fn o Toplevel.context_of))) |
54f186bb5e3e
added "Highest Priority" category; and tuned slightly code
Christian Urban <urbanc@in.tum.de>
parents:
777
diff
changeset
|
283 |
|
1097
551eacf071d7
More indentation, names and todo cleaning in the quotient package
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1064
diff
changeset
|
284 |
val _ = map improper_command |
1438
61671de8a545
synchronised with main hg-repository; used add_typedef_global in nominal_atoms
Christian Urban <urbanc@in.tum.de>
parents:
1260
diff
changeset
|
285 |
[(print_mapsinfo, "print_quotmaps", "prints out all map functions"), |
1097
551eacf071d7
More indentation, names and todo cleaning in the quotient package
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1064
diff
changeset
|
286 |
(print_quotinfo, "print_quotients", "prints out all quotients"), |
551eacf071d7
More indentation, names and todo cleaning in the quotient package
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1064
diff
changeset
|
287 |
(print_qconstinfo, "print_quotconsts", "prints out all quotient constants")] |
778
54f186bb5e3e
added "Highest Priority" category; and tuned slightly code
Christian Urban <urbanc@in.tum.de>
parents:
777
diff
changeset
|
288 |
|
54f186bb5e3e
added "Highest Priority" category; and tuned slightly code
Christian Urban <urbanc@in.tum.de>
parents:
777
diff
changeset
|
289 |
|
264
d0581fbc096c
split quotient.ML into two files
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
290 |
end; (* structure *) |