205 val used = map fst (fold Term.add_frees fs []); |
205 val used = map fst (fold Term.add_frees fs []); |
206 val x = (Name.variant used "x", dummyT); |
206 val x = (Name.variant used "x", dummyT); |
207 val frees = ls @ x :: rs; |
207 val frees = ls @ x :: rs; |
208 val raw_rhs = list_abs_free (frees, |
208 val raw_rhs = list_abs_free (frees, |
209 list_comb (Const (rec_name, dummyT), fs @ [Free x])) |
209 list_comb (Const (rec_name, dummyT), fs @ [Free x])) |
210 val def_name = Thm.def_name (Sign.base_name fname); |
210 val def_name = Thm.def_name (NameSpace.base_name fname); |
211 val rhs = singleton (Syntax.check_terms ctxt) raw_rhs; |
211 val rhs = singleton (Syntax.check_terms ctxt) raw_rhs; |
212 val SOME var = get_first (fn ((b, _), mx) => |
212 val SOME var = get_first (fn ((b, _), mx) => |
213 if Binding.name_of b = fname then SOME (b, mx) else NONE) fixes; |
213 if Binding.name_of b = fname then SOME (b, mx) else NONE) fixes; |
214 in |
214 in |
215 ((var, ((Binding.name def_name, []), rhs)), |
215 ((var, ((Binding.name def_name, []), rhs)), |
284 val (defs_thms, lthy') = lthy |> |
284 val (defs_thms, lthy') = lthy |> |
285 set_group ? LocalTheory.set_group (serial_string ()) |> |
285 set_group ? LocalTheory.set_group (serial_string ()) |> |
286 fold_map (apfst (snd o snd) oo |
286 fold_map (apfst (snd o snd) oo |
287 LocalTheory.define Thm.definitionK o fst) defs'; |
287 LocalTheory.define Thm.definitionK o fst) defs'; |
288 val qualify = Binding.qualify false |
288 val qualify = Binding.qualify false |
289 (space_implode "_" (map (Sign.base_name o #1) defs)); |
289 (space_implode "_" (map (NameSpace.base_name o #1) defs)); |
290 val names_atts' = map (apfst qualify) names_atts; |
290 val names_atts' = map (apfst qualify) names_atts; |
291 val cert = cterm_of (ProofContext.theory_of lthy'); |
291 val cert = cterm_of (ProofContext.theory_of lthy'); |
292 |
292 |
293 fun mk_idx eq = |
293 fun mk_idx eq = |
294 let |
294 let |