515 | inputno (ntok::"0"::"Inp"::_) = Int.fromString ntok (* DFG *) |
515 | inputno (ntok::"0"::"Inp"::_) = Int.fromString ntok (* DFG *) |
516 | inputno _ = NONE |
516 | inputno _ = NONE |
517 val lines = split_lines proof_extract |
517 val lines = split_lines proof_extract |
518 in map_filter (inputno o toks) lines end |
518 in map_filter (inputno o toks) lines end |
519 |
519 |
520 (*extracting lemmas from tstp-output between the lines from above*) |
520 (* Extracting lemmas from TSTP output between the lines from above. *) |
521 fun extract_lemmas get_step_nums (proof, thm_names, conj_count, _, _, _) = |
521 fun extract_lemmas get_step_nums (proof, thm_names, conjecture_pos, _, _, _) = |
522 let |
522 let |
523 (* get the names of axioms from their numbers*) |
523 (* get the names of axioms from their numbers*) |
524 fun get_axiom_names thm_names step_nums = |
524 fun get_axiom_names thm_names step_nums = |
525 let |
525 let |
526 val last_axiom = Vector.length thm_names |
526 val last_axiom = Vector.length thm_names |
527 fun is_axiom n = n <= last_axiom |
527 fun is_axiom n = n <= last_axiom |
528 fun is_conj n = n >= fst conj_count andalso |
528 fun is_conj n = n >= fst conjecture_pos andalso |
529 n < fst conj_count + snd conj_count |
529 n < fst conjecture_pos + snd conjecture_pos |
530 fun getname i = Vector.sub(thm_names, i-1) |
530 fun name_at i = Vector.sub (thm_names, i - 1) |
531 in |
531 in |
532 (sort_distinct string_ord (filter (fn x => x <> "??.unknown") |
532 (sort_distinct string_ord (filter (fn x => x <> "??.unknown") |
533 (map getname (filter is_axiom step_nums))), |
533 (map name_at (filter is_axiom step_nums))), |
534 exists is_conj step_nums) |
534 exists is_conj step_nums) |
535 end |
535 end |
536 in get_axiom_names thm_names (get_step_nums (get_proof_extract proof)) end; |
536 in get_axiom_names thm_names (get_step_nums (get_proof_extract proof)) end; |
537 |
537 |
538 (*Used to label theorems chained into the sledgehammer call*) |
538 (*Used to label theorems chained into the sledgehammer call*) |
572 "\nWarning: The goal is provable because the context is inconsistent."), |
572 "\nWarning: The goal is provable because the context is inconsistent."), |
573 kill_chained lemmas) |
573 kill_chained lemmas) |
574 end |
574 end |
575 |
575 |
576 fun isar_proof_text minimal modulus sorts atp_name |
576 fun isar_proof_text minimal modulus sorts atp_name |
577 (result as (proof, thm_names, conj_count, ctxt, goal, i)) = |
577 (result as (proof, thm_names, _, ctxt, goal, i)) = |
578 let |
578 let |
579 (* We could use "split_lines", but it can return blank lines. *) |
579 (* We could use "split_lines", but it can return blank lines. *) |
580 val lines = String.tokens (equal #"\n"); |
580 val lines = String.tokens (equal #"\n"); |
581 val kill_spaces = |
581 val kill_spaces = |
582 String.translate (fn c => if Char.isSpace c then "" else str c) |
582 String.translate (fn c => if Char.isSpace c then "" else str c) |