Skip to content

BMC: looping constraint must consider all inputs #1206

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion regression/ebmc/SVA-LTL/lasso1-show-formula.desc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ lasso1.sv
--bound 1 --show-formula
^EXIT=0$
^SIGNAL=0$
^\(\d+\) lasso::1-back-to-0 ⇔ \(.*counter@1 = .*counter@0 ∧ .*clock@1 .*clock@0\)$
^\(\d+\) lasso::1-back-to-0 ⇔ \(.*clock@1 .*clock@0 ∧ .*counter@1 = .*counter@0\)$
--
--
6 changes: 3 additions & 3 deletions regression/smv/LTL/smv_ltlspec_F5.desc
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
KNOWNBUG
CORE
smv_ltlspec_F5.smv
--bound 3 --numbered-trace
--bound 1 --numbered-trace
^\[spec1\] F \(!some_input \& X !some_input\): REFUTED$
^Counterexample with 2 states:$
^EXIT=10$
^SIGNAL=0$
--
^warning: ignoring
--
The BMC engine gives the wrong answer.
2 changes: 1 addition & 1 deletion regression/smv/LTL/smv_ltlspec_F5.smv
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ MODULE main
VAR some_input : boolean;

-- Expected to fail
-- The shortest loop is FALSE, FALSE
-- The shortest loop is FALSE, FALSE or TRUE, TRUE
LTLSPEC F (!some_input & X !some_input)
8 changes: 8 additions & 0 deletions regression/smv/LTL/smv_ltlspec_F7.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
smv_ltlspec_F7.smv
--bound 1 --show-formula
^\(1\) lasso::1-back-to-0 ⇔ \(smv::main::var::some_input@1 = smv::main::var::some_input@0\)$
^EXIT=0$
^SIGNAL=0$
--
^warning: ignoring
6 changes: 6 additions & 0 deletions regression/smv/LTL/smv_ltlspec_F7.smv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
MODULE main

VAR some_input : 1..3;

-- Expected to fail
LTLSPEC F (some_input >= 2)
21 changes: 3 additions & 18 deletions src/trans-word-level/lasso.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void lasso_constraints(

std::vector<symbol_exprt> variables_to_compare;

// Gather the state variables.
// Gather the state variables, and the inputs.
const symbol_tablet &symbol_table = ns.get_symbol_table();
auto lower = symbol_table.symbol_module_map.lower_bound(module_identifier);
auto upper = symbol_table.symbol_module_map.upper_bound(module_identifier);
Expand All @@ -104,26 +104,11 @@ void lasso_constraints(
{
const symbolt &symbol = ns.lookup(it->second);

if(symbol.is_state_var)
if(symbol.is_state_var || symbol.is_input)
variables_to_compare.push_back(symbol.symbol_expr());
}

// gather the top-level inputs
const auto &module_symbol = ns.lookup(module_identifier);
DATA_INVARIANT(module_symbol.type.id() == ID_module, "expected a module");
const auto &ports = module_symbol.type.find(ID_ports);

for(auto &port : static_cast<const exprt &>(ports).operands())
{
DATA_INVARIANT(port.id() == ID_symbol, "port must be a symbol");
if(port.get_bool(ID_input) && !port.get_bool(ID_output))
{
symbol_exprt input_symbol(port.get(ID_identifier), port.type());
input_symbol.add_source_location() = port.source_location();
variables_to_compare.push_back(std::move(input_symbol));
}
}

// Create the constraint
for(mp_integer i = 1; i < no_timeframes; ++i)
{
for(mp_integer k = 0; k < i; ++k)
Expand Down
Loading