Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
2592b65
WIP: tidy-tern-769
briansrls Apr 30, 2026
3453a17
chore: apply cargo fmt
briansrls Apr 30, 2026
c36e956
WIP: tidy-tern-769
briansrls Apr 30, 2026
8d10039
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls Apr 30, 2026
f008b6f
WIP: tidy-tern-769
briansrls Apr 30, 2026
dce2fc0
chore: apply cargo fmt
briansrls Apr 30, 2026
0f2d0d0
WIP: tidy-tern-769
briansrls Apr 30, 2026
75772bd
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls Apr 30, 2026
37e9b38
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 1, 2026
16207e9
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 1, 2026
962d973
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 1, 2026
46e92f0
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 1, 2026
9fd943e
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 1, 2026
ed0f59c
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 1, 2026
361e128
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 1, 2026
c806aaa
WIP: tidy-tern-769
briansrls May 1, 2026
64edc56
feat(std): add Magnitude opaque carrier (T-Numeric-Construction Slice 1)
briansrls May 1, 2026
6b756a9
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 1, 2026
874e321
WIP: tidy-tern-769
briansrls May 1, 2026
08bb95a
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 1, 2026
d279af0
WIP: tidy-tern-769
briansrls May 1, 2026
07cb719
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 1, 2026
6440ca0
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 1, 2026
c4a56fa
WIP: tidy-tern-769
briansrls May 1, 2026
83ac68d
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 1, 2026
09f0af7
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 1, 2026
00d4c7f
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 1, 2026
dd23d33
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 1, 2026
5f533e0
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 1, 2026
63d7075
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 1, 2026
5834de1
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 1, 2026
68ab971
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 1, 2026
c1cd614
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 1, 2026
3cadf1d
WIP: tidy-tern-769
briansrls May 1, 2026
0dfa004
feat(std): T-Numeric-Construction Slice 2 — Nat = Semiring<Magnitude>
briansrls May 1, 2026
0ec0ace
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 1, 2026
1a14d82
fix(std/nat): document tracked-scaffold dissolution trigger to Commut…
briansrls May 1, 2026
8420693
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 1, 2026
a2d5d7c
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 1, 2026
7d20a5f
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 1, 2026
ab1e578
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 1, 2026
b2d425e
WIP: tidy-tern-769
briansrls May 1, 2026
c3240ff
WIP: tidy-tern-769
briansrls May 1, 2026
9f1af86
WIP: tidy-tern-769
briansrls May 1, 2026
fab0ccf
WIP: tidy-tern-769
briansrls May 1, 2026
001890d
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 1, 2026
37cc331
chore: apply cargo fmt
briansrls May 1, 2026
7e5bdc5
revert(std): drop Int = AbelianGroup<Nat> alias pivot; add GroupCompl…
briansrls May 1, 2026
e02ed6b
fix(test): revert stale parse_corpus_manifest row for integer.dag
briansrls May 1, 2026
ca602f7
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 1, 2026
fac7b39
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 1, 2026
64d46d2
WIP: tidy-tern-769
briansrls May 1, 2026
e49ce60
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 1, 2026
6be7055
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 1, 2026
46e636c
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 1, 2026
4cdc0aa
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 1, 2026
5d1063b
WIP: tidy-tern-769
briansrls May 1, 2026
6afe657
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 1, 2026
dc52252
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 1, 2026
b85c1b0
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 1, 2026
4ba0341
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 1, 2026
8bbdc3b
WIP: tidy-tern-769
briansrls May 1, 2026
041a006
WIP: tidy-tern-769
briansrls May 1, 2026
f65b4de
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 1, 2026
ded3991
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 1, 2026
50a406b
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 1, 2026
e978adf
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 1, 2026
478195d
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 1, 2026
84a8cbe
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 1, 2026
3e42d80
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 1, 2026
666ead8
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 1, 2026
4816f1e
WIP: tidy-tern-769
briansrls May 1, 2026
9c53d06
feat(std): GroupCompletion<M> opaque-atom substrate-introduction
briansrls May 1, 2026
91e9873
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 1, 2026
715875d
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 1, 2026
ccd59ff
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 1, 2026
3fbaacd
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 2, 2026
790d689
feat(std): T-Numeric-Construction Slice 3 — Int = AbelianGroup<GroupC…
briansrls May 2, 2026
8fc67a6
chore: apply cargo fmt
briansrls May 2, 2026
e1a06b5
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 2, 2026
c80e9eb
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 2, 2026
973049b
fix(test): pin transform_callable_unsupported_in_e3_slice to Bool not…
briansrls May 2, 2026
ad2854f
chore: apply cargo fmt
briansrls May 2, 2026
b65b6b8
WIP: tidy-tern-769
briansrls May 2, 2026
6027dfc
Merge remote-tracking branch 'origin/main' into session/tidy-tern-769
briansrls May 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 56 additions & 18 deletions dsl/std/integer.dag
Original file line number Diff line number Diff line change
@@ -1,31 +1,50 @@
// std/integer.dag -- Integer types as carrier + algebra witness.
//
// MODELING NOTE: A value of type Int is NOT an OrderedRing record.
// Int is a CARRIER (Word64) with EVIDENCE that it inhabits OrderedRing.
// The algebra record is the witness — it tells the compiler what
// operations are valid on Int values. Values are Word64; operations
// come from the ring structure.
// MODELING NOTE: T-Numeric-Construction Slice 3 pivots the default `Int`
// alias from the legacy 64-bit storage carrier to the honest construction-
// chain form. Authority chain:
//
// Current representation: Int = OrderedRing<Word64>
// This conflates carrier with witness (the reviewer correctly noted
// this). The end-state model separates them:
// - `docs/design-numeric-construction.md` §3 (construction-chain layer 3).
// - `docs/audit/t-numeric-construction-group-completion-6q.md` (Q6
// single-authority resolution: `type Int = AbelianGroup<GroupCompletion<Nat>>`,
// not the rejected compact form `type Int = GroupCompletion<Nat>`).
// - GroupCompletion<M> substrate-introduction (#1448, merged).
// - Director ratifications on inbox #1288 (#4360232423 substrate-split,
// #4362239705 Slice 3 alias-pivot dispatch).
//
// type Int64 = Carrier<Word64> with OrderedRing
// -- or --
// type Int64 { carrier: Word64, algebra: OrderedRing<Word64> }
// Construction-chain progression:
//
// Until the language supports trait/witness syntax, the direct alias
// is the honest intermediate. The compiler's structural field lookup
// works the same either way — it finds "add" on the resolved type.
// Magnitude → Nat = Semiring<Magnitude> → Int = AbelianGroup<GroupCompletion<Nat>> → ...
//
// Signed/unsigned distinction comes from the algebra:
// `GroupCompletion<Nat>` is the **derived carrier** (opaque atom denoting
// the abelian-group carrier obtained from Nat via the Grothendieck
// construction). `AbelianGroup<T>` is the standard algebra witness over
// that carrier — `T = GroupCompletion<Nat>` types `inverse: fn(GroupCompletion<Nat>) -> GroupCompletion<Nat>`,
// which is honest by construction (every element of the group-completion
// carrier has an additive inverse).
//
// The fixed-width rows (`Int8`..`Int128`, `UInt8`..`UInt128`) stay on
// `OrderedRing<Word*>` / `Semiring<Word*>`; only this default alias moves.
// Slice §6 (cascade) migrates downstream consumers off `OrderedRing<Word64>`
// for the abstract `Int` algebra. Until then, code that explicitly names
// `Int8`/`Int64`/etc. continues to inhabit `OrderedRing<Word*>`.
//
// LEGACY MODELING NOTE (Int8..Int128 storage rows): A value of type Int8
// is NOT an OrderedRing record. Int8 is a CARRIER (Byte) with EVIDENCE
// that it inhabits OrderedRing. The algebra record is the witness — it
// tells the compiler what operations are valid on Int8 values. Values are
// Byte; operations come from the ring structure. The fixed-width rows
// stay shape-conflated until v3 supports trait/witness syntax separation.
//
// Signed/unsigned distinction comes from the algebra (legacy fixed-width rows):
// OrderedRing has negate (signed arithmetic — additive inverse)
// Semiring has no negate (unsigned — only add and mul)

