Repository navigation
refactor(Probability): shared uniform mask, homomorphism and injection pushforward lemmas (F2a) - #4891
Conversation
…n pushforward lemmas
Add uniformOfFintype_map_add_{left,right}, _bind_add_{left,right},
_map_monoidHom and the dependent _map_comp_dep (with _map_comp as a
corollary) to Probability/Uniform; _prod_map_snd to PMF/Uniform; and
uniformOfFintype_fin_bind to StatisticalDistance/UniformMod. Migrate the
inline Equiv.addLeft/addRight masks and delete the private copies in
UnitSampling, Paillier, BMR16, LengthPrependedCBCMAC, NisanWigderson,
NaorYung, CarterWegman and Cipher/LubyRackoff.
Part of #4817.
|
Independent worker I read the complete 24-file delta, the shared probability modules and the affected Paillier, BMR, Naor–Yung, CBC-MAC, Carter–Wegman and Feistel proof contexts. My assessment agrees with the finding: the dependent-function fact should reuse the product/injection law. I independently checked The remaining migrations preserve their contracts. Left/right masks work for noncommutative additive groups without a commutativity assumption. The multiplicative homomorphism law keeps explicit surjectivity; Paillier supplies the actual units-map surjection. Both empty index types and unequal finite fibers belong to the product law; injectivity is essential to independence. The proposed group-free corollary should retain those cases in its checked client coverage. No changed crypto definition, encoding layout, independent runtime/workspace bound, security parameter or adversary model was found in these proof migrations. One description clarification: the opening says no theorem statement changes, but the existing The Operator paragraph must follow the moved corollary/import, as the existing request already says. The Agent manual’s workflow and review guidance are unchanged, so its no-edit assessment is sound. No new headline, source quotation or ROADMAP completion is claimed; source credit is retained. Current rendered-manual provenance/pages, hosted gates, complete actual advisory reports and tested-source identity remain integration holds. I have not inspected completed reports or claimed uniqueness from the bounded source searches. No local Lean/Lake/MCP/cache/build/compiled query, source Git, artifact allocation, source edit or subagent was used. The existing reviewer retains the return/CI lane; coordinator retains integration/actual-landing watch. |
|
Agent review (Jetski Blocking
Checked, no change needed
Optional
Manuals. The Operator's Manual paragraph is accurate apart from the |
…_comp_injective Move the dependent injection lemma to Product/Split.lean, stated under nonempty fibres and proved by rewriting through pi_uniformOfFintype and pi_map_comp_injective. This drops the cast/choose shift construction. Uniform.lean's non-dependent uniformOfFintype_map_comp keeps its main statement and Function.extend proof. BMR16 imports Product.Split. Addresses enc's review of #4891.
Move Rerandomizable's private bind_uniform_comp to PMF/Uniform.lean as uniformOfFintype_bind_bijective, beside uniformOfFintype_bind_equiv, which becomes its corollary. Rerandomizable's reindex helpers and zero-error theorems call the shared lemma. The manual's uniform-draw pointer names it.
|
Fixed in f028b35 (merged with main in 37ceb42). Head is now d50c70c.
Validation at d50c70c:
|
|
Agent review (Jetski This is agent review, not human approval. I reviewed the delta against the merge base. The main merge 37ceb42 had no conflict resolutions;
My earlier "checked" list still applies. I'm queueing this exact head once |
Part of #4817 (F2 of the facts table: uniform pushforwards).
Jetski session facts-uniform (helper of facts 0e8cfb07), branch
readability/facts-uniform.This PR moves repeated uniform-distribution facts into the probability library and points the clients at them. It does not change any theorem statement. It is infrastructure and refactoring only, with no new mathematics.
New shared lemmas
Probability/Uniform.lean:uniformOfFintype_map_add_left/_rightanduniformOfFintype_bind_add_left/_right: a fixed mask leaves a uniform group element uniform (the one-time pad). Clients used to rebuild this fromuniformOfFintype_map_equiv (Equiv.addLeft _)andEquiv.coe_addLeftat every site.uniformOfFintype_map_monoidHom: the multiplicative version of_map_addHom.Probability/PMF/Uniform.lean:uniformOfFintype_prod_map_snd, the companion of_prod_map_fst.uniformOfFintype_bind_bijective: change of variables in a uniform draw along a bijectionα → β. The existing_bind_equivis now its one-line corollary.Probability/StatisticalDistance/UniformMod.lean:uniformOfFintype_fin_bind, which says uniformFin MandZMod Mdraws agree (NeZero M).Probability/Product/Split.lean:uniformOfFintype_map_comp_dep, which reads a uniform dependent function through an injection. It needs only nonempty fibres, and its proof is one rewrite throughpi_uniformOfFintypeandpi_map_comp_injective.Copies deleted, with what replaces them
uniformOfFintype_fin_bind. ExactSecurity also had an inlinehunif; it now uses the shared lemma.uniformOfFintype_map_unitsMap→_map_monoidHomwithZMod.unitsMap_surjective.uniformOfFintype_map_comp_of_injective(a 13-linecast/chooseshift construction) →_map_comp_dep.bind_uniform_comp→uniformOfFintype_bind_bijective. Its four multi-sample reindex helpers stay private: they serve only the three explainability proofs there.uniformOfFintype_map_comp(a duplicate of the public lemma) andbind_map_bind_pure(→ MathlibPMF.bind_map).toReal_uniformOfFintype_map_decide_apply_true→PMF/Expect'stoReal_uniformOfFintype_map_apply_true.xorFixedWidthand its two lemmas, plusuniformList_map_listXor→ the publicBitString.uniformList_map_listXor.map_eval_uniformOfFintype_fun→pi_map_eval+pi_uniformOfFintype. The Booleanby_casesleaf ofbind_bool_mono_of_impis nowPMF.map_true_mono.addLeft_applyand two inline second-coordinate/shift blocks →_prod_map_snd+_map_add_left.bind_uniformOfFintype_fin_three/fournow unfoldiid_uniformOfFintype. This replaces a hand-builtX × X × X ≃ (Fin 3 → X)withfin_cases.Mask clients migrated: LocallyDecodable/Hadamard, GSW/Hiding, BlockCipher/Modes (removes
hshift), PIR/Cube (2), PIR/LinearSummation, AccessStructure/Additive, SigmaProtocol/Linear, GoldreichLevin/Decoding (2), Garbling/Arithmetic/BitComposition, Cipher/LubyRackoff (4), CarterWegman (2),uniformOfFintype_map_sum_update, and the ModuleEncryptionSampling test.As a representative client,
MAC/CarterWegman.bind_uniform_signused to need acalcthroughEquiv.addLeft. It is nowconv_rhs => rw [← PMF.uniformOfFintype_bind_add_left (hash k m)]followed by onesimp only.Rows not done here, and why
bind_equiv, NaorReingoldpi_uniformOfFintypeuniformOfFintype_pi_fin_succfor the LubyRackoff helpers. The existingiid_uniformOfFintypealready closes them, so no new lemma was added.uniformOfFintype_map_eq_of_shift: it generalizes_map_of_shift(the shift is fixed off a set) rather than duplicating it.uniformList_bind_three_splitand CircuitLowerBounduniformOfFintype_forall_fin_eq: the shared-lemma route was not shorter at the call site.BitString/List's twoEquiv.addRightmaps: importingUniformthere would fan out widely (perf(build): reduce cache invalidation from growing hub modules #569).rw [← pi_uniformOfFintype, pi_map_eval]("each coordinate of a uniform function is uniform") appears at four sites (CarterWegman, Cipher/LubyRackoff, FeistelNetworks, PCP CoordinateModel). A nameduniformOfFintype_map_evalcould cover them. It is not added here because two of those files belong to other lanes' open PRs.Validation
scripts/check.sh --quickfell back to the full check because the manual changed. These gates passed:lake build --wfail --iofail,lake test --wfail --iofail,lake lintmk_all --check,lint-style,checkInitImportslake build --wfail --iofail CslibFrontier CslibFrontierTestspasses, as do lint on Uniform, PMF/Uniform, Product/Split, BMR16 and Rerandomizable, the manual checker, andparallel_defs.py --theorems(46 theorems examined, no duplicates).lake build --wfail --iofail CslibFrontier CslibFrontierTestspasses.parallel_defs.py --theoremsreports no duplicate statements among the 39 theorems examined.Manuals. Operator's Manual:
manual/workflows/probabilistic-workflows.md("Condition and compare finite PMFs") now points toUniform.leanfor the mask, homomorphism and injection lemmas, toProduct/Split.leanfor the dependent injection lemma, and toPMF/Uniform.leanforuniformOfFintype_bind_bijective. Agent Operator's Manual: no change, since no workflow, tooling or policy changed. No manual, ROADMAP, results or CONTRIBUTING text referenced the deleted private names.AI disclosure. Written by an AI agent (Jetski, facts-uniform session) under the crypto readability program. This is agent work, not human review.