(* Combine indexed fact names for pretty-printing. Example: [... "assms(1)" "assms(3)" ...] becomes [... "assms(1,3)" ...] Combines only adjacent same names. Input should not have same name with and without index.
*) fun merge_indexed_facts (facts: Pretty.T list) : Pretty.T list = let
fun split (p: Pretty.T) : (string * string) option = try (unsuffix ")" o content_of_pretty) p
|> Option.mapPartial (first_field "(")
fun add_pretty (name,is) = (SOME (name,is),Pretty.str (name ^ "(" ^ is ^ ")"))
fun merge ((SOME (name1,is1),p1) :: (y as (SOME (name2,is2),_)) :: zs) = if name1 = name2 then merge (add_pretty (name1,is1 ^ "," ^ is2) :: zs) else p1 :: merge (y :: zs)
| merge ((_,p) :: ys) = p :: merge ys
| merge [] = []
fun apply_on_subgoal _ 1 = "by "
| apply_on_subgoal 1 _ = "apply "
| apply_on_subgoal i n = "prefer " ^ string_of_int i ^ " " ^ apply_on_subgoal 1 n
fun proof_method_command meth i n extras = let val (indirect_facts, direct_facts) = if is_proof_method_direct meth then ([], extras) else (extras, []) val suffix = if is_proof_method_multi_goal meth andalso n <> 1 then"[1]"else"" in
(if null indirect_facts then [] else Pretty.str "using" :: merge_indexed_facts indirect_facts) @
[pretty_proof_method (apply_on_subgoal i n) suffix direct_facts meth]
|> Pretty.block o Pretty.breaks
|> Pretty.symbolic_string_of (* markup string *) end
fun try_command_line banner play command = letval s = string_of_play_outcome play in (* Add optional markup break (command may need multiple lines) *)
banner ^ Markup.markup (Markup.break {width = 1, indent = 2}) " " ^
Active.sendback_markup_command command ^ (s |> s <> "" ? enclose " ("")") end
val failed_command_line =
prefix ("One-line proof reconstruction failed:" ^ (* Add optional markup break (command may need multiple lines) *)
Markup.markup (Markup.break {width = 1, indent = 2}) " ")
fun one_line_proof_text ((used_facts, (meth, play)), banner, subgoal, subgoal_count) = letval extra = filter_out (fn (_, (sc, _)) => sc = Chained) used_facts in map fst extra
|> proof_method_command meth subgoal subgoal_count
|> (if play = Play_Failed then failed_command_line else try_command_line banner play) end
end;
¤ Dauer der Verarbeitung: 0.16 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.