src/HOL/Tools/Sledgehammer/sledgehammer_provers.ML
changeset 54818 a80bd631e573
parent 54816 10d48c2a3e32
child 54823 a510fc40559c
equal deleted inserted replaced
54817:e1da23db35a9 54818:a80bd631e573
   725                       extract_tstplike_proof_and_outcome verbose proof_delims known_failures output
   725                       extract_tstplike_proof_and_outcome verbose proof_delims known_failures output
   726                       |>> atp_proof_of_tstplike_proof atp_problem
   726                       |>> atp_proof_of_tstplike_proof atp_problem
   727                       handle UNRECOGNIZED_ATP_PROOF () => ([], SOME ProofIncomplete)))
   727                       handle UNRECOGNIZED_ATP_PROOF () => ([], SOME ProofIncomplete)))
   728               handle TimeLimit.TimeOut => (("", slice_timeout), ([], SOME TimedOut))
   728               handle TimeLimit.TimeOut => (("", slice_timeout), ([], SOME TimedOut))
   729             val outcome =
   729             val outcome =
   730               case outcome of
   730               (case outcome of
   731                 NONE =>
   731                 NONE =>
   732                 (case used_facts_in_unsound_atp_proof ctxt fact_names atp_proof
   732                 (case used_facts_in_unsound_atp_proof ctxt fact_names atp_proof
   733                       |> Option.map (sort string_ord) of
   733                       |> Option.map (sort string_ord) of
   734                    SOME facts =>
   734                    SOME facts =>
   735                    let
   735                    let val failure = UnsoundProof (is_type_enc_sound type_enc, facts) in
   736                      val failure =
   736                      if debug then (warning (string_of_atp_failure failure); NONE) else SOME failure
   737                        UnsoundProof (is_type_enc_sound type_enc, facts)
       
   738                    in
       
   739                      if debug then
       
   740                        (warning (string_of_atp_failure failure); NONE)
       
   741                      else
       
   742                        SOME failure
       
   743                    end
   737                    end
   744                  | NONE => NONE)
   738                  | NONE => NONE)
   745               | _ => outcome
   739               | _ => outcome)
   746           in
   740           in
   747             ((SOME key, value), (output, run_time, facts, atp_proof, outcome))
   741             ((SOME key, value), (output, run_time, facts, atp_proof, outcome))
   748           end
   742           end
   749         val timer = Timer.startRealTimer ()
   743         val timer = Timer.startRealTimer ()
   750         fun maybe_run_slice slice
   744         fun maybe_run_slice slice
   754             in
   748             in
   755               if Time.<= (time_left, Time.zeroTime) then
   749               if Time.<= (time_left, Time.zeroTime) then
   756                 result
   750                 result
   757               else
   751               else
   758                 run_slice time_left cache slice
   752                 run_slice time_left cache slice
   759                 |> (fn (cache, (output, run_time, used_from, atp_proof,
   753                 |> (fn (cache, (output, run_time, used_from, atp_proof, outcome)) =>
   760                                 outcome)) =>
   754                   (cache, (output, Time.+ (run_time0, run_time), used_from, atp_proof, outcome)))
   761                        (cache, (output, Time.+ (run_time0, run_time), used_from,
       
   762                                 atp_proof, outcome)))
       
   763             end
   755             end
   764           | maybe_run_slice _ result = result
   756           | maybe_run_slice _ result = result
   765       in
   757       in
   766         ((NONE, ([], Symtab.empty, Vector.fromList [], [], Symtab.empty)),
   758         ((NONE, ([], Symtab.empty, Vector.fromList [], [], Symtab.empty)),
   767          ("", Time.zeroTime, [], [], SOME InternalError))
   759          ("", Time.zeroTime, [], [], SOME InternalError))
   788         NONE =>
   780         NONE =>
   789         let
   781         let
   790           val used_facts = used_facts_in_atp_proof ctxt fact_names atp_proof
   782           val used_facts = used_facts_in_atp_proof ctxt fact_names atp_proof
   791           val needs_full_types = is_typed_helper_used_in_atp_proof atp_proof
   783           val needs_full_types = is_typed_helper_used_in_atp_proof atp_proof
   792           val reconstrs =
   784           val reconstrs =
   793             bunch_of_reconstructors needs_full_types
   785             bunch_of_reconstructors needs_full_types (lam_trans_of_atp_proof atp_proof
   794                 (lam_trans_of_atp_proof atp_proof
   786               o (fn desperate => if desperate then hide_lamsN else default_metis_lam_trans))
   795                  o (fn desperate => if desperate then hide_lamsN
       
   796                                     else default_metis_lam_trans))
       
   797         in
   787         in
   798           (used_facts,
   788           (used_facts,
   799            Lazy.lazy (fn () =>
   789            Lazy.lazy (fn () =>
   800              let
   790              let
   801                val used_pairs =
   791                val used_pairs =