Current task: —

← Session 33 — ii′-3b/3c crux + F-D finding; Lagarias letter package

#1940 assistant 2026-08-25 04:50:43.082 UTC · 2524→3387 tok open ⤢
thinking (2830 chars)
The Bn change touches: 1. `Bn` def (line 2413): 2F → 4F, (2/3)Ĉ₀ → (2/3)Z2. 2. `marginTilde` def (line 754): same expression duplicated — must change in lockstep. 3. `marginExpanded` blocks (mFblock etc., ~line 1819-1830): the block decomposition used by marginTilde_convex via marginTilde_eq_expanded — the mK constant (with (2/3)·2.9? no — mK := −40·1.3352 − 2(e⁴+1)(7(3·2.9²+48)+3.3) − 1 + 1: the constant blocks; the (2/3)Ĉ₀ block becomes (2/3)Z2 — Z2 = 0.6L+0.886LL+2.7 vs Ĉ₀ = 0.433L+0.886LL+2.9: the block decomposition changes (the 4T·(2/3)·(0.6L) vs 4T·(2/3)(0.433L) coefficients + the constant 2.7 vs 2.9 in mK? mK doesn't include the I_III constant... mK = −40M₀ − 2(e⁴+1)(7(3·2.9²+48)+3.3) − 1 + 1 — the "3·2.9²" is Hhat's constant part (3C₀² with C₀'s constant 2.9)... the I_III block's constant 4T·(2/3)·2.9 → 4T·(2/3)·2.7 — mK would change? mK is the constant gatherer for marginExpanded — need to see the block definitions to know. And 2F → 4F: the mFblock coefficient. 4. marginTilde_eq_expanded (the bookkeeping simp proof — re-run). 5. marginTilde_convex (the ψ-table — the changed blocks' rows re-proved). 6. marginTilde_eq_sub (bookkeeping — re-run). 7. LiBasePoints: marginTilde_FAlt_80000_pos + marginTilde_FAlt_80000_lt_100000 (re-certify with rational intervals — values improve). 8. lambda_pos_finite_height_verified (consumes the above — its statement is Bn-independent ✓ but its proof passes through the changed pieces — re-check). Also Z2 needs a Lean def (the two-unit count bound form — currently inline in ZeroCountProp2's statement). Define `Z2hat (t : ℝ) : ℝ := 0.6 * Real.log (t + 2) + 0.886 * Real.log (Real.log (t + 2)) + 2.7` in LiContour (where ZeroCountProp2 lives) or in LiSkeleton near C0hat. Better: LiSkeleton next to C0hat (used by Bn) — but ZeroCountProp2 (LiContour) should then be restated with Z2hat for consistency... LiContour is a proved file — editing ZeroCountProp2's statement would break its consumers (5f capstone). DON'T touch ZeroCountProp2; just define Z2hat in LiSkeleton (or LiContour without changing the Prop) and note the definitional equality. This is ii′-6-a (next sub-stage). For NOW (this session's tail), produce: 1. **D-071** (the ii′-6 design doc): the two findings, the user approvals (verbatim 8-step protocol), the numerical validation (E-030), the honest-Bn definition, the affected-declarations map, the sub-stage map ii′-6-a..e, the perimeter formalizations (ZeroCountGlobalProp + MZeroProp statements), the sides-identity/bridge/extended-pigeonhole/segment-integral component designs. 2. **E-030** (the numerical validation script + data + db registration). 3. Journal/STATE/NGUYEN updates + commit (clean boundary). Let me write the E-030 script first (deterministic, cached), run it to produce CSV+JSON, then D-071, then archive updates + commit.
Plan set. Producing E-030 (the preserved numerical validation, step 8 of your protocol), then D-071.
tool: Write
input
{
  "file_path": "D:\\Python\\Quantum\\research\\numerics\\scripts\\E-030-honest-Bn-fold.py",
  "content": "#!/usr/bin/env python3\n\"\"\"E-030 \u2014 ii\u2032-6 design validation: the honest assembly vs the baked B(n)\nand vs the corrected (honest) Bn. Session 038 (ii\u2032-6-0, D-071).\n\nFindings preserved (user protocol step 8 \u2014 audit history):\n  F-A: the residue sum \u03bb_n(T) runs over BOTH signs of \u03b3 \u27f9 honest bridge\n       |\u03bb_n(T)| \u2264 4\u00b7FAlt(T); D-036/D-037/E-023's B(n) charges 2\u00b7FAlt\n       (factor-2 accounting slip; R-004 unaffected: \u226a margins).\n  F-B: I_III's near-sum needs the two-unit count (2/3)\u00b7Z2 vs baked\n       (2/3)\u0108\u2080 (D-069 Finding 2's predicted (4/3)-ish correction).\n  F-C: with the baked Bn the honest assembly overshoots for n \u2273 5\u00d710\u2077\n       (ratio 1.012 at 10\u00b9\u00b2); with the corrected Bn (4F, (2/3)Z2) the\n       fold is the identity (provable), and margin > 0 is preserved\n       with huge slack on the whole range [8\u00d710\u2074, N\u2081].\n\nChecks:\n  V1: baked-vs-honest ratio table (the F-C overshoot demonstration).\n  V2: corrected-Bn margin > 0 on a log grid over [8\u00d710\u2074, N\u2081], and\n      margin \u2265 baked margin at the certified base points (values improve).\n  V3: the horizontal segment-integral form \u2264 its baked share\n      (NI + 5.5\u00b7(10.5 log + 48) + 3.3 \u2264 7\u00b7Hhat + 3.3) on the grid.\n\"\"\"\nimport json\nimport sys\nfrom pathlib import Path\n\nimport mpmath as mp\n\nmp.mp.dps = 50\n\nDATA = Path(__file__).resolve().parent.parent / \"data\"\nCSV = DATA / \"E-030-honest-Bn-fold.csv\"\nJSON = DATA / \"E-030-honest-Bn-fold.json\"\n\npi, e = mp.pi, mp.e\n\n\ndef C0hat(t):\n    return mp.mpf(\"0.433\") * mp.log(t + 2) + mp.mpf(\"0.886\") * mp.log(mp.log(t + 2)) + mp.mpf(\"2.9\")\n\n\ndef Z2(t):\n    return mp.mpf(\"0.6\") * mp.log(t + 2) + mp.mpf(\"0.886\") * mp.log(mp.log(t + 2)) + mp.mpf(\"2.7\")\n\n\ndef FAlt(T):\n    return ((1 / (2 * pi)) * (T * mp.log(T)) + mp.mpf(\"0.137\") * mp.log(T)\n            + mp.mpf(\"0.443\") * mp.log(mp.log(T)) + (mp.mpf(7) / 8 + mp.mpf(\"1.588\")))\n\n\ndef Hhat(T):\n    return 3 * C0hat(T) ** 2 + mp.mpf(\"10.5\") * mp.log(T + 2) + 48\n\n\ndef IIMaj(n):\n    return 2 * (mp.sqrt(n) + 1) * (mp.e ** (mp.sqrt(n) / 2) + 1) * mp.mpf(\"0.57\") * 2 ** (-(2 * mp.sqrt(n) - 2))\n\n\ndef Bn_baked(n):\n    T = mp.sqrt(n) + 1\n    return (2 * FAlt(T) + 4 * T * ((mp.mpf(2) / 3) * C0hat(T) + mp.mpf(\"10.5\") * mp.log(T + 2) + 48)\n            + 40 * mp.mpf(\"1.3352\") + 2 * (e ** 4 + 1) * (7 * Hhat(T) + mp.mpf(\"3.3\")) + IIMaj(n) + 1)\n\n\ndef Bn_honest(n):\n    \"\"\"Corrected Bn: bridge 4F, I_III (2/3)Z2.\"\"\"\n    T = mp.sqrt(n) + 1\n    return (4 * FAlt(T) + 4 * T * ((mp.mpf(2) / 3) * Z2(T) + mp.mpf(\"10.5\") * mp.log(T + 2) + 48)\n            + 40 * mp.mpf(\"1.3352\") + 2 * (e ** 4 + 1) * (7 * Hhat(T) + mp.mpf(\"3.3\")) + IIMaj(n) + 1)\n\n\ndef honest_assembly(n):\n    \"\"\"The pieces the Lean assembly will actually prove (horizontal\n    segment-integral form; Finding-2-extended pigeonhole clearance).\"\"\"\n    T = mp.sqrt(n) + 1\n    a = mp.sqrt(n)\n    c = 1 / (9 * C0hat(a + 2))                # 3-unit pigeonhole clearance\n    NI = Z2(T) * 2 * mp.log(mp.mpf(\"16.5\") / c)  # near-sum integral on the horizontal\n    bridge = 4 * FAlt(T)\n    left = 4 * T * ((mp.mpf(2) / 3) * Z2(T) + mp.mpf(\"10.5\") * mp.log(T + 2) + 48)\n    horiz = 2 * (e ** 4 + 1) * (NI + mp.mpf(\"5.5\") * (mp.mpf(\"10.5\") * mp.log(T + 2) + 48) + mp.mpf(\"3.3\"))\n    return bridge + left + 40 * mp.mpf(\"1.3352\") + horiz + IIMaj(n) + 1, NI\n\n\ndef sInftyLower(n):\n    return mp.mpf(\"0.5\") * n * mp.log(n) + (mp.mpf(\"-1.41894\")) * n - 4\n\n\ndef main() -> int:\n    if JSON.exists() and \"--force\" not in sys.argv:\n        print(f\"cached: {JSON} (use --force to recompute)\")\n        return 0\n\n    rows = []\n    grid = [mp.mpf(10) ** 5, mp.mpf(\"1.2e5\"), mp.mpf(\"1.5e5\"), mp.mpf(\"2e5\"), mp.mpf(\"5e5\"),\n            mp.mpf(10) ** 6, mp.mpf(10) ** 7, mp.mpf(10) ** 8, mp.mpf(10) ** 9, mp.mpf(10) ** 10,\n            mp.mpf(10) ** 12, mp.mpf(10) ** 16, mp.mpf(10) ** 20, mp.mpf(\"9e24\")]\n    for n in grid:\n        h, NI = honest_assembly(n)\n        T = mp.sqrt(n) + 1\n        hbaked_share = 7 * Hhat(T) + mp.mpf(\"3.3\")\n        hinside = NI + mp.mpf(\"5.5\") * (mp.mpf(\"10.5\") * mp.log(T + 2) + 48) + mp.mpf(\"3.3\")\n        rows.append({\n            \"n\": mp.nstr(n, 8),\n            \"Bn_baked\": mp.nstr(Bn_baked(n), 12),\n            \"Bn_honest\": mp.nstr(Bn_honest(n), 12),\n            \"honest_assembly\": mp.nstr(h, 12),\n            \"assembly_over_baked\": mp.nstr(h / Bn_baked(n), 6),\n            \"assembly_over_honestBn\": mp.nstr(h / Bn_honest(n), 6),\n            \"horizIntegral_over_bakedShare\": mp.nstr(hinside / hbaked_share, 6),\n            \"margin_honestBn\": mp.nstr(sInftyLower(n) - Bn_honest(n) + 1, 12),\n            \"margin_bakedBn\": mp.nstr(sInftyLower(n) - Bn_baked(n) + 1, 12),\n        })\n\n    # V1: overshoot demonstration (baked)\n    v1 = any(mp.mpf(r[\"assembly_over_baked\"]) > 1 for r in rows)\n    # V2: margin with corrected Bn positive on the whole grid\n    v2 = all(mp.mpf(r[\"margin_honestBn\"]) > 0 for r in rows)\n    # V3: horizontal segment-integral fits under its baked share\n    v3 = all(mp.mpf(r[\"horizIntegral_over_bakedShare\"]) < 1 for r in rows)\n    # assembly always under the CORRECTED Bn (the fold works)\n    v4 = all(mp.mpf(r[\"assembly_over_honestBn\"]) < 1 for r in rows)\n\n    DATA.mkdir(exist_ok=True)\n    with CSV.open(\"w\") as f:\n        f.write(\",\".join(rows[0].keys()) + \"\\n\")\n        for r in rows:\n            f.write(\",\".join(r.values()) + \"\\n\")\n    sidecar = {\n        \"experiment\": \"E-030\",\n        \"title\": \"ii\u2032-6 design validation: honest assembly vs baked Bn and corrected Bn\",\n        \"session\": \"038 (ii\u2032-6-0)\",\n        \"design_doc\": \"D-071\",\n        \"checks\": {\"V1_baked_overshoot_present\": v1, \"V2_margin_honestBn_positive\": v2,\n                   \"V3_horizontal_integral_fits\": v3, \"V4_fold_under_corrected_Bn\": v4},\n        \"all_checks_pass\": v1 and v2 and v3 and v4,\n        \"dps\": 50,\n        \"notes\": \"F-A bridge factor-2 (both-signs), F-B I_III two-unit count, \"\n                 \"F-C baked Bn overshoot beyond ~5e7; corrected Bn (4F, (2/3)Z2) \"\n                 \"makes the fold the identity; margin positive everywhere.\",\n    }\n    with JSON.open(\"w\") as f:\n        json.dump(sidecar, f, indent=2)\n    print(f\"V1 overshoot present: {v1} | V2 margin>0: {v2} | V3 horiz fits: {v3} | V4 fold works: {v4}\")\n    print(f\"wrote {CSV} + {JSON}\")\n    return 0 if sidecar[\"all_checks_pass\"] else 1\n\n\nif __name__ == \"__main__\":\n    sys.exit(main())\n"
}
raw content_json (database row)
[{"type":"thinking","thinking":"The Bn change touches:\n1. `Bn` def (line 2413): 2F → 4F, (2/3)Ĉ₀ → (2/3)Z2.\n2. `marginTilde` def (line 754): same expression duplicated — must change in lockstep.\n3. `marginExpanded` blocks (mFblock etc., ~line 1819-1830): the block decomposition used by marginTilde_convex via marginTilde_eq_expanded — the mK constant (with (2/3)·2.9? no — mK := −40·1.3352 − 2(e⁴+1)(7(3·2.9²+48)+3.3) − 1 + 1: the constant blocks; the (2/3)Ĉ₀ block becomes (2/3)Z2 — Z2 = 0.6L+0.886LL+2.7 vs Ĉ₀ = 0.433L+0.886LL+2.9: the block decomposition changes (the 4T·(2/3)·(0.6L) vs 4T·(2/3)(0.433L) coefficients + the constant 2.7 vs 2.9 in mK? mK doesn't include the I_III constant... mK = −40M₀ − 2(e⁴+1)(7(3·2.9²+48)+3.3) − 1 + 1 — the \"3·2.9²\" is Hhat's constant part (3C₀² with C₀'s constant 2.9)... the I_III block's constant 4T·(2/3)·2.9 → 4T·(2/3)·2.7 — mK would change? mK is the constant gatherer for marginExpanded — need to see the block definitions to know. And 2F → 4F: the mFblock coefficient.\n4. marginTilde_eq_expanded (the bookkeeping simp proof — re-run).\n5. marginTilde_convex (the ψ-table — the changed blocks' rows re-proved).\n6. marginTilde_eq_sub (bookkeeping — re-run).\n7. LiBasePoints: marginTilde_FAlt_80000_pos + marginTilde_FAlt_80000_lt_100000 (re-certify with rational intervals — values improve).\n8. lambda_pos_finite_height_verified (consumes the above — its statement is Bn-independent ✓ but its proof passes through the changed pieces — re-check).\n\nAlso Z2 needs a Lean def (the two-unit count bound form — currently inline in ZeroCountProp2's statement). Define `Z2hat (t : ℝ) : ℝ := 0.6 * Real.log (t + 2) + 0.886 * Real.log (Real.log (t + 2)) + 2.7` in LiContour (where ZeroCountProp2 lives) or in LiSkeleton near C0hat. Better: LiSkeleton next to C0hat (used by Bn) — but ZeroCountProp2 (LiContour) should then be restated with Z2hat for consistency... LiContour is a proved file — editing ZeroCountProp2's statement would break its consumers (5f capstone). DON'T touch ZeroCountProp2; just define Z2hat in LiSkeleton (or LiContour without changing the Prop) and note the definitional equality.\n\nThis is ii′-6-a (next sub-stage). For NOW (this session's tail), produce:\n1. **D-071** (the ii′-6 design doc): the two findings, the user approvals (verbatim 8-step protocol), the numerical validation (E-030), the honest-Bn definition, the affected-declarations map, the sub-stage map ii′-6-a..e, the perimeter formalizations (ZeroCountGlobalProp + MZeroProp statements), the sides-identity/bridge/extended-pigeonhole/segment-integral component designs.\n2. **E-030** (the numerical validation script + data + db registration).\n3. Journal/STATE/NGUYEN updates + commit (clean boundary).\n\nLet me write the E-030 script first (deterministic, cached), run it to produce CSV+JSON, then D-071, then archive updates + commit.","signature":""},{"type":"text","text":"Plan set. Producing E-030 (the preserved numerical validation, step 8 of your protocol), then D-071."},{"type":"tool_use","id":"Write_184","name":"Write","input":{"file_path":"D:\\Python\\Quantum\\research\\numerics\\scripts\\E-030-honest-Bn-fold.py","content":"#!/usr/bin/env python3\n\"\"\"E-030 — ii′-6 design validation: the honest assembly vs the baked B(n)\nand vs the corrected (honest) Bn. Session 038 (ii′-6-0, D-071).\n\nFindings preserved (user protocol step 8 — audit history):\n  F-A: the residue sum λ_n(T) runs over BOTH signs of γ ⟹ honest bridge\n       |λ_n(T)| ≤ 4·FAlt(T); D-036/D-037/E-023's B(n) charges 2·FAlt\n       (factor-2 accounting slip; R-004 unaffected: ≪ margins).\n  F-B: I_III's near-sum needs the two-unit count (2/3)·Z2 vs baked\n       (2/3)Ĉ₀ (D-069 Finding 2's predicted (4/3)-ish correction).\n  F-C: with the baked Bn the honest assembly overshoots for n ≳ 5×10⁷\n       (ratio 1.012 at 10¹²); with the corrected Bn (4F, (2/3)Z2) the\n       fold is the identity (provable), and margin > 0 is preserved\n       with huge slack on the whole range [8×10⁴, N₁].\n\nChecks:\n  V1: baked-vs-honest ratio table (the F-C overshoot demonstration).\n  V2: corrected-Bn margin > 0 on a log grid over [8×10⁴, N₁], and\n      margin ≥ baked margin at the certified base points (values improve).\n  V3: the horizontal segment-integral form ≤ its baked share\n      (NI + 5.5·(10.5 log + 48) + 3.3 ≤ 7·Hhat + 3.3) on the grid.\n\"\"\"\nimport json\nimport sys\nfrom pathlib import Path\n\nimport mpmath as mp\n\nmp.mp.dps = 50\n\nDATA = Path(__file__).resolve().parent.parent / \"data\"\nCSV = DATA / \"E-030-honest-Bn-fold.csv\"\nJSON = DATA / \"E-030-honest-Bn-fold.json\"\n\npi, e = mp.pi, mp.e\n\n\ndef C0hat(t):\n    return mp.mpf(\"0.433\") * mp.log(t + 2) + mp.mpf(\"0.886\") * mp.log(mp.log(t + 2)) + mp.mpf(\"2.9\")\n\n\ndef Z2(t):\n    return mp.mpf(\"0.6\") * mp.log(t + 2) + mp.mpf(\"0.886\") * mp.log(mp.log(t + 2)) + mp.mpf(\"2.7\")\n\n\ndef FAlt(T):\n    return ((1 / (2 * pi)) * (T * mp.log(T)) + mp.mpf(\"0.137\") * mp.log(T)\n            + mp.mpf(\"0.443\") * mp.log(mp.log(T)) + (mp.mpf(7) / 8 + mp.mpf(\"1.588\")))\n\n\ndef Hhat(T):\n    return 3 * C0hat(T) ** 2 + mp.mpf(\"10.5\") * mp.log(T + 2) + 48\n\n\ndef IIMaj(n):\n    return 2 * (mp.sqrt(n) + 1) * (mp.e ** (mp.sqrt(n) / 2) + 1) * mp.mpf(\"0.57\") * 2 ** (-(2 * mp.sqrt(n) - 2))\n\n\ndef Bn_baked(n):\n    T = mp.sqrt(n) + 1\n    return (2 * FAlt(T) + 4 * T * ((mp.mpf(2) / 3) * C0hat(T) + mp.mpf(\"10.5\") * mp.log(T + 2) + 48)\n            + 40 * mp.mpf(\"1.3352\") + 2 * (e ** 4 + 1) * (7 * Hhat(T) + mp.mpf(\"3.3\")) + IIMaj(n) + 1)\n\n\ndef Bn_honest(n):\n    \"\"\"Corrected Bn: bridge 4F, I_III (2/3)Z2.\"\"\"\n    T = mp.sqrt(n) + 1\n    return (4 * FAlt(T) + 4 * T * ((mp.mpf(2) / 3) * Z2(T) + mp.mpf(\"10.5\") * mp.log(T + 2) + 48)\n            + 40 * mp.mpf(\"1.3352\") + 2 * (e ** 4 + 1) * (7 * Hhat(T) + mp.mpf(\"3.3\")) + IIMaj(n) + 1)\n\n\ndef honest_assembly(n):\n    \"\"\"The pieces the Lean assembly will actually prove (horizontal\n    segment-integral form; Finding-2-extended pigeonhole clearance).\"\"\"\n    T = mp.sqrt(n) + 1\n    a = mp.sqrt(n)\n    c = 1 / (9 * C0hat(a + 2))                # 3-unit pigeonhole clearance\n    NI = Z2(T) * 2 * mp.log(mp.mpf(\"16.5\") / c)  # near-sum integral on the horizontal\n    bridge = 4 * FAlt(T)\n    left = 4 * T * ((mp.mpf(2) / 3) * Z2(T) + mp.mpf(\"10.5\") * mp.log(T + 2) + 48)\n    horiz = 2 * (e ** 4 + 1) * (NI + mp.mpf(\"5.5\") * (mp.mpf(\"10.5\") * mp.log(T + 2) + 48) + mp.mpf(\"3.3\"))\n    return bridge + left + 40 * mp.mpf(\"1.3352\") + horiz + IIMaj(n) + 1, NI\n\n\ndef sInftyLower(n):\n    return mp.mpf(\"0.5\") * n * mp.log(n) + (mp.mpf(\"-1.41894\")) * n - 4\n\n\ndef main() -> int:\n    if JSON.exists() and \"--force\" not in sys.argv:\n        print(f\"cached: {JSON} (use --force to recompute)\")\n        return 0\n\n    rows = []\n    grid = [mp.mpf(10) ** 5, mp.mpf(\"1.2e5\"), mp.mpf(\"1.5e5\"), mp.mpf(\"2e5\"), mp.mpf(\"5e5\"),\n            mp.mpf(10) ** 6, mp.mpf(10) ** 7, mp.mpf(10) ** 8, mp.mpf(10) ** 9, mp.mpf(10) ** 10,\n            mp.mpf(10) ** 12, mp.mpf(10) ** 16, mp.mpf(10) ** 20, mp.mpf(\"9e24\")]\n    for n in grid:\n        h, NI = honest_assembly(n)\n        T = mp.sqrt(n) + 1\n        hbaked_share = 7 * Hhat(T) + mp.mpf(\"3.3\")\n        hinside = NI + mp.mpf(\"5.5\") * (mp.mpf(\"10.5\") * mp.log(T + 2) + 48) + mp.mpf(\"3.3\")\n        rows.append({\n            \"n\": mp.nstr(n, 8),\n            \"Bn_baked\": mp.nstr(Bn_baked(n), 12),\n            \"Bn_honest\": mp.nstr(Bn_honest(n), 12),\n            \"honest_assembly\": mp.nstr(h, 12),\n            \"assembly_over_baked\": mp.nstr(h / Bn_baked(n), 6),\n            \"assembly_over_honestBn\": mp.nstr(h / Bn_honest(n), 6),\n            \"horizIntegral_over_bakedShare\": mp.nstr(hinside / hbaked_share, 6),\n            \"margin_honestBn\": mp.nstr(sInftyLower(n) - Bn_honest(n) + 1, 12),\n            \"margin_bakedBn\": mp.nstr(sInftyLower(n) - Bn_baked(n) + 1, 12),\n        })\n\n    # V1: overshoot demonstration (baked)\n    v1 = any(mp.mpf(r[\"assembly_over_baked\"]) > 1 for r in rows)\n    # V2: margin with corrected Bn positive on the whole grid\n    v2 = all(mp.mpf(r[\"margin_honestBn\"]) > 0 for r in rows)\n    # V3: horizontal segment-integral fits under its baked share\n    v3 = all(mp.mpf(r[\"horizIntegral_over_bakedShare\"]) < 1 for r in rows)\n    # assembly always under the CORRECTED Bn (the fold works)\n    v4 = all(mp.mpf(r[\"assembly_over_honestBn\"]) < 1 for r in rows)\n\n    DATA.mkdir(exist_ok=True)\n    with CSV.open(\"w\") as f:\n        f.write(\",\".join(rows[0].keys()) + \"\\n\")\n        for r in rows:\n            f.write(\",\".join(r.values()) + \"\\n\")\n    sidecar = {\n        \"experiment\": \"E-030\",\n        \"title\": \"ii′-6 design validation: honest assembly vs baked Bn and corrected Bn\",\n        \"session\": \"038 (ii′-6-0)\",\n        \"design_doc\": \"D-071\",\n        \"checks\": {\"V1_baked_overshoot_present\": v1, \"V2_margin_honestBn_positive\": v2,\n                   \"V3_horizontal_integral_fits\": v3, \"V4_fold_under_corrected_Bn\": v4},\n        \"all_checks_pass\": v1 and v2 and v3 and v4,\n        \"dps\": 50,\n        \"notes\": \"F-A bridge factor-2 (both-signs), F-B I_III two-unit count, \"\n                 \"F-C baked Bn overshoot beyond ~5e7; corrected Bn (4F, (2/3)Z2) \"\n                 \"makes the fold the identity; margin positive everywhere.\",\n    }\n    with JSON.open(\"w\") as f:\n        json.dump(sidecar, f, indent=2)\n    print(f\"V1 overshoot present: {v1} | V2 margin>0: {v2} | V3 horiz fits: {v3} | V4 fold works: {v4}\")\n    print(f\"wrote {CSV} + {JSON}\")\n    return 0 if sidecar[\"all_checks_pass\"] else 1\n\n\nif __name__ == \"__main__\":\n    sys.exit(main())\n"},"extra_content":null}]