equal
deleted
inserted
replaced
307 (K (ALLGOALS |
307 (K (ALLGOALS |
308 (PRECISE_CONJUNCTS ~1 (ALLGOALS |
308 (PRECISE_CONJUNCTS ~1 (ALLGOALS |
309 (PRECISE_CONJUNCTS ~1 (TRYALL (Tactic.rtac Drule.protectI)))))))))); |
309 (PRECISE_CONJUNCTS ~1 (TRYALL (Tactic.rtac Drule.protectI)))))))))); |
310 |
310 |
311 fun pretty_witness ctxt witn = |
311 fun pretty_witness ctxt witn = |
312 let val prt_term = Pretty.quote o ProofContext.pretty_term ctxt |
312 let val prt_term = Pretty.quote o ProofContext.pretty_term ctxt in |
313 in |
|
314 Pretty.block (prt_term (witness_prop witn) :: |
313 Pretty.block (prt_term (witness_prop witn) :: |
315 (if ! show_hyps then [Pretty.brk 2, Pretty.list "[" "]" |
314 (if ! show_hyps then [Pretty.brk 2, Pretty.list "[" "]" |
316 (map prt_term (witness_hyps witn))] else [])) |
315 (map prt_term (witness_hyps witn))] else [])) |
317 end; |
316 end; |
318 |
317 |
409 if Symtab.is_empty env then th |
408 if Symtab.is_empty env then th |
410 else |
409 else |
411 let val subst = instT_subst env th |
410 let val subst = instT_subst env th |
412 in if null subst then th else th |> hyps_rule (instantiate_tfrees thy subst) end; |
411 in if null subst then th else th |> hyps_rule (instantiate_tfrees thy subst) end; |
413 |
412 |
414 fun instT_morphism thy env = Morphism.morphism |
413 fun instT_morphism thy env = |
415 {name = I, var = I, typ = instT_type env, term = instT_term env, fact = map (instT_thm thy env)}; |
414 let val thy_ref = Theory.self_ref thy in |
|
415 Morphism.morphism |
|
416 {name = I, var = I, |
|
417 typ = instT_type env, |
|
418 term = instT_term env, |
|
419 fact = map (fn th => instT_thm (Theory.deref thy_ref) env th)} |
|
420 end; |
416 |
421 |
417 |
422 |
418 (* instantiate types and terms *) |
423 (* instantiate types and terms *) |
419 |
424 |
420 fun inst_term (envT, env) = |
425 fun inst_term (envT, env) = |
452 (instantiate_tfrees thy substT #> |
457 (instantiate_tfrees thy substT #> |
453 instantiate_frees thy subst #> |
458 instantiate_frees thy subst #> |
454 Drule.fconv_rule (Thm.beta_conversion true)) |
459 Drule.fconv_rule (Thm.beta_conversion true)) |
455 end; |
460 end; |
456 |
461 |
457 fun inst_morphism thy envs = Morphism.morphism |
462 fun inst_morphism thy envs = |
458 {name = I, var = I, typ = instT_type (#1 envs), term = inst_term envs, |
463 let val thy_ref = Theory.self_ref thy in |
459 fact = map (inst_thm thy envs)}; |
464 Morphism.morphism |
|
465 {name = I, var = I, |
|
466 typ = instT_type (#1 envs), |
|
467 term = inst_term envs, |
|
468 fact = map (fn th => inst_thm (Theory.deref thy_ref) envs th)} |
|
469 end; |
460 |
470 |
461 |
471 |
462 (* satisfy hypotheses *) |
472 (* satisfy hypotheses *) |
463 |
473 |
464 fun satisfy_thm witns thm = thm |> fold (fn hyp => |
474 fun satisfy_thm witns thm = thm |> fold (fn hyp => |