Eval Dist uniform Sample bind update
evalDist_uniformSample_bind_update
Plain-language statement
Overwriting one coordinate of a uniform function table is measure-preserving. Drawing a value u uniformly from R, then a full function table g : D → R uniformly, and returning Function.update g t u yields the same distribution as drawing the table directly. This is the t-marginal independence of the uniform (product) distribution on D → R:...
Exact Lean statement
lemma evalDist_uniformSample_bind_update
{D R : Type} [Finite D] [DecidableEq D] [Finite R] [Nonempty R]
[SampleableType R] [SampleableType (D → R)] (t : D) :
𝒟[do let u ← $ᵗ R; let g ← $ᵗ (D → R); pure (Function.update g t u)] =
𝒟[$ᵗ (D → R)]Formal artifact
Lean source
lemma evalDist_uniformSample_bind_update {D R : Type} [Finite D] [DecidableEq D] [Finite R] [Nonempty R] [SampleableType R] [SampleableType (D → R)] (t : D) : 𝒟[do let u ← $ᵗ R; let g ← $ᵗ (D → R); pure (Function.update g t u)] = 𝒟[$ᵗ (D → R)] := by classical letI := Fintype.ofFinite D letI := Fintype.ofFinite R haveI : Nonempty (D → R) := ⟨fun _ => Classical.arbitrary R⟩ refine evalDist_ext fun h => ?_ rw [probOutput_uniformSample (D → R) h, probOutput_bind_eq_sum_fintype] -- For each fixed `u`, count the tables `g` whose `t`-update equals `h`. have hinner : ∀ u : R, Pr[= h | (do let g ← $ᵗ (D → R); pure (Function.update g t u))] = (if u = h t then (Fintype.card R : ℝ≥0∞) * (Fintype.card (D → R) : ℝ≥0∞)⁻¹ else 0) := by intro u rw [bind_pure_comp, probOutput_map_eq_sum_fintype_ite] simp only [probOutput_uniformSample (D → R)] rw [← Finset.sum_filter, Finset.sum_const, nsmul_eq_mul] -- The matching tables are exactly `Function.update h t r` for `r : R`. have hcard : ((Finset.univ.filter fun g : D → R => h = Function.update g t u).card : ℝ≥0∞) = if u = h t then (Fintype.card R : ℝ≥0∞) else 0 := by by_cases hu : u = h t · have hset : (Finset.univ.filter fun g : D → R => h = Function.update g t u) = Finset.univ.image (fun r : R => Function.update h t r) := by ext g simp only [Finset.mem_filter, Finset.mem_univ, true_and, Finset.mem_image] constructor · intro hg exact ⟨g t, by subst hg; simp⟩ · rintro ⟨r, rfl⟩ subst hu; simp rw [hset, Finset.card_image_of_injective _ (fun r₁ r₂ hr => by simpa using congrFun hr t), Finset.card_univ, if_pos hu] · rw [if_neg hu, Nat.cast_eq_zero, Finset.card_eq_zero, Finset.filter_eq_empty_iff] rintro g - rfl simp at hu rw [hcard, ite_mul, zero_mul] simp_rw [hinner, mul_ite, mul_zero] rw [Finset.sum_ite_eq' Finset.univ (h t), if_pos (Finset.mem_univ _), probOutput_uniformSample R, ← mul_assoc, ENNReal.inv_mul_cancel (by simp [Fintype.card_ne_zero]) (ENNReal.natCast_ne_top _), one_mul]- Project
- VCVio
- License
- Apache-2.0
- Commit
- 2ceb2d825ee3
- Source
- VCVio/OracleComp/Constructions/SampleableType.lean:447-490
Reuse this declaration
Bring the exact result into your workflow
The import identifies the source module. Your project still needs the pinned package dependency shown on this page.
What this badge means
This completion status comes from the project or community source. It has not yet been represented here as an independent rebuild and axiom audit.
Continue in this project
Related declarations
Expected Cost Nat eq sum tail probs of pathwise Cost At Most
AddWriterT.expectedCostNat_eq_sum_tail_probs_of_pathwiseCostAtMost
Plain-language statement
Finite tail-sum formula for natural-valued writer cost under a pathwise upper bound. If every execution path of oa incurs cost at most n, then the tail probabilities vanish above n, so the infinite tail sum truncates to Finset.range n.
Source project: VCVio
Person-level attribution pending.
IND CPA advantage to Real le sum step signed Advantage Real abs
AsymmEncAlg.IND_CPA_advantage_toReal_le_sum_step_signedAdvantageReal_abs
Plain-language statement
Planned generic one-time-to-many-time lift: bounded multi-query IND-CPA advantage is at most the sum of the extracted one-time signed advantages over the first q fresh LR queries.
Source project: VCVio
Person-level attribution pending.
IND CPA LR hybrid Game q eval Dist eq left of Makes At Most Queries
AsymmEncAlg.IND_CPA_LR_hybridGame_q_evalDist_eq_left_of_MakesAtMostQueries
Plain-language statement
If an adversary makes at most q fresh LR queries, then the leftUntil = q LR-hybrid is the all-left endpoint game.
Source project: VCVio
Person-level attribution pending.