@@ -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,18 @@ 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) ;
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 ()); } ;
115115
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);
126117
118+ // Create the constraint
127119 for (mp_integer i = 1 ; i < no_timeframes; ++i)
128120 {
129121 for (mp_integer k = 0 ; k < i; ++k)
0 commit comments