Skip to content

v4 T-4 Phase-3: dissolve python.dag PythonNumericTower wrapper → flat-nullary PythonScalar (#3309 fwd-port) - #3344

Merged
briansrls merged 4 commits into
mainfrom
session/stern-eagle-698-3309-fwd
May 19, 2026
Merged

briansrls merged 4 commits into
mainfrom
session/stern-eagle-698-3309-fwd

Conversation

@briansrls

@briansrls briansrls commented May 19, 2026 •

Copy link
Copy Markdown
Contributor

Issue

#3338 landed canonical-B bool grounding for python.dag but retained a hollow nested PythonNumericTower / Numeric-tower wrapper: PythonScalar = Numeric { tower: PythonNumericTower } | Singleton { kind }. The single-field Numeric { tower } wrapper is a Practice-8 hollow prong (a wrapper adding no field of its own) and PythonNumericTower is a classifier reading zero spec facts.

Operator A-vs-B ruling (2) (2026-05-19, relayed via vivid-carp-207): #3309's Practice-8 dissolution of that wrapper carries unique value and is forward-ported onto post-#3338 main.

The dissolution

PythonScalar is reseeded into a flat-nullary coproduct:

type PythonScalar
  = IntScalar
  | FloatScalar
  | ComplexScalar
  | BoolScalar
  | Singleton { kind: PythonSingletonKind }

PythonNumericTower is dissolved. The flat coproduct mirrors rust.dag RustScalar's structure (flat scalar coproduct with nullary variants), not its facts: Python's numeric primitives have zero intra-kind variance (one int, one float, one complex — Python Language Reference §3.2), so the variants carry no fabricated kind/width carrier.

Preserved byte-exact (the #3338 canonical-B grounding mechanism)

  • data py_bool_grounding: BooleanAlgebra<Bool> = bool_boolean_algebra (data row untouched)
  • import v4.std.logic { Bool, bool_boolean_algebra } / import v4.std.algebra { BooleanAlgebra }

Header/ledger references to the dissolved PythonNumericTower.BoolLevel are re-anchored to PythonScalar.BoolScalar (python.dag scope/owns/bool-header/grounding-comment; DECISIONS.md python.dag / singletons bullet). New SL-3309-PYTHON-SCALAR-RESEED ledger row added.

Acceptance criteria (runnable)

  1. v2 compiles 0 diagnostics (python.dag is in the closure):
    cargo run -p v2-compiler --bin v2-compiler -- compile --source-root src/v4 --output-dir /tmp/v4out --target rust
    
    -> compiled: 76 files emitted, 0 diagnostics
  2. PythonScalar is flat-nullary -- no Numeric-tower / PythonNumericTower remain:
    grep -n 'PythonNumericTower\|Numeric {' src/v4/extdeps/languages/python.dag   # -> no matches
    
  3. fix-language-files #3338 bool grounding byte-identical to main:
    git diff origin/main HEAD -- src/v4/extdeps/languages/python.dag | grep -E '^[-+].*(py_bool_grounding|import v4.std)'   # -> no matches
    

🤖 Generated with Claude Code

briansrls and others added 3 commits May 18, 2026 21:51
…wrapper → flat-nullary PythonScalar

Operator A-vs-B ruling (2): #3309's Practice-8 dissolution of the hollow
nested PythonNumericTower / Numeric-tower wrapper carries unique value
over the shape #3338 retained. Forward-ported onto post-#3338 main.

- PythonScalar reseeded `Numeric { tower: PythonNumericTower } | Singleton`
  → flat coproduct `IntScalar | FloatScalar | ComplexScalar | BoolScalar
  | Singleton { kind }`; PythonNumericTower enum dissolved.
- #3338 canonical-B bool grounding preserved byte-exact: py_bool_grounding
  data row + its v4.std.logic / v4.std.algebra imports untouched.
- Header/ledger refs to the dissolved PythonNumericTower re-anchored to
  PythonScalar.BoolScalar (python.dag L2/L3/L5/L40; DECISIONS.md).
- SL-3309-PYTHON-SCALAR-RESEED ledger row added.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@briansrls briansrls changed the title v4 T-4 Phase-3: python.dag per-language fact-bundle rework — scalar tower as kind×width fact-bundle coproduct (rust.dag RustScalar shape) NOW; per-primitive bool-alias/grounding-row HELD-PROVISIONAL 🟡 gated on operator A-vs-B ruling (NOT modeled until ruled); P1-KEYSTONE typed facts; per-coproduct v4 T-4 Phase-3: dissolve python.dag PythonNumericTower wrapper → flat-nullary PythonScalar (#3309 fwd-port) May 19, 2026
@briansrls
briansrls marked this pull request as ready for review May 19, 2026 02:00
PythonNumericTower.BoolLevel -> PythonScalar.BoolScalar — minimal
anchor-reconcile of the one remaining repo-wide reference to the type
this PR dissolves (manager standing principle: reconcile every
dissolved-type ref, never preserve-stale).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@briansrls

Copy link
Copy Markdown
Contributor Author

Thanks for the review. The exploratory observation — docs/modeling/grounding-worked-examples.md mentioning PythonNumericTower.BoolLevel — is already addressed. The review artifact was generated against commit 4550b5c31; the subsequent commit 7a3dc65dd ("Reconcile dissolved-type ref in grounding-worked-examples.md") reconciles that line to PythonScalar.BoolScalar. grep -n PythonNumericTower docs/modeling/grounding-worked-examples.md on the current PR head returns no matches. The only surviving PythonNumericTower strings repo-wide are inside the new SL-3309-PYTHON-SCALAR-RESEED decision prose, where they deliberately describe the dissolved before-state ("dissolves the bare PythonNumericTower enum", "formerly anchored at"). No further change needed.\n\n— sent from stern-eagle-698

@briansrls
briansrls merged commit d5d84e1 into main May 19, 2026
7 checks passed
briansrls added a commit that referenced this pull request May 19, 2026
…VS-B row by ID (#3346)

Non-blocking ledger-traceability follow-up to merged #3344 (the #3309
reading-(2) forward-port). Adds a one-clause **Supersedes:** pointer to
the SL-3309-PYTHON-SCALAR-RESEED row naming the dropped prior
held-provisional SL-3309-PYTHON-PER-PRIMITIVE-A-VS-B row by ID, closed by
operator A-vs-B ruling (2) + #3338 py_bool_grounding. By-ID only — no
stale PyBool=Bool / open-gate text reintroduced (carrying that verbatim
would itself be the stale closed-gate finding the dissolution removes).
DECISIONS.md-only; no .dag change.
@briansrls
briansrls deleted the session/stern-eagle-698-3309-fwd branch June 1, 2026 18:43
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.

1 participant