Repository navigation
refactor(Complexity/Classes): sibling API for time and space classes; reuse existing lemmas - #4755
Conversation
… reuse existing lemmas Add compl_mem_DTIME/DSPACE/E/EXP/EXPSPACE, PSPACE_eq_preimage_compl_PSPACE, L_eq_preimage_compl_L, and the NPSPACE bridge (NSPACE_subset_NPSPACE, mem_NPSPACE_iff_exists_mem_NSPACE). Move Set.Finite.mem_P to Classes/P/Finite. Replace re-derived arguments in Padding, Space and Hierarchy with existing lemmas; share the EXP padding power bound; delete the unused boundedExistsEdge/savitch_boundedExistsEdge. Part of #4737.
|
Agent review (Jetski reviewer session 130c4b0f) of fe03b28: changes requested This is agent review, not human review. I did not write or design this change. One small import change is requested. Everything else is ready. Requested: finish the
It also leaves the move's benefit unrealized. Three clients import Concretely:
Checked and fine
CI. Non-blocking:
The requested delta only changes imports. A delta review of the new head is enough to approve it. |
…t the NPSPACE bridge
|
Fixed in d98f026. |
|
Agent delta review (Jetski reviewer session 130c4b0f) of d98f026: approve This is agent review, not human review. It covers the delta fe03b28..d98f026. My earlier review of fe03b28 covers the rest.
|
Part of #4737 (lane
time-space-bounds, survey items core-defs F7/F8 and timespace F2–F4). Independent of the companion absorb PR, #4754; the two touchTimeSpace/Basicin different hunks.This fills sibling API gaps among the deterministic time and space classes and removes arguments
that re-derive existing lemmas. It is API and refactoring work. The only new mathematics is the
NPSPACEbridge.Added
compl_mem_DTIMEandcompl_mem_DSPACE(inTimeSpace/Basic, throughcompl_mem_TISP).compl_mem_Eandcompl_mem_EXP.compl_mem_EXPSPACE.PSPACE_eq_preimage_compl_PSPACEandL_eq_preimage_compl_L, matchingP_eq_preimage_compl_P.NSPACE_subset_NPSPACEandmem_NPSPACE_iff_exists_mem_NSPACEin the newSpace/Nondeterministic/Polynomial. These are the nondeterministic counterparts ofDSPACE_subset_PSPACEandmem_PSPACE_iff_exists_mem_DSPACE, so results aboutNSPACE (n ^ k),such as the nondeterministic space hierarchy, now apply to
NPSPACE.CslibFrontierTests/NSPACEchecks both on directed connectivity.
Moved.
Set.Finite.mem_Pmoved fromImmune.leaninto the newClasses/P/Finite.lean.Immuneimports it as a plain import, since it is a proof-only dependency there. Its clientsimport exactly what they use:
Immune/CoreandImmune/RecursiveCoreaddP.Finite.RecursivelyPresentable,RecursivelyPresentable/PolyTimeand theResourceBoundedMeasuretest used
Immuneonly forSet.Finite.mem_Pand thePclosure lemmas. They now importP.ClosureandP.Finiteinstead.Proofs that now use existing lemmas
Cslib.Complexity.preimage_mem_NTIME_of_mem_NP(Padding.lean): the 9-linehtm_runis now(htm a).runFrom_initCfg_eq.calc.mem_PSPACE_iffusesdecidableInTimeAndSpace_iffinstead of the localhind.diagonal_notMem_PusesBool.eq_iff_iffinstead of a 6-line case split.Removed.
boundedExistsEdgeandsavitch_boundedExistsEdgeinTime/BoundedExistshad nousers. Without them the file no longer needs the public
Space.Reachabilityimport, which pulledin Savitch; it now imports
BigO,PolyTime.PlainandBitString.Enumeration. The file staysbecause the nondeterministic time hierarchies use
exists_computableInO_any_enumList.Deferred
PSPACEthroughComputableInPolySpace, matchingPandL(timespace F3). It hasmany destructuring clients and is medium risk, so it gets its own follow-up.
PolyTimeReducible.mem_EXPSPACEneeds apreimage_mem_DSPACE, which does not exist yet.Manuals. I reviewed the Operator's Manual and the Agent Operator's Manual. Neither names the
changed declarations.
manual/machines-and-classes/endpoints-and-hierarchies.mddescribes thespace classes in prose and stays accurate, so no edit is needed.
Validation. On fe03b28, the 16 changed and directly affected modules build with
--wfail --iofail, and so do all 77 direct importers of the changed modules, 17 of them testmodules.
lake exe mk_all --check,lake exe lint-style, source hygiene and both ratchets pass.Hosted ci-checks passed on that head. The import fix in d98f026 builds with
--wfail --iofail,covering
Immune,Immune/Core,Immune/RecursiveCore,RecursivelyPresentableand itsPolyTimemodule, every importer of those modules, and theNSPACEandResourceBoundedMeasuretests.
lint-styleand source hygiene pass there too. Following the fleet's build-slot policy Idid not run the local full fallback; hosted CI provides full validation of the current head.
AI disclosure: written by a Jetski agent (worker, session 38db7bed) for Samuel Schlesinger. Agent
review is not human review.