Skip to content

Conversation

@blishko
Copy link
Collaborator

@blishko blishko commented Nov 12, 2025

Description

On expression level, we convert all inequalities to use (signed) less-than operator, (S)LT.

On propositional level, we express inequalities using PLT and PLEq. Here, it might be beneficial to keep leq-or-equal operator, so as to express as much as possible with positive atoms, avoiding negation.

We also take advantage of "bool-like" expressions, i.e., word-expressions that we can express on the propositional level. These include "IsZero", "(S)LT", "Eq".
The result of these operations can only be 0 or 1, so we can simplify a propositon (PEq (Lit 0) e) where e is bool-like (and also if it is equal to Lit 1).

Checklist

  • tested locally
  • added automated tests
  • updated the docs
  • updated the changelog

On expression level, we convert all inequalities to use (signed)
less-than operator, (S)LT.

On propositional level, we express inequalities using PLT and PLEq.
Here, it might be beneficial to keep leq-or-equal operator, so as to
express as much as possible with positive atoms, avoiding negation.

We also take advantage of "bool-like" expressions, i.e.,
word-expressions that we can express on the propositional level.
These include "IsZero", "(S)LT", "Eq".
The result of these operations can only be 0 or 1, so we can simplify a
propositon (PEq (Lit 0) e) where e is bool-like (and also if it is equal
to Lit 1).
@blishko blishko requested a review from msooseth November 12, 2025 13:44
Copy link
Collaborator

@msooseth msooseth left a comment

Choose a reason for hiding this comment

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

Thanks! LGTM!

I probably should have added some example Props that the old set simplified, and checked that it got smaller. I think there were some contracts that could be significantly simplified with the right rules. We are currently not tracking if we accidentally don't simplify something with a change. Next time I look at some Props, I'll add some tests for the size of the simplified Prop.

@blishko
Copy link
Collaborator Author

blishko commented Nov 15, 2025

We should definitely gather more unit tests for simplifications!

@blishko blishko merged commit d6e6e05 into main Nov 15, 2025
13 of 14 checks passed
@blishko blishko deleted the canonical-comparison-simplifications branch November 15, 2025 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants