Skip to content

The parser: equation strings to a term model - #3

Open
roed-math wants to merge 1 commit into
split/01-bibliographyfrom
split/02-parsing
Open

The parser: equation strings to a term model#3
roed-math wants to merge 1 commit into
split/01-bibliographyfrom
split/02-parsing

Conversation

@roed-math

@roed-math roed-math commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

The parser: equation string to ParsedEquation.

Recognizes the term model the rest of the classifier works with: polynomial
terms, 2^n-style exponential terms and y^q power terms, with parameters
living in the coefficient ring.

Denominators are cleared, and the hypotheses that introduces are kept as
structured, executable predicates rather than prose. API note:
ParsedEquation.conditions is a tuple of NonzeroCondition objects
(conditions.py), not a list of display strings; str(c) renders one and
c.as_dict() serializes it. The conditions are collected from the source
syntax before Sage can simplify a denominator away, so 1/(x - 1) = 1/(y - 1)
records x - 1 != 0 (not x != 0) and x/x = y keeps both the condition and
x as an unknown. source_lhs/source_rhs keep the user's equation beside
the normalized model, and is_solution() checks candidates against it exactly —
the final correctness filter for every solver's output.

No family data is involved: the parser is exercised by its own doctests and by
tests/test_parsing.py.

Part of the series that splits #1 into reviewable pieces:

  1. 01-bibliography — packaging, docs, annotated bibliography
  2. 02-parsing — equation strings to a term model
  3. 03-registry — the YAML family registry (3 seed families)
  4. 04-matchers — shape recognizers
  5. 05-classify — the classification pipeline
  6. 06-solvers — solver framework, two seed solvers, and the CLI
  7. 07..09-backbone — the 23 parent families of the DAG, by depth
  8. one PR per remaining family (38 of them, mutually independent)
  9. 99-polish — restore the full doctests and tighten the invariants

@roed-math roed-math mentioned this pull request Aug 8, 2026
@roed-math
roed-math force-pushed the split/01-bibliography branch from 8e824be to c747532 Compare August 8, 2026 16:12
@roed-math
roed-math force-pushed the split/01-bibliography branch from c747532 to cbc6bd5 Compare August 9, 2026 02:43
@roed-math
roed-math force-pushed the split/01-bibliography branch from cbc6bd5 to 5424adf Compare August 9, 2026 05:01
@roed-math
roed-math force-pushed the split/01-bibliography branch from 5424adf to 1eafd8f Compare August 9, 2026 05:21
@roed-math
roed-math force-pushed the split/01-bibliography branch from 1eafd8f to 94de58a Compare August 9, 2026 08:23
The parser: equation string to `ParsedEquation`.

Recognizes the term model the rest of the classifier works with: polynomial
terms, `2^n`-style exponential terms and `y^q` power terms, with parameters
living in the coefficient ring.

Denominators are cleared, and the hypotheses that introduces are kept as
structured, executable predicates rather than prose.  **API note:**
`ParsedEquation.conditions` is a tuple of `NonzeroCondition` objects
(`conditions.py`), not a list of display strings; `str(c)` renders one and
`c.as_dict()` serializes it.  The conditions are collected from the source
syntax *before* Sage can simplify a denominator away, so `1/(x - 1) = 1/(y - 1)`
records `x - 1 != 0` (not `x != 0`) and `x/x = y` keeps both the condition and
`x` as an unknown.  `source_lhs`/`source_rhs` keep the user's equation beside
the normalized model, and `is_solution()` checks candidates against it exactly —
the final correctness filter for every solver's output.

No family data is involved: the parser is exercised by its own doctests and by
`tests/test_parsing.py`.

Part of the series that splits #1 into reviewable pieces:

1. `01-bibliography` — packaging, docs, annotated bibliography
2. `02-parsing` — equation strings to a term model
3. `03-registry` — the YAML family registry (3 seed families)
4. `04-matchers` — shape recognizers
5. `05-classify` — the classification pipeline
6. `06-solvers` — solver framework, two seed solvers, and the CLI
7. `07..09-backbone` — the 23 parent families of the DAG, by depth
8. one PR per remaining family (38 of them, mutually independent)
9. `99-polish` — restore the full doctests and tighten the invariants
@roed-math
roed-math force-pushed the split/01-bibliography branch from 94de58a to 353fb02 Compare August 9, 2026 20:35
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.

2 participants