equal
deleted
inserted
replaced
158 |
158 |
159 fun ctyp_fun f cT = |
159 fun ctyp_fun f cT = |
160 let val {T, thy, ...} = Thm.rep_ctyp cT |
160 let val {T, thy, ...} = Thm.rep_ctyp cT |
161 in Thm.ctyp_of thy (f T) end; |
161 in Thm.ctyp_of thy (f T) end; |
162 |
162 |
163 val cert = cterm_of ProtoPure.thy; |
163 val cert = cterm_of (Context.the_theory (Context.the_thread_data ())); |
164 |
164 |
165 val implies = cert Term.implies; |
165 val implies = cert Term.implies; |
166 fun mk_implies (A, B) = Thm.capply (Thm.capply implies A) B; |
166 fun mk_implies (A, B) = Thm.capply (Thm.capply implies A) B; |
167 |
167 |
168 (*cterm version of list_implies: [A1,...,An], B goes to [|A1;==>;An|]==>B *) |
168 (*cterm version of list_implies: [A1,...,An], B goes to [|A1;==>;An|]==>B *) |
516 |
516 |
517 |
517 |
518 |
518 |
519 (*** Meta-Rewriting Rules ***) |
519 (*** Meta-Rewriting Rules ***) |
520 |
520 |
521 val read_prop = Thm.cterm_of ProtoPure.thy o SimpleSyntax.read_prop; |
521 val read_prop = cert o SimpleSyntax.read_prop; |
522 |
522 |
523 fun store_thm name thm = hd (PureThy.smart_store_thms (name, [thm])); |
523 fun store_thm name thm = hd (PureThy.smart_store_thms (name, [thm])); |
524 fun store_standard_thm name thm = store_thm name (standard thm); |
524 fun store_standard_thm name thm = store_thm name (standard thm); |
525 fun store_thm_open name thm = hd (PureThy.smart_store_thms_open (name, [thm])); |
525 fun store_thm_open name thm = hd (PureThy.smart_store_thms_open (name, [thm])); |
526 fun store_standard_thm_open name thm = store_thm_open name (standard' thm); |
526 fun store_standard_thm_open name thm = store_thm_open name (standard' thm); |
856 |
856 |
857 (** protected propositions and embedded terms **) |
857 (** protected propositions and embedded terms **) |
858 |
858 |
859 local |
859 local |
860 val A = cert (Free ("A", propT)); |
860 val A = cert (Free ("A", propT)); |
861 val prop_def = Thm.unvarify ProtoPure.prop_def; |
861 val get_axiom = Thm.unvarify o Thm.get_axiom (Context.the_theory (Context.the_thread_data ())); |
862 val term_def = Thm.unvarify ProtoPure.term_def; |
862 val prop_def = get_axiom "prop_def"; |
|
863 val term_def = get_axiom "term_def"; |
863 in |
864 in |
864 val protect = Thm.capply (cert Logic.protectC); |
865 val protect = Thm.capply (cert Logic.protectC); |
865 val protectI = store_thm "protectI" (PureThy.kind_rule Thm.internalK (standard |
866 val protectI = store_thm "protectI" (PureThy.kind_rule Thm.internalK (standard |
866 (Thm.equal_elim (Thm.symmetric prop_def) (Thm.assume A)))); |
867 (Thm.equal_elim (Thm.symmetric prop_def) (Thm.assume A)))); |
867 val protectD = store_thm "protectD" (PureThy.kind_rule Thm.internalK (standard |
868 val protectD = store_thm "protectD" (PureThy.kind_rule Thm.internalK (standard |
897 end; |
898 end; |
898 |
899 |
899 fun cterm_rule f = dest_term o f o mk_term; |
900 fun cterm_rule f = dest_term o f o mk_term; |
900 fun term_rule thy f t = Thm.term_of (cterm_rule f (Thm.cterm_of thy t)); |
901 fun term_rule thy f t = Thm.term_of (cterm_rule f (Thm.cterm_of thy t)); |
901 |
902 |
902 val dummy_thm = mk_term (Thm.cterm_of ProtoPure.thy (Term.dummy_pattern propT)); |
903 val dummy_thm = mk_term (cert (Term.dummy_pattern propT)); |
903 |
904 |
904 |
905 |
905 |
906 |
906 (** variations on instantiate **) |
907 (** variations on instantiate **) |
907 |
908 |