# Derivation 30: The Denomination Boundary

## Claim

The three open questions from FRAMEWORK.md —

1. Where is the entropy-vs-energy regime boundary?
2. Does spacetime require a discrete substrate?
3. Is degenerate perturbation theory the right tool at the boundary?

— are one question. The boundary between energy-denominated and
entropy-denominated synchronization cost is the devil's staircase
drawn in coupling space. It is fractal. It is the quantum-classical
boundary. And the tool that resolves degeneracy at each level is the
mediant — the same operation that builds the tree.

## The two denominations

At every node p/q of the Stern-Brocot tree, the system faces a cost:

**Energy cost** (maintaining coherence within a tongue):

$$C_E(p/q, K) = K \cdot w(p/q, K) = K \cdot (K/2)^q$$

This is the coupling strength times the tongue width. It measures how
much energy the system spends to keep oscillators locked at ratio p/q.
It increases with K — stronger coupling costs more energy to maintain.

**Entropy cost** (sacrificing distinguishability by locking):

$$C_S(p/q, K) = \ln\left(\frac{\text{accessible states outside tongue}}{\text{total states}}\right) = \ln(1 - w(p/q, K))$$

This measures how much configuration space the system gives up by
committing to one tongue. It becomes more negative (costlier) as the
tongue widens with increasing K.

## The denomination switch

At low K, tongues are narrow: w << 1. Locking to any particular p/q
costs almost no entropy (you give up a negligible fraction of
configuration space) but costs energy proportional to K. The system
optimizes energy — the cheapest tongue wins.

At high K, tongues are wide: w → 1. Almost all of configuration space
is locked. Locking costs no energy (the coupling is strong enough to
maintain it for free) but costs entropy — each locked mode removes
a distinguishable state. The system optimizes entropy — the mode that
preserves the most distinguishability wins.

The switch occurs when:

$$\frac{\partial C_E}{\partial K} = \frac{\partial C_S}{\partial K}$$

For tongue p/q with width w ~ (K/2)^q:

$$w + K \cdot q \cdot w / K = \frac{q \cdot w / K}{1 - w}$$

At the boundary (w << 1 but non-negligible):

$$K_*(q) \approx 2 \cdot q^{-1/(q-1)}$$

This is a **different K* for each denominator q**. The denomination
boundary is not a single coupling value — it is a sequence:

| q | K*(q) | Tongue |
|---|-------|--------|
| 1 | — | Always locked (trivial) |
| 2 | 2.00 | 1/2 |
| 3 | 1.73 | 1/3, 2/3 |
| 4 | 1.59 | 1/4, 3/4 |
| 5 | 1.50 | Fibonacci convergents |
| ... | → √2 | Limit |

Higher-denominator modes switch denomination at *lower* coupling.
The boundary in (K, q) space is a decreasing function — it is the
**Arnold tongue envelope** viewed from the cost-denomination axis.

## The fractal boundary

Between any two denomination switches K*(q) and K*(q+1), there are
denomination switches for all mediants (composite modes with
denominators between q and q+1 on the Stern-Brocot tree). The set
of K* values is dense in the interval [√2, 2].

The boundary between energy-denominated and entropy-denominated
cost is not a line. It is a **Cantor-like set** — the devil's
staircase drawn in coupling space rather than frequency space.

At coupling K:
- Modes with K*(q) > K are energy-denominated (tongue still narrow,
  system pays energy to maintain lock)
- Modes with K*(q) < K are entropy-denominated (tongue wide, system
  pays entropy to maintain distinguishability)
- Modes with K*(q) ≈ K are **at the boundary** — neither denomination
  is correct, both costs are comparable

The modes at the boundary are the degenerate ones.

## Degeneracy at the boundary

When two adjacent Stern-Brocot fractions p/q and p'/q' have equal
cost at coupling K, their tongues overlap. The system cannot resolve
which mode it belongs to. Standard perturbation theory would lift
this degeneracy by finding the correct basis within the degenerate
subspace.

But the perturbation that resolves the degeneracy is the **mediant**
(p+p')/(q+q'). The mediant mode has denominator q+q' — it sits
between the two parents on the tree and has a tongue that is narrower
than either parent's. It resolves the degeneracy by providing a new
mode that the system can lock to when neither parent is clearly
cheaper.

This is not standard degenerate perturbation theory. It is
**tree-structured resolution**: each degeneracy is lifted by
descending one level in the Stern-Brocot tree. The "perturbation
Hamiltonian" is the tree itself.

### The self-referential loop

The mediant that lifts the degeneracy changes the population
distribution, which changes the coupling K (through the order
parameter), which changes which modes are degenerate. The resolution
of each degeneracy creates new ones at the next level.

This is the field equation (D11) in microscopic form:

$$N(p/q) = N_{\text{total}} \times g(p/q) \times w(p/q, K_0 F[N])$$

The fixed point of this loop is the self-consistent population
at which no further degeneracy resolution changes the coupling.
That fixed point is the physical state.

## The discrete substrate question

The denomination boundary answers Question 2 directly.

The continuum limit (Q completed to R) corresponds to K = 1 exactly,
where all tongues fill configuration space completely. At K = 1,
every mode is entropy-denominated, there are no gaps, and the
Stern-Brocot tree becomes the real line. This is general relativity
(Proof A).

At K < 1, there are gaps. The gaps are the modes that haven't
switched denomination yet — they're still energy-denominated, still
quantum. The gaps are the irrational winding numbers, and they carry
the quantum states (D12 §II).

The discrete substrate is not assumed — it is the set of modes that
have switched denomination at the current coupling K. The continuum
is the limit where all modes have switched. The physical system is
always at some K < 1 (except at the cosmological constant's fixed
point), so the substrate is always discrete.

The tree doesn't need to be postulated as discrete. It IS discrete at
any finite coupling, and continuous only in the K → 1 limit that is
never physically realized (the fidelity bound, D9, prevents it).

## Observables

### Observable 1: Denomination switch in the Stribeck lattice

The waveform evolution (stable_waveform_v2.py) shows the denomination
switch directly. At low F_n, the waveform minimizes energy (smooth
sine — minimum dissipation). At high F_n, the waveform minimizes
entropy (staircase — minimum number of active modes).

**Prediction**: at the transition coupling (F_n ≈ 2–4 for this
lattice), the waveform should show **intermittency** — alternating
epochs of sinusoidal (energy-dominated) and staircase
(entropy-dominated) behavior within the same time series. This is
the system fluctuating across the denomination boundary.

### Observable 2: Fractal dimension of the boundary

The set of coupling values at which new mode-locks appear should have
a fractal dimension determined by the Stern-Brocot tree structure.
For the golden-ratio staircase, the box-counting dimension of the
tongue boundaries is:

$$d_{\text{box}} = 1 - \frac{\ln \varphi^2}{\ln 2} \approx 0.306$$

This is measurable in the lattice by sweeping F_n finely across the
transition region and recording the coupling values at which new
spectral peaks appear.

### Observable 3: Mediant resolution of degeneracy

When two spectral peaks (at frequencies f₁ = p/q and f₂ = p'/q' of
the drive) have comparable amplitude, a third peak should appear at
the mediant frequency f₃ = (p+p')/(q+q'). This is the tree resolving
the degeneracy.

**Prediction**: at the coupling where the 1/2 and 1/3 subharmonics
have equal power, a peak at 2/5 (the mediant of 1/2 and 1/3) should
emerge. This is the Fibonacci convergent appearing as the resolution
of the simplest degeneracy.

### Observable 4: Intermittency statistics

At the denomination boundary, the system alternates between
energy-dominated and entropy-dominated epochs. The distribution of
epoch durations should follow a power law with exponent related to the
tongue-width scaling:

$$P(\text{epoch} > T) \propto T^{-\alpha}, \quad \alpha = \frac{\ln(K/2)}{\ln \varphi^2}$$

This is testable in the time series of the lattice at F_n ≈ 3.

## The variational principle: the staircase as shortest path

### The spectral gap between square and staircase

Five canonical waveforms have distinct spectral signatures:

| Waveform | Harmonics | Amplitude scaling | Spectral type |
|---|---|---|---|
| Sine | Fundamental only | — | Single peak |
| Triangle | Odd integers 1, 3, 5, ... | 1/n² | Integer lattice, fast decay |
| Sawtooth | All integers 1, 2, 3, ... | 1/n | Integer lattice, slow decay |
| Square | Odd integers 1, 3, 5, ... | 1/n | Integer lattice, slow decay |
| Devil's staircase | All rationals p/q | ~(K/2)^q | Stern-Brocot tree, exponential in denominator |

The first four have spectral content at **integer** multiples of the
fundamental. The staircase has spectral content at **rational** multiples
— 1/2, 1/3, 2/3, 2/5, 3/5, ... — with amplitudes that fall off
exponentially with the **denominator q**, not the harmonic number n.

This is a structurally different kind of spectrum. Integer harmonics
tile the frequency axis uniformly. Rational harmonics tile it like the
Stern-Brocot tree — dense everywhere but hierarchically weighted. The
1/1 mode dominates, 1/2 and 1/3 are next, then the mediants 2/5 and
3/5, then the next level. Each level is exponentially suppressed by
(K/2)^q.

The gap between square and staircase is the gap between **periodicity**
and **mode-locking**. A periodic signal repeats exactly after one
period — it can only have integer harmonics. A mode-locked signal
repeats after a rational number of drive periods — it has content at
all rationals. The "extra" spectral content at non-integer rationals
is the signature of locking to a tree rather than a lattice.

### The variational statement

The devil's staircase W(Ω) maps bare frequency Ω to winding number W.
It is a monotone function from [0,1] to [0,1] with total variation
TV = 1 at all coupling K.

Define the **synchronization cost** of a path W(Ω) as:

$$C[W] = \int_0^1 c\!\left(\frac{dW}{d\Omega}\right) d\Omega$$

where c(v) is the cost per unit frequency of maintaining a derivative
(velocity) v in the winding number. On a tongue plateau, dW/dΩ = 0
and the cost is zero — the system is locked for free. In a transition
(gap between tongues), dW/dΩ > 0 and the cost is positive.

The constraint is:

$$\int_0^1 \frac{dW}{d\Omega}\, d\Omega = W(1) - W(0) = 1$$

The path must get from W = 0 to W = 1 across the full frequency range.

**Theorem.** The devil's staircase is the path W(Ω) that minimizes
C[W] subject to the endpoint constraint, given that the cost-free
segments (tongues) are located at the Stern-Brocot rationals with
widths w(p/q, K) = (K/2)^q.

**Proof sketch.** Any monotone path from (0,0) to (1,1) with total
variation 1 can be decomposed into:
- **Free segments**: intervals where W is constant (locked to a tongue,
  zero cost)
- **Costly segments**: intervals where W increases (transition between
  tongues, positive cost)

To minimize total cost, the path should maximize the total length of
free segments. The free segments are the Arnold tongues. Their total
measure at coupling K is:

$$\mu_{\text{free}}(K) = \sum_{p/q} w(p/q, K) = \sum_{q=1}^{\infty} \sum_{\substack{p=1 \\ \gcd(p,q)=1}}^{q-1} \left(\frac{K}{2}\right)^q$$

As K → 1, this sum approaches 1 (the tongues fill [0,1]). At K < 1,
the free measure is less than 1 and the path must traverse some
costly transitions.

The cost-minimizing strategy is to occupy the **widest available
tongues first** — the ones with smallest denominator q, since their
width (K/2)^q is largest. This is exactly the order in which the
Stern-Brocot tree is built: depth 1 first (q = 1), then depth 2
(q = 2), then mediants, and so on.

The devil's staircase IS this greedy strategy made precise. It assigns
the available free segments in order of decreasing width (increasing
denominator), and concentrates all the costly transitions into the
smallest possible intervals. ∎

### What the staircase minimizes

The staircase is the **path of least synchronization cost** through
frequency space, subject to the constraint that all winding numbers
from 0 to 1 are visited. It is a brachistochrone — but the quantity
being minimized is not travel time through physical space. It is the
total cost of frequency conversion across the spectrum.

| Brachistochrone | Devil's staircase |
|---|---|
| Physical path through a gravitational field | Path through frequency space at coupling K |
| Gravity provides free acceleration | Tongues provide free locking |
| The cycloid maximizes time in free fall | The staircase maximizes time on plateaus |
| Costly segments: climbing against gravity | Costly segments: transitions between tongues |
| Constraint: reach the endpoint | Constraint: W goes from 0 to 1 |

The coupling K plays the role of gravity. At K = 0 (no coupling),
there are no tongues — the cheapest path is the straight line W = Ω,
and the cost is uniformly distributed. At K = 1 (critical coupling),
the tongues fill everything — the cheapest path has zero cost
everywhere, and the staircase is complete.

### The fourth primitive, reinterpreted

The parabola x² + μ = 0 (Primitive 4 from D10) is the normal form
at each tongue boundary. It determines the shape of the costly
transitions — the saddle-node bifurcation that the path must traverse
between adjacent plateaus.

The brachistochrone is a cycloid, generated by a circle rolling on a
line. The staircase's costly segments are parabolas (saddle-node
normal form) connected by flat segments (tongues). The cycloid
minimizes time; the staircase minimizes synchronization cost. Both
are variational solutions with the same structure: free segments
(free fall / locked plateaus) connected by forced segments
(climbing / bifurcation transitions).

The parabola is the staircase's unit of cost. Each transition between
adjacent tongues costs exactly one parabola's worth of synchronization.
The total cost of the path is the number of transitions times the cost
per transition, minimized by occupying the widest tongues first.

### Numerical confirmation (`staircase_spectrum_v2.py`)

The plateau fraction of the staircase increases monotonically with K:

| K | Plateau fraction | Total variation |
|---|---|---|
| 0.30 | 10.0% | 1.0000 |
| 0.60 | 23.2% | 1.0000 |
| 0.90 | 47.7% | 1.0000 |
| 0.95 | 55.0% | 1.0000 |
| 0.99 | 63.7% | 1.0000 |

The total variation is exactly 1.0 at all K — the path always covers
the same distance (W: 0 → 1). The plateau fraction is the fraction
of that distance traversed at zero cost. The staircase maximizes this
fraction given the available tongue widths at each K.

## The Pythagorean comma as irreducible cost

### The comma

The Pythagorean comma is (3/2)¹² / 2⁷ = 531441/524288 ≈ 1.01364.
Twelve perfect fifths overshoot seven octaves by 1.36%. The tonal
system built from octaves (q = 2) and fifths (q = 3) does not close.

In the Stern-Brocot tree, this is the statement that **the tree has
no loops**. The path through 12 nodes at 3/2 and the path through
7 nodes at 2/1 end at different places. The comma is the distance
between these endpoints.

### The comma in the variational picture

The staircase's cost function charges (1 − w(p/q, K)) per transition
through tongue p/q. The Pythagorean path (12 fifths) costs more than
the direct path (7 octaves):

| K | Cost(12 fifths) | Cost(7 octaves) | Ratio |
|---|---|---|---|
| 0.90 | 10.907 | 5.583 | 1.954 |
| 0.95 | 10.714 | 5.421 | 1.977 |
| 0.99 | 10.545 | 5.285 | **1.995** |

The cost ratio converges to **2** as K → 1. The Pythagorean path
costs exactly twice the direct path at critical coupling. This factor
of 2 is the number of complete Farey traversals in the comma cycle.

### The comma and the 19

The Pythagorean comma is 3¹² / 2¹⁹. The exponents decompose:

$$12 = 2 \times q_2 q_3 = 2 \times 6$$

$$7 = |F_6| - q_2 q_3 = 13 - 6$$

$$12 + 7 = |F_6| + q_2 q_3 = 13 + 6 = 19$$

The total number of transitions in the comma cycle — 12 fifths up
and 7 octaves down — is **19**. This is the denominator of
Ω_Λ = 13/19.

The decomposition:

| Quantity | Value | Klein bottle origin |
|---|---|---|
| 12 fifths | 2 × q₂q₃ | Two complete Farey-scale traversals |
| 7 octaves | \|F₆\| − q₂q₃ | Excess of states over interaction scale |
| 19 total | \|F₆\| + q₂q₃ | Total budget (= Ω_Λ denominator) |

The dark energy fraction Ω_Λ = 13/19 is the ratio of locked modes
(13 = |F₆|) to total transitions (19) in the cycle that doesn't
close. **The Pythagorean comma is the Klein bottle's failure to close.**

### Why the comma is irreducible

The Klein bottle selects q₂ = 2 and q₃ = 3 (D19). These are the
octave and the fifth — the two simplest non-trivial mode-locking
ratios. Any attempt to build a closed tonal system from only these
two intervals fails by exactly the comma.

In the variational picture, this means: the cost-minimizing path
through frequency space using only q = 2 and q = 3 tongues cannot
return to its starting point. The 1.36% overshoot is the minimum
irreducible synchronization cost of the Klein bottle configuration.

The staircase resolves this by filling in higher-denominator modes
(q = 4, 5, 6, ...) — the Stern-Brocot mediants that appear at
parent degeneracies (the mediant test above). Each mediant reduces
the remaining gap but never closes it completely. The residual is
always a comma at the next level of the tree.

This is why the configuration space is a tree and not a lattice:
**a lattice would close, and the comma would vanish. The comma
exists because the Stern-Brocot tree is the configuration space,
and trees don't have loops.**

### Numerical verification (`pythagorean_comma_variational.py`)

Tracing 12 fifths through the Stern-Brocot tree (mod octaves):

    Step 12: × 3/2 → 531441/524288 = 1.013643

Overshoot from unity: 0.013643 = comma − 1. Exact match.

The tongue-width equality 12 × w(q=3) = 7 × w(q=2) requires
K = 7/6 ≈ 1.167 — supercritical. At any physical coupling K ≤ 1,
the fifths never catch the octaves. The comma is always present.

## Connection to the CMB

The baryon-photon coupling at recombination was at some effective K.
The acoustic peaks are the modes that had switched denomination
(entropy-denominated, locked, classical). The damping tail is the
modes that hadn't (energy-denominated, unlocked, quantum).

The Silk damping scale is the denomination boundary for the
baryon-photon system. The framework predicts:

1. The damping tail should show discrete structure at rational l-ratios
   (the tongue boundaries that haven't locked yet)
2. The peak height ratios should be expressible as Farey fractions
3. The transition between peaks and damping tail should show the
   intermittency signature — not a smooth envelope but a staircase

These are testable with current CMB data (Planck, ACT, SPT) at high l.

## Numerical results

### Mediant resolution: confirmed (`mediant_test.py`)

At every parent-mode degeneracy point, the mediant peak is present:

| Parents | Crossing F_n | Mediant | Mediant/Parent |
|---------|-------------|---------|----------------|
| 1/3 + 1/2 | 4.0 | **2/5** | 72% |
| 1/2 + 2/3 | 2.9 | **3/5** | **161%** |
| 2/3 + 1/1 | 2.7 | **3/4** | 58% |
| 1/1 + 3/2 | 3.6 | **4/3** | **132%** |
| 3/2 + 2/1 | 4.0 | **5/3** | 99% |
| 2/1 + 3/1 | 3.3 | **5/2** | 53% |

In two cases (3/5, 4/3) the mediant exceeds both parents — the system
preferentially selects the resolution mode over the degenerate parents.
The tree doesn't just resolve degeneracy; it **selects** the mediant.

The full Stern-Brocot tree lights up level by level with increasing
coupling: parents first, mediants follow, ordered by denominator.

### Intermittency: confirmed (`denomination_boundary.py`)

At F_n = 3.0, the plateau fraction per period fluctuates across
[0.04, 0.48] with std = 0.08. The distribution is unimodal at 0.24,
meaning the system is *inside* the transition — both denominations
apply simultaneously, not alternating between two regimes.

### Waveform evolution: confirmed (`waveform_evolution.py`, [`stable_waveform_v2.py`](https://github.com/nickjoven/harmonics/blob/main/sync_cost/derivations/stable_waveform_v2.py))

The progression sine → clipped → trapezoidal → subharmonic limit cycle
is observed across elements 1–5. At high coupling, the waveform is
a stable periodic orbit at a rational subharmonic of the drive. The
"stable oscillation" is the mode-locked limit cycle.

## Status

**Confirmed numerically.** The mediant resolution of degeneracy is the
strongest result: every Stern-Brocot mediant appears at its parents'
degeneracy point, and two mediants exceed their parents. This is not
standard perturbation theory — it is tree-structured resolution where
the operation that lifts the degeneracy is the same operation that
builds the configuration space.

The three FRAMEWORK.md open questions reduce to one structure:
- **Entropy vs energy**: the denomination switches at K*(q), different
  for each denominator, producing a fractal boundary
- **Discrete vs continuum**: the tree is discrete at K < 1 and
  continuous only in the K → 1 limit (never realized physically)
- **Degenerate perturbation theory**: replaced by mediant resolution,
  which is self-referential (the resolution changes the coupling)

The variational principle — the staircase as path of least
synchronization cost — provides the missing link to the fourth
primitive (the parabola). Each tongue transition costs one parabola.
The staircase maximizes plateau fraction (confirmed: 10% → 64% as
K: 0.3 → 0.99, with total variation invariant at 1.0).

The spectral gap between square wave and staircase is the gap between
periodicity and mode-locking: integer harmonics vs rational harmonics,
1/n decay vs (K/2)^q decay.

The Pythagorean comma closes the loop between the Klein bottle (D19),
the Farey partition (D25), and the variational principle. The 19 in
Ω_Λ = 13/19 is the comma cycle length: 12 fifths + 7 octaves =
2q₂q₃ + (|F₆| − q₂q₃) = |F₆| + q₂q₃. The comma is the irreducible
cost of the tree not having loops.

Remaining:
- CMB predictions (damping tail fine structure, Farey peak heights)
- Fractal dimension of mode-lock onset boundary (finer sweep needed)
- Rigorous proof that the staircase is the unique cost minimizer
- Whether the comma's 1.36% appears as a measurable cosmological residual
