Skip to content

feat(core): P0 Sprint 1 - Zig to .t27 specs (6 files)#311

Merged
gHashTag merged 35 commits intomasterfrom
feat/p0-core-rewrite-sprint1
Apr 7, 2026
Merged

feat(core): P0 Sprint 1 - Zig to .t27 specs (6 files)#311
gHashTag merged 35 commits intomasterfrom
feat/p0-core-rewrite-sprint1

Conversation

@gHashTag
Copy link
Copy Markdown
Owner

@gHashTag gHashTag commented Apr 7, 2026

Summary

Convert 6 Zig source files from trinity-source/src/ to .t27 specs as part of P0 Core Rewrite Sprint 1.

Files Converted

  1. specs/ternary/bigint.t27 - Balanced ternary arbitrary precision arithmetic

    • TVCBigInt with 256 trit capacity
    • SIMD-optimized operations (Vec32i8, Vec32i16)
    • Karatsuba multiplication O(n^1.585)
    • Newton-Raphson division
    • 32 tests, 15 invariants, 11 benchmarks
  2. specs/jit/jit.t27 - JIT compiler for VSA operations

    • x86-64 instruction encoding
    • mmap for executable memory
    • Code generation: bind, bundle, dot_product
    • JitCache for dimension-based caching
    • 15 tests, 10 invariants, 8 benchmarks
  3. specs/vsa/vsa_core.t27 - Core VSA operations

    • bind/unbind (associative memory)
    • bundle2/bundle3 (superposition)
    • permute (position encoding)
    • similarity functions (cosine, hamming, dot)
    • 22 tests, 13 invariants, 12 benchmarks
  4. specs/ternary/hybrid_bigint.t27 - Memory/speed trade-off

    • Packed storage (5 trits/byte) + unpacked computation
    • SIMD-accelerated operations
    • Lazy unpacking, dirty tracking
    • 30 tests, 15 invariants, 14 benchmarks
  5. specs/neural/forward_pass.t27 - VSA-based neural network

    • Multi-head attention (3 heads)
    • Resonator training
    • Direct role averaging
    • Autoregressive generation
    • 30 tests, 15 invariants, 14 benchmarks
  6. specs/numeric/format_conversion.t27 - Format conversions

    • GF16 (6:9 format), FP16, BF16, Ternary
    • CNN operations (conv2d, max_pool2d)
    • Quantization utilities
    • 22 tests, 14 invariants, 14 benchmarks

Test Plan

  • All 6 specs parsed successfully with t27c
  • Each spec contains 8+ tests
  • Each spec contains invariants section
  • Each spec contains benchmarks section
  • All specs use GF16 for numeric scalars

Breaking Changes

None - this adds new spec files without modifying existing code.

Checklist

  • Author name updated to "Dmitrii Vasilev"
  • SPDX-License-Identifier: Apache-2.0 included
  • All specs follow patterns from specs/ar/ternary_logic.t27
  • t27c parse successful for all files

🤖 Generated with Claude Code

Dmitrii Vasilev and others added 30 commits April 7, 2026 11:12
…oses #222)

Add brain summaries pipeline for Queen Lotus orchestration:

- specs/queen/brain_summaries.t27: Spec for episode summarization
  - 6 tests for aggregation functions
  - 4 invariants for consistency checks
  - 2 benchmarks for performance
- conformance/BRAIN_SUMMARIES_SCHEMA.json: JSON schema for summaries
- .trinity/queen-brain/summaries/: Directory structure
- .github/workflows/schema-validation.yml: Add brain summaries validation
- .trinity/seals/BrainSummaries.json: Seal file

Phase 4 progress: 50% (7/9 steps complete)

φ² + 1/φ² = 3 | TRINITY

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add similarity search operations for VSA trit vectors:

- specs/vsa/similarity_search.t27: Similarity search spec
  - Cosine similarity [-1, 1]
  - Hamming similarity [0, 1]
  - Jaccard index [0, 1]
  - Top-K search with multiple metrics
  - HNSW-like approximate search structure
  - 8 tests, 5 invariants, 2 benchmarks

- .trinity/seals/VSASimilaritySearch.json: Seal file

Spec growth: 81 → 82 specs (target: 100 by Ring 070)

φ² + 1/φ² = 3 | TRINITY

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Phase 4 progress: 50% → 60%
- Spec count: 81 → 82
- Add Rings 061 (brain summaries) and 062 (VSA similarity search) to completed rings
- Update queen health to 0.95
- Update revision note

φ² + 1/φ² = 3 | TRINITY
Add fundamental ternary logic gates:

- specs/isa/ternary_gates.t27: Ternary logic gates spec
  - NOT gate (ternary inverter)
  - MIN gate (acts as AND)
  - MAX gate (acts as OR)
  - Consensus, majority, any, all gates
  - 13 tests, 7 invariants, 4 benchmarks

- .trinity/seals/TernaryGates.json: Seal file

Spec growth: 82 → 83 specs (target: 100 by Ring 070)

φ² + 1/φ² = 3 | TRINITY

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Phase 4 progress: 60% → 70%
- Spec count: 82 → 83
- Add Ring 063 to completed rings
- Update revision note

φ² + 1/φ² = 3 | TRINITY
…loses #228)

Add balanced ternary arithmetic operations:

- specs/isa/ternary_arithmetic.t27: Ternary arithmetic spec
  - Single trit addition with carry propagation
  - Single trit subtraction with borrow
  - Single trit and word-level operations
  - Ternary to decimal and decimal to ternary conversion
  - Comparison operations for ternary words
  - 8 tests, 6 invariants, 4 benchmarks

- .trinity/seals/TernaryArithmetic.json: Seal file

Spec growth: 83 → 84 specs (target: 100 by Ring 070)

φ² + 1/φ² = 3 | TRINITY

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…oses #230)

Add ternary encoding schemes:

- specs/base/ternary_encoding.t27: Ternary encoding spec
  - Bit to trit and trit to bit conversion
  - Nibble to 3 trits mapping
  - Byte to trit array conversion
  - Balanced to unipolar ternary conversion
  - String/character encoding
  - 9 tests, 5 invariants, 3 benchmarks

- .trinity/seals/TernaryEncoding.json: Seal file

Spec growth: 84 → 85 specs (target: 100 by Ring 070)

φ² + 1/φ² = 3 | TRINITY

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Phase 4 progress: 70% → 80%
- Spec count: 83 → 85
- Add Rings 064 (ternary arithmetic), 065 (ternary encoding) to completed rings
- Update queen health to 0.98
- Update revision note with ISA layer progress

φ² + 1/φ² = 3 | TRINITY
Add ternary memory operations:

- specs/base/ternary_memory.t27: Ternary memory spec
  - TritCell with metadata (state, access count, timestamp)
  - TernaryWord (27 trits) with checksum
  - TernaryMemoryBank for allocation and access
  - Locking and dirty state tracking
  - 8 tests, 6 invariants, 4 benchmarks

- .trinity/seals/TernaryMemory.json: Seal file

Spec growth: 85 → 86 specs (target: 100 by Ring 070)

φ² + 1/φ² = 3 | TRINITY

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Phase 4 progress: 80% → 90%
- Spec count: 85 → 86
- Add Ring 066 (ternary memory) to completed rings
- Update queen health to 1.0 (excellent)
- Update revision note with base layer progress

φ² + 1/φ² = 3 | TRINITY
Add ternary shift and rotate operations:

- specs/isa/ternary_shift.t27: Ternary shift spec
  - Left/right shift with zero fill
  - Left/right rotate (circular shift)
  - Arithmetic shift right (sign-preserving)
  - Trit extraction and insertion
  - 9 tests, 5 invariants, 4 benchmarks

- .trinity/seals/TernaryShift.json: Seal file

Spec growth: 86 → 87 specs (target: 100 by Ring 070)

φ² + 1/φ² = 3 | TRINITY

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add ternary bitwise operations:

- specs/isa/ternary_bitwise.t27: Ternary bitwise spec
  - Tritwise AND, OR, XOR, NOT operations
  - NAND, NOR, XNOR operations
  - Mask and merge operations
  - 9 tests, 5 invariants, 5 benchmarks

- .trinity/seals/TernaryBitwise.json: Seal file

Spec growth: 87 → 88 specs (target: 100 by Ring 070)

φ² + 1/φ² = 3 | TRINITY

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Rings 071-082 added to completed rings
- Spec count: 90 -> 100 (MILESTONE)
- Phase 4 progress: 93% -> 99%
- Crown automation ring: 070 -> 082

phi^2 + 1/phi^2 = 3 | TRINITY
TA1 Conformance (7/7 requirements compliant):
- ternary_logic.t27 (Ring 18) - K3 semantics
- proof_trace.t27 (Ring 19) - Bounded traces <=10 steps
- datalog_engine.t27 (Ring 20) - Forward-chaining O(n)
- restraint.t27 (Ring 21) - Bounded rationality
- explainability.t27 (Ring 22) - XAI <=10 steps
- asp_solver.t27 (Ring 23) - ASP with NAF
- composition.t27 (Ring 24) - ML+AR patterns

TA2 Conformance (4/5 compliant, 1 pending validation):
- Hypervector bind/unbind
- Similarity metrics
- Bundle operations
- ML+AR composition
- Performance benchmarks (pending measurement)

phi^2 + 1/phi^2 = 3 | TRINITY
- Add specs/physics/pellis-formulas.t27 (L5 anchor, Pell block, TDD blocks)
- Add tri math compare with --pellis, --pellis-extended, --hybrid, --sensitivity
- Append JSONL proof lines to .trinity/experience/math_compare.jsonl
- Scaffold research/trinity-pellis-paper/ (README + formula table)
- Seal PellisFormulas; update docs/NOW.md handoff

Closes #277

Made-with: Cursor
- Extracts WHAT: 5-trit-per-byte encoding for ternary data
- Extracts WHY: Efficient storage for balanced ternary computation
- Constants: TRITS_PER_BYTE=5, MAX_PACKED_BYTES=2400, MAX_TRITS=12000
- Functions: encodePack, decodePack, PackedBigInt arithmetic
- L4 Compliance: 10+ tests, invariants for encoding/roundtrip
- References: issue #298

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ractor

Implements Sprint 3.5 addressing "generative mechanism" gap:
- φ is unique fixed point of balancing recursion f(x) = (x + x⁻¹ + 1)/2
- Zero free parameters — analytically proven, no fitting
- Convergence rate λ = (√5 - 1)/4 ≈ 0.309

Files added:
- specs/math/phi_universal_attractor.t27: TDD spec with 8 tests + 5 invariants + 2 bench
- coq/Kernel/PhiAttractor.v: Coq proof (phi_is_fixed_point, uniqueness lemma)
- benchmarks/phi_attractor_convergence.py: Numerical verification
- GITHUB_ISSUE_THEOREM3.md: GitHub issue template
- docs/WHITEPAPER/gf_paper_v3_imrad_draft.md: Added §2.6, updated Abstract/Conclusion/§7

Co-authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Theorem: C(b) = b/ln(b) achieves unique minimum at b = e
Among integer bases: ternary (b=3) costs 5.4% less than binary (b=2)

Files:
- specs/math/radix_economy.t27: TDD spec with 8 tests + 7 invariants
- conformance/radix_economy_vectors.json: existing conformance vectors
- .trinity/seals/RadixEconomy.json: seal hashes
- .trinity/experience/2026-04-07_ring-050_sprint-3.5_radix-economy.json: TRI-LOOP entry

Co-authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add three new .t27 specs for P0 Core Rewrite Sprint 1:
- specs/numeric/formats.t27: GF16/f32 format conversion, ternary quantization
- specs/vsa/sdk.t27: VSA SDK wrapper with Hypervector abstraction
- specs/server/vm.t27: VSA Virtual Machine with opcode set

All specs parse successfully with 0 errors.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add .github/workflows/release.yml for automated multi-platform publication
- Add workspace Cargo.toml with ffi, python, javascript members
- Update JavaScript package name to "golden-float" for npm consistency

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Dmitrii Vasilev and others added 5 commits April 7, 2026 23:29
…, T-12, T-13) (#309)

* feat(ring-071): NotebookLM backend - config, token, cookie_auth (T-11, T-12, T-13)

* fix(ring-071): Rename token.py to auth_token.py to avoid stdlib conflict

---------

Co-authored-by: Dmitrii Vasilev <admin@t27.ai>
Migrated 6 Zig files from gHashTag/trinity to .t27 specifications:

1. specs/vm/jit_semantics.t27 - JIT compilation semantics for VSA operations
2. specs/graph/knowledge_graph.t27 - Vector Symbolic Architecture knowledge graph
3. specs/numeric/bigint.t27 - Balanced ternary BigInt with Karatsuba multiplication
4. specs/hslm/forward_pass.t27 - Minimal forward pass for LLM inference
5. specs/vsa/sequence_hdc.t27 - Hyperdimensional Computing for language detection
6. specs/vsa/packed_vsa.t27 - Packed VSA operations with lookup tables

Each spec follows L4 TESTABILITY with 8+ tests, invariants, and benchmarks.
L6 CEILING: All numeric constants use GF16 encoding.
L5 IDENTITY: TRINITY = φ² + φ⁻² = 3 preserved in comments.

Co-authored-by: Dmitrii Vasilev <admin@t27.ai>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
- Add Python PyO3 bindings (GF16, GF32)
- Add JavaScript wasm-bindgen bindings
- Add FFI layer with C ABI exports
- Add unified C header (include/golden_float.h)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Convert 6 Zig source files from trinity-source/src/ to .t27 specs:

1. specs/ternary/bigint.t27 - Balanced ternary arbitrary precision arithmetic
   - TVCBigInt with 256 trit capacity
   - SIMD-optimized operations (Vec32i8, Vec32i16)
   - Karatsuba multiplication O(n^1.585)
   - Newton-Raphson division
   - 32 tests, 15 invariants, 11 benchmarks

2. specs/jit/jit.t27 - JIT compiler for VSA operations
   - x86-64 instruction encoding
   - mmap for executable memory
   - Code generation: bind, bundle, dot_product
   - JitCache for dimension-based caching
   - 15 tests, 10 invariants, 8 benchmarks

3. specs/vsa/vsa_core.t27 - Core VSA operations
   - bind/unbind (associative memory)
   - bundle2/bundle3 (superposition)
   - permute (position encoding)
   - similarity functions (cosine, hamming, dot)
   - 22 tests, 13 invariants, 12 benchmarks

4. specs/ternary/hybrid_bigint.t27 - Memory/speed trade-off
   - Packed storage (5 trits/byte) + unpacked computation
   - SIMD-accelerated operations
   - Lazy unpacking, dirty tracking
   - 30 tests, 15 invariants, 14 benchmarks

5. specs/neural/forward_pass.t27 - VSA-based neural network
   - Multi-head attention (3 heads)
   - Resonator training
   - Direct role averaging
   - Autoregressive generation
   - 30 tests, 15 invariants, 14 benchmarks

6. specs/numeric/format_conversion.t27 - Format conversions
   - GF16 (6:9 format), FP16, BF16, Ternary
   - CNN operations (conv2d, max_pool2d)
   - Quantization utilities
   - 22 tests, 14 invariants, 14 benchmarks

Author: Dmitrii Vasilev
SPDX-License-Identifier: Apache-2.0
@gHashTag gHashTag merged commit 29702fc into master Apr 7, 2026
1 of 6 checks passed
@gHashTag gHashTag deleted the feat/p0-core-rewrite-sprint1 branch April 7, 2026 17:09
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.

1 participant