equal
deleted
inserted
replaced
97 val minfo = {rel_quot_thm = rel_quot_thm} |
97 val minfo = {rel_quot_thm = rel_quot_thm} |
98 in |
98 in |
99 Quotmaps.map (Symtab.update (relatorT_name, minfo)) ctxt |
99 Quotmaps.map (Symtab.update (relatorT_name, minfo)) ctxt |
100 end |
100 end |
101 |
101 |
102 val quotmaps_attribute_setup = |
102 val quot_map_attribute_setup = |
103 Attrib.setup @{binding quot_map} (Scan.succeed (Thm.declaration_attribute add_quot_map)) |
103 Attrib.setup @{binding quot_map} (Scan.succeed (Thm.declaration_attribute add_quot_map)) |
104 "declaration of the Quotient map theorem" |
104 "declaration of the Quotient map theorem" |
105 |
105 |
106 fun print_quotmaps ctxt = |
106 fun print_quotmaps ctxt = |
107 let |
107 let |
134 val lookup_quotients = Symtab.lookup o Quotients.get o Context.Proof |
134 val lookup_quotients = Symtab.lookup o Quotients.get o Context.Proof |
135 val lookup_quotients_global = Symtab.lookup o Quotients.get o Context.Theory |
135 val lookup_quotients_global = Symtab.lookup o Quotients.get o Context.Theory |
136 |
136 |
137 fun update_quotients str qinfo = Quotients.map (Symtab.update (str, qinfo)) |
137 fun update_quotients str qinfo = Quotients.map (Symtab.update (str, qinfo)) |
138 |
138 |
|
139 fun delete_quotients quot_thm ctxt = |
|
140 let |
|
141 val (_, qtyp) = quot_thm_rty_qty quot_thm |
|
142 val qty_full_name = (fst o dest_Type) qtyp |
|
143 val symtab = Quotients.get ctxt |
|
144 val maybe_stored_quot_thm = Symtab.lookup symtab qty_full_name |
|
145 in |
|
146 case maybe_stored_quot_thm of |
|
147 SOME {quot_thm = stored_quot_thm} => |
|
148 if Thm.eq_thm_prop (stored_quot_thm, quot_thm) then |
|
149 Quotients.map (Symtab.delete qty_full_name) ctxt |
|
150 else |
|
151 ctxt |
|
152 | NONE => ctxt |
|
153 end |
|
154 |
139 fun dest_quotients ctxt = (* FIXME slightly expensive way to retrieve data *) |
155 fun dest_quotients ctxt = (* FIXME slightly expensive way to retrieve data *) |
140 map snd (Symtab.dest (Quotients.get (Context.Proof ctxt))) |
156 map snd (Symtab.dest (Quotients.get (Context.Proof ctxt))) |
141 |
157 |
142 fun print_quotients ctxt = |
158 fun print_quotients ctxt = |
143 let |
159 let |
151 map prt_quot (Symtab.dest (Quotients.get (Context.Proof ctxt))) |
167 map prt_quot (Symtab.dest (Quotients.get (Context.Proof ctxt))) |
152 |> Pretty.big_list "quotients:" |
168 |> Pretty.big_list "quotients:" |
153 |> Pretty.writeln |
169 |> Pretty.writeln |
154 end |
170 end |
155 |
171 |
|
172 val quot_del_attribute_setup = |
|
173 Attrib.setup @{binding quot_del} (Scan.succeed (Thm.declaration_attribute delete_quotients)) |
|
174 "deletes the Quotient theorem" |
|
175 |
156 structure Invariant_Commute = Named_Thms |
176 structure Invariant_Commute = Named_Thms |
157 ( |
177 ( |
158 val name = @{binding invariant_commute} |
178 val name = @{binding invariant_commute} |
159 val description = "theorems that a relator of an invariant is an invariant of the corresponding predicate" |
179 val description = "theorems that a relator of an invariant is an invariant of the corresponding predicate" |
160 ) |
180 ) |
172 val add_reflp_preserve_rule_attrib = Attrib.internal (K add_reflp_preserve_rule_attribute) |
192 val add_reflp_preserve_rule_attrib = Attrib.internal (K add_reflp_preserve_rule_attribute) |
173 |
193 |
174 (* theory setup *) |
194 (* theory setup *) |
175 |
195 |
176 val setup = |
196 val setup = |
177 quotmaps_attribute_setup |
197 quot_map_attribute_setup |
|
198 #> quot_del_attribute_setup |
178 #> Invariant_Commute.setup |
199 #> Invariant_Commute.setup |
179 #> Reflp_Preserve.setup |
200 #> Reflp_Preserve.setup |
180 |
201 |
181 (* outer syntax commands *) |
202 (* outer syntax commands *) |
182 |
203 |