src/HOL/Tools/code_evaluation.ML
changeset 45344 e209da839ff4
parent 43329 84472e198515
child 45429 fd58cbf8cae3
equal deleted inserted replaced
45343:873e9c0ca37d 45344:e209da839ff4
    57 fun mk_term_of_eq thy ty (c, (_, tys)) =
    57 fun mk_term_of_eq thy ty (c, (_, tys)) =
    58   let
    58   let
    59     val t = list_comb (Const (c, tys ---> ty),
    59     val t = list_comb (Const (c, tys ---> ty),
    60       map Free (Name.invent_names Name.context "a" tys));
    60       map Free (Name.invent_names Name.context "a" tys));
    61     val (arg, rhs) =
    61     val (arg, rhs) =
    62       pairself (Thm.cterm_of thy o map_types Logic.unvarifyT_global o Logic.varify_global)
    62       pairself (Thm.cterm_of thy o Logic.unvarify_types_global o Logic.varify_global)
    63         (t, (map_aterms (fn t as Free (_, ty) => HOLogic.mk_term_of ty t | t => t) o HOLogic.reflect_term) t)
    63         (t,
       
    64           map_aterms (fn t as Free (_, ty) => HOLogic.mk_term_of ty t | t => t)
       
    65             (HOLogic.reflect_term t));
    64     val cty = Thm.ctyp_of thy ty;
    66     val cty = Thm.ctyp_of thy ty;
    65   in
    67   in
    66     @{thm term_of_anything}
    68     @{thm term_of_anything}
    67     |> Drule.instantiate' [SOME cty] [SOME arg, SOME rhs]
    69     |> Drule.instantiate' [SOME cty] [SOME arg, SOME rhs]
    68     |> Thm.varifyT_global
    70     |> Thm.varifyT_global