313 [typ_u, term_u] => |
313 [typ_u, term_u] => |
314 aux (SOME (type_from_fo_term tfrees typ_u)) extra_us term_u |
314 aux (SOME (type_from_fo_term tfrees typ_u)) extra_us term_u |
315 | _ => raise FO_TERM us |
315 | _ => raise FO_TERM us |
316 else case strip_prefix_and_unascii const_prefix a of |
316 else case strip_prefix_and_unascii const_prefix a of |
317 SOME "equal" => |
317 SOME "equal" => |
318 list_comb (Const (@{const_name HOL.eq}, HOLogic.typeT), |
318 let val ts = map (aux NONE []) us in |
319 map (aux NONE []) us) |
319 if length ts = 2 andalso hd ts aconv List.last ts then |
|
320 (* Vampire is keen on producing these. *) |
|
321 @{const True} |
|
322 else |
|
323 list_comb (Const (@{const_name HOL.eq}, HOLogic.typeT), ts) |
|
324 end |
320 | SOME b => |
325 | SOME b => |
321 let |
326 let |
322 val c = invert_const b |
327 val c = invert_const b |
323 val num_type_args = num_type_args thy c |
328 val num_type_args = num_type_args thy c |
324 val (type_us, term_us) = |
329 val (type_us, term_us) = |
524 (* ATPs sometimes reuse free variable names in the strangest ways. Removing |
529 (* ATPs sometimes reuse free variable names in the strangest ways. Removing |
525 offending lines often does the trick. *) |
530 offending lines often does the trick. *) |
526 fun is_bad_free frees (Free x) = not (member (op =) frees x) |
531 fun is_bad_free frees (Free x) = not (member (op =) frees x) |
527 | is_bad_free _ _ = false |
532 | is_bad_free _ _ = false |
528 |
533 |
529 (* Vampire is keen on producing these. *) |
|
530 fun is_trivial_formula (@{const Not} $ (Const (@{const_name HOL.eq}, _) |
|
531 $ t1 $ t2)) = (t1 aconv t2) |
|
532 | is_trivial_formula _ = false |
|
533 |
|
534 fun add_desired_line _ _ _ _ (line as Definition (num, _, _)) (j, lines) = |
534 fun add_desired_line _ _ _ _ (line as Definition (num, _, _)) (j, lines) = |
535 (j, line :: map (replace_deps_in_line (num, [])) lines) |
535 (j, line :: map (replace_deps_in_line (num, [])) lines) |
536 | add_desired_line isar_shrink_factor conjecture_shape axiom_names frees |
536 | add_desired_line isar_shrink_factor conjecture_shape axiom_names frees |
537 (Inference (num, t, deps)) (j, lines) = |
537 (Inference (num, t, deps)) (j, lines) = |
538 (j + 1, |
538 (j + 1, |
539 if is_axiom_number axiom_names num orelse |
539 if is_axiom_number axiom_names num orelse |
540 is_conjecture_number conjecture_shape num orelse |
540 is_conjecture_number conjecture_shape num orelse |
541 (not (is_only_type_information t) andalso |
541 (not (is_only_type_information t) andalso |
542 null (Term.add_tvars t []) andalso |
542 null (Term.add_tvars t []) andalso |
543 not (exists_subterm (is_bad_free frees) t) andalso |
543 not (exists_subterm (is_bad_free frees) t) andalso |
544 not (is_trivial_formula t) andalso |
|
545 (null lines orelse (* last line must be kept *) |
544 (null lines orelse (* last line must be kept *) |
546 (length deps >= 2 andalso j mod isar_shrink_factor = 0))) then |
545 (length deps >= 2 andalso j mod isar_shrink_factor = 0))) then |
547 Inference (num, t, deps) :: lines (* keep line *) |
546 Inference (num, t, deps) :: lines (* keep line *) |
548 else |
547 else |
549 map (replace_deps_in_line (num, deps)) lines) (* drop line *) |
548 map (replace_deps_in_line (num, deps)) lines) (* drop line *) |