src/Pure/Isar/proof.ML
changeset 19900 21a99d88d925
parent 19862 7f29aa958b72
child 19915 b08e26fb247e
equal deleted inserted replaced
19899:b7385ca02d79 19900:21a99d88d925
    16   val assert_bottom: bool -> state -> state
    16   val assert_bottom: bool -> state -> state
    17   val context_of: state -> context
    17   val context_of: state -> context
    18   val theory_of: state -> theory
    18   val theory_of: state -> theory
    19   val sign_of: state -> theory    (*obsolete*)
    19   val sign_of: state -> theory    (*obsolete*)
    20   val map_context: (context -> context) -> state -> state
    20   val map_context: (context -> context) -> state -> state
    21   val warn_extra_tfrees: state -> state -> state
       
    22   val add_binds_i: (indexname * term option) list -> state -> state
    21   val add_binds_i: (indexname * term option) list -> state -> state
    23   val put_thms: bool -> string * thm list option -> state -> state
    22   val put_thms: bool -> string * thm list option -> state -> state
    24   val put_thms_internal: string * thm list option -> state -> state
    23   val put_thms_internal: string * thm list option -> state -> state
    25   val the_facts: state -> thm list
    24   val the_facts: state -> thm list
    26   val the_fact: state -> thm
    25   val the_fact: state -> thm
   200   map_current (fn (ctxt, facts, mode, goal) => (f ctxt, facts, mode, goal));
   199   map_current (fn (ctxt, facts, mode, goal) => (f ctxt, facts, mode, goal));
   201 
   200 
   202 fun map_context_result f state =
   201 fun map_context_result f state =
   203   f (context_of state) ||> (fn ctxt => map_context (K ctxt) state);
   202   f (context_of state) ||> (fn ctxt => map_context (K ctxt) state);
   204 
   203 
   205 val warn_extra_tfrees = map_context o ProofContext.warn_extra_tfrees o context_of;
       
   206 val add_binds_i = map_context o ProofContext.add_binds_i;
   204 val add_binds_i = map_context o ProofContext.add_binds_i;
   207 val put_thms = map_context oo ProofContext.put_thms;
   205 val put_thms = map_context oo ProofContext.put_thms;
   208 val put_thms_internal = map_context o ProofContext.put_thms_internal;
   206 val put_thms_internal = map_context o ProofContext.put_thms_internal;
   209 
   207 
   210 
   208 
   805     val goal = Goal.init (Thm.cterm_of thy (Logic.mk_conjunction_list2 propss'));
   803     val goal = Goal.init (Thm.cterm_of thy (Logic.mk_conjunction_list2 propss'));
   806     val after_qed' = after_qed |>> (fn after_local =>
   804     val after_qed' = after_qed |>> (fn after_local =>
   807       fn results => map_context after_ctxt #> after_local results);
   805       fn results => map_context after_ctxt #> after_local results);
   808   in
   806   in
   809     goal_state
   807     goal_state
   810     |> map_context (ProofContext.set_body true)
   808     |> map_context (Variable.set_body true)
   811     |> put_goal (SOME (make_goal ((kind, propss'), [], goal, before_qed, after_qed')))
   809     |> put_goal (SOME (make_goal ((kind, propss'), [], goal, before_qed, after_qed')))
   812     |> map_context (ProofContext.add_cases false (AutoBind.cases thy props))
   810     |> map_context (ProofContext.add_cases false (AutoBind.cases thy props))
   813     |> map_context (ProofContext.auto_bind_goal props)
   811     |> map_context (ProofContext.auto_bind_goal props)
   814     |> K chaining ? (`the_facts #-> using_facts)
   812     |> K chaining ? (`the_facts #-> using_facts)
   815     |> put_facts NONE
   813     |> put_facts NONE
   827     val outer_state = state |> close_block;
   825     val outer_state = state |> close_block;
   828     val outer_ctxt = context_of outer_state;
   826     val outer_ctxt = context_of outer_state;
   829 
   827 
   830     val props =
   828     val props =
   831       flat (tl stmt)
   829       flat (tl stmt)
   832       |> ProofContext.generalize goal_ctxt outer_ctxt;
   830       |> Variable.generalize goal_ctxt outer_ctxt;
   833     val results =
   831     val results =
   834       tl (conclude_goal state goal stmt)
   832       tl (conclude_goal state goal stmt)
   835       |> (Seq.map_list o Seq.map_list) (ProofContext.exports goal_ctxt outer_ctxt);
   833       |> (Seq.map_list o Seq.map_list) (ProofContext.exports goal_ctxt outer_ctxt);
   836   in
   834   in
   837     outer_state
   835     outer_state
   853       #-> (fn res => tap (fn st => print_results (context_of st) ((kind, ""), res) : unit))
   851       #-> (fn res => tap (fn st => print_results (context_of st) ((kind, ""), res) : unit))
   854       #> after_qed results;
   852       #> after_qed results;
   855   in
   853   in
   856     state
   854     state
   857     |> generic_goal prepp (kind ^ goal_names NONE "" names) before_qed (after_qed', K I) propp
   855     |> generic_goal prepp (kind ^ goal_names NONE "" names) before_qed (after_qed', K I) propp
   858     |> warn_extra_tfrees state
   856     |> tap (Variable.warn_extra_tfrees (context_of state) o context_of)
   859   end;
   857   end;
   860 
   858 
   861 fun local_qed txt =
   859 fun local_qed txt =
   862   end_proof false txt
   860   end_proof false txt
   863   #> Seq.map generic_qed
   861   #> Seq.map generic_qed