Repository navigation
feat(std): T-Numeric-Construction Slice 2 — Nat = Semiring<Magnitude> #1399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
2592b65
WIP: tidy-tern-769
briansrls 3453a17
chore: apply cargo fmt
briansrls c36e956
WIP: tidy-tern-769
briansrls 8d10039
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls f008b6f
WIP: tidy-tern-769
briansrls dce2fc0
chore: apply cargo fmt
briansrls 0f2d0d0
WIP: tidy-tern-769
briansrls 75772bd
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls 37e9b38
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls 16207e9
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls 962d973
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls 46e92f0
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls 9fd943e
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls ed0f59c
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls 361e128
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls c806aaa
WIP: tidy-tern-769
briansrls 64edc56
feat(std): add Magnitude opaque carrier (T-Numeric-Construction Slice 1)
briansrls 6b756a9
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls 874e321
WIP: tidy-tern-769
briansrls 08bb95a
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls d279af0
WIP: tidy-tern-769
briansrls 07cb719
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls 6440ca0
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls c4a56fa
WIP: tidy-tern-769
briansrls 83ac68d
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls 09f0af7
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls 00d4c7f
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls dd23d33
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls 5f533e0
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls 63d7075
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls 5834de1
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls 68ab971
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls c1cd614
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls 3cadf1d
WIP: tidy-tern-769
briansrls 0dfa004
feat(std): T-Numeric-Construction Slice 2 — Nat = Semiring<Magnitude>
briansrls 0ec0ace
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls 1a14d82
fix(std/nat): document tracked-scaffold dissolution trigger to Commut…
briansrls 8420693
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| // std/nat.dag -- Natural numbers (ℕ) as semiring over the abstract counting carrier. | ||
| // | ||
| // Layer 2 of the construction chain authored in | ||
| // `docs/design-numeric-construction.md`: | ||
| // | ||
| // Magnitude → Nat → Int → Rational → Real | ||
| // | ||
| // `Nat = Semiring<Magnitude>` says "ℕ is the algebra of addition + multiplication | ||
| // (with identities 0 and 1) over the unbounded counting carrier `Magnitude`." | ||
| // No additive inverse — `Semiring` is the right algebra layer for ℕ; `Int` | ||
| // extends to `AbelianGroup<Nat>` in a later slice (Grothendieck construction). | ||
| // | ||
| // TRACKED SCAFFOLD (algebra-strength sharpening) — P5 dissolution trigger: | ||
| // The denotational note at `dsl/std/algebra.dag:54` says | ||
| // "Nat inhabits CommutativeSemiring (because (Nat, *, 1) is a commutative monoid)" | ||
| // but `dsl/std/algebra.dag` declares only `type Semiring<T>` (no | ||
| // `type CommutativeSemiring<T>`). `Semiring<Magnitude>` is the closest | ||
| // honest algebra surface available today; multiplicative commutativity | ||
| // of ℕ is true denotationally but not yet pinned structurally in the | ||
| // substrate. Precedent for the sharpening is already in algebra.dag: | ||
| // `Monoid → CommutativeMonoid` is the same shape (`algebra.dag:111-122`). | ||
| // | ||
| // **Dissolution trigger:** when an algebra-strength sharpening slice | ||
| // introduces `type CommutativeSemiring<T>` to `dsl/std/algebra.dag`, | ||
| // change this declaration to | ||
| // `type Nat = CommutativeSemiring<Magnitude>` | ||
| // and update the structural ratchet | ||
| // `nat_resolves_to_semiring_over_magnitude` in | ||
| // `src/v3/compiler/tests/integration/m2_substrate_inhabitance_test.rs` | ||
| // to match the new template id. No consumer migration needed — | ||
| // `CommutativeSemiring<T>` extends `Semiring<T>` at the algebra layer; | ||
| // downstream callers see no signature change. | ||
| // | ||
| // The construction-chain progression in `docs/design-numeric-construction.md` | ||
| // sequences concept-layer introduction first (this slice + Slices 3+); | ||
| // algebra-strength sharpening is a parallel lane (see PR #1399 inbox | ||
| // discussion at #1130). | ||
| // | ||
| // CONSUMERS: none in this slice. Refinements `Nat<N>` (later slices, gated | ||
| // on T-V2-Retirement per design doc §"path (a) coordination") parameterize | ||
| // the namespace to bind concrete bit-width at grounding time. | ||
| // | ||
| // HARD BOUNDARIES: | ||
| // - Carrier is `Magnitude`, the canonical algebraic counting carrier. | ||
| // `Word64` / `Word128` (and `Byte`/`Word16`/`Word32`) at `dsl/std/bit.dag` | ||
| // remain **storage refinements** at the bit-/byte-record layer; they are | ||
| // not alternate `Nat`/`Magnitude` authorities. | ||
| // - No tokenizer / `LitInt` / literal-grammar changes. | ||
| // - No refinement syntax (`Nat<N>`, `where bits <= N`) — gated on | ||
| // T-V2-Retirement per design doc. | ||
| // - No migration of legacy `dsl/std/integer.dag` `Semiring<Word*>` / `OrderedRing<Word*>` | ||
| // chain — sequenced for design doc §6 cascade slice. | ||
|
|
||
| module std.nat | ||
|
|
||
| import std.algebra { Semiring } | ||
| import std.magnitude { Magnitude } | ||
|
|
||
| type Nat = Semiring<Magnitude> | ||
Large diffs are not rendered by default.
Oops, something went wrong.
4,341 changes: 2,171 additions & 2,170 deletions
4,341
src/v3/compiler/src/bootstrap_generated_without_parse_surface.rs
Large diffs are not rendered by default.
Oops, something went wrong.
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
Oops, something went wrong.
Oops, something went wrong.
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.
This comment was marked as resolved.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.