src/Pure/drule.ML
changeset 46497 89ccf66aa73d
parent 46496 b8920f3fd259
child 47022 8eac39af4ec0
equal deleted inserted replaced
46496:b8920f3fd259 46497:89ccf66aa73d
   141 fun ctyp_fun f cT = Thm.ctyp_of (Thm.theory_of_ctyp cT) (f (Thm.typ_of cT));
   141 fun ctyp_fun f cT = Thm.ctyp_of (Thm.theory_of_ctyp cT) (f (Thm.typ_of cT));
   142 
   142 
   143 fun certify t = Thm.cterm_of (Context.the_theory (Context.the_thread_data ())) t;
   143 fun certify t = Thm.cterm_of (Context.the_theory (Context.the_thread_data ())) t;
   144 
   144 
   145 val implies = certify Logic.implies;
   145 val implies = certify Logic.implies;
   146 fun mk_implies (A, B) = Thm.capply (Thm.capply implies A) B;
   146 fun mk_implies (A, B) = Thm.apply (Thm.apply implies A) B;
   147 
   147 
   148 (*cterm version of list_implies: [A1,...,An], B  goes to [|A1;==>;An|]==>B *)
   148 (*cterm version of list_implies: [A1,...,An], B  goes to [|A1;==>;An|]==>B *)
   149 fun list_implies([], B) = B
   149 fun list_implies([], B) = B
   150   | list_implies(A::AS, B) = mk_implies (A, list_implies(AS,B));
   150   | list_implies(A::AS, B) = mk_implies (A, list_implies(AS,B));
   151 
   151 
   152 (*cterm version of list_comb: maps  (f, [t1,...,tn])  to  f(t1,...,tn) *)
   152 (*cterm version of list_comb: maps  (f, [t1,...,tn])  to  f(t1,...,tn) *)
   153 fun list_comb (f, []) = f
   153 fun list_comb (f, []) = f
   154   | list_comb (f, t::ts) = list_comb (Thm.capply f t, ts);
   154   | list_comb (f, t::ts) = list_comb (Thm.apply f t, ts);
   155 
   155 
   156 (*cterm version of strip_comb: maps  f(t1,...,tn)  to  (f, [t1,...,tn]) *)
   156 (*cterm version of strip_comb: maps  f(t1,...,tn)  to  (f, [t1,...,tn]) *)
   157 fun strip_comb ct =
   157 fun strip_comb ct =
   158   let
   158   let
   159     fun stripc (p as (ct, cts)) =
   159     fun stripc (p as (ct, cts)) =
   171   | _ => ([], cT));
   171   | _ => ([], cT));
   172 
   172 
   173 (*Beta-conversion for cterms, where x is an abstraction. Simply returns the rhs
   173 (*Beta-conversion for cterms, where x is an abstraction. Simply returns the rhs
   174   of the meta-equality returned by the beta_conversion rule.*)
   174   of the meta-equality returned by the beta_conversion rule.*)
   175 fun beta_conv x y =
   175 fun beta_conv x y =
   176   Thm.dest_arg (cprop_of (Thm.beta_conversion false (Thm.capply x y)));
   176   Thm.dest_arg (cprop_of (Thm.beta_conversion false (Thm.apply x y)));
   177 
   177 
   178 
   178 
   179 
   179 
   180 (*** Find the type (sort) associated with a (T)Var or (T)Free in a term
   180 (*** Find the type (sort) associated with a (T)Var or (T)Free in a term
   181      Used for establishing default types (of variables) and sorts (of
   181      Used for establishing default types (of variables) and sorts (of
   671   val CA = mk_implies (C, A);
   671   val CA = mk_implies (C, A);
   672 in
   672 in
   673 
   673 
   674 (* protect *)
   674 (* protect *)
   675 
   675 
   676 val protect = Thm.capply (certify Logic.protectC);
   676 val protect = Thm.apply (certify Logic.protectC);
   677 
   677 
   678 val protectI =
   678 val protectI =
   679   store_standard_thm (Binding.conceal (Binding.name "protectI"))
   679   store_standard_thm (Binding.conceal (Binding.name "protectI"))
   680     (Thm.equal_elim (Thm.symmetric prop_def) (Thm.assume A));
   680     (Thm.equal_elim (Thm.symmetric prop_def) (Thm.assume A));
   681 
   681