module std.integer

import std.algebra { OrderedRing, Semiring }
import std.algebra { OrderedRing, Semiring, AbelianGroup, GroupCompletion }
import std.bit { Byte, Word16, Word32, Word64, Word128 }
import std.nat { Nat }

// Signed integers: ordered rings (add + negate + mul + compare)
type Int8 = OrderedRing<Byte>
Expand All @@ -41,8 +60,27 @@ type UInt32 = Semiring<Word32>
type UInt64 = Semiring<Word64>
type UInt128 = Semiring<Word128>

// Default aliases
type Int = Int64
// Default aliases.
//
// T-Numeric-Construction Slice 3 alias-pivot.
//
// `Int` is the abstract integer algebra: an `AbelianGroup` over the
// derived `GroupCompletion<Nat>` carrier. `GroupCompletion<Nat>` (from
// `std.algebra`) is the opaque atom denoting "the abelian-group carrier
// derived from Nat via the Grothendieck construction"; `AbelianGroup<T>`
// over that carrier is the standard algebra witness. This is the canonical
// Q6 single-authority form per the audit at
// `docs/audit/t-numeric-construction-group-completion-6q.md`; the compact
// alternative `type Int = GroupCompletion<Nat>` was explicitly rejected.
//
// The fixed-width storage rows above (`Int8`..`Int128`) stay on
// `OrderedRing<Word*>`; only this default alias is the construction-chain
// layer-3 carrier. Slice §6 (cascade) migrates downstream consumers off
// `OrderedRing<Word*>` for the abstract `Int` algebra path.
//
// `UInt = UInt64` remains the legacy default alias until the cascade slice;
// per design doc `UInt IS Nat`, but per-row migration is §6's job.
type Int = AbelianGroup<GroupCompletion<Nat>>
type UInt = UInt64

// ─── Diagnostic enumeration order (Modeling problem 4; slice 2) ─────────────
Expand Down
3,955 changes: 1,978 additions & 1,977 deletions src/v3/compiler/src/bootstrap_generated.rs

Large diffs are not rendered by default.

3,789 changes: 1,895 additions & 1,894 deletions src/v3/compiler/src/bootstrap_generated_without_parse_surface.rs

Large diffs are not rendered by default.

Loading
Loading