src/Pure/drule.ML
changeset 14081 6c0f67e2f8d5
parent 13659 3cf622f6b0b2
child 14340 bc93ffa674cc
equal deleted inserted replaced
14080:9a50427d7165 14081:6c0f67e2f8d5
   118   val mk_triv_goal: cterm -> thm
   118   val mk_triv_goal: cterm -> thm
   119   val tvars_of_terms: term list -> (indexname * sort) list
   119   val tvars_of_terms: term list -> (indexname * sort) list
   120   val vars_of_terms: term list -> (indexname * typ) list
   120   val vars_of_terms: term list -> (indexname * typ) list
   121   val tvars_of: thm -> (indexname * sort) list
   121   val tvars_of: thm -> (indexname * sort) list
   122   val vars_of: thm -> (indexname * typ) list
   122   val vars_of: thm -> (indexname * typ) list
       
   123   val rename_bvars: (string * string) list -> thm -> thm
       
   124   val rename_bvars': string option list -> thm -> thm
   123   val unvarifyT: thm -> thm
   125   val unvarifyT: thm -> thm
   124   val unvarify: thm -> thm
   126   val unvarify: thm -> thm
   125   val tvars_intr_list: string list -> thm -> thm * (string * indexname) list
   127   val tvars_intr_list: string list -> thm -> thm * (string * indexname) list
   126   val remdups_rl: thm
   128   val remdups_rl: thm
   127   val conj_intr: thm -> thm -> thm
   129   val conj_intr: thm -> thm -> thm
   847       if forall is_none cts then thm'
   849       if forall is_none cts then thm'
   848       else Thm.instantiate ([], map inst_of (zip_vars (vars_of thm') cts)) thm'
   850       else Thm.instantiate ([], map inst_of (zip_vars (vars_of thm') cts)) thm'
   849     end;
   851     end;
   850 
   852 
   851 
   853 
       
   854 
       
   855 (** renaming of bound variables **)
       
   856 
       
   857 (* replace bound variables x_i in thm by y_i *)
       
   858 (* where vs = [(x_1, y_1), ..., (x_n, y_n)]  *)
       
   859 
       
   860 fun rename_bvars [] thm = thm
       
   861   | rename_bvars vs thm =
       
   862     let
       
   863       val {sign, prop, ...} = rep_thm thm;
       
   864       fun ren (Abs (x, T, t)) = Abs (if_none (assoc (vs, x)) x, T, ren t)
       
   865         | ren (t $ u) = ren t $ ren u
       
   866         | ren t = t;
       
   867     in equal_elim (reflexive (cterm_of sign (ren prop))) thm end;
       
   868 
       
   869 
       
   870 (* renaming in left-to-right order *)
       
   871 
       
   872 fun rename_bvars' xs thm =
       
   873   let
       
   874     val {sign, prop, ...} = rep_thm thm;
       
   875     fun rename [] t = ([], t)
       
   876       | rename (x' :: xs) (Abs (x, T, t)) =
       
   877           let val (xs', t') = rename xs t
       
   878           in (xs', Abs (if_none x' x, T, t')) end
       
   879       | rename xs (t $ u) =
       
   880           let
       
   881             val (xs', t') = rename xs t;
       
   882             val (xs'', u') = rename xs' u
       
   883           in (xs'', t' $ u') end
       
   884       | rename xs t = (xs, t);
       
   885   in case rename xs prop of
       
   886       ([], prop') => equal_elim (reflexive (cterm_of sign prop')) thm
       
   887     | _ => error "More names than abstractions in theorem"
       
   888   end;
       
   889 
       
   890 
       
   891 
   852 (* unvarify(T) *)
   892 (* unvarify(T) *)
   853 
   893 
   854 (*assume thm in standard form, i.e. no frees, 0 var indexes*)
   894 (*assume thm in standard form, i.e. no frees, 0 var indexes*)
   855 
   895 
   856 fun unvarifyT thm =
   896 fun unvarifyT thm =