Repository navigation
Add specs/vsa/trinity_compat: the VSA contract the Trinity facade runs (S04 of trinity#988) - #3580
Merged
gHashTag merged 4 commits intoSep 12, 2026
Conversation
Closes gHashTag#3563 -- S01 of gHashTag/trinity#988. specs/trinity/project.t27 (module trinity_project) pins the consumer gHashTag/trinity at 976df517 and declares the seven profiles with headless as the initial one, the eight dispositions, the five evidence tags of docs/system/project.md, the dialect and build counts the inventory measured, the four dependency pins and the twelve work packages S01..S12. Fifty capability cards specs/trinity/capabilities/<id>.t27 give every shipped build target and every requested capability an owner, a disposition, a canonical spec and dialect, implementation and generated paths, a backend, the build.zig targets it owns, an acceptance command, an evidence status with its source and a work package. tools/trinity_manifest.py derives the inventory from a clean pinned checkout (inventory --trinity-root; a modified tracked file is refused) and holds the cards to it (check): 51 executables, 6 libraries, 73 tests and 68 steps are each owned by exactly one card, default-installed targets are headless and !ci_mode-guarded ones are not, every trinity: path is tracked, the website mirror is never canonical, DIALECT follows the extension of CANONICAL_SPEC, only executable/adapter/research cards claim a backend, no spec has two owners, measured names its command and source, every work package has a card. --self-check plants thirteen defects and requires each to be reported. The inventory and the derived report are committed under conformance/trinity/. specs/catalog/discovery.t27 is the canonical copy of the world-scan contract gHashTag/trinity#990 vendored under the site's mirror path; specs/OWNERS.md registers catalog/ and trinity/. Evidence is what a public CI log measured: zig build -Dci=true succeeded on ubuntu-latest at 79ffb034 (one data commit before the pin); the test step is piped through tee there and its exit code is not measured (gHashTag/trinity#616), so no card claims a passing test. Seals for the 52 files by t27c seal --save at 03f0faf; t27c typecheck reports 0 errors on each; published_figures test-blocks pin 12593 -> 12653 with the movement recorded next to the pin. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…d (S02) Closes gHashTag#3564 -- S02 of gHashTag/trinity#988. Stacked on gHashTag#3577 (S01). specs/trinity/compiler_matrix.t27 (module trinity_compiler_matrix) names the native compiler (t27c 0.2.0; NATIVE_REVISION is the last commit that changed bootstrap/, bff21b8), the WASM the site vendors (1cd2877, its own column, no runtime), the four backends with the command that emits each and what proves a runtime result on each, the four stages kept apart in every record, fourteen features of the Trinity headless profile with one fixture each under bootstrap/tests/fixtures/trinity_matrix/, five negatives with the latest stage at which each must be rejected, and an absent backend that must yield blocked. tools/trinity_compiler_matrix.py run carries every fixture through t27c typecheck and parse --json (annotation agreement, import resolution, declaration count), gen-c / gen / gen-rust / gen-verilog, cc, zig test, rustc --test, iverilog and t27c icarus-simulate, and writes conformance/trinity/compiler_matrix.json; check holds the record to the spec and the fixture hashes; --self-check proves the negatives are negatives and that a stale status, an accepted negative, a late rejection and a listed absent backend are each reported. Measured: 12 of 14 features execute on their backend; enums is blocked on C (the enum declares EVIDENCE_EMULATOR, the switch compares against EMULATOR) while it executes on Zig; ffi_boundary is blocked at declaration (a bodyless signature is a parse error, gHashTag#3472). The Rust backend emits declarations only for every fixture. The Zig backend (0.17.0-dev nightly, because 0.15.2 cannot link on the host) does not lower string equality, array constants, invariant blocks or the clocked form. All five negatives are rejected: the invalid annotation and the unresolved import by the tool at declaration (both compilers report typecheck.ok for them), the false assertion at runtime, the bodyless function and the dropped module by the parser. check_specs_generate registers the fixture directory as control fixtures; published_figures test-blocks pin 12653 -> 12659. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Closes gHashTag#3565 -- S03 of gHashTag/trinity#988. Stacked on gHashTag#3578 (S02). specs/trinity/build_graph.t27 (module trinity_build_graph) declares what the consumer's build is made of at 976df517: the Zig it requires and the one its CI measures with, the CI build and test commands (the test exit code does not reach the job, gHashTag/trinity#616), the build.zig options, the four build.zig.zon pins with how build.zig uses each, the submodule, the seven profiles with what is measured for each, the untracked outputs, fourteen tracked files a generator writes with their generators and inputs, the seven generator output locations, and the receipt policy of the bootstrap/fixture profile. tools/trinity_build_receipt.py graph derives conformance/trinity/ build_graph.json from the pinned tree: 44 named modules, 252 import edges resolved to 84 named modules, 152 package modules (149 to zig-hdc-vsa, 3 to golden-float) and 16 inline modules, 0 unresolved, the generated files and their inputs hashed at the pin. receipt --runs 2 writes bootstrap_receipt.json: compiler-source revision bff21b8, the t27c hash, the host, and every generated output of the 18 matrix fixtures x 4 backends hashed in two runs: 72 outputs, 0 differing. check recomputes offline that the compiler sources, Cargo.lock, the fixtures and a fresh generation match the receipt, and with --trinity-root judges drift in the consumer (hand edit, stale, unregistered): none at the pin. --self-check plants each defect. trinity_compiler_matrix.py names the compiler-source revision by bootstrap/src (the fixtures live under bootstrap/tests/); same revision, record and seal refreshed. published_figures test-blocks pin 12659 -> 12663. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…s (S04) specs/vsa/trinity_compat.t27 (module vsa_trinity_compat, KIND "vsa-compat") names the facade trinity:src/trinity.zig, the implementation owner it resolves to (gHashTag/zig-golden-float e7ce3288 src/vsa/core.zig through gHashTag/zig-hdc b73b2fa2) and, for each of the sixteen re-exported operations, the owner function, the canonical function of specs/vsa/vsa_core.t27, a finding and a verdict: 4 agree on every input, 6 agree on equal lengths only, 6 differ in kind (bind and unbind annihilate on a zero trit in the owner and keep it as an identity in the canonical spec; encodeSequence, probeSequence, randomVector, bundleN). The semantics the pinned consumer executes are the reference of the Trinity profile, stated as elementwise functions the C backend runs; the zero-identity bind and the additive TRI27 register bind are classified separately. Numeric representation declared: i8 trits, five per byte, 12000 packed / 59049 hybrid capacity, SIMD width 32, i32 dot accumulator, f64 similarities, no GoldenFloat on the facade, no allocation, no error. 10 tests, 5 invariants; All 10 tests passed on C. tools/trinity_vsa_compat.py: vectors writes conformance/vsa_trinity_compat.json from a Python statement of the owner semantics (149 vectors over 15 operations); run generates the spec to C and replays every vector through a driver composed of the spec's own functions (149 of 149 pass); check holds the record to the spec and the model; --self-check plants a wrong expectation, a zero-identity bind in the spec, drifted vectors, a stale replay and a recorded failure. Not measured: the owner's Zig itself (the package does not build with the Zig on this host); the spec records this in NOT_MEASURED. docs/now entry, specs/trinity/README.md section and rows, specs/OWNERS.md vsa/ row, seal .trinity/seals/vsa_vsa_trinity_compat.json, published_figures test-block pin 12663 -> 12673. Closes gHashTag#3566 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #3566 -- work package S04 of gHashTag/trinity#988: the VSA and numeric contract the Trinity facade actually runs. Stacked on #3579 (S03), #3578 (S02) and #3577 (S01): the diff shows all four until the earlier ones merge; S04 itself touches only
specs/vsa/,conformance/,tools/,docs/now/, the S01 README and OWNERS.What
specs/vsa/trinity_compat.t27(modulevsa_trinity_compat,KIND = "vsa-compat").trinity:src/trinity.zigre-exports sixteen VSA operations from the package the consumer pins -- gHashTag/zig-golden-floate7ce3288,src/vsa/core.zig, passed through gHashTag/zig-hdcb73b2fa2name by name -- whilespecs/vsa/vsa_core.t27describes the same names with other semantics. The spec names the facade and the owner and records, per export, the owner function (file:line), the canonical function (name:line), a finding and a verdict:permute,inversePermute,countNonZero,vectorNorm.bundle2,bundle3,cosineSimilarity,hammingDistance,hammingSimilarity,dotSimilarity.bindandunbind(the owner multiplies, so a zero trit annihilates;vsa_core.t27,ops.t27andcoptic_bindkeep the zero trit as an identity),encodeSequence(the owner adds permuted vectors with a carrying balanced-ternaryadd, not a bundle),probeSequence,randomVector(two different generators),bundleN(the owner takes the sign of the sum of all vectors; the canonical spec foldsbundle3(result, result, next)and readsvectors[2]for a count of two).The semantics the pinned consumer executes are selected as the reference of the Trinity profile and stated as elementwise functions the C backend runs, because the compiler does not lower array parameters (S02):
trit_bind,trit_bind_zero_identity,trit_sign,trit_bundle2,trit_bundle3,trit_differs,trit_nonzero,len_max,len_min,rotate_right,rotate_left,packed_bytes,pack_index,pack_slot,cosine_defined,tri27_bind. The zero-identity bind of the canonical specs and the additive TRI27 register bind ofsrc/tri27/emu/executor.zig(mod 19683, zero register as identity) are classified separately, each with its own function and tests. The numeric representation is declared: i8 trits, five to a byte, two capacities in one package (12000 packed inpacked_trit.zig, 59049 hybrid internary/hybrid.zig, the type the sixteen operations take), SIMD width 32, an i32 dot accumulator in the owner (i64 in the canonical spec; both hold, |dot| <= 59049), f64 similarities, no GoldenFloat format on the facade (0 references to gf16 intrinity.zig,sdk.zig,science.zig,vm.zig,jit.zig), no allocation and no error in the sixteen operations. Ten test blocks (the nine bind pairs, the four pairs where the variant differs, self-inverse on nonzero trits only, bundle ties, the length rules, the rotation law, packing arithmetic, the cosine precondition, the TRI27 cases) and five invariants.tools/trinity_vsa_compat.pyvectorswritesconformance/vsa_trinity_compat.jsonfrom a Python statement of the owner's semantics as read ate7ce3288: 149 vectors over 15 operations -- equal lengths, one SIMD chunk, a chunk plus a remainder, unequal lengths, all-zero and empty vectors, ties, every pair of trits once, the rotation identities (k = 0, k = len, k > len) and the inverse law, packing, the TRI27 fix-up. The pseudo-random trits come from the tool's own LCG, never from the owner's PRNG.rungenerates the spec to C witht27c gen-c, composes the elementwise functions into whole-vector operations in a C driver whose length rules are the spec's ownlen_max,len_minandrotate_*, replays every vector and records the verdict with the compiler, the C compiler, the host and the spec hash. Model and spec are two independent statements of one reading of the owner; a failing vector names a wrong reading, a wrong function or a wrong composition.checkholds the committed record to the spec and the model: drifted vectors, constants or operations, a missing operation, a replay of another spec text, a changed vector count and a recorded failure are findings; the facade tables must have one entry per export, every verdict must be one ofVERDICTSand open its finding, and the three counts must equal the verdicts.--self-checkplants a wrong expected trit (fails exactly its vector), a zero-identity bind in the spec (fails only bind-shaped vectors: 28 of 149, allbind,unbind,cosine_similarity,dot_similarity), drifted vectors, a stale replay and a recorded failure.Also:
docs/nowentry;specs/trinity/README.mdgains the S04 section and two rows;specs/OWNERS.mdnames the file undervsa/; seal.trinity/seals/vsa_vsa_trinity_compat.json;tools/published_figures.pytest-blocks pin 12663 -> 12673.Measured (2026-09-12)
t27c typecheck: 0 errors, 0 warnings;gen-c+cc -DT27_TEST_MAIN: All 10 tests passed.;gen,gen-rust,gen-verilogexit 0.NOT_MEASURED. A differential run against the owner remains the owner's own test suite.Verification
The red
test-ratcheton #3578/#3579 is pre-existing: the same 23 Rust tests (icarus_lowerable,lex_conform,parse_conform,tests_w458) fail on everyBootstrap Test Ratchetrun ofmastersince 2026-09-08 (e.g. run 34237060544 atf6a4a0fa, same "113 targets ran; 23 failing" summary); the S02 fixtures do not change the set.What this does not claim
vsa_core.t27is wrong: it is a different contract, and this spec records which one the consumer runs. Reconciling the two, or moving the consumer to the canonical semantics, is a decision for the owners, not a side effect of S04.operations), the elementwise functions live in the spec.bundleNfor more than three vectors beyond whatsrc/vsa/core.zig:324says, or about the sequence helpers' numeric behaviour: they are recorded as differing in kind and carry no vectors.Do not merge without the owner's approval.
🤖 Generated with Claude Code