File size: 6,641 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 124 | import OAI.Analysis.FreeEntropy.HeatAnalysis
namespace OAI
universe u1
noncomputable section
open scoped ENNReal NNReal Topology
open MeasureTheory Filter Set Finset
namespace FiniteEntropySeparation
theorem signed_lintegral_toEReal {Ξ± : Type u1} [MeasurableSpace Ξ±] {ΞΌ : Measure Ξ±}
{b f : Ξ± β ββ₯0β} {r : Ξ± β β}
(hb : βα΅ x βΞΌ, b x β β€) (hf : βα΅ x βΞΌ, f x β β€)
(hr : βα΅ x βΞΌ, r x = (b x).toReal - (f x).toReal) (hi : Integrable r ΞΌ) :
(β«β» x, b x - f x βΞΌ).toEReal - (β«β» x, f x - b x βΞΌ).toEReal =
((β« x, r x βΞΌ : β) : EReal) := by
have hp : β«β» x, b x - f x βΞΌ = β«β» x, ENNReal.ofReal (r x) βΞΌ := by
apply lintegral_congr_ae
filter_upwards [hb,hf,hr] with x hb hf hr
rw [hr, ENNReal.ofReal_sub _ ENNReal.toReal_nonneg, ENNReal.ofReal_toReal hb,
ENNReal.ofReal_toReal hf]
have hn : β«β» x, f x - b x βΞΌ = β«β» x, ENNReal.ofReal (-r x) βΞΌ := by
apply lintegral_congr_ae
filter_upwards [hb,hf,hr] with x hb hf hr
rw [hr, neg_sub, ENNReal.ofReal_sub _ ENNReal.toReal_nonneg, ENNReal.ofReal_toReal hb,
ENNReal.ofReal_toReal hf]
have hnf : (β«β» x, ENNReal.ofReal (-r x) βΞΌ) < β := by
simpa only [Pi.neg_apply] using lintegral_ofReal_finite hi.neg
rw [hp,hn, β EReal.coe_ennreal_toReal (lintegral_ofReal_finite hi).ne,
β EReal.coe_ennreal_toReal hnf.ne,
integral_eq_lintegral_pos_part_sub_lintegral_neg_part hi]
norm_cast
namespace Model
variable (p : β) [NeZero p]
def gaussianEntropy (a : β) : β :=
(p+1 : β)/2 * Real.log (2*Real.pi*Real.exp 1) +
(1/2 : β) * β i : Fin (p+1), Real.log (a + variance p i)
theorem chiStar_integral (hp : 2 β€ p) (a : β) (ha : 0 < a) :
chiStar (Ο p) (X p a) (auxiliaryNoise p) =
(((p+1 : β)/2 * Real.log (2*Real.pi*Real.exp 1) +
(1/2 : β) * β« s in Ioi (0 : β), (p+1 : β)/(1+s) - heatFisherReal p (a+s) : β) : EReal) := by
let b : β β ββ₯0β := fun s => ENNReal.ofReal ((p+1 : β)/(1+s))
let f : β β ββ₯0β := fun s => freeFisher (Ο p) (doublyNoised p a s)
let r : β β β := fun s => (p+1 : β)/(1+s) - heatFisherReal p (a+s)
have hb : βα΅ s βvolume.restrict (Ioi (0 : β)), b s β β€ := Eventually.of_forall (fun _ => ENNReal.ofReal_ne_top)
have hf : βα΅ s βvolume.restrict (Ioi (0 : β)), f s β β€ := by
filter_upwards [ae_restrict_mem measurableSet_Ioi] with s hs
exact ne_top_of_le_ne_top ENNReal.ofReal_ne_top
(doublyNoised_fisher_le p a s ha.le hs.le (by linarith [show 0<s from hs]))
have hr : βα΅ s βvolume.restrict (Ioi (0 : β)), r s = (b s).toReal - (f s).toReal := by
filter_upwards [ae_restrict_mem measurableSet_Ioi] with s hs
have hu : 0 < a+s := by linarith [show 0<s from hs]
have hs0 : 0 < s := hs
dsimp [r,b,f,heatFisherReal]
rw [doublyNoised_fisher_eq p a s ha.le hs.le hu, ENNReal.toReal_ofReal (by positivity)]
have he := signed_lintegral_toEReal hb hf hr (entropyIntegrand_integrable p hp a ha)
unfold chiStar
change (_ : EReal) + (1/2 : EReal) * (β«β» s in Ioi (0:β), b s - f s).toEReal -
(1/2 : EReal) * (β«β» s in Ioi (0:β), f s - b s).toEReal = _
have ht := entropy_parts_finite (f := f) (n := (p+1 : β)) ha (by linarith : 0 < a+4)
(fun s hs => by simpa [f,add_assoc,add_comm,add_left_comm] using
doublyNoised_fisher_lower p hp a s ha.le hs.le (by linarith))
(fun s hs => doublyNoised_fisher_le p a s ha.le hs.le (by linarith))
rw [β EReal.coe_ennreal_toReal ht.1.ne, β EReal.coe_ennreal_toReal ht.2.ne] at he β’
have he' : (β«β» s in Ioi (0:β), b s - f s).toReal -
(β«β» s in Ioi (0:β), f s - b s).toReal = β« s in Ioi (0:β), r s := by
exact_mod_cast he
change (((p+1 : β)/2 * Real.log (2*Real.pi*Real.exp 1) +
(1/2 : β)*(β«β» s in Ioi (0:β), b s-f s).toReal -
(1/2 : β)*(β«β» s in Ioi (0:β), f s-b s).toReal : β) : EReal) = _
congr 1
change _ = (p+1 : β)/2 * Real.log (2*Real.pi*Real.exp 1) +
(1/2 : β)*β« s in Ioi (0:β), r s
linarith [he']
theorem covarianceCorrection_integrable (a : β) (ha : 0 < a) :
IntegrableOn (fun s => β i : Fin (p+1), reciprocalDifference (a+variance p i) s) (Ioi 0) :=
integrable_finsetSum _ (fun i _ => reciprocalDifference_integrable (by linarith [variance_nonneg p i]))
theorem covarianceCorrection_integral (a : β) (ha : 0 < a) :
(β« s in Ioi (0 : β), β i : Fin (p+1), reciprocalDifference (a+variance p i) s) =
β i : Fin (p+1), Real.log (a+variance p i) := by
rw [integral_finsetSum _ (fun i _ => reciprocalDifference_integrable (by linarith [variance_nonneg p i]))]
apply sum_congr rfl
intro i _
exact reciprocalDifference_integral (by linarith [variance_nonneg p i])
theorem covarianceCorrection_identity (a s : β) :
(β i : Fin (p+1), reciprocalDifference (a+variance p i) s) -
((p+1 : β)/(1+s) - heatFisherReal p (a+s)) = fisherDeficit p (a+s) := by
simp only [reciprocalDifference, sum_sub_distrib, sum_const, card_univ, Fintype.card_fin, nsmul_eq_mul]
simp only [fisherDeficit, covarianceFisher, heatFisherReal, one_div]
have he : (β i : Fin (p+1), (a+variance p i+s)β»ΒΉ) = β i : Fin (p+1), (variance p i+(a+s))β»ΒΉ := by
apply sum_congr rfl; intro i _; congr 1; ring
rw [he]
simp only [div_eq_mul_inv]
ring
theorem fisherDeficit_shift_integrable (hp : 2 β€ p) (a : β) (ha : 0 < a) :
IntegrableOn (fun s => fisherDeficit p (a+s)) (Ioi 0) := by
have hh := (covarianceCorrection_integrable p a ha).sub (entropyIntegrand_integrable p hp a ha)
change IntegrableOn (fun s => (β i : Fin (p+1), reciprocalDifference (a+variance p i) s) -
((p+1 : β)/(1+s) - heatFisherReal p (a+s))) (Ioi 0) at hh
simpa only [covarianceCorrection_identity] using hh
theorem chiStar_covariance_formula (hp : 2 β€ p) (a : β) (ha : 0 < a) :
chiStar (Ο p) (X p a) (auxiliaryNoise p) =
((gaussianEntropy p a - (1/2 : β) * β« s in Ioi (0:β), fisherDeficit p (a+s) : β) : EReal) := by
rw [chiStar_integral p hp a ha]
congr 1
have he : (β« s in Ioi (0:β), fisherDeficit p (a+s)) =
(β i : Fin (p+1), Real.log (a+variance p i)) -
(β« s in Ioi (0:β), (p+1 : β)/(1+s) - heatFisherReal p (a+s)) := by
simp_rw [β covarianceCorrection_identity p a]
rw [integral_sub (covarianceCorrection_integrable p a ha) (entropyIntegrand_integrable p hp a ha),
covarianceCorrection_integral p a ha]
rw [he]
unfold gaussianEntropy
ring
end Model
end FiniteEntropySeparation
end
end OAI
|