Skip to content

Expression Oversimplification#179

Open
rcosta358 wants to merge 2 commits intomainfrom
expression-oversimplification
Open

Expression Oversimplification#179
rcosta358 wants to merge 2 commits intomainfrom
expression-oversimplification

Conversation

@rcosta358
Copy link
Collaborator

@rcosta358 rcosta358 commented Mar 17, 2026

Closes #163. Expressions were simplified to the fullest (e.g., true), which was not helpful to see in the error message, especially in the terminal version which does not allow for expansion.

To fix this, two changes were made:

  • Added a condition to stop and use the unsimplified expression If an expression is simplified to a boolean literal
  • Added unwrapDerivedLiterals that is called after the simplification is performed, to traverse the derivation tree and replace boolean literals with the expressions that produced them, but only when at least one operand in the derivation is non-boolean (otherwise the boolean literal is okay)

Examples

Before & After

x > 5 && x == 1010 > 5true
x > 5 && x == 1010 > 5

Before & After

x == y > 0 && y == 1x == 1 > 0x == true
x == y > 0 && y == 1x == 1 > 0

Before & After

...1 == 1 && 2 == 2true && truetrue
...1 == 1 && 2 == 2

@rcosta358 rcosta358 self-assigned this Mar 17, 2026
@rcosta358 rcosta358 added enhancement New feature or request simplification Related to the simplification of expressions labels Mar 17, 2026
@rcosta358 rcosta358 marked this pull request as draft March 18, 2026 00:24
@rcosta358 rcosta358 marked this pull request as draft March 18, 2026 00:24
@rcosta358 rcosta358 marked this pull request as ready for review March 18, 2026 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request simplification Related to the simplification of expressions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Don't oversimplify to true

1 participant