Skip to content

feat(ring-2): type declarations → Zig codegen [SEED-2] - #10

Merged
gHashTag merged 1 commit into
masterfrom
ring/2-type-decl-gen
Apr 4, 2026
Merged

gHashTag merged 1 commit into
masterfrom
ring/2-type-decl-gen

Conversation

@gHashTag

@gHashTag gHashTag commented Apr 4, 2026

Copy link
Copy Markdown
Owner

Closes #5

Summary

  • Enum codegen: Variant values now emitted correctly (neg = -1, zero = 0, pos = 1)
  • Struct codegen: Fields parsed from both inline (pub const X = struct { ... }) and standalone (pub struct X { ... }) declarations, emitted with proper types
  • Array type aliases: Handles [EXPR]Type patterns (e.g. pub const TernaryWord = [WORD_BYTES]u8;)
  • Function stubs: Empty fn bodies now contain @compileError("not yet implemented");
  • Header: Includes module name and phi signature (phi^2 + 1/phi^2 = 3 | TRINITY)

Test Results

  • t27c gen tests/ring0_trivial.t27 → 5 pub const declarations ✅
  • t27c gen specs/base/types.t27 → 15 consts + 1 enum (Trit) + 1 struct (UnpackResult) + 35 fn stubs ✅
  • All 29 .t27 files parse and generate without errors ✅

Zig codegen for type declarations. Ghuloum step 3.

phi^2 + 1/phi^2 = 3 | TRINITY

t27c gen now outputs valid Zig for const, enum, struct declarations:
- Enum variant values emitted correctly (e.g. neg = -1, zero = 0, pos = 1)
- Struct fields parsed and generated with proper types
- Array type aliases handled (e.g. [WORD_BYTES]u8)
- Function stubs include @CompileError("not yet implemented")
- Header includes module name and phi signature
- All 29 .t27 files parse and generate without errors

Closes #5
@gHashTag
gHashTag merged commit 7b3c946 into master Apr 4, 2026
1 check passed
@gHashTag
gHashTag deleted the ring/2-type-decl-gen branch April 4, 2026 09:58
gHashTag added a commit that referenced this pull request May 15, 2026
…d, Lever #10)

Closes #658
Refs trinity-fpga#130

Wave-36 L-DPC33 Adaptive Voltage Stacking — Lever #10.

Changes (purely additive, R18 LAYER-FROZEN):
- coq/IGLA/RMarker.v:
  * holo_op extended: +OP_VOLT_STACK (TRI-27 ISA 0xE4)
  * rtl_uses_star: 10 arms (all false)
  * sacred_alphabet: 10 elements (added OP_LUT_NPU + OP_VOLT_STACK)
  * +11 new Qed including Theorem volt_stack_safe
- trios-coq/IGLA/VoltStack.v (NEW, 301 lines, 25 lemmas):
  * Theorem volt_stack_safe_chain (depth-7 chain)
  * 3-tier voltage monotonicity (Vt_NearRet 550mV < Vt_Cruise 750mV < Vt_Active 1000mV)
  * 48-island count invariant (3 * 16 = 48)
  * 8 ns wake-up latency within 50 ns layer-switch budget
  * W-105-A leakage falsifier encoded (>=90 permille floor)
- trios-coq/_CoqProject + citation_map.json updated

Compliance:
  R3:  36 new Qed total (RMarker.v +11, VoltStack.v +25)
  R7:  W-105-A pre-reg encoded as volt_stack_passes_w105a
  R14: citation_map.json registers all 25 VoltStack.v lemmas + sibling links
  R15: sacred-synth-gate chain 0xDE..0xE4
  R18: LAYER-FROZEN purely additive

Local compile: coqc PASS (0 admitted, 0 errors).

phi^2 + phi^-2 = 3 . DOI 10.5281/zenodo.19227877

Signed-off-by: Vasilev Dmitrii <admin@t27.ai>
gHashTag added a commit that referenced this pull request May 15, 2026
…d, Lever #10)

Closes #658
Refs trinity-fpga#130

