66 | label_of_clause c = (space_implode "___" (map (fst o raw_label_of_num o fst) c), 0) |
66 | label_of_clause c = (space_implode "___" (map (fst o raw_label_of_num o fst) c), 0) |
67 |
67 |
68 fun add_fact_of_dependencies [(_, ss as _ :: _)] = apsnd (union (op =) ss) |
68 fun add_fact_of_dependencies [(_, ss as _ :: _)] = apsnd (union (op =) ss) |
69 | add_fact_of_dependencies names = apfst (insert (op =) (label_of_clause names)) |
69 | add_fact_of_dependencies names = apfst (insert (op =) (label_of_clause names)) |
70 |
70 |
71 (* No "real" literals means only type information (tfree_tcs, clsrel, or clsarity). *) |
71 fun is_True_prop t = t aconv @{prop True} |
72 fun is_only_type_information t = t aconv @{prop True} |
|
73 |
72 |
74 (* Discard facts; consolidate adjacent lines that prove the same formula, since they differ only in |
73 (* Discard facts; consolidate adjacent lines that prove the same formula, since they differ only in |
75 type information. *) |
74 type information. *) |
76 fun add_line_pass1 (line as (name, role, t, rule, [])) lines = |
75 fun add_line_pass1 (line as (name, role, t, rule, [])) lines = |
77 (* No dependencies: lemma (for Z3), fact, conjecture, or (for Vampire) internal facts or |
76 (* No dependencies: lemma (for Z3), fact, conjecture, or (for Vampire) internal facts or |
78 definitions. *) |
77 definitions. *) |
79 if role = Lemma orelse role = Conjecture orelse role = Negated_Conjecture orelse |
78 if role = Conjecture orelse role = Negated_Conjecture then |
80 role = Hypothesis orelse is_arith_rule rule then |
|
81 line :: lines |
79 line :: lines |
|
80 else if role = Lemma orelse role = Hypothesis orelse is_arith_rule rule then |
|
81 lines |> not (is_True_prop t) ? cons line |
82 else if role = Axiom then |
82 else if role = Axiom then |
83 (* Facts are not proof lines. *) |
83 (* Facts are not proof lines. *) |
84 lines |> is_only_type_information t ? map (replace_dependencies_in_line (name, [])) |
84 lines |> is_True_prop t ? map (replace_dependencies_in_line (name, [])) |
85 else |
85 else |
86 map (replace_dependencies_in_line (name, [])) lines |
86 map (replace_dependencies_in_line (name, [])) lines |
87 | add_line_pass1 line lines = line :: lines |
87 | add_line_pass1 line lines = line :: lines |
88 |
88 |
89 fun add_lines_pass2 res [] = rev res |
89 fun add_lines_pass2 res [] = rev res |
90 | add_lines_pass2 res ((line as (name, role, t, rule, deps)) :: lines) = |
90 | add_lines_pass2 res ((line as (name, role, t, rule, deps)) :: lines) = |
91 let |
91 let |
92 val is_last_line = null lines |
92 val is_last_line = null lines |
93 |
93 |
94 fun looks_interesting () = |
94 fun looks_interesting () = |
95 not (is_only_type_information t) andalso null (Term.add_tvars t []) |
95 not (is_True_prop t) andalso null (Term.add_tvars t []) andalso length deps >= 2 andalso |
96 andalso length deps >= 2 andalso not (can the_single lines) |
96 not (can the_single lines) |
97 |
97 |
98 fun is_skolemizing_line (_, _, _, rule', deps') = |
98 fun is_skolemizing_line (_, _, _, rule', deps') = |
99 is_skolemize_rule rule' andalso member (op =) deps' name |
99 is_skolemize_rule rule' andalso member (op =) deps' name |
100 fun is_before_skolemize_rule () = exists is_skolemizing_line lines |
100 fun is_before_skolemize_rule () = exists is_skolemizing_line lines |
101 in |
101 in |