src/Pure/goal.ML
changeset 28973 c549650d1442
parent 28619 89f9dd800a22
child 29088 95a239a5e055
equal deleted inserted replaced
28972:cb8a2c3e188f 28973:c549650d1442
    18   val init: cterm -> thm
    18   val init: cterm -> thm
    19   val protect: thm -> thm
    19   val protect: thm -> thm
    20   val conclude: thm -> thm
    20   val conclude: thm -> thm
    21   val finish: thm -> thm
    21   val finish: thm -> thm
    22   val norm_result: thm -> thm
    22   val norm_result: thm -> thm
    23   val future_result: Proof.context -> (unit -> thm) -> term -> thm
    23   val future_result: Proof.context -> thm future -> term -> thm
    24   val prove_internal: cterm list -> cterm -> (thm list -> tactic) -> thm
    24   val prove_internal: cterm list -> cterm -> (thm list -> tactic) -> thm
    25   val prove_multi: Proof.context -> string list -> term list -> term list ->
    25   val prove_multi: Proof.context -> string list -> term list -> term list ->
    26     ({prems: thm list, context: Proof.context} -> tactic) -> thm list
    26     ({prems: thm list, context: Proof.context} -> tactic) -> thm list
    27   val prove_future: Proof.context -> string list -> term list -> term ->
    27   val prove_future: Proof.context -> string list -> term list -> term ->
    28     ({prems: thm list, context: Proof.context} -> tactic) -> thm
    28     ({prems: thm list, context: Proof.context} -> tactic) -> thm
   114     val tfrees = fold Term.add_tfrees (prop :: As) [];
   114     val tfrees = fold Term.add_tfrees (prop :: As) [];
   115     val instT = map (fn (a, S) => (certT (TVar ((a, 0), S)), certT (TFree (a, S)))) tfrees;
   115     val instT = map (fn (a, S) => (certT (TVar ((a, 0), S)), certT (TFree (a, S)))) tfrees;
   116 
   116 
   117     val global_prop =
   117     val global_prop =
   118       Term.map_types Logic.varifyT (fold_rev Logic.all xs (Logic.list_implies (As, prop)));
   118       Term.map_types Logic.varifyT (fold_rev Logic.all xs (Logic.list_implies (As, prop)));
   119     val global_result =
   119     val global_result = result |> Future.map
   120       Thm.generalize (map #1 tfrees, []) 0 o
   120       (Thm.adjust_maxidx_thm ~1 #>
   121       Drule.forall_intr_list fixes o
   121         Drule.implies_intr_list assms #>
   122       Drule.implies_intr_list assms o
   122         Drule.forall_intr_list fixes #>
   123       Thm.adjust_maxidx_thm ~1 o result;
   123         Thm.generalize (map #1 tfrees, []) 0);
   124     val local_result =
   124     val local_result =
   125       Thm.future global_result (cert global_prop)
   125       Thm.future global_result (cert global_prop)
   126       |> Thm.instantiate (instT, [])
   126       |> Thm.instantiate (instT, [])
   127       |> Drule.forall_elim_list fixes
   127       |> Drule.forall_elim_list fixes
   128       |> fold (Thm.elim_implies o Thm.assume) assms;
   128       |> fold (Thm.elim_implies o Thm.assume) assms;
   176             then Thm.check_shyps sorts res
   176             then Thm.check_shyps sorts res
   177             else err ("Proved a different theorem: " ^ string_of_term (Thm.prop_of res))
   177             else err ("Proved a different theorem: " ^ string_of_term (Thm.prop_of res))
   178           end);
   178           end);
   179     val res =
   179     val res =
   180       if immediate orelse #maxidx (Thm.rep_cterm stmt) >= 0 then result ()
   180       if immediate orelse #maxidx (Thm.rep_cterm stmt) >= 0 then result ()
   181       else future_result ctxt' result (Thm.term_of stmt);
   181       else future_result ctxt' (Future.fork_background result) (Thm.term_of stmt);
   182   in
   182   in
   183     Conjunction.elim_balanced (length props) res
   183     Conjunction.elim_balanced (length props) res
   184     |> map (Assumption.export false ctxt' ctxt)
   184     |> map (Assumption.export false ctxt' ctxt)
   185     |> Variable.export ctxt' ctxt
   185     |> Variable.export ctxt' ctxt
   186     |> map Drule.zero_var_indexes
   186     |> map Drule.zero_var_indexes