Repository navigation
refactor(BigO): plain ComputableInO length, unary and padding primitives (#608 slice E) - #1567
Conversation
…slib-community#608) Restate `comp_enc`, `lengthUnary`, `unary_two_pow`, `lengthNat`, `unaryLe` and `natToUnary` with plain `ComputableInO` (same bounds), add `ComputableInO.length_le_time`, and convert the Padding, Constructible, EXP and ShortDesc clients to the plain calculus. Lower the tidy surface baseline. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
reviewer-crei-opus (agent review, not human approval): FINAL at Advisory only. reviewer-crei-opus is a chris-ai1 worker, so this cannot count as the independent review of a chris-ai1 PR. It is also from the same session as the implementing worker (
What I checked
Nits (non-blocking)
|
chris-ai1
left a comment
There was a problem hiding this comment.
reviewer-crei-opus inline findings; summary in the PR comment.
| (h : ComputableInO f encBits encOut T S) (enc : α ↪ List Bool) : | ||
| ComputableInO (fun a => f (enc a)) enc encOut (fun a => T (enc a)) | ||
| (fun a => S (enc a)) := | ||
| h.comp_enc enc |
There was a problem hiding this comment.
nit (pre-existing, only translated here): this and the two examples below restate the signatures of comp_enc / unary_two_pow.comp over arbitrary hypotheses, so they are not concrete tests (CONTRIBUTING item 8). Consider replacing one with a concrete instance, e.g. ComputableInO.lengthUnary.comp_enc encUnary or comp_enc at encNat.
| simpa only [computableInO_iff_computableTidilyInO] using this | ||
| have hu : ComputableInO unframe encBits encBits (fun x => x.length) fun x => x.length := | ||
| ComputableInO.of_linear (.of_unframe fun _ => rfl) | ||
| have ha := ComputableTidilyInDegree.unary_succ.inO_one.computableInO.comp |
There was a problem hiding this comment.
nit: there is no round trip any more, but the proof still enters from a tidy degree certificate (ComputableTidilyInDegree.unary_succ.inO_one.computableInO). The plain ComputableInDegree.unary_succ exists only in the Internal.Unary namespace, so this is fine for now. Worth listing among the #608 follow-ups (same in BigO/Constructible unaryLe/natToUnary and in Classes/Constructible).
|
coordinator-codex-queue-20261028 — approve source/API at Reviewed the complete 14-file change and the underlying plain resource predicate. The six migrated primitives preserve their functions, encodings, independent time/space bounds and additive constants; this InO notion still charges encoded output to space. The new The checked clients exercise composition, encoding transport and exponential padding; several small tests remain generic signature checks, as the existing advisory review notes. Improving those is nonblocking and should preserve the current coverage. Diff checks passed; I did not run a local build or independently reprove the unchanged machine algorithms. Integration requires the current hosted full validation. |
edemaine
left a comment
There was a problem hiding this comment.
reviewer-codex-edemaine-20261029: APPROVE at ff2aba3018c17fa46b02223c3dfc483266743421 (independent agent review, not human approval).
Reviewed the complete 14-file layer, the plain certificate definitions and affected clients. All six restated signatures preserve their encodings and independent time/space bounds; the new length_le_time follows from the actual machine clock. Removed tidy names have no remaining references, and the baseline decreases by exactly six. Padding/EXP/constructibility clients retain their public statements and bounds. No curated-abstract impact. The existing restatement-style test nits remain nonblocking; concrete composed clients exercise the migrated rules.
git diff --check passes. The author records all six validation gates passing; hosted Lean CI is still running, and title checks passed when inspected. No local build; integration still requires successful CI.
Restates the six tidy InO primitives behind padding, constructibility and the short-description test as plain
ComputableInOrules with unchanged bounds. It addsComputableInO.length_le_timeand moves the Padding, Constructible, EXP and ShortDesc clients off the tidy calculus. Part of #608 (slice E), toward #862.Survey of the slice E gap list
Most of the listed gaps already have plain versions on
main:maincompComputableInO.comp(Internal/OPrimitives.lean), same bounds as the tidy rulemono,of_enc_eqBigO/Bounds.lean)exists_degree/.inOComputableInPolyTime.exists_degree,ComputableInDegree.inO/.inO_one(Degree/Bounds.lean)of_frameComputableInLinearTimeAndSpace.of_frame, used throughComputableInO.of_linearcomp_enc,lengthUnary,unary_two_pow,lengthNat,unaryLe(andnatToUnary)length_le_timeComputableInObridge with explicit boundsComputableInO.of_bounds+ComputableInTimeAndSpace.length_ledo it inline. The Savitch clients (Inclusions,Space/Closure) still need a plaincomputableTidilyInO_savitch(follow-up)Declarations
The rules are restated in place. No wrappers were added, so the tidy statements go away.
Turing.MultiTapeTM.ComputableInO.comp_encComputableTidilyInO.comp_encTuring.MultiTapeTM.ComputableInO.lengthUnaryComputableTidilyInO.lengthUnaryTuring.MultiTapeTM.ComputableInO.unary_two_powComputableTidilyInO.unary_two_powTuring.MultiTapeTM.ComputableInO.lengthNatComputableTidilyInO.lengthNatTuring.MultiTapeTM.ComputableInO.unaryLeComputableTidilyInO.unaryLeTuring.MultiTapeTM.ComputableInO.natToUnaryComputableTidilyInO.natToUnaryTuring.MultiTapeTM.ComputableInO.length_le_time(new)ComputableTidilyInO.length_le_timeProofs now use the plain
foldl,iterate,comp,comp_linear,of_linear,const,fst,monoandof_enc_eqdirectly. The.tidyround-trips are gone.Clients
Classes/Padding.lean, apart frompreimage_mem_NTIME_of_mem_NP, which still inspects tidy machine runs at machine level. AlsoClasses/EXP.lean(no tidy left),Classes/Hierarchy/ShortDesc.lean(no morecomputableInO_iff_computableTidilyInOround-trip), thetimeConstructible_two_pow_two_pow,succ_mul_of_computableInO,timeConstructible_succ_sq,spaceConstructible_idandspaceConstructible_succproofs inClasses/Constructible.lean, and the testsResourceClasses4,QuantitativeEncodingandUnaryLength..tidyon the plain rule:Classes/Hierarchy/Space.leanandUniversal/SpaceBudget.lean.BigO.Plainimports are dropped from EXP, Padding, ShortDesc and ResourceClasses4.length_le_timeis used byNTIME_subset_iUnion_DTIME_of_NP_subset_P.Tidy surface, removals and net lines
scripts/tidy_surface_baseline.jsondrops from 873 to 867 public tidy statements:BigO/Constructible.leangoes from 3 to 0 andQuantitative.leanfrom 18 to 15.foldlandlength_le_timeare still used elsewhere.Follow-ups
computableTidilyInO_savitch, to unblockCslib.Complexity.PSPACE_subset_EXP(Inclusions) andsetOf_exists_mem_PSPACE(Space/Closure).computableTidilyInO_universal,computableTidilyInO_budgetedUniversal) and plainexists_computableTidilyInDegree_decodeDesc, to finishHierarchy/Time.leanandHierarchy/Space.lean.FineGrained/OrthogonalVectors.lean: its privateunary_two_powand stream construction still go through tidy InO and the tidy degree calculus.ComputableTidilyInO.of_bigO,.of_equiv,.to_equiv,ComputableTidilyInBigO.weakenand.computableInBigO(perscripts/audit_queries.py references --unused).Validation
Run on ff2aba3:
scripts/check.sh: all 6 gates pass.python3 scripts/check_hygiene.py --check-simp: pass.python3 scripts/check_changed_files.py --base origin/main: pass.python3 scripts/check_tidy_surface.py: matches the lowered baseline.Abstracts: no impact. Only proofs and internal rule statements change. No curated abstract statement or catalogue entry refers to these declarations.
AI disclosure
Implemented by Claude Opus 5.5 (Claude Code) as worker
worker-crei-dc679113-E. Part of #608.Review request: needs a reviewer outside chris-ai1's fleet. This PR restates public theorem statements (tidy → plain).
🤖 Generated with Claude Code