247 |> Thm.cterm_of ctxt |
247 |> Thm.cterm_of ctxt |
248 |> meta_rewrite_conv ctxt |
248 |> meta_rewrite_conv ctxt |
249 |> (snd o Logic.dest_equals o Thm.prop_of) |
249 |> (snd o Logic.dest_equals o Thm.prop_of) |
250 |> conditional ? Logic.strip_imp_concl |
250 |> conditional ? Logic.strip_imp_concl |
251 |> (abs_def o #2 o cert_def ctxt get_pos); |
251 |> (abs_def o #2 o cert_def ctxt get_pos); |
252 fun prove ctxt' def = |
252 fun prove def_ctxt def = |
253 Goal.prove ctxt' |
253 Goal.prove def_ctxt |
254 ((not (Variable.is_body ctxt') ? Variable.add_free_names ctxt' prop) []) [] prop |
254 ((not (Variable.is_body def_ctxt) ? Variable.add_free_names def_ctxt prop) []) [] prop |
255 (fn {context = ctxt'', ...} => |
255 (fn {context = goal_ctxt, ...} => |
256 ALLGOALS |
256 ALLGOALS |
257 (CONVERSION (meta_rewrite_conv ctxt'') THEN' |
257 (CONVERSION (meta_rewrite_conv goal_ctxt) THEN' |
258 rewrite_goal_tac ctxt'' [def] THEN' |
258 rewrite_goal_tac goal_ctxt [def] THEN' |
259 resolve_tac ctxt'' [Drule.reflexive_thm])) |
259 resolve_tac goal_ctxt [Drule.reflexive_thm])) |
260 handle ERROR msg => cat_error msg "Failed to prove definitional specification"; |
260 handle ERROR msg => cat_error msg "Failed to prove definitional specification"; |
261 in (((c, T), rhs), prove) end; |
261 in (((c, T), rhs), prove) end; |
262 |
262 |
263 end; |
263 end; |