Download lean/OAI/Computability/SpaceSimulation/OneTape/Growth.lean from roseking/openAI-math-dataset: direct link, hf CLI and curl.
- Browser
- Download file 5.22 kB
-
https://huggingface.co/datasets/roseking/openAI-math-dataset/resolve/main/lean/OAI/Computability/SpaceSimulation/OneTape/Growth.lean
- Command line
-
hf download hf://datasets/roseking/openAI-math-dataset/lean/OAI/Computability/SpaceSimulation/OneTape/Growth.lean
-
curl -L -o Growth.lean https://huggingface.co/datasets/roseking/openAI-math-dataset/resolve/main/lean/OAI/Computability/SpaceSimulation/OneTape/Growth.lean
5.22 kB
| import OAI.Computability.SpaceSimulation.OneTape.Sizes | |
| namespace OAI | |
| namespace Fifths.Cost | |
| noncomputable def Log (T : ℕ) := Real.log (T+2 : ℝ) / Real.log 2 | |
| noncomputable def exponent := (2:ℝ)/5 | |
| private theorem logpos : 0 < Real.log 2 := Real.log_pos (by norm_num) | |
| theorem one_le (T : ℕ) : 1 ≤ Log T := by | |
| unfold Log | |
| apply (le_div_iff₀ logpos).mpr | |
| rw | |
| apply Real.log_le_log (by norm_num) | |
| have : (0:ℝ) ≤ T := by positivity | |
| linarith | |
| private theorem smallPow {T : ℕ} (h : T ≥ 2) : | |
| 2^(T.size-1) ≤ T ∧ 1 ≤ T.size := by | |
| have b := Nat.size_pos.mpr (show 0<T by omega) | |
| exact ⟨Nat.lt_size.mp (by omega), b⟩ | |
| theorem lg_real {T : ℕ} (h : T ≥ 2) : (lg T:ℝ) ≤ 3 * Log T := by | |
| obtain ⟨p,l⟩ := smallPow h | |
| have q : ((T.size-1:ℕ) : ℝ) ≤ Log T := by | |
| unfold Log | |
| apply (le_div_iff₀ logpos).mpr | |
| rw | |
| apply Real.log_le_log (by positivity) | |
| exact le_trans (by exact_mod_cast p) (show (T:ℝ) ≤ T+2 by linarith) | |
| have k := one_le T | |
| rw | |
| exact Real.log_le_log (by positivity) (by exact_mod_cast p) | |
| theorem log_shift (T : ℕ) : Log (T+2) ≤ 2 * Log T := by | |
| unfold Log | |
| rw | |
| apply div_le_div_of_nonneg_right _ logpos.le | |
| have w : (↑(T+2:ℕ):ℝ)+2 ≤ ((T:ℝ)+2)^2 := by | |
| push_cast | |
| have : (0:ℝ) ≤ T := by positivity | |
| nlinarith | |
| have g := Real.log_le_log (by positivity) w | |
| simpa only | |
| calc | |
| _ ≤ 2^(T.size+4) := Nat.pow_le_pow_right (by omega) (by unfold power; omega) | |
| _ = 32*2^(T.size-1) := by | |
| nth_rw 1 | |
| rw | |
| rw | |
| apply (pow_le_pow_iff_left₀ (by positivity) (by positivity) | |
| (show (5:ℕ)≠0 by decide)).mp | |
| rw | |
| calc | |
| _ ≤ (32*(T:ℝ))*(32*(T:ℝ)) := mul_le_mul p p (by positivity) (by positivity) | |
| _ ≤ _ := by nlinarith | |
| noncomputable def factor (d : ℕ) : ℝ := 32 * 3^(d+2) | |
| theorem fpos (d : ℕ) : 0 < factor d := by unfold factor; positivity | |
| theorem realBound (d : ℕ) {T : ℕ} (h : T≥2) : | |
| (bound d T:ℝ) ≤ factor d * (T:ℝ)^exponent * (Log T)^(d+2) := by | |
| have p := k_real h | |
| have q := lg_real h | |
| have b := one_le T | |
| unfold bound | |
| push_cast | |
| calc | |
| _ ≤ (32 * (T:ℝ)^exponent) * (3*Log T)^(d+2) := | |
| mul_le_mul p (pow_le_pow_left₀ (by positivity) q _) (by positivity) (by positivity) | |
| _ = _ := by rw | |