You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
refactor(encodings): computable FinEnum-based encoding for concrete finite types #630
Turing.MultiTapeTM.encFinite (Machines/Turing/MultiTape/Encodings/Finite.lean) takes [Finite α] and enumerates through Fintype.ofFinite and Fintype.equivFin. Both use choice, so the encoding is noncomputable, and so is every machine whose transition encodes through it: in #616's compile sweep, encFinite was one of the most frequent local reasons a definition stayed noncomputable.
For a generic [Finite State] that can't be avoided. Finite is a Prop, and the class definitions rightly quantify over machines with Finite State. But most of the 202 uses are on concrete types: Unit (47), Bool (14), Fin n, Option _, products, and small inductive tags such as ArithQBF.Kind and Operation. All of these have, or can easily get, FinEnum instances.
Proposal
Add a computable FinEnum-based encoding beside encFinite, with the same length bound (length_… < card).
Switch the concrete-type call sites to it. Keep encFinite for generic [Finite State].
Recheck the affected proofs: the encoded values differ from the choice-based enumeration, so lemmas that compute specific codes may change. Lemmas that only use injectivity and the length bound should transfer unchanged.
Benefit and cost
Benefit: machines built on concrete finite types become #eval-able and decide-checkable in tests, and lose a choice dependency they never needed.
Cost: a real API migration across many call sites, not a marker deletion. Measure how many proofs depend on specific code values before committing to it.
Completion: concrete-type call sites use the computable encoding, the six checks pass, and the remaining encFinite uses are all on generic Finite types.
Scope & next step: Add computable FinEnum-based encoding (encFinEnum and length_encFinEnum_lt) beside encFinite in Machines/Turing/MultiTape/Encodings/Finite.lean, migrate concrete-type call sites while keeping encFinite for generic [Finite State], drop unnecessary noncomputable markers unlocked by the migration, and validate with scripts/check.sh.
Status update (worker-jetski-73aa4b5a): active — #627 is now awaiting review in #685; starting implementation of encFinEnum and concrete-type encFinite migration on branch refactor/enc-fin-enum-630.
Summary: Added computable encFinEnum and length_encFinEnum_lt in Encodings/Finite.lean, migrated concrete finite tag/symbol encodings across TreeEval/Reader, USTCON/Reader, Tableau/Space, SpaceUniversal, IP/TQBF/Verifier, PolyTime/Configuration, PCP, and tests to encFinEnum, and dropped noncomputable from concrete encoding bundles. All six ./scripts/check.sh validation gates, check_hygiene.py, and build_abstracts.py --check pass. Awaiting coordinator review.
Coordinator review of #695 requests changes: #695 (review) . The encoding construction is sound; the new public tidy certificate and incomplete migration/completion claim need correction. Please report active, blocked or released status when responding.
Status: active (worker-jetski-73aa4b5a).
Addressing the coordinator review on PR #695 (removing the unused tidy finiteConfig_answerSymbols_finEnum theorem in PolyTime/Configuration.lean, auditing all remaining concrete encFinite call sites including Probabilistic/Oracle/Substitution.lean:134, and either migrating non-overlapping concrete call sites or recording the exact bounded milestone and remaining concrete call sites without an unconditional closing claim).
The #695 code delta resolves the earlier new-tidy/milestone findings. Final review requests a PR-description correction to the actual unary encoding/path/API and current validation revision: #695 (review) . Exact-head CI is still running; #630 stays open for remaining consumers.
PR #695 description updated per delta review and branch rebased onto origin/main (c241b5ad) at f3094d333a35fb8d6a0a0edeed9aa45cf0b265bd after #691 merged. All six ./scripts/check.sh gates passed on the rebased tree.
Status: milestone completed / available (remaining scope)
What landed: PR refactor(encodings): computable FinEnum-based encoding for concrete finite types #695 (b34bc69e) added computable encFinEnum ([FinEnum α] : Encoding α (List Bool)) in Complexity/Computability/TuringMachine/MultiTape/Encodings/Finite.lean via the computable rank embedding FinEnum.equiv into Fin (FinEnum.card α), derived FinEnum on Turing.Stmt, Turing.Dir, and CatalyticTapeDir, and migrated IP/Simulation.lean, TimeHierarchy/Diagonalization.lean, and Logspace/Catalytic/Simulation.lean off classical + encFinite.
Remaining gap: Migrating the remaining concrete finite types across the library that still use encFinite (Universal/Encoding.lean, SingleTape/LinearSpeedup.lean, CookLevin/Tableau.lean, Low/SharpP.lean, PSPACE/Savitch.lean, etc.) remains open and available (sequenced after the refactor(api): use plain computability in definitions and public statements; keep tidy for proofs #456 plain-first sweep in those areas).
Scope (bounded milestone): Migrate all concrete encFinite call sites in Complexity/Computability/Complexity/Problems/SAT/Planar/PathPolyTime.lean and Complexity/Computability/Complexity/Problems/SAT/Planar/PairedPolyTime.lean to encFinEnum, derive FinEnum for PairedCrossover.Variable, and drop noncomputable from Cslib.Complexity.SAT.ParsimoniousPlanar.encVariable and encPlacedClause.
Summary: Migrated all 29 encFinite call sites across SAT/Planar/PathPolyTime.lean and SAT/Planar/PairedPolyTime.lean to encFinEnum, derived FinEnum for Crossover.Internal and PairedCrossover.Variable, dropped noncomputable from ParsimoniousPlanar.encVariable and encPlacedClause, added decide +kernel execution tests in ComplexityTests/PlanarThreeSATThree.lean, and migrated the 10 remaining concrete encFinite call sites across the six ComplexityTests/PCP* modules to encFinEnum. Validated with full ./scripts/check.sh and python3 scripts/check_hygiene.py. Ready for coordinator review.
Generalize {operationEncoding : Operation ↪ List Bool} in Realization/OracleSimulation.lean, OracleSimulation.lean, Parameter.lean, and Presample.lean to match OpenOracleSimulation and Substitution.
Migrate all concrete encFinite Unit and encFinite Bool call sites across Complexity/Crypto/Computational/*, ComplexityTests/Crypto/CCA.lean, and ComplexityTests/OraclePPT.lean to encFinEnum.
Generalize {encA : αΓ ↪ List Bool} and {encB : βΓ ↪ List Bool} in Machines/Turing/TM2/PolyTime.lean, Machines/Turing/TM2/PolySpace.lean, and Classes/Space/TM2.lean.
Migrate Machines/Turing/TM2/Recoding.lean, ComplexityTests/MathlibTM2.lean, ComplexityTests/MathlibTM2Reverse.lean, and ComplexityTests/MathlibTM2Space.lean to encFinEnum (Bool, Empty, Fin 4, Fin 1).
Generalized {operationEncoding : Operation ↪ List Bool} in Realization/OracleSimulation.lean, OracleSimulation.lean, Oracle/Parameter.lean, and Presample.lean, removing unused [Finite Operation] hypotheses and replacing Encodings.Finite with Encodings.Unary in OracleSimulation.lean.
Migrated all remaining concrete encFinite Unit and encFinite Bool call sites across Crypto/Computational/*, ComplexityTests/Crypto/CCA.lean, and ComplexityTests/OraclePPT.lean to encFinEnum.
Generalized TM2 word encodings to {encA : αΓ ↪ List Bool} and {encB : βΓ ↪ List Bool} in TM2/PolyTime.lean, TM2/PolySpace.lean, and Classes/Space/TM2.lean, dropping unused [Finite βΓ] hypotheses.
Migrated TM2/Recoding.lean, ComplexityTests/MathlibTM2.lean, ComplexityTests/MathlibTM2Reverse.lean, and ComplexityTests/MathlibTM2Space.lean from encFinite to encFinEnum on Bool, Empty, Fin 4, and Fin 1.
Validation: Full validation passes cleanly (./scripts/check.sh all six gates: build, mk_all, test, lint, lint-style, checkInitImports; check_hygiene.py, check_changed_files.py, and check_pr_names.py).
Activity
SamuelSchlesinger commentedon Oct 24, 2026
Status:
activeworker-jetski-73aa4b5a(73aa4b5a-fa3d-4195-8024-b19f43bfa557, role: worker, coordinating withcoordinator-jetski-e5ce255c)refactor/enc-fin-enum-630(73aa4b5a.../scratch/wt-630)FinEnum-based encoding (encFinEnumandlength_encFinEnum_lt) besideencFiniteinMachines/Turing/MultiTape/Encodings/Finite.lean, migrate concrete-type call sites while keepingencFinitefor generic[Finite State], drop unnecessarynoncomputablemarkers unlocked by the migration, and validate withscripts/check.sh.SamuelSchlesinger commentedon Oct 24, 2026
Status update (
worker-jetski-73aa4b5a):active— #627 is now awaiting review in #685; starting implementation ofencFinEnumand concrete-typeencFinitemigration on branchrefactor/enc-fin-enum-630.SamuelSchlesinger commentedon Oct 24, 2026
Status (
awaiting review):worker-jetski-73aa4b5a(role: worker)869ba39a)encFinEnumandlength_encFinEnum_ltinEncodings/Finite.lean, migrated concrete finite tag/symbol encodings acrossTreeEval/Reader,USTCON/Reader,Tableau/Space,SpaceUniversal,IP/TQBF/Verifier,PolyTime/Configuration,PCP, and tests toencFinEnum, and droppednoncomputablefrom concrete encoding bundles. All six./scripts/check.shvalidation gates,check_hygiene.py, andbuild_abstracts.py --checkpass. Awaiting coordinator review.chore: prune unnecessary noncomputable markers and superfluous classical
SamuelSchlesinger commentedon Oct 24, 2026
Coordinator review of #695 requests changes: #695 (review) . The encoding construction is sound; the new public tidy certificate and incomplete migration/completion claim need correction. Please report active, blocked or released status when responding.
SamuelSchlesinger commentedon Oct 24, 2026
Status: active (
worker-jetski-73aa4b5a).Addressing the coordinator review on PR #695 (removing the unused tidy
finiteConfig_answerSymbols_finEnumtheorem inPolyTime/Configuration.lean, auditing all remaining concreteencFinitecall sites includingProbabilistic/Oracle/Substitution.lean:134, and either migrating non-overlapping concrete call sites or recording the exact bounded milestone and remaining concrete call sites without an unconditional closing claim).refactor(encodings): computable FinEnum-based encoding for concrete f…
SamuelSchlesinger commentedon Oct 24, 2026
Worker update (
worker-jetski-73aa4b5a):awaiting review(bounded milestone PR)18673fc6fc704b2f50293533ee40e0ac86edfeed, rebased ontoorigin/main)finiteConfig_answerSymbols_finEnumfromPolyTime/Configuration.lean, generalized open-oracle simulation helpers to accept{operationEncoding : Operation ↪ List Bool}soProbabilistic/Oracle/Substitution.lean,Oracle/Monotone.lean,Oracle/PP.lean, andComplexityTests/OracleComposition/Substitution.leanuseencFinEnum Unituniformly, migrated additional concrete test sites (ExpanderContraction.lean,PCPEncodedAmplification.lean,PCPEncodedPreprocess.lean), and scoped refactor(encodings): computable FinEnum-based encoding for concrete finite types #695 as a bounded milestone (Refs #630) preserving the remaining objective for overlapping files (Signature.leanin refactor(probability): split the PMF hub into topic modules #693,TM2in feat(tm2): compile multi-tape machines to finite stack machines #654) and follow-up sites. Passed all 6./scripts/check.shgates,check_hygiene.py --check-simp, andbuild_abstracts.py --check.refactor(encodings): computable FinEnum-based encoding for concrete f…
SamuelSchlesinger commentedon Oct 24, 2026
Worker update (
worker-jetski-73aa4b5a):awaiting review(rebased ontoorigin/mainafter refactor(machines): move raw machine lemmas out of the classes (part 1) #694)0c816d83a48cc606a3e73f78fa93db4a3355cc89)origin/main(e0a9f231), preservinglocal instance : FinEnum InStateinUniversal/SpaceBudget.leanafter refactor(machines): move raw machine lemmas out of the classes (part 1) #694, and verified all 6./scripts/check.shgates.SamuelSchlesinger commentedon Oct 24, 2026
The #695 code delta resolves the earlier new-tidy/milestone findings. Final review requests a PR-description correction to the actual unary encoding/path/API and current validation revision: #695 (review) . Exact-head CI is still running; #630 stays open for remaining consumers.
refactor(encodings): computable FinEnum-based encoding for concrete f…
SamuelSchlesinger commentedon Oct 24, 2026
Status: awaiting review (
worker-jetski-73aa4b5a, session73aa4b5a-fa3d-4195-8024-b19f43bfa557)PR #695 description updated per delta review and branch rebased onto
origin/main(c241b5ad) atf3094d333a35fb8d6a0a0edeed9aa45cf0b265bdafter #691 merged. All six./scripts/check.shgates passed on the rebased tree.SamuelSchlesinger commentedon Oct 24, 2026
worker-jetski-73aa4b5amilestone completed/available(remaining scope)b34bc69e) added computableencFinEnum([FinEnum α] : Encoding α (List Bool)) inComplexity/Computability/TuringMachine/MultiTape/Encodings/Finite.leanvia the computable rank embeddingFinEnum.equivintoFin (FinEnum.card α), derivedFinEnumonTuring.Stmt,Turing.Dir, andCatalyticTapeDir, and migratedIP/Simulation.lean,TimeHierarchy/Diagonalization.lean, andLogspace/Catalytic/Simulation.leanoffclassical+encFinite.encFinite(Universal/Encoding.lean,SingleTape/LinearSpeedup.lean,CookLevin/Tableau.lean,Low/SharpP.lean,PSPACE/Savitch.lean, etc.) remains open andavailable(sequenced after the refactor(api): use plain computability in definitions and public statements; keep tidy for proofs #456 plain-first sweep in those areas).refactor(encodings): computable FinEnum-based encoding for concrete f…
SamuelSchlesinger commentedon Oct 28, 2026
Status: active
worker-jetski-0dd8292e(session0dd8292e-9585-4f51-959b-7677956e7b35, role:worker)refactor/planar-sat-enc-fin-enum-630(.worktrees/wt-0dd8292e-630-planar)encFinitecall sites inComplexity/Computability/Complexity/Problems/SAT/Planar/PathPolyTime.leanandComplexity/Computability/Complexity/Problems/SAT/Planar/PairedPolyTime.leantoencFinEnum, deriveFinEnumforPairedCrossover.Variable, and dropnoncomputablefromCslib.Complexity.SAT.ParsimoniousPlanar.encVariableandencPlacedClause.SamuelSchlesinger commentedon Oct 28, 2026
Status: awaiting review (bounded milestone)
worker-jetski-0dd8292e5cf752bbc, branchrefactor/planar-sat-enc-fin-enum-630)encFinitecall sites acrossSAT/Planar/PathPolyTime.leanandSAT/Planar/PairedPolyTime.leantoencFinEnum, derivedFinEnumforCrossover.InternalandPairedCrossover.Variable, droppednoncomputablefromParsimoniousPlanar.encVariableandencPlacedClause, addeddecide +kernelexecution tests inComplexityTests/PlanarThreeSATThree.lean, and migrated the 10 remaining concreteencFinitecall sites across the sixComplexityTests/PCP*modules toencFinEnum. Validated with full./scripts/check.shandpython3 scripts/check_hygiene.py. Ready for coordinator review.SamuelSchlesinger commentedon Oct 28, 2026
Worker claim: remaining concrete-type
encFinitemigrationworker-jetski-70d186e6(role:worker)activerefactor/enc-fin-enum-remaining-630-70d186e6(.worktrees/wt-630-remaining-70d186e6, based onorigin/mainat2d3a095f1with refactor(encodings): migrate planar SAT and PCP test encodings to encFinEnum (#630) #1382 merged)encFinitemigrations across the repository to finish refactor(encodings): computable FinEnum-based encoding for concrete finite types #630:{operationEncoding : Operation ↪ List Bool}inRealization/OracleSimulation.lean,OracleSimulation.lean,Parameter.lean, andPresample.leanto matchOpenOracleSimulationandSubstitution.encFinite UnitandencFinite Boolcall sites acrossComplexity/Crypto/Computational/*,ComplexityTests/Crypto/CCA.lean, andComplexityTests/OraclePPT.leantoencFinEnum.{encA : αΓ ↪ List Bool}and{encB : βΓ ↪ List Bool}inMachines/Turing/TM2/PolyTime.lean,Machines/Turing/TM2/PolySpace.lean, andClasses/Space/TM2.lean.Machines/Turing/TM2/Recoding.lean,ComplexityTests/MathlibTM2.lean,ComplexityTests/MathlibTM2Reverse.lean, andComplexityTests/MathlibTM2Space.leantoencFinEnum(Bool,Empty,Fin 4,Fin 1).SamuelSchlesinger commentedon Oct 28, 2026
Worker update: PR opened for remaining concrete-type
encFinitemigrationworker-jetski-70d186e6(role:worker)awaiting review052f9d5f72a8, branchrefactor/enc-fin-enum-remaining-630-70d186e6){operationEncoding : Operation ↪ List Bool}inRealization/OracleSimulation.lean,OracleSimulation.lean,Oracle/Parameter.lean, andPresample.lean, removing unused[Finite Operation]hypotheses and replacingEncodings.FinitewithEncodings.UnaryinOracleSimulation.lean.encFinite UnitandencFinite Boolcall sites acrossCrypto/Computational/*,ComplexityTests/Crypto/CCA.lean, andComplexityTests/OraclePPT.leantoencFinEnum.{encA : αΓ ↪ List Bool}and{encB : βΓ ↪ List Bool}inTM2/PolyTime.lean,TM2/PolySpace.lean, andClasses/Space/TM2.lean, dropping unused[Finite βΓ]hypotheses.TM2/Recoding.lean,ComplexityTests/MathlibTM2.lean,ComplexityTests/MathlibTM2Reverse.lean, andComplexityTests/MathlibTM2Space.leanfromencFinitetoencFinEnumonBool,Empty,Fin 4, andFin 1../scripts/check.shall six gates:build,mk_all,test,lint,lint-style,checkInitImports;check_hygiene.py,check_changed_files.py, andcheck_pr_names.py).refactor(encodings): migrate remaining concrete encFinite uses to enc…
refactor(encodings): migrate planar SAT and PCP test encodings to enc…