src/HOL/Tools/Sledgehammer/sledgehammer_print.ML
changeset 54765 b05b0ea06306
parent 54764 1c9ef5c834e8
child 54766 6ac273f176cd
equal deleted inserted replaced
54764:1c9ef5c834e8 54765:b05b0ea06306
   172             |> maybe_quote),
   172             |> maybe_quote),
   173        ctxt |> Variable.auto_fixes term)
   173        ctxt |> Variable.auto_fixes term)
   174 
   174 
   175     fun by_method meth = "by " ^
   175     fun by_method meth = "by " ^
   176       (case meth of
   176       (case meth of
   177         SimpM => "simp"
   177         Simp_Method => "simp"
   178       | AutoM => "auto"
   178       | Auto_Method => "auto"
   179       | FastforceM => "fastforce"
   179       | Fastforce_Method => "fastforce"
   180       | ForceM => "force"
   180       | Force_Method => "force"
   181       | ArithM => "arith"
   181       | Arith_Method => "arith"
   182       | BlastM => "blast"
   182       | Blast_Method => "blast"
   183       | MesonM => "meson"
   183       | Meson_Method => "meson"
   184       | _ => raise Fail "Sledgehammer_Print: by_method")
   184       | _ => raise Fail "Sledgehammer_Print: by_method")
   185 
   185 
   186     fun using_facts [] [] = ""
   186     fun using_facts [] [] = ""
   187       | using_facts ls ss =
   187       | using_facts ls ss =
   188           "using " ^ space_implode " " (map string_of_label ls @ ss) ^ " "
   188           "using " ^ space_implode " " (map string_of_label ls @ ss) ^ " "
   189 
   189 
   190     fun of_method ls ss MetisM =
   190     fun of_method ls ss Metis_Method =
   191         reconstructor_command (Metis (type_enc, lam_trans)) 1 1 [] 0 (ls, ss)
   191         reconstructor_command (Metis (type_enc, lam_trans)) 1 1 [] 0 (ls, ss)
   192       | of_method ls ss meth = using_facts ls ss ^ by_method meth
   192       | of_method ls ss meth = using_facts ls ss ^ by_method meth
   193 
   193 
   194     fun of_byline ind options (ls, ss) meth =
   194     fun of_byline ind options (ls, ss) meth =
   195       let
   195       let
   252         #> add_term t2
   252         #> add_term t2
   253         #> add_suffix "\n"
   253         #> add_suffix "\n"
   254       | add_step ind (step as Prove (qs, xs, l, t, subproofs, (facts, meth))) =
   254       | add_step ind (step as Prove (qs, xs, l, t, subproofs, (facts, meth))) =
   255         (case xs of
   255         (case xs of
   256           [] => (* have *)
   256           [] => (* have *)
   257             add_step_pre ind qs subproofs
   257           add_step_pre ind qs subproofs
   258             #> add_suffix (of_prove qs (length subproofs) ^ " ")
   258           #> add_suffix (of_prove qs (length subproofs) ^ " ")
   259             #> add_step_post ind l t facts meth ""
   259           #> add_step_post ind l t facts meth ""
   260         | _ => (* obtain *)
   260         | _ => (* obtain *)
   261             add_step_pre ind qs subproofs
   261           add_step_pre ind qs subproofs
   262             #> add_suffix (of_obtain qs (length subproofs) ^ " ")
   262           #> add_suffix (of_obtain qs (length subproofs) ^ " ")
   263             #> add_frees xs
   263           #> add_frees xs
   264             #> add_suffix " where "
   264           #> add_suffix " where "
   265             (* The new skolemizer puts the arguments in the same order as the ATPs (E and Vampire --
   265           #> add_step_post ind l t facts meth
   266                but see also "atp_proof_reconstruct.ML" regarding Vampire). *)
   266                (if use_metis_new_skolem step then "using [[metis_new_skolem]] " else ""))
   267             #> add_step_post ind l t facts meth
       
   268                  (if use_metis_new_skolem step then
       
   269                     "using [[metis_new_skolem]] "
       
   270                   else
       
   271                     ""))
       
   272 
   267 
   273     and add_steps ind = fold (add_step ind)
   268     and add_steps ind = fold (add_step ind)
   274 
   269 
   275     and of_proof ind ctxt (Proof (xs, assms, steps)) =
   270     and of_proof ind ctxt (Proof (xs, assms, steps)) =
   276       ("", ctxt) |> add_fix ind xs |> add_assms ind assms |> add_steps ind steps |> fst
   271       ("", ctxt) |> add_fix ind xs |> add_assms ind assms |> add_steps ind steps |> fst
   277   in
   272   in
   278     (* One-step Metis proofs are pointless; better use the one-liner directly. *)
   273     (* One-step Metis proofs are pointless; better use the one-liner directly. *)
   279     (case proof of
   274     (case proof of
   280       Proof ([], [], []) => "" (* degenerate case: the conjecture is "True" with Z3 *)
   275       Proof ([], [], []) => "" (* degenerate case: the conjecture is "True" with Z3 *)
   281     | Proof ([], [], [Prove (_, [], _, _, [], (_, MetisM))]) => ""
   276     | Proof ([], [], [Prove (_, [], _, _, [], (_, Metis_Method))]) => ""
   282     | _ =>
   277     | _ =>
   283       (if i <> 1 then "prefer " ^ string_of_int i ^ "\n" else "") ^
   278       (if i <> 1 then "prefer " ^ string_of_int i ^ "\n" else "") ^
   284       of_indent 0 ^ "proof -\n" ^ of_proof 1 ctxt proof ^
   279       of_indent 0 ^ "proof -\n" ^ of_proof 1 ctxt proof ^
   285       of_indent 0 ^ (if n <> 1 then "next" else "qed"))
   280       of_indent 0 ^ (if n <> 1 then "next" else "qed"))
   286   end
   281   end