Wave-36 L-DPC33 Adaptive Voltage Stacking — Lever #10.

Changes (purely additive, R18 LAYER-FROZEN):
- coq/IGLA/RMarker.v:
  * holo_op extended: +OP_VOLT_STACK (TRI-27 ISA 0xE4)
  * rtl_uses_star: 10 arms (all false)
  * sacred_alphabet: 10 elements (added OP_LUT_NPU + OP_VOLT_STACK)
  * +11 new Qed including Theorem volt_stack_safe
- trios-coq/IGLA/VoltStack.v (NEW, 301 lines, 25 lemmas):
  * Theorem volt_stack_safe_chain (depth-7 chain)
  * 3-tier voltage monotonicity (Vt_NearRet 550mV < Vt_Cruise 750mV < Vt_Active 1000mV)
  * 48-island count invariant (3 * 16 = 48)
  * 8 ns wake-up latency within 50 ns layer-switch budget
  * W-105-A leakage falsifier encoded (>=90 permille floor)
- trios-coq/_CoqProject + citation_map.json updated

Compliance:
  R3:  36 new Qed total (RMarker.v +11, VoltStack.v +25)
  R7:  W-105-A pre-reg encoded as volt_stack_passes_w105a
  R14: citation_map.json registers all 25 VoltStack.v lemmas + sibling links
  R15: sacred-synth-gate chain 0xDE..0xE4
  R18: LAYER-FROZEN purely additive

Local compile: coqc PASS (0 admitted, 0 errors).

phi^2 + phi^-2 = 3 . DOI 10.5281/zenodo.19227877

