Skip to content

fix(lean,#8869): rewrite ceilLog2 via Nat.log 2 — root cause of Computation native_decide - #9536

Merged
jsboige merged 1 commit into
mainfrom
fix/conway-ceilllog2-decide-reducible-8869
Aug 5, 2026
Merged

jsboige merged 1 commit into
mainfrom
fix/conway-ceilllog2-decide-reducible-8869

Conversation

@jsboige

@jsboige jsboige commented Aug 5, 2026

Copy link
Copy Markdown
Owner

fix(lean,#8869): rewrite ceilLog2 via Nat.log 2 — root cause of Computation.lean native_decide

Grain: MED/lean — lane myia-po-2026:CoursIA — executes ai-01's #8869 bounded probe (msg-165936). See #8869.

Root cause (empirical, firsthand, sub-expression bisect)

The 14-15 native_decide theorems in Computation.lean were NOT intrinsically native. The single stuck point is MacroCell.ceilLog2, which recursed on (k+2+1)/2 — not structurally smaller → Lean compiles WellFounded recursion → opaque to the kernel reducer → decide cannot evaluate it → gridFrame lvl stuck → buildFromGrid/toGrid/evolveHashlife all stuck downstream.

Sub-expression bisect (kernel decide, worktree CoursIA-8869, Mathlib rc1 d568c8c0 warm):

  • gridRowMin/Max block (Int foldl min/max): reduce ✓
  • gridFrame's Int arithmetic — rMin-2 (Int.sub), rMax-rMin+5 (Int.add), .toNat: all reduce ✓ (my earlier c.843 "Int obstruction" was wrong — retracted)
  • MacroCell.ceilLog2 6 = 3: FAILS — even ceilLog2 2 = 1 (one recursion step), even with maxRecDepth 1000000. WF-opacity, not depth.
  • Nat.log 2 (Mathlib, structural): reduces ✓

The fix (body-only, same signature, same values)

def ceilLog2 (k : Nat) : Nat :=
  if k ≤ 1 then 0 else Nat.log 2 (k - 1) + 1

Same function (values invariant for all k: 0,1→0; 2→1; 3,4→2; 5,6,7,8→3; 9..16→4 …), so ceilLog2_spec (statement unchanged: 2 ^ ceilLog2 k ≥ k) is re-proved via Mathlib's Nat.lt_pow_succ_log_self + omega. No sorry, no axiom, no signature change. Downstream ceilLog2_ge_three_of_ge_five and the HashlifeCorrectness proofs use ceilLog2_spec as a black box — unaffected (lake build SUCCESS on MacroCell + Computation + HashlifeCorrectness verified).

Measurement (ai-01's acceptance: ≥7/15 = real path)

Re-stated all 15 native_decide theorems with by decide in a probe module: 15/15 PASS (lake build Conway.Life.Probe8869Measure Build completed successfully, 0 decide failures). The ceilLog2 rewrite flips every theorem — decisively validates the path (≥7 criterion met at 100 %).

Scope of THIS PR (root fix only)

This PR lands the MacroCell.lean ceilLog2 rewrite only (+24/−17, body + spec re-proof). It does NOT flip the Computation.lean theorems (native_decide → decide) nor touch the proof-integrity gate — those are a follow-up PR because:

  1. Build perf: kernel decide is slower than native_decide; the probe module built in ~123 s. Flipping the 15 theorems needs a build-time evaluation to avoid CI timeouts (the original native_decide choice may have been for perf, now that the obstruction is lifted both options are viable — a deliberate choice, not a drive-by).
  2. Gate impact: flipping removes 15 ._native.native_decide.ax_1_1 from the audit allow-list + the len(names)==46 pin — ai-01's CI-revelation procedure + gate turf.

This PR is safe standalone: the rewrite improves ceilLog2 reducibility with no observable change to existing proofs (they still use native_decide, still pass). It enables the follow-up.

Overturns the gridFrame Nat-indexing prescription

ai-01's msg-165936 prescribed Nat-indexing gridFrame. The probe proves the obstruction is one layer deeper (ceilLog2), and gridFrame's Int arithmetic already reduces. The fix is a 1-line body rewrite, not a layer-wide refactor. Reported to ai-01 (DM msg-...222331); this PR is the verified root fix the measurement points to.

Lean CI discipline §B

  • grep -c sorry unchanged (0 in MacroCell; the 9 in HashlifeCorrectness untouched).
  • lake build Conway.Life.MacroCell SUCCESS, Conway.Life.Computation SUCCESS, Conway.Life.HashlifeCorrectness SUCCESS (downstream).
  • No axiom added (one removed-from-TCB opportunity — the 15 native_decide axioms become removable in the follow-up, not here).

See #8869 (partial — root fix; theorem-flip + gate cleanup follow-up pending ai-01 sanction + perf eval).

🤖 Generated with Claude Code

…_decide)

ceilLog2 recursed on (k+2+1)/2 — not structurally smaller, so Lean compiled
WellFounded recursion, making the def opaque to the kernel reducer. decide
could not evaluate it, so gridFrame lvl stuck, blocking the entire
buildFromGrid/toGrid/evolveHashlife chain (the 14-15 Computation.lean
coherence theorems were native_decide by symptom, not intrinsic).

Rewrite the body via Nat.log 2 (Mathlib structural recursion, kernel-reducible):
  ceilLog2 k = if k <= 1 then 0 else Nat.log 2 (k-1) + 1
Same function (values invariant), ceilLog2_spec statement unchanged, re-proved
via Nat.lt_pow_succ_log_self + omega. No sorry, no axiom, no signature change.

Measurement: all 15 native_decide theorems flip to decide-reducible (15/15
PASS in Probe8869Measure). Far exceeds ai-01's >=7/15 criterion. Overturns the
gridFrame Nat-indexing prescription (probe shows gridFrame Int arithmetic
already reduces; the obstruction is ceilLog2, one layer deeper).

Verified builds: Conway.Life.MacroCell, Conway.Life.Computation,
Conway.Life.HashlifeCorrectness (downstream gate incl. 9 acknowledged sorries).
grep -c sorry unchanged in HashlifeCorrectness.

See #8869 (root fix; theorem-flip + gate cleanup follow-up pending).

Co-Authored-By: Claude <noreply@anthropic.com>
@jsboige
jsboige merged commit 17f8e7b into main Aug 5, 2026
15 checks passed
jsboige added a commit that referenced this pull request Aug 5, 2026
…ing (#9548)

Grain: MED/lean — lane myia-ai-01:CoursIA — prev: DEEP/lean #9539

#9536 rewrote ceilLog2 via Nat.log 2 in MacroCell.lean (FR) but left the
_en sibling on the old WellFounded recursion — an i18n DRIFT that turned
'Scripts Tests (CPU)' red on main for every PR (seen on #9541/#9543).

- Port def ceilLog2 + ceilLog2_spec proof to the EN sibling (byte-identical
  code, EN docstrings/comments per sibling-pair Pattern A).
- lake build Conway.Life.MacroCell_en: SUCCESS (2947 jobs), EXIT=0.
- check_i18n_siblings.py --all: 177/179 byte-identical, 0 drift, 0 orphan.

Co-authored-by: Claude-Code <noreply@anthropic.com>
jsboige added a commit that referenced this pull request Aug 6, 2026
…ewrite false docstrings

After #9536 (ceilLog2 rewrite via Nat.log 2, merged), the 18 hashlife/
evolution theorems in Computation.lean + Computation_en.lean flip from
native_decide to kernel decide.

Verified: 0 decide failures, 133-149s cold build (18 kernel proofs, warm
imports), 7s incremental. Removes the native_decide axioms from the TCB
for these decls. FR+EN siblings flipped together (proof byte-identity).

Per ai-01 msg-...232021/...232153 (GO): the per-theorem docstrings and the
4 "### Pourquoi native_decide" prose blocks claimed native_decide was
"required: not reducible by decide" due to an INTRINSIC MacroCell/Int
opacity (diagnosis c.8126/#8749, now REFUTED by #9536's ceilLog2 root
cause). Those docstrings became FALSE after the flip — rewritten to state
decide-reducibility and cite the ceilLog2 root cause (#9536, sub-expression
bisect c.847). 0 proof lines touched (only docstrings/prose).

See #8869

Co-Authored-By: Claude <noreply@anthropic.com>
jsboige added a commit that referenced this pull request Aug 6, 2026
…ewrite false docstrings

After #9536 (ceilLog2 rewrite via Nat.log 2, merged), the 18 hashlife/
evolution theorems in Computation.lean + Computation_en.lean flip from
native_decide to kernel decide.

Verified: 0 decide failures, 133-149s cold build (18 kernel proofs, warm
imports), 7s incremental. Removes the native_decide axioms from the TCB
for these decls. FR+EN siblings flipped together (proof byte-identity).

Per ai-01 msg-...232021/...232153 (GO): the per-theorem docstrings and the
4 "### Pourquoi native_decide" prose blocks claimed native_decide was
"required: not reducible by decide" due to an INTRINSIC MacroCell/Int
opacity (diagnosis c.8126/#8749, now REFUTED by #9536's ceilLog2 root
cause). Those docstrings became FALSE after the flip — rewritten to state
decide-reducibility and cite the ceilLog2 root cause (#9536, sub-expression
bisect c.847). 0 proof lines touched (only docstrings/prose).

See #8869

Co-Authored-By: Claude <noreply@anthropic.com>
jsboige added a commit that referenced this pull request Aug 6, 2026
…ewrite false docstrings

After #9536 (ceilLog2 rewrite via Nat.log 2, merged), the 18 hashlife/
evolution theorems in Computation.lean + Computation_en.lean flip from
native_decide to kernel decide.

Verified: 0 decide failures, 133-149s cold build (18 kernel proofs, warm
imports), 7s incremental. Removes the native_decide axioms from the TCB
for these decls. FR+EN siblings flipped together (proof byte-identity).

Per ai-01 msg-...232021/...232153 (GO): the per-theorem docstrings and the
4 "### Pourquoi native_decide" prose blocks claimed native_decide was
"required: not reducible by decide" due to an INTRINSIC MacroCell/Int
opacity (diagnosis c.8126/#8749, now REFUTED by #9536's ceilLog2 root
cause). Those docstrings became FALSE after the flip — rewritten to state
decide-reducibility and cite the ceilLog2 root cause (#9536, sub-expression
bisect c.847). 0 proof lines touched (only docstrings/prose).

See #8869

Co-Authored-By: Claude <noreply@anthropic.com>
jsboige added a commit that referenced this pull request Aug 6, 2026
…ewrite false docstrings (#9544)

After #9536 (ceilLog2 rewrite via Nat.log 2, merged), the 18 hashlife/
evolution theorems in Computation.lean + Computation_en.lean flip from
native_decide to kernel decide.

Verified: 0 decide failures, 133-149s cold build (18 kernel proofs, warm
imports), 7s incremental. Removes the native_decide axioms from the TCB
for these decls. FR+EN siblings flipped together (proof byte-identity).

Per ai-01 msg-...232021/...232153 (GO): the per-theorem docstrings and the
4 "### Pourquoi native_decide" prose blocks claimed native_decide was
"required: not reducible by decide" due to an INTRINSIC MacroCell/Int
opacity (diagnosis c.8126/#8749, now REFUTED by #9536's ceilLog2 root
cause). Those docstrings became FALSE after the flip — rewritten to state
decide-reducibility and cite the ceilLog2 root cause (#9536, sub-expression
bisect c.847). 0 proof lines touched (only docstrings/prose).

See #8869

Co-authored-by: Claude <noreply@anthropic.com>
jsboige added a commit that referenced this pull request Aug 6, 2026
…e (5/7) (#9571)

Flip 5 still-life theorems (loaf, boat, tub, pond, ship) from
native_decide to kernel decide in Oscillators.lean + Oscillators_en.lean.
Removes 5 native_decide axioms from the TCB (kernel-verified, zero axiom).

2 theorems remain native_decide per c.91 budget rule (measured firsthand):
- pulsar_period_three: decide kernel FAILS (maxRecDepth reached, L178:65)
- pentadecathlon_period_15: period-15 reduction strictly harder than
  pulsar (period 3) which already exceeds maxRecDepth; retained.

Docstrings rewritten (4 prose blocks FR+EN) per the c.91 per-flip rule:
the "native_decide requis / borderline" taglines become false post-flip.
The stale "theorems commented out pending verification" (FALSE: they are
active) corrected to document the maxRecDepth verdict + native-axiom cost.

allow-list trimmed (lean-conway.yml L185): 5 still-life native_decide
axioms removed. Oscillators IS in proof-integrity-audit target-modules
(unlike Computation) so the trim is required in the same PR (c.91 point 3).
pulsar + pentadecathlon RETAINED. Derived firsthand from the current list.

Build: lake build Conway.Life.Oscillators Oscillators_en EXIT=0, 30s
(warm Mathlib). First attempt (6 flipped) FAILED at pulsar maxRecDepth
after 44s; reverting pulsar -> 5 still-lifes compile cleanly.

Pre-authorized per ai-01 c.91 (msg-192021: Oscillators/Spaceships/RLE
one module per PR).

See #8869, See #9536

Co-authored-by: Claude <noreply@anthropic.com>
@jsboige
jsboige deleted the fix/conway-ceilllog2-decide-reducible-8869 branch September 2, 2026 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant