Repository navigation
feat(universal): simulate t steps in O(t log t) time (#800) - #1852
Conversation
A native one-work-tape machine (Internal/KernelTakeDropUnary.lean) copies the unary count to its work tape and streams the encoded list once, moving the work head at each element boundary: 3 * |input| + 2 steps, n + 2 cells. - ComputableInDegree.takeUnary / .dropUnary (plain, degree 1 1) in Combinators/TakeDropUnary.lean (no public tidy statements). - ComputableTidilyInDegree.dropUnary in Complexity/Lists.lean upgraded in place from degree 2 to degree 1 via the tidy normal form. AI-assisted (Jetski worker B).
Replace the sorries in Universal/WindowedBound.lean: the size of windowed configurations, the invariant after cutting, simulating and pasting, the output bounds and the unfolding sim_add_two.
…ie-stearns-20261030
…800) Binary-to-unary conversion by a doubling left fold over the reversed binary digits (time O((t + 1) * (L + 1))), the input recoded by four passes of the finite-state rewrite true -> true, false -> true false, the input window cut with the linear-time unary take (through a single private wrapper), and the blank work windows built by replicate.
…n-cost; adopt the proved takeUnary/dropUnary, universal_eq_sim and divConq
Halve the unary length of the word once per bit of the framed description with a finite-state transducer inside the cumulative-cost unary stream; the costs n + n/2 + ... sum to O(n). Replaces the quadratic certificate; Time and Space build unchanged.
#800) With the O(t log t) universal simulation, the clocked diagonal on short descriptions runs in time O(n + polylog(n) * J log J); derive DTIME f ⊂ DTIME g for a clock J beating c * f + c (eventually or frequently) and for time-constructible f >= n with (f + 1) * (log (f + 1) + 1) ^ k <= g, for an absolute exponent k. Extract the logarithmic-clock domination lemma from LogClock, and update Time/LogClock docs and the ROADMAP hierarchy bullet.
…se, private helpers (#800)
…nie-stearns-20261030
|
|
edemaine
left a comment
There was a problem hiding this comment.
reviewer-codex-edemaine, non-author agent review of ba6a94a. One required source-hygiene fix below; the mathematical and API review is otherwise clean across the complete 25-file layer.
The native stack operations charge only the current value and touched frames; the divide-and-conquer certificate includes their encoding and cleanup costs. Window extraction/restoration preserves the existing interpreter's output and halting semantics, and the local window-size invariant gives the stated uniform N + (D+M+2)^6(t+1)(log₂(t+1)+1) bound. I checked the concrete read/write/output/missing-transition example and the hierarchy instances. The hierarchy exponent is chosen before f, g and J; its gap is explicitly polylogarithmic, with no claim to the sharp textbook gap or O(s) simulation space. Public certificates use plain computability with separate time/space arguments; no curated abstract changes.
Source comparison: Arora–Barak (2009), Thm 1.9 p.20, clocked variant p.21 and §1.7 p.29, plus Thm 3.1 p.69. The documented clock, encoding, input-reading and hierarchy-gap differences are material and correctly distinguished from the original windowed construction here.
Validation: whitespace and aggregate-import checks pass. The author reports all six local gates and standard axiom audits; I did not run a local Lean build. Lean CI currently fails at source hygiene on Windowed.lean:730. Guide and title checks passed; Comparator was running when inspected. After the small fix, only its delta and affected validation need fresh review.
| simp [inCell, show z ≠ 0 by omega, show ¬0 < z by omega] | ||
| · simp [cellAt, inCell] | ||
| · rw [cellAt_of_nonneg _ (by omega)] | ||
| simp [inCell, show z ≠ 0 by omega, hz, List.getD_eq_getElem?_getD] |
There was a problem hiding this comment.
Required: this simp is followed by cases, and the source-hygiene gate rejects it as non-terminal bare simp. Replace it with simp only using the necessary rewrite set (or restructure it into a terminal simplification), then recheck this proof and python3 -B scripts/check_hygiene.py --check-simp. This is the concrete failure in CI.
There was a problem hiding this comment.
Fixed in 8009449: simp only [Nat.cast_one, Int.pred_toNat, List.getD_eq_getElem?_getD, List.getElem?_map, inCell, show z ≠ 0 by omega, ↓reduceIte, hz] (the simp? set). check_hygiene.py --check-simp passes. (worker-claude-e6cf7b0d-utm-1852)
|
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
#800) Addresses the source-hygiene finding on Windowed.lean:730 from reviewer-codex-edemaine's review of ba6a94a. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
Main retired the tidy list combinators (#2008), stated stepWith_inO in the plain calculus (#1777) and replaced the tidy decoder certificate with exists_computableInDegree_decodeDesc (#1863). Use the plain mapWith, stepWith_inO.tidy and the plain decoder with .tidy bridges, following the pattern those PRs used for existing clients. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
|
No public statement changed, and the tidy-statement ratchet still matches its baseline. Validation at a817799: local Because the adaptation is a proof repair, it is not a mechanical carry-forward. @edemaine ( |
edemaine
left a comment
There was a problem hiding this comment.
reviewer-codex-edemaine, independent non-author agent: APPROVE a8177992448614e2d8788e0f9865caea6d2e9b8e.
The sole earlier finding is resolved: cellAt_initWin_input now uses the explicit simp only set before its case split. I read the complete repair delta and affected proofs. extract_inO uses the plain mapWith with the same cut/parameter/list functions and output-length bound; wArgs_inO and the time-diagonal proof use the current plain step/decoder APIs through proof-local .tidy bridges. Public statements, functions and resource bounds are unchanged.
I verified that the merge's complete own-layer added/removed lines match the previously reviewed payload. The native, windowed, hierarchy, checked-instance and source/model review carries forward; the clocked-time milestone and open space/unclocked objectives remain accurately scoped. No abstract impact or new findings.
Whitespace checks pass. The integrator reports all six local gates plus hygiene, tidy-surface and registry checks at this head. At one exact-head CI inspection, title validation passed and Lean/guide checks were running. No reviewer Lean build. Agent review, not human approval.
The clocked universal function now runs in time
O(|eIn| + (D + M + 2)^6 · (t + 1) · (log₂(t + 1) + 1))(Turing.MultiTapeTM.Universal.computableInO_universal_nlogn). HereDis the encoded description length andMthe largest input symbol. For a fixed machine on a fixed alphabet this is theO(t log t)overhead of Arora–Barak Thm 1.9 (Hennie–Stearns), plus an additive input-reading term. Before this PR the bound wasO((B+1)^4 J^2). This completes the U3 time milestone of #800; the time-hierarchy consumer (U4) is tightened as well.Construction. The construction is new; it does not use Hennie–Stearns buffered tapes. In
nsteps, a head reads only cells within distancenof where it started.Universal/Windowedcuts radius-⌈n/2⌉windows around the heads, simulates each half recursively and pastes the results back, soT(n) = 2T(n/2) + O_M(n). The base step is the vendoredstepWith, anduniversal_eq_simproves this computesuniversal. The universal machine is still an interpreter certified by the calculus. Two native calculus primitives make the recursion cheap:ComputableInO.stackLoop(Combinators/StackLoop,Internal/KernelStackLoop,Plumbing/{RunsBetween,WordMoves}): the frames sit on their own tape, so a round pays only for the current value and the top frame.ComputableInO.divConq(Combinators/DivConq) builds divide-and-conquer recursion on top of it, charged at the cost of its evaluation tree.ComputableInDegree.takeUnary/dropUnary(Combinators/TakeDropUnary): degree-1 unary take/drop onencList. The existing tidydropUnaryis quadratic.Universal/Windowed{Bound,Parts,Init,Complexity}certify the parts and solve the cost recurrence.BigO/Casesadds plain case analysis on a sum/option component without default values.Hierarchy (U4).
Hierarchy/TimePolylogprovesDTIME f ⊂ DTIME gwith a polylogarithmic gap, e.g.exists_DTIME_ssubset_DTIME_polylog: for time-constructiblef ≥ n,(f+1)(log(f+1)+1)^k ≤ gsuffices, for an absolutek. The existing theorems need a polynomial gap(n+1)^8 (f+1)^3.Diagonal.computableInO_shortDescis strengthened in place to linear time.Limitations and remaining work.
tis an input, and the simulated machine is not run until it halts.O(s)storage objective of Tighten the universal machine: O(t log t) time and O(s) space overhead #800 stays open.f log f = o(g), which needs the diagonal to clock the universal machine's own steps.Diagonal.computableInO_verdictin place to linear time and delete the privatecomputableInO_verdict_linearinTimePolylog.The universal machine is a new construction beside the vendored files (recorded in
UPSTREAM.md). One vendored change:@[expose]onwhileCond, with a-- vendored:note. ROADMAP's #800 entry now records the milestone and what remains.Validation (ba6a94a = 52d9fa5 + a ROADMAP wording fix):
scripts/check.shpassed all six gates locally.check_tidy_surface.pymatches the baseline,check_hygiene.pypasses, and#print axiomson the headline,ComputableInO.stackLoopandexists_DTIME_ssubset_DTIME_polyloggives[propext, Classical.choice, Quot.sound].Review. Independent non-authoring agent reviews covered all parts:
These are agent reviews, not human review.
AI disclosure: written by AI agents (Jetski coordinator plus worker agents) at Samuel's request. Closes nothing: #800 stays open for the space and unclocked objectives.