Download data/lean/OAI/Dynamics/EntropyCounterexample/ClockDynamics.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 8.76 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Dynamics/EntropyCounterexample/ClockDynamics.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Dynamics/EntropyCounterexample/ClockDynamics.lean
-
curl -L -o ClockDynamics.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Dynamics/EntropyCounterexample/ClockDynamics.lean
8.76 kB
| import Mathlib | |
| namespace OAI | |
| open Filter Set | |
| open scoped Topology | |
| namespace Problem340.ClockDynamics | |
| theorem bounded_clock_limit {t : β β β} | |
| (hmono : Monotone t) (hbounded : BddAbove (Set.range t)) : | |
| β T : β, Tendsto t atTop (π T) β§ | |
| Tendsto (fun n => t (n + 1) - t n) atTop (π 0) := by | |
| have hlimit : Tendsto t atTop (π (β¨ n, t n)) := | |
| tendsto_atTop_ciSup hmono hbounded | |
| refine β¨β¨ n, t n, hlimit, ?_β© | |
| have hnext : Tendsto (fun n => t (n + 1)) atTop (π (β¨ n, t n)) := | |
| hlimit.comp (tendsto_add_atTop_nat 1) | |
| simpa using hnext.sub hlimit | |
| theorem bounded_clock_limit_barrier {t : β β β} {b : β β β} | |
| (hmono : Monotone t) (hbounded : BddAbove (Set.range t)) | |
| (hb : Continuous b) (hb_nonneg : β x, 0 β€ b x) | |
| (hstep : β n, b (t n) β€ t (n + 1) - t n) : | |
| β T : β, Tendsto t atTop (π T) β§ b T = 0 := by | |
| obtain β¨T, hlimit, hdiffβ© := bounded_clock_limit hmono hbounded | |
| refine β¨T, hlimit, ?_β© | |
| have hzero : Tendsto (fun n => b (t n)) atTop (π 0) := | |
| squeeze_zero (fun n => hb_nonneg (t n)) hstep hdiff | |
| exact tendsto_nhds_unique (hb.tendsto T |>.comp hlimit) hzero | |
| theorem bounded_clock_limit_lattice {t : β β β} {b : β β β} | |
| (hmono : Monotone t) (hbounded : BddAbove (Set.range t)) | |
| (hb : Continuous b) (hb_nonneg : β x, 0 β€ b x) | |
| (hstep : β n, b (t n) β€ t (n + 1) - t n) | |
| (hzeros : β x, b x = 0 β β k : β€, x = 50 + 100 * (k : β)) : | |
| β k : β€, Tendsto t atTop (π (50 + 100 * (k : β))) := by | |
| obtain β¨T, hlimit, hzeroβ© := | |
| bounded_clock_limit_barrier hmono hbounded hb hb_nonneg hstep | |
| obtain β¨k, rflβ© := hzeros T hzero | |
| exact β¨k, hlimitβ© | |
| theorem monotone_of_nonneg_increments {t : β β β} | |
| (hstep : β n, 0 β€ t (n + 1) - t n) : Monotone t := by | |
| apply monotone_nat_of_le_succ | |
| intro n | |
| linarith [hstep n] | |
| theorem barrier_trapping {t r : β β β} {a T R : β} {N : β} | |
| (htN : a β€ t N β§ t N β€ T) (hrN : r N β€ R) | |
| (hstep : β n, N β€ n β a β€ t n β t n β€ T β r n β€ R β | |
| (a β€ t (n + 1) β§ t (n + 1) β€ T) β§ r (n + 1) β€ R) : | |
| β n, N β€ n β (a β€ t n β§ t n β€ T) β§ r n β€ R := by | |
| intro n hn | |
| induction n, hn using Nat.le_induction with | |
| | base => exact β¨htN, hrNβ© | |
| | succ n hn ih => exact hstep n hn ih.1.1 ih.1.2 ih.2 | |
| theorem exists_first_crossing {t : β β β} {a : β} | |
| (hstart : t 0 < a) (hstep : β n, t (n + 1) - t n β€ 1) | |
| (hevent : β n, a β€ t n) : | |
| β n, a β€ t n β§ t n < a + 1 β§ β m, m < n β t m < a := by | |
| classical | |
| let n := Nat.find hevent | |
| have hn : a β€ t n := Nat.find_spec hevent | |
| have hbefore : β m, m < n β t m < a := by | |
| intro m hm | |
| exact lt_of_not_ge (Nat.find_min hevent hm) | |
| have hnpos : 0 < n := by | |
| by_contra h | |
| have hnzero : n = 0 := by omega | |
| rw [hnzero] at hn | |
| linarith | |
| refine β¨n, hn, ?_, hbeforeβ© | |
| have hp : t (n - 1) < a := hbefore (n - 1) (by omega) | |
| have hs := hstep (n - 1) | |
| have heq : n - 1 + 1 = n := by omega | |
| rw [heq] at hs | |
| linarith | |
| theorem single_visit_short_interval {t : β β β} {a b : β} | |
| (hmono : Monotone t) (hwidth : b - a β€ 1) | |
| (hstep : β n, a < t n β t n < b β t (n + 1) = t n + 1) | |
| {i j : β} (hi : a < t i β§ t i < b) (hj : a < t j β§ t j < b) : i = j := by | |
| have hnotlt : β i j, a < t i β§ t i < b β a < t j β§ t j < b β Β¬ i < j := by | |
| intro i j hi hj hij | |
| have hle := hmono (Nat.succ_le_of_lt hij) | |
| rw [hstep i hi.1 hi.2] at hle | |
| linarith | |
| exact Nat.le_antisymm (Nat.le_of_not_gt (hnotlt j i hj hi)) | |
| (Nat.le_of_not_gt (hnotlt i j hi hj)) | |
| theorem squaring_tendsto_zero {R : Type*} [SeminormedRing R] {z : β β R} | |
| (hstep : β n, z (n + 1) = z n ^ 2) (hsmall : βz 0β < 1) : | |
| Tendsto z atTop (π 0) := by | |
| have hformula : β n, z n = z 0 ^ (2 ^ n) := by | |
| intro n | |
| induction n with | |
| | zero => simp | |
| | succ n ih => rw [hstep, ih, β pow_mul, Nat.pow_succ] | |
| have hpower := (tendsto_pow_atTop_nhds_zero_of_norm_lt_one hsmall).comp | |
| (tendsto_pow_atTop_atTop_of_one_lt (by norm_num : 1 < (2 : β))) | |
| exact hpower.congr (fun n => (hformula n).symm) | |
| theorem eventually_squaring_tendsto_zero {R : Type*} [SeminormedRing R] | |
| {z : β β R} (hstep : βαΆ n in atTop, z (n + 1) = z n ^ 2) | |
| (hsmall : βαΆ n in atTop, βz nβ < 1) : Tendsto z atTop (π 0) := by | |
| obtain β¨N, hNβ© := eventually_atTop.mp (hstep.and hsmall) | |
| apply (tendsto_add_atTop_iff_nat N).mp | |
| apply squaring_tendsto_zero | |
| Β· intro n | |
| have h := (hN (n + N) (by omega)).1 | |
| convert h using 1 | |
| congr 1 | |
| omega | |
| Β· simpa using (hN N le_rfl).2 | |
| theorem eventually_small_of_bounded_clock {t r : β β β} {R c : β} | |
| (hmono : Monotone t) (hbounded : BddAbove (Set.range t)) (hc : 0 < c) | |
| (hfast : β n, R β€ r n β c β€ t (n + 1) - t n) : | |
| βαΆ n in atTop, r n < R := by | |
| obtain β¨T, hlimit, hdiffβ© := bounded_clock_limit hmono hbounded | |
| have hsmall := hdiff.eventually (gt_mem_nhds hc) | |
| filter_upwards [hsmall] with n hn | |
| by_contra h | |
| exact (not_le_of_gt hn) (hfast n (le_of_not_gt h)) | |
| theorem bounded_clock_eventually_squaring_tendsto_zero | |
| {R : Type*} [SeminormedRing R] {t : β β β} {z : β β R} {r c : β} | |
| (hmono : Monotone t) (hbounded : BddAbove (Set.range t)) | |
| (hc : 0 < c) (hr : r β€ 1) | |
| (hfast : β n, r β€ βz nβ β c β€ t (n + 1) - t n) | |
| (hstep : βαΆ n in atTop, z (n + 1) = z n ^ 2) : | |
| Tendsto z atTop (π 0) := by | |
| apply eventually_squaring_tendsto_zero hstep | |
| filter_upwards [eventually_small_of_bounded_clock hmono hbounded hc hfast] with n hn | |
| exact hn.trans_le hr | |
| theorem preparation_norm_gt_half {t : β β β} {z : β β β} {N : β} | |
| (hmono : Monotone t) (hunbounded : Β¬ BddAbove (Set.range t)) | |
| (hstart : 8 β€ t N β§ t N β€ 50) | |
| (htrap : β n, N β€ n β 8 β€ t n β t n β€ 50 β βz nβ β€ 1 / 2 β | |
| t (n + 1) β€ 50 β§ z (n + 1) = z n ^ 2) : | |
| 1 / 2 < βz Nβ := by | |
| by_contra h | |
| have hsmall : βz Nβ β€ 1 / 2 := le_of_not_gt h | |
| have hinvariant : β n, N β€ n β (8 β€ t n β§ t n β€ 50) β§ βz nβ β€ 1 / 2 := by | |
| apply barrier_trapping hstart hsmall | |
| intro n hn hlow hhigh hz | |
| obtain β¨hclock, hsquareβ© := htrap n hn hlow hhigh hz | |
| refine β¨β¨hlow.trans (hmono (Nat.le_succ n)), hclockβ©, ?_β© | |
| rw [hsquare, norm_pow] | |
| nlinarith [norm_nonneg (z n)] | |
| apply hunbounded | |
| refine β¨50, ?_β© | |
| rintro x β¨n, rflβ© | |
| by_cases hn : N β€ n | |
| Β· exact (hinvariant n hn).1.2 | |
| Β· exact (hmono (le_of_not_ge hn)).trans hstart.2 | |
| theorem exists_crossing_after {t : β β β} {N : β} {a : β} | |
| (hmono : Monotone t) (hunbounded : Β¬ BddAbove (Set.range t)) | |
| (hstart : t N < a) (hstep : β n, t (n + 1) - t n β€ 1) : | |
| β n, N β€ n β§ a β€ t n β§ t n < a + 1 := by | |
| have hevent : β n, a β€ t (n + N) := by | |
| obtain β¨x, β¨m, rflβ©, hmβ© := not_bddAbove_iff.mp hunbounded a | |
| exact β¨m, hm.le.trans (hmono (by omega))β© | |
| have hstep' : β n, t ((n + 1) + N) - t (n + N) β€ 1 := by | |
| intro n | |
| simpa only [Nat.add_right_comm] using hstep (n + N) | |
| obtain β¨n, hlow, hhigh, _β© := | |
| exists_first_crossing (t := fun n => t (n + N)) (by simpa using hstart) hstep' hevent | |
| exact β¨n + N, by omega, hlow, hhighβ© | |
| theorem exists_later_periodic_reset {t : β β β} (hmono : Monotone t) | |
| (hunbounded : Β¬ BddAbove (Set.range t)) | |
| (hstep : β n, t (n + 1) - t n β€ 1) (N : β) : | |
| β n β₯ N, β k : β€, 2 + 100 * (k : β) β€ t n β§ t n < 3 + 100 * (k : β) := by | |
| obtain β¨k, hkβ© := exists_int_gt ((t N - 2) / 100) | |
| have hstart : t N < 2 + 100 * (k : β) := by linarith | |
| obtain β¨n, hn, hlow, hhighβ© := exists_crossing_after hmono hunbounded hstart hstep | |
| refine β¨n, hn, k, hlow, ?_β© | |
| linarith | |
| theorem eventually_zero_after_periodic_reset {V : Type*} [Zero V] | |
| {t : β β β} {v : β β V} (hmono : Monotone t) | |
| (hunbounded : Β¬ BddAbove (Set.range t)) | |
| (hstep : β n, t (n + 1) - t n β€ 1) | |
| (hstay : βαΆ n in atTop, v n = 0 β v (n + 1) = 0) | |
| (hreset : β n (k : β€), 2 + 100 * (k : β) β€ t n β | |
| t n β€ 5 + 100 * (k : β) β v (n + 1) = 0) : | |
| βαΆ n in atTop, v n = 0 := by | |
| obtain β¨N, hNβ© := eventually_atTop.mp hstay | |
| obtain β¨n, hn, k, hlow, hhighβ© := exists_later_periodic_reset hmono hunbounded hstep N | |
| have hzero : v (n + 1) = 0 := hreset n k hlow (by linarith) | |
| apply eventually_atTop.mpr | |
| refine β¨n + 1, ?_β© | |
| intro m hm | |
| induction m, hm using Nat.le_induction with | |
| | base => exact hzero | |
| | succ m hm ih => exact hN m (by omega) ih | |
| end Problem340.ClockDynamics | |
| end OAI | |