Skip to content

Commit 1df0bb7

Browse files
committed
SMV: turn nondeterministic choice into disjunction
This avoids replaces the "constraint_select_one" expression by an explicit disjunction in the SMV type checker.
1 parent b6bf787 commit 1df0bb7

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

src/smvlang/smv_typecheck.cpp

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1839,21 +1839,19 @@ void smv_typecheckt::typecheck_assignment(exprt &expr)
18391839

18401840
if(rhs.type().id() == ID_smv_set && rhs.id() == ID_smv_set)
18411841
{
1842-
// sets can be assigned to scalars, which yields a nondeterministic
1843-
// choice
1844-
std::string identifier =
1845-
module_identifier + "::var::" + std::to_string(nondet_count++);
1846-
1847-
rhs.set(ID_identifier, identifier);
1848-
rhs.set("#smv_nondet_choice", true);
1842+
// Sets can be assigned to scalars, which yields a nondeterministic
1843+
// choice. First check the set elements.
1844+
for(auto &op : rhs.operands())
1845+
convert_expr_to(op, lhs.type());
18491846

1850-
rhs.id(ID_constraint_select_one);
1851-
rhs.type() = lhs.type();
1847+
// Now turn the nondeterministic choice into a top-level
1848+
// disjunctive constraint.
1849+
exprt::operandst disjuncts;
18521850

1853-
// check the set elements
18541851
for(auto &op : rhs.operands())
1855-
convert_expr_to(op, lhs.type());
1852+
disjuncts.push_back(equal_exprt{lhs, op});
18561853

1854+
expr = disjunction(disjuncts);
18571855
return;
18581856
}
18591857

0 commit comments

Comments
 (0)