src/Pure/Isar/proof.ML
changeset 17166 dc3b8cec8bba
parent 17112 736f4b7841a8
child 17203 29b2563f5c11
equal deleted inserted replaced
17165:9b498019723f 17166:dc3b8cec8bba
   621   |> chain;
   621   |> chain;
   622 
   622 
   623 
   623 
   624 (* note / from / with *)
   624 (* note / from / with *)
   625 
   625 
   626 fun no_result args = map (pair ("", [])) args;
   626 fun no_binding args = map (pair ("", [])) args;
   627 
   627 
   628 local
   628 local
   629 
   629 
   630 fun gen_thmss note_ctxt more_facts opt_chain prep_atts args state =
   630 fun gen_thmss note_ctxt more_facts opt_chain prep_atts args state =
   631   state
   631   state
   639 val note_thmss = gen_thmss ProofContext.note_thmss (K []) I Attrib.local_attribute;
   639 val note_thmss = gen_thmss ProofContext.note_thmss (K []) I Attrib.local_attribute;
   640 val note_thmss_i = gen_thmss ProofContext.note_thmss_i (K []) I (K I);
   640 val note_thmss_i = gen_thmss ProofContext.note_thmss_i (K []) I (K I);
   641 fun simple_note_thms name thms = note_thmss_i [((name, []), [(thms, [])])];
   641 fun simple_note_thms name thms = note_thmss_i [((name, []), [(thms, [])])];
   642 
   642 
   643 val from_thmss =
   643 val from_thmss =
   644   gen_thmss ProofContext.note_thmss (K []) chain Attrib.local_attribute o no_result;
   644   gen_thmss ProofContext.note_thmss (K []) chain Attrib.local_attribute o no_binding;
   645 val from_thmss_i = gen_thmss ProofContext.note_thmss_i (K []) chain (K I) o no_result;
   645 val from_thmss_i = gen_thmss ProofContext.note_thmss_i (K []) chain (K I) o no_binding;
   646 
   646 
   647 val with_thmss =
   647 val with_thmss =
   648   gen_thmss ProofContext.note_thmss the_facts chain Attrib.local_attribute o no_result;
   648   gen_thmss ProofContext.note_thmss the_facts chain Attrib.local_attribute o no_binding;
   649 val with_thmss_i = gen_thmss ProofContext.note_thmss_i the_facts chain (K I) o no_result;
   649 val with_thmss_i = gen_thmss ProofContext.note_thmss_i the_facts chain (K I) o no_binding;
   650 
   650 
   651 end;
   651 end;
   652 
   652 
   653 
   653 
   654 (* using *)
   654 (* using *)
   656 local
   656 local
   657 
   657 
   658 fun gen_using_thmss note prep_atts args state =
   658 fun gen_using_thmss note prep_atts args state =
   659   state
   659   state
   660   |> assert_backward
   660   |> assert_backward
   661   |> map_context_result (note (Attrib.map_facts (prep_atts (theory_of state)) (no_result args)))
   661   |> map_context_result (note (Attrib.map_facts (prep_atts (theory_of state)) (no_binding args)))
   662   |> (fn (st, named_facts) =>
   662   |> (fn (st, named_facts) =>
   663     let val (_, (_, ((result, (facts, thm)), x))) = find_goal st;
   663     let val (_, (_, ((result, (facts, thm)), x))) = find_goal st;
   664     in st |> map_goal I (K ((result, (facts @ List.concat (map snd named_facts), thm)), x)) end);
   664     in st |> map_goal I (K ((result, (facts @ List.concat (map snd named_facts), thm)), x)) end);
   665 
   665 
   666 in
   666 in
   955 (* unstructured proof steps *)
   955 (* unstructured proof steps *)
   956 
   956 
   957 fun defer i = assert_no_chain #> refine (Method.Basic (K (Method.defer i)));
   957 fun defer i = assert_no_chain #> refine (Method.Basic (K (Method.defer i)));
   958 fun prefer i = assert_no_chain #> refine (Method.Basic (K (Method.prefer i)));
   958 fun prefer i = assert_no_chain #> refine (Method.Basic (K (Method.prefer i)));
   959 
   959 
   960 fun apply text =
   960 fun apply text = assert_backward #> refine text #> Seq.map (goal_facts (K []));
   961   assert_backward
   961 fun apply_end text = assert_forward #> refine_end text;
   962   #> refine text
       
   963   #> Seq.map (goal_facts (K []));
       
   964 
       
   965 fun apply_end text =
       
   966   assert_forward
       
   967   #> refine_end text;
       
   968 
   962 
   969 
   963 
   970 
   964 
   971 (** blocks **)
   965 (** blocks **)
   972 
   966