File size: 4,316 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 | import Mathlib
import OAI.Probability.SKBarriers.Calculus.IntervalDifferentiation
import OAI.Probability.SKBarriers.Calculus.BrascampLieb
namespace OAI
section
section
noncomputable section
open scoped BigOperators Topology
open MeasureTheory ProbabilityTheory Filter
noncomputable section
open MeasureTheory Set Filter
open scoped Topology Interval
noncomputable section
open MeasureTheory Set
open scoped Interval
namespace SK.Analytic
theorem hasDerivAt_neg_log_intervalPartition
(V Vβ : β β β β β) (hV : Continuous (Function.uncurry V))
(hVβ : Continuous (Function.uncurry Vβ))
(hd : β x y, HasDerivAt (fun z => V z y) (Vβ x y) x)
{a b : β} (hab : a < b) (x : β) :
HasDerivAt (fun z => -Real.log (intervalPartition (V z) a b))
(intervalMean (V x) (Vβ x) a b) x := by
let p : β β β β β := fun x y => Real.exp (-V x y)
have hp : Continuous (Function.uncurry p) := Real.continuous_exp.comp hV.neg
have hpβ : Continuous (fun z : β Γ β => -Vβ z.1 z.2 * p z.1 z.2) := hVβ.neg.mul hp
have hpd : β z y, HasDerivAt (fun w => p w y) (-Vβ z y * p z y) z := by
intro z y
convert! (hd z y).neg.exp using 1
dsimp [p]
ring
have hZ := hasDerivAt_intervalIntegral p (fun z y => -Vβ z y * p z y) hp hpβ hpd a b x
have hZβ : 0 < intervalPartition (V x) a b :=
intervalPartition_pos (hV.comp (continuous_const.prodMk continuous_id)) hab
have heq : (β« y in a..b, -Vβ x y * p x y) = -(β« y in a..b, Vβ x y * p x y) := by
simp only [neg_mul, intervalIntegral.integral_neg]
rw [heq] at hZ
convert! (hZ.log (ne_of_gt hZβ)).neg using 1
dsimp only [intervalMean, intervalPartition, p]
ring
theorem hasDerivAt_interval_score
(V Vβ Vβ : β β β β β) (hV : Continuous (Function.uncurry V))
(hVβ : Continuous (Function.uncurry Vβ)) (hVβ : Continuous (Function.uncurry Vβ))
(hd : β x y, HasDerivAt (fun z => V z y) (Vβ x y) x)
(hdβ : β x y, HasDerivAt (fun z => Vβ z y) (Vβ x y) x)
{a b : β} (hab : a < b) (x : β) :
HasDerivAt (fun z => intervalMean (V z) (Vβ z) a b)
(intervalMean (V x) (Vβ x) a b -
(intervalMean (V x) (fun y => Vβ x y ^ 2) a b -
(intervalMean (V x) (Vβ x) a b)^2)) x := by
let p : β β β β β := fun x y => Real.exp (-V x y)
have hp : Continuous (Function.uncurry p) := Real.continuous_exp.comp hV.neg
have hpβ : Continuous (fun z : β Γ β => -Vβ z.1 z.2 * p z.1 z.2) := hVβ.neg.mul hp
have hpd : β z y, HasDerivAt (fun w => p w y) (-Vβ z y * p z y) z := by
intro z y
convert! (hd z y).neg.exp using 1
dsimp [p]
ring
have hA : Continuous (fun z : β Γ β => Vβ z.1 z.2 * p z.1 z.2) := hVβ.mul hp
have hAβ : Continuous (fun z : β Γ β => (Vβ z.1 z.2 - Vβ z.1 z.2^2)*p z.1 z.2) :=
(hVβ.sub (hVβ.pow 2)).mul hp
have hAd : β z y, HasDerivAt (fun w => Vβ w y * p w y)
((Vβ z y - Vβ z y^2)*p z y) z := by
intro z y
convert! (hdβ z y).fun_mul (hpd z y) using 1
ring
have hZ := hasDerivAt_intervalIntegral p (fun z y => -Vβ z y * p z y) hp hpβ hpd a b x
have hN := hasDerivAt_intervalIntegral (fun z y => Vβ z y*p z y)
(fun z y => (Vβ z y - Vβ z y^2)*p z y) hA hAβ hAd a b x
have hZβ : 0 < intervalPartition (V x) a b :=
intervalPartition_pos (hV.comp (continuous_const.prodMk continuous_id)) hab
have heqZ : (β« y in a..b, -Vβ x y * p x y) = -(β« y in a..b, Vβ x y * p x y) := by
simp only [neg_mul, intervalIntegral.integral_neg]
have heqN : (β« y in a..b, (Vβ x y - Vβ x y^2)*p x y) =
(β« y in a..b, Vβ x y*p x y) - (β« y in a..b, Vβ x y^2*p x y) := by
simp_rw [sub_mul]
apply intervalIntegral.integral_sub
Β· exact ((hVβ.comp (continuous_const.prodMk continuous_id)).mul
(hp.comp (continuous_const.prodMk continuous_id))).intervalIntegrable a b
Β· exact (((hVβ.comp (continuous_const.prodMk continuous_id)).pow 2).mul
(hp.comp (continuous_const.prodMk continuous_id))).intervalIntegrable a b
rw [heqZ] at hZ
rw [heqN] at hN
convert! hN.fun_div hZ (ne_of_gt hZβ) using 1
dsimp only [intervalMean, intervalPartition, p]
field_simp
ring
end SK.Analytic
end
end
end
end
end
end OAI
|