src/Pure/Isar/proof.ML
changeset 63352 4eaf35781b23
parent 63344 c9910404cc8a
child 63368 e9e677b73011
equal deleted inserted replaced
63347:e344dc82f6c2 63352:4eaf35781b23
   726   #> chain;
   726   #> chain;
   727 
   727 
   728 
   728 
   729 (* note etc. *)
   729 (* note etc. *)
   730 
   730 
   731 fun no_binding args = map (pair (Binding.empty, [])) args;
   731 fun empty_bindings args = map (pair Binding.empty_atts) args;
   732 
   732 
   733 local
   733 local
   734 
   734 
   735 fun gen_thmss more_facts opt_chain opt_result prep_atts prep_fact args state =
   735 fun gen_thmss more_facts opt_chain opt_result prep_atts prep_fact args state =
   736   state
   736   state
   744 in
   744 in
   745 
   745 
   746 val note_thmss = gen_thmss (K []) I #2 (K I) (K I);
   746 val note_thmss = gen_thmss (K []) I #2 (K I) (K I);
   747 val note_thmss_cmd = gen_thmss (K []) I #2 Attrib.attribute_cmd Proof_Context.get_fact;
   747 val note_thmss_cmd = gen_thmss (K []) I #2 Attrib.attribute_cmd Proof_Context.get_fact;
   748 
   748 
   749 val from_thmss = gen_thmss (K []) chain #2 (K I) (K I) o no_binding;
   749 val from_thmss = gen_thmss (K []) chain #2 (K I) (K I) o empty_bindings;
   750 val from_thmss_cmd =
   750 val from_thmss_cmd =
   751   gen_thmss (K []) chain #2 Attrib.attribute_cmd Proof_Context.get_fact o no_binding;
   751   gen_thmss (K []) chain #2 Attrib.attribute_cmd Proof_Context.get_fact o empty_bindings;
   752 
   752 
   753 val with_thmss = gen_thmss the_facts chain #2 (K I) (K I) o no_binding;
   753 val with_thmss = gen_thmss the_facts chain #2 (K I) (K I) o empty_bindings;
   754 val with_thmss_cmd =
   754 val with_thmss_cmd =
   755   gen_thmss the_facts chain #2 Attrib.attribute_cmd Proof_Context.get_fact o no_binding;
   755   gen_thmss the_facts chain #2 Attrib.attribute_cmd Proof_Context.get_fact o empty_bindings;
   756 
   756 
   757 val local_results = gen_thmss (K []) I I (K I) (K I) o map (apsnd Thm.simple_fact);
   757 val local_results = gen_thmss (K []) I I (K I) (K I) o map (apsnd Thm.simple_fact);
   758 
   758 
   759 end;
   759 end;
   760 
   760 
   784 fun gen_using f g prep_att prep_fact args state =
   784 fun gen_using f g prep_att prep_fact args state =
   785   state
   785   state
   786   |> assert_backward
   786   |> assert_backward
   787   |> map_context_result
   787   |> map_context_result
   788     (fn ctxt => ctxt |> Proof_Context.note_thmss ""
   788     (fn ctxt => ctxt |> Proof_Context.note_thmss ""
   789       (Attrib.map_facts_refs (map (prep_att ctxt)) (prep_fact ctxt) (no_binding args)))
   789       (Attrib.map_facts_refs (map (prep_att ctxt)) (prep_fact ctxt) (empty_bindings args)))
   790   |> (fn (named_facts, state') =>
   790   |> (fn (named_facts, state') =>
   791     state' |> map_goal (fn (goal_ctxt, statement, using, goal, before_qed, after_qed) =>
   791     state' |> map_goal (fn (goal_ctxt, statement, using, goal, before_qed, after_qed) =>
   792       let
   792       let
   793         val ctxt = context_of state';
   793         val ctxt = context_of state';
   794         val ths = maps snd named_facts;
   794         val ths = maps snd named_facts;
   853     val (decls, fixes) = chop (length raw_decls) vars;
   853     val (decls, fixes) = chop (length raw_decls) vars;
   854     val show_term = Syntax.string_of_term vars_ctxt;
   854     val show_term = Syntax.string_of_term vars_ctxt;
   855 
   855 
   856     (*defs*)
   856     (*defs*)
   857     fun match_defs (((b, _, mx), (_, Free (x, T))) :: more_decls) ((((y, U), t), _) :: more_defs) =
   857     fun match_defs (((b, _, mx), (_, Free (x, T))) :: more_decls) ((((y, U), t), _) :: more_defs) =
   858           if x = y then ((b, mx), (Thm.empty_binding, t)) :: match_defs more_decls more_defs
   858           if x = y then ((b, mx), (Binding.empty_atts, t)) :: match_defs more_decls more_defs
   859           else
   859           else
   860             error ("Mismatch of declaration " ^ show_term (Free (x, T)) ^ " wrt. definition " ^
   860             error ("Mismatch of declaration " ^ show_term (Free (x, T)) ^ " wrt. definition " ^
   861               show_term (Free (y, U)))
   861               show_term (Free (y, U)))
   862       | match_defs [] [] = []
   862       | match_defs [] [] = []
   863       | match_defs more_decls more_defs =
   863       | match_defs more_decls more_defs =