src/Pure/more_thm.ML
changeset 74249 9d9e7ed01dbb
parent 74247 a88fda85bd25
child 74265 633fe7390c97
equal deleted inserted replaced
74248:ea9f2cb22e50 74249:9d9e7ed01dbb
    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 Term_Subst.TVars.table -> ctyp Term_Subst.TVars.table
    28   val add_tvars: thm -> ctyp Term_Subst.TVars.table -> ctyp Term_Subst.TVars.table
    29   val add_vars: thm -> cterm Term_Subst.Vars.table -> cterm Term_Subst.Vars.table
    29   val add_vars: thm -> cterm Term_Subst.Vars.table -> cterm Term_Subst.Vars.table
    30   val frees_of: thm -> cterm list
       
    31   val dest_funT: ctyp -> ctyp * ctyp
    30   val dest_funT: ctyp -> ctyp * ctyp
    32   val strip_type: ctyp -> ctyp list * ctyp
    31   val strip_type: ctyp -> ctyp list * ctyp
    33   val all_name: Proof.context -> string * cterm -> cterm -> cterm
    32   val all_name: Proof.context -> string * cterm -> cterm -> cterm
    34   val all: Proof.context -> cterm -> cterm -> cterm
    33   val all: Proof.context -> cterm -> cterm -> cterm
    35   val mk_binop: cterm -> cterm -> cterm -> cterm
    34   val mk_binop: cterm -> cterm -> cterm -> cterm
   146 val add_vars =
   145 val add_vars =
   147   Thm.fold_atomic_cterms {hyps = false} Term.is_Var (fn ct => fn tab =>
   146   Thm.fold_atomic_cterms {hyps = false} Term.is_Var (fn ct => fn tab =>
   148     let val v = Term.dest_Var (Thm.term_of ct)
   147     let val v = Term.dest_Var (Thm.term_of ct)
   149     in tab |> not (Term_Subst.Vars.defined tab v) ? Term_Subst.Vars.update (v, ct) end);
   148     in tab |> not (Term_Subst.Vars.defined tab v) ? Term_Subst.Vars.update (v, ct) end);
   150 
   149 
   151 fun frees_of th =
       
   152   (th, (Term_Subst.Frees.empty, [])) |-> Thm.fold_atomic_cterms {hyps = true} Term.is_Free
       
   153     (fn ct => fn (set, list) =>
       
   154       let val v = Term.dest_Free (Thm.term_of ct) in
       
   155         if not (Term_Subst.Frees.defined set v)
       
   156         then (Term_Subst.Frees.add (v, ()) set, ct :: list)
       
   157         else (set, list)
       
   158       end)
       
   159   |> #2;
       
   160 
       
   161 
   150 
   162 (* ctyp operations *)
   151 (* ctyp operations *)
   163 
   152 
   164 fun dest_funT cT =
   153 fun dest_funT cT =
   165   (case Thm.typ_of cT of
   154   (case Thm.typ_of cT of