File size: 5,664 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 | import OAI.Combinatorics.EditApproximation.Geometry.CellGroupSelection
import OAI.Combinatorics.EditApproximation.Refinement.ComputedGroupNumerical
import OAI.Combinatorics.EditApproximation.Refinement.ComputedBandSpacing
namespace OAI
/-! One actual whole cell has simultaneous gamma*b accuracy with failure at most H^-4. -/
namespace EditApproximation
open MeasureTheory ProbabilityTheory
theorem computed_cellGroupEstimate_failure {Ξ± : Type*} (source target : List Ξ±)
(N : β) (hN : 0 < N) (hell : 1764 β€ inputSmallLog N)
{M P b Q thetaExponent T : β} [NeZero M]
[MeasurableSpace (Fin M)] [MeasurableSingletonClass (Fin M)]
(hM : 0 < M) (hMeq : M = (integerParameters N).M)
(hPeq : P = (integerParameters N).P) (eb : β) (hbeq : b = 2 ^ eb)
(hQeq : Q = inputSmallLog N ^ 80) (hthetaeq : thetaExponent = 40 * smallLogExponent N)
(parent : TargetInterval source.length) (a : β)
(parentInitial : TargetInterval target.length β β)
(child initial value : Fin M β TargetInterval target.length β β) (cell : β Γ β)
(scales : Fin T β β) (count : Fin T β β)
(hscales : List.ofFn scales = groupDyadicScales M b (inputSmallLog N))
(hcount : β scale, count scale = groupSampleCount M Q b (scales scale))
(hspatial : β i s t, initial i s β€ initial i t +
(32 * inputSmallLog N : β) * targetEndpointDistance s t)
(hvalue : β i s, 0 β€ value i s β§ value i s β€ initial i s)
(bernstein : β scale : Fin T, FiniteBernsteinInput
(Measure.pi fun _ : Fin (count scale) => (PMF.uniformOfFintype (Fin M)).toMeasure)) :
let members := cellUnskippedBands source target parent b P (inputSmallLog N) thetaExponent
(rationalParameters (inputSmallLog N)).tau a parentInitial child initial cell
(groupSharedDrawLaw count).real
{draw | β member β members, ((rationalParameters (inputSmallLog N)).gamma : β) * b <
|((unskippedGroupEstimate scales count value member draw -
rationalEndpointActionValue member.center member.rounded value : β) : β)|} β€
1 / (inputHeight N : β) ^ 4 := by
let ell := inputSmallLog N
let members := cellUnskippedBands source target parent b P ell thetaExponent
(rationalParameters ell).tau a parentInitial child initial cell
let deviation : β := 1 / (2 * (ell : β) ^ 21)
let ΞΌ := groupSharedDrawLaw (M := M) count
let : IsProbabilityMeasure ΞΌ := by dsimp only [ΞΌ]; infer_instance
have hellQ : (2 : β) β€ ell := by exact_mod_cast (show 2 β€ ell from by omega)
have hellpos : (0 : β) < ell := by linarith only [hellQ]
have hb : 0 < b := hbeq βΈ Nat.two_pow_pos eb
have hQ : 0 < Q := by rw [hQeq]; exact pow_pos (by omega : 0 < inputSmallLog N) 80
have htheta : (2 : β) ^ (-(thetaExponent : β€)) = 1 / (ell : β) ^ 40 := by
rw [hthetaeq]
exact (computed_theta_dyadic N).symm
have hsmall : 2 * (32 * ell : β) * (2 : β) ^ (-(thetaExponent : β€)) β€ 1 := by
rw [htheta]
have h := (basic_band_small_constants hellQ).2.2.2.2
convert h using 1
ring
have hdev : 0 < deviation := by dsimp only [deviation]; positivity
have htail := unskippedGroupEstimate_failure scales count Q hscales hcount value members hM hQ hb
hellpos (32 * ell) (mul_nonneg (by norm_num) (Nat.cast_nonneg _)) hsmall hspatial hvalue deviation hdev bernstein
have hT : T β€ 2 * ell := by
have hlength := congrArg List.length hscales
simp only [List.length_ofFn] at hlength
rw [hlength, hMeq, hbeq]
exact computed_group_scale_count N eb hN (by omega)
have hTQ : (T : β) β€ 2 * ell := by exact_mod_cast hT
have hbudget : (T : β) * deviation β€ (rationalParameters ell).gamma := by
have h := mul_le_mul_of_nonneg_right hTQ hdev.le
have hid : (2 * ell : β) * deviation = (rationalParameters ell).gamma := by
dsimp only [deviation, rationalParameters]
field_simp
exact h.trans_eq hid
have hbudgetR : (T : β) * (deviation : β) * b β€
((rationalParameters ell).gamma : β) * b := by
have h := mul_le_mul_of_nonneg_right hbudget (Nat.cast_nonneg (Ξ± := β) b)
exact_mod_cast h
have hsubset : {draw | β member β members, ((rationalParameters ell).gamma : β) * b <
|((unskippedGroupEstimate scales count value member draw -
rationalEndpointActionValue member.center member.rounded value : β) : β)|} β
{draw | β member β members, (T : β) * (deviation : β) * b <
|((unskippedGroupEstimate scales count value member draw -
rationalEndpointActionValue member.center member.rounded value : β) : β)|} := by
rintro draw β¨member, hm, heβ©
exact β¨member, hm, hbudgetR.trans_lt heβ©
have hmembers : members.length β€ ((integerParameters N).P + 1) ^ 2 := by
rw [β hPeq]
exact cellUnskippedBands_length_le source target parent b P ell thetaExponent _ a parentInitial
child initial cell β¨eb, hbeqβ© β¨_, hPeq.trans (computed_P_dyadic N)β©
have hnumerical := computed_group_union_failure N eb members.length hN hell hmembers
dsimp only at hnumerical
have hTeq : T = (groupDyadicScales (integerParameters N).M (2 ^ eb) ell).length := by
have hlength := congrArg List.length hscales
simpa only [List.length_ofFn, hMeq, hbeq] using hlength
change ΞΌ.real _ β€ _
apply (measureReal_mono hsubset (measure_ne_top ΞΌ _)).trans
apply htail.trans
rw [hQeq, hTeq]
simpa only [deviation, ell, Rat.cast_div, Rat.cast_mul, Rat.cast_ofNat, Rat.cast_pow,
Rat.cast_natCast, Rat.cast_one, Nat.cast_pow, neg_mul, neg_div] using hnumerical
end EditApproximation
end OAI
|