Repository navigation
quality(foundations): area checklist #614
Description
Area checklist for #587 (Foundations). Owner: lead-claude-foundations-c4b0c164 (Claude Code, Opus 5.5), delegated by coordinator-claude-c4b0c164-20261023.
Scope. Complexity/Foundations/**, Complexity/Probability/**, Complexity/Languages/** and Complexity/Computability/BitString/Padding.lean: 317 modules, about 63k lines. The audit snapshot is main d52fd12c, and no area file has changed since. Surface counts come from the shared #604 report at 2549de63.
Method. Six read-only sub-audits covered every module: BooleanAnalysis; Combinatorics; Expander; Data; Code and the other Foundations; Probability and Languages. Alongside them I took:
.ileanreference counts;- an alpha-equivalence scan of every area theorem against all of Mathlib and CSLib;
- proof-length and import-closure measurements.
Statements marked checked were confirmed in Lean.
Summary. Hygiene is in good shape:
- no tidy predicates in statements;
- every definition has a docstring;
--check-simpis clean;- module docs name only real declarations;
- apart from deprecated aliases, the only exact duplicate of a Mathlib/CSLib/in-library statement is item C1.
The main costs are structural:
- Hub churn from leaf helpers. The BitString
Basic ← Parity ← Weightspine,Probability/PMF, and the numeral helpers inBitString/Basic. - Layering inversions.
DataandFieldTheoryimportBooleanAnalysisand the affine-disperser proof. - Parallel encodings of one notion. Bits read as a number have 7 forms, event probability 6, and a bit as ±1 has 5.
- Misplaced computational modules. Several live in Foundations.
- Documentation gaps. 425 theorems have no docstring, and about 700 public names used elsewhere are missing from their module docs.
Privatization is a smaller lever than the raw count suggests. Of the report's 410 candidates, the judged verdicts make about 80 private and 10 deleted, and move about 30. The rest are natural API (mono, nonneg, mem_ and bridge lemmas), which should be listed in module docs instead. The per-declaration verdicts and the PMF split map are in the first comment below.
Constraints
- Vendored or submitted copies change only upstream:
Languages/Probabilistic/Basic.leanand two blocks ofProbability/PMF.lean(cslib feat(iteration): share batches on promised state sets #1129, feat(MCSP): add fixed-length core of OS18 Lemma 16 (formula projection and amplification) #1062), andData/Fin/Tuple.lean(a CSLib branch). Data/List/Basic.leanbelongs to perf(list): split Basic into narrow topic modules and migrate consumers #573 (Codex) and is not edited here.- The 11 area files on
refactor/remove-deprecations-587wait for the sweep to land. - Items marked ↔ edit another area's files. They are announced on Quality program: a uniform, library-wide overhaul of interfaces, structure and documentation #587 first, and those client edits stay mechanical.
- No deprecated aliases (doc(agents): drop deprecated aliases while no downstream users exist #588). Every PR updates its in-repo clients, assesses the abstracts, and keeps models, encodings, bounds and nonvacuity.
Priorities: P1 marks structure or high-traffic API, P2 surface, naming, docs and automation with ≥3 clients, P3 polish. Each task is one PR of at most about 40 files unless it says otherwise.
A. Hubs and layering
-
A1 [P1] Cut the BitString
Basic ← Parity ← Weightspine.ParityimportsBitString.Basiconly for a docstring mention; its proofs useBooleanRing.add_self.WeightimportsParityonly forparity_eq_decide_weightandisSymmetric_parity.- Change: drop both edges, put the two bridge theorems in a small module imported by their users, and add explicit imports to about 9 clients.
- Effect: the import closure of
Basicfalls from 700 to 542 library modules, and that ofParityfrom 598 to 136. There are no statement changes.
-
A2 [P1] Put bit and sign values below Boolean analysis.
- New
Data/BitString/Sign.leanholdssignVal,bitValand their lemmas (signVal_mul_self,signVal_xor,signVal_eq_neg_one_pow,neg_one_pow_toNat_xor,bitVal_pow,neg_one_pow_toNat_eq_one_sub_two_mul_bitVal,sq_signVal_sub_signVal, …).FourierandLowDegreeimport it. - Add
signVal_eq_one_sub_two_mul_bitVal; it is re-proved inline atQueryComplexity/Degree.lean:234. - This fixes
Data/BitString/QuadraticFormandCombinatorics/AffineDisperser/Bits, which importBooleanAnalysis.LowDegree(MvPolynomial, span and dimension theory) only forbitVal. - About 12 files; ↔ import edits in Communication, TreeEval, Circuit/Frontier and QueryComplexity.
- New
-
A3 [P1] Split the
Probability/PMF.leanhub, in three PRs.- It has 40 direct importers and 461 transitive ones. 360 of those import it only through
Languages/Probabilistic/Basic, which uses only the vendored feat(iteration): share batches on promised state sets #1129 block. - (a) Create
PMF/Event(thetoOuterMeasure_*lemmas,filter_apply_toReal, the BooleantoReal_*),PMF/Bind(bind_congr_on_support,bind_apply_of_forall,exists_bind_apply_le, …) andPMF/Uniform. Movemap_injectivetoPMF/Map. The vendored blocks stay unchanged. - (b) Clients import the topic module they use, one PR per directory (↔ Crypto, ↔ Computability, then Probability/Languages).
- (c)
PairwiseIndependentandConditioningimportCslib.Probability.PMFdirectly.
- It has 40 direct importers and 461 transitive ones. 360 of those import it only through
-
A4 [P1] One binary-numeral module, in two PRs. Seven readings of bits as a number coexist:
equivFin, plus an inline copy inListCode.decodeBits(checkedrfl);- Batteries'
Nat.ofBitsin Packing, SumTree and Multiplication; List.foldr Nat.bit 0inNat/BitsandMatrix/Binary;lsbValue;binaryValue(most significant bit first);- explicit sums.
The two PRs:
- (a) New
BitString/BinaryholdsequivFin,val_equivFin_*andindexBits.Basickeepscard,add_selfandadd_cancel_*. Movedecide_equivFin_le_succto its only user,Circuit/Boolean/Comparison↔. Repoint about 38 importers. - (b) Add the bridges
↑(equivFin n x) = Nat.ofBits x(checked),equivFin_symm_applyandlsbValue_ofFn, and makebinaryValue_reverse_ofFnpublic (today it is private inMCSP/NP.lean:103). DeletelsbValue_lt(duplicatesNat.foldr_bit_lt) andfoldr_lowBits. RewritedecodeBitsthroughequivFin/indexBits. - Give
ofBits_eq_lsbValueone public home here and delete its private copies inClasses/Counting/Space.leanand in feat(crypto): Schnorr identification under the discrete-logarithm assumption #636 (DiscreteLog/SchnorrGroup.lean). If this lands first, coordinate with feat(crypto): Schnorr identification under the discrete-logarithm assumption #636's author on feat(crypto): Sigma protocols, Schnorr identification and Fiat–Shamir signatures (Boneh–Shoup ch. 19) #581.
-
A5 [P1] Separate binary-field infrastructure from the affine-disperser proof.
FieldTheory/Finite/BinaryFieldpublicly importsAffineDisperser.Bits, and with it the whole disperser chain, forbitEquiv.HardnessAmplification/Scheduletherefore loads that proof.- Move
bitEquivtoData/BitString/ZModTwo, andpolyOfCode/leastIrreducible*intoFieldTheory/Finite. - Drop
hpfromirreducible_leastIrreducible/monic_leastIrreducibleand delete the primed copies. - Move the subfield bounds to
FieldTheory/Finite/Subfield.card_subfield_leiscard_subfield_le_of_lt_prime (L := 1)(checked). - Put
LineCode/Field'snonempty_addEquiv_bitStringandexists_field_card_eq_two_powbeside them, and makeequivBitsan additive equivalence. - About 24 files; ↔ Computability AffineDisperser/HardnessEncoding imports.
-
A6 [P1] ↔ Move computational modules out of Foundations.
Expander/ReingoldEval(program counters and stack frames) goes next toAlgorithms/Reachability/Reingold.Expander/TowerTable{,/Family}(list tables) go next toPolyTime/RotationMap/Tower.- Delete
TowerTable.numberedIndex, which equals(ZigzagTowerVertex.equivFin …).val. FunctionalGraph/DistinguishedPointsis algorithm semantics with no library users.- Needs the destination owners' agreement.
-
A7 [P1] ↔ Move the Fourier-degree bridge into Foundations.
- Move the
Cslib.BitStringpart ofComputability/QueryComplexity/Degree.lean(totalDegree,mem_lowDegree_iff_fourierCoeff_eq_zero, …) and thesignSpanpart ofLowDegreeParityinto a newBooleanAnalysis/Degree.lean. - Restate Bonami, FourierDegree and RelevantCoordinates with
f ∈ lowDegree ℝ ι k. The raw∀ S, k < #S → fourierCoeff f S = 0occurs 12 times; keep it as a corollary form. - Bonami's module doc cites a lemma its imports cannot reach.
- Move the
-
A8 [P2] Split
BitString/PartialAssignment(854 lines).- The core part keeps
fill,free,assignandExtends; 9 importers use only these. - Counting and random restrictions go to their own module; their 6 users are Andreev, Subbotovskaya, Håstad ×2, LMN and Switching.
- Extract
free_update_noneandExtends.update_{some,none}, which shortenssum_extensions_updatefrom 66 to about 25 lines, and privatize the 4 counting helpers.
- The core part keeps
-
A9 [P2] Split
BitString/Weight(after A1).- The weight core takes
ballSizeandweight_cons_succfrom CoverCoding. A newBitString/Thresholdholdsthreshold,majority,strictMajorityandIsSymmetric. - Add a
BitString nform ofweight_le: 9 modules writesimpa using weight_le x. - Add
(List.ofFn x).count true = weight x, re-proved inRepeatandToda/Counting. - About 25 files.
- The weight core takes
-
A10 [P2] Expander module structure.
- Split
Products.lean(709 lines) into Tensor, Zigzag and Replacement. - Delete the superseded
TowerBaseby restatingexists_spectralExpansion_zigzagTower_lefrom the explicitaffinePlaneTowerBase (ZMod 257). - Rename
ReingoldVertex, a generic nested product that the tower also uses, and give it a singleequivFinnumbering; three implementations exist today.
- Split
B. Placement (no statement changes)
- B1 [P2] Put codes in
Data/Code.- Move
Data/ListDecodingtoData/Code/ListDecoding. - Merge
Data/HammingBound, whose only client isCode/HammingBound, into it, stated once throughminDist. - Keep one binary ball-size lemma; there are three today (
Code.card_filter_hammingNorm_le_eq_sum_choose,BitString.card_filter_weight_le,CoverCoding.ballSize).
- Move
- B2 [P2] Move general lemmas out of BooleanAnalysis.
one_sub_pow_mul_one_add_mul_le_oneis a real inequality inCslib.BitString, andExpander/TowerBaseimports Bernoulli only for it. It goes to Analysis.IsLowerSet.antitone_indicator_onegoes toOrder/UpperLower.expect_comp_arrowCongr,expect_sumElimandexpect_restrict_coordinatesgo toData/Finset/Expect.exists_eq_parityOn_iffgoes toBitString/Parity; today Hadamard imports BLR to get it.- Tensorization's
bernoulliAverage_sumElimgoes to Bernoulli, and itsnoiseOp_*lemmas to Noise.
- B3 [P2] Place the Hadamard code and the long code.
hadamardCode, its Fourier-free lemmas andselfCorrectgo toData/Code/Hadamard. 6 of the 8 importers use only these, yet load Linearity, Convolution and Fourier.longCode*goes toLongCode.- Mark
hadamardCode_apply@[simp]; it appears in 13 simp sets. - ↔ import edits in DecisionTree, HardnessAmplification, WeightedThreshold and Communication.
- B4 [P2] Move general algebra filed under
Cslib.AffineDisperser(after A5).SubspacePolynomial(linearized polynomials) goes toFieldTheory/Finite/LinearizedPolynomial.Mooregoes toLinearAlgebra/Matrix/Moore, withdet_eq_permanentrenamedMatrix.det_eq_permanent_of_charTwo.TensorBasisgoes to FieldTheory,PivotSpaceandCubeSumto LinearAlgebra, andPrimestoData/Nat/Prime.- Replace the 11 copies of
have : CharP F 2 := charP_of_injective_algebraMap' ….
- B5 [P2] Probability placement.
- Measure-level Pinsker goes to
Probability/Pinsker, a Mathlib candidate. dist_eq_tvDist_toMeasure_div_twoanddist_eq_sum_filter_ltgo toStatisticalDistance.Matrix.toeplitzand its 11 lemmas go toLinearAlgebra/Matrix/Toeplitz.- The Shearer and Loomis–Whitney counting statements, which contain no PMF, move to
Cslib.Finset.*. toMeasure_bind_pairgoes to Product.
- Measure-level Pinsker goes to
- B6 [P3] Miscellaneous placement.
Function.iterate_trans(14 call sites) moves out ofRelation/RelatesWithinSteps.- The two LinearAlgebra
Rankfiles are sorted by topic. Analysis/MarkovInequalityis Markov brothers': rename the module, and renameabs_eval_derivative_leto…_le_sq_mul.maj3/majTreemove out ofCode/SelfCorrection.- The geometry and measure lemmas in Sheppard and Cap move to their topic homes.
list_prefix_*andarithmeticProgressionCountgo to Data.
- B7 [P2] Data leaf modules, in two PRs.
BitString/Hoeffdinggoes to Combinatorics, andBitString/QuadraticFormto BooleanAnalysis.BitString/AffineDisperserandCombinatorics/AffineDisperser/AffineSubspaceswap homes. AddisAffine_iff_exists_affineMap(checked).- The seven ℕ-word modules (Projection, HighestDiff, Packing, PackedCount, Sparse, SumTree, Multiplication) never mention
BitString n. They go toData/Nat/Bitwise, withNat.*names for generic facts. - ↔ Selection, Broadcast, Uhlig, Point and Padding move to their circuit or machine clients.
- B8 [P3] The OrderedSet interface.
- Move the
Semantics/Stateful/OrderedSetinterface toData/OrderedSet/Spec, and its examples into tests. - Prove
OrderedSet.least = Finset.min(checked).
- Move the
C. Reuse and statements
- C1 [P1] Remove finite-field duplicates.
- Delete
LineCode.HighRate.sum_eval_eq_zero_of_natDegree_lt, which isFiniteField.sum_eval_eq_zero_of_natDegree_lt(checked). - Keep one public lemma for restricting a multivariate polynomial to a line. There are three copies today:
FiniteField.natDegree_eval₂_line_le, a private one inLocalDecoding, and one inline inlowDegreeExtension_mem_reedMuller. - Derive
eq_zero_of_forall_sum_mul_prod_pow_eq_zerofromlinearIndependent_prod_pow(checked), which drops a ULift workaround. - About 7 files.
- Delete
- C2 [P2] FunctionalGraph, in two PRs.
- (a) Rewrite the 11
by classical; exact …definitions asopen scoped Classical interms. They are definitionally equal (checked), so no client changes. DefinecycleSetviaperiodicOrbit(checked). AddtransientDepth_eq_zero_of_mem_periodicPtsandcycleLength_eq_minimalPeriod_of_mem_periodicPts, re-derived 4 times in Iteration, and add@[simp]to the*_iterateandmem_*lemmas. - (b) Deduplicate
Spectrum, which has no library users. ItscycleLength_le_cardis Mathlib'sminimalPeriod_le_card(checked), and the equal-iterates fact exists 3 times. Rename misleading names; for example,forest_edges_mergeproves that edges do not merge.
- (a) Rewrite the 11
- C3 [P2] Canonical tuple splitting and packing (after A4).
fstBits/sndBitsareFin.appendEquiv(rfl; 54 uses in 5 modules).packRecordsandpointBits/targetBits/lineBitsareblocksEquiv.symm(rfl).List.ofFn_eq_appendisList.ofFn_add.- Generalize
blocksEquivfromBoolto any type.
- C4 [P2] ↔ Stateful API, in two PRs (clients in Algorithms).
totalre-implementsList.sum, so deletetotal_appendandtotal_one.- Rename
spec_total_*toSpec.totalCost_*,valid_history_of_totaltoSpec.validHistory_of_forall_valid, and the existence theorems named*.runtoexists_executes. - Add
@[simp]equation lemmas forrunClient,run,totalCost,ValidHistoryandproduct; they remove 15simp [Spec.runClient, …]unfoldings. - Add the
Spec.toFLTS(CSLib) andeval_eq_liftMbridges. - Fix the module docs: Basic omits 15 API names, and 6 modules lack References.
- C5 [P2] ↔ InductiveCounting.
Relation/InductiveCounting(26 public declarations, no library users) andAlgorithms/Reachability/InductiveCounting/Semanticsformalize the BFS rounds twice.- Define
roundSetfromreachableWithin, or delete the unused half. - Cite [Immerman1988] and [Szelepcsenyi1987].
- C6 [P2] Code interface, in two PRs.
- Add
Sudan.WeightedDegreeLE; the raw quantifier has 13 copies (↔ 4 Circuit clients). GiveIsInterpolanta single weight convention. - Add
Code.IsAsymptoticallyGoodfor code families, and restate Justesen with it; today it is a 4-way conjunction for eachs. - Build the decoders from the explicit interpolant rather than
Classical.choose. - Name the Hadamard result
minDist_range_hadamardCode.
- Add
- C7 [P2] Korten-layer cleanup.
BooleanAnalysis/HarmonicMeandefines onlyharmonicTransform, so rename itHarmonicTransform. Its private two-point lemmas are cases ofharmonicMean_le_expectandharmonicMean_mono.- Define
resampleviaSet.piecewise, and addprojectionAverage_eq_expect_piecewiseso the FourierRestriction results apply. - Rename paper-label theorem names after their statements:
coordinateFiber_good_probability,bernoulliAverage_few_light_patterns,expect_half_of_flip,IsDensityLimit.mono_deficit,bernoulliAverage_bias_antitone, …
- C8 [P2] Hash and concentration bridges.
- Add
IsPairwiseIndependentHash.isTwoUniversaland a density-form iff; this removes the 15-lemmasimpa onlyatProbability/BitString/LinearHash/Collisions.lean:60. - Add the expectation of a coordinate sum under
pi, and a two-sided tail lemma for the three copies of that step. - Derive Hoeffding from McDiarmid while keeping its support-only hypothesis.
- Add
- C9 [P2] Bridges to Mathlib and CSLib (additive).
- Expander spectrum: relate
λ(G) = ‖W|₁⊥‖to Rayleigh quotients, eigenvalues andadjMatrix. The docstrings atExpander/Basic:265andCheeger:102state eigenvalue facts that are not theorems. - Generalize
BitString.lpNormto anyFintypeand bridge it toMeasureTheory.lpNorm. - Add
toMeasure_uniformOfFinset. - ↔ Add
Multigraph.toGraph(Mathlib'sGraph), moved here fromCircuit/Frontier. - Add
flipOn_eq_flipBlock(CSLib), and replaceSensitivitySeparation's localflip↔.
- Expander spectrum: relate
- C10 [P3] Expander statements.
- The Cheeger and Lazy results quantify over any
Hwith an equation for its walk; state them forG.lazyinstead. le_edgeExpansion_of_spectralExpansion_lehard-codesFin 120and1 - 1/360000; generalize it.- Add an edge-multiplicity API for the "half self-loops" hypothesis, which is spelled out 6 times.
- The Cheeger and Lazy results quantify over any
- C11 [P3] Namespaces against upstream markers (AGENTS.md rule 1).
CentralBinomialhas a Mathlib marker but uses theCslibnamespace.HypergeometricandPowersetTailhave CSLib markers but use the rootFinsetnamespace.- ↔ The samplers (
sampleBinaryNat, …) move toCslib.ProbComp, touching 25 files. OracleComp.HasQueryBoundsandProbOracleComp.HasQueryBoundsclash.killTimeis not graph theory and should leaveCslib.RotationMap.
D. Automation
- D1 [P1]
OracleComp/evalautomation.- Add
@[simp] run_interpret_{pure,bind,map,query}forStateT. 77 simp calls chaininterpret_bind, StateT.run_bind, and 57 of them also needmonad_bind_eq_bind. - Restate
runWith_*as documented simp corollaries. - Add
@[simp] mem_support_eval_{bind,pure,map,uniform}_iff, replacing 44 hand-written chains (32 in Crypto). - Add an
OracleComp.inductioneliminator, replacing 7–9change … (query q >>= cont)sites, andProbComp.isMonadHom_eval, restated 4 times. - The new lemmas go outside the vendored Basic. A sweep of the call sites is an optional follow-up.
- Add
- D2 [P2] ↔ One vocabulary for event probability (Crypto). Needs a notation decision.
- Today
toOuterMeasure s, itstoReal,toMeasure/μ.real,(eval p true).toReal,Game.succProbability, 12 localPr[p]notations (with two definitions) anddensall coexist. - Provide one scoped
Pr[…]notation with asuccProbabilitylemma. - Use Mathlib's
PMF.toMeasure_apply_eq_toOuterMeasureto remove 10 measurability plumbings. - Merge the five uniform-image-mass lemmas into one ℝ≥0∞ form and one
densform.
- Today
- D3 [P2] Make
bind_map_prodMk_applypublic. It has a dependent kernel and today exists only as a private copy in Divergence.PMF.mapis unfolded in 83 simp calls across 52 files. - D4 [P2]
RotationMapsimp set.- Add the missing
rot_*lemmas: reindex, ofInvolutive, slotGraph, extendLabels, contract, lazy, restrict and complete. - Make
rot_pow_succpublic, and markrot_zigzagandrot_affinePlane@[simp]. - This removes the 10-line
changeinHom.powRot_mapand unfoldings in TowerTable,PCP/Encoded/PreprocessandUSTCON/Reader. - Optional: a
positivityextension forspectralExpansion, replacing 59 manualspectralExpansion_nonnegcalls in 20 files.
- Add the missing
- D5 [P2] Let
powRottake a raw rotation function (after D4).tensorRotandzigzagRotalready do.Walk/WithInput's three recursions then become instances, and ↔ it moves next to its only certificate consumer. - D6 [P2] Boolean-analysis lemmas clients re-derive.
fourierCoeff_chi, unfolded by hand 3 times.bernoulliAverage_one_half.- One coordinate-split lemma instead of four (
Bernoulli.sum_cons,expect_univ_fin_cons,TwoPoint.expect_unit, …). expect_boole_sq, proved three times in Expander.
E. Surface and documentation (per subtree, after the moves above)
@[expose] is a no-op in the 114 modules that define no def, abbrev or instance. The report also finds 230 exposed definitions that no other module unfolds. Narrowing is build-verified.
- E1 [P1] Interface of the highest-fan-out modules.
- Modules (rebuild fan-out in parentheses): StackTape (116), BiTape (115), BitString/Block (346), BitString/List/{Operations,Binary} (252/240), Enumeration (238), List/BalancedFold (227), Conditioning (158), ProbComp Iteration (146), Languages/Probabilistic/BitString (128), Product (126), Collision, Flip.
- Make the true helpers private, e.g.
listBlank_mk_cons_toListandapply_le_map_fst. - Delete
read_cons_zero/succandfoldr_lowBits. - Keep
@[expose]only on definitions that downstream proofs unfold. - List the kept API in module docs, and add the missing docstrings (StackTape 29, BiTape 26).
- E2 [P2] BooleanAnalysis. Make 12 helpers private (4 KKL steps, …) and delete 1. Add 38 docstrings (15 in LowDegree). List 103 used-but-unlisted names: Fourier 22, Fibers 17, LowDegree 15, Bernoulli 12.
- E3 [P2] Combinatorics, excluding Expander.
- Make 18 helpers private.
- Add 139 docstrings. The most used undocumented ones are
cycleLength_pos(27 uses),phase_lt(22) andtransientDepth_eq_zero_iff. - Fill the module-doc lists: Explicit 17, FunctionalGraph 14, Multigraph 10.
- E4 [P2] Expander.
- Make 5 helpers private and delete 2. Add 6 docstrings.
- List 58 unlisted names: TowerTable 10, Basic 9 (including
spectralExpansion_nonneg, used in 17 modules), Walk 8. - Move
spectralExpansion_eq_of_walk_eqinto Basic, so only Basic unfoldsspectralExpansion.
- E5 [P2] Data. Make 15 helpers private and delete 3. Add 174 docstrings (PartialAssignment 24). Add 106 module-doc items, including
assign,unassign,outsideandEnumeration.ofNodup/range/singleton. - E6 [P2] Code and the other Foundations.
- Make about 12 helpers private (
shiftEval, theSpansKernelset, …). - Add 30 docstrings, including
minDist_le_hammingDist,mem_reedSolomonandmem_reedMuller. - Add References sections to Stateful ×6 and SubmatrixRobust, and list about 35 endpoints.
- Make about 12 helpers private (
- E7 [P2] Probability and Languages.
- Make 14 helpers private and add 41 docstrings, including the 10
runWith_*/acceptProbWith_*inOracle/Interaction. - Fix the wrong title of
PMF/Expectand the list glitch inApproximateCounting/Relative.
- Make 14 helpers private and add 41 docstrings, including the 10
- E8 [P1] Upstream docs for
Languages/Probabilistic/Basic, via cslib feat(iteration): share batches on promised state sets #1129, then re-sync. It needs## Mainsections, docstrings for its 8 simp lemmas (evalhas 136 client modules), and a statement of the normal form:eval_bindturns>>=intoPMF.bind. - E9 [P2] A Foundations chapter for the guide (doc(guide): a Verso guide that drives interface and documentation quality #585). Cover bit strings, Fourier analysis, PMF/ProbComp and codes, reusing the checked examples from G. Coordinate with doc(guide): a Verso guide that drives interface and documentation quality #585's owner.
F. Proofs
- F1 [P3] Proof outliers that hide reusable steps. Each is done after the theme that touches its module.
LocalListDecoding.exists_card_lineListDecode_ne_le(154 lines).card_filter_lineAgree_le_mul_sq_le(102): use Chebyshev fromFintype.mul_dens_filter_le_expect.PowersetTail.four_mul_sum_card_filter_notMem_le(151): extractFinset.mul_card_filter_le_sum, used 4 times.AffineDisperser.exists_traceSym_ne(143),SubspacePolynomial.exists_coeffPattern(138),Threshold.eventually_explicitThreshold_le(123).ReingoldEval.exists_iterate_call: 113 lines including itswhereclause.- The two
Hittingtheorems (62 lines each): they reprove library facts. Presample.run_interpret_presample(60), after D1.- The duplicated 10-lemma
simpain RandomOracle.
G. Tests
- G1 [P2] A new
ComplexityTests/BitString.lean.- Every numeral reading agrees on a concrete word.
- Examples for weight, parity, threshold, blocks,
ofList,listRow,PartialAssignment.fillandcard_withFree. weightLayer_nonemptyas a nonvacuity instance.
- G2 [P2] Boolean analysis.
- BLR on a concrete non-parity.
exists_mirror_setwith X = Y = univ.noiseSensitivity_le_mul_totalInfluenceon and₂.- The Hadamard tester with ε > 0.
- One check for each of the 8 untested modules.
- G3 [P2] Combinatorics and Expander.
- The sunflower lemma,
IsGrading.exists_sdiff,card_edist_le_leand the central-binomial bounds. - The mixing lemma on a Mathlib
SimpleGraph.
- The sunflower lemma,
- G4 [P2] Codes, linear algebra and probability.
kernelVecon aZMod 2matrix,Sudan.interpolant/hintDecode, andlowDegreeExtensionoverZMod 3.- HarmonicMean,
IsFiveCycleand Rank. - The 15 Probability results covered only by
#print axioms: Toeplitz surjectivity, leftover-hash variants, the entropy chain rule, …
Order
The first three PRs are E1, A2 and A1.
- E1 and A2 have no file overlap with each other, with open PRs, or with the sweep.
- A1 starts once refactor(crypto): define cryptographic primitives with plain computability #568 lands, because its client
Crypto/Computational/HardCore.leanis in refactor(crypto): define cryptographic primitives with plain computability #568.
Next come A3(a), C1 and C2(a). Status updates go in this issue.
Activity
SamuelSchlesinger commentedon Oct 23, 2026
Per-declaration verdicts behind the surface items (E1–E7). They are the sub-audits' judgement on the #604 report's candidates at
d52fd12c. Only rows that change something are listed: private, delete, move or rename. Every other candidate stays public and should be listed in its module doc. Each PR re-checks its rows against the current source.BooleanAnalysis (E2, B2): 23 of 75 candidates
IsLowerSet.antitone_indicator_oneone_sub_pow_mul_one_add_mul_le_onesum_uniformMass_muluniformMass_le_rpowexpect_restrict_coordinatesexpect_log_card_fibersignVal_eq_neg_one_powneg_one_pow_toNat_xorsq_signVal_sub_signValexpect_mul_noiseOp_mul_leabs_derivative_signVal_rpowbernoulliAverage_sumElimnoiseOp_comp_arrowCongrnoiseOp_of_isEmptyexpect_comp_arrowCongrexpect_sumElimsum_sum_filter_mem_fourierCoeff_sq_div_cardsum_filter_mem_fourierCoeff_sq_div_card_le_influencesum_filter_mem_fourierCoeff_sq_div_card_lesum_filter_mem_fourierCoeff_sq_div_card_mul_log_lecoordinateMarginal_normalizebitVal_powneg_one_pow_toNat_eq_one_sub_two_mul_bitValCombinatorics (E3, C2): 22 of 102 candidates
Cslib.AffineDisperser.exists_subset_card_eq_mul_sum_leCslib.AffineDisperser.exists_code_irreducibleCslib.AffineDisperser.leastIrreducible_eqCslib.AffineDisperser.linearizedEval_sub_mulCslib.card_middle_leCslib.IsGrading.exists_sdiff_oneCslib.FunctionalGraph.checkpointHull_predecessorCslib.FunctionalGraph.minimalPeriod_eq_of_periodic_iteratesCslib.FunctionalGraph.scan_invariantCslib.FunctionalGraph.periodWalk_invariantCslib.FunctionalGraph.ForestDuality.iter_add_of_eqCslib.FunctionalGraph.ForestDuality.BeforeCslib.FunctionalGraph.ForestDuality.before_wellFoundedCslib.FunctionalGraph.ForestDuality.shared_vertexCslib.FunctionalGraph.forestPath_stepCslib.FunctionalGraph.forestPath_iterate_prefixCslib.FunctionalGraph.list_prefix_leCslib.FunctionalGraph.reaches_from_prefixCslib.FunctionalGraph.forest_backtrack_interiorCslib.FunctionalGraph.cycleLength_le_cardCslib.FunctionalGraph.card_add_mod_ltCslib.FunctionalGraph.minimalPeriod_iterate_cardExpander (E4): 10 of 56 candidates
weightedWalk_eq_mulweightedWalk_eq_zero_of_eq_zero(h 0 v = 0 -> weightedWalk t h v = 0), which is what …contractDart_injectivefinSlotEncode_fst_surjectivespectralExpansion_eq_of_walk_eqreachable_root_neighbor_reingoldreachable_slotGraph_zpownumberedIndexexpect_mul_walkAt_lengthexpect_walkDart_mkaffinePlane_rotData (E1, E5): 21 of 57 candidates
Cslib.BitString.weight_cons_succCslib.BitString.foldr_lowBitsCslib.BitString.mulPrefix_succCslib.BitString.mulPrefix_modCslib.BitString.mulPrefix_eq_mulCslib.BitString.mulCarry_succCslib.BitString.mulPrefix_eq_of_carriesCslib.BitString.PartialAssignment.card_filter_extensions_free_eqCslib.BitString.PartialAssignment.card_filter_extensions_not_nonempty_interCslib.BitString.PartialAssignment.card_filter_extends_withFreeCslib.BitString.PartialAssignment.card_filter_outside_eqCslib.BitString.testBit_eq_false_of_widthCslib.BitString.shiftRight_monoCslib.BitString.differingBits_nonemptyCslib.BitString.shortWords_eq_biUnionCslib.SignQueries.weight_indicatorCslib.SignQueries.product_indicatorCslib.SignQueries.sign_eval_queryPolynomialCslib.Turing.StackTape.listBlank_mk_cons_toListCslib.Turing.StackTape.read_cons_zeroCslib.Turing.StackTape.read_cons_succCode and other Foundations (E6): 20 of 56 candidates
Cslib.Code.shiftEvalCslib.Code.eval_shiftEvalCslib.Code.lineAgree_smulCslib.Code.card_hintDecode_line_ne_leCslib.Code.two_ne_of_maj3_neSudan.IsInterpolant.natDegree_eval_leSudan.bivariateOf_congrSudan.eq_bivariateOfAffineDisperser.leastIrreducible_zeroAffineDisperser.irreducible_leastIrreducible'AffineDisperser.monic_leastIrreducible'SpansKernelspansKernel_singleSpansKernel.kernelStepspansKernel_kernelBasisUpTospansKernel_kernelBasisMatrix.span_range_row_submatrix_eq_mapMatrix.ncard_preimage_add_ncard_preimage_lespec_total_onetotal_appendProbability and Languages (E7): 15 of 84 candidates
ProbComp.testProbabilityLT_error_le_deviationBitString.LinearHash.eval_extract_ofFnRandomOracle.run_interpret_memoize_transcriptRandomOracle.run_interpret_memoize_transcript_probBitString.LinearHash.uniform_prefixProbability.PMF.apply_le_map_fstProbability.PMF.dist_eq_sum_filter_ltProbability.mean_conditionalEntropy_hash_leProbability.exists_ambiguous_of_card_ne_oneProbability.card_ambiguous_mul_leProbability.PMF.conditionalEntropy_map_restrict_leProbability.PMF.entropy_map_restrict_univBitString.chi_poweringBitString.expect_signVal_dotProductBitString.card_filter_sum_pow_eq_zero_leA3: proposed home of each
Probability/PMF.leandeclaration (35)SamuelSchlesinger commentedon Oct 23, 2026
active (
lead-claude-foundations-c4b0c164). Samuel lifted the 40-file bound for mechanical themes, so group E now lands as area-wide PRs, each with its rule stated.Data/BitString/Sign): running the full check.Main definitionsentries), stacked on refactor(foundations): make judged proof helpers private #628: build next.SamuelSchlesinger commentedon Oct 24, 2026
Progress (
lead-claude-foundations-c4b0c164):Data/BitString/Sign), refactor(bitstring): cut the Basic ← Parity ← Weight import spine #650 (A1: spine cut;Basic701→571 andParity599→140 transitive importers).@[expose]narrowing on the high-fan-out modules.SamuelSchlesinger commentedon Oct 24, 2026
Changes requested on docs PR #653 by
coordinator-reviewer-codex-20261023: two new Reed–Solomon docstrings call the degree-bound parameter an unconditional dimension, although the lemmas assume neither distinct evaluation points nork ≤ n. Replace that phrase with “degree bound k” or the code name. The remaining docs pass review; see the inline finding and request a delta review after the wording fix.SamuelSchlesinger commentedon Oct 24, 2026
#653's degree/dimension wording is corrected and independently reapproved at
fe46836bbycoordinator-reviewer-codex-20261023. Earlier documentation review carries forward; require green CI at the new head. See the delta verdict on #653.SamuelSchlesinger commentedon Oct 24, 2026
Progress (
lead-claude-foundations-c4b0c164):k" docstrings) is fixed infe46836b; delta review requested.@[expose]narrowing (E9 and the expose part of E1): deferred. On the high-fan-out modules most candidate definitions have@[simp] … := rflequation lemmas (StackTape.read,enum,flipOn,PMF.pi,ProbComp.iterate, …). Those lemmas need the body, so the definitions must stay exposed. What remains narrowable (blockBits,listXorSelected,balancedFold,conditionalSnd,collisionProbability) are stable definitions, so the interface payoff is negligible. I'm not opening that PR.BitString.uniformMass_le_rpow, which refactor(foundations): make judged proof helpers private #628 makes private, turned out to be what a client needs to applybernoulliAverage_few_light_patterns. It is API, not a proof step; I'll make it public again in a later Boolean-analysis PR.SamuelSchlesinger commentedon Oct 24, 2026
Machines/WordRAM owner decision (
coordinator-codex-01a16ab8): agree with A6. MoveReingoldEvaltoAlgorithms/Reachability/ReingoldEval.lean, andTowerTable{,/Family}toComputability/Machines/Turing/MultiTape/Complexity/PolyTime/RotationMap/TowerTable{,/Family}.lean, alongside the existing Tower/Family certificates. Keep the mathematical Reingold/tower/affine-family models in Foundations, preserve declaration names and semantics, and update every import/client together. The current dependency direction supports these destinations; recheck file overlap before editing.SamuelSchlesinger commentedon Oct 24, 2026
#664's examples pass the independent mathematical/API review.
coordinator-reviewer-codex-20261023requested only a small proof-hygiene correction: nonterminal baresimpcalls in the Boolean-analysis and combinatorics tests. See the inline findings and request delta review after fixing them. The empty hypergeometric tail improvement is explicitly optional.SamuelSchlesinger commentedon Oct 24, 2026
blocked: paused for capacity (
lead-claude-foundations-c4b0c164).Open PRs:
fe46836b).b73b5a72).Next items, in order:
refactor/pmf-topics-614(not pushed). Rebase after chore: prune unnecessary noncomputable markers and superfluous classical #632 and refactor(classes): make proof helpers private across the classes area #634 merge, then regenerate the client imports with the saved script.ReingoldEvalandTowerTableout of Foundations. Codex agreed. Do it after doc(foundations): document every public declaration and list public definitions #653 and chore: prune unnecessary noncomputable markers and superfluous classical #632 merge. Review goes tocoordinator-codex-01a16ab8; coordinate any S1 files withworker-codex-01a16ab8-608.lsbValue_eq_foldr_bit,val_equivFin_eq_ofBitsandlsbValue_ofFn, makebinaryValue_reverse_ofFnpublic, and delete the private copies inCounting/Space,MCSP/NPand feat(crypto): Schnorr identification under the discrete-logarithm assumption #636. Do it after refactor(foundations): make judged proof helpers private #628, doc(foundations): document every public declaration and list public definitions #653, refactor(classes): make proof helpers private across the classes area #634 and refactor(classes): split the Inclusions hub into narrow modules #646.reachable_slotGraph_zpowmade private, anduniformMass_le_rpowmade public again.feat/expander-spectral-bridge-614(no PR yet).SamuelSchlesinger commentedon Oct 24, 2026
#664's proof-hygiene cleanup is fixed and independently reapproved at
b73b5a72bycoordinator-reviewer-codex-20261023; the inline findings are resolved. Earlier mathematical review carries forward. See the delta verdict and require green CI on the revised head.SamuelSchlesinger commentedon Oct 24, 2026
active again (
lead-claude-foundations-c4b0c164). A3, the PMF hub split, is reapplied on currentmain; its 86 client imports are regenerated and the build is running. Next are A6 (after #653 lands) and A7 (with the Classes lead on #610).SamuelSchlesinger commentedon Oct 24, 2026
awaiting review (
worker-claude-614-a3-c4b0c164): A3, the PMF hub split, is #693 at2d21f3d4, rebased onto currentmain. A change to a candidate PMF lemma used to rebuild 438 library modules. It now rebuilds 37 (Event), 38 (Bind) or 9 (Uniform). All six gates pass. Review is requested fromcoordinator-reviewer-codex-20261023. The PR overlaps #653 in four files; whichever lands second rebases.refactor(foundations): make judged proof helpers private
refactor(probability): split the PMF hub into topic modules
129 remaining items
refactor(Code): Sudan WeightedDegreeLE, IsAsymptoticallyGood, and exp…
feat(Foundations,Probability): add Mathlib and CSLib bridges for LpNo…
refactor(Combinatorics,Code): align namespaces with upstream markers …
refactor(Foundations,Algorithms,Probabilistic): factor remaining F1 p…
SamuelSchlesinger commentedon Oct 24, 2026
Status update —
awaiting review(Comment-only documentation and module-doc alignment for remaining non-vendoredFoundationsandInteractivedrift)worker-jetski-dcee3f78(dcee3f78-c6ce-4323-a285-39427f388c18, with worker subagentsfb170437,269933f7)doc/foundations-interactive-docs-614, headd02b6477)45/-- ... -/declaration docstring blocks and aligns/-! ... -/module docstrings (## Main definitions,## Main results, and## References) across14-- upstream: candidatefiles (10inFoundations/,Languages/, andProbability/, plus4inComputability/Interactive/). LeavesComplexity/Languages/Probabilistic/Basic.leanand the-- upstream: submitted #1129block ofComplexity/Probability/PMF.leanuntouched per the#614constraint and Item E8../scripts/check.shgates,check_hygiene.py --check-simp,check_tidy_surface.py,build_abstracts.py --check, mechanical comment-stripping check (strip_docs(HEAD~1) == strip_docs(HEAD)), andquality_report.py(Otherreaches0 · 0 / 22 · 0 / 37undocumented and0 · 0doc drift;Foundationsreaches0undocumented and0 · 0doc drift outside the vendoredcslib #1129copy).SamuelSchlesinger commentedon Oct 24, 2026
Status update (
worker-jetski-80c34aaa, session80c34aaa-5899-48b7-ada9-c104a7032911): awaiting review on PR #876 at623eb05019f5483faf296078e8362322128a709e(addressed coordinator review feedback on Item C9 bullet 5flipOnsweep).refactor: rename ReingoldVertex to IteratedProd and unify equivFin nu…
refactor(Circuit,Turing): relocate circuit/machine bit-string leaves …
refactor(Foundations/Combinatorics/Expander): deduplicate abs_expect_…
refactor(QueryComplexity/SensitivitySeparation): replace Internal.fli…
doc(Foundations,Interactive): document public declarations and align …
SamuelSchlesinger commentedon Oct 24, 2026
Peer coordinator-reviewer-codex-20261023 (not Samuel): #879's bounded documentation milestone LANDED at 45f7a88, under Codex's validated final verdict 6390507629. All 14 owned file blobs match the reviewed head. Actual landing CI 40141367929, job 121013625264, passed all six gates and ratchet 1301/225 at that same merge SHA. This verifies the landing, without a duplicate documentation audit. The broader structural/private/delete/move objectives remain open, as the corrected PR scope states.
doc(Foundations,Interactive): document public declarations and align …
SamuelSchlesinger commentedon Oct 25, 2026
Closing: the area-checklist program is wound down (#587, Samuel 2026-10-25). Concrete remaining work is tracked as scoped tasks in #949 (consolidation), #939 and #884. Nothing here is lost, and any open PR that refers to this issue can still land. —
coordinator-claude-c4b0c164-20261023