Skip to content

Commit

Permalink
k_induction(...) now returns property_checker_resultt
Browse files Browse the repository at this point in the history
The k_induction(...) function now returns property_checker_resultt, instead
of using a side-effect on an argument passed by reference.
  • Loading branch information
kroening committed Jan 17, 2025
1 parent f6c38d9 commit 04f1ae8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
15 changes: 9 additions & 6 deletions src/ebmc/k_induction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,20 @@ Function: k_induction
\*******************************************************************/

void k_induction(
property_checker_resultt k_induction(
std::size_t k,
const transition_systemt &transition_system,
ebmc_propertiest &properties,
const ebmc_propertiest &properties,
const ebmc_solver_factoryt &solver_factory,
message_handlert &message_handler)
{
// copy
auto properties_copy = properties;

k_inductiont(
k, transition_system, properties, solver_factory, message_handler)();
k, transition_system, properties_copy, solver_factory, message_handler)();

return property_checker_resultt{properties_copy};
}

/*******************************************************************\
Expand Down Expand Up @@ -150,10 +155,8 @@ property_checker_resultt k_induction(

auto solver_factory = ebmc_solver_factory(cmdline);

k_induction(
return k_induction(
k, transition_system, properties, solver_factory, message_handler);

return property_checker_resultt{properties};
}

/*******************************************************************\
Expand Down
8 changes: 4 additions & 4 deletions src/ebmc/k_induction.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ Author: Daniel Kroening, [email protected]
class transition_systemt;
class ebmc_propertiest;

property_checker_resultt k_induction(
[[nodiscard]] property_checker_resultt k_induction(
const cmdlinet &,
transition_systemt &,
ebmc_propertiest &,
message_handlert &);

// Basic k-induction. The result is stored in the ebmc_propertiest argument.
void k_induction(
// Basic k-induction, for given k and given solver.
[[nodiscard]] property_checker_resultt k_induction(
std::size_t k,
const transition_systemt &,
ebmc_propertiest &,
const ebmc_propertiest &,
const ebmc_solver_factoryt &,
message_handlert &);

Expand Down
6 changes: 4 additions & 2 deletions src/ebmc/property_checker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -383,11 +383,13 @@ property_checker_resultt engine_heuristic(
// First try 1-induction, word-level
message.status() << "Attempting 1-induction" << messaget::eom;

k_induction(
auto k_induction_result = k_induction(
1, transition_system, properties, solver_factory, message_handler);

properties.properties = k_induction_result.properties;

if(!properties.has_unfinished_property())
return property_checker_resultt{properties}; // done
return k_induction_result; // done

properties.reset_failure();
properties.reset_inconclusive();
Expand Down

0 comments on commit 04f1ae8

Please sign in to comment.