File size: 4,829 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 | import OAI.Dynamics.ConditionalShuffle.ResetEnergy
namespace OAI
noncomputable section
open scoped BigOperators Classical
open Filter Topology
namespace Thorp.Conditional
theorem prefix_test_energy (d t m : β) (Ξ΅ : β)
(hE : β (B : Position (d+2) β Bool) (tag) (ht : B tag = true),
m β€ freeCount B β expectedEnergy (d+1) (initialState (d+2) B tag ht) t β€ Ξ΅)
(k : β) (hk : k + m β€ Fintype.card (Position (d + 2)))
(e : Fin k β Position (d + 2)) (he : Function.Injective e)
(f : (Fin k β Position (d + 2)) β β) (hf : β z, |f z| β€ 1) :
|mean (fun Ο : History (d + 2) t => f ((run (d + 2) t Ο) β e)) -
mean (fun g : State (d + 2) => f (g β e))| β€
(k : β) * Real.sqrt ((Fintype.card (Position (d + 2)) : β) *
Ξ΅) := by
induction k with
| zero =>
have hz (g : State (d + 2)) : g β e = e := by funext i; exact Fin.elim0 i
simp only [hz, mean_const, sub_self, abs_zero, Nat.cast_zero, zero_mul, le_refl]
| succ k ih =>
have he0 : Function.Injective (Fin.init e) := by
intro i j hij
exact Fin.castSucc_inj.mp (he hij)
have ht : freeOf (Fin.init e) (e (Fin.last k)) = true := by
apply (freeOf_true _ _).mpr
intro i hi
exact Fin.castSucc_ne_last i (he hi)
have hcount : m β€ freeCount (freeOf (Fin.init e)) := by
rw [freeCount_freeOf _ he0]
omega
have henergy := hE (freeOf (Fin.init e)) (e (Fin.last k)) ht hcount
have hz := prefix_one_step_bound (d + 1) t k e he f hf
have hestimate :
Real.sqrt ((Fintype.card (Position (d + 2)) : β) *
expectedEnergy (d + 1) (initialState (d + 2) (freeOf (Fin.init e)) (e (Fin.last k)) ht)
t) β€
Real.sqrt ((Fintype.card (Position (d + 2)) : β) *
Ξ΅) := by
apply Real.sqrt_le_sqrt
apply mul_le_mul_of_nonneg_left _ (Nat.cast_nonneg _)
exact henergy
have hnext := ih (by omega) (Fin.init e) he0 (completeTest f) (completeTest_bound f hf)
rw [uniform_prefix_step k e he f]
have htri := abs_sub_le
(mean (fun Ο : History (d + 2) t => f ((run (d + 2) t Ο) β e)))
(mean (fun Ο : History (d + 2) t => completeTest f ((run (d + 2) t Ο) β Fin.init e)))
(mean (fun g : State (d + 2) => completeTest f (g β Fin.init e)))
have hz' := hz.trans hestimate
push_cast
nlinarith
lemma reset_sqrt_bound (D : β) :
Real.sqrt ((2^D : β)*(1/2 : β)^(20*D)) β€ (1/2 : β)^(9*D) := by
apply (Real.sqrt_le_left (by positivity)).mpr
have he : (2^D : β)*(1/2 : β)^(20*D) = (1/2 : β)^(19*D) := by
rw [pow_mul, β mul_pow, pow_mul]; norm_num
rw [he, β pow_mul]
apply pow_le_pow_of_le_one (by norm_num) (by norm_num)
omega
theorem reset_partial_mixing (Ο : β) (hΟ : 0 < Ο) (hΟβ : Ο β€ 1) :
βαΆ d : β in atTop, β (b : β) (e : Fin b β Position (d+2)),
Function.Injective e β (b : β) β€ (1-Ο)*(2^(d+2) : β) β
tv (fairMass (fun Ο : History (d+2) (2*resetS Ο*(d+2)) =>
run (d+2) (2*resetS Ο*(d+2)) Ο β e))
(fairMass (fun g : State (d+2) => g β e)) β€ (1/2 : β)^(8*(d+2)) := by
filter_upwards [reset_energy_eventually Ο hΟ hΟβ] with d hd
intro b e he hb
have hbN : b β€ Fintype.card (Position (d+2)) := by
simpa only [Fintype.card_fin] using Fintype.card_le_of_injective e he
let m := Fintype.card (Position (d+2)) - b
have hm : Ο * Fintype.card (Position (d+2)) β€ (m : β) := by
dsimp [m]; rw [Nat.cast_sub hbN]
rw [card_position] at *; push_cast at *; nlinarith
have hE (B : Position (d+2) β Bool) (tag) (ht : B tag = true) (hB : m β€ freeCount B) :
expectedEnergy (d+1) (initialState (d+2) B tag ht) (2*resetS Ο*(d+2)) β€
(1/2 : β)^(20*(d+2)) := by
apply hd
exact hm.trans (by exact_mod_cast hB)
have hh := fairMass_tv_le_of_test
(fun Ο : History (d+2) (2*resetS Ο*(d+2)) => run (d+2) (2*resetS Ο*(d+2)) Ο β e)
(fun g : State (d+2) => g β e)
((b : β)*Real.sqrt ((Fintype.card (Position (d+2)) : β)*(1/2 : β)^(20*(d+2))))
(prefix_test_energy d (2*resetS Ο*(d+2)) m _ hE b (by dsimp [m]; omega) e he)
have hbN' : (b : β) β€ (2^(d+2) : β) := by simpa only [card_position, Nat.cast_pow, Nat.cast_ofNat] using
(show (b : β) β€ (Fintype.card (Position (d+2)) : β) by exact_mod_cast hbN)
have hmul : (2^(d+2) : β)*(1/2 : β)^(9*(d+2)) = (1/2 : β)^(8*(d+2)) := by
rw [pow_mul, β mul_pow, pow_mul]; norm_num
apply hh.trans
rw [card_position, Nat.cast_pow, Nat.cast_ofNat]
have hsq := reset_sqrt_bound (d+2)
have hproduct := mul_le_mul hbN' hsq (Real.sqrt_nonneg _) (by positivity)
rw [hmul] at hproduct
linarith [pow_nonneg (by norm_num : (0 : β) β€ 1/2) (8*(d+2))]
end Thorp.Conditional
end
end OAI
|