Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 104 additions & 0 deletions research/direct-flow-leaf-walk/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# The leaf-exit walk of #4436's direct flow: a √G regime now, saturation later

**Claim type:** exact finite computation of the leaf log-depth up to lockstep depth 60, plus a standard
large-deviation heuristic for its limit. **No new κ.** It explains the growth of the log-gap `g` in my
[#4465](https://github.com/CrocSwap/integer-mult-bounds/pull/4465). That growth comes from the leaf exits
alone, and `g` sets the refined-induction ceiling `s*·g/(g + 1 + ln m)` on zxv's #4436 direct flow.

## The walk

A leaf exit at rank `N` is `rρ`, where `ρ` is a product of `G = ⌊log₅(N/m)⌋` letters of `P`, under
`mρr ≤ N` at each step. Its `t*`-potential weight is `cnt(ρ)·P_r·(rρ)^{t*}`. Each step `ln r` is
nonnegative, so only the final constraint binds: `S_G = ln ρ ≤ B = ln(N/m)`. The leaf log-depth
therefore splits as

D(G) = E[ln(N/(rρ))] = (ln m − E ln r) + E[B − S_G | S_G ≤ B].

At level starts `B = G ln 5`. The `t*`-tilted step law has mean `μ = 1.62592`, which is above
`ln 5 = 1.60944` by `ε = 0.01648`, and standard deviation `σ = 1.48391`.

## The √G regime (exact data)

`D(G)` is computed exactly from `F[G]`, which lives on {2,3,5}-smooth states, at `N = 121·5^G`. The
verifier covers `G ≤ 40` in about 12 seconds. `evidence/leafwalk.py` extends this to `G = 60`, with
output in `evidence/LEAF-DEPTH-G60.txt`.

| G | 2 | 5 | 10 | 20 | 30 | 40 | 60 |
| --- | --- | --- | --- | --- | --- | --- | --- |
| D(G) | 5.005 | 5.683 | 6.777 | 8.297 | 9.447 | 10.354 | 11.940 |

Fits over `7 ≤ G ≤ 40`:

| law | max residual |
| --- | --- |
| `a + b√G` | **0.054**, with `a = 3.26`, `b = 1.125` |
| linear | 0.38 |
| logarithmic | 0.32 |

The intercept matches `ln m − μ = 3.17`. The slope is close to the CLT value `σ√(2/π) = 1.18`.
That is the law of `E[B − S | S ≤ B]` while `B` sits inside the CLT window (`εG ≪ σ√G`).

## Saturation (heuristic)

Once `G ≫ G× = σ²/ε² ≈ 8,100`, the barrier lies far below the mean. By the exponential change of
measure with Esscher parameter `λ* = 0.0075`, which tilts the step mean to `ln 5`, the overshoot
`B − S_G` given survival tends to `Exp(λ*)`. Hence

D(G) → ln m − μ + 1/λ* ≈ 136.5.

So `g` stays bounded and the refined-induction cap stays strictly below `s*`.

- **Estimate with stable shares.** Keeping the measured shares (leaf about 0.914) and depths (boundary
about 1.84, sources about 2.45) gives `g∞ ≈ 122` and a cap near `0.955·s* ≈ 0.00256`.
- **Lower estimate.** My #4459 bound `β ≤ 0.321` gives a leaf share of at least 0.68, which yields
`g∞ ≳ 88` and a cap of at least about 0.00252.

Either way, saving 0.0023 is reached at `g ≈ 34.5`. That happens inside the √G regime, near
`G ≈ 1,340`, or `N ≈ 10^{940}`. `diagnostics/SATURATION.md` refines the earlier `10^{700}` and observes the
saturation directly by importance sampling up to `G = 10⁶`: the overshoot reaches 131.7, against `1/λ* = 133.3`.

## Reading

- **#4436's direct flow certifies at most roughly 0.0025–0.0026 under #4405's single-step test.** This
heuristic asymptotic ceiling sits strictly below the root `s* = 0.0026865`, because the tilted
P-step mean exceeds `ln k_min`.
- **The only practical gap is the rank.** The selected 0.0023 is certifiable only at astronomically
large rank.
- **What the shortfall comes from.** It is caused by the leaf exits sitting `Θ(1/λ*)` nats below `N`,
not by the boundary exits.

## Not covered

- A proof of the saturation, including the lattice and non-Gaussian corrections, and the stability
of the shares at large `G`.
- Any multi-step test.
- Native premises.

## Reproduce

```sh
python3.12 -B scripts/research_package.py --package research/direct-flow-leaf-walk --check-only
python3.12 -B scripts/research_package.py --package research/direct-flow-leaf-walk
python3.12 -B research/direct-flow-leaf-walk/evidence/leafwalk.py 60 # ~3 min, the G = 60 table
```

The verifier prints `PASS_DIRECT_FLOW_LEAF_WALK`, using only the standard library.

## Open next questions

1. **Can the leaf walk be steered to `μ ≤ ln k_min`?**
- *Why it matters:* with zero or negative relative drift, the overshoot would grow without bound,
and the direct cap would tend to `s*`.
- *First step:* check whether a different job order or leaf depth (for example `G + 1` levels)
changes the effective barrier slope.
2. **A rigorous Bahadur–Rao bound for `E[B − S_G | S_G ≤ B]` with explicit constants.**
- *First step:* the three-dimensional {2,3,5} lattice local CLT.

## Credit

- The direct flow and the gate are zxv's (#4436).
- The refined induction is 1337isnot1337's (#4405).
- The lockstep construction is Jacob Alan Sussman's Theorem 1G.

Prepared by Ryanson Jonathan with substantial Claude Code (Claude Opus 5.5) assistance.
Apache-2.0.
18 changes: 18 additions & 0 deletions research/direct-flow-leaf-walk/SOURCES.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"schema_version": 1,
"base_commit": "2a13eb1827784206202db90e5dc8327cf8a250db",
"files": [
{
"path": "certificates/selected-result.json",
"usage": "provenance",
"git_blob": "ed33caef5c5827693e9572d252a66f99cbb73d40",
"sha256": "5732707cc1e460b090b53f2463162749ad860de878a18f7408938671d295a9d9"
},
{
"path": "docs/research/agent-task-catalog.json",
"usage": "provenance",
"git_blob": "64bfc5af6709ed9811171e0a2108f05e1219cb65",
"sha256": "352a6184713b8843d96fd2c2071eb7aeaa655906b7c51d45ad444912666c8a96"
}
]
}
100 changes: 100 additions & 0 deletions research/direct-flow-leaf-walk/TASK.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{
"schema_version": 1,
"task_id": "independent-moment",
"priority_revision": 7,
"base_commit": "2a13eb1827784206202db90e5dc8327cf8a250db",
"original_card": {
"id": "independent-moment",
"question": "Does a new paid-profile or mixture-ceiling claim have independent source-bound coverage of its actual changed ledger?",
"starting_points": [
"docs/research/research-family-status.md",
"certificates/selected-result.json",
"research/staged544-mixed-fourth-entry/README.md",
"research/staged-fourth-mixture-ceiling/README.md",
"research/r437-two-window-carrier/README.md"
],
"methods": [
"Independently reconstruct one changed paid ledger or pooled dual with exact source and model binding.",
"Check a genuinely uncovered moment implication with a different enclosure method and semantic controls."
],
"acceptance_gate": "Demonstrate independence, source binding, positive cases and semantic failure controls. Name the existing checks and the missing coverage. More digits or another equivalent evaluation of an unchanged root is not by itself new verification coverage.",
"first_step": {
"command": [
"python3",
"-B",
"scripts/research_baseline.py"
],
"expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY",
"inspect": "Choose one uncovered implication in #4088 literal mixed fill, #4091 pooled dual/model binding or #4067 changed frame/host bill. #4091 pins an earlier #4088 head: validate word, capacity and stock equivalence before applying that ceiling to the later fill.",
"scope": "Source-binding orientation only; no scientific replay, theorem acceptance or supplier admission. Budget any heavy replay separately."
},
"first_experiment": "Independently reconstruct one changed ledger or pooled certificate with a positive case and a semantic failure control. Compare exact sources and name what existing checks miss. Keep this separate from supplier-boundary-audit (ordinary/outer dispatch) and uniform-transfer-audit (all-size proof). Stop after the chosen implication; more digits of an unchanged root are not additional mechanism coverage.",
"bottleneck_link": "Independent pricing prevents unsupported frontier claims and can reveal genuine accounting slack.",
"allowed_variations": [
"Reconstruct either a source ledger or a numeric enclosure with a different method."
],
"scope_change_triggers": [
"Importing the primary function and calling its output independent verification.",
"Calling an aggregate histogram or source archive an independently accepted physical supplier."
],
"overlap_terms": [
"independent moment",
"rank histogram",
"exact enclosure",
"2979",
"rank7 joint endframes",
"paired extraction",
"joint lowering",
"4088",
"4091",
"4067",
"staged544-mixed-fourth-entry",
"staged-fourth-mixture-ceiling",
"r437-two-window-carrier"
],
"existing_checks": [
{
"scope": "PR #4088: mixed local/owner/phase ledger and moment reported.",
"evidence": "research/staged544-mixed-fourth-entry/README.md",
"remaining": "Independent binding of changed construction to paid histogram, distinct from full admission.",
"status": "author-checked",
"source_commit": "72d7efc181edb21806a878f174847c96dd410ab0",
"selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129"
},
{
"scope": "PR #4091: sharp pooled ceiling proposed for fixed THREE/FOUR words and inventory.",
"evidence": "research/staged-fourth-mixture-ceiling/README.md",
"remaining": "Validate dual, exhaustive pattern scope and exact source equivalence before applying to newer fills.",
"status": "author-checked",
"source_commit": "a29bdd8f56cd18b805917775cdec09ff935eddc4",
"selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129"
},
{
"scope": "PR #4067: paid (2,2) to (1,3) exchange and fixed OQ4 host reported.",
"evidence": "research/r437-two-window-carrier/README.md",
"remaining": "Independent full cost delta; remaining caller/precision/stock obligations are separate.",
"status": "author-checked",
"source_commit": "a95f11c52e3ca1e4c5171b3c20d8f4b0815aee2e",
"selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129"
}
]
},
"scope_status": "refined",
"actual_scope": "Leaf-exit walk behind #4465's log-gap: exact sqrt(G) regime to G=60 and predicted saturation (Esscher) giving a refined-induction cap strictly below s*.",
"scope_change_reason": "Follow-up to #4465.",
"bottleneck_link": "Bounds what a direct-flow (no tensor/padding) exponent can certify via the refined induction.",
"budget_minutes": 40,
"stop_rule": "Stop at exact data to G=60 and the asymptotic heuristic.",
"outcome": "completed",
"evidence": "D(G) = 3.26 + 1.125 sqrt(G) (max residual 0.054, G=7..40; linear 0.38, log 0.32); mu - ln5 = 0.0165 > 0, lambda* = 0.0075, G_x ~ 8100; predicted saturation D ~ 136.5 and cap ~0.0025-0.00256 < s* = 0.0026865.",
"author": "Ryanson Jonathan, with Claude Code (Claude Opus 5.5) assistance",
"ai_assistance": "Substantial Claude Code (Claude Opus 5.5) assistance; no independent human review.",
"open_questions": [
{
"question": "Can the leaf walk be steered to tilted mean <= ln k_min?",
"why_it_matters": "Then the overshoot grows without bound and the direct cap tends to s*.",
"first_step": "Test alternative leaf depths/job orders for the effective barrier slope.",
"blocked_by": "None."
}
]
}
18 changes: 18 additions & 0 deletions research/direct-flow-leaf-walk/VERIFY.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"schema_version": 1,
"status": "ready",
"python": "3.12",
"requirements": [],
"inputs": [],
"commands": [
{
"argv": [
"{python}",
"-B",
"{package}/verify.py"
],
"timeout_seconds": 180,
"checks": "Exact leaf log-depth D(G) of #4436's direct p7 flow at N=121*5^G, G=2..40: sqrt(G) fit residual <0.08 vs linear/log >0.25, slope near sigma*sqrt(2/pi), intercept ln m - mu, concave 10-level increments; tilted step mean > ln 5; Esscher lambda* and crossover G_x reported."
}
]
}
43 changes: 43 additions & 0 deletions research/direct-flow-leaf-walk/diagnostics/DEPTH-VARIANTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Diagnostic: forcing a shallower lockstep depth

This answers open question 1 of the README negatively, for the obvious lever. It is not registered
and not part of the verifier. Run it with `python3.12 -B depth_variants.py`.
`overlap_flow_depth.py` is the package's flow with one optional `G` override added.

| N | G0 | G | exact identity | g | κ(0.001), η = 0.99422 | source mass ≤ N/m |
| --- | --- | --- | --- | --- | --- | --- |
| 10⁵ | 4 | 4 | yes | 2.823 | 0.995257 | 0 |
| 10⁵ | 4 | 3 | yes | 3.220 | 0.994592 | 2.0·10⁻⁶ |
| 10⁵ | 4 | 2 | yes | 3.783 | 0.993648 | 0.296 |
| 2·10⁶ | 6 | 6 | yes | 3.219 | 0.994593 | 0 |
| 2·10⁶ | 6 | 5 | yes | 3.618 | 0.993927 | 1.3·10⁻¹⁰ |
| 2·10⁶ | 6 | 3 | yes | 5.022 | 0.991578 | 0.327 |

## What the table shows

- A shallower depth keeps the rank-one potential identity, and the `t*` balance, exactly. It also
raises `g` substantially.
- But it puts sources at or below `N/m`.
- `G0 = ⌊log₅(N/m)⌋` is the only depth with every source in `(N/m, N]`.

