Repository navigation
refactor(Complexity/Classes): one affine bound lemma shape for time and space classes - #4754
Conversation
…nd space classes
Public Nat.exists_le_add_of_eventually_le, Nat.exists_le_mul_add_of_eventually_le,
Nat.mul_add_le_mul_add_of_le_mul_add and Nat.add_one_pow_le_two_pow_mul_add in a new
Foundations/Data/Nat/AffineBound module replace private copies in Classes/Time.lean,
Classes/Alternation.lean and Classes/Time/Polynomial.lean and inline copies in
Space/Basic, Space/Nondeterministic, TimeSpace/Basic and SharpP/Time.
DSPACE/NSPACE/ATIME/ASPACE_subset_of_le_mul_add (c d) become X_mono_of_le_mul_add {C},
the shape of DTIME, TISP, SharpTIME and SigmaTwoTIME; NTIME and BPTIME gain the lemma, and
each class derives _mono and _mono_of_eventually_le from it (adding NSPACE_mono and
ATIME/ASPACE_mono_of_eventually_le).
Part of #4737
…om Nat.mul_add_one_pow_le_two_pow Use it in Padding/Polynomial in place of the inline calc.
|
Agent review (Jetski reviewer session 130c4b0f) of 6f52d3f: approve This is agent review, not human review. I did not write or design this change. Reuse. I searched Mathlib for the four
Declaration preservation. No old names remain anywhere in the tree: library, tests, manual, results or ROADMAP. The same holds for the removed private helpers. Open PRs. I grepped the diffs of all 61 other open PRs, plus the heads of the two whose diffs GitHub will not serve (#2530, #3268). None use the old names or the removed helpers. #4150 changes Manuals. I agree no edit to the Operator's Manual or the Agent Operator's Manual is needed. Neither names a changed declaration, and neither do CI. Non-blocking:
|
Part of #4737 (lane
time-space-bounds, survey items core-defs F4/F7, timespace F1).The time and space classes now share one lemma shape for absorbing linear bounds:
X_mono_of_le_mul_add {C} (h : ∀ n, t₁ n ≤ C * t₂ n + C) : X enc t₁ ⊆ X enc t₂.X_monoandX_mono_of_eventually_leare derived from it. The arithmetic that each class re-derived (theeventual-to-everywhere bound, the constant-absorption step, the
(n + 1) ^ kshift) now lives inone small module,
Foundations/Data/Nat/AffineBound. It importsInitandMathlib.Order.Filter.AtTopBot.Basicpublicly, andPolynomialBound.ClosureandMathlib.Data.Finset.Lattice.Foldfor proofs only.This is a refactor. It adds no new mathematics.
Renamed, without aliases.
DTIME,TISP,SigmaTwoTIMEandSharpTIMEalready used the_mono_of_le_mul_add {C}shape, and #4692 callsDTIME_mono_of_le_mul_add (C := …), so the fourodd ones out were renamed to match:
DSPACE_subset_of_le_mul_add (c d)DSPACE_mono_of_le_mul_add {C}NSPACE_subset_of_le_mul_add (c d)NSPACE_mono_of_le_mul_add {C}ATIME_subset_of_le_mul_add (c d)ATIME_mono_of_le_mul_add {C}ASPACE_subset_of_le_mul_add (c d)ASPACE_mono_of_le_mul_add {C}All in-repository callers were updated. No open PR uses the old names; I checked every open PR
diff.
Added.
NTIME_mono_of_le_mul_add,BPTIME_mono_of_le_mul_add.NSPACE_mono.ATIME_mono_of_eventually_le,ASPACE_mono_of_eventually_le.Nat.exists_le_add_of_eventually_le,Nat.exists_le_mul_add_of_eventually_le,Nat.mul_add_le_mul_add_of_le_mul_add,Nat.add_one_pow_le_two_pow_mul_add.Removed.
exists_add_of_eventually_leandexists_linear_of_eventually_le(Time).mul_add_le_mul_add(Alternation).succ_pow_le_two_pow_mul_add(Time/Polynomial).NTIME_succ_pow_eq, andin
Padding/Polynomial.Nat.add_one_pow_le_two_pow_mul_addis derived from the existingNat.mul_add_one_pow_le_two_pow(c = 1), not re-proved. It gives that bound in theC * g n + Cshape that the class lemmas take.PPTIME(PP/Time.lean, randomized lane) hasPPTIME_monobut no_of_le_mul_addvariant. I leftit alone and record it as a follow-up for that lane.
Manuals. I reviewed the Operator's Manual and the Agent Operator's Manual. No manual, the
results inventory or
ROADMAP.mdnames any renamed or added declaration, so neither manual needsan edit.
Validation. On e1a8624, a local
scripts/check.shfell back to the full check because theaggregate changed. All six Lean gates passed (
lake build,lake test,lake lint,mk_all --check,lint-style,checkInitImports), as did the Python tooling tests, sourcehygiene, both ratchets, documentation pins, the tidy statement ratchet, the result registry and
the changed-file lints. I stopped the run during the last step, the re-elaboration of
cache-restored files, to free a shared build slot. On the follow-up commit 6f52d3f (proof-only:
the power bound and
Padding/Polynomial),AffineBoundand its importers build with--wfail;source hygiene and both ratchets pass. Hosted CI provides full validation of the head.
AI disclosure: written by a Jetski agent (worker, session 38db7bed) for Samuel Schlesinger. Agent
review is not human review.