import Mathlib.Analysis.SpecialFunctions.Log.Base import Mathlib.Analysis.SpecialFunctions.Pow.Real import Mathlib.Analysis.Complex.ExponentialBounds import Mathlib.Data.Nat.Log import Mathlib.Tactic /-! # Asymptotic Parameter Inequalities (Section 4 of `main.tex`) Formalizes the exact parameter choices and inequalities from Section 4 of `main.tex`: For `c > 0`, `C₁ > 0`, `m₀ : ℕ`, setting `n = s`, `λ = log₂ s`, `Δ = ⌈log₂ s⌉ = Nat.clog 2 s`, and `m = ⌈2 ^ ((8 * log₂ s / c) ^ (3 / 4))⌉`, there exist explicit constants `C > 0` (depending only on `c`) and `s₀ : ℕ` (depending on `c, C₁, m₀`) such that for all `s ≥ s₀`: - (a) `m ≥ m₀` and `m ≥ 2` - (b) `Δ < m ^ 2` - (c) `m ^ 2 ≤ s` and `s + m ^ 2 + 1 + 2 * s ^ 2 * (Δ + 2) ≤ s ^ 3` - (d) `log₂ C₁ + 4 * log₂ m < 5 * log₂ s` - **Circuit bound**: `C₁ * m ^ 4 * (s + m ^ 2 + 1 + 2 * s ^ 2 * (Δ + 2)) < m ^ (c * (log₂ m) ^ (1 / 3))` - **Hitting set bound** (for all `d ≥ 1`): `(d * m + 1) ^ (2 * m ^ 4) ≤ (d + 1) ^ (2 ^ (C * (log₂ s) ^ (3 / 4)))`. -/ namespace PermanentPIT.Asymptotics open Real /-- The parameter `m(c, s) = ⌈2 ^ ((8 * log₂ s / c) ^ (3 / 4))⌉` from `main.tex`. -/ noncomputable def mParam (c : ℝ) (s : ℕ) : ℕ := Nat.ceil ((2 : ℝ) ^ ((8 * Real.logb 2 (s : ℝ) / c) ^ ((3 : ℝ) / 4))) /-- The exponent `X(c, s) = (8 * log₂ s / c) ^ (3 / 4)`. -/ noncomputable def xParam (c : ℝ) (s : ℕ) : ℝ := (8 * Real.logb 2 (s : ℝ) / c) ^ ((3 : ℝ) / 4) /-- The design overlap parameter `Δ(s) = ⌈log₂ s⌉ = Nat.clog 2 s`. -/ def deltaParam (s : ℕ) : ℕ := Nat.clog 2 s /-- For `m ≥ 1`, `m ≤ 2 ^ (m - 1)`. -/ theorem nat_le_two_pow_pred {m : ℕ} (hm : 1 ≤ m) : m ≤ 2 ^ (m - 1) := by induction m with | zero => omega | succ k ih => cases k with | zero => simp | succ k' => have hk : 1 ≤ k' + 1 := by omega have h1 := ih hk have hpow : 2 ^ (k' + 1) = 2 * 2 ^ k' := by rw [pow_succ, mul_comm] have hsub : k' + 1 - 1 = k' := by omega rw [hsub] at h1 simp only [Nat.add_sub_cancel] omega /-- For `m ≥ 1`, `log₂ m ≤ m - 1`. -/ theorem logb_two_le_sub_one {m : ℕ} (hm : 1 ≤ m) : Real.logb 2 (m : ℝ) ≤ (m : ℝ) - 1 := by have hm_pos : (0 : ℝ) < (m : ℝ) := by exact_mod_cast (by omega : 0 < m) have hle : (m : ℝ) ≤ (2 : ℝ) ^ ((m - 1 : ℕ) : ℝ) := by have hnat : m ≤ 2 ^ (m - 1) := nat_le_two_pow_pred hm rw [Real.rpow_natCast] exact_mod_cast hnat have hlog : Real.logb 2 (m : ℝ) ≤ Real.logb 2 ((2 : ℝ) ^ ((m - 1 : ℕ) : ℝ)) := Real.logb_le_logb_of_le (by norm_num) hm_pos hle rw [Real.logb_rpow (by norm_num) (by norm_num)] at hlog have hcast : ((m - 1 : ℕ) : ℝ) = (m : ℝ) - 1 := by rw [Nat.cast_sub hm, Nat.cast_one] linarith /-- For `s ≥ 2`, `Nat.clog 2 s < log₂ s + 1`. -/ theorem deltaParam_lt_logb_add_one {s : ℕ} (hs : 2 ≤ s) : (deltaParam s : ℝ) < Real.logb 2 (s : ℝ) + 1 := by unfold deltaParam have hs1 : 1 < s := by omega have hpos : 0 < Nat.clog 2 s := Nat.clog_pos (by omega) hs1 have hlt : 2 ^ (Nat.clog 2 s - 1) < s := Nat.pow_pred_clog_lt_self (by omega) hs1 have hlt_r : (2 : ℝ) ^ ((Nat.clog 2 s - 1 : ℕ) : ℝ) < (s : ℝ) := by rw [Real.rpow_natCast] exact_mod_cast hlt have hpow_pos : (0 : ℝ) < (2 : ℝ) ^ ((Nat.clog 2 s - 1 : ℕ) : ℝ) := Real.rpow_pos_of_pos (by norm_num) _ have hlog : Real.logb 2 ((2 : ℝ) ^ ((Nat.clog 2 s - 1 : ℕ) : ℝ)) < Real.logb 2 (s : ℝ) := Real.logb_lt_logb (by norm_num) hpow_pos hlt_r rw [Real.logb_rpow (by norm_num) (by norm_num)] at hlog have hcast : ((Nat.clog 2 s - 1 : ℕ) : ℝ) = (Nat.clog 2 s : ℝ) - 1 := by rw [Nat.cast_sub (by omega), Nat.cast_one] linarith /-- Quadratic lower bound on `Real.exp`: for `y ≥ 0`, `1 + y + y^2 / 2 ≤ exp y`. -/ theorem quadratic_le_exp {y : ℝ} (hy : 0 ≤ y) : 1 + y + y ^ 2 / 2 ≤ Real.exp y := by have h := Real.sum_le_exp_of_nonneg hy 3 simp [Finset.sum_range_succ, Nat.factorial] at h linarith /-- Algebraic identity: `m ^ (c * (log₂ m) ^ (1 / 3)) = 2 ^ (c * (log₂ m) ^ (4 / 3))` for `m > 1`. -/ theorem rpow_eq_two_rpow_four_thirds {c x : ℝ} (hx : 1 < x) : x ^ (c * (Real.logb 2 x) ^ ((1 : ℝ) / 3)) = (2 : ℝ) ^ (c * (Real.logb 2 x) ^ ((4 : ℝ) / 3)) := by have hx_pos : 0 < x := by linarith have hlog_pos : 0 < Real.logb 2 x := Real.logb_pos (by norm_num) hx conv_lhs => arg 1 rw [← Real.rpow_logb (b := 2) (by norm_num) (by norm_num) hx_pos] rw [← Real.rpow_mul (by norm_num)] congr 1 have hadd : (Real.logb 2 x) ^ ((1 : ℝ) + (1 : ℝ) / 3) = (Real.logb 2 x) ^ (1 : ℝ) * (Real.logb 2 x) ^ ((1 : ℝ) / 3) := Real.rpow_add hlog_pos 1 ((1 : ℝ) / 3) rw [Real.rpow_one] at hadd have h43 : (1 : ℝ) + (1 : ℝ) / 3 = (4 : ℝ) / 3 := by norm_num rw [h43] at hadd rw [hadd] ring /-- For `X ≥ 1`, `m = ⌈2 ^ X⌉` satisfies `2 ^ X ≤ m ≤ 2 ^ (X + 1)`, hence `X ≤ log₂ m ≤ X + 1` and `2 ≤ m`. -/ theorem mParam_bounds {c : ℝ} {s : ℕ} (hX : 1 ≤ xParam c s) : 2 ≤ mParam c s ∧ (2 : ℝ) ^ (xParam c s) ≤ (mParam c s : ℝ) ∧ (mParam c s : ℝ) ≤ (2 : ℝ) ^ (xParam c s + 1) ∧ xParam c s ≤ Real.logb 2 (mParam c s : ℝ) ∧ Real.logb 2 (mParam c s : ℝ) ≤ xParam c s + 1 := by unfold mParam xParam at * set X := (8 * Real.logb 2 (s : ℝ) / c) ^ ((3 : ℝ) / 4) have h2X_ge : (2 : ℝ) ≤ (2 : ℝ) ^ X := by calc (2 : ℝ) = (2 : ℝ) ^ (1 : ℝ) := (Real.rpow_one 2).symm _ ≤ (2 : ℝ) ^ X := Real.rpow_le_rpow_of_exponent_le (by norm_num) hX have h2X_pos : (0 : ℝ) < (2 : ℝ) ^ X := Real.rpow_pos_of_pos (by norm_num) X have hle : (2 : ℝ) ^ X ≤ (Nat.ceil ((2 : ℝ) ^ X) : ℝ) := Nat.le_ceil _ have hm_ge2 : (2 : ℝ) ≤ (Nat.ceil ((2 : ℝ) ^ X) : ℝ) := le_trans h2X_ge hle have hm_nat : 2 ≤ Nat.ceil ((2 : ℝ) ^ X) := by exact_mod_cast hm_ge2 have hm_pos : (0 : ℝ) < (Nat.ceil ((2 : ℝ) ^ X) : ℝ) := by linarith have hlt_add : (Nat.ceil ((2 : ℝ) ^ X) : ℝ) < (2 : ℝ) ^ X + 1 := Nat.ceil_lt_add_one (le_of_lt h2X_pos) have hle_succ : (Nat.ceil ((2 : ℝ) ^ X) : ℝ) ≤ (2 : ℝ) ^ (X + 1) := by have hadd : (2 : ℝ) ^ (X + 1) = (2 : ℝ) ^ X * (2 : ℝ) ^ (1 : ℝ) := Real.rpow_add (by norm_num) X 1 rw [Real.rpow_one] at hadd linarith have hlog_lo : X ≤ Real.logb 2 (Nat.ceil ((2 : ℝ) ^ X) : ℝ) := by have h := Real.logb_le_logb_of_le (b := 2) (by norm_num) h2X_pos hle rwa [Real.logb_rpow (by norm_num) (by norm_num)] at h have hlog_hi : Real.logb 2 (Nat.ceil ((2 : ℝ) ^ X) : ℝ) ≤ X + 1 := by have h := Real.logb_le_logb_of_le (b := 2) (by norm_num) hm_pos hle_succ rwa [Real.logb_rpow (by norm_num) (by norm_num)] at h exact ⟨hm_nat, hle, hle_succ, hlog_lo, hlog_hi⟩ /-- Lower bound `8 * log₂ s ≤ c * (log₂ m) ^ (4 / 3)` whenever `c > 0`, `s ≥ 2`, `X ≥ 1`. -/ theorem eight_log_le_c_log_m_pow {c : ℝ} {s : ℕ} (hc : 0 < c) (hs : 2 ≤ s) (hX : 1 ≤ xParam c s) : 8 * Real.logb 2 (s : ℝ) ≤ c * (Real.logb 2 (mParam c s : ℝ)) ^ ((4 : ℝ) / 3) := by have hlog_s_pos : 0 < Real.logb 2 (s : ℝ) := Real.logb_pos (by norm_num) (by exact_mod_cast (by omega : 1 < s)) have harg_nonneg : 0 ≤ 8 * Real.logb 2 (s : ℝ) / c := div_nonneg (by linarith) (le_of_lt hc) have hX_le := (mParam_bounds hX).2.2.2.1 have hX_nonneg : 0 ≤ xParam c s := by linarith have hpow : (xParam c s) ^ ((4 : ℝ) / 3) ≤ (Real.logb 2 (mParam c s : ℝ)) ^ ((4 : ℝ) / 3) := Real.rpow_le_rpow hX_nonneg hX_le (by norm_num) have hcancel : (xParam c s) ^ ((4 : ℝ) / 3) = 8 * Real.logb 2 (s : ℝ) / c := by unfold xParam rw [← Real.rpow_mul harg_nonneg] norm_num rw [hcancel] at hpow have hmul := mul_le_mul_of_nonneg_left hpow (le_of_lt hc) have hcc : c * (8 * Real.logb 2 (s : ℝ) / c) = 8 * Real.logb 2 (s : ℝ) := by field_simp linarith /-- **Hitting set size bound (Section 4 of `main.tex`).** For `c > 0`, put `C = 6 * (8 / c) ^ (3 / 4) + 6`. Whenever `s ≥ 2` and `X(c, s) ≥ 1`, for every integer `d ≥ 1` we have `(d * m + 1) ^ (2 * m ^ 4) ≤ (d + 1) ^ (2 ^ (C * (log₂ s) ^ (3 / 4)))`. -/ theorem hitting_set_size_bound {c : ℝ} {s d : ℕ} (hc : 0 < c) (hs : 2 ≤ s) (hd : 1 ≤ d) (hX : 1 ≤ xParam c s) : ((d * mParam c s + 1 : ℕ) : ℝ) ^ (2 * (mParam c s) ^ 4) ≤ ((d + 1 : ℕ) : ℝ) ^ ((2 : ℝ) ^ ((6 * (8 / c) ^ ((3 : ℝ) / 4) + 6) * (Real.logb 2 (s : ℝ)) ^ ((3 : ℝ) / 4))) := by set m := mParam c s set lam := Real.logb 2 (s : ℝ) set X := xParam c s obtain ⟨hm2, -, hm_hi, -, hlog_hi⟩ := mParam_bounds hX have hm1 : 1 ≤ m := by omega have hm_pos : (0 : ℝ) < (m : ℝ) := by exact_mod_cast (by omega : 0 < m) have hlogm_nonneg : 0 ≤ Real.logb 2 (m : ℝ) := Real.logb_nonneg (by norm_num) (by exact_mod_cast hm1) have hd2 : (2 : ℝ) ≤ ((d + 1 : ℕ) : ℝ) := by exact_mod_cast (by omega : 2 ≤ d + 1) have hd1 : (1 : ℝ) ≤ ((d + 1 : ℕ) : ℝ) := by linarith have hd_pos : (0 : ℝ) < ((d + 1 : ℕ) : ℝ) := by linarith -- Step 1: d * m + 1 ≤ (d + 1) * m ≤ (d + 1) ^ (1 + log₂ m) have hbase1 : ((d * m + 1 : ℕ) : ℝ) ≤ ((d + 1 : ℕ) : ℝ) * (m : ℝ) := by have hnat : d * m + 1 ≤ (d + 1) * m := by nlinarith exact_mod_cast hnat have hm_le_d : (m : ℝ) ≤ ((d + 1 : ℕ) : ℝ) ^ (Real.logb 2 (m : ℝ)) := by calc (m : ℝ) = (2 : ℝ) ^ (Real.logb 2 (m : ℝ)) := (Real.rpow_logb (by norm_num) (by norm_num) hm_pos).symm _ ≤ ((d + 1 : ℕ) : ℝ) ^ (Real.logb 2 (m : ℝ)) := Real.rpow_le_rpow (by norm_num) hd2 hlogm_nonneg have hbase2 : ((d * m + 1 : ℕ) : ℝ) ≤ ((d + 1 : ℕ) : ℝ) ^ (1 + Real.logb 2 (m : ℝ)) := by calc ((d * m + 1 : ℕ) : ℝ) ≤ ((d + 1 : ℕ) : ℝ) * (m : ℝ) := hbase1 _ ≤ ((d + 1 : ℕ) : ℝ) * ((d + 1 : ℕ) : ℝ) ^ (Real.logb 2 (m : ℝ)) := mul_le_mul_of_nonneg_left hm_le_d (le_of_lt hd_pos) _ = ((d + 1 : ℕ) : ℝ) ^ (1 : ℝ) * ((d + 1 : ℕ) : ℝ) ^ (Real.logb 2 (m : ℝ)) := by rw [Real.rpow_one] _ = ((d + 1 : ℕ) : ℝ) ^ (1 + Real.logb 2 (m : ℝ)) := (Real.rpow_add hd_pos 1 _).symm -- Step 2: Raise to 2 * m^4 have hstep2 : ((d * m + 1 : ℕ) : ℝ) ^ (2 * m ^ 4) ≤ ((d + 1 : ℕ) : ℝ) ^ ((1 + Real.logb 2 (m : ℝ)) * ((2 * m ^ 4 : ℕ) : ℝ)) := by calc ((d * m + 1 : ℕ) : ℝ) ^ (2 * m ^ 4) ≤ (((d + 1 : ℕ) : ℝ) ^ (1 + Real.logb 2 (m : ℝ))) ^ (2 * m ^ 4) := pow_le_pow_left₀ (by positivity) hbase2 _ _ = (((d + 1 : ℕ) : ℝ) ^ (1 + Real.logb 2 (m : ℝ))) ^ ((2 * m ^ 4 : ℕ) : ℝ) := (Real.rpow_natCast _ _).symm _ = ((d + 1 : ℕ) : ℝ) ^ ((1 + Real.logb 2 (m : ℝ)) * ((2 * m ^ 4 : ℕ) : ℝ)) := (Real.rpow_mul (le_of_lt hd_pos) _ _).symm -- Step 3: Bound exponent (1 + log₂ m) * (2 * m^4) ≤ m^6 ≤ 2 ^ (6 * X + 6) ≤ 2 ^ (C * lam^(3/4)) have hexp1 : (1 + Real.logb 2 (m : ℝ)) * ((2 * m ^ 4 : ℕ) : ℝ) ≤ (m : ℝ) ^ (6 : ℕ) := by have hlogm_le : 1 + Real.logb 2 (m : ℝ) ≤ (m : ℝ) := by linarith [logb_two_le_sub_one hm1] have h2le : (2 : ℝ) ≤ (m : ℝ) := by exact_mod_cast hm2 have hcast : ((2 * m ^ 4 : ℕ) : ℝ) = 2 * (m : ℝ) ^ 4 := by push_cast; ring rw [hcast] have hm4_nonneg : (0 : ℝ) ≤ (m : ℝ) ^ 4 := by positivity calc (1 + Real.logb 2 (m : ℝ)) * (2 * (m : ℝ) ^ 4) ≤ (m : ℝ) * (2 * (m : ℝ) ^ 4) := mul_le_mul_of_nonneg_right hlogm_le (by positivity) _ = 2 * ((m : ℝ) ^ 5) := by ring _ ≤ (m : ℝ) * ((m : ℝ) ^ 5) := mul_le_mul_of_nonneg_right h2le (by positivity) _ = (m : ℝ) ^ (6 : ℕ) := by ring have hexp2 : (m : ℝ) ^ (6 : ℕ) ≤ (2 : ℝ) ^ (6 * X + 6) := by calc (m : ℝ) ^ (6 : ℕ) ≤ ((2 : ℝ) ^ (X + 1)) ^ (6 : ℕ) := pow_le_pow_left₀ (le_of_lt hm_pos) hm_hi 6 _ = ((2 : ℝ) ^ (X + 1)) ^ ((6 : ℕ) : ℝ) := (Real.rpow_natCast _ _).symm _ = (2 : ℝ) ^ ((X + 1) * (6 : ℝ)) := by rw [← Real.rpow_mul (by norm_num)]; norm_cast _ = (2 : ℝ) ^ (6 * X + 6) := by ring_nf have hlam_ge1 : (1 : ℝ) ≤ lam := by have hs2 : (2 : ℝ) ≤ (s : ℝ) := by exact_mod_cast hs have h := Real.logb_le_logb_of_le (b := 2) (by norm_num) (by norm_num) hs2 simpa [lam] using h have hlam34_ge1 : (1 : ℝ) ≤ lam ^ ((3 : ℝ) / 4) := Real.one_le_rpow hlam_ge1 (by norm_num) have hX_split : X = (8 / c) ^ ((3 : ℝ) / 4) * lam ^ ((3 : ℝ) / 4) := by dsimp only [X, xParam, lam] have hmul : 8 * Real.logb 2 (s : ℝ) / c = (8 / c) * Real.logb 2 (s : ℝ) := by ring rw [hmul, Real.mul_rpow (by positivity) (by linarith)] have hexp3 : 6 * X + 6 ≤ (6 * (8 / c) ^ ((3 : ℝ) / 4) + 6) * lam ^ ((3 : ℝ) / 4) := by rw [hX_split] nlinarith have hexp_total : (1 + Real.logb 2 (m : ℝ)) * ((2 * m ^ 4 : ℕ) : ℝ) ≤ (2 : ℝ) ^ ((6 * (8 / c) ^ ((3 : ℝ) / 4) + 6) * lam ^ ((3 : ℝ) / 4)) := hexp1.trans (hexp2.trans (Real.rpow_le_rpow_of_exponent_le (by norm_num) hexp3)) exact hstep2.trans (Real.rpow_le_rpow_of_exponent_le hd1 hexp_total) /-- **Main Asymptotic Parameter Theorem (Section 4 of `main.tex`).** For any `c > 0`, `C₁ > 0`, and `m₀ : ℕ`, there exist constants `C > 0` (explicitly `C = 6 * (8 / c) ^ (3 / 4) + 6`) and `s₀ : ℕ` such that for all `s ≥ s₀` (with `n = s`, `Δ = Nat.clog 2 s`, `m = mParam c s`): 1. `m ≥ m₀` and `m ≥ 2` (condition (a)); 2. `Δ < m ^ 2` (condition (b)); 3. `m ^ 2 ≤ s` and `s + m ^ 2 + 1 + 2 * s ^ 2 * (Δ + 2) ≤ s ^ 3` (condition (c)); 4. `log₂ C₁ + 4 * log₂ m < 5 * log₂ s` (condition (d)); 5. **Strict circuit-size inequality**: `C₁ * m ^ 4 * (s + m ^ 2 + 1 + 2 * s ^ 2 * (Δ + 2)) < m ^ (c * (log₂ m) ^ (1 / 3))`; 6. **Hitting-set cardinality inequality** (for all `d ≥ 1`): `(d * m + 1) ^ (2 * m ^ 4) ≤ (d + 1) ^ (2 ^ (C * (log₂ s) ^ (3 / 4)))`. -/ theorem asymptotic_parameters_exist {c C₁ : ℝ} (hc : 0 < c) (hC₁ : 0 < C₁) (m₀ : ℕ) : ∃ (C : ℝ) (s₀ : ℕ), 0 < C ∧ ∀ s : ℕ, s₀ ≤ s → let m := mParam c s let Δ := deltaParam s m₀ ≤ m ∧ 2 ≤ m ∧ Δ < m ^ 2 ∧ m ^ 2 ≤ s ∧ s + m ^ 2 + 1 + 2 * s ^ 2 * (Δ + 2) ≤ s ^ 3 ∧ Real.logb 2 C₁ + 4 * Real.logb 2 (m : ℝ) < 5 * Real.logb 2 (s : ℝ) ∧ C₁ * (m : ℝ) ^ 4 * ((s : ℝ) + (m : ℝ) ^ 2 + 1 + 2 * (s : ℝ) ^ 2 * ((Δ : ℝ) + 2)) < (m : ℝ) ^ (c * (Real.logb 2 (m : ℝ)) ^ ((1 : ℝ) / 3)) ∧ ∀ d : ℕ, 1 ≤ d → ((d * m + 1 : ℕ) : ℝ) ^ (2 * m ^ 4) ≤ ((d + 1 : ℕ) : ℝ) ^ ((2 : ℝ) ^ (C * (Real.logb 2 (s : ℝ)) ^ ((3 : ℝ) / 4))) := by let A : ℝ := (8 / c) ^ ((3 : ℝ) / 4) have hA_pos : 0 < A := Real.rpow_pos_of_pos (by positivity) _ have hlog2_pos : 0 < Real.log 2 := Real.log_pos (by norm_num) let C : ℝ := 6 * A + 6 have hC_pos : 0 < C := by positivity let U₀ : ℝ := max 4 (max (2 * A + 4) (max (A⁻¹ + 2) (max (2 / (A * Real.log 2) + 2) (max (Real.logb 2 (max 2 (m₀ : ℝ)) + 2) (Real.logb 2 (max 1 C₁) + 8))))) have hU₀_ge4 : 4 ≤ U₀ := le_max_left _ _ have hU₀_pos : 0 < U₀ := by linarith let s₀ : ℕ := Nat.ceil ((2 : ℝ) ^ (U₀ ^ (4 : ℕ))) + 16 refine ⟨C, s₀, hC_pos, ?_⟩ intro s hs have hs16 : 16 ≤ s := by omega have hs2 : 2 ≤ s := by omega have hs_pos : (0 : ℝ) < (s : ℝ) := by exact_mod_cast (by omega : 0 < s) have hs_ge_pow : (2 : ℝ) ^ (U₀ ^ (4 : ℕ)) ≤ (s : ℝ) := by have h1 : (2 : ℝ) ^ (U₀ ^ (4 : ℕ)) ≤ (Nat.ceil ((2 : ℝ) ^ (U₀ ^ (4 : ℕ))) : ℝ) := Nat.le_ceil _ have h2 : (Nat.ceil ((2 : ℝ) ^ (U₀ ^ (4 : ℕ))) : ℝ) ≤ (s : ℝ) := by exact_mod_cast (by omega : Nat.ceil ((2 : ℝ) ^ (U₀ ^ (4 : ℕ))) ≤ s) linarith set lam : ℝ := Real.logb 2 (s : ℝ) have hlam_ge : U₀ ^ (4 : ℕ) ≤ lam := by have h := Real.logb_le_logb_of_le (b := 2) (by norm_num) (Real.rpow_pos_of_pos (by norm_num) _) hs_ge_pow rwa [Real.logb_rpow (by norm_num) (by norm_num)] at h have hlam_ge256 : 256 ≤ lam := by have h4 : (4 : ℝ) ^ (4 : ℕ) ≤ U₀ ^ (4 : ℕ) := pow_le_pow_left₀ (by norm_num) hU₀_ge4 4 norm_num at h4 linarith have hlam_pos : 0 < lam := by linarith -- Define u = lam ^ (1 / 4) so that u ^ 4 = lam and X = A * u ^ 3 set u : ℝ := lam ^ ((1 : ℝ) / 4) have hu_pos : 0 < u := Real.rpow_pos_of_pos hlam_pos _ have hu4 : u ^ (4 : ℕ) = lam := by dsimp only [u] rw [← Real.rpow_natCast, ← Real.rpow_mul (le_of_lt hlam_pos)] norm_num have hu3 : u ^ (3 : ℕ) = lam ^ ((3 : ℝ) / 4) := by dsimp only [u] rw [← Real.rpow_natCast, ← Real.rpow_mul (le_of_lt hlam_pos)] norm_num have hu_ge_U₀ : U₀ ≤ u := by have h := Real.rpow_le_rpow (by positivity) hlam_ge (by norm_num : (0 : ℝ) ≤ (1 : ℝ) / 4) have hpow : (U₀ ^ (4 : ℕ)) ^ ((1 : ℝ) / 4) = U₀ := by rw [← Real.rpow_natCast, ← Real.rpow_mul (le_of_lt hU₀_pos)] norm_num linarith have hu_ge4 : 4 ≤ u := le_trans hU₀_ge4 hu_ge_U₀ have hu_ge_2A4 : 2 * A + 4 ≤ u := le_trans (le_trans (le_max_left _ _) (le_max_right _ _)) hu_ge_U₀ have hu_ge_Ainv : A⁻¹ + 2 ≤ u := le_trans (le_trans (le_max_left _ _) (le_trans (le_max_right _ _) (le_max_right _ _))) hu_ge_U₀ have hu_ge_log2 : 2 / (A * Real.log 2) + 2 ≤ u := le_trans (le_trans (le_max_left _ _) (le_trans (le_max_right _ _) (le_trans (le_max_right _ _) (le_max_right _ _)))) hu_ge_U₀ have hu_ge_m0 : Real.logb 2 (max 2 (m₀ : ℝ)) + 2 ≤ u := le_trans (le_trans (le_max_left _ _) (le_trans (le_max_right _ _) (le_trans (le_max_right _ _) (le_trans (le_max_right _ _) (le_max_right _ _))))) hu_ge_U₀ have hu_ge_C1 : Real.logb 2 (max 1 C₁) + 8 ≤ u := le_trans (le_trans (le_max_right _ _) (le_trans (le_max_right _ _) (le_trans (le_max_right _ _) (le_trans (le_max_right _ _) (le_max_right _ _))))) hu_ge_U₀ -- Relate X = xParam c s to A * u ^ 3 set X : ℝ := xParam c s have hX_eq : X = A * u ^ (3 : ℕ) := by dsimp only [X, xParam, A] have hmul : 8 * lam / c = (8 / c) * lam := by ring rw [hmul, Real.mul_rpow (by positivity) (le_of_lt hlam_pos), ← hu3] have hAu_ge1 : 1 ≤ A * u := by have h1 : A⁻¹ ≤ u := by linarith only [hu_ge_Ainv] have h2 := mul_le_mul_of_nonneg_left h1 (le_of_lt hA_pos) rw [mul_inv_cancel₀ (ne_of_gt hA_pos)] at h2 exact h2 have hX_ge_u2 : u ^ (2 : ℕ) ≤ X := by rw [hX_eq] have : A * u ^ (3 : ℕ) = (A * u) * u ^ (2 : ℕ) := by ring rw [this] nlinarith only [hAu_ge1, sq_nonneg u] have hX_ge1 : 1 ≤ X := by nlinarith only [hX_ge_u2, hu_ge4] -- Bounds on m = mParam c s set m := mParam c s set Δ := deltaParam s obtain ⟨hm2, hm_lo, hm_hi, hlogm_lo, hlogm_hi⟩ := mParam_bounds hX_ge1 have hm_pos : (0 : ℝ) < (m : ℝ) := by exact_mod_cast (by omega : 0 < m) -- (a) m₀ ≤ m have ha : m₀ ≤ m := by have hX_m0 : Real.logb 2 (max 2 (m₀ : ℝ)) ≤ X := by nlinarith only [hu_ge_m0, hu_ge4, hX_ge_u2] have hmax_pos : (0 : ℝ) < max 2 (m₀ : ℝ) := by positivity have hpow : max 2 (m₀ : ℝ) ≤ (2 : ℝ) ^ X := by calc max 2 (m₀ : ℝ) = (2 : ℝ) ^ (Real.logb 2 (max 2 (m₀ : ℝ))) := (Real.rpow_logb (by norm_num) (by norm_num) hmax_pos).symm _ ≤ (2 : ℝ) ^ X := Real.rpow_le_rpow_of_exponent_le (by norm_num) hX_m0 have hm0_le : (m₀ : ℝ) ≤ (m : ℝ) := le_trans (le_max_right _ _) (le_trans hpow hm_lo) exact_mod_cast hm0_le -- (b) Δ < m ^ 2 have hb : Δ < m ^ 2 := by have hΔ_lt : (Δ : ℝ) < lam + 1 := deltaParam_lt_logb_add_one hs2 have hmul_pos : 0 < A * Real.log 2 := mul_pos hA_pos hlog2_pos have h2u : 2 / (A * Real.log 2) ≤ u := by linarith only [hu_ge_log2] have hprod_ge : 2 ≤ A * Real.log 2 * u := by have h := mul_le_mul_of_nonneg_left h2u (le_of_lt hmul_pos) rw [mul_div_cancel₀ _ (ne_of_gt hmul_pos)] at h exact h let y : ℝ := 2 * X * Real.log 2 have hy_ge : 4 * u ^ (2 : ℕ) ≤ y := by dsimp only [y] rw [hX_eq] have : 2 * (A * u ^ (3 : ℕ)) * Real.log 2 = 2 * (A * Real.log 2 * u) * u ^ (2 : ℕ) := by ring rw [this] nlinarith only [hprod_ge, sq_nonneg u] have hy_nonneg : 0 ≤ y := by nlinarith only [hy_ge, sq_nonneg u] have hm2_ge_exp : Real.exp y ≤ (m : ℝ) ^ (2 : ℕ) := by calc Real.exp y = Real.exp (Real.log 2 * (2 * X)) := by congr 1; dsimp only [y]; ring _ = (2 : ℝ) ^ (2 * X) := (Real.rpow_def_of_pos (by norm_num) (2 * X)).symm _ = ((2 : ℝ) ^ X) ^ ((2 : ℕ) : ℝ) := by rw [← Real.rpow_mul (by norm_num)]; congr 1; norm_num; ring _ = ((2 : ℝ) ^ X) ^ (2 : ℕ) := Real.rpow_natCast _ 2 _ ≤ (m : ℝ) ^ (2 : ℕ) := pow_le_pow_left₀ (by positivity) hm_lo 2 have hexp_ge : 1 + y + y ^ 2 / 2 ≤ Real.exp y := quadratic_le_exp hy_nonneg have hy2_ge : 16 * lam ≤ y ^ 2 := by have hsq : (4 * u ^ (2 : ℕ)) ^ 2 ≤ y ^ 2 := pow_le_pow_left₀ (by positivity) hy_ge 2 have hu4' : (4 * u ^ (2 : ℕ)) ^ 2 = 16 * u ^ (4 : ℕ) := by ring rw [hu4', hu4] at hsq exact hsq have hΔ_lt_m2 : (Δ : ℝ) < (m : ℝ) ^ (2 : ℕ) := by linarith only [hΔ_lt, hm2_ge_exp, hexp_ge, hy2_ge, hy_nonneg, hlam_pos] exact_mod_cast hΔ_lt_m2 -- (c1) m ^ 2 ≤ s have hc1 : m ^ 2 ≤ s := by have h2X : 2 * Real.logb 2 (m : ℝ) ≤ lam := by have h1 : 2 * Real.logb 2 (m : ℝ) ≤ 2 * X + 2 := by linarith only [hlogm_hi] have h2 : 2 * A * u ^ (3 : ℕ) + 2 ≤ u ^ (4 : ℕ) := by have h2A : 2 * A ≤ u - 4 := by linarith only [hu_ge_2A4] have hu3_ge : 64 ≤ u ^ (3 : ℕ) := by have : (4 : ℝ) ^ (3 : ℕ) ≤ u ^ (3 : ℕ) := pow_le_pow_left₀ (by norm_num) hu_ge4 3 norm_num at this; exact this have hmul : 2 * A * u ^ (3 : ℕ) ≤ (u - 4) * u ^ (3 : ℕ) := mul_le_mul_of_nonneg_right h2A (by positivity) have hpow_id : (u - 4) * u ^ (3 : ℕ) = u ^ (4 : ℕ) - 4 * u ^ (3 : ℕ) := by ring linarith only [hmul, hpow_id, hu3_ge] rw [hX_eq] at h1 rw [hu4] at h2 linarith only [h1, h2] have hpow : (m : ℝ) ^ (2 : ℕ) ≤ (s : ℝ) := by calc (m : ℝ) ^ (2 : ℕ) = ((2 : ℝ) ^ (Real.logb 2 (m : ℝ))) ^ (2 : ℕ) := by rw [Real.rpow_logb (by norm_num) (by norm_num) hm_pos] _ = ((2 : ℝ) ^ (Real.logb 2 (m : ℝ))) ^ ((2 : ℕ) : ℝ) := (Real.rpow_natCast _ 2).symm _ = (2 : ℝ) ^ (2 * Real.logb 2 (m : ℝ)) := by rw [← Real.rpow_mul (by norm_num)]; congr 1; norm_num; ring _ ≤ (2 : ℝ) ^ lam := Real.rpow_le_rpow_of_exponent_le (by norm_num) h2X _ = (s : ℝ) := Real.rpow_logb (by norm_num) (by norm_num) hs_pos exact_mod_cast hpow -- (c2) s + m ^ 2 + 1 + 2 * s ^ 2 * (Δ + 2) ≤ s ^ 3 have hc2 : s + m ^ 2 + 1 + 2 * s ^ 2 * (Δ + 2) ≤ s ^ 3 := by have hlog2_gt : (1 : ℝ) / 2 < Real.log 2 := by linarith [Real.log_two_gt_d9] have hΔ_lt : (Δ : ℝ) < lam + 1 := deltaParam_lt_logb_add_one hs2 have hs_eq_exp : (s : ℝ) = Real.exp (lam * Real.log 2) := by calc (s : ℝ) = (2 : ℝ) ^ lam := (Real.rpow_logb (by norm_num) (by norm_num) hs_pos).symm _ = Real.exp (Real.log 2 * lam) := Real.rpow_def_of_pos (by norm_num) lam _ = Real.exp (lam * Real.log 2) := by ring_nf have hquad := quadratic_le_exp (mul_nonneg (le_of_lt hlam_pos) (le_of_lt hlog2_pos)) have hsq : (lam / 2) ^ 2 ≤ (lam * Real.log 2) ^ 2 := pow_le_pow_left₀ (by linarith only [hlam_pos]) (by nlinarith only [hlog2_gt, hlam_pos]) 2 have h2Δ5_r : (2 * (Δ : ℝ) + 5) ≤ (s : ℝ) := by rw [hs_eq_exp] nlinarith only [hquad, hsq, hlam_ge256, hΔ_lt, hlog2_gt, hlam_pos] have h2Δ5 : 2 * Δ + 5 ≤ s := by exact_mod_cast h2Δ5_r have h2s1 : 2 * s + 1 ≤ s ^ 2 := by nlinarith only [hs16] have hstep : s + m ^ 2 + 1 + 2 * s ^ 2 * (Δ + 2) ≤ s ^ 2 * (2 * Δ + 5) := by nlinarith only [hc1, h2s1] calc s + m ^ 2 + 1 + 2 * s ^ 2 * (Δ + 2) ≤ s ^ 2 * (2 * Δ + 5) := hstep _ ≤ s ^ 2 * s := Nat.mul_le_mul_left (s ^ 2) h2Δ5 _ = s ^ 3 := by ring -- (d) log₂ C₁ + 4 * log₂ m < 5 * log₂ s have hd : Real.logb 2 C₁ + 4 * Real.logb 2 (m : ℝ) < 5 * lam := by have hC1_le : Real.logb 2 C₁ ≤ Real.logb 2 (max 1 C₁) := Real.logb_le_logb_of_le (b := 2) (by norm_num) hC₁ (le_max_right 1 C₁) have h4X : 4 * X ≤ 2 * lam := by rw [hX_eq, ← hu4] have h4A : 4 * A ≤ 2 * u := by linarith only [hu_ge_2A4] have := mul_le_mul_of_nonneg_right h4A (by positivity : (0 : ℝ) ≤ u ^ (3 : ℕ)) nlinarith only [this] have hu_le_lam : u ≤ lam := by rw [← hu4] have hu2 : 16 ≤ u ^ (2 : ℕ) := by nlinarith only [hu_ge4] nlinarith only [hu_ge4, hu2] linarith only [hC1_le, hlogm_hi, h4X, hu_ge_C1, hu_le_lam, hlam_ge256] -- (e) Strict circuit-size inequality have hcircuit : C₁ * (m : ℝ) ^ 4 * ((s : ℝ) + (m : ℝ) ^ 2 + 1 + 2 * (s : ℝ) ^ 2 * ((Δ : ℝ) + 2)) < (m : ℝ) ^ (c * (Real.logb 2 (m : ℝ)) ^ ((1 : ℝ) / 3)) := by set L : ℝ := C₁ * (m : ℝ) ^ 4 * ((s : ℝ) + (m : ℝ) ^ 2 + 1 + 2 * (s : ℝ) ^ 2 * ((Δ : ℝ) + 2)) have hL_pos : 0 < L := by positivity have hinner_le : (s : ℝ) + (m : ℝ) ^ 2 + 1 + 2 * (s : ℝ) ^ 2 * ((Δ : ℝ) + 2) ≤ (s : ℝ) ^ (3 : ℕ) := by exact_mod_cast hc2 have hL_le : L ≤ C₁ * (m : ℝ) ^ (4 : ℕ) * (s : ℝ) ^ (3 : ℕ) := by dsimp only [L] exact mul_le_mul_of_nonneg_left hinner_le (by positivity) have hlog_L : Real.logb 2 L < 8 * lam := by have h1 : Real.logb 2 L ≤ Real.logb 2 (C₁ * (m : ℝ) ^ (4 : ℕ) * (s : ℝ) ^ (3 : ℕ)) := Real.logb_le_logb_of_le (by norm_num) hL_pos hL_le have h2 : Real.logb 2 (C₁ * (m : ℝ) ^ (4 : ℕ) * (s : ℝ) ^ (3 : ℕ)) = Real.logb 2 C₁ + 4 * Real.logb 2 (m : ℝ) + 3 * lam := by rw [Real.logb_mul (by positivity) (by positivity), Real.logb_mul (by positivity) (by positivity), Real.logb_pow, Real.logb_pow] push_cast rfl linarith have h8_le : 8 * lam ≤ c * (Real.logb 2 (m : ℝ)) ^ ((4 : ℝ) / 3) := eight_log_le_c_log_m_pow hc hs2 hX_ge1 have hlog_lt : Real.logb 2 L < c * (Real.logb 2 (m : ℝ)) ^ ((4 : ℝ) / 3) := lt_of_lt_of_le hlog_L h8_le have hm_gt1 : (1 : ℝ) < (m : ℝ) := by exact_mod_cast (by omega : 1 < m) calc L = (2 : ℝ) ^ (Real.logb 2 L) := (Real.rpow_logb (by norm_num) (by norm_num) hL_pos).symm _ < (2 : ℝ) ^ (c * (Real.logb 2 (m : ℝ)) ^ ((4 : ℝ) / 3)) := Real.rpow_lt_rpow_of_exponent_lt (by norm_num) hlog_lt _ = (m : ℝ) ^ (c * (Real.logb 2 (m : ℝ)) ^ ((1 : ℝ) / 3)) := (rpow_eq_two_rpow_four_thirds hm_gt1).symm -- (f) Hitting-set bound have hhit : ∀ d : ℕ, 1 ≤ d → ((d * m + 1 : ℕ) : ℝ) ^ (2 * m ^ 4) ≤ ((d + 1 : ℕ) : ℝ) ^ ((2 : ℝ) ^ (C * (Real.logb 2 (s : ℝ)) ^ ((3 : ℝ) / 4))) := fun d hd1 => hitting_set_size_bound hc hs2 hd1 hX_ge1 exact ⟨ha, hm2, hb, hc1, hc2, hd, hcircuit, hhit⟩ end PermanentPIT.Asymptotics #print axioms PermanentPIT.Asymptotics.mParam_bounds #print axioms PermanentPIT.Asymptotics.eight_log_le_c_log_m_pow #print axioms PermanentPIT.Asymptotics.hitting_set_size_bound #print axioms PermanentPIT.Asymptotics.asymptotic_parameters_exist