83 NONE => (case get_defn thy defs s T of |
82 NONE => (case get_defn thy defs s T of |
84 NONE => thyname_of_const s thy |
83 NONE => thyname_of_const s thy |
85 | SOME ((_, (thyname, _)), _) => thyname) |
84 | SOME ((_, (thyname, _)), _) => thyname) |
86 | SOME thyname => thyname) |
85 | SOME thyname => thyname) |
87 end); |
86 end); |
88 |
|
89 fun get_thm_equations thy (c, ty) = |
|
90 Symtab.lookup (CodegenData.get thy) c |
|
91 |> Option.map (fn thms => |
|
92 List.filter (fn (thm, _) => is_instance thy ty ((snd o const_of o prop_of) thm)) thms |
|
93 |> del_redundant thy []) |
|
94 |> Option.mapPartial (fn thms => if null thms then NONE else SOME thms) |
|
95 |> Option.map (fn thms => |
|
96 (preprocess thy (map fst thms), |
|
97 (snd o const_of o prop_of o fst o hd) thms)) |
|
98 |> (Option.map o apfst o map) (fn thm => thm RS HOL.eq_reflection); |
|
99 |
87 |
100 fun mk_suffix thy defs (s, T) = (case get_defn thy defs s T of |
88 fun mk_suffix thy defs (s, T) = (case get_defn thy defs s T of |
101 SOME (_, SOME i) => " def" ^ string_of_int i | _ => ""); |
89 SOME (_, SOME i) => " def" ^ string_of_int i | _ => ""); |
102 |
90 |
103 exception EQN of string * typ * string; |
91 exception EQN of string * typ * string; |