Skip to content

Conversation

@daniel-raffler
Copy link
Contributor

Hello

this PR fixes issues with name collisions on CVC4/5 and Princess. None of these solvers support variable/Uf names to be overloaded, however, checks for name collisions were missing or broken. Because of this, duplicate symbols could be declared, but the solver would still crash when trying to use these new symbols. This PR fixes the checks and makes sure that a more user-friendly error message is printed when trying to redefine an existing symbol

Copy link
Member

@kfriedberger kfriedberger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, overall,
I have not tested it on larger scale, so maybe one could execute some CPAchecker benchmarks with the new implementation sooner or later.

new ITermITE(
(IFormula) arg, new IIntLit(IdealInt.ZERO()), new IIntLit(IdealInt.ONE()));
} else if (!exprIsRational(arg) && functionTakesRational(i)) {
} else if (actualType.isIntegerType() && expectedType.isRationalType()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting. This looks simpler than before. Maybe Princess improved its API in the last years. 😄 Does this really hold for all inputs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the API didn't change. Princess uses IFunctions for function declarations and it's not always possible to get a type signature from them as they may be polymorphic. When declaring a UF symbol it's generally possible to cast the IFunction to a MonoSortedIFunction with a fixed type that can then be accessed. However, the cast doesn't always seem to work and sometimes the signature just isn't available. Because of that we're now storing the signature inside PrincessIFunctionDeclaration, which wraps around the actual IFunction. The function cache now also maps to PrincessIFunctionDeclaration, instead of IFuntion. This allows us to check for collisions when declaring a new UF symbol.. and it also has the side-effect of simplifying the code above as we can just compare the type of the arguments to the stored function type

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

Crashes with overloaded variable names in CVC and Princess

2 participants