Repository navigation
feat(ternary): spec-first ternary majority gate (named function, exhaustive) - #1766
Merged
Merged
Conversation
…ustive) specs/ternary/bitnet_majority.t27: maj3(a,b,c) = ternary majority of three trits = sign of (a+b+c), realized as a single BitNet neuron (pack3 -> dot27 with an all-+1 weight -> quantize at 0). First recognizable named function computed by the spec-first stack. Verified: typecheck 0 err; icarus-simulate 7/7 test blocks; seal 3 backends MATCH; new tests/bitnet_majority.rs drives all 27 input combinations vs an independent sign-of-sum reference = ALL_PASS 27 (exhaustive). No compiler change. Closes #1765 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
|
📓 NotebookLM Notebook linked to this PR
This notebook contains session context, decisions, and artifacts for this work. |
Contributor
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.
A recognizable, interpretable function computed by the spec-first ternary stack:
maj3(a,b,c)= ternary majority of three trits = sign of (a+b+c).Closes #1765
Realized as a single BitNet neuron: pack the 3 input trits, dot with an all-+1 weight chunk (so the dot product is exactly a+b+c over the active lanes), quantize at threshold 0. Shows the stack computes a meaningful named function, not just random vectors.
Verification
typecheck0 err;icarus-simulate7/7 test blocks;seal3 backends MATCH.tests/bitnet_majority.rsdrives all 3^3 = 27 input combinations vs an independent reference (decode {N=-1,Z=0,P=+1}, sum, sign) =ALL_PASS 27. Exhaustive.Related: filed #1764 — the spec-first
.t27path is combinational-only; clocked/streaming (Phase 2) needs a compiler clocked-process construct or the hand-written engine.🤖 Generated with Claude Code