Signed-off-by: Vasilev Dmitrii <admin@t27.ai>
gHashTag added a commit that referenced this pull request May 22, 2026
…se cognitive loop) (Closes #737) (#738)

- ring-098-rust: bounded internal World Model mirroring specs/brain/unified_state.t27 + specs/ml/rl/dqn.t27 + specs/brain/cognitive_loop.t27 byte-for-byte

- 779 LOC, 29 tests, all green on Rust 1.83.0 (zero bugfix cycles)

- Cross-kernel anchor #10: world_model_phi_identity routes phi^2 + 1/phi^2 = 3 through integer projection + pow_u64 witness + PHI_SQ + PHI_INV_SQ == TRINITY mass-conservation

- LOC correction: claimed 920 -> actual 779 (R5-HONEST)

Closes #737

Co-authored-by: Trinity Agent <agent@trinity-s3ai.local>
gHashTag added a commit that referenced this pull request Jun 1, 2026
feat(ring-2): type declarations → Zig codegen [SEED-2]
gHashTag added a commit that referenced this pull request Jun 1, 2026
…se cognitive loop) (Closes #737) (#738)

- ring-098-rust: bounded internal World Model mirroring specs/brain/unified_state.t27 + specs/ml/rl/dqn.t27 + specs/brain/cognitive_loop.t27 byte-for-byte

- 779 LOC, 29 tests, all green on Rust 1.83.0 (zero bugfix cycles)

- Cross-kernel anchor #10: world_model_phi_identity routes phi^2 + 1/phi^2 = 3 through integer projection + pow_u64 witness + PHI_SQ + PHI_INV_SQ == TRINITY mass-conservation

- LOC correction: claimed 920 -> actual 779 (R5-HONEST)

Closes #737

Co-authored-by: Trinity Agent <agent@trinity-s3ai.local>
gHashTag added a commit that referenced this pull request Jun 1, 2026
…se cognitive loop) (Closes #737) (#738)

- ring-098-rust: bounded internal World Model mirroring specs/brain/unified_state.t27 + specs/ml/rl/dqn.t27 + specs/brain/cognitive_loop.t27 byte-for-byte

- 779 LOC, 29 tests, all green on Rust 1.83.0 (zero bugfix cycles)

- Cross-kernel anchor #10: world_model_phi_identity routes phi^2 + 1/phi^2 = 3 through integer projection + pow_u64 witness + PHI_SQ + PHI_INV_SQ == TRINITY mass-conservation

- LOC correction: claimed 920 -> actual 779 (R5-HONEST)

Closes #737

Co-authored-by: Trinity Agent <agent@trinity-s3ai.local>
gHashTag added a commit that referenced this pull request Aug 1, 2026
…out (#1576)

* fix(conformance): make the pack generator runnable from a clean checkout

gen_all_formats.py read its catalog from a hardcoded /tmp/catalog_lines.txt that
was never committed, so on a fresh clone it raised FileNotFoundError before
producing anything: the 83-pack corpus could be read but not regenerated.

The catalog was never actually missing. specs/numeric/formats_catalog.t27 carries
all 83 rows as trailing `// CATALOG: id=... ` comments -- the same lines
catalog-count-gate.yml counts for the 83-format invariant, already in the format
parse_catalog expects. The /tmp file was a second, unversioned copy of data the
repository holds. The generator now reads the SSOT, and parse_catalog accepts the
comment prefix while still taking a bare `id=` line.

Two problems surfaced while fixing that.

Re-running the generator silently reverted the 2026-07-05 promotions. The
SELFCONSISTENT branch hardcoded kind bitexact_selfconsistent with the comment
"NOT promoted to bitexact (no independent second witness)" -- true when written,
but the six wide rungs since acquired independent second witnesses and were
promoted in the pack files. A regeneration would have rewritten the index back to
69/6/8, undoing an honesty-rule-#10 promotion the packs themselves record. The
tier now derives from the pack, which is the artefact of record for its own
status, so a future promotion flows into the index by itself. The hand-written
promotion rationales are kept verbatim in a PROMOTION_SOURCE registry rather than
flattened to a generic string.

The index also exposed no witness information: a consumer of
INDEX_all_formats.json could not tell which packs carry a witness record without
opening all 83 files. Each entry now carries a witnesses count, with a top-level
witnessed_packs.

verify_regeneration.py is added as the falsifiable half: it regenerates and
compares against the digests recorded at HEAD.

  packs compared: 83
    digests unchanged : 83
    digests changed   : 0
    tier changed      : 0

Index changes are strictly additive -- 0 entry fields changed or removed. Both
gates pass: wp18_selftest_gate.py all PASS, wp18_conformance_gate.py CLEAN with
no failures.

Closes #1575

* docs(now): record #1576 in the coordination anchor

now-sync-gate requires every PR to master to update docs/NOW.md.
This PR predates my knowing that; the entry describes what it
lands and states its honesty limits, in the file's existing shape.

---------

Co-authored-by: gHashTag <admin@t27.ai>
gHashTag added a commit that referenced this pull request Aug 1, 2026
…marises (#1578)

* ci(conformance): gate INDEX_all_formats.json against the packs it summarises

The index is what consumers read and what Paper B recomputes its coverage from,
and nothing checked that it still agreed with the packs underneath it.

That gap already cost a regression. gen_all_formats.py hardcoded the tier for the
six wide GoldenFloat rungs -- correct when written, but the rungs later acquired
independent second witnesses and were promoted in the pack files. Re-running the
generator rewrote the index from 75/0/8 back to 69/6/8, silently reverting an
honesty-rule-#10 promotion the packs themselves record. #1576 fixes that instance;
this closes the class.

Checks: entry names a file that exists; recorded sha256 matches disk; kind agrees
with the pack's own bitexact + witnesses state; index witness count matches the
pack; header totals match the entries; no pack file missing from the index.

Two things are deliberately NOT failures. A bitexact pack with an empty
witnesses[] is the normal case -- the ~60 uncontested packs were bit-precise from
the start, and witnesses[] records the promotions that were CONTESTED; demanding a
witness everywhere would fail the whole corpus and misstate rule #10. And five
hand-curated packs carry no bitexact key at all while the index labels them
bitexact: an absent flag is unknown, not false, so reading silence as denial would
make the gate assert something the pack never said. Both are reported as notes.

Follows the wp18_selftest_gate.py convention -- --selftest plants a mutant per
check and fails if any survives, so the gate proves itself falsifiable before CI
trusts it. All six mutants are killed. Replayed against the live corpus by
demoting the six rungs exactly as the old generator would, the gate fails with
exit 1 and names each rung with its witness count. Clean on current master, so it
stands alone and does not depend on #1576.

Closes #1577

* docs(now): record #1578 in the coordination anchor

now-sync-gate requires every PR to master to update docs/NOW.md.
This PR predates my knowing that; the entry describes what it
lands and states its honesty limits, in the file's existing shape.

---------

Co-authored-by: gHashTag <admin@t27.ai>
gHashTag added a commit that referenced this pull request Aug 1, 2026
…ry (#1582)

* fix(witness): resolve the wide-rung pack defaults inside the repository

The six wide-rung witness decode references defaulted to an absolute path under
/home/user/workspace when run with no argument, so the file a witnesses[] entry
names failed on every machine but the one it was written on:

  FileNotFoundError: '/home/user/workspace/gf128_work/gf128_pack.json'

That matters more than an ordinary broken default. These are the artifacts honesty
rule #10 points a sceptical reader at, and running the named file is the first
thing anyone checking the corpus does.

The witnesses themselves are sound. Passing the in-repo pack explicitly already
gave the claimed result -- gf128 15/15 exact, abs_error=0 -- so nothing about the
decoding changes here, only where the default input is looked up. The
cross_check_representative.py scripts were never affected, since they import these
modules rather than invoking __main__.

The default now resolves relative to the script's own location. All six run
standalone afterwards and print their own verdict at abs_error=0, gf48 through
gf1024.

Found by extending the pass-49 "just run everything" sweep to tools/ and scripts/,
after triaging 300 files by side effect so only the 79 with no write, exec, network
or git call were executed unattended.

Closes #1581

* docs(now): record #1582 in the coordination anchor

now-sync-gate requires every PR to master to update docs/NOW.md.
This PR predates my knowing that; the entry describes what it
lands and states its honesty limits, in the file's existing shape.

---------

Co-authored-by: gHashTag <admin@t27.ai>
gHashTag added a commit that referenced this pull request Aug 7, 2026
… (Refs #1764) (#1905)

Pipelined both shared cores latency-1 with a register INSIDE the combinational
cloud (GftSmul_p2b mid-RNE, GftSadd_p2 mid-cascade), each bit-exact to its
combinational core over 40-60k random operands; integrated trainer bit-exact
in sim, fmax 32 MHz. On the AX7203, 0/4 seeds trained stably (seeds 2,3
near-model at ep0 then collapsed by ep20; 1,4 glitched from ep0) -- same as
baseline. So registering the core datapath (endpoints in cycle 97, mid-cloud
now) does NOT fix the fault: the hazard is not in the GftSmul/GftSadd
datapath. Closes the pipeline-the-cores branch (cycles 94-99). Redirect to the
rf-write/control path (di decode, pc/settle/cen counters) and global placement
effects. Added ruled-out #10.

Refs #1764

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
gHashTag added a commit that referenced this pull request Aug 8, 2026
…10) (Refs #1764)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
gHashTag added a commit that referenced this pull request Aug 8, 2026
…ons exhausted (Refs #1764) (#1907)

* docs: MMCM places but is dead on silicon -> open-flow structural options exhausted (Refs #1764)

Tested the last structural lever: regenerate the 200 MHz clock through the
MMCM/CMT tree to probe the global clock-skew hypothesis. MMCME2_BASE places in
nextpnr and the fasm builds, but the flashed bitstream is dead on the AX7203
(no UART response, 4 seeds, with/without BUFG on the MMCM output) -- the open
flow does not emit MMCM config bits, so it never locks. MMCM is placement-only
on openXC7, not functional. So the open-toolchain structural options are
exhausted (11 local fixes + MMCM); only commercial P&R can close timing or
give a working MMCM. Seed-search is final on the open flow. Added ruled-out
#12.

Refs #1764

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* docs: reconcile stale 'pipeline is the fix' bullet with the disproof (#10) (Refs #1764)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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.

[SEED-2] Ring-2: Type declarations — enum/struct gen to Zig

1 participant