Skip to content

Misleading Expansions#180

Open
rcosta358 wants to merge 3 commits intomainfrom
misleading-expansions
Open

Misleading Expansions#180
rcosta358 wants to merge 3 commits intomainfrom
misleading-expansions

Conversation

@rcosta358
Copy link
Collaborator

@rcosta358 rcosta358 commented Mar 17, 2026

Closes #161. Even when the simplifier could not actually simplify an expression, it still produced a derivation tree that looked like it contained meaningful expansions:

  • Unary minus on literals (e.g. -(128)-128) was treated as a simplification and given a derivation origin. To fix this, we skip creating an origin when the operand is a just a literal
  • A && B && C was always turned into a derivation tree even when nothing changed. To fix this, now we only create a BinaryDerivationNode if at least one child expression actually has an origin

Example

Before

image

After

image

@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 changed the base branch from main to expression-oversimplification March 17, 2026 11:58
@rcosta358 rcosta358 force-pushed the misleading-expansions branch from 9c718cf to 780ab72 Compare March 18, 2026 16:21
@rcosta358 rcosta358 changed the base branch from expression-oversimplification to main March 18, 2026 16:21
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 show expansion if result is the same

1 participant