Lean 4 · 15
declarations statementsfull
def mergeAt {R : Type*} (j : I) (a : R) (rest : {i : I // i ≠ j} → R) : I → R := body · 1 line
fun i => if h : i = j then a else rest ⟨i,h⟩@[simp] theorem mergeAt_self {R : Type*} (j : I) (a : R) (rest : {i : I // i ≠ j} → R) :
mergeAt j a rest j = a := by simp [mergeAt] @[simp] theorem mergeAt_other {R : Type*} (j : I) (a : R)
(rest : {i : I // i ≠ j} → R) (i : {i : I // i ≠ j}) :
mergeAt j a rest i.1 = rest i := by simp [mergeAt, i.property] def partialRevealWeight (μ : Games.FiniteDistribution (X × Y)) (j : I)
(rest : {i : I // i ≠ j} → X ⊕ Y) (u : I → X × Y) : ℝ := body · 1 line
μ.weight (u j) * ∏ i : {i : I // i ≠ j}, (revealLaw μ).weight (u i.1,rest i)theorem product_reveal_at (μ : Games.FiniteDistribution (X × Y)) (j : I)
(r : X ⊕ Y) (rest : {i : I // i ≠ j} → X ⊕ Y) (u : I → X × Y) :
(∏ i, (revealLaw μ).weight (u i,mergeAt j r rest i)) =
(if r = Sum.inl (u j).1 then partialRevealWeight μ j rest u / 2 else 0) +
(if r = Sum.inr (u j).2 then partialRevealWeight μ j rest u / 2 else 0) := by proof · 4 lines
rw [Fintype.prod_eq_mul_prod_subtype_ne _ j]
simp only [mergeAt_self, mergeAt_other, revealLaw_weight]
by_cases hl : r = Sum.inl (u j).1 <;> by_cases hr : r = Sum.inr (u j).2 <;>
simp [hl, hr, partialRevealWeight, revealLaw_weight] <;> ringdef partialRevealMarginal (μ : Games.FiniteDistribution (X × Y)) (j : I)
(likelihood : T → (I → X × Y) → ℝ) :
(T × ({i : I // i ≠ j} → X ⊕ Y)) × (X × Y) → ℝ := by body · 3 lines
classical
exact fun z => ∑ u, if u j = z.2 then
partialRevealWeight μ j z.1.2 u * likelihood z.1.1 u else 0def fullRevealMarginal (μ : Games.FiniteDistribution (X × Y)) (j : I)
(likelihood : T → (I → X × Y) → ℝ) :
(T × (I → X ⊕ Y)) × (X × Y) → ℝ := by body · 3 lines
classical
exact fun z => ∑ u, if u j = z.2 then
(∏ i, (revealLaw μ).weight (u i,z.1.2 i)) * likelihood z.1.1 u else 0theorem fullRevealMarginal_merge (μ : Games.FiniteDistribution (X × Y)) (j : I)
(likelihood : T → (I → X × Y) → ℝ) (t : T)
(rest : {i : I // i ≠ j} → X ⊕ Y) (r : X ⊕ Y) (q : X × Y) :
fullRevealMarginal μ j likelihood ((t,mergeAt j r rest),q) =
maskedJoint (partialRevealMarginal μ j likelihood) (((t,rest),r),q) := by proof · 20 lines
classical
unfold fullRevealMarginal
simp_rw [product_reveal_at]
have hpoint (u : I → X × Y) :
(if u j = q then
((if r = Sum.inl (u j).1 then partialRevealWeight μ j rest u / 2 else 0) +
(if r = Sum.inr (u j).2 then partialRevealWeight μ j rest u / 2 else 0)) *
likelihood t u else 0) =
(if r = Sum.inl q.1 then
(if u j = q then partialRevealWeight μ j rest u * likelihood t u else 0) / 2 else 0) +
(if r = Sum.inr q.2 then
(if u j = q then partialRevealWeight μ j rest u * likelihood t u else 0) / 2 else 0) := by
by_cases hu : u j = q
· rw [hu]
by_cases hl : r = Sum.inl q.1 <;> by_cases hr : r = Sum.inr q.2 <;>
simp [hl, hr] <;> ring
· simp [hu]
simp_rw [hpoint]
simp [maskedJoint, partialRevealMarginal, Finset.sum_add_distrib,
Finset.sum_ite_irrel, div_eq_mul_inv, Finset.sum_mul]def fullRevealModel (μ : Games.FiniteDistribution (X × Y)) (j : I)
(likelihood : T → (I → X × Y) → ℝ) :
(T × (I → X ⊕ Y)) × (X × Y) → ℝ := fun z => body · 2 lines
Information.firstMarginal (fullRevealMarginal μ j likelihood) z.1 *
(revealProfile μ (z.1.2 j)).weight z.2theorem fullRevealModel_merge (μ : Games.FiniteDistribution (X × Y)) (j : I)
(likelihood : T → (I → X × Y) → ℝ) (t : T)
(rest : {i : I // i ≠ j} → X ⊕ Y) (r : X ⊕ Y) (q : X × Y) :
fullRevealModel μ j likelihood ((t,mergeAt j r rest),q) =
maskedModel μ (partialRevealMarginal μ j likelihood) (((t,rest),r),q) := by proof · 2 lines
simp only [fullRevealModel, Information.firstMarginal, fullRevealMarginal_merge,
mergeAt_self, maskedModel]def revealSplitEquiv (j : I) :
((T × (I → X ⊕ Y)) × (X × Y)) ≃
(((T × ({i : I // i ≠ j} → X ⊕ Y)) × (X ⊕ Y)) × (X × Y)) where body · 18 lines
toFun z := (((z.1.1, fun i => z.1.2 i.1), z.1.2 j), z.2)
invFun z := ((z.1.1.1, mergeAt j z.1.2 z.1.1.2), z.2)
left_inv z := by
apply Prod.ext
· apply Prod.ext
· rfl
· funext i
by_cases h : i = j <;> simp [mergeAt, h]
· rfl
right_inv z := by
apply Prod.ext
· apply Prod.ext
· apply Prod.ext
· rfl
· funext i
exact mergeAt_other j z.1.2 z.1.1.2 i
· exact mergeAt_self j z.1.2 z.1.1.2
· rfltheorem totalVariation_comp_equiv {A B : Type*} [Fintype A] [Fintype B]
(e : A ≃ B) (p q : B → ℝ) :
Information.totalVariation (fun a => p (e a)) (fun a => q (e a)) =
Information.totalVariation p q := by proof · 3 lines
unfold Information.totalVariation
congr 1
exact e.sum_comp (fun b => |p b - q b|)theorem fullReveal_totalVariation (μ : Games.FiniteDistribution (X × Y)) (j : I)
(likelihood : T → (I → X × Y) → ℝ) :
Information.totalVariation (fullRevealMarginal μ j likelihood) (fullRevealModel μ j likelihood) =
Information.totalVariation (maskedJoint (partialRevealMarginal μ j likelihood))
(maskedModel μ (partialRevealMarginal μ j likelihood)) := by proof · 9 lines
calc
_ = Information.totalVariation
(fun z => fullRevealMarginal μ j likelihood ((revealSplitEquiv (T := T) j).symm z))
(fun z => fullRevealModel μ j likelihood ((revealSplitEquiv (T := T) j).symm z)) :=
(totalVariation_comp_equiv (revealSplitEquiv (T := T) j).symm _ _).symm
_ = _ := by
congr 1 <;> funext z
· exact fullRevealMarginal_merge μ j likelihood z.1.1.1 z.1.1.2 z.1.2 z.2
· exact fullRevealModel_merge μ j likelihood z.1.1.1 z.1.1.2 z.1.2 z.2theorem leftReveal_full_error (μ : Games.FiniteDistribution (X × Y)) (j : I)
(likelihood : T → (I → X × Y) → ℝ) :
Information.totalVariation (partialRevealMarginal μ j likelihood)
(leftRevealModel μ (partialRevealMarginal μ j likelihood)) ≤
2 * Information.totalVariation (fullRevealMarginal μ j likelihood)
(fullRevealModel μ j likelihood) := by proof · 2 lines
rw [fullReveal_totalVariation] exact leftRevealModel_totalVariation_le μ _
theorem rightReveal_full_error (μ : Games.FiniteDistribution (X × Y)) (j : I)
(likelihood : T → (I → X × Y) → ℝ) :
Information.totalVariation (partialRevealMarginal μ j likelihood)
(rightRevealModel μ (partialRevealMarginal μ j likelihood)) ≤
2 * Information.totalVariation (fullRevealMarginal μ j likelihood)
(fullRevealModel μ j likelihood) := by proof · 2 lines
rw [fullReveal_totalVariation] exact rightRevealModel_totalVariation_le μ _
Outline
- def
mergeAt12 - theorem
mergeAt_self16 - theorem
mergeAt_other20 - def
partialRevealWeight24 - theorem
product_reveal_at28 - def
partialRevealMarginal38 - def
fullRevealMarginal45 - theorem
fullRevealMarginal_merge53 - def
fullRevealModel79 - theorem
fullRevealModel_merge86 - def
revealSplitEquiv94 - theorem
totalVariation_comp_equiv116 - theorem
fullReveal_totalVariation124 - theorem
leftReveal_full_error139 - theorem
rightReveal_full_error148
Xet Storage Details
- Size:
- 7.26 kB
- Xet hash:
- 0ce8d013a254bcad3c1fb5fb46a69d75433f78e8398cb71b57e62b6d9d09c548
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.