let add_lemma (selection: selection) (lemma: clause) : unit =
if filter_lemma selection lemma then begin
if Config.print_lemmas selection.sel_config then begin
print_endline ("REDUNDANT LEMMA: " ^ Term.clause_to_string lemma);
end;
end
else begin
match Config.lemma selection.sel_config with
| Flags.LM_Propositional ->
if Config.print_lemmas selection.sel_config then begin
print_endline ("LEMMA: " ^ Term.clause_to_string lemma);
end;
let global_lemma =
not selection.sel_bound#is_derivation_incomplete
in
Lemma_propositional.add_lemma selection.sel_lemmas_propositional lemma global_lemma
| Flags.LM_None
| Flags.LM_Grounded
| Flags.LM_Lifted ->
if Config.print_lemmas selection.sel_config then begin
print_endline ("LEMMA: " ^ Term.clause_to_string lemma);
end;
prune_lemmas selection;
let new_context_unifier_space =
Context_unifier_space.create_space
selection.sel_space_registry
selection.sel_problem_literals
lemma
selection.sel_process_close
selection.sel_process_assert
selection.sel_process_split
selection.sel_is_element_incomplete_assert
selection.sel_is_element_incomplete_split
true
in
new_context_unifier_space.Context_unifier.cus_utility := (get_min_lemma_utility selection);
let global_lemma =
not selection.sel_bound#is_derivation_incomplete
in
selection.sel_lemma_spaces <- (new_context_unifier_space, global_lemma) :: selection.sel_lemma_spaces;
begin
match lemma with
| unit_literal :: [] ->
begin
match Context.check_contradictory selection.sel_context unit_literal with
| Some element ->
let context_partner =
Context_unifier.create_context_partner
element
None
true
in
let raw_context_unifier =
Context_unifier.create_context_unifier
new_context_unifier_space [| context_partner |] false
in
selection.sel_best_closing := Some raw_context_unifier;
raise_close selection
| None ->
let raw_context_unifier =
Context_unifier.create_context_unifier
new_context_unifier_space [| Context_unifier.assert_partner |] false
in
Statistic.inc_computed_assert_candidates selection.sel_statistic;
selection.sel_unit_asserts <- (unit_literal, raw_context_unifier) :: selection.sel_unit_asserts
end
| _ ->
()
end;
end