roseking's picture
Add lean source and binary files (part 64)
92416a2 verified
Raw History Blame Contribute Delete
2.57 kB
import Mathlib
import OAI.Computability.VertexCover.PCP.Preprocessing
namespace OAI
namespace UniqueGames.Foundations.PCP.FinalConstants
def alphabet : Nat := 64
def compositionLoss : Nat := 12288
def denominator : Nat := 16 * alphabet ^ 4 * 66 * compositionLoss
def windowHalf : Nat := denominator * Preprocessing.sizeFactor
def windowSize : Nat := 2 * windowHalf + 1
def smoothingScale : Nat := 4 * alphabet * windowHalf
def endpointLength : Nat := smoothingScale ^ 2
def walkLength : Nat := 2 * endpointLength + 1
noncomputable def gain : ℝ := (windowSize : ℝ) / denominator
noncomputable def cap : ℝ := 1 / (walkLength : ℝ)
theorem denominator_positive : 0 < denominator := by
norm_num [denominator, alphabet, compositionLoss]
theorem windowHalf_positive : 0 < windowHalf :=
Nat.mul_pos denominator_positive Preprocessing.sizeFactor_positive
theorem walkLength_positive : 0 < walkLength := by
simp [walkLength]
theorem gain_large : 2 * (Preprocessing.sizeFactor : ℝ) ≤ gain := by
have hd : (0 : ℝ) < denominator := by exact_mod_cast denominator_positive
apply (le_div_iff₀ hd).2
simp only [windowSize, windowHalf, Nat.cast_add, Nat.cast_mul,
Nat.cast_ofNat]
nlinarith
theorem cap_positive : 0 < cap := by
exact one_div_pos.mpr (by exact_mod_cast walkLength_positive)
theorem cap_le_one : cap ≤ 1 := by
apply (div_le_one (by exact_mod_cast walkLength_positive)).2
exact_mod_cast walkLength_positive
theorem composed_gap (epsilon : ℝ) (he : 0 ≤ epsilon) :
min (2 * epsilon) cap ≤
gain * min (epsilon / (Preprocessing.sizeFactor : ℝ))
(1 / (walkLength : ℝ)) := by
have hs : (0 : ℝ) < Preprocessing.sizeFactor := by
exact_mod_cast Preprocessing.sizeFactor_positive
have hs1 : (1 : ℝ) ≤ Preprocessing.sizeFactor := by
exact_mod_cast Preprocessing.sizeFactor_positive
have hg : 0 ≤ gain := le_trans (by positivity) gain_large
rw [mul_min_of_nonneg _ _ hg]
apply min_le_min
· calc
2 * epsilon = (2 * (Preprocessing.sizeFactor : ℝ)) *
(epsilon / (Preprocessing.sizeFactor : ℝ)) := by field_simp
_ ≤ gain * (epsilon / (Preprocessing.sizeFactor : ℝ)) :=
mul_le_mul_of_nonneg_right gain_large (div_nonneg he hs.le)
· change cap ≤ gain * cap
have hgain : 1 ≤ gain := by linarith [gain_large]
simpa only [one_mul] using mul_le_mul_of_nonneg_right hgain cap_positive.le
end UniqueGames.Foundations.PCP.FinalConstants
end OAI