Download data/lean/OAI/Dynamics/EntropyCounterexample/ClockPrediction.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 6.59 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Dynamics/EntropyCounterexample/ClockPrediction.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Dynamics/EntropyCounterexample/ClockPrediction.lean
-
curl -L -o ClockPrediction.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Dynamics/EntropyCounterexample/ClockPrediction.lean
6.59 kB
| import Mathlib | |
| namespace OAI | |
| noncomputable section | |
| open Filter Set | |
| namespace Problem340 | |
| theorem clock_readings_separated {t : β β β} (ht : Monotone t) | |
| {i j : β} (hij : i < j) (hstep : t (i + 1) = t i + 1) : | |
| t i + 1 β€ t j := by | |
| rw [β hstep] | |
| exact ht (Nat.succ_le_of_lt hij) | |
| theorem clock_readout_unique {t : β β β} {Ξ² : β β β} {a b : β} | |
| (ht : Monotone t) (hwidth : b - a < 1) | |
| (hsupport : β x, Ξ² x β 0 β a < x β§ x < b) | |
| (hstep : β n, Ξ² (t n) β 0 β t (n + 1) = t n + 1) | |
| {i j : β} (hi : Ξ² (t i) β 0) (hj : Ξ² (t j) β 0) : i = j := by | |
| obtain hij | hij | hij := lt_trichotomy i j | |
| Β· have hsep := clock_readings_separated ht hij (hstep i hi) | |
| have hi' := hsupport (t i) hi | |
| have hj' := hsupport (t j) hj | |
| linarith | |
| Β· exact hij | |
| Β· have hsep := clock_readings_separated ht hij (hstep j hj) | |
| have hi' := hsupport (t i) hi | |
| have hj' := hsupport (t j) hj | |
| linarith | |
| theorem clock_readout_support_subsingleton {t : β β β} {Ξ² : β β β} {a b : β} | |
| (ht : Monotone t) (hwidth : b - a < 1) | |
| (hsupport : β x, Ξ² x β 0 β a < x β§ x < b) | |
| (hstep : β n, Ξ² (t n) β 0 β t (n + 1) = t n + 1) : | |
| Set.Subsingleton {n : β | Ξ² (t n) β 0} := by | |
| intro i hi j hj | |
| exact clock_readout_unique ht hwidth hsupport hstep hi hj | |
| theorem tsum_clock_readout_eq_single {E : Type*} [NormedAddCommGroup E] | |
| [NormedSpace β E] {t : β β β} {Ξ² : β β β} {a b : β} | |
| (ht : Monotone t) (hwidth : b - a < 1) | |
| (hsupport : β x, Ξ² x β 0 β a < x β§ x < b) | |
| (hstep : β n, Ξ² (t n) β 0 β t (n + 1) = t n + 1) | |
| (v : β β E) {j : β} (hj : Ξ² (t j) β 0) : | |
| (β' n, Ξ² (t n) β’ v n) = Ξ² (t j) β’ v j := by | |
| apply tsum_eq_single j | |
| intro n hnj | |
| have hn : Ξ² (t n) = 0 := by | |
| by_contra hn | |
| exact hnj (clock_readout_unique ht hwidth hsupport hstep hn hj) | |
| simp [hn] | |
| theorem tsum_clock_readout_eq_zero {E : Type*} [NormedAddCommGroup E] | |
| [NormedSpace β E] {t : β β β} {Ξ² : β β β} | |
| (v : β β E) (hzero : β n, Ξ² (t n) = 0) : | |
| (β' n, Ξ² (t n) β’ v n) = 0 := by | |
| simp [hzero] | |
| theorem clock_unit_speed_add {t : β β β} {a b : β} | |
| (ht : Monotone t) | |
| (hstep : β n, a β€ t n β t n β€ b β t (n + 1) = t n + 1) | |
| (i d : β) (ha : a β€ t i) (hb : t (i + d) β€ b) : | |
| t (i + d) = t i + (d : β) := by | |
| induction d with | |
| | zero => simp | |
| | succ d ih => | |
| have hd : t (i + d) β€ b := (ht (by omega)).trans hb | |
| have hlo : a β€ t (i + d) := ha.trans (ht (by omega)) | |
| have heq := hstep (i + d) hlo hd | |
| have hprev := ih hd | |
| simpa [Nat.succ_eq_add_one, Nat.add_assoc, Nat.cast_add, Nat.cast_one, | |
| hprev, add_assoc] using heq | |
| theorem clock_preparation_card_le_five {t : β β β} | |
| (ht : Monotone t) | |
| (hstep : β n, 8 β€ t n β t n β€ 12 β t (n + 1) = t n + 1) | |
| (I : Finset β) (hI : β i β I, 8 < t i β§ t i < 12) : I.card β€ 5 := by | |
| classical | |
| by_cases hne : I.Nonempty | |
| Β· let i := I.min' hne | |
| have hi : i β I := Finset.min'_mem I hne | |
| have hsub : I β Finset.Icc i (i + 4) := by | |
| intro j hj | |
| have hij : i β€ j := Finset.min'_le I j hj | |
| have hadd : i + (j - i) = j := Nat.add_sub_of_le hij | |
| have htime := clock_unit_speed_add ht hstep i (j - i) | |
| (hI i hi).1.le (by simpa [hadd] using (hI j hj).2.le) | |
| rw [hadd] at htime | |
| have hgap : (j - i : β) < 4 := by | |
| have hi' := (hI i hi).1 | |
| have hj' := (hI j hj).2 | |
| have hcast : ((j - i : β) : β) = (j : β) - (i : β) := | |
| Nat.cast_sub hij | |
| rw [hcast] at htime | |
| linarith | |
| have hgap' : j - i < 4 := by | |
| have : ((j - i : β) : β) < (4 : β) := by | |
| simpa [Nat.cast_sub hij] using hgap | |
| exact_mod_cast this | |
| exact Finset.mem_Icc.mpr β¨hij, by omegaβ© | |
| have hc := Finset.card_le_card hsub | |
| simp only [Nat.card_Icc] at hc | |
| omega | |
| Β· simp [Finset.not_nonempty_iff_eq_empty.mp hne] | |
| theorem clock_prediction_agreement {X : Type*} {x y : β β X} | |
| {clock : X β β} {a b : β} {N : β} | |
| (hzero : x 0 = y 0) | |
| (hbefore : β n < N, x n = y n β clock (x n) < a β x (n + 1) = y (n + 1)) | |
| (hxstep : β n < N, a β€ clock (x n) β clock (x n) β€ b β | |
| clock (x (n + 1)) = clock (x n) + 1) | |
| (hystep : β n < N, a β€ clock (y n) β clock (y n) β€ b β | |
| clock (y (n + 1)) = clock (y n) + 1) | |
| (hbound : β n < N, clock (x n) β€ b) : | |
| β n β€ N, clock (x n) = clock (y n) := by | |
| have hfast (n : β) (hn : n < N) (heq : clock (x n) = clock (y n)) | |
| (ha : a β€ clock (x n)) : | |
| clock (x (n + 1)) = clock (y (n + 1)) β§ a β€ clock (x (n + 1)) := by | |
| have hx := hxstep n hn ha (hbound n hn) | |
| have hy := hystep n hn (heq βΈ ha) (heq βΈ hbound n hn) | |
| constructor | |
| Β· rw [hx, hy, heq] | |
| Β· linarith | |
| have hinv : β n β€ N, | |
| x n = y n β¨ (clock (x n) = clock (y n) β§ a β€ clock (x n)) := by | |
| intro n | |
| induction n with | |
| | zero => intro _; exact Or.inl hzero | |
| | succ n ih => | |
| intro hn | |
| have hn' : n < N := by omega | |
| rcases ih (by omega) with heq | β¨heq, haβ© | |
| Β· by_cases ha : clock (x n) < a | |
| Β· exact Or.inl (hbefore n hn' heq ha) | |
| Β· exact Or.inr (hfast n hn' (congrArg clock heq) (le_of_not_gt ha)) | |
| Β· exact Or.inr (hfast n hn' heq ha) | |
| intro n hn | |
| rcases hinv n hn with heq | β¨heq, _β© | |
| Β· exact congrArg clock heq | |
| Β· exact heq | |
| theorem clock_readout_values_agree {s t : β β β} {Ξ² : β β β} {b : β} | |
| (hs : Monotone s) (ht : Monotone t) | |
| (hsupport : β r, b β€ r β Ξ² r = 0) | |
| (N : β) (hN : b β€ s N) (hagree : β n β€ N, s n = t n) : | |
| β n, Ξ² (s n) = Ξ² (t n) := by | |
| intro n | |
| by_cases hn : n β€ N | |
| Β· rw [hagree n hn] | |
| Β· have hNn : N β€ n := by omega | |
| have hsN : b β€ s n := hN.trans (hs hNn) | |
| have htN : b β€ t n := (hagree N le_rfl βΈ hN).trans (ht hNn) | |
| rw [hsupport _ hsN, hsupport _ htN] | |
| theorem clock_prediction_single_hit {s t : β β β} {Ξ² : β β β} {a b : β} | |
| (hs : Monotone s) (hwidth : b - a < 1) | |
| (hsupport : β r, Ξ² r β 0 β a < r β§ r < b) | |
| (hstep : β n, Ξ² (s n) β 0 β s (n + 1) = s n + 1) | |
| (hagree : β n, Ξ² (s n) = Ξ² (t n)) | |
| {j : β} (hj : Ξ² (s j) β 0) (n : β) : | |
| Ξ² (t n) = if n = j then Ξ² (s j) else 0 := by | |
| rw [β hagree n] | |
| split_ifs with hnj | |
| Β· subst n; rfl | |
| Β· by_contra hn | |
| exact hnj (clock_readout_unique hs hwidth hsupport hstep hn hj) | |
| end Problem340 | |
| end | |
| end OAI | |