equal
deleted
inserted
replaced
215 val close = Logic.close_prop (map #2 fixes @ frees) prems; |
215 val close = Logic.close_prop (map #2 fixes @ frees) prems; |
216 val specs = |
216 val specs = |
217 map ((apsnd o map) (prep_att vars_ctxt) o fst) raw_concls ~~ map close concls; |
217 map ((apsnd o map) (prep_att vars_ctxt) o fst) raw_concls ~~ map close concls; |
218 |
218 |
219 val spec_name = |
219 val spec_name = |
220 Sign.full_name thy |
220 Binding.conglomerate (if null decls then map (#1 o #1) specs else map (#1 o #1) decls); |
221 (Binding.conglomerate (if null decls then map (#1 o #1) specs else map (#1 o #1) decls)); |
|
222 |
221 |
223 |
222 |
224 (*consts*) |
223 (*consts*) |
225 val (consts, consts_thy) = thy |
224 val (consts, consts_thy) = thy |
226 |> fold_map (fn ((b, _, mx), (_, t)) => Theory.specify_const ((b, Term.type_of t), mx)) decls; |
225 |> fold_map (fn ((b, _, mx), (_, t)) => Theory.specify_const ((b, Term.type_of t), mx)) decls; |
268 val name = Thm.def_binding_optional b a; |
267 val name = Thm.def_binding_optional b a; |
269 val ((lhs, (_, raw_th)), lthy2) = lthy |
268 val ((lhs, (_, raw_th)), lthy2) = lthy |
270 |> Local_Theory.define_internal ((b, mx), ((Binding.suffix_name "_raw" name, []), rhs)); |
269 |> Local_Theory.define_internal ((b, mx), ((Binding.suffix_name "_raw" name, []), rhs)); |
271 |
270 |
272 val th = prove lthy2 raw_th; |
271 val th = prove lthy2 raw_th; |
273 val lthy3 = lthy2 |> Spec_Rules.add const_name Spec_Rules.equational [lhs] [th]; |
272 val lthy3 = lthy2 |> Spec_Rules.add b Spec_Rules.equational [lhs] [th]; |
274 |
273 |
275 val ([(def_name, [th'])], lthy4) = lthy3 |
274 val ([(def_name, [th'])], lthy4) = lthy3 |
276 |> Local_Theory.notes [((name, atts), [([th], [])])]; |
275 |> Local_Theory.notes [((name, atts), [([th], [])])]; |
277 |
276 |
278 val lthy5 = lthy4 |
277 val lthy5 = lthy4 |