Download data/lean/OAI/Dynamics/StandardMap/ArrayGrid.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 5.08 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Dynamics/StandardMap/ArrayGrid.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Dynamics/StandardMap/ArrayGrid.lean
-
curl -L -o ArrayGrid.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Dynamics/StandardMap/ArrayGrid.lean
5.08 kB
| import OAI.Dynamics.StandardMap.ArrayTests | |
| namespace OAI | |
| open MeasureTheory Set | |
| open scoped ENNReal BigOperators | |
| open Set Filter | |
| open scoped Topology | |
| namespace StandardMapEntropy | |
| lemma dyadic_zsmul_val (i : β€) (h : DyadicTime) : ((i β’ h : DyadicTime):β)=(i:β)*(h:β) := by | |
| simp only [AddSubgroup.coe_zsmul,zsmul_eq_mul] | |
| lemma dyadic_mid_grid (h : DyadicTime) (i : β€) : dyadicMid (i β’ h) ((i+2) β’ h)=(i+1) β’ h := by | |
| apply Subtype.ext | |
| simp only [dyadicMid_val,dyadic_zsmul_val,Int.cast_add,Int.cast_one,Int.cast_ofNat] | |
| ring | |
| lemma int_constant_of_succ (f : β€ β β) (hf : β i,f (i+1)=f i) (i : β€) : f i=f 0 := by | |
| induction i using Int.induction_on with | |
| | zero => rfl | |
| | succ n ih => rw [hf,ih] | |
| | pred n ih => rw [β hf (- (n:β€)-1),sub_add_cancel,ih] | |
| lemma array_grid_edges (d : DistanceArray) | |
| (hz : β s t : DyadicTime, (s:β)<(t:β) β arrayJ s t d+arrayV s t d=0) | |
| (h : DyadicTime) (hh : 0<(h:β)) (i : β€) : | |
| d.val (i β’ h) ((i+1) β’ h)=d.val 0 h := by | |
| let f : β€ β β := fun i => d.val (i β’ h) ((i+1) β’ h) | |
| have hf (i : β€) : f (i+1)=f i := by | |
| have hi : ((i β’ h : DyadicTime):β)<(((i+2) β’ h : DyadicTime):β) := by | |
| simp only [dyadic_zsmul_val,Int.cast_add,Int.cast_ofNat]; nlinarith | |
| obtain β¨hL,hRβ© := array_zero_test_halves (i β’ h) ((i+2) β’ h) hi d (hz _ _ hi) | |
| rw [dyadic_mid_grid] at hL hR | |
| dsimp only [f] | |
| simpa only [show i+1+1=i+2 by ring] using hR.trans hL.symm | |
| have he := int_constant_of_succ f hf i | |
| simpa only [f,zero_smul,zero_add,one_zsmul] using he | |
| lemma array_grid_upper (d : DistanceArray) (h : DyadicTime) (c : β) | |
| (he : β i : β€,d.val (i β’ h) ((i+1) β’ h)=c) (i : β€) (n : β) : | |
| d.val (i β’ h) ((i+(n:β€)) β’ h) β€ (n:β)*c := by | |
| induction n with | |
| | zero => simpa using (show d.val (i β’ h) (i β’ h) β€ 0 by rw [d.property.2.1]) | |
| | succ n ih => | |
| have ht := d.property.2.2.2.1 (i β’ h) ((i+(n:β€)) β’ h) ((i+((n+1:β):β€)) β’ h) | |
| have hn : i+((n+1:β):β€)=i+(n:β€)+1 := by omega | |
| rw [hn,he] at ht | |
| rw [hn] | |
| push_cast | |
| linarith | |
| lemma array_grid_power (d : DistanceArray) | |
| (hz : β s t : DyadicTime, (s:β)<(t:β) β arrayJ s t d+arrayV s t d=0) | |
| (h : DyadicTime) (hh : 0<(h:β)) (i : β€) (m : β) : | |
| d.val (i β’ h) ((i+(2:β€)^m) β’ h)=(2:β)^m*d.val 0 h := by | |
| induction m with | |
| | zero => simpa using array_grid_edges d hz h hh i | |
| | succ m ih => | |
| have hm : (0:β)<(2:β)^(m+1) := by positivity | |
| have hi : ((i β’ h : DyadicTime):β)<(((i+(2:β€)^(m+1)) β’ h : DyadicTime):β) := by | |
| simp only [dyadic_zsmul_val,Int.cast_add,Int.cast_pow,Int.cast_ofNat] | |
| nlinarith | |
| have hmid : dyadicMid (i β’ h) ((i+(2:β€)^(m+1)) β’ h)=(i+(2:β€)^m) β’ h := by | |
| apply Subtype.ext | |
| simp only [dyadicMid_val,dyadic_zsmul_val,Int.cast_add,Int.cast_pow,Int.cast_ofNat,pow_succ] | |
| push_cast | |
| ring | |
| have hl := (array_zero_test_halves _ _ hi d (hz _ _ hi)).1 | |
| rw [hmid,ih] at hl | |
| calc | |
| _ = 2*((2:β)^m*d.val 0 h) := by linarith | |
| _ = _ := by rw [pow_succ]; ring | |
| lemma nat_le_two_power (n : β) : n β€ 2^n := by | |
| induction n with | |
| | zero => simp | |
| | succ n ih => | |
| have hp : 1 β€ (2:β)^n := one_le_powβ (by norm_num) | |
| rw [pow_succ] | |
| omega | |
| lemma array_grid_distance_nat (d : DistanceArray) | |
| (hz : β s t : DyadicTime, (s:β)<(t:β) β arrayJ s t d+arrayV s t d=0) | |
| (h : DyadicTime) (hh : 0<(h:β)) (i : β€) (n : β) : | |
| d.val (i β’ h) ((i+(n:β€)) β’ h)=(n:β)*d.val 0 h := by | |
| have he := array_grid_edges d hz h hh | |
| apply le_antisymm (array_grid_upper d h (d.val 0 h) he i n) | |
| let N : β := 2^n | |
| have hn : n β€ N := nat_le_two_power n | |
| have hu := array_grid_upper d h (d.val 0 h) he (i+(n:β€)) (N-n) | |
| have hidx : i+(n:β€)+((N-n:β):β€)=i+(2:β€)^n := by | |
| rw [Nat.cast_sub hn] | |
| dsimp only [N] | |
| push_cast; ring | |
| rw [hidx] at hu | |
| have ht := d.property.2.2.2.1 (i β’ h) ((i+(n:β€)) β’ h) ((i+(2:β€)^n) β’ h) | |
| rw [array_grid_power d hz h hh i n] at ht | |
| have hcast : ((N-n:β):β)=(2:β)^n-(n:β) := by rw [Nat.cast_sub hn]; simp [N] | |
| rw [hcast] at hu | |
| nlinarith | |
| lemma array_grid_distance (d : DistanceArray) | |
| (hz : β s t : DyadicTime, (s:β)<(t:β) β arrayJ s t d+arrayV s t d=0) | |
| (h : DyadicTime) (hh : 0<(h:β)) (i j : β€) : | |
| d.val (i β’ h) (j β’ h)=|(j:β)-(i:β)| *d.val 0 h := by | |
| wlog hij : i β€ j generalizing i j | |
| Β· rw [d.property.2.2.1,abs_sub_comm] | |
| exact this j i (le_of_not_ge hij) | |
| have hn : i+((j-i).toNat:β€)=j := by rw [Int.toNat_of_nonneg (sub_nonneg.mpr hij)]; ring | |
| have he := array_grid_distance_nat d hz h hh i (j-i).toNat | |
| rw [hn] at he | |
| have hcast : ((j-i).toNat:β)=(j:β)-(i:β) := by | |
| have hh := congrArg (fun a : β€ => (a:β)) (Int.toNat_of_nonneg (sub_nonneg.mpr hij)) | |
| simpa only [Int.cast_natCast,Int.cast_sub] using hh | |
| rw [hcast] at he | |
| rw [abs_of_nonneg (sub_nonneg.mpr (by exact_mod_cast hij))] | |
| exact he | |
| end StandardMapEntropy | |
| end OAI | |