@@ -95,7 +95,7 @@ void lasso_constraints(
95
95
96
96
std::vector<symbol_exprt> variables_to_compare;
97
97
98
- // Gather the state variables.
98
+ // Gather the state variables, and the inputs .
99
99
const symbol_tablet &symbol_table = ns.get_symbol_table ();
100
100
auto lower = symbol_table.symbol_module_map .lower_bound (module_identifier);
101
101
auto upper = symbol_table.symbol_module_map .upper_bound (module_identifier);
@@ -104,26 +104,18 @@ void lasso_constraints(
104
104
{
105
105
const symbolt &symbol = ns.lookup (it->second );
106
106
107
- if (symbol.is_state_var )
107
+ if (symbol.is_state_var || symbol. is_input )
108
108
variables_to_compare.push_back (symbol.symbol_expr ());
109
109
}
110
110
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) ;
111
+ // We sort the set of variables to compare,
112
+ // to get a deterministic formula
113
+ auto ordering = []( const symbol_exprt &a, const symbol_exprt &b)
114
+ { return id2string (a. get_identifier ()) < id2string (b. get_identifier ()); } ;
115
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
- }
116
+ std::sort (variables_to_compare.begin (), variables_to_compare.end (), ordering);
126
117
118
+ // Create the constraint
127
119
for (mp_integer i = 1 ; i < no_timeframes; ++i)
128
120
{
129
121
for (mp_integer k = 0 ; k < i; ++k)
0 commit comments