Skip to content

Commit 7749e4c

Browse files
gHashTagclaude
andcommitted
feat: Academic documentation styling with KaTeX math rendering
- Add KaTeX for proper mathematical equation rendering - Add academic typography (Merriweather serif, Inter sans-serif, JetBrains Mono) - Create Figure, Table, Abstract, PaperMeta MDX components - Add theorem/lemma/proof/corollary/definition CSS styling with semantic colors - Convert key equations to LaTeX syntax (Trinity Identity, Koide formula, etc.) - Add abstract sections to research pages (bitnet-report, trinity-node-ffi) - Equation numbering with \tag{} for cross-referencing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent d411590 commit 7749e4c

14 files changed

Lines changed: 892 additions & 94 deletions

File tree

docsite/docs/concepts/trinity-identity.md

Lines changed: 31 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -8,69 +8,50 @@ sidebar_position: 3
88

99
The Trinity Identity is the equation at the heart of this project:
1010

11-
```
12-
phi^2 + 1/phi^2 = 3
13-
```
11+
$$\varphi^2 + \frac{1}{\varphi^2} = 3$$
1412

15-
where phi = (1 + sqrt(5)) / 2 = 1.6180339887... is the **golden ratio**. This identity connects the golden ratio -- one of the most widely studied irrational constants in mathematics -- to the number **3**, the optimal integer base for computing.
13+
where $\varphi = \frac{1 + \sqrt{5}}{2} \approx 1.618$ is the **golden ratio**. This identity connects the golden ratio one of the most widely studied irrational constants in mathematics to the number **3**, the optimal integer base for computing.
1614

1715
## The Golden Ratio
1816

19-
The golden ratio phi is defined as the positive root of the equation:
17+
The golden ratio $\varphi$ is defined as the positive root of the equation:
2018

21-
```
22-
x^2 - x - 1 = 0
23-
```
19+
$$x^2 - x - 1 = 0$$
2420

25-
which gives phi = (1 + sqrt(5)) / 2. It satisfies the fundamental property:
21+
which gives $\varphi = \frac{1 + \sqrt{5}}{2}$. It satisfies the fundamental property:
2622

27-
```
28-
phi^2 = phi + 1
29-
```
23+
$$\varphi^2 = \varphi + 1$$
3024

31-
This means that squaring the golden ratio is the same as adding one to it. Equivalently, the reciprocal of phi has a remarkably simple form:
25+
This means that squaring the golden ratio is the same as adding one to it. Equivalently, the reciprocal of $\varphi$ has a remarkably simple form:
3226

33-
```
34-
1/phi = phi - 1 = 0.6180339887...
35-
```
27+
$$\frac{1}{\varphi} = \varphi - 1 \approx 0.618$$
3628

37-
The golden ratio appears throughout mathematics and the natural sciences: in Fibonacci sequences, optimal packing problems, quasicrystal tilings (Penrose tilings), and phyllotaxis (the spiral arrangement of leaves and seeds in plants). Its key mathematical property is that it is the "most irrational" number -- its continued fraction representation converges more slowly than that of any other irrational number, making it maximally resistant to rational approximation (Livio, 2002).
29+
The golden ratio appears throughout mathematics and the natural sciences: in Fibonacci sequences, optimal packing problems, quasicrystal tilings (Penrose tilings), and phyllotaxis (the spiral arrangement of leaves and seeds in plants). Its key mathematical property is that it is the "most irrational" number its continued fraction representation converges more slowly than that of any other irrational number, making it maximally resistant to rational approximation (Livio, 2002).
3830

3931
## Algebraic Proof
4032

41-
**Step 1.** Compute phi^2 using the identity phi^2 = phi + 1:
33+
<div className="proof">
34+
<div className="proof-title">Proof</div>
4235

43-
```
44-
phi^2 = phi + 1 = (3 + sqrt(5)) / 2
45-
```
36+
**Step 1.** Compute $\varphi^2$ using the identity $\varphi^2 = \varphi + 1$:
4637

47-
**Step 2.** Compute 1/phi using rationalization:
38+
$$\varphi^2 = \varphi + 1 = \frac{3 + \sqrt{5}}{2}$$
4839

