src/Pure/Isar/proof.ML
changeset 49907 c4bd02e32d35
parent 49890 89eff795f757
child 49909 904b7d3bde5e
equal deleted inserted replaced
49906:06a3570b0f0a 49907:c4bd02e32d35
   998 
   998 
   999 fun global_qed arg =
   999 fun global_qed arg =
  1000   global_qeds (Position.none, arg) #> Seq.the_result finished_goal_error;
  1000   global_qeds (Position.none, arg) #> Seq.the_result finished_goal_error;
  1001 
  1001 
  1002 
  1002 
  1003 (* concluding steps *)
  1003 (* terminal proof steps *)
  1004 
  1004 
  1005 local
  1005 local
  1006 
  1006 
  1007 fun terminal_proof qeds initial terminal =
  1007 fun terminal_proof qeds initial terminal =
  1008   proof_results (SOME initial) #> Seq.maps_results (qeds (#2 (#2 initial), terminal))
  1008   proof_results (SOME initial) #> Seq.maps_results (qeds (#2 (#2 initial), terminal))
  1009   #> Seq.the_result "";
  1009   #> Seq.the_result "";
  1010 
  1010 
  1011 fun skipped_proof x =
       
  1012   (Output.report (Markup.markup Isabelle_Markup.bad "Skipped proof"); x);
       
  1013 
       
  1014 in
  1011 in
  1015 
  1012 
  1016 fun local_terminal_proof (text, opt_text) = terminal_proof local_qeds text (opt_text, true);
  1013 fun local_terminal_proof (text, opt_text) = terminal_proof local_qeds text (opt_text, true);
  1017 val local_default_proof = local_terminal_proof ((Method.default_text, Position.no_range), NONE);
  1014 val local_default_proof = local_terminal_proof ((Method.default_text, Position.no_range), NONE);
  1018 val local_immediate_proof = local_terminal_proof ((Method.this_text, Position.no_range), NONE);
  1015 val local_immediate_proof = local_terminal_proof ((Method.this_text, Position.no_range), NONE);
  1019 fun local_skip_proof int =
       
  1020   local_terminal_proof ((Method.sorry_text int, Position.no_range), NONE) #> skipped_proof;
       
  1021 val local_done_proof = terminal_proof local_qeds (Method.done_text, Position.no_range) (NONE, false);
  1016 val local_done_proof = terminal_proof local_qeds (Method.done_text, Position.no_range) (NONE, false);
  1022 
  1017 
  1023 fun global_terminal_proof (text, opt_text) = terminal_proof global_qeds text (opt_text, true);
  1018 fun global_terminal_proof (text, opt_text) = terminal_proof global_qeds text (opt_text, true);
  1024 val global_default_proof = global_terminal_proof ((Method.default_text, Position.no_range), NONE);
  1019 val global_default_proof = global_terminal_proof ((Method.default_text, Position.no_range), NONE);
  1025 val global_immediate_proof = global_terminal_proof ((Method.this_text, Position.no_range), NONE);
  1020 val global_immediate_proof = global_terminal_proof ((Method.this_text, Position.no_range), NONE);
  1026 fun global_skip_proof int =
       
  1027   global_terminal_proof ((Method.sorry_text int, Position.no_range), NONE) #> skipped_proof;
       
  1028 val global_done_proof = terminal_proof global_qeds (Method.done_text, Position.no_range) (NONE, false);
  1021 val global_done_proof = terminal_proof global_qeds (Method.done_text, Position.no_range) (NONE, false);
       
  1022 
       
  1023 end;
       
  1024 
       
  1025 
       
  1026 (* skip proofs *)
       
  1027 
       
  1028 local
       
  1029 
       
  1030 fun skipped_proof state =
       
  1031   Context_Position.if_visible (context_of state) Output.report
       
  1032     (Markup.markup Isabelle_Markup.bad "Skipped proof");
       
  1033 
       
  1034 in
       
  1035 
       
  1036 fun local_skip_proof int state =
       
  1037   local_terminal_proof ((Method.sorry_text int, Position.no_range), NONE) state before
       
  1038   skipped_proof state;
       
  1039 
       
  1040 fun global_skip_proof int state =
       
  1041   global_terminal_proof ((Method.sorry_text int, Position.no_range), NONE) state before
       
  1042   skipped_proof state;
  1029 
  1043 
  1030 end;
  1044 end;
  1031 
  1045 
  1032 
  1046 
  1033 (* common goal statements *)
  1047 (* common goal statements *)
  1067       #> after_qed results;
  1081       #> after_qed results;
  1068   in
  1082   in
  1069     state
  1083     state
  1070     |> local_goal print_results prep_att prepp "show" before_qed after_qed' stmt
  1084     |> local_goal print_results prep_att prepp "show" before_qed after_qed' stmt
  1071     |> int ? (fn goal_state =>
  1085     |> int ? (fn goal_state =>
  1072       (case test_proof goal_state of
  1086       (case test_proof (map_context (Context_Position.set_visible false) goal_state) of
  1073         Exn.Res (SOME _) => goal_state
  1087         Exn.Res (SOME _) => goal_state
  1074       | Exn.Res NONE => error (fail_msg (context_of goal_state))
  1088       | Exn.Res NONE => error (fail_msg (context_of goal_state))
  1075       | Exn.Exn exn => raise Exn.EXCEPTIONS ([exn, ERROR (fail_msg (context_of goal_state))])))
  1089       | Exn.Exn exn => raise Exn.EXCEPTIONS ([exn, ERROR (fail_msg (context_of goal_state))])))
  1076   end;
  1090   end;
  1077 
  1091