Skip to content

Commit 7ab1ab5

Browse files
committed
BMC: looping constraint must consider all inputs
The SMV top-level main module does not have explicit inputs or output. This change adds all inputs to the list of variables that are compared when creating the lasso condition.
1 parent 521d107 commit 7ab1ab5

File tree

6 files changed

+22
-23
lines changed

6 files changed

+22
-23
lines changed

regression/ebmc/SVA-LTL/lasso1-show-formula.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ lasso1.sv
33
--bound 1 --show-formula
44
^EXIT=0$
55
^SIGNAL=0$
6-
^\(\d+\) lasso::1-back-to-0 ⇔ \(.*counter@1 = .*counter@0 ∧ .*clock@1 .*clock@0\)$
6+
^\(\d+\) lasso::1-back-to-0 ⇔ \(.*clock@1 .*clock@0 ∧ .*counter@1 = .*counter@0\)$
77
--
88
--
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
KNOWNBUG
1+
CORE
22
smv_ltlspec_F5.smv
3-
--bound 3 --numbered-trace
3+
--bound 1 --numbered-trace
44
^\[spec1\] F \(!some_input \& X !some_input\): REFUTED$
5+
^Counterexample with 2 states:$
56
^EXIT=10$
67
^SIGNAL=0$
78
--
89
^warning: ignoring
910
--
10-
The BMC engine gives the wrong answer.

regression/smv/LTL/smv_ltlspec_F5.smv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ MODULE main
33
VAR some_input : boolean;
44

55
-- Expected to fail
6-
-- The shortest loop is FALSE, FALSE
6+
-- The shortest loop is FALSE, FALSE or TRUE, TRUE
77
LTLSPEC F (!some_input & X !some_input)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
smv_ltlspec_F7.smv
3+
--bound 1 --show-formula
4+
^\(1\) lasso::1-back-to-0 ⇔ \(smv::main::var::some_input@1 = smv::main::var::some_input@0\)$
5+
^EXIT=0$
6+
^SIGNAL=0$
7+
--
8+
^warning: ignoring

regression/smv/LTL/smv_ltlspec_F7.smv

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
MODULE main
2+
3+
VAR some_input : 1..3;
4+
5+
-- Expected to fail
6+
LTLSPEC F (some_input >= 2)

src/trans-word-level/lasso.cpp

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ void lasso_constraints(
9595

9696
std::vector<symbol_exprt> variables_to_compare;
9797

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

107-
if(symbol.is_state_var)
107+
if(symbol.is_state_var || symbol.is_input)
108108
variables_to_compare.push_back(symbol.symbol_expr());
109109
}
110110

111-
// gather the top-level inputs
112-
const auto &module_symbol = ns.lookup(module_identifier);
113-
DATA_INVARIANT(module_symbol.type.id() == ID_module, "expected a module");
114-
const auto &ports = module_symbol.type.find(ID_ports);
115-
116-
for(auto &port : static_cast<const exprt &>(ports).operands())
117-
{
118-
DATA_INVARIANT(port.id() == ID_symbol, "port must be a symbol");
119-
if(port.get_bool(ID_input) && !port.get_bool(ID_output))
120-
{
121-
symbol_exprt input_symbol(port.get(ID_identifier), port.type());
122-
input_symbol.add_source_location() = port.source_location();
123-
variables_to_compare.push_back(std::move(input_symbol));
124-
}
125-
}
126-
111+
// Create the constraint
127112
for(mp_integer i = 1; i < no_timeframes; ++i)
128113
{
129114
for(mp_integer k = 0; k < i; ++k)

0 commit comments

Comments
 (0)