62 val instT_thm: theory -> typ Symtab.table -> thm -> thm |
62 val instT_thm: theory -> typ Symtab.table -> thm -> thm |
63 val instT_morphism: theory -> typ Symtab.table -> morphism |
63 val instT_morphism: theory -> typ Symtab.table -> morphism |
64 val inst_term: typ Symtab.table * term Symtab.table -> term -> term |
64 val inst_term: typ Symtab.table * term Symtab.table -> term -> term |
65 val inst_thm: theory -> typ Symtab.table * term Symtab.table -> thm -> thm |
65 val inst_thm: theory -> typ Symtab.table * term Symtab.table -> thm -> thm |
66 val inst_morphism: theory -> typ Symtab.table * term Symtab.table -> morphism |
66 val inst_morphism: theory -> typ Symtab.table * term Symtab.table -> morphism |
67 val inst_morphism': theory -> typ Symtab.table * term Symtab.table -> typ Symtab.table * term Symtab.table -> morphism |
|
68 val satisfy_thm: witness list -> thm -> thm |
67 val satisfy_thm: witness list -> thm -> thm |
69 val satisfy_morphism: witness list -> morphism |
68 val satisfy_morphism: witness list -> morphism |
70 val satisfy_facts: witness list -> |
69 val satisfy_facts: witness list -> |
71 ((string * Attrib.src list) * (thm list * Attrib.src list) list) list -> |
70 ((string * Attrib.src list) * (thm list * Attrib.src list) list) list -> |
72 ((string * Attrib.src list) * (thm list * Attrib.src list) list) list |
71 ((string * Attrib.src list) * (thm list * Attrib.src list) list) list |
468 typ = instT_type (#1 envs), |
467 typ = instT_type (#1 envs), |
469 term = inst_term envs, |
468 term = inst_term envs, |
470 fact = map (fn th => inst_thm (Theory.deref thy_ref) envs th)} |
469 fact = map (fn th => inst_thm (Theory.deref thy_ref) envs th)} |
471 end; |
470 end; |
472 |
471 |
473 (* separate instantiation for theorems -- cannot have vars *) |
|
474 fun inst_morphism' thy envs envs' = |
|
475 let val thy_ref = Theory.check_thy thy in |
|
476 Morphism.morphism |
|
477 {name = I, var = I, |
|
478 typ = instT_type (#1 envs), |
|
479 term = inst_term envs, |
|
480 fact = map (fn th => inst_thm (Theory.deref thy_ref) envs' th)} |
|
481 end; |
|
482 |
|
483 |
472 |
484 (* satisfy hypotheses *) |
473 (* satisfy hypotheses *) |
485 |
474 |
486 fun satisfy_thm witns thm = thm |> fold (fn hyp => |
475 fun satisfy_thm witns thm = thm |> fold (fn hyp => |
487 (case find_first (fn Witness (t, _) => Thm.term_of hyp aconv t) witns of |
476 (case find_first (fn Witness (t, _) => Thm.term_of hyp aconv t) witns of |
488 NONE => I |
477 NONE => I |
489 | SOME (Witness (_, th)) => Drule.implies_intr_protected [hyp] #> Goal.comp_hhf th)) |
478 | SOME (Witness (_, th)) => Drule.implies_intr_protected [hyp] #> |
|
479 (fn thm' => Thm.implies_elim thm' |
|
480 (Thm.instantiate (Thm.match (cprop_of th, Drule.protect hyp)) th)))) |
490 (#hyps (Thm.crep_thm thm)); |
481 (#hyps (Thm.crep_thm thm)); |
491 |
482 |
492 fun satisfy_morphism witns = Morphism.thm_morphism (satisfy_thm witns); |
483 fun satisfy_morphism witns = Morphism.thm_morphism (satisfy_thm witns); |
493 |
484 |
494 fun satisfy_facts witns = facts_map (morph_ctxt (satisfy_morphism witns)); |
485 fun satisfy_facts witns = facts_map (morph_ctxt (satisfy_morphism witns)); |