49-
```
50-
1/phi = 2 / (1 + sqrt(5))
51-
= 2(1 - sqrt(5)) / ((1)^2 - (sqrt(5))^2)
52-
= 2(1 - sqrt(5)) / (-4)
53-
= (sqrt(5) - 1) / 2
54-
= phi - 1
55-
```
40+
**Step 2.** Compute $\frac{1}{\varphi}$ using rationalization:
5641

57-
**Step 3.** Compute 1/phi^2:
42+
$$\frac{1}{\varphi} = \frac{2}{1 + \sqrt{5}} = \frac{2(1 - \sqrt{5})}{1 - 5} = \frac{2(1 - \sqrt{5})}{-4} = \frac{\sqrt{5} - 1}{2} = \varphi - 1$$
5843

59-
```
60-
1/phi^2 = (phi - 1)^2
61-
= phi^2 - 2*phi + 1
62-
= (phi + 1) - 2*phi + 1 [substituting phi^2 = phi + 1]
63-
= 2 - phi
64-
```
44+
**Step 3.** Compute $\frac{1}{\varphi^2}$:
45+
46+
$$\frac{1}{\varphi^2} = (\varphi - 1)^2 = \varphi^2 - 2\varphi + 1 = (\varphi + 1) - 2\varphi + 1 = 2 - \varphi$$
6547

6648
**Step 4.** Sum the two terms:
6749

68-
```
69-
phi^2 + 1/phi^2 = (phi + 1) + (2 - phi)
70-
= 3
71-
```
50+
$$\varphi^2 + \frac{1}{\varphi^2} = (\varphi + 1) + (2 - \varphi) = 3$$
7251

73-
The phi terms cancel exactly, leaving the integer 3. **QED.**
52+
The $\varphi$ terms cancel exactly, leaving the integer 3.
53+
<span className="qed"></span>
54+
</div>
7455

7556
## Why This Matters
7657

@@ -86,29 +67,25 @@ The constant of optimal proportion, squared and added to its inverse square, yie
8667

8768
The information content of a ternary digit is:
8869

89-
```
90-
log2(3) = 1.58496... bits/trit
91-
```
70+
$$\log_2(3) = 1.58496... \text{ bits/trit}$$
9271

93-
The Trinity Identity evaluates to 3, which is the base of the ternary number system used by Trinity. While this is an elegant coincidence -- the golden ratio's algebraic properties yielding the ternary base -- these are two mathematically independent facts: the identity phi^2 + 1/phi^2 = 3 follows from the minimal polynomial of phi, while the information density of a trit follows from Shannon's entropy formula. The project takes its name from this numerical coincidence.
72+
The Trinity Identity evaluates to 3, which is the base of the ternary number system used by Trinity. While this is an elegant coincidence the golden ratio's algebraic properties yielding the ternary base these are two mathematically independent facts: the identity $\varphi^2 + \frac{1}{\varphi^2} = 3$ follows from the minimal polynomial of $\varphi$, while the information density of a trit follows from Shannon's entropy formula. The project takes its name from this numerical coincidence.
9473

9574
The 58.5% information advantage of ternary over binary (1.585 bits per trit vs. 1 bit per bit) is a direct consequence of 3 being a larger base, and is the reason ternary representations are more compact than binary ones for a given range of values.
9675

9776
## Parametric Constant Approximation
9877

9978
Building on this connection, the Parametric Constant Approximation proposes that certain mathematical and physical constants can be expressed (exactly or approximately) in the form:
10079

101-
```
102-
V = n * 3^k * pi^m * phi^p * e^q
103-
```
80+
$$V = n \cdot 3^k \cdot \pi^m \cdot \varphi^p \cdot e^q$$
10481

