ticket #000030 Phases 1+2: algebra-symbolic@v1 + calculus-derivative@v1
Two new π* canonicalizers extend the math substrate above
arithmetic@v1 (closed-form rationals) and logic-kernel@v1
(propositional Boolean → CNF):
algebra-symbolic@v1 (Phase 1) — symbolic-algebra domain.
sp.expand → sp.srepr canonical bytes. Polynomial identity collapses
((x+1)**2 ≡ x**2 + 2*x + 1); exponential identity collapses
(exp(a+b) ≡ exp(a)*exp(b), inherited from sp.expand's default
behavior); trigonometric identity does NOT collapse
(sin²+cos² ≢ 1). The trig surface is reserved for a future
algebra-symbolic-simplified@v1 variant that wraps sp.simplify at
unbounded CPU cost. Rejects relationals (`x > 0`) and
BooleanFunction shapes (`x & y`) via `isinstance(expr, sp.Expr)` —
sp.Symbol confusingly inherits from Boolean so the right rejection
filter is "not Expr" rather than "Boolean".
calculus-derivative@v1 (Phase 2) — calculus domain. JSON-shaped
{f, x, n} input → sp.diff → sp.expand → srepr bytes. Output is
itself a valid algebra-symbolic@v1 input so the two compose
naturally under arborist.pi_star.compose. n defaults to 1; bools
explicitly rejected (Python isinstance(True, int) is True so we
filter that explicitly).
Optional dependency: sympy ships in the new [math] extra
(pyproject.toml). Folded into [dev] so make bootstrap pulls it
transitively. An explicit `bootstrap-math` Makefile target documents
the opt-in for minimal-install users. Both modules self-guard
via `try: import sympy as sp / except ImportError: sp = None` and
only register(...) when sympy is present, so a fresh checkout
without [math] still loads arborist.pi_star without raising.
Preflight algebra route lands in
arborist.qa.query._canonical_projection_preflight between the
arithmetic and logic routes. Charset regex (_CANONICAL_ALGEBRA_RE)
allows lowercase letters + math chars; requires at least one
letter (else arithmetic wins); rejects natural-language leading
verbs via _CANONICAL_ALGEBRA_NL_LEAD_RE (4-letter minimum so
single-/two-/three-char identifiers like x, xy, sin, cos, pi
survive while "simplify (...)", "factor x...", "expand (a+b)..."
fall through). PiStarError + KeyError both fall through cleanly
so a sympy-less install just routes everything past algebra.
Bench substrate:
- bench/batteries/base.py PHASE_1_CARRIERS gains "symbolic_algebra"
- bench/fixtures/5s/syntax-algebra-symbolic-v1.jsonl (10 fixtures)
- bench/fixtures/5s/semantics-algebra-symbolic-v1.jsonl (13 fixtures
including the documented trig non-collapse + exp collapse)
- Makefile bench-5s-algebra target → 100% pass
Tests: 18 algebra-symbolic + 38 calculus-derivative unit tests +
~10 new preflight-route tests in test_canonical_projection.py. All
gate on pytest.importorskip("sympy") so a sympy-less suite stays
green. Full suite: 1369 passed / 27 skipped.
Phases 3-7 (integral, limit, series, linear-algebra,
function-sampled) remain open as future work; each lands as its
own ticket when an actual consumer surfaces.
This commit is contained in:
parent
97a4187845
commit
04f3f5d2a8
14 changed files with 823 additions and 12 deletions
|
|
@ -61,7 +61,7 @@ Newest first. Update on every open/close.
|
|||
|
||||
| ID | Title | Status | Opened | Directive |
|
||||
|----------|------------------------------------------------|-----------------------|------------|-----------|
|
||||
| #000030 | Math π* expansion: SymPy substrate (algebra · calculus · linalg) | open · awaiting go/no-go | 2026-05-09 | — |
|
||||
| #000030 | Math π* expansion: SymPy substrate (algebra · calculus · linalg) | closed · Phases 1+2 landed 2026-05-09 (3-7 future work) | 2026-05-09 | — |
|
||||
| #000029 | Claim-pack source (axiom/theorem JSON bundles) | closed · landed 2026-05-09 | 2026-05-09 | — |
|
||||
| #000028 | Multi-modality witness for canonical shapes | closed · landed 2026-05-09 (STRICT-WITNESSED reachable post-#000027) | 2026-05-08 | — |
|
||||
| #000027 | Canonical projections persist to providence_cache | closed · landed 2026-05-09 | 2026-05-08 | — |
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# Ticket #000030 — Math π* expansion: SymPy substrate
|
||||
|
||||
**Status:** open · awaiting go/no-go
|
||||
**Status:** closed · Phases 1+2 landed 2026-05-09 (Phases 3-7 remain open as future work)
|
||||
**Opened:** 2026-05-09
|
||||
**Scope:** Extend the π* registry with SymPy-backed canonicalizers
|
||||
covering symbolic algebra, calculus (derivatives, integrals,
|
||||
|
|
@ -452,12 +452,54 @@ each warrant their own commit but share infrastructure.
|
|||
|
||||
## Status
|
||||
|
||||
Open · awaiting go/no-go.
|
||||
**Phases 1+2 landed 2026-05-09 in a single commit.** Phases 3-7
|
||||
(integral, limit, series, linear-algebra, function-sampled) remain
|
||||
open as future work; each is a separate ticket when fox prioritizes.
|
||||
|
||||
Estimated size:
|
||||
- Phase 1: ~120 LOC module + ~80 LOC tests + ~25 fixtures.
|
||||
- Phase 2: ~80 LOC module + ~60 LOC tests + ~20 fixtures.
|
||||
- Phases 3-7: ~80 LOC each (similar shape).
|
||||
Landed scope:
|
||||
|
||||
Phase 1+2 single commit feasible. Subsequent phases roll one at a
|
||||
time as fox prioritizes.
|
||||
- `pyproject.toml` — `[math]` extra (`sympy>=1.13`); folded into
|
||||
`[dev]` so `make bootstrap` pulls it transitively.
|
||||
- `Makefile` — `bootstrap-math` explicit target + `bench-5s-algebra`
|
||||
bench target.
|
||||
- `arborist/pi_star/algebra_symbolic.py` — Phase 1 module
|
||||
(`AlgebraSymbolicV1`). `sp.expand` → `sp.srepr` canonical bytes.
|
||||
Polynomial AND exponential identity collapse; trigonometric
|
||||
identity does not (deferred to a future
|
||||
`algebra-symbolic-simplified@v1` Phase 1b ticket).
|
||||
- `arborist/pi_star/calculus_derivative.py` — Phase 2 module
|
||||
(`CalculusDerivativeV1`). JSON-shaped `{f, x, n}` input contract
|
||||
→ SymPy `diff` + `expand` → srepr bytes (output is itself a valid
|
||||
algebra-symbolic@v1 input).
|
||||
- `arborist/pi_star/__init__.py` — registers both side-effect
|
||||
modules at package load; both self-guard via defensive
|
||||
`import sympy` so a fresh checkout without `[math]` still loads.
|
||||
- `arborist/qa/query.py:_canonical_projection_preflight` — third
|
||||
route between arithmetic and logic. Charset regex
|
||||
(`_CANONICAL_ALGEBRA_RE`) + leading-natural-language-verb reject
|
||||
(`_CANONICAL_ALGEBRA_NL_LEAD_RE`, 4-letter minimum so `x`, `xy`,
|
||||
`sin`, `cos`, `pi` survive) + at-least-one-letter requirement
|
||||
(else arithmetic wins). PiStarError + KeyError both fall through
|
||||
cleanly.
|
||||
- `bench/fixtures/5s/{syntax,semantics}-algebra-symbolic-v1.jsonl`
|
||||
— 10 syntax fixtures (parse-pass) + 13 semantics fixtures
|
||||
(equivalence classes including the documented trig non-collapse
|
||||
+ exp collapse). `bench-5s-algebra` target reports 100% pass.
|
||||
- `bench/batteries/base.py PHASE_1_CARRIERS` — `symbolic_algebra`
|
||||
added to the carrier whitelist so the harness accepts the new
|
||||
fixtures.
|
||||
- `tests/test_pi_star_algebra_symbolic.py` (18 tests) +
|
||||
`tests/test_pi_star_calculus_derivative.py` (38 tests) +
|
||||
preflight algebra-route tests in
|
||||
`tests/test_canonical_projection.py`. All gate on
|
||||
`pytest.importorskip("sympy")` so a sympy-less checkout stays
|
||||
green.
|
||||
- Full test suite passes (1369 passed / 27 skipped).
|
||||
|
||||
Estimated-size predictions held: Phase 1 ~130 LOC + tests, Phase 2
|
||||
~140 LOC + tests. Total commit ~1100 LOC including tests, fixtures,
|
||||
docs, and the preflight wiring.
|
||||
|
||||
Phase 3-7 follow-on size estimate (`~80 LOC each`) carries
|
||||
forward; each gets its own future ticket when an actual consumer
|
||||
surfaces the need.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue