Skip to content

specs/ternary: trits + radix_economy -- the logic of the course "The ternary machine" (t27.ai) #8978

Closed

Description

@gHashTag

Owner, 2026-10-11: build the next t27.ai course and make it engaging with visualisations. The course "The ternary machine" (gHashTag/trinity, ternary-computing) gets an interactive widget in every lesson. Each widget's numbers must come from a t27 spec compiled to wasm, as with line_bounce, eye_isi and secded (#8931).

Two specs:

  • specs/ternary/trits.t27
    • balanced-ternary digits, read with the offset 111...1 (base 3), so no signed division is needed;
    • negation by flipping trits, rounding by cutting trits;
    • Kleene logic: NOT, MIN, MAX, CONSENSUS, ANY, plus the half adder;
    • full adder, ripple add;
    • product by one trit without a multiplier, long multiplication, MAC step;
    • a trit in two bits, five trits in a byte, bit use, bits for k trits;
    • three-way compare at the first differing trit, two-answer and three-answer question counts;
    • a ternary activation.
  • specs/ternary/radix_economy.t27
    • digits per base, cost = b * digits, b / ln b (ln as a series), the cheapest base.

Done when both specs typecheck and every test passes with no vacuous pass, negative controls are caught, and the seals are saved.

User Scenarios

  • Given the specs/ternary directory exists, when the spec specs/ternary/trits.t27 is compiled with t27c, then it typechecks and all its tests pass with no vacuous pass.
  • Given the specs/ternary directory exists, when the spec specs/ternary/radix_economy.t27 is compiled with t27c, then it typechecks and all its tests pass with no vacuous pass.

Requirements

  • FR-001: specs/ternary/trits.t27 MUST define balanced-ternary digits read with offset 111...1 (base 3) avoiding signed division.
  • FR-002: specs/ternary/trits.t27 MUST implement negation by flipping trits and rounding by cutting trits.
  • FR-003: specs/ternary/trits.t27 MUST implement Kleene logic: NOT, MIN, MAX, CONSENSUS, ANY, and half adder.
  • FR-004: specs/ternary/trits.t27 MUST implement full adder, ripple add.
  • FR-005: specs/ternary/trits.t27 MUST implement product by one trit without a multiplier, long multiplication, MAC step.
  • FR-006: specs/ternary/trits.t27 MUST implement trit encoding: a trit in two bits, five trits in a byte, bit use, bits for k trits.
  • FR-007: specs/ternary/trits.t27 MUST implement three-way compare at first differing trit, two-answer and three-answer question counts.
  • FR-008: specs/ternary/trits.t27 MUST implement a ternary activation function.
  • FR-009: specs/ternary/radix_economy.t27 MUST compute digits per base, cost = b * digits, b / ln b (ln as a series), and identify the cheapest base.
  • FR-010: Both specs MUST compile to WASM without errors for use in interactive widgets.

Success Criteria

  • t27c specs/ternary/trits.t27 exits with exit 0 and produces a WASM module.
  • t27c specs/ternary/radix_economy.t27 exits with exit 0 and produces a WASM module.
  • All tests in specs/ternary/trits.t27 pass (negative controls caught, no vacuous pass).
  • All tests in specs/ternary/radix_economy.t27 pass (negative controls caught, no vacuous pass).
  • Seals are saved for both specs.

Boundary

  • specs/ternary/trits.t27
  • specs/ternary/radix_economy.t27

Activity

  1. added a commit that references this issue on Oct 11, 2026
    ada4e8b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions