src/Pure/goal.ML
changeset 74282 c2ee8d993d6a
parent 74269 f084d599bb44
child 74526 bbfed17243af
equal deleted inserted replaced
74281:7829d6435c60 74282:c2ee8d993d6a
    56 
    56 
    57 (*
    57 (*
    58   -------- (init)
    58   -------- (init)
    59   C \<Longrightarrow> #C
    59   C \<Longrightarrow> #C
    60 *)
    60 *)
    61 fun init C = Thm.instantiate ([], [((("A", 0), propT), C)]) Drule.protectI;
    61 fun init C = Thm.instantiate (TVars.empty, Vars.make [((("A", 0), propT), C)]) Drule.protectI;
    62 
    62 
    63 (*
    63 (*
    64   A1 \<Longrightarrow> ... \<Longrightarrow> An \<Longrightarrow> C
    64   A1 \<Longrightarrow> ... \<Longrightarrow> An \<Longrightarrow> C
    65   ------------------------ (protect n)
    65   ------------------------ (protect n)
    66   A1 \<Longrightarrow> ... \<Longrightarrow> An \<Longrightarrow> #C
    66   A1 \<Longrightarrow> ... \<Longrightarrow> An \<Longrightarrow> #C
   120     val xs = Frees.fold_rev (cons o Thm.cterm_of ctxt o Free o #1) frees [];
   120     val xs = Frees.fold_rev (cons o Thm.cterm_of ctxt o Free o #1) frees [];
   121 
   121 
   122     val tfrees = TFrees.build (fold TFrees.add_tfrees (prop :: As));
   122     val tfrees = TFrees.build (fold TFrees.add_tfrees (prop :: As));
   123     val Ts = Names.build (TFrees.fold (Names.add_set o #1 o #1) tfrees);
   123     val Ts = Names.build (TFrees.fold (Names.add_set o #1 o #1) tfrees);
   124     val instT =
   124     val instT =
   125       build (tfrees |> TFrees.fold (fn ((a, S), _) =>
   125       TVars.build (tfrees |> TFrees.fold (fn ((a, S), _) =>
   126         cons (((a, 0), S), Thm.ctyp_of ctxt (TFree (a, S)))));
   126         TVars.add (((a, 0), S), Thm.ctyp_of ctxt (TFree (a, S)))));
   127 
   127 
   128     val global_prop =
   128     val global_prop =
   129       Logic.list_implies (As, prop)
   129       Logic.list_implies (As, prop)
   130       |> Frees.fold_rev (Logic.all o Free o #1) frees
   130       |> Frees.fold_rev (Logic.all o Free o #1) frees
   131       |> Logic.varify_types_global
   131       |> Logic.varify_types_global
   140         Thm.strip_shyps #>
   140         Thm.strip_shyps #>
   141         Thm.solve_constraints);
   141         Thm.solve_constraints);
   142     val local_result =
   142     val local_result =
   143       Thm.future global_result global_prop
   143       Thm.future global_result global_prop
   144       |> Thm.close_derivation \<^here>
   144       |> Thm.close_derivation \<^here>
   145       |> Thm.instantiate (instT, [])
   145       |> Thm.instantiate (instT, Vars.empty)
   146       |> Drule.forall_elim_list xs
   146       |> Drule.forall_elim_list xs
   147       |> fold (Thm.elim_implies o Thm.assume) assms
   147       |> fold (Thm.elim_implies o Thm.assume) assms
   148       |> Thm.solve_constraints;
   148       |> Thm.solve_constraints;
   149   in local_result end;
   149   in local_result end;
   150 
   150