Skip to content

GF Competitive Analysis: GMP integration, verify_precision.py, gf_competitive.t27 spec, and whitepaper scaffold #289

Description

@gHashTag

GF Competitive Analysis — Proving GoldenFloat is Not Random

Date: 2026-04-07
Status: Working Draft
Architecture: every step = tri CLI + experience/ source of truth .trinity


Why This Work Is Needed

The t27 project implements GoldenFloat (GF) — a family of 7 floating-point formats (GF4, GF8, GF12, GF16, GF20, GF24, GF32) designed around the golden ratio φ ≈ 1.618. Current benchmarks exist but we need:

  1. GMP Integration — arbitrary precision verification (100+ digits via Python mpmath)
  2. Mathematical proof that GF is not random — derived from sacred geometry
  3. Competitive comparison against IEEE 754, OCP MXFP, mainstream languages
  4. Scientific documentation following zig-golden-float whitepaper standards
  5. Cross-language verification proving ternary computes more decimal places accurately

Phase 0 — GMP / mpmath Integration (P0 TODAY)

0.1 Create scripts/verify_precision.py

Python mpmath script outputting all sacred constants at 100 decimal digits:

from mpmath import mp, mpf, sqrt
import json

mp.dps = 100  # 100 decimal digits

phi = (mp.mpf(1) + sqrt(mp.mpf(5))) / mp.mpf(2)
phi_inv = 1 / phi
phi_sq = phi * phi

# Pellis closed form (FORMULA_TABLE.md row 31)
term1 = 360 / phi_sq
term2 = -2 / (phi ** 4)
term3 = 1 / (3 * phi) ** 5
pellis = term1 + term2 + term3

results = {
    "precision_digits": 100,
    "phi": str(phi),
    "phi_inv": str(phi_inv),
    "phi_sq": str(phi_sq),
    "pellis_100_digits": str(pellis),
    "pi": str(mp.pi),
    "e": str(mp.e),
    "phi_identity_check": str(phi_sq - phi - 1),  # should be ~0
    "trinity_identity_check": str(phi_sq + 1/phi_sq - 3)  # should be ~0
}

print(json.dumps(results, indent=2))

Output: JSON with all sacred constants at 100 digits, stored in .trinity/experience/precision_verify.json

0.2 Update research/trinity-pellis-paper/FORMULA_TABLE.md

Add row 31 with Pellis value pre-registered to 50 digits:

  • 137.03599916476639345... (50 digits fixed)
  • Mark as "verified via mpmath (100 digits)"
  • Add pre-registered checkpoint section for CODATA 2026/2030 comparison

0.3 Future: tri math compare --precision N

Add --precision-bits flag to bootstrap/src/math_compare.rs to compute sacred constants at N digits via Python subprocess.


Phase 1 — New Spec: specs/numeric/gf_competitive.t27

Create spec with:

  • test golden_float_phi_representation — GF32 error < 5.0e-4
  • test golden_float_vs_ieee_sacred_constants — GF16 mean error <= IEEE × 0.9
  • test roundtrip_uniform_distribution — NMSE GF16 <= IEEE FP16 × 1.01
  • test addition_precision_phi_relation — φ² = φ+1 identity in GF16
  • test accumulation_stability — sum 10^6 terms, rel_error < 1e-4
  • test ternary_vs_python_decimal_places — ternary >= IEEE f64 places
  • invariant gf16_phi_distance_is_measurable
  • invariant phi_split_is_optimal
  • bench gf16_encode_decode_latency — target < 50 ns

Compliance: L4 TESTABILITY — must include test/invariant/bench sections (SOUL.md Art II).


Phase 2 — New Spec: specs/numeric/pellis_verify.t27

GMP-backed Pellis verification spec:

  • Import from specs/physics/pellis-formulas.t27
  • test pellis_100_digit_verification — compare mpmath output with CODATA 2022 α⁻¹
  • invariant pellis_preregistered_checkpoint — fixed 50-digit value

Phase 3 — Language Harness Directory: benchmarks/language_tests/

Create harnesses outputting JSON {test_name, input, result, decimal_places, error, time_ns}:

File Language Type
python_float64.py Python IEEE f64 baseline
python_decimal.py Python Decimal exact
python_fractions.py Python Rational arithmetic
javascript_number.js Node.js Web standard
rust_f64.rs Rust System reference
cpp_double.cpp C++ Low-level reference

Test scenarios: π calculation, φ iteration φ_{n+1} = 1 + 1/φ_n, accumulation Σ 1/n for n=1..10⁶.


Phase 4 — Whitepaper: docs/WHITEPAPER/gf_not_random.md

Structure:

  1. Abstract — GF derived from sacred geometry via optimization
  2. Background — problem statement, φ in nature
  3. Mathematical Foundation — Phi-Split Optimality Theorem + proof
  4. Anti-Randomness Arguments — algebraic derivation, universality, falsifiability
  5. Experimental Results — sacred constants accuracy, roundtrip precision, cross-language
  6. Use Case Recommendations — GF16 primary, GF32 high precision, GF8 weight compression
  7. Conclusion + References

All Files to Create/Modify

File Action Priority
scripts/verify_precision.py CREATE P0 TODAY
research/trinity-pellis-paper/FORMULA_TABLE.md MODIFY (add row 31 + 50-digit Pellis) P0 TODAY
specs/numeric/gf_competitive.t27 CREATE P1
specs/numeric/pellis_verify.t27 CREATE P1
bootstrap/src/math_compare.rs MODIFY (add --precision N) P1
benchmarks/language_tests/python_float64.py CREATE P2
benchmarks/language_tests/python_decimal.py CREATE P2
benchmarks/language_tests/rust_f64.rs CREATE P2
benchmarks/language_tests/javascript_number.js CREATE P2
docs/WHITEPAPER/gf_not_random.md CREATE P2
conformance/gf_competitive_bench.json CREATE P2

Verification Gates

# Phase 1: Spec validation
./scripts/tri parse specs/numeric/gf_competitive.t27
./scripts/tri gen specs/numeric/gf_competitive.t27
./bootstrap/target/release/t27c test specs/numeric/gf_competitive.t27

# Phase 2: mpmath precision check
python3 scripts/verify_precision.py > .trinity/experience/precision_verify.json

# Phase 3: Language harnesses
cd benchmarks/language_tests && python3 python_float64.py > results/python_float64.json

# Phase 4: Competitive suite
./scripts/tri math compete --sacred --roundtrip --languages --full --format json

Success Criteria

  • scripts/verify_precision.py outputs 100-digit Pellis value
  • FORMULA_TABLE.md row 31 pre-registered at 50 digits with mpmath verification note
  • specs/numeric/gf_competitive.t27 passes tri test (L4 compliant)
  • specs/numeric/pellis_verify.t27 passes tri test
  • All language harnesses produce valid JSON
  • GF32 sacred constant error < 5× IEEE FP32
  • GF16 NMSE <= IEEE FP16 NMSE × 1.01
  • Ternary decimal places >= IEEE f64 decimal places
  • docs/WHITEPAPER/gf_not_random.md complete
  • Results in conformance/gf_competitive_bench.json
  • NOW.md updated with ring iteration entry
  • Experience JSONL entry appended to .trinity/experience/clara_track1.jsonl

Invariant Laws Compliance (per SOUL.md / AGENTS.md)

  • L1 TRACEABILITY: All PRs implementing this work must include Closes #<this-issue>
  • L2 GENERATION: gen/ output generated from specs — no hand-editing
  • L3 PURITY: All .t27 files ASCII-only, English identifiers
  • L4 TESTABILITY: Every new .t27 spec must contain test/invariant/bench
  • L7 UNITY: Python scripts in scripts/ are permitted; no new *.sh on critical path

φ² + 1/φ² = 3 | TRINITY

Activity

  1. gHashTag commented on Apr 8, 2026

    @gHashTag
    OwnerAuthor

    📓 NotebookLM Notebook created

    Notebook ID: eb84480f-ebea-469d-bda3-be882e728806
    URL: https://notebooklm.google.com/notebook/eb84480f-ebea-469d-bda3-be882e728806

  2. added a commit that references this issue on Apr 14, 2026
    f5441be
  3. added 2 commits that reference this issue on Apr 29, 2026
    53def68
    10b71fc
  4. gHashTag commented on Apr 29, 2026

    @gHashTag
    OwnerAuthor

    All phases complete:

    Phase 0: scripts/verify_precision.py — 100-digit mpmath, covers FORMULA_TABLE rows 1,2,3,5,22-25,27-31
    Phase 1: specs/numeric/gf_competitive.t27 — 8 tests, 7 invariants, 3 benchmarks
    Phase 2: specs/math/pellis_precision_verify.t27 — 9 tests, 7 invariants, 2 benchmarks
    Phase 3: Language harnesses complete — python_float64, python_decimal (new), python_fractions (new), javascript_number, rust_f64, cpp_bench
    FORMULA_TABLE.md: Row 31 Pellis α⁻¹ checkpoint registered at 137.035999164766…

    Both specs parse and seal correctly.

  5. added 2 commits that reference this issue on Apr 29, 2026
    664e5e3
    14f7a55
  6. added 2 commits that reference this issue on Jun 1, 2026
    75c2876
    78ddcf2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions