File size: 5,471 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 Mathlib
import OAI.Probability.GaussianRegression.Main
import OAI.Probability.MemoryPrecision.CubeBlock
import OAI.Probability.MemoryPrecision.CubeCaps
import OAI.Probability.MemoryPrecision.RealContinuation
namespace OAI
open MeasureTheory ProbabilityTheory Set Filter EuclideanGeometry
open scoped ENNReal NNReal RealInnerProductSpace Topology Pointwise
noncomputable section
universe u v
open MeasureTheory ProbabilityTheory Set Filter
open scoped ENNReal NNReal RealInnerProductSpace Topology Pointwise
namespace MemoryPrecision
open NoiselessRegression
def CubeStepConstant : β := Classical.choose cube_block
lemma cubeStepConstant_one : 1 β€ CubeStepConstant := (Classical.choose_spec cube_block).1
lemma cubeStepConstant_pos : 0 < CubeStepConstant := lt_of_lt_of_le zero_lt_one cubeStepConstant_one
def CubeStep (d N : β) : β := CubeStepConstant^(d/2) * (N:β)^(1/(((d/2)/4:β):β))
lemma cubeStep_one (d : β) {N : β} (hN : 1 β€ N) : 1 β€ CubeStep d N := by
apply one_le_mul_of_one_le_of_one_le
Β· exact one_le_powβ cubeStepConstant_one
Β· exact Real.one_le_rpow (by exact_mod_cast hN) (by positivity)
lemma cubeStep_pos (d : β) {N : β} (hN : 1 β€ N) : 0 < CubeStep d N :=
lt_of_lt_of_le zero_lt_one (cubeStep_one d hN)
lemma cube_deterministic_step {d m N : β} (hd : 16 β€ d) (hm : 1 β€ m)
(hmp : m β€ (d/2)/4) (hN : 1 β€ N) {H : β} (hH : 0 < H)
(h : Fin N β Space d β ββ₯0β) (hh : β w, Measurable (h w))
(hh1 : β w s, h w s β€ 1)
(hb : β w, CubeLocal (fun u => h w (CubeEmbedding d u)) H)
(Ο : ((Fin m β Space d) Γ (Fin m β β)) β Fin N) (hΟ : Measurable Ο) :
CubeLocal (fun u => blockValue h Ο (CubeEmbedding d u)) (CubeStep d N * H) := by
classical
let g (w : Fin N) (x : (Fin m β Space d) Γ (Fin m β β)) : ββ₯0β :=
if Ο x = w then 1 else 0
have hg (w) : Measurable (g w) := by
exact Measurable.ite (measurableSet_eq_fun hΟ measurable_const) measurable_const measurable_const
have hg1 (x) : β w, g w x β€ 1 := by simp [g]
have hb' := (Classical.choose_spec cube_block).2 d m N hd hm hmp hN H hH.le
(fun w u => h w (CubeEmbedding d u)) (fun w => (hh w).comp (cubeEmbedding_measurable d))
(fun w u => hh1 w (CubeEmbedding d u)) hb g hg hg1
convert hb' using 1
Β· funext u
unfold blockValue WeightedBlock
congr 1
funext A
simp [g]
Β· rfl
lemma CubeLocal.mono {d : β} {h : Cube d β ββ₯0β} {H K : β}
(hh : CubeLocal h H) (hHK : H β€ K) : CubeLocal h K := by
intro z r hr
exact (hh z r hr).trans (ENNReal.ofReal_le_ofReal (mul_le_mul_of_nonneg_right hHK (by positivity)))
lemma cube_continuation_mass {d N : β} (hd : 16 β€ d) (hN : 1 β€ N)
{Ξ΄ : β β Fin N β (Space d Γ β) β Fin N}
{w : β β Fin N β Space d β ββ₯0β}
(hΞ΄ : β n j, Measurable (Ξ΄ n j)) (hw : β n j, Measurable (w n j))
(hw1 : β n j s, w n j s β€ 1) {H : β} (hH : 0 < H)
(hlocal : β n j, CubeLocal (fun s => w n j (CubeEmbedding d s)) H)
(b k : β) (hk : k β€ b*((d/2)/4)) (n : β) (j : Fin N) :
CubeLocal (fun s => continuation Ξ΄ w n k j (CubeEmbedding d s))
(H * CubeStep d N ^ b) := by
have hp : 0 < (d/2)/4 := by omega
have hK := cubeStep_one d hN
have hK0 := cubeStep_pos d hN
induction b generalizing k n j with
| zero =>
have : k = 0 := by omega
subst k
simpa [continuation] using hlocal n j
| succ b ih =>
by_cases hk0 : k = 0
Β· subst k
apply (hlocal n j).mono
simpa [continuation] using le_mul_of_one_le_right hH.le (one_le_powβ hK)
Β· let m := min k ((d/2)/4)
have hm : 1 β€ m := by dsimp [m]; omega
have hmp : m β€ (d/2)/4 := min_le_right _ _
have hmk : m β€ k := min_le_left _ _
have hk' : k-m β€ b*((d/2)/4) := by
dsimp [m]
rw [Nat.succ_mul] at hk
omega
have hb := cube_deterministic_step hd hm hmp hN
(mul_pos hH (pow_pos hK0 b))
(fun a => continuation Ξ΄ w (n+m) (k-m) a)
(fun a => measurable_continuation hΞ΄ hw _ _ a)
(fun a s => continuation_le_one hw1 _ _ a s)
(fun a => ih (k-m) hk' (n+m) a) (streamRoute Ξ΄ n m j)
(measurable_streamRoute hΞ΄ n m j)
have he : (fun s : Cube d => continuation Ξ΄ w n k j (CubeEmbedding d s)) =
(fun s : Cube d => blockValue (fun a => continuation Ξ΄ w (n+m) (k-m) a)
(streamRoute Ξ΄ n m j) (CubeEmbedding d s)) := by
funext s
simpa [Nat.add_sub_of_le hmk] using continuation_unroll hΞ΄ n m (k-m) j (CubeEmbedding d s)
rw [he]
convert hb using 1
rw [pow_succ]; ring
lemma cube_continuation_cap_integral {d N : β} (hd : 16 β€ d) (hN : 1 β€ N)
{Ξ΄ : β β Fin N β (Space d Γ β) β Fin N} (hΞ΄ : β n j, Measurable (Ξ΄ n j))
(y : β β Fin N β Space d) {Ξ΅ : β} (hΞ΅ : 0 < Ξ΅) (n k : β) (j : Fin N) :
(β«β» u, continuation Ξ΄ (fun n j => capWeight (y n j) Ξ΅) n k j (CubeEmbedding d u) βCubeLaw d) β€
ENNReal.ofReal ((12:β)^(d/2)*Ξ΅^((d/2:β)/4:β) * CubeStep d N ^ BlockCount k ((d/2)/4)) := by
apply cube_mass_bound
apply cube_continuation_mass hd hN hΞ΄ (fun n j => measurable_capWeight _ _)
(fun n j s => capWeight_le_one _ _ _) (by positivity)
(fun n j => cube_cap_local (by omega) (y n j) hΞ΅)
simpa [mul_comm] using blockCount_mul_ge k (by omega : 0 < (d/2)/4)
end MemoryPrecision
end
end OAI
|