Lean / Reader
Lean readerDecayConverse.lean
Lean 4 Web has Mathlib, so it can check files that import only Mathlib. This one also imports DecayTail, DecayTransfer, which it does not have: you can read it there, but it will not check. Build the project itself to check it.
import DecayTailimport DecayTransfernamespace DecayClassification/-- i+1 converts from the formal zero-based index to the source index. -/noncomputable def regular (A : ℝ) (D j : ℕ) : ℝ := A / ((j+1:ℕ):ℝ)^(D*(j+1))theorem regular_pos {A : ℝ} (hA : 0 < A) (D j : ℕ) : 0 < regular A D j := byunfold regularpositivitytheorem regular_half {A : ℝ} (hA : 0 < A) {D : ℕ} (hD : 0 < D) (j : ℕ) :2*regular A D (j+1) ≤ regular A D j := bylet x : ℝ := ((j+1:ℕ):ℝ)let y : ℝ := ((j+1+1:ℕ):ℝ)have hx : 1 ≤ x := by dsimp [x]; exact_mod_cast (show 1 ≤ j+1 by omega)have hy : 2 ≤ y := by dsimp [y]; push_cast; linarith [Nat.cast_nonneg (α := ℝ) j]have xy : x ≤ y := by dsimp [x,y]; push_cast; linarithhave denom : 2*x^(D*(j+1)) ≤ y^(D*(j+1+1)) := byhave hbase := pow_le_pow_left₀ (le_trans zero_le_one hx) xy (D*(j+1))have hfactor : 2 ≤ y^D := byhave hh := pow_le_pow_right₀ (by linarith : (1:ℝ) ≤ y) (show 1 ≤ D by omega)exact hy.trans (by simpa using hh)calc_ ≤ y^D * y^(D*(j+1)) := mul_le_mul hfactor hbase (by positivity) (by positivity)_ = y^(D*(j+1+1)) := by rw [← pow_add]; congr 1; ringhave x0 := pow_pos (by linarith : 0 < x) (D*(j+1))have y0 := pow_pos (by linarith : 0 < y) (D*(j+1+1))change 2*(A/y^(D*(j+1+1))) ≤ A/x^(D*(j+1))rw [← mul_div_assoc, div_le_div_iff₀ y0 x0]nlinarith [mul_le_mul_of_nonneg_left denom hA.le]theorem regular_tail_comparison (A : ℝ) (hA : 0 ≤ A) (C j : ℕ) (hj : 1 ≤ j) :regular A (4*C+1) j * ((2*j+2:ℕ):ℝ)^(C*(2*j+2)) ≤ A := bylet x : ℝ := ((j+1:ℕ):ℝ)have hx : 2 ≤ x := by dsimp [x]; exact_mod_cast (show 2 ≤ j+1 by omega)have x0 : 0 < x := by linarithhave rcast : ((2*j+2:ℕ):ℝ) = 2*x := by dsimp [x]; push_cast; ringhave denom : (2*x)^(C*(2*j+2)) ≤ x^((4*C+1)*(j+1)) := byhave h1 : 2*x ≤ x^2 := by nlinarith [mul_nonneg (show 0 ≤ x-2 by linarith) x0.le]calc_ ≤ (x^2)^(C*(2*j+2)) := pow_le_pow_left₀ (by positivity) h1 __ = x^(2*(C*(2*j+2))) := (pow_mul ..).symm_ ≤ _ := pow_le_pow_right₀ (by linarith) (by nlinarith : 2*(C*(2*j+2)) ≤ (4*C+1)*(j+1))rw [rcast]change (A / x^((4*C+1)*(j+1)))*(2*x)^(C*(2*j+2)) ≤ Arw [div_mul_eq_mul_div, div_le_iff₀ (pow_pos x0 _)]exact mul_le_mul_of_nonneg_left denom hA/-- The graph-theoretic input in the converse is independent of the targetprofile. It records exactly the provisional graph sizes and regular caps. -/def RegularModels : Prop :=∀ D : ℕ, 0 < D → ∃ A : ℝ, 0 < A ∧ ∃ k : ℕ, 2 ≤ k ∧∀ L : ℕ, ∃ N : ℕ, ∀ J ≥ N, ∃ n ≥ L, ∃ c : Fin n × Fin n → ℕ,(∀ e ∈ edges n, c e ≤ J) ∧ Bounded (regular A D) c ∧1 ≤ 2*regular A D J*(edges n).card ∧ ¬MonoClique k c/-- The complete transfer from a failed tail test for any positive monotoneprofile to unbounded finite counterexamples, up to one scale factor. -/theorem scaled_counterexamples (models : RegularModels) (a : ℕ → ℝ) (ha : Antitone a)(ha0 : ∀ i, 0 < a i) (bad : ¬TailTest a) :∃ γ : ℝ, 1 ≤ γ ∧ ¬DecayRamsey (fun i => γ*a i) := byobtain ⟨C,_,N,witness⟩ := witnesses_of_failure a badlet D := 4*C+1have hD : 0 < D := by dsimp [D]; omegaobtain ⟨A,hA,k,hk,hmodel⟩ := models D hDobtain ⟨γ,hγ,supply⟩ := scaled_supply a (regular A D) ha ha0 (regular_pos hA D)C N 1 A hA witness (fun j hj => regular_tail_comparison A hA.le C j hj)have hγ0 : 0 ≤ γ := by linarithexact ⟨γ,hγ,nonforcing_of_models _ _ (fun _ _ hij => mul_le_mul_of_nonneg_left (ha hij) hγ0)(fun i => mul_nonneg hγ0 (ha0 i).le) (regular_pos hA D)(regular_half hA hD) supply k hk hmodel⟩#print axioms scaled_counterexamples#print axioms integral_transfer#print axioms DecayEdgeRefinement.recolorend DecayClassification