File size: 5,068 Bytes
4a56cd6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | import OAI.Computability.UniqueGames.Inverse.EqualityFiber
namespace OAI
section
namespace UniqueGamesTheorem.Inverse.FactorSampling
noncomputable section
open scoped BigOperators Classical
open UniqueGamesTheorem.Foundations.Information
variable {A B : Type*} [Fintype A] [Fintype B] [Zero A] [Zero B]
def fullAverage (p : A β β) (q : B β β) (h : A β B β β) : β :=
β a, β b, p a * q b * h a b
def nonzeroFlow (p : A β β) (q : B β β) (h : A β B β β) : β :=
β a, β b, p a * q b * if a β 0 β§ b β 0 then h a b else 0
def zeroMass (p : A β β) (q : B β β) : β :=
p 0 + q 0 - p 0 * q 0
omit [Fintype A] [Fintype B] in
private theorem boundary_indicator (a : A) (b : B) :
(if a = 0 β¨ b = 0 then (1 : β) else 0) =
(if a = 0 then 1 else 0) + (if b = 0 then 1 else 0) -
(if a = 0 then 1 else 0) * (if b = 0 then 1 else 0) := by
by_cases ha : a = 0 <;> by_cases hb : b = 0 <;> simp [ha, hb]
/-- The overlap of the two zero-factor events is subtracted exactly once. -/
theorem boundary_mass (p : A β β) (q : B β β)
(hp : IsProbability p) (hq : IsProbability q) :
fullAverage p q (fun a b => if a = 0 β¨ b = 0 then 1 else 0) = zeroMass p q := by
unfold fullAverage zeroMass
simp_rw [boundary_indicator, mul_sub, mul_add]
simp only [Finset.sum_sub_distrib, Finset.sum_add_distrib]
have hβ : (β a, β b, p a * q b * if a = 0 then 1 else 0) = p 0 := by
calc
_ = β a, p a * (β b, q b) * if a = 0 then 1 else 0 := by
apply Finset.sum_congr rfl
intro a _
rw [β Finset.sum_mul, β Finset.mul_sum]
_ = p 0 := by simp [hq.2, mul_ite]
have hβ : (β a, β b, p a * q b * if b = 0 then 1 else 0) = q 0 := by
simp only [mul_ite, mul_one, mul_zero, Finset.sum_ite_eq', Finset.mem_univ, ite_true]
rw [β Finset.sum_mul, hp.2, one_mul]
have hβ : (β a, β b, p a * q b *
((if a = 0 then 1 else 0) * (if b = 0 then 1 else 0))) = p 0 * q 0 := by
simp [mul_ite]
rw [hβ, hβ, hβ]
/-- A self-loop occurs whenever either perturbation factor is zero. -/
theorem fullAverage_eq_zeroMass_add_nonzeroFlow (p : A β β) (q : B β β)
(hp : IsProbability p) (hq : IsProbability q) (h : A β B β β)
(hleft : β b, h 0 b = 1) (hright : β a, h a 0 = 1) :
fullAverage p q h = zeroMass p q + nonzeroFlow p q h := by
have hpoint (a : A) (b : B) : h a b =
(if a = 0 β¨ b = 0 then 1 else 0) +
(if a β 0 β§ b β 0 then h a b else 0) := by
by_cases ha : a = 0
Β· subst a
simp [hleft]
Β· by_cases hb : b = 0
Β· subst b
simp [hright]
Β· simp [ha, hb]
calc
fullAverage p q h =
fullAverage p q (fun a b => if a = 0 β¨ b = 0 then 1 else 0) +
nonzeroFlow p q h := by
unfold fullAverage nonzeroFlow
simp only [β Finset.sum_add_distrib]
apply Finset.sum_congr rfl
intro a _
apply Finset.sum_congr rfl
intro b _
simpa only [mul_add] using congrArg (fun z : β => p a * q b * z) (hpoint a b)
_ = _ := by rw [boundary_mass p q hp hq]
def conditionedRetention (p : A β β) (q : B β β) (h : A β B β β) : β :=
nonzeroFlow p q h / (1 - zeroMass p q)
theorem fullAverage_eq_mixture (p : A β β) (q : B β β)
(hp : IsProbability p) (hq : IsProbability q) (h : A β B β β)
(hleft : β b, h 0 b = 1) (hright : β a, h a 0 = 1)
(hzero : zeroMass p q < 1) :
fullAverage p q h = zeroMass p q +
(1 - zeroMass p q) * conditionedRetention p q h := by
rw [fullAverage_eq_zeroMass_add_nonzeroFlow p q hp hq h hleft hright]
unfold conditionedRetention
have hne : 1 - zeroMass p q β 0 := by linarith
field_simp
/-- This is the full sampling-law implication, rather than only the scalar
inequality under an assumed mixture identity. -/
theorem conditionedRetention_ge_half (p : A β β) (q : B β β)
(hp : IsProbability p) (hq : IsProbability q) (h : A β B β β)
(hleft : β b, h 0 b = 1) (hright : β a, h a 0 = 1)
{Ξ· : β} (hΞ· : 0 < Ξ·) (hΞ·1 : Ξ· < 1)
(hzero : 0 β€ zeroMass p q) (hzeroΞ· : zeroMass p q β€ Ξ· / 2)
(haccept : Ξ· β€ fullAverage p q h) : Ξ· / 2 β€ conditionedRetention p q h := by
apply EqualityFiber.nonzero_retention_ge_half hΞ· hΞ·1 hzero hzeroΞ·
rw [β fullAverage_eq_mixture p q hp hq h hleft hright (by linarith)]
exact haccept
omit [Fintype A] [Fintype B] in
/-- Specialization of the excluded zero-factor mass to uniform binary vector
spaces. The powers are supplied by the cardinalities, so the formula also
keeps track of the overlap when both factors are zero. -/
theorem zeroMass_binary_uniform (p : A β β) (q : B β β) (ell m : β)
(hp0 : p 0 = ((2 : β) ^ ell)β»ΒΉ) (hq0 : q 0 = ((2 : β) ^ m)β»ΒΉ) :
zeroMass p q = ((2 : β) ^ ell)β»ΒΉ + ((2 : β) ^ m)β»ΒΉ - ((2 : β) ^ (ell + m))β»ΒΉ := by
unfold zeroMass
rw [hp0, hq0, pow_add, mul_inv]
end
end UniqueGamesTheorem.Inverse.FactorSampling
end
end OAI
|