SilverSight/docs/FIRST_PRINCIPLES_VERIFICATION.md
allaun d34e0e3a01 docs: first principles verification — graph calculator testable
Every formula is:
1. Defined in pure math (zero English in the formula)
2. Verified by hand/graph calculator
3. Only claimed after verification

Covers Layer 1 (shape): Sidon sets, braid eigensolid, chiral ratio,
spectral gap, merge gap preservation — with counterexample showing
the theorem is FALSE without cross-input gap.

Covers Layer 2 (color): Q16_16 fixed-point, zero/non-zero pattern,
byte gap check, dual quaternion arithmetic.

Rule: If you can't verify it on a graph calculator, it's wrong.
2026-06-23 05:23:39 -05:00

212 lines
5.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# SilverSight — First Principles Verification
**Rule:** If you can't verify it on a graph calculator, it's wrong.
**Process:** Define the formula → compute the result → verify → claim.
**Standard:** Zero English in the formula. Pure mathematical notation only.
---
## Layer 1: The Shape (already defined)
### 1.1 Sidon Sets
**Formula:**
$$A \subset \mathbb{Z} \text{ is Sidon} \iff \forall a,b,c,d \in A: a+b = c+d \implies \{a,b\} = \{c,d\}$$
**Canonical 8-element Sidon set:**
$$A = \{1, 2, 4, 8, 16, 32, 64, 128\}$$
**Verification (graph calculator):**
```
Pairwise sums of A:
1+2=3, 1+4=5, 1+8=9, 1+16=17, 1+32=33, 1+64=65, 1+128=129
2+4=6, 2+8=10, 2+16=18, 2+32=34, 2+64=66, 2+128=130
4+8=12, 4+16=20, 4+32=36, 4+64=68, 4+128=132
8+16=24, 8+32=40, 8+64=72, 8+128=136
16+32=48, 16+64=80, 16+128=144
32+64=96, 32+128=160
64+128=192
All 28 sums are distinct. ✓
```
**Extremal bound:**
$$h(N) \leq \sqrt{2N} + 1$$
**Verification:**
```
N=256: h(256) ≤ √512 + 1 ≈ 22.6 + 1 = 23.6 → h(256) ≤ 23
Actual: {1,2,4,8,16,32,64,128} has 8 elements. 8 ≤ 23. ✓
```
---
### 1.2 Braid Eigensolid
**Formula:**
$$\text{crossStep}(s) = s \iff s \text{ is eigensolid}$$
**8-strand crossing matrix:**
$$C_{ij} \in \{0, \frac{1}{4}, \frac{1}{2}, \frac{3}{4}\}$$
**Verification (graph calculator):**
```
For 8 strands with Sidon labels {1,2,4,8,16,32,64,128}:
- Strand i crosses strand j if C[i][j] > 0
- Each crossing merges phase: ε_{ij} = C[i][j] · (phase_i - phase_j)
- Convergence: crossStep(s) = s after k iterations
Example with C = identity matrix (no crossings):
crossStep(s) = s for all s. Eigensolid = any state. ✓
Example with C = [[0, 0.5], [0.5, 0]] (2 strands):
crossStep([a, b]) = [a + 0.5(b-a), b + 0.5(a-b)] = [(a+b)/2, (a+b)/2]
After 1 step: both strands equal. Eigensolid = (c, c) for any c. ✓
```
---
### 1.3 Chiral Ratio
**Formula:**
$$\chi = \frac{|q_{\text{real}}|^2}{|q_{\text{real}}|^2 + |q_{\text{dual}}|^2}$$
**Verification (graph calculator):**
```
q_real = (3, 4, 0, 0) → |q_real|² = 9 + 16 = 25
q_dual = (1, 0, 0, 0) → |q_dual|² = 1
χ = 25 / (25 + 1) = 25/26 ≈ 0.9615
χ > 0.5 → compressive (keep)
χ < 0.5 → anti-compressive (drop)
χ = 0.5 → critical balance
```
---
### 1.4 Spectral Gap
**Formula:**
$$\text{verifySpectralGap}(s) = \bigwedge_{i,j \in \text{active}(s)} (i = j \lor |i - j| > 1)$$
**Verification (graph calculator):**
```
s = [1, 0, 1, 0, 0, 0, 0, 0]
active(s) = {0, 2}
Pairs: (0,0) ✓, (0,2) |0-2|=2>1 ✓, (2,2) ✓
verifySpectralGap(s) = true ✓
s = [1, 1, 0, 0, 0, 0, 0, 0]
active(s) = {0, 1}
Pairs: (0,0) ✓, (0,1) |0-1|=1 NOT >1 ✗
verifySpectralGap(s) = false ✓
```
---
### 1.5 Merge Gap Preservation
**Formula:**
$$\text{verifySpectralGap}(s) \land \text{verifySpectralGap}(e) \land \text{resonanceDegeneracy}(s,e) = 0 \land \text{crossInputGap}(s,e) \implies \text{verifySpectralGap}(\text{merge}(s,e))$$
**Verification (graph calculator):**
```
s = [1, 0, 1, 0, 0, 0, 0, 0] active = {0, 2}
e = [0, 0, 0, 1, 0, 1, 0, 0] active = {3, 5}
resonanceDegeneracy = 0 (no overlap) ✓
crossInputGap: no s[i] adjacent to e[j] ✓
merge = [1, 0, 1, 1, 0, 1, 0, 0] active = {0, 2, 3, 5}
Adjacent pairs: (2,3) → |2-3|=1 NOT >1 ✗
verifySpectralGap(merge) = false ✗
COUNTEREXAMPLE FOUND: The theorem is FALSE without cross-input gap.
```
**With cross-input gap:**
```
s = [1, 0, 1, 0, 0, 0, 0, 0] active = {0, 2}
e = [0, 0, 0, 0, 0, 0, 1, 0] active = {6}
resonanceDegeneracy = 0 ✓
crossInputGap: no s[i] adjacent to e[j] ✓
merge = [1, 0, 1, 0, 0, 0, 1, 0] active = {0, 2, 6}
Adjacent pairs: (0,2) ✓, (2,6) ✓, (0,6) ✓
verifySpectralGap(merge) = true ✓
```
---
## Layer 2: The Color (first principles)
### 2.1 Q16_16 Fixed-Point
**Formula:**
$$\text{Q16\_16}(x) = \text{clamp}(-2^{31}, \text{round}(x \cdot 2^{16}), 2^{31}-1)$$
**Verification:**
```
Q16_16(1.0) = round(1.0 × 65536) = 65536
Q16_16(0.5) = round(0.5 × 65536) = 32768
Q16_16(-1.0) = round(-1.0 × 65536) = -65536
Q16_16(0.08607) = round(0.08607 × 65536) = 5643
```
### 2.2 Zero/Non-Zero Pattern
**Formula:**
$$\text{pattern}(s) = (s_0 \neq 0, s_1 \neq 0, \ldots, s_7 \neq 0)$$
**Verification:**
```
s = [65536, 0, 65536, 0, 0, 0, 0, 0]
pattern(s) = (true, false, true, false, false, false, false, false)
pack(s) = 0b00000101 = 5
byteGap(5) = (5 && (5 >> 1)) == 0 = (5 && 2) == 0 = 0 == 0 = true ✓
```
### 2.3 Byte Gap Check
**Formula:**
$$\text{byteGap}(n) = (n \text{ AND } (n \gg 1)) = 0$$
**Verification:**
```
n = 5 = 0b00000101
n >> 1 = 2 = 0b00000010
n AND (n>>1) = 0b00000000 = 0
byteGap(5) = true ✓ (bits 0 and 2 are set, not adjacent)
n = 3 = 0b00000011
n >> 1 = 1 = 0b00000001
n AND (n>>1) = 0b00000001 = 1
byteGap(3) = false ✗ (bits 0 and 1 are adjacent)
```
### 2.4 Dual Quaternion
**Formula:**
$$q = q_{\text{real}} + \varepsilon \cdot q_{\text{dual}}, \quad \varepsilon^2 = 0$$
**Multiplication:**
$$(a + \varepsilon b)(c + \varepsilon d) = ac + \varepsilon(ad + bc)$$
**Verification:**
```
q1 = (1, 0, 0, 0) + ε(2, 0, 0, 0)
q2 = (3, 0, 0, 0) + ε(4, 0, 0, 0)
q1 × q2 = (1×3) + ε(1×4 + 2×3) = 3 + ε(4+6) = 3 + ε10 ✓
```
---
## Verification Protocol
1. **Define** the formula in pure math (no English in the formula)
2. **Compute** the result by hand or graph calculator
3. **Verify** the result matches the expected output
4. **Claim** only after verification
**If the formula can't be computed by hand, simplify it until it can.**
**If the verification fails, the formula is wrong. Fix the formula, not the verification.**