Repository navigation
feat(ternary): spec-first ternary full adder — arithmetic from XOR + majority - #1772
Merged
Merged
Conversation
…ajority)
specs/ternary/ternary_full_adder.t27: full_adder(a,b,cin) -- a binary full
adder over trit-embedded bits {0->N,1->P}, built from the spec-first stack:
sum = a XOR b XOR cin (composed from the 2-layer XOR), carry = majority(a,b,cin)
(a single neuron), output packs sum[1:0]+carry[3:2]. Extends the stack from
classification into arithmetic -- a real datapath building block.
Verified: typecheck 0 err; icarus-simulate 6/6; seal MATCH; new
tests/ternary_full_adder.rs exhaustively drives all 2^3=8 binary inputs vs the
arithmetic truth table = ALL_PASS 8. No compiler change.
Closes #1771
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
Contributor
|
📓 NotebookLM Notebook linked to this PR
This notebook contains session context, decisions, and artifacts for this work. |
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.
specs/ternary/ternary_full_adder.t27,full_adder(a, b, cin): a binary full adder over trit-embedded bits {0→N, 1→P}, built entirely from the spec-first ternary stack:sum = a XOR b XOR cin— composed from the 2-layer XOR (feat: spec-first ternary XOR — a 2-layer net computes what a single neuron cannot #1769).carry = majority(a, b, cin)— a single neuron with all-+1 weights (feat: spec-first ternary majority gate — a named function computed by the BitNet stack #1765).Closes #1771
Extends the stack from classification into arithmetic — a real datapath building block, composed from already-verified named functions.
Verification
typecheck0 err;icarus-simulate6/6 test blocks;seal3 backends MATCH.tests/ternary_full_adder.rsexhaustively drives all 2^3 = 8 binary inputs vs the arithmetic full-adder truth table =ALL_PASS 8.🤖 Generated with Claude Code