src/Pure/more_thm.ML
changeset 74243 de383840425f
parent 74242 5e3f4efa87f9
child 74244 12dac3698efd
equal deleted inserted replaced
74242:5e3f4efa87f9 74243:de383840425f
    23   include THM
    23   include THM
    24   structure Ctermtab: TABLE
    24   structure Ctermtab: TABLE
    25   structure Thmtab: TABLE
    25   structure Thmtab: TABLE
    26   val eq_ctyp: ctyp * ctyp -> bool
    26   val eq_ctyp: ctyp * ctyp -> bool
    27   val aconvc: cterm * cterm -> bool
    27   val aconvc: cterm * cterm -> bool
    28   val add_tvars: thm -> ctyp list -> ctyp list
    28   val add_tvars: thm -> ctyp Term_Subst.TVars.table -> ctyp Term_Subst.TVars.table
    29   val add_vars: thm -> cterm list -> cterm list
    29   val add_vars: thm -> cterm Term_Subst.Vars.table -> cterm Term_Subst.Vars.table
    30   val frees_of: thm -> cterm list
    30   val frees_of: thm -> cterm list
    31   val dest_funT: ctyp -> ctyp * ctyp
    31   val dest_funT: ctyp -> ctyp * ctyp
    32   val strip_type: ctyp -> ctyp list * ctyp
    32   val strip_type: ctyp -> ctyp list * ctyp
    33   val all_name: Proof.context -> string * cterm -> cterm -> cterm
    33   val all_name: Proof.context -> string * cterm -> cterm -> cterm
    34   val all: Proof.context -> cterm -> cterm -> cterm
    34   val all: Proof.context -> cterm -> cterm -> cterm
   136 
   136 
   137 val eq_ctyp = op = o apply2 Thm.typ_of;
   137 val eq_ctyp = op = o apply2 Thm.typ_of;
   138 val op aconvc = op aconv o apply2 Thm.term_of;
   138 val op aconvc = op aconv o apply2 Thm.term_of;
   139 
   139 
   140 val add_tvars =
   140 val add_tvars =
   141   Thm.fold_atomic_ctyps {hyps = false} (fn a => is_TVar (Thm.typ_of a) ? insert eq_ctyp a);
   141   Thm.fold_atomic_ctyps {hyps = false} (fn cT => fn tab =>
       
   142     (case Thm.typ_of cT of
       
   143       TVar v =>
       
   144         if not (Term_Subst.TVars.defined tab v)
       
   145         then Term_Subst.TVars.update (v, cT) tab
       
   146         else tab
       
   147     | _ => tab));
       
   148 
   142 val add_vars =
   149 val add_vars =
   143   Thm.fold_atomic_cterms {hyps = false} (fn a => is_Var (Thm.term_of a) ? insert (op aconvc) a);
   150   Thm.fold_atomic_cterms {hyps = false} (fn ct => fn tab =>
       
   151     (case Thm.term_of ct of
       
   152       Var v =>
       
   153         if not (Term_Subst.Vars.defined tab v)
       
   154         then Term_Subst.Vars.update (v, ct) tab
       
   155         else tab
       
   156     | _ => tab));
   144 
   157 
   145 fun frees_of th =
   158 fun frees_of th =
   146   (th, (Term_Subst.Frees.empty, [])) |-> Thm.fold_atomic_cterms {hyps = true}
   159   (th, (Term_Subst.Frees.empty, [])) |-> Thm.fold_atomic_cterms {hyps = true}
   147     (fn a => fn (set, list) =>
   160     (fn a => fn (set, list) =>
   148       (case Thm.term_of a of
   161       (case Thm.term_of a of