Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds termination/pruning guards around rule discovery and maintenance in SimpliPy, aiming to avoid non-terminating metavariable expansions and reduce redundant explicit rules.
Changes:
- Add
violates_wildcard_multiplicity(...)and use it during rule discovery to filter unsafe candidates, while also preferring candidates with fewer'<constant>'tokens. - Introduce
SimpliPyEngine.prune_redundant_rules()and invoke it after rule discovery; add a CLIprune-rulescommand. - Update tests for pruning/multiplicity behavior and bump project version to
0.2.15.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
tests/test_engine_simplification.py |
Adds tests for rule pruning and wildcard multiplicity guard. |
src/simplipy/utils.py |
Adds wildcard multiplicity checker helper. |
src/simplipy/engine.py |
Adds redundant-rule pruning, integrates multiplicity guard + candidate sorting in rule finder, and runs pruning after rule discovery. |
src/simplipy/__main__.py |
Adds prune-rules CLI command. |
README.md |
Version bump to 0.2.15. |
pyproject.toml |
Version bump to 0.2.15. |
.gitignore |
Ignore .vscode/. |
.github/copilot-instructions.md |
Removes Copilot instruction file. |
Comments suppressed due to low confidence (1)
tests/test_engine_simplification.py:120
- Lines 117–124 are indented as part of the
TestPruneRedundantRulesclass body but are not inside atest_...method. This will execute at import/class-definition time and will likely break test collection (and/or perform a networkedSimpliPyEngine.load(...)during import). Wrap this block in a test function/method (e.g.def test_repeated_addition_...) and ensure the indentation is correct so it’s not executed at class scope.
assert len(engine.simplification_rules) == 2
engine = SimpliPyEngine.load("dev_7-3", install=True)
expr = " + ".join(["x"] * 14)
simplified = engine.simplify(expr, max_iter=1, verbose=False)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
… n constants