src/Pure/drule.ML
changeset 35985 0bbf0d2348f9
parent 35897 8758895ea413
child 36330 0584e203960e
equal deleted inserted replaced
35984:87e6e2737aee 35985:0bbf0d2348f9
    14   val strip_imp_concl: cterm -> cterm
    14   val strip_imp_concl: cterm -> cterm
    15   val cprems_of: thm -> cterm list
    15   val cprems_of: thm -> cterm list
    16   val cterm_fun: (term -> term) -> (cterm -> cterm)
    16   val cterm_fun: (term -> term) -> (cterm -> cterm)
    17   val ctyp_fun: (typ -> typ) -> (ctyp -> ctyp)
    17   val ctyp_fun: (typ -> typ) -> (ctyp -> ctyp)
    18   val forall_intr_list: cterm list -> thm -> thm
    18   val forall_intr_list: cterm list -> thm -> thm
    19   val forall_intr_frees: thm -> thm
       
    20   val forall_intr_vars: thm -> thm
    19   val forall_intr_vars: thm -> thm
    21   val forall_elim_list: cterm list -> thm -> thm
    20   val forall_elim_list: cterm list -> thm -> thm
    22   val gen_all: thm -> thm
    21   val gen_all: thm -> thm
    23   val lift_all: cterm -> thm -> thm
    22   val lift_all: cterm -> thm -> thm
    24   val legacy_freeze_thaw: thm -> thm * (thm -> thm)
    23   val legacy_freeze_thaw: thm -> thm * (thm -> thm)
   212     (Thm.fold_terms Term.add_tvars th []) th;
   211     (Thm.fold_terms Term.add_tvars th []) th;
   213 
   212 
   214 (*Generalization over a list of variables*)
   213 (*Generalization over a list of variables*)
   215 val forall_intr_list = fold_rev forall_intr;
   214 val forall_intr_list = fold_rev forall_intr;
   216 
   215 
   217 (*Generalization over all suitable Free variables*)
       
   218 fun forall_intr_frees th =
       
   219     let
       
   220       val thy = Thm.theory_of_thm th;
       
   221       val {prop, hyps, tpairs, ...} = rep_thm th;
       
   222       val fixed = fold Term.add_frees (Thm.terms_of_tpairs tpairs @ hyps) [];
       
   223       val frees = Term.fold_aterms (fn Free v =>
       
   224         if member (op =) fixed v then I else insert (op =) v | _ => I) prop [];
       
   225     in fold (forall_intr o cterm_of thy o Free) frees th end;
       
   226 
       
   227 (*Generalization over Vars -- canonical order*)
   216 (*Generalization over Vars -- canonical order*)
   228 fun forall_intr_vars th =
   217 fun forall_intr_vars th =
   229   fold forall_intr
   218   fold forall_intr
   230     (map (Thm.cterm_of (Thm.theory_of_thm th) o Var) (Thm.fold_terms Term.add_vars th [])) th;
   219     (map (Thm.cterm_of (Thm.theory_of_thm th) o Var) (Thm.fold_terms Term.add_vars th [])) th;
   231 
   220 
   304 
   293 
   305 (* old-style export without context *)
   294 (* old-style export without context *)
   306 
   295 
   307 val export_without_context_open =
   296 val export_without_context_open =
   308   implies_intr_hyps
   297   implies_intr_hyps
   309   #> forall_intr_frees
   298   #> Thm.forall_intr_frees
   310   #> `Thm.maxidx_of
   299   #> `Thm.maxidx_of
   311   #-> (fn maxidx =>
   300   #-> (fn maxidx =>
   312     Thm.forall_elim_vars (maxidx + 1)
   301     Thm.forall_elim_vars (maxidx + 1)
   313     #> Thm.strip_shyps
   302     #> Thm.strip_shyps
   314     #> zero_var_indexes
   303     #> zero_var_indexes