176 |
176 |
177 (*axioms*) |
177 (*axioms*) |
178 val (axioms, axioms_thy) = (specs, consts_thy) |-> fold_map (fn ((b, atts), props) => |
178 val (axioms, axioms_thy) = (specs, consts_thy) |-> fold_map (fn ((b, atts), props) => |
179 fold_map Thm.add_axiom_global |
179 fold_map Thm.add_axiom_global |
180 (map (apfst (fn a => Binding.map_name (K a) b)) |
180 (map (apfst (fn a => Binding.map_name (K a) b)) |
181 (Global_Theory.name_multi (Variable.check_name b) (map subst props))) |
181 (Global_Theory.name_multi (Binding.name_of b) (map subst props))) |
182 #>> (fn ths => ((b, atts), [(map #2 ths, [])]))); |
182 #>> (fn ths => ((b, atts), [(map #2 ths, [])]))); |
183 |
183 |
184 (*facts*) |
184 (*facts*) |
185 val (facts, facts_lthy) = axioms_thy |
185 val (facts, facts_lthy) = axioms_thy |
186 |> Named_Target.theory_init |
186 |> Named_Target.theory_init |
326 val goal_ctxt = (fold o fold) (Variable.auto_fixes o fst) propp elems_ctxt; |
326 val goal_ctxt = (fold o fold) (Variable.auto_fixes o fst) propp elems_ctxt; |
327 in (([], prems, stmt, NONE), goal_ctxt) end |
327 in (([], prems, stmt, NONE), goal_ctxt) end |
328 | Element.Obtains obtains => |
328 | Element.Obtains obtains => |
329 let |
329 let |
330 val case_names = obtains |> map_index (fn (i, (b, _)) => |
330 val case_names = obtains |> map_index (fn (i, (b, _)) => |
331 if Binding.is_empty b then string_of_int (i + 1) else Variable.check_name b); |
331 if Binding.is_empty b then string_of_int (i + 1) else Name_Space.base_name b); |
332 val constraints = obtains |> map (fn (_, (vars, _)) => |
332 val constraints = obtains |> map (fn (_, (vars, _)) => |
333 Element.Constrains |
333 Element.Constrains |
334 (vars |> map_filter (fn (x, SOME T) => SOME (Variable.check_name x, T) | _ => NONE))); |
334 (vars |> map_filter (fn (x, SOME T) => SOME (Variable.check_name x, T) | _ => NONE))); |
335 |
335 |
336 val raw_propp = obtains |> map (fn (_, (_, props)) => map (rpair []) props); |
336 val raw_propp = obtains |> map (fn (_, (_, props)) => map (rpair []) props); |