src/HOL/Tools/Sledgehammer/sledgehammer_isar_proof.ML
changeset 67399 eab6ce8368fa
parent 66020 a31760eee09d
child 67405 e9ab4ad7bd15
equal deleted inserted replaced
67398:5eb932e604a2 67399:eab6ce8368fa
   282     fun of_indent ind = replicate_string (ind * indent_size) " "
   282     fun of_indent ind = replicate_string (ind * indent_size) " "
   283     fun of_moreover ind = of_indent ind ^ "moreover\n"
   283     fun of_moreover ind = of_indent ind ^ "moreover\n"
   284     fun of_label l = if l = no_label then "" else string_of_label l ^ ": "
   284     fun of_label l = if l = no_label then "" else string_of_label l ^ ": "
   285 
   285 
   286     fun of_obtain qs nr =
   286     fun of_obtain qs nr =
   287       (if nr > 1 orelse (nr = 1 andalso member (op =) qs Then) then "ultimately "
   287       (if nr > 1 orelse (nr = 1 andalso member (=) qs Then) then "ultimately "
   288        else if nr = 1 orelse member (op =) qs Then then "then "
   288        else if nr = 1 orelse member (=) qs Then then "then "
   289        else "") ^ "obtain"
   289        else "") ^ "obtain"
   290 
   290 
   291     fun of_show_have qs = if member (op =) qs Show then "show" else "have"
   291     fun of_show_have qs = if member (=) qs Show then "show" else "have"
   292     fun of_thus_hence qs = if member (op =) qs Show then "then show" else "then have"
   292     fun of_thus_hence qs = if member (=) qs Show then "then show" else "then have"
   293 
   293 
   294     fun of_have qs nr =
   294     fun of_have qs nr =
   295       if nr > 1 orelse (nr = 1 andalso member (op =) qs Then) then "ultimately " ^ of_show_have qs
   295       if nr > 1 orelse (nr = 1 andalso member (=) qs Then) then "ultimately " ^ of_show_have qs
   296       else if nr = 1 orelse member (op =) qs Then then of_thus_hence qs
   296       else if nr = 1 orelse member (op =) qs Then then of_thus_hence qs
   297       else of_show_have qs
   297       else of_show_have qs
   298 
   298 
   299     fun add_term term (s, ctxt) =
   299     fun add_term term (s, ctxt) =
   300       (s ^ (term
   300       (s ^ (term
   342         String.extract (s, ind * indent_size, SOME (size s - ind * indent_size - 1)) ^
   342         String.extract (s, ind * indent_size, SOME (size s - ind * indent_size - 1)) ^
   343         suffix ^ "\n"
   343         suffix ^ "\n"
   344       end
   344       end
   345     and of_subproofs _ _ _ [] = ""
   345     and of_subproofs _ _ _ [] = ""
   346       | of_subproofs ind ctxt qs subs =
   346       | of_subproofs ind ctxt qs subs =
   347         (if member (op =) qs Then then of_moreover ind else "") ^
   347         (if member (=) qs Then then of_moreover ind else "") ^
   348         space_implode (of_moreover ind) (map (of_subproof ind ctxt) subs)
   348         space_implode (of_moreover ind) (map (of_subproof ind ctxt) subs)
   349     and add_step_pre ind qs subs (s, ctxt) =
   349     and add_step_pre ind qs subs (s, ctxt) =
   350       (s ^ of_subproofs ind ctxt qs subs ^ of_indent ind, ctxt)
   350       (s ^ of_subproofs ind ctxt qs subs ^ of_indent ind, ctxt)
   351     and add_step ind (Let (t1, t2)) =
   351     and add_step ind (Let (t1, t2)) =
   352         add_str (of_indent ind ^ "let ") #> add_term t1 #> add_str " = " #> add_term t2
   352         add_str (of_indent ind ^ "let ") #> add_term t1 #> add_str " = " #> add_term t2