## Open question

`G0 − 1` violates the source range only by a mass of about `10⁻⁶` to `10⁻¹⁰`, yet gains about 0.4 in
`g`. Can #4405's induction absorb a tiny low-source mass, for example through the induction hypothesis
at smaller rank? If so, a mixed-depth flow could lift the single-step ceiling. That is a question for
#4436 and #4405, and it is not claimed here.

## Conservative mixed depth (`depth_mixed_scan.py`, about 10 min)

Low sources (`≤ N/m`) get **no credit**: they are dropped from the denominator. The table gives
`sup κ` over the 5% grid with `3·10⁵ ≤ N < 2.5·10⁶`.

| saving | η | depth `G0` | depth `G0−1` | per-rank best of the two |
| --- | --- | --- | --- | --- |
| 0.001 | 0.994220 | 0.995037 | 0.995786 | **0.994521** |
| 0.0012 | 0.993068 | 0.995623 | 0.996568 | 0.995199 |
| 0.0015 | 0.991343 | 0.996504 | 0.997743 | 0.996165 |

Choosing the depth rank by rank helps, but only modestly: about 0.0005 in κ. Under this conservative
reading it does not yet certify 0.001 by `2.5·10⁶`. Depth `G0−1` alone is worse in the supremum,
because it loses near the level changes.
25 changes: 25 additions & 0 deletions research/direct-flow-leaf-walk/diagnostics/SATURATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Diagnostic: the predicted saturation, observed by importance sampling

The walk is monotone, because every step `ln r ≥ 0`. So the leaf law is exactly the `G`-fold tilted
P-product restricted to `S_G ≤ B`, where `B = G ln 5` at level starts. `saturate.py` (numpy, about
1 minute) samples `S_G` as a multinomial sum at the Esscher tilt whose mean is `B/G`. It reweights by
`e^{λ(S−B)}`, and estimates the conditioned overshoot `E[B − S_G | S_G ≤ B]` from 400,000 samples per
row.

| G | 50 | 200 | 1,000 | 4,000 | 16,000 | 64,000 | 256,000 | 10⁶ |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| overshoot | 8.01 | 15.54 | 32.01 | 55.16 | 84.73 | 111.53 | 125.74 | 131.66 |

- **The limit.** The overshoot tends to `1/λ* = 133.35`, as predicted.
- **Consistency with the exact data.** At `G ≈ 50` the exact computation gives
`D − (ln m − μ) ≈ 11.10 − 3.17 = 7.93`, consistent with the sampled 8.01.
- **The crossover.** It sits near `G× ≈ 8,100`, as predicted.

## Refined estimates

These keep the measured shares (leaf about 0.914, boundary depth about 1.84, source depth about 2.45).

- **The limit:** `g∞ ≈ 0.914·(3.17 + 133.35) − 2.29 ≈ 122.5`, so the cap is
`s*·g∞/(g∞ + 5.796) ≈ 0.00257`.
- **Saving 0.0023:** this needs `g ≈ 34.5`, an overshoot of about 37, so `G ≈ 1,340` and
`N ≈ 121·5^{1340} ≈ 10^{940}`. That replaces the README's rougher `10^{700}`.
20 changes: 20 additions & 0 deletions research/direct-flow-leaf-walk/diagnostics/SHARES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Diagnostic: share and depth stability through N ≈ 1.2·10⁹

This addresses the "stability of the shares" caveat in the README and in `SATURATION.md`. Run it with
`python3.12 -B leaf_share.py 2 9` (about 2 minutes). It uses the package flow, copied as
`overlap_flow.py`, at the start and near the end of each level.

| G | N | leaf share of exit potential | boundary depth | source depth |
| --- | --- | --- | --- | --- |
| 2 | 3,026 / 14,822 | 0.885 / 0.917 | 1.845 / 1.900 | 2.438 / 2.345 |
| 3 | 15,126 / 74,112 | 0.923 / 0.904 | 1.914 / 1.773 | 2.390 / 2.440 |
| 4 | 75,626 / 370,562 | 0.918 / 0.902 | 1.798 / 1.904 | 2.438 / 2.521 |
| 5 | 378,126 / 1,852,812 | 0.921 / 0.910 | 1.818 / 1.873 | 2.425 / 2.502 |
| 6 | 1,890,626 / 9,264,062 | 0.914 / 0.911 | 1.851 / 1.845 | 2.458 / 2.480 |
| 7 | 9,453,126 / 46,320,312 | 0.915 / 0.906 | 1.830 / 1.864 | 2.453 / 2.490 |
| 8 | 47,265,626 / 231,601,562 | 0.908 / 0.908 | 1.867 / 1.853 | 2.482 / 2.487 |
| 9 | 236,328,126 / 1,158,007,812 | 0.911 / 0.910 | 1.861 / 1.839 | 2.483 / 2.474 |

The leaf share, the boundary-exit depth and the source depth all settle, at about 0.91, 1.85 and 2.48,
while the leaf depth keeps growing (README). This supports the stable-share assumption behind the
asymptotic cap of about 0.00257. It is finite evidence, not a proof.
23 changes: 23 additions & 0 deletions research/direct-flow-leaf-walk/diagnostics/depth_mixed_scan.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
exec(open('overlap_flow_depth.py').read()) # run from this directory
W={5:420,6:270,7:840,8:1395,9:3195,25:448,41:448,57:448,121:224}
P={1:37305,2:10695,3:3360,4:1530,5:300,8:1464,16:448,32:448,48:448}
m=121
sav=(0.001,0.0012,0.0015)
worst={(d,s):0 for d in (0,1,2) for s in sav}
for N in [int(1000*1.05**i) for i in range(0,200) if 1000*1.05**i<2.5e6]:
G0=0
while 5**(G0+1)<=N//m: G0+=1
ks={}
for d in (0,1):
if G0-d<1: continue
R=flow(N,W,P,G0-d); S,X=R['S'],R['X']
for s in sav:
z=1-s
ks[(d,s)]=sum(v*e**z for e,v in X.items())/sum(v*x**z for x,v in S.items() if m*x>N)
if N>=3e5:
for s in sav:
worst[(0,s)]=max(worst[(0,s)],ks[(0,s)]); worst[(1,s)]=max(worst[(1,s)],ks[(1,s)])
worst[(2,s)]=max(worst[(2,s)],min(ks[(0,s)],ks[(1,s)]))
for s in sav:
eta=(1-s)*121**(-s)
print(f"saving {s}: eta {eta:.6f} | depth G0: sup kappa(N>=3e5) {worst[(0,s)]:.6f} | depth G0-1, low sources dropped: {worst[(1,s)]:.6f} | per-N best of the two: {worst[(2,s)]:.6f}")
20 changes: 20 additions & 0 deletions research/direct-flow-leaf-walk/diagnostics/depth_variants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Diagnostic (not registered): #4436's direct flow with a forced lockstep depth G <= G0 = floor(log5(N/m)).
# Run from this directory: python3.12 -B depth_variants.py
import math
exec(open('overlap_flow_depth.py').read())
W = {5: 420, 6: 270, 7: 840, 8: 1395, 9: 3195, 25: 448, 41: 448, 57: 448, 121: 224}
P = {1: 37305, 2: 10695, 3: 3360, 4: 1530, 5: 300, 8: 1464, 16: 448, 32: 448, 48: 448}
m, ts = 121, 0.9973135109511491
for N in (20000, 100000, 400000, 2000000):
G0 = 0
while 5 ** (G0 + 1) <= N // m:
G0 += 1
for G in range(max(0, G0 - 3), G0 + 1):
R = flow(N, W, P, G)
S, X = R['S'], R['X']
ident = sum(s * v for s, v in S.items()) - sum(e * v for e, v in X.items()) == 608 * R['col']
st = sum(v * s ** ts for s, v in S.items()); xt = sum(v * e ** ts for e, v in X.items())
g = sum(v * s ** ts * math.log(s) for s, v in S.items()) / st - sum(v * e ** ts * math.log(e) for e, v in X.items()) / xt
k = sum(v * e ** 0.999 for e, v in X.items()) / sum(v * s ** 0.999 for s, v in S.items())
low = sum(v for s, v in S.items() if m * s <= N) / sum(S.values())
print(N, G0, G, ident, f"g={g:.4f} kappa(0.001)={k:.6f} (eta 0.994220) source mass <= N/m: {low:.3g}")
Loading
Loading