Download data/lean/OAI/Computability/VertexCover/Analysis/RoundingError.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 3.87 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Computability/VertexCover/Analysis/RoundingError.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Computability/VertexCover/Analysis/RoundingError.lean
-
curl -L -o RoundingError.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Computability/VertexCover/Analysis/RoundingError.lean
3.87 kB
| import Mathlib | |
| namespace OAI | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| namespace VertexCover.GridCoupling | |
| open MeasureTheory ProbabilityTheory | |
| open scoped ENNReal | |
| noncomputable def midpoint (p : β) (i : Fin p) : β := -1 + (2*(i:β)+1)/p | |
| noncomputable def index (p : β) (hp : 0 < p) (x : β) : Fin p := | |
| β¨min β(p:β)*(x+1)/2ββ (p-1), (min_le_right _ _).trans_lt (by omega)β© | |
| theorem index_measurable (p : β) (hp : 0 < p) : Measurable (index p hp) := by | |
| let g : β β Fin p := fun k => β¨min k (p-1), (min_le_right _ _).trans_lt (by omega)β© | |
| exact (measurable_of_countable g).comp | |
| (((measurable_const.mul (measurable_id.add_const 1)).div_const 2).nat_floor) | |
| theorem floor_lt_on_interval (p : β) (hp : 0 < p) {x : β} | |
| (hx : x β Set.Ico (-1 : β) 1) : β(p:β)*(x+1)/2ββ < p := by | |
| apply (Nat.floor_lt' (Nat.ne_of_gt hp)).mpr | |
| have hpR : (0:β) < p := Nat.cast_pos.mpr hp | |
| nlinarith [mul_lt_mul_of_pos_left hx.2 hpR] | |
| theorem index_val_on_interval (p : β) (hp : 0 < p) {x : β} | |
| (hx : x β Set.Ico (-1 : β) 1) : (index p hp x).val = β(p:β)*(x+1)/2ββ := by | |
| exact min_eq_left (by have h := floor_lt_on_interval p hp hx; omega) | |
| theorem index_eq_iff_on_interval (p : β) (hp : 0 < p) {x : β} | |
| (hx : x β Set.Ico (-1 : β) 1) (i : Fin p) : | |
| index p hp x = i β -1 + 2*(i:β)/p β€ x β§ x < -1 + 2*((i:β)+1)/p := by | |
| have hz : 0 β€ (p:β)*(x+1)/2 := div_nonneg (mul_nonneg (Nat.cast_nonneg _) (by linarith [hx.1])) (by norm_num) | |
| have hpR : (0:β) < p := Nat.cast_pos.mpr hp | |
| rw [Fin.ext_iff, index_val_on_interval p hp hx, Nat.floor_eq_iff hz] | |
| constructor | |
| Β· rintro β¨hl, huβ© | |
| constructor | |
| Β· have h : 2*(i:β)/p β€ x+1 := (div_le_iffβ hpR).mpr (by nlinarith) | |
| linarith | |
| Β· have h : x+1 < 2*((i:β)+1)/p := (lt_div_iffβ hpR).mpr (by nlinarith) | |
| linarith | |
| Β· rintro β¨hl, huβ© | |
| have hL : 2*(i:β) β€ (x+1)*p := (div_le_iffβ hpR).mp (by linarith) | |
| have hU : (x+1)*p < 2*((i:β)+1) := (lt_div_iffβ hpR).mp (by linarith) | |
| constructor <;> nlinarith | |
| end VertexCover.GridCoupling | |
| namespace VertexCover.GridCoupling | |
| open MeasureTheory ProbabilityTheory | |
| open scoped ENNReal | |
| theorem cell_subset_interval (p : β) (hp : 0 < p) (i : Fin p) : | |
| Set.Ico (-1 + 2*(i:β)/p) (-1 + 2*((i:β)+1)/p) β Set.Ico (-1:β) 1 := by | |
| intro x hx | |
| have hpR : (0:β) < p := Nat.cast_pos.mpr hp | |
| have hi : (i:β)+1 β€ p := by exact_mod_cast i.isLt | |
| have hz : 0 β€ 2*(i:β)/p := div_nonneg (mul_nonneg (by norm_num) (Nat.cast_nonneg _)) hpR.le | |
| have hu : 2*((i:β)+1)/p β€ 2 := (div_le_iffβ hpR).mpr (by nlinarith) | |
| exact β¨by linarith [hx.1], by linarith [hx.2]β© | |
| theorem preimage_cell (p : β) (hp : 0 < p) (i : Fin p) : | |
| (index p hp β»ΒΉ' {i}) β© Set.Ico (-1:β) 1 = | |
| Set.Ico (-1 + 2*(i:β)/p) (-1 + 2*((i:β)+1)/p) := by | |
| ext x | |
| constructor | |
| Β· rintro β¨hi, hxβ© | |
| exact (index_eq_iff_on_interval p hp hx i).mp hi | |
| Β· intro hx | |
| have hx' := cell_subset_interval p hp i hx | |
| exact β¨(index_eq_iff_on_interval p hp hx' i).mpr hx, hx'β© | |
| theorem rounding_error (p : β) (hp : 0 < p) {x : β} | |
| (hx : x β Set.Ico (-1 : β) 1) : |x - midpoint p (index p hp x)| β€ 1/p := by | |
| have h := (index_eq_iff_on_interval p hp hx (index p hp x)).mp rfl | |
| unfold midpoint | |
| rw [abs_le] | |
| simp only [mul_add, mul_one, add_div] at h β’ | |
| have he : (2:β)/p = 2*(1/p) := by ring | |
| rw [he] at h | |
| constructor <;> linarith | |
| end VertexCover.GridCoupling | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end OAI | |