src/HOL/Nominal/nominal_fresh_fun.ML
changeset 42364 8c674b3b8e44
parent 42361 23f352990944
child 42806 4b660cdab9b7
equal deleted inserted replaced
42363:e52e3f697510 42364:8c674b3b8e44
    53 fun generate_fresh_tac atom_name i thm =
    53 fun generate_fresh_tac atom_name i thm =
    54  let
    54  let
    55    val thy = theory_of_thm thm;
    55    val thy = theory_of_thm thm;
    56 (* the parsing function returns a qualified name, we get back the base name *)
    56 (* the parsing function returns a qualified name, we get back the base name *)
    57    val atom_basename = Long_Name.base_name atom_name;
    57    val atom_basename = Long_Name.base_name atom_name;
    58    val goal = List.nth(prems_of thm, i-1);
    58    val goal = nth (prems_of thm) (i - 1);
    59    val ps = Logic.strip_params goal;
    59    val ps = Logic.strip_params goal;
    60    val Ts = rev (map snd ps);
    60    val Ts = rev (map snd ps);
    61    fun is_of_fs_name T = Sign.of_sort thy (T, [Sign.intern_class thy ("fs_"^atom_basename)]);
    61    fun is_of_fs_name T = Sign.of_sort thy (T, [Sign.intern_class thy ("fs_"^atom_basename)]);
    62 (* rebuild de bruijn indices *)
    62 (* rebuild de bruijn indices *)
    63    val bvs = map_index (Bound o fst) ps;
    63    val bvs = map_index (Bound o fst) ps;
    95 (* This tactic generates a fresh name of the atom type *)
    95 (* This tactic generates a fresh name of the atom type *)
    96 (* given by the innermost fresh_fun                    *)
    96 (* given by the innermost fresh_fun                    *)
    97 
    97 
    98 fun generate_fresh_fun_tac i thm =
    98 fun generate_fresh_fun_tac i thm =
    99   let
    99   let
   100     val goal = List.nth(prems_of thm, i-1);
   100     val goal = nth (prems_of thm) (i - 1);
   101     val atom_name_opt = get_inner_fresh_fun goal;
   101     val atom_name_opt = get_inner_fresh_fun goal;
   102   in
   102   in
   103   case atom_name_opt of
   103   case atom_name_opt of
   104     NONE => all_tac thm
   104     NONE => all_tac thm
   105   | SOME atom_name  => generate_fresh_tac atom_name i thm
   105   | SOME atom_name  => generate_fresh_tac atom_name i thm