105-
where n is an integer, and k, m, p, q are rational exponents. This decomposition combines:
106-
- **3^k** -- powers of the optimal base (ternary)
107-
- **pi^m** -- powers of pi (circular/geometric symmetry)
108-
- **phi^p** -- powers of the golden ratio (self-similar proportion)
109-
- **e^q** -- powers of Euler's number (natural growth/decay)
82+
where $n$ is an integer, and $k, m, p, q$ are rational exponents. This decomposition combines:
83+
- $3^k$ — powers of the optimal base (ternary)
84+
- $\pi^m$ — powers of pi (circular/geometric symmetry)
85+
- $\varphi^p$ — powers of the golden ratio (self-similar proportion)
86+
- $e^q$ — powers of Euler's number (natural growth/decay)
11087

111-
The [Constant Approximation Formulas](/docs/math-foundations/formulas) page demonstrates this decomposition for physical constants including the fine structure constant (1/alpha = 4*pi^3 + pi^2 + pi = 137.036...) and the proton-electron mass ratio (m_p/m_e = 6*pi^5 = 1836.12...).
88+
The [Constant Approximation Formulas](/docs/math-foundations/formulas) page demonstrates this decomposition for physical constants including the fine structure constant ($\frac{1}{\alpha} = 4\pi^3 + \pi^2 + \pi = 137.036...$) and the proton-electron mass ratio ($\frac{m_p}{m_e} = 6\pi^5 = 1836.12...$).
11289

11390
:::caution
11491

docsite/docs/math-foundations/formulas.md

Lines changed: 41 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -15,48 +15,54 @@ The formulas below are **empirical approximations**, not derived physical theori
1515

1616
<div class="formula">
1717

18-
**V = n * 3^k * pi^m * phi^p * e^q**
18+
$$V = n \cdot 3^k \cdot \pi^m \cdot \varphi^p \cdot e^q \tag{1}$$
1919

2020
</div>
2121

2222
Several measured physical constants can be approximated by combinations of:
23-
- **n** -- Integer coefficient
24-
- **3^k** -- Powers of 3
25-
- **pi^m** -- Powers of pi (geometric symmetry)
26-
- **phi^p** -- Powers of the golden ratio (self-similar proportion)
27-
- **e^q** -- Powers of Euler's number (natural growth)
23+
- $n$ — Integer coefficient
24+
- $3^k$ — Powers of 3
25+
- $\pi^m$ — Powers of pi (geometric symmetry)
26+
- $\varphi^p$ — Powers of the golden ratio (self-similar proportion)
27+
- $e^q$ — Powers of Euler's number (natural growth)
2828

2929
---
3030

3131
## Electromagnetic Constants
3232

33-
### Fine Structure Constant (alpha)
33+
### Fine Structure Constant ($\alpha$)
3434

3535
<div class="theorem-card">
3636
<h4>Formula</h4>
3737

38-
**1/alpha = 4*pi^3 + pi^2 + pi**
38+
$$\frac{1}{\alpha} = 4\pi^3 + \pi^2 + \pi \tag{2}$$
39+
40+
| Metric | Value |
41+
|--------|-------|
42+
| Calculated | 137.0363... |
43+
| Measured | 137.0360... |
44+
| Error | 0.0002% |
3945

40-
**Calculated**: 137.0363...
41-
**Measured**: 137.0360...
42-
**Error**: 0.0002%
4346
</div>
4447

45-
The fine structure constant alpha = 1/137.036 governs the strength of electromagnetic interactions. It determines the probability of a photon being absorbed or emitted by a charged particle. This approximation expresses it purely in terms of pi with integer coefficients.
48+
The fine structure constant $\alpha = 1/137.036$ governs the strength of electromagnetic interactions. It determines the probability of a photon being absorbed or emitted by a charged particle. This approximation expresses it purely in terms of $\pi$ with integer coefficients.
4649

4750
### Proton-Electron Mass Ratio
4851

4952
<div class="theorem-card">
5053
<h4>Formula</h4>
5154

52-
**m(p)/m(e) = 6*pi^5**
55+
$$\frac{m_p}{m_e} = 6\pi^5 \tag{3}$$
56+
57+
| Metric | Value |
58+
|--------|-------|
59+
| Calculated | 1836.12... |
60+
| Measured | 1836.15... |
61+
| Error | 0.002% |
5362

54-
**Calculated**: 1836.12...
55-
**Measured**: 1836.15...
56-
**Error**: 0.002%
5763
</div>
5864

59-
The proton is approximately 1836 times heavier than the electron. This ratio is closely approximated by 6*pi^5.
65+
The proton is approximately 1836 times heavier than the electron. This ratio is closely approximated by $6\pi^5$.
6066

6167
---
6268

@@ -67,14 +73,17 @@ The proton is approximately 1836 times heavier than the electron. This ratio is
6773
<div class="theorem-card">
6874
<h4>Formula</h4>
6975

70-
**Q = (m(e) + m(mu) + m(tau)) / (sqrt(m(e)) + sqrt(m(mu)) + sqrt(m(tau)))^2 = 2/3**
76+
$$Q = \frac{m_e + m_\mu + m_\tau}{\left(\sqrt{m_e} + \sqrt{m_\mu} + \sqrt{m_\tau}\right)^2} = \frac{2}{3} \tag{4}$$
77+
78+
| Metric | Value |
79+
|--------|-------|
80+
| Calculated | 0.666661... |
81+
| Measured | 0.666656... |
82+
| Error | 0.0009% |
7183

72-
**Calculated**: 0.666661...
73-
**Measured**: 0.666656...
74-
**Error**: 0.0009%
7584
</div>
7685

77-
The Koide formula relates the three charged lepton masses (electron, muon, tau) through a remarkably simple ratio of 2/3. The precision of this relationship remains unexplained by the Standard Model.
86+
The Koide formula relates the three charged lepton masses (electron, muon, tau) through a remarkably simple ratio of $\frac{2}{3}$. The precision of this relationship remains unexplained by the Standard Model.
7887

7988
### Muon-Electron Mass Ratio
8089

@@ -137,11 +146,14 @@ Dark energy constitutes approximately 68% of the universe's energy. Note that Om
137146
<div class="theorem-card">
138147
<h4>Formula</h4>
139148

140-
**n(s) = 94/pi^4**
149+
$$n_s = \frac{94}{\pi^4} \tag{5}$$
150+
151+
| Metric | Value |
152+
|--------|-------|
153+
| Calculated | 0.96490... |
154+
| Measured | 0.96490... |
155+
| Error | 0.0002% |
141156

142-
**Calculated**: 0.96490...
143-
**Measured**: 0.96490...
144-
**Error**: 0.0002%
145157
</div>
146158

147159
The scalar spectral index of primordial density fluctuations measured from the Cosmic Microwave Background. This expression achieves extraordinary precision.
@@ -224,13 +236,13 @@ Simplified: **M(Z) = M(W) / cos(theta(W))**
224236

225237
<div class="formula">
226238

227-
**dim(E8) = 3^5 + 5 = 243 + 5 = 248**
239+
$$\dim(E_8) = 3^5 + 5 = 243 + 5 = 248 \tag{6}$$
228240

229-
**roots(E8) = 3^5 - 3 = 243 - 3 = 240**
241+
$$\text{roots}(E_8) = 3^5 - 3 = 243 - 3 = 240 \tag{7}$$
230242

231243
</div>
232244

233-
The exceptional Lie group E8 appears in string theory and attempts at grand unification. Both its dimension and root count can be written arithmetically in terms of powers of 3 with small additive corrections. This is a numerical coincidence, not evidence of a structural connection between E8 and ternary computing.
245+
The exceptional Lie group $E_8$ appears in string theory and attempts at grand unification. Both its dimension and root count can be written arithmetically in terms of powers of 3 with small additive corrections. This is a numerical coincidence, not evidence of a structural connection between $E_8$ and ternary computing.
234246

235247
---
236248

docsite/docs/research/bitnet-report.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,22 @@ sidebar_position: 2
44

55
# BitNet b1.58 Coherence Report
66

7-
This report documents the results of testing Microsoft's official BitNet b1.58-2B-4T model across three different inference frameworks. The goal was to evaluate output coherence, inference speed, and practical usability of ternary-weight language models.
8-
9-
**Date:** February 5, 2026
10-
**Model:** microsoft/bitnet-b1.58-2B-4T
11-
**Finding:** Incoherent output observed across all three frameworks on CPU hardware. GPU testing is required to establish baseline quality.
7+
<div className="paper-meta">
8+
<p><strong>Authors:</strong> Trinity Research Team</p>
9+
<p><strong>Date:</strong> February 5, 2026</p>
10+
<p><strong>Status:</strong> Technical Report</p>
11+
<p><strong>Model:</strong> microsoft/bitnet-b1.58-2B-4T</p>
12+
</div>
13+
14+
<div className="abstract">
15+
<div className="abstract-title">Abstract</div>
16+
17+
This report documents the results of testing Microsoft's official BitNet b1.58-2B-4T model across three different inference frameworks: HuggingFace Transformers (greedy and sampling modes) and the official bitnet.cpp. We evaluate output coherence, inference speed, and practical usability of ternary-weight language models. Initial testing on CPU hardware (Apple M1 Pro) revealed incoherent output across all frameworks, attributed to GGUF tokenizer metadata errors. Subsequent GPU testing (RTX 4090) confirmed coherent text generation is achievable with proper configuration.
18+
19+
<div className="keywords">
20+
<strong>Keywords:</strong> BitNet, ternary inference, LLM evaluation, 1.58-bit quantization, coherence testing
21+
</div>
22+
</div>
1223

1324
## Academic References
1425

docsite/docs/research/trinity-node-ffi.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,21 @@ sidebar_position: 3
44

55
# Trinity Node BitNet FFI Integration
66

7-
This report documents the successful integration of BitNet ternary inference into the Trinity node via FFI (Foreign Function Interface) wrapper to the official Microsoft bitnet.cpp.
7+
<div className="paper-meta">
8+
<p><strong>Authors:</strong> Trinity Research Team</p>
9+
<p><strong>Date:</strong> February 6, 2026</p>
10+
<p><strong>Status:</strong> Production-ready</p>
11+
</div>
812

9-
**Date:** February 6, 2026
10-
**Status:** Production-ready
11-
**Finding:** 100% coherent text generation, fully local inference, no cloud API required.
13+
<div className="abstract">
14+
<div className="abstract-title">Abstract</div>
15+
16+
This report documents the successful integration of BitNet ternary inference into the Trinity node via FFI (Foreign Function Interface) wrapper to the official Microsoft bitnet.cpp. The integration achieves 100% coherent text generation at 13.7 tokens/second on CPU hardware, with fully local inference requiring no cloud API. This enables Trinity nodes to provide decentralized AI services with minimal energy consumption through ternary weight operations ({-1, 0, +1}).
17+
18+
<div className="keywords">
19+
<strong>Keywords:</strong> BitNet, FFI integration, ternary inference, decentralized AI, local LLM
20+
</div>
21+
</div>
1222

1323
## Academic References
1424

docsite/docusaurus.config.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import {themes as prismThemes} from 'prism-react-renderer';
22
import type {Config} from '@docusaurus/types';
33
import type * as Preset from '@docusaurus/preset-classic';
4+
import remarkMath from 'remark-math';
5+
import rehypeKatex from 'rehype-katex';
46

57
const config: Config = {
68
title: 'Trinity',
@@ -27,13 +29,25 @@ const config: Config = {
2729
locales: ['en'],
2830
},
2931

32+
// KaTeX stylesheet for mathematical rendering
33+
stylesheets: [
34+
{
35+
href: 'https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/katex.min.css',
36+
type: 'text/css',
37+
integrity: 'sha384-Xi8rHCmBmhbuyyhbI88391ZKP2dmfnOl4rT9ZfRI7mLTdk1wblIUnrIq35nqwEvC',
38+
crossorigin: 'anonymous',
39+
},
40+
],
41+
3042
presets: [
3143
[
3244
'classic',
3345
{
3446
docs: {
3547
sidebarPath: './sidebars.ts',
3648
editUrl: 'https://github.com/gHashTag/trinity/tree/main/docsite/',
49+
remarkPlugins: [remarkMath],
50+
rehypePlugins: [rehypeKatex],
3751
},
3852
blog: false,
3953
theme: {

0 commit comments

Comments
 (0)