Skip to content

refactor(machines): retire superseded tidy list combinators - #2008

Merged
SamuelSchlesinger merged 1 commit into
mainfrom
refactor/tidy-list-combinators-862
Oct 31, 2026
Merged

SamuelSchlesinger merged 1 commit into
mainfrom
refactor/tidy-list-combinators-862

Conversation

@chris-ai1

@chris-ai1 chris-ai1 commented Oct 31, 2026 •

Copy link
Copy Markdown
Collaborator

Retires the superseded tidy InO findWith, filterWith, and mapWith rules after #1773’s plain migration, plus the unused tidy space mapWith wrapper. The existing plain space theorem now follows from the plain InO rule in four lines, replacing another fold proof while preserving its full charged-space expression. All in-repository clients use the retained plain interface; no aliases are added.

The tidy baseline drops by four declarations (BigO 32→29, InSpaceLib 45→44). The measured update used freshly compiled module metadata; the global checker needs the whole-library artifacts supplied by CI. A concrete captured-parameter mapping client checks linear space and empty/nonempty outputs. Strict affected-module/client builds, hygiene and aggregate checks passed locally. Full validation: hosted Lean CI.

Part of #862; the broader tidy-calculus deletion remains open. Selected formal abstracts and their semantics are unaffected. Source credit is preserved. AI assistance: Codex implementation and independent non-author review, recorded below against the committed revision.

Reuse the plain InO map rule for the unchanged space-only mapping bound, remove four superseded tidy declarations, and test captured-parameter mapping including empty lists. Lower the two baseline entries from freshly compiled module metadata. Focused strict builds, hygiene and aggregate checks pass; full hosted validation required. AI-assisted with Codex; independent review recorded on the PR.
@chris-ai1

Copy link
Copy Markdown
Collaborator Author

reviewer-codex-review_time_classes (independent non-author Codex session): APPROVE at ea97f8c. This is agent review, not human approval. The committed sources match the reviewed files.

The plain ComputableInSpace.mapWith signature and full charged-space bound are unchanged. Its proof now reuses the plain ComputableInO.mapWith rule through conversions preserving that space bound while leaving time existential. The four removed tidy declarations have no remaining clients; distinct degree and polynomial-time APIs remain intact. Public import availability and source credit are preserved, and the two baseline reductions match the removals exactly.

The new captured-parameter fill client covers both Boolean values and an empty list. The author's strict focused build passed for the affected modules, InSpacePlain tests and Universal.Complexity; full hosted validation is pending. No curated abstract statement changes. I inspected the source, resource conversions, references, imports and final deltas without editing or running builds.

@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator

reviewer-claude-e6cf7b0d-10 (Claude Code, Opus; Claude fleet, outside this PR's fleet): reviewing at ea97f8c.

@SamuelSchlesinger SamuelSchlesinger left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reviewer-claude-e6cf7b0d-10 (Claude Code, Opus; Claude fleet, outside this PR's fleet). Verdict at ea97f8c: APPROVE. Agent review, not human approval.

  • The PR removes four tidy declarations: ComputableTidilyInO.findWith, .filterWith and .mapWith, and ComputableTidilyInSpace.mapWith. None has a remaining reference on the branch. The step helpers they used (findStep, filterStep, mapStep, their foldl_* lemmas and length_encList_filter_le) are still used by the plain BigO/Lists.lean and by Lists.lean, so nothing is left dead.
  • The statement of ComputableInSpace.mapWith is unchanged, including its full charged-space expression. Its proof is now exists_inO followed by of_inO (ComputableInO.mapWith …). That replaces a copy of the fold argument with the plain rule, which is the intended direction for #862.
  • The baseline drops 32→29 for BigO.lean and 45→44 for InSpaceLib.lean, matching the four removals. The -- vendored: note records the local adaptation of the vendored file, and the credit to Christian Reitwiessner's construction is kept in BigO/Lists.lean.
  • fill_inSpace is a real client: a captured parameter, linear space, and rfl checks on empty and nonempty lists. Hosted CI is green at this head.

Nit, optional: the module docstring of BigO.lean now reads ".foldl, .foldlWith: left folds with a parameter", but only foldlWith takes a parameter.

@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator

auditor-claude-e6cf7b0d-22 (Claude Code, Opus; Claude fleet). Statement-level audit of ea97f8c: no public statement is lost. This is not a full review.

  • The three removed ComputableTidilyInO.findWith/filterWith/mapWith have exactly the same hypotheses and time/space bounds as the retained plain ComputableInO.findWith/filterWith/mapWith in BigO/Lists.lean, with ComputableTidilyInO replaced by ComputableInO (checked by normalized text comparison).
  • The removed ComputableTidilyInSpace.mapWith has the same bound as the retained ComputableInSpace.mapWith, whose header this PR leaves unchanged; only its proof is rerouted through ComputableInO.mapWith.
  • No library, test or abstract file references the removed names. The baseline drops 3 (BigO) + 1 (InSpaceLib), matching the four removals.
  • The new fill_inSpace test exercises a captured parameter and checks both empty and nonempty outputs.

@SamuelSchlesinger
SamuelSchlesinger added this pull request to the merge queue Oct 31, 2026
Merged via the queue into main with commit cff59fb Oct 31, 2026
4 checks passed
SamuelSchlesinger added a commit that referenced this pull request Oct 31, 2026
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
orbitingflea pushed a commit to orbitingflea/complexitylib2 that referenced this pull request Oct 31, 2026
…#800) (cslib-community#1852)

* wip(universal): interfaces for the O(t log t) windowed simulation (cslib-community#800)

* wip(divconq): trace lemma and case-analysis certificates

* wip: plain-form interfaces; case-analysis certificates

* wip(universal): interfaces for the windowed cost analysis (cslib-community#800)

* wip: local copy of the plain divConq stub (coordinator's WIP file does not build)

* wip(divconq): fix module structure

* wip(divconq): round certificates

* feat(universal): prove universal_eq_sim for the windowed simulation (cslib-community#800)

* wip(divconq): round and halt certificates

* feat(turing): linear-time unary take and drop on encoded lists (cslib-community#800)

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).

* feat(universal): prove the windowed size bounds (cslib-community#800)

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.

* wip(universal): cutting, pasting and halving certificates (cslib-community#800)

* wip(stack-loop): runs between shifted configurations and word-moving machines (cslib-community#800)

* feat(universal): size facts for the windowed simulation and tests (cslib-community#800)

* feat(divconq): divide and conquer from the stack loop

* chore: regenerate Complexity.lean

* feat(universal): prove initProb_inO, the cost of the initial windows (cslib-community#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.

* style: line lengths

* feat(universal): certificates for windowed cutting, pasting, stepping and halving (cslib-community#800)

* wip(universal): D&C parts and node/base cost bounds for the windowed simulation (cslib-community#800)

* feat(universal): the universal function in time O(t log t) (cslib-community#800)

* wip(stack-loop): tape layout and phases of the stack-loop machine (cslib-community#800)

* docs(universal): document the windowed cost certificates (cslib-community#800)

* fix(divconq): keep tidy helpers private; review doc fixes

* fix(turing): keep vendored Lists.lean faithful; doc and test nits (cslib-community#800)

Review S1: revert the Complexity/Lists.lean hunk (tidy dropUnary keeps crei's
degree-2 proof) and drop the docs/test mentioning the tidy dropUnary. Nits:
split the KernelTakeDropUnary module docstring title onto its own line and add
a blank line before `module` in the test file.

* wip(stack-loop): the run of the stack-loop machine (cslib-community#800)

* style: line lengths

* test(divconq): smoke test instantiating ComputableInO.divConq (cslib-community#800)

* feat(stack-loop): prove ComputableInO.stackLoop natively (cslib-community#800)

* chore(stack-loop): register modules, fix lints (cslib-community#800)

* feat(Hierarchy/ShortDesc): decide shortness in linear time

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.

* feat(Hierarchy/TimePolylog): time hierarchy with a polylogarithmic gap (cslib-community#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.

* doc(upstream): record the windowed universal simulation

* doc: literature mapping, ROADMAP milestone, narrower public imports (review)

* style: line length

* style: line length

* refactor(stack-loop): address review — reuse whileCond, targeted expose, private helpers (cslib-community#800)

* doc(roadmap): define N, D, M in the cslib-community#800 entry

* style(universal): replace non-terminal simp with simp only in Windowed (cslib-community#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

* fix(universal): adapt WindowedParts and TimePolylog to main (cslib-community#800)

Main retired the tidy list combinators (cslib-community#2008), stated stepWith_inO in the
plain calculus (cslib-community#1777) and replaced the tidy decoder certificate with
exists_computableInDegree_decodeDesc (cslib-community#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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.

2 participants