diff --git a/LeanPool/MetricCodes/Binary.lean b/LeanPool/MetricCodes/Binary.lean index 79a3e72ca..4b81ea01d 100644 --- a/LeanPool/MetricCodes/Binary.lean +++ b/LeanPool/MetricCodes/Binary.lean @@ -424,7 +424,7 @@ theorem tendsto_logb_supportHarmonicDimension · have hb : 0 < b := lt_of_le_of_ne h.support_nonneg (Ne.symm hbzero) have hba : b < a := by - nlinarith [h.support_lt_half, h.weight_pos] + linarith [h.support_lt_half, h.weight_pos] have hhalf : ∀ᶠ n : ℕ in atTop, 2 * supportDegree b n ≤ shellWeight a n := @@ -459,7 +459,7 @@ theorem tendsto_logb_complementHarmonicDimension · have hg : 0 < g := lt_of_le_of_ne h.complement_nonneg (Ne.symm hgzero) have hga : g < 1 - a := by - nlinarith [h.complement_lt_half, h.weight_complement_pos] + linarith [h.complement_lt_half, h.weight_complement_pos] have hhalf : ∀ᶠ n : ℕ in atTop, 2 * complementDegree g n ≤ n - shellWeight a n := @@ -1241,7 +1241,7 @@ theorem splitTensor_pairing {n w p q : ℕ} rw [Finset.mul_sum] apply Finset.sum_congr rfl intro B _ - ring + ac_rfl theorem splitTensor_orthonormal {n w p q r s : ℕ} (x : JohnsonSphere n w) @@ -1405,7 +1405,7 @@ theorem dot_fintype_weighted_sum rw [Finset.mul_sum] apply Finset.sum_congr rfl intro S _ - ring + ac_rfl theorem coupledTensor_dot {n w p q t : ℕ} (x : JohnsonSphere n w) @@ -2308,9 +2308,7 @@ def johnsonUpperScale (n j : ℕ) : ℝ := theorem johnsonMiddleScale_pos {n j : ℕ} (hj : 0 < j) (hhalf : 2 * j < n) : 0 < johnsonMiddleScale n j := by - have hj' : (0 : ℝ) < (j : ℝ) := by exact_mod_cast hj have hn : 0 < n := by omega - have hn' : (0 : ℝ) < (n : ℝ) := by exact_mod_cast hn have hgap := johnsonHarmonicGap_pos hhalf have hlast : 0 < (n : ℝ) - (j : ℝ) + 1 := by have hcast : (j : ℝ) < (n : ℝ) := by @@ -3147,7 +3145,7 @@ theorem johnsonMiddleChannel_isometry {n j : ℕ} Finset.mul_sum] apply Finset.sum_congr rfl intro a _ - ring + ac_rfl _ = ((Real.sqrt (johnsonMiddleScale n j))⁻¹ * (Real.sqrt (johnsonMiddleScale n j))⁻¹) * (johnsonMiddleScale n j * MetricCodes.Boolean.dot f g) := by @@ -3156,7 +3154,7 @@ theorem johnsonMiddleChannel_isometry {n j : ℕ} (Real.sqrt (johnsonMiddleScale n j))⁻¹ * johnsonMiddleScale n j) * MetricCodes.Boolean.dot f g := by - ring + ac_rfl _ = MetricCodes.Boolean.dot f g := by rw [hscalar, one_mul] @@ -3516,7 +3514,7 @@ theorem johnsonUpperChannel_isometry {n j : ℕ} Finset.mul_sum] apply Finset.sum_congr rfl intro a _ - ring + ac_rfl _ = ((Real.sqrt (johnsonUpperScale n j))⁻¹ * (Real.sqrt (johnsonUpperScale n j))⁻¹) * (johnsonUpperScale n j * MetricCodes.Boolean.dot f g) := by @@ -3525,7 +3523,7 @@ theorem johnsonUpperChannel_isometry {n j : ℕ} (Real.sqrt (johnsonUpperScale n j))⁻¹ * johnsonUpperScale n j) * MetricCodes.Boolean.dot f g := by - ring + ac_rfl _ = MetricCodes.Boolean.dot f g := by rw [hscalar, one_mul] @@ -3783,7 +3781,7 @@ theorem johnsonCoordinateDot_smul {n : ℕ} Finset.mul_sum] apply Finset.sum_congr rfl intro a _ - ring + ac_rfl theorem johnsonLowerChannel_orthogonal_middleChannel {n j : ℕ} (f g : MetricCodes.Boolean.Function n) @@ -4345,7 +4343,7 @@ theorem johnsonDot_axisRaise {n w : ℕ} intro a _ apply Finset.sum_congr rfl intro S _ - ring + ac_rfl theorem johnsonDot_axisLower {n w : ℕ} (x : JohnsonSphere n w) @@ -4362,7 +4360,7 @@ theorem johnsonDot_axisLower {n w : ℕ} intro a _ apply Finset.sum_congr rfl intro S _ - ring + ac_rfl theorem johnsonDot_axisMembership {n w : ℕ} (x : JohnsonSphere n w) @@ -4380,7 +4378,7 @@ theorem johnsonDot_axisMembership {n w : ℕ} intro a _ apply Finset.sum_congr rfl intro S _ - ring + ac_rfl theorem johnsonLowerChannel_axis_inner {n w j : ℕ} (x : JohnsonSphere n w) @@ -4398,7 +4396,7 @@ theorem johnsonLowerChannel_axis_inner {n w j : ℕ} rw [johnsonDot_axisRaise, Finset.mul_sum] apply Finset.sum_congr rfl intro a _ - ring + ac_rfl theorem johnsonUpperRaw_dot_harmonic_right {n j k : ℕ} (f g : MetricCodes.Boolean.Function n) @@ -4434,7 +4432,7 @@ theorem johnsonUpperChannel_axis_inner {n w j k : ℕ} rw [johnsonDot_axisLower, Finset.mul_sum] apply Finset.sum_congr rfl intro a _ - ring + ac_rfl theorem johnsonMiddleRaw_dot_harmonic_right {n j k : ℕ} (f g : MetricCodes.Boolean.Function n) @@ -4592,7 +4590,7 @@ theorem sum_geometricAxis_on_subset {n w : ℕ} _ = _ := by rw [sum_coordinateIndicator_on_subset x S, MetricCodes.Boolean.sum_mem_indicator] - ring + ac_rfl theorem johnsonAxisMembership_apply {n w : ℕ} (x : JohnsonSphere n w) @@ -4680,7 +4678,7 @@ theorem johnsonDot_fintype_weighted_sum_right intro i _ apply Finset.sum_congr rfl intro S _ - ring + ac_rfl theorem johnsonAxisMembership_coupledTensor {n w p q : ℕ} (x : JohnsonSphere n w) @@ -4758,7 +4756,7 @@ theorem johnsonAxisMembership_coupledHarmonic_dot simp only [Finset.mul_sum] apply Finset.sum_congr rfl intro r _ - ring + ac_rfl theorem coordinateSplitEquiv_erase_support {n w : ℕ} (x : JohnsonSphere n w) (i : SupportCoordinates x) @@ -4989,7 +4987,7 @@ theorem raise_splitTensor_eq {n w p q r s : ℕ} complementRaisedFunction_raise x hq hcomplement] simp only [Pi.add_apply, Pi.smul_apply, smul_eq_mul, splitTensor] - ring + ac_rfl theorem johnsonHarmonic_dot_splitTensor_succ_mul {n w p q t r : ℕ} @@ -5117,7 +5115,7 @@ theorem johnsonHarmonic_dot_coupledHarmonic clebschNormSq w (n - w) p q t = Real.sqrt (clebschNormSq w (n - w) p q t) := by field_simp [hsqrt] - nlinarith [hsq] + linarith [hsq] calc (Real.sqrt (clebschNormSq w (n - w) p q t))⁻¹ * (∑ r : Fin (t + 1), @@ -6011,7 +6009,7 @@ theorem clebschFirstMoment_eq (((w : ℝ) - 2 * (p : ℝ)) + ((N : ℝ) - 2 * (q : ℝ)) - 2 * (t : ℝ) + 2) * clebschFirstMoment w N p q t := by - ring + ac_rfl _ = (t : ℝ) * ((N : ℝ) - 2 * (q : ℝ) - (t : ℝ) + 1) * clebschNormSq w N p q t := @@ -6490,8 +6488,6 @@ theorem clebschCenteredExpectation_eq_johnsonDiagonal have hn : 0 < n := by omega have hnreal : 0 < (n : ℝ) := by exact_mod_cast hn have hwreal : 0 < (w : ℝ) := by exact_mod_cast h.weight_pos - have hNreal : 0 < ((n - w : ℕ) : ℝ) := by - exact_mod_cast (Nat.sub_pos_of_lt h.weight_lt) have hjbound := h.window_degree_le_weight source have hjreal : 2 * ((p + q + source.val : ℕ) : ℝ) < (n : ℝ) := by @@ -6502,10 +6498,6 @@ theorem clebschCenteredExpectation_eq_johnsonDiagonal exact_mod_cast hstrict push_cast at hs linarith - have hjgap : - 0 < (n : ℝ) - - 2 * ((p + q + source.val : ℕ) : ℝ) := by - linarith have hJ : 0 < MetricCodes.johnsonJ n (p + q + source.val) := by unfold MetricCodes.johnsonJ @@ -6553,7 +6545,7 @@ theorem clebschCenteredExpectation_eq_johnsonDiagonal have hden'' : (n : ℝ) - 2 * (p : ℝ) - 2 * (q : ℝ) - 2 * (source.val : ℝ) + 2 ≠ 0 := by - nlinarith [hden'] + linarith [hden'] have hJ' : (n : ℝ) / 2 - ((p : ℝ) + (q : ℝ) + (source.val : ℝ)) ≠ 0 := by @@ -6772,7 +6764,6 @@ theorem johnsonMiddleSignedScalar_eq_sqrt_hattedDiagonal have hjw : j ≤ w := h.window_degree_le_weight source have hjhalf : 2 * j < n := by omega have hn : 0 < n := by omega - have hnreal : 0 < (n : ℝ) := by exact_mod_cast hn have hwreal : 0 < (w : ℝ) := by exact_mod_cast h.weight_pos have hcomp : 0 < ((n - w : ℕ) : ℝ) := by exact_mod_cast (Nat.sub_pos_of_lt h.weight_lt) @@ -6786,13 +6777,7 @@ theorem johnsonMiddleSignedScalar_eq_sqrt_hattedDiagonal exact_mod_cast hstrict push_cast at hs linarith - have hF : 0 < F := by - dsimp [F] - positivity have hmiddle := johnsonMiddleScale_pos hsource hjhalf - have haxis : 0 < (n : ℝ) / - ((w : ℝ) * ((n - w : ℕ) : ℝ)) := by - positivity have hS : 0 < S := by dsimp [S] positivity @@ -6887,7 +6872,7 @@ theorem booleanHarmonicDimension_mul_degreeComplement rw [Nat.cast_sub hk] at hchoose rw [MetricCodes.booleanHarmonicDimension_succ, Nat.cast_sub hmono] push_cast at hchoose ⊢ - nlinarith [hchoose] + linarith [hchoose] theorem booleanHarmonicDimension_succ_div {n j : ℕ} (hhalf : 2 * (j + 1) ≤ n) : @@ -7139,7 +7124,7 @@ theorem clebschSignedAdjacentCross_sum_comm rw [← clebschSignedAdjacentCross_sum hsupport hcomplement] apply Finset.sum_congr rfl intro r _ - ring + ac_rfl theorem johnsonAxisLower_coupledHarmonic_dot_closed {n w p q t : ℕ} @@ -7317,7 +7302,7 @@ theorem johnsonMiddleChannel_coupled_axis_inner_of_split_proportional htsupport htcomplement a)] rw [johnsonAxisMembership_coupledHarmonic_dot_of_split_proportional x hp hq htsupport htcomplement a f hpair] - ring + ac_rfl theorem johnsonMiddleChannel_coupled_axis_inner_closed {n w p q t : ℕ} @@ -7937,7 +7922,6 @@ theorem johnsonAdjacentRawScalar_sq have hn : 0 < n := by omega have haxis : 0 ≤ (n : ℝ) / ((w : ℝ) * ((n - w : ℕ) : ℝ)) := by - have hw' : 0 < (w : ℝ) := by exact_mod_cast hw have hN : 0 < ((n - w : ℕ) : ℝ) := by exact_mod_cast Nat.sub_pos_of_lt hwn positivity @@ -7984,8 +7968,6 @@ theorem johnsonAdjacentRawScalar_pos (hcomplement : 2 * q + (t + 1) ≤ n - w) : 0 < johnsonAdjacentRawScalar n w p q t := by have hn : 0 < n := by omega - have hnreal : 0 < (n : ℝ) := by exact_mod_cast hn - have hwreal : 0 < (w : ℝ) := by exact_mod_cast hw have hcomp : 0 < ((n - w : ℕ) : ℝ) := by exact_mod_cast Nat.sub_pos_of_lt hwn have hcoefficient : @@ -8204,8 +8186,6 @@ theorem johnsonLowerOffDiagonalScalar_eq_sqrt_source 2 * q + (target.val + 1) ≤ n - w := by omega have hraw := johnsonAdjacentRawScalar_pos h.weight_pos h.weight_lt hsupport' hcomplement' - have hdegree : 0 < ((p + q + (target.val + 1) : ℕ) : ℝ) := by - positivity have hleft : 0 < johnsonLowerOffDiagonalScalar n w p q target.val := by unfold johnsonLowerOffDiagonalScalar diff --git a/LeanPool/MetricCodes/Branching.lean b/LeanPool/MetricCodes/Branching.lean index 91e0d4e9c..496f177e7 100644 --- a/LeanPool/MetricCodes/Branching.lean +++ b/LeanPool/MetricCodes/Branching.lean @@ -296,7 +296,7 @@ theorem polarization_chain_commutator intro a _ rw [SpherePacking.mvPolynomial_pderiv_commute (variableIndex j a) (variableIndex k b) p] - ring + ac_rfl have hleft : polarization r n i j (polarization r n j k p) = polarization r n i k p + @@ -1005,7 +1005,7 @@ theorem actual_weyl_detailed_balance {r n : ℕ} minusProbability n (raiseWeight lam ℓ) mu ℓ := by rw [plusProbability_eq_weylEdgeRatio_mul_minus ℓ h hraise, weylDimension_raiseWeight ℓ h] - ring + ac_rfl end @@ -1832,7 +1832,7 @@ theorem tendsto_plusProbability_of_ratios {r : ℕ} rw [mul_div_mul_comm, ← Finset.prod_div_distrib] congr 2 funext j - ring + ac_rfl · unfold lagrangeWeight lagrangeNumerator lagrangeDenominator rw [Finset.prod_div_distrib] @@ -2114,8 +2114,8 @@ theorem reachable_zero {r m : ℕ} (v : Vertex r m) : exact hreach.trans hedge theorem grid_connected (r m : ℕ) : (grid r m).Connected := by - apply (grid r m).connected_iff_exists_forall_reachable.mpr - exact ⟨(fun _ => 0), reachable_zero⟩ + exact (SimpleGraph.connected_iff_exists_forall_reachable (grid r m)).mpr + (Exists.intro (fun _ ↦ 0) reachable_zero) private theorem forwardMatrix_nextVertex_pos_metriccodes2_dbb1ceac {r m : ℕ} (edge : Vertex r m → Fin (r + 1) → ℝ) @@ -2901,7 +2901,7 @@ theorem eventually_const_mul_lt_rpow_of_logRate (Real.exp_log hpositive).symm _ < Real.exp (Real.log 2 * (R * (n : ℝ))) := by apply Real.exp_lt_exp.mpr - nlinarith + linarith _ = (2 : ℝ) ^ (R * (n : ℝ)) := (Real.rpow_def_of_pos (by norm_num) _).symm @@ -2982,7 +2982,7 @@ theorem fixedLevelHierarchyCodeBound_levelZero refine (hn C).trans ?_ apply Real.strictMono_rpow_of_base_gt_one (by norm_num : (1 : ℝ) < 2) have hnreal : 0 < (n : ℝ) := by exact_mod_cast hnpos - nlinarith [mul_pos (sub_pos.mpr hR) hnreal] + linarith [mul_pos (sub_pos.mpr hR) hnreal] theorem fixedLevelHierarchyCodeBound_of_positiveTerminal (hpositive : ∀ {r : ℕ} {s R : ℝ}, 0 < s → s < 1 → @@ -3008,7 +3008,7 @@ theorem fixedLevelHierarchyCodeBound_of_positiveTerminal exists_sameLevel_opening_strict_refinement (Nat.succ_pos r) hinterlacing hzero exact hpositive hs hs' A b hA hApos - (by nlinarith) (by linarith) + (by linarith) (by linarith) theorem fixedLevelHierarchyCodeBound_of_actualRectangularGraphs (hboxes : ∀ {r : ℕ} {s R : ℝ}, 0 < s → s < 1 → @@ -3189,6 +3189,22 @@ def liftChannel {I : Type*} [Fintype I] [DecidableEq I] ((coordinateInclusion (n := n) lam target).toLinearMap.comp T.toLinearMap).comp (vertexInclusion (YoungVertex (n := n) lam) source).adjoint +private theorem adjoint_comp_composed_maps + {E F F' G G' H : Type*} + [NormedAddCommGroup E] [InnerProductSpace ℝ E] [FiniteDimensional ℝ E] + [NormedAddCommGroup F] [InnerProductSpace ℝ F] [FiniteDimensional ℝ F] + [AddCommMonoid F'] [Module ℝ F'] + [NormedAddCommGroup G] [InnerProductSpace ℝ G] [FiniteDimensional ℝ G] + [NormedAddCommGroup G'] [InnerProductSpace ℝ G'] [FiniteDimensional ℝ G'] + [NormedAddCommGroup H] [InnerProductSpace ℝ H] [FiniteDimensional ℝ H] + (C : F →ₗ[ℝ] E) (T : G →ₗ[ℝ] F) (V : G →ₗ[ℝ] H) + (C' : F' →ₗ[ℝ] E) (T' : G' →ₗ[ℝ] F') (V' : G' →ₗ[ℝ] H) : + ((C.comp T).comp V.adjoint).adjoint.comp + ((C'.comp T').comp V'.adjoint) = + V.comp ((T.adjoint.comp ((C.adjoint.comp C').comp T')).comp V'.adjoint) := by + rw [LinearMap.adjoint_comp, LinearMap.adjoint_comp, LinearMap.adjoint_adjoint] + simp only [LinearMap.comp_assoc] + theorem liftChannel_adjoint_comp_self {I : Type*} [Fintype I] [DecidableEq I] {r n : ℕ} (lam : I → Fin (r + 1) → ℕ) (target source : I) @@ -3197,36 +3213,11 @@ theorem liftChannel_adjoint_comp_self (liftChannel lam target source T).adjoint.comp (liftChannel lam target source T) = vertexProjection (YoungVertex (n := n) lam) source := by - apply LinearMap.ext - intro v - apply ext_inner_right ℝ - intro w - change - ⟪(liftChannel lam target source T).adjoint - (liftChannel lam target source T v), w⟫_ℝ = - ⟪vertexInclusion (YoungVertex (n := n) lam) source - ((vertexInclusion (YoungVertex (n := n) lam) source).adjoint v), - w⟫_ℝ - rw [LinearMap.adjoint_inner_left] - calc - ⟪liftChannel lam target source T v, - liftChannel lam target source T w⟫_ℝ = - ⟪(vertexInclusion (YoungVertex (n := n) lam) source).adjoint v, - (vertexInclusion (YoungVertex (n := n) lam) source).adjoint w⟫_ℝ := by - change - ⟪coordinateInclusion (n := n) lam target - (T ((vertexInclusion (YoungVertex (n := n) lam) source).adjoint v)), - coordinateInclusion (n := n) lam target - (T ((vertexInclusion (YoungVertex (n := n) lam) source).adjoint w))⟫_ℝ = _ - rw [(coordinateInclusion (n := n) lam target).inner_map_map, - T.inner_map_map] - rfl - _ = ⟪vertexInclusion (YoungVertex (n := n) lam) source - ((vertexInclusion (YoungVertex (n := n) lam) source).adjoint v), - w⟫_ℝ := - LinearMap.adjoint_inner_right - (vertexInclusion (YoungVertex (n := n) lam) source).toLinearMap - ((vertexInclusion (YoungVertex (n := n) lam) source).adjoint v) w + unfold liftChannel + rw [adjoint_comp_composed_maps, + (coordinateInclusion (n := n) lam target).adjoint_comp_self', + LinearMap.id_comp, T.adjoint_comp_self', LinearMap.id_comp] + rfl theorem liftChannel_orthogonal_of_target_ne {I : Type*} [Fintype I] [DecidableEq I] @@ -3239,40 +3230,10 @@ theorem liftChannel_orthogonal_of_target_ne (hne : target ≠ target') : (liftChannel lam target source T).adjoint.comp (liftChannel lam target' source' T') = 0 := by - apply LinearMap.ext - intro v - apply ext_inner_right ℝ - intro w - rw [LinearMap.zero_apply, inner_zero_left] - change - ⟪(liftChannel lam target source T).adjoint - (liftChannel lam target' source' T' v), w⟫_ℝ = 0 - rw [LinearMap.adjoint_inner_left] - change - ⟪coordinateInclusion (n := n) lam target' - (T' ((vertexInclusion (YoungVertex (n := n) lam) source').adjoint v)), - coordinateInclusion (n := n) lam target - (T ((vertexInclusion (YoungVertex (n := n) lam) source).adjoint w))⟫_ℝ = 0 - let z := T' ((vertexInclusion (YoungVertex (n := n) lam) source').adjoint v) - let q := T ((vertexInclusion (YoungVertex (n := n) lam) source).adjoint w) - have hzero := congrArg - (fun A : (SpherePacking.Euclidean n ⊗[ℝ] - YoungVertex (n := n) lam target') →ₗ[ℝ] - (SpherePacking.Euclidean n ⊗[ℝ] - YoungVertex (n := n) lam target) => A z) - (coordinateInclusion_orthogonal lam hne) - change - (coordinateInclusion (n := n) lam target).adjoint - (coordinateInclusion (n := n) lam target' z) = 0 at hzero - calc - ⟪coordinateInclusion (n := n) lam target' z, - coordinateInclusion (n := n) lam target q⟫_ℝ = - ⟪(coordinateInclusion (n := n) lam target).adjoint - (coordinateInclusion (n := n) lam target' z), q⟫_ℝ := - (LinearMap.adjoint_inner_left - (coordinateInclusion (n := n) lam target).toLinearMap q - (coordinateInclusion (n := n) lam target' z)).symm - _ = 0 := by simp only [hzero, inner_zero_left] + unfold liftChannel + rw [adjoint_comp_composed_maps, coordinateInclusion_orthogonal lam hne, + LinearMap.zero_comp, LinearMap.comp_zero, LinearMap.zero_comp, + LinearMap.comp_zero] theorem liftChannel_orthogonal_of_clebsch {I : Type*} [Fintype I] [DecidableEq I] @@ -3285,34 +3246,10 @@ theorem liftChannel_orthogonal_of_clebsch (horthogonal : T.adjoint.comp T'.toLinearMap = 0) : (liftChannel lam target source T).adjoint.comp (liftChannel lam target source' T') = 0 := by - apply LinearMap.ext - intro v - apply ext_inner_right ℝ - intro w - rw [LinearMap.zero_apply, inner_zero_left] - change - ⟪(liftChannel lam target source T).adjoint - (liftChannel lam target source' T' v), w⟫_ℝ = 0 - rw [LinearMap.adjoint_inner_left] - change - ⟪coordinateInclusion (n := n) lam target - (T' ((vertexInclusion (YoungVertex (n := n) lam) source').adjoint v)), - coordinateInclusion (n := n) lam target - (T ((vertexInclusion (YoungVertex (n := n) lam) source).adjoint w))⟫_ℝ = 0 - rw [(coordinateInclusion (n := n) lam target).inner_map_map] - let z := (vertexInclusion (YoungVertex (n := n) lam) source').adjoint v - let q := (vertexInclusion (YoungVertex (n := n) lam) source).adjoint w - have hzero := congrArg - (fun A : YoungVertex (n := n) lam source' →ₗ[ℝ] - YoungVertex (n := n) lam source => A z) - horthogonal - change T.adjoint (T' z) = 0 at hzero - calc - ⟪T' z, T q⟫_ℝ = ⟪T.adjoint (T' z), q⟫_ℝ := - (LinearMap.adjoint_inner_left T.toLinearMap q (T' z)).symm - _ = 0 := by - rw [hzero] - exact inner_zero_left q + unfold liftChannel + rw [adjoint_comp_composed_maps, + (coordinateInclusion (n := n) lam target).adjoint_comp_self', + LinearMap.id_comp, horthogonal, LinearMap.zero_comp, LinearMap.comp_zero] theorem liftChannel_adjoint_axis_self {I : Type*} [Fintype I] [DecidableEq I] @@ -4372,8 +4309,6 @@ theorem gramPivot_pair_eq_of_variable_eq {r n : ℕ} a b (gramPivot hn z) (gramPivot hn w)).mp h have hrow := congrArg Fin.val hindex.1 have hcolumn := congrArg Fin.val hindex.2 - have hz := z.property - have hw := w.property apply Subtype.ext apply Prod.ext · apply Fin.ext @@ -4671,7 +4606,7 @@ theorem gramVariableWeight_nonneg {r n : ℕ} push_cast omega unfold gramVariableWeight - nlinarith [mul_nonneg (sub_nonneg.mpr hupp) + linarith [mul_nonneg (sub_nonneg.mpr hupp) (show 0 ≤ ((n + 2 * r : ℕ) : ℤ) + ((k.val : ℤ) - 2 * (i.val : ℤ)) by linarith)] @@ -5114,10 +5049,8 @@ theorem representationDegree_add_sum_sum_lt representationDegree m b (g a a') < d) : representationDegree m b (r + ∑ a ∈ s, ∑ a' ∈ t, g a a') < d := by - apply lt_of_le_of_lt - (representationDegree_add_le m b r (∑ a ∈ s, ∑ a' ∈ t, g a a')) - exact (max_lt_iff).mpr - ⟨hr, representationDegree_sum_sum_lt m b s t g d hd hterm⟩ + exact lt_of_le_of_lt (representationDegree_add_le m b r (∑ a ∈ s, ∑ a' ∈ t, g a a')) + (max_lt_iff.mpr ⟨hr, representationDegree_sum_sum_lt m b s t g d hd hterm⟩) theorem representationDegree_single_lt {σ K ι : Type*} [Field K] @@ -5526,7 +5459,7 @@ private theorem buchberger_correction_pair_lt MvPolynomial.C cij * (Pij * ((m.leadingTerm (b j) - b j) * b i)) := by simp only [Algebra.smul_def, algebraMap_eq] - ring + ac_rfl rw [hrewrite, m.degree_mul (MvPolynomial.C_ne_zero.mpr hc0) hterm, m.degree_C, zero_add] @@ -5603,7 +5536,7 @@ private theorem buchberger_correction_pair_lt MvPolynomial.C cij * (Pij * ((b i - m.leadingTerm (b i)) * b j)) := by simp only [Algebra.smul_def, algebraMap_eq] - ring + ac_rfl rw [hrewrite, m.degree_mul (MvPolynomial.C_ne_zero.mpr hc0) hterm, m.degree_C, zero_add] @@ -6330,7 +6263,7 @@ theorem rowEuler_axialCoordinate_lowerPolarizationPath · subst a by_cases hstart : row = polarizationPathStart row S · rw [← hstart] - simp only [ite_true, raiseWeight, Function.update_self, + simp only [ite_true, raiseWeight.eq_1, Function.update_self, Nat.cast_add, Nat.cast_one, MvPolynomial.smul_eq_C_mul, map_add, map_one] ring @@ -6346,7 +6279,7 @@ theorem rowEuler_axialCoordinate_lowerPolarizationPath ring · simp only [hastart, ↓reduceIte, zero_mul, MvPolynomial.smul_eq_C_mul, map_natCast, harow, add_zero, sub_zero, zero_add, raiseWeight, ne_eq, not_false_eq_true, Function.update_of_ne] - ring + ac_rfl theorem arbitraryRowAxialRaise_rowEuler {r n : ℕ} (lam : Fin (r + 1) → ℕ) @@ -6902,7 +6835,7 @@ theorem simpleRoot_coordinate_both a b j hab hbj q A B hq hqa hqb] simp only [polarization_apply, MvPolynomial.smul_eq_C_mul, MvPolynomial.C_add, MvPolynomial.C_sub, MvPolynomial.C_1] - ring + ac_rfl end ArbitraryRowMickelssonSimpleRoot diff --git a/LeanPool/MetricCodes/Conclusion.lean b/LeanPool/MetricCodes/Conclusion.lean index 709b90209..7645fe129 100644 --- a/LeanPool/MetricCodes/Conclusion.lean +++ b/LeanPool/MetricCodes/Conclusion.lean @@ -26,6 +26,23 @@ namespace Spherical section +open scoped BigOperators + +private theorem linearMap_comp_sum_comp + {ι E F G : Type*} [Fintype ι] + [AddCommMonoid E] [Module ℝ E] + [AddCommMonoid F] [Module ℝ F] + [AddCommMonoid G] [Module ℝ G] + (C : F →ₗ[ℝ] E) (T : ι → F →ₗ[ℝ] F) (J : G →ₗ[ℝ] F) : + C.comp ((∑ i, T i).comp J) = ∑ i, C.comp ((T i).comp J) := by + apply LinearMap.ext + intro x + simp only [LinearMap.comp_apply, LinearMap.sum_apply, map_sum] + +end + +section + open scoped BigOperators InnerProductSpace @@ -425,10 +442,10 @@ theorem gtAxisCompressedCharacteristicMinor_eval_neg_wallShift_eq_zero_of_last_e (p q : HarmonicYoungSpace (n := n) mu) : (gtAxisCompressedCharacteristicMinor lam mu h hgram p q).eval (-(wallShift (n + 1) (r + 1))) = 0 := by - apply gtAxisCompressedCharacteristicMinor_eval_neg_wallShift_eq_zero - lam mu h hgram hfinite hlast p q - exact gtAxisCompressedSignedProjectorCoefficient_last_false_eq_zero - hfinite.1 lam mu h hgram h.antitone_ambient hlast hfinite p q + exact gtAxisCompressedCharacteristicMinor_eval_neg_wallShift_eq_zero lam mu h hgram hfinite hlast + p q + (gtAxisCompressedSignedProjectorCoefficient_last_false_eq_zero hfinite.left lam mu h hgram + (Interlaces.antitone_ambient h) hlast hfinite p q) end AllRankGTAbsentWallCharacteristicFactor @@ -978,7 +995,6 @@ theorem gtStabilizerArrowheadNode_injective_of_interlacing unfold stabilizerShift wallShift have hi : i.val ≤ r := by have := i.isLt; omega have hireal : (i.val : ℝ) ≤ r := by exact_mod_cast hi - have hmu : (0 : ℝ) ≤ mu i := Nat.cast_nonneg _ push_cast linarith · have hanti : Antitone mu := by @@ -2091,7 +2107,7 @@ theorem isometric_scaled_sector_adjoint_compression (T (I (C p))), hnode p, real_inner_smul_right] rw [map_smul, real_inner_smul_left, real_inner_smul_right, hpair, ← hinner] - ring + ac_rfl theorem normalizedGTTransverseNegativeSector_relativeCasimir_adjoint_compression {r n : ℕ} (lam : Fin (r + 2) → ℕ) @@ -2508,28 +2524,15 @@ theorem appendedPaddedPieriLower_adjoint_paddedPhysicalStabilizerTensor_eq_zero let C := (normalizedPaddedPieriLower (n := n + 1) (appendZeroWeight lam) hdominant (Fin.last (r + 2)) hsource).toLinearMap let A := paddedPhysicalStabilizerTensor lam mu B - apply LinearMap.ext - intro p - change C.adjoint (A p) = 0 - apply ext_inner_left ℝ - intro q - rw [inner_zero_right] - have hsum := canonicalFullBranch_sum_projection source hn hsource q - rw [← hsum, sum_inner] - apply Finset.sum_eq_zero - intro nu _ - let F := (canonicalFullBranchFibre source hn nu).toLinearMap - obtain ⟨z, hz⟩ := Submodule.starProjection_apply_mem - (LinearMap.range F) q - change F z = (LinearMap.range F).starProjection q at hz - rw [← hz] - calc - ⟪F z, C.adjoint (A p)⟫_ℝ = ⟪C (F z), A p⟫_ℝ := - LinearMap.adjoint_inner_right C (F z) (A p) - _ = ⟪A p, C (F z)⟫_ℝ := real_inner_comm (A p) (C (F z)) - _ = 0 := - appendedFullBranchPieriLower_paddedPhysicalStabilizerTensor_inner_eq_zero - lam mu hmu B hB hdominant hsource hn nu p z + apply adjoint_composition_eq_zero_of_spanning_ranges + (fun nu : FullBranchWeight source => + HarmonicYoungSpace (n := n) (fullBranchSignature nu)) + (fun nu => (canonicalFullBranchFibre source hn nu).toLinearMap) + (canonicalFullBranch_iSup_range_eq_top_unconditional source hn hsource) C A + intro nu x p + exact (real_inner_comm _ _).trans + (appendedFullBranchPieriLower_paddedPhysicalStabilizerTensor_inner_eq_zero + lam mu hmu B hB hdominant hsource hn nu p x) theorem paddedOrthogonalTensorPieriChannel_appended_stabilizerIntertwiner_orthogonal {r n : ℕ} (lam : Fin (r + 2) → ℕ) @@ -3234,10 +3237,7 @@ theorem transverseTensorEmbeddingOfStabilizerIsometry_mixedRotation (transverseTensorEmbeddingOfStabilizerIsometry lam nu F).toLinearMap) = 0 rw [transverseTensorEmbeddingOfStabilizerIsometry_rotationTerm, gtTransverseEuclideanIsometry_cross_rotation_compression] - apply TensorProduct.ext - ext v p - simp only [TensorProduct.map_zero_left, LinearMap.compr₂ₛₗ_apply, TensorProduct.mk_apply, - LinearMap.zero_apply] + exact TensorProduct.map_zero_left _ have hcrossSwap (a : Fin n) : I.adjoint.comp ((TensorProduct.map @@ -3251,10 +3251,7 @@ theorem transverseTensorEmbeddingOfStabilizerIsometry_mixedRotation (transverseTensorEmbeddingOfStabilizerIsometry lam nu F).toLinearMap) = 0 rw [transverseTensorEmbeddingOfStabilizerIsometry_rotationTerm, gtTransverseEuclideanIsometry_cross_rotation_compression_swap] - apply TensorProduct.ext - ext v p - simp only [TensorProduct.map_zero_left, LinearMap.compr₂ₛₗ_apply, TensorProduct.mk_apply, - LinearMap.zero_apply] + exact TensorProduct.map_zero_left _ have hlast : I.adjoint.comp ((TensorProduct.map @@ -3278,20 +3275,11 @@ theorem transverseTensorEmbeddingOfStabilizerIsometry_mixedRotation change I.adjoint.comp ((∑ a : Fin (n + 1), ∑ b : Fin (n + 1), TensorProduct.map (euclideanAmbientRotation a b) (youngAmbientRotation lam a b)).comp I) = _ - apply TensorProduct.ext' - intro v p - simp only [LinearMap.comp_apply, LinearMap.sum_apply, map_sum] + rw [linearMap_comp_sum_comp] + simp_rw [linearMap_comp_sum_comp] rw [Fin.sum_univ_castSucc] simp_rw [Fin.sum_univ_castSucc] - have htangential' (a b : Fin n) := - LinearMap.congr_fun (htangential a b) (v ⊗ₜ[ℝ] p) - have hcross' (a : Fin n) := - LinearMap.congr_fun (hcross a) (v ⊗ₜ[ℝ] p) - have hcrossSwap' (a : Fin n) := - LinearMap.congr_fun (hcrossSwap a) (v ⊗ₜ[ℝ] p) - have hlast' := LinearMap.congr_fun hlast (v ⊗ₜ[ℝ] p) - simp only [LinearMap.comp_apply, LinearMap.zero_apply] at htangential' hcross' hcrossSwap' hlast' - simp only [htangential', hcross', hcrossSwap', hlast', + simp only [htangential, hcross, hcrossSwap, hlast, Finset.sum_const_zero, add_zero] theorem transverseTensorEmbeddingOfStabilizerIsometry_relativeCasimir @@ -4529,17 +4517,8 @@ theorem physicalPaddedPieriChannel_relativeCasimir (HigherChannel.ambientShift n (appendZeroWeight lam)) (paddedPieriSignedChannel (appendZeroWeight lam) i) • physicalPaddedPieriChannel hn lam hdom i p := by - exact zeroRowTransportPaddedPieriChannel_eigen_of_intertwine - lam - (paddedOrthogonalTensorPieriChannel hn - (appendZeroWeight lam) hdom i) - (zeroRowTensorIsometryEquiv_symm_relativeCasimir_intertwine lam).symm - (HigherChannel.signedNode - (HigherChannel.ambientShift n (appendZeroWeight lam)) - (paddedPieriSignedChannel (appendZeroWeight lam) i)) - p - (paddedOrthogonalTensorPieriChannel_relativeCasimir hn - (appendZeroWeight lam) hdom i p) + exact @AllRankGTSelectedPhysicalChannelRange.physicalPaddedPieriChannel_relativeCasimir r n hn lam + hdom i p end AllRankGTPhysicalPaddedPieriFullEigen @@ -4950,7 +4929,7 @@ theorem negativeSector_shortTensor_adjoint_eigen I.toLinearMap.adjoint (gtRelativeCasimir (n := n + 1) lam (B p)) = d • I.toLinearMap.adjoint (B p) := by - dsimp + dsimp only let c : ℝ := (Real.sqrt (internalRowLowerGramScalar (raiseWeight mu row) row * weylEdgeRatio n mu row))⁻¹ @@ -4997,7 +4976,7 @@ theorem negativeSector_selectedFullTensor_adjoint_eigen J.toLinearMap.adjoint (gtRelativeCasimir (n := n + 1) lam (B p)) = d • J.toLinearMap.adjoint (B p) := by - dsimp + dsimp only apply adjoint_eigen_of_range_le (gtTransverseTensorEmbedding lam (raiseWeight mu row) hnu hnuGram).toLinearMap (gtFullTransverseEmbedding lam hn @@ -5032,7 +5011,7 @@ theorem positiveSector_shortTensor_adjoint_eigen I.toLinearMap.adjoint (gtRelativeCasimir (n := n + 1) lam (B p)) = d • I.toLinearMap.adjoint (B p) := by - dsimp + dsimp only let c : ℝ := (Real.sqrt (internalRowLowerGramScalar mu row))⁻¹ let C := youngClebschLower (n := n) nu mu (by rw [hmunu]; exact sum_raiseWeight nu row) row @@ -5075,7 +5054,7 @@ theorem positiveSector_selectedFullTensor_adjoint_eigen J.toLinearMap.adjoint (gtRelativeCasimir (n := n + 1) lam (B p)) = d • J.toLinearMap.adjoint (B p) := by - dsimp + dsimp only apply adjoint_eigen_of_range_le (gtTransverseTensorEmbedding lam nu hnu hnuGram).toLinearMap (gtFullTransverseEmbedding lam hn @@ -5269,7 +5248,7 @@ theorem normalizedWallSector_selectedFullTensor_adjoint_eigen J.toLinearMap.adjoint (gtRelativeCasimir (n := n + 1) lam (B p)) = d • J.toLinearMap.adjoint (B p) := by - dsimp + dsimp only apply adjoint_eigen_of_range_le (gtTransverseWallTensorEmbedding lam mu h hn hlast).toLinearMap (gtFullTransverseEmbedding lam hn @@ -5333,16 +5312,8 @@ theorem transverseStabilizerIsometry_adjoint_comp_of_orthogonal F.toLinearMap).adjoint.comp (TensorProduct.map (gtTransverseEuclideanIsometry n).toLinearMap G.toLinearMap) = 0 - rw [TensorProduct.adjoint_map] - apply TensorProduct.ext - ext v p - have hz := LinearMap.congr_fun horth p - change F.toLinearMap.adjoint (G p) = 0 at hz - change - (gtTransverseEuclideanIsometry n).toLinearMap.adjoint - (gtTransverseEuclideanIsometry n v) ⊗ₜ[ℝ] - F.toLinearMap.adjoint (G p) = 0 - rw [hz, TensorProduct.tmul_zero] + rw [TensorProduct.adjoint_map, ← TensorProduct.map_comp, horth, + TensorProduct.map_zero_right] theorem transverseStabilizerIsometry_rotationTerm_cross {s t r n : ℕ} (lam : Fin (r + 1) → ℕ) @@ -5414,10 +5385,7 @@ theorem transverseStabilizerIsometry_mixedRotation_cross_eq_zero ((youngAmbientRotation lam a.castSucc b.castSucc).comp G.toLinearMap) = 0 := by rw [← hG a b, ← LinearMap.comp_assoc, horth, LinearMap.zero_comp] rw [hz] - apply TensorProduct.ext - ext v p - simp only [TensorProduct.map_zero_right, LinearMap.compr₂ₛₗ_apply, TensorProduct.mk_apply, - LinearMap.zero_apply] + exact TensorProduct.map_zero_right _ have hcross (a : Fin n) : I.adjoint.comp ((TensorProduct.map @@ -5433,10 +5401,7 @@ theorem transverseStabilizerIsometry_mixedRotation_cross_eq_zero lam target G).toLinearMap) = 0 rw [transverseStabilizerIsometry_rotationTerm_cross, gtTransverseEuclideanIsometry_cross_rotation_compression] - apply TensorProduct.ext - ext v p - simp only [TensorProduct.map_zero_left, LinearMap.compr₂ₛₗ_apply, TensorProduct.mk_apply, - LinearMap.zero_apply] + exact TensorProduct.map_zero_left _ have hcrossSwap (a : Fin n) : I.adjoint.comp ((TensorProduct.map @@ -5452,10 +5417,7 @@ theorem transverseStabilizerIsometry_mixedRotation_cross_eq_zero lam target G).toLinearMap) = 0 rw [transverseStabilizerIsometry_rotationTerm_cross, gtTransverseEuclideanIsometry_cross_rotation_compression_swap] - apply TensorProduct.ext - ext v p - simp only [TensorProduct.map_zero_left, LinearMap.compr₂ₛₗ_apply, TensorProduct.mk_apply, - LinearMap.zero_apply] + exact TensorProduct.map_zero_left _ have hlast : I.adjoint.comp ((TensorProduct.map @@ -5480,22 +5442,11 @@ theorem transverseStabilizerIsometry_mixedRotation_cross_eq_zero change I.adjoint.comp ((∑ a : Fin (n + 1), ∑ b : Fin (n + 1), TensorProduct.map (euclideanAmbientRotation a b) (youngAmbientRotation lam a b)).comp J) = 0 - apply TensorProduct.ext' - intro v p - simp only [LinearMap.comp_apply, LinearMap.sum_apply, map_sum, - LinearMap.zero_apply] + rw [linearMap_comp_sum_comp] + simp_rw [linearMap_comp_sum_comp] rw [Fin.sum_univ_castSucc] simp_rw [Fin.sum_univ_castSucc] - have htangential' (a b : Fin n) := - LinearMap.congr_fun (htangential a b) (v ⊗ₜ[ℝ] p) - have hcross' (a : Fin n) := - LinearMap.congr_fun (hcross a) (v ⊗ₜ[ℝ] p) - have hcrossSwap' (a : Fin n) := - LinearMap.congr_fun (hcrossSwap a) (v ⊗ₜ[ℝ] p) - have hlast' := LinearMap.congr_fun hlast (v ⊗ₜ[ℝ] p) - simp only [LinearMap.comp_apply, LinearMap.zero_apply] - at htangential' hcross' hcrossSwap' hlast' - simp only [htangential', hcross', hcrossSwap', hlast', + simp only [htangential, hcross, hcrossSwap, hlast, Finset.sum_const_zero, add_zero] theorem transverseStabilizerIsometry_relativeCasimir_cross_eq_zero @@ -5905,7 +5856,7 @@ theorem gtRelativeCasimir_normalizedWallSector_additiveColumn (-(wallShift (n + 1) (r + 1))) • B.toLinearMap + (canonicalGelfandTsetlinAxisTensor lam mu h hgram).comp (gtTransverseAxisCrossBlock lam mu h hgram B.toLinearMap) := by - dsimp + dsimp only let hw : 2 * (r + 1) + 5 ≤ n + 1 := by omega let B := normalizedGTTransverseWallSector lam mu h hw hlast let A := canonicalGelfandTsetlinAxisTensor lam mu h hgram @@ -6070,9 +6021,6 @@ theorem negativeStabilizerNode_ne_signedAmbientNode_of_valid_raise · simp only [gtStabilizerArrowheadNode_neg, one_div, signedNode, Bool.false_eq_true, ↓reduceIte, ne_eq] intro heq - have hcoord : - stabilizerShift (n + 1) mu row + 1 / 2 = - ambientShift (n + 1) lam j := by linarith by_cases hji : j ≤ row.castSucc · have hmono := hfinite.ambientShift_strictAnti.antitone hji linarith @@ -6747,7 +6695,7 @@ theorem gtAxisCompressedCharacteristicMinor_eval_eq_adjugate_inner gtAxisCompressedSignedProjectorCoefficient] apply Finset.sum_congr rfl intro channel _ - ring + ac_rfl theorem gtAxisCompressedCharacteristicMinor_eval_eq_zero_of_arrowhead_operator_row {r n : ℕ} (lam : Fin (r + 2) → ℕ) @@ -6997,11 +6945,9 @@ theorem gtSignedArrowheadCoupling_injective (hnode : ∀ i : Fin (r + 1) × Bool, d ≠ signedNode (HigherChannel.ambientShift n lam) i) : Function.Injective K := by - apply arrowhead_isometric_coupling_injective_of_characteristic - (gtRelativeCasimir (n := n) lam) B A K - (gtChannelCharacteristicPolynomial n lam) d hrow hchar - exact gtChannelCharacteristicPolynomial_eval_ne_zero_of_forall_ne - lam d hnode + exact arrowhead_isometric_coupling_injective_of_characteristic (gtRelativeCasimir lam) B A K + (gtChannelCharacteristicPolynomial n lam) d hrow hchar + (gtChannelCharacteristicPolynomial_eval_ne_zero_of_forall_ne lam d hnode) end AllRankGTCartanSpectralCouplingNonvanishing @@ -7356,7 +7302,7 @@ theorem isometricSector_operator_column_of_mem_axis_sector rw [hx, hy] _ = d • B p + A (A.toLinearMap.adjoint (T (B p))) := by rw [map_smul] - module + ac_rfl theorem gtAxisCompressedCharacteristicMinor_eval_negativeValidNode_eq_zero {r n : ℕ} (lam : Fin (r + 2) → ℕ) diff --git a/LeanPool/MetricCodes/Foundations.lean b/LeanPool/MetricCodes/Foundations.lean index fedca76d3..f44b724a1 100644 --- a/LeanPool/MetricCodes/Foundations.lean +++ b/LeanPool/MetricCodes/Foundations.lean @@ -34,6 +34,15 @@ noncomputable section MetricCodesNoncomputable namespace MetricCodes +private theorem one_sub_centered_square (x : ℝ) : + 1 - (1 - 2 * x) ^ 2 = 4 * (x * (1 - x)) := by + ring + +private theorem centered_square_difference (x y : ℝ) : + (1 - 2 * x) ^ 2 - (1 - 2 * y) ^ 2 = + 4 * (y * (1 - y) - x * (1 - x)) := by + ring + section open scoped BigOperators InnerProductSpace @@ -85,8 +94,8 @@ theorem hammingCorrelation_le_of_dist_le have hdiv : 2 * (d : ℝ) / (n : ℝ) ≤ 2 * (hammingDist x y : ℝ) / (n : ℝ) := by - exact (div_le_div_iff_of_pos_right hn').2 (by linarith) - linarith + exact (div_le_div_iff_of_pos_right hn').2 (by linarith only [hd']) + linarith only [hdiv] /-- The spherical entropy used in the metric-code argument. -/ def sphericalEntropy (u : ℝ) : ℝ := @@ -100,7 +109,7 @@ theorem sphericalEntropy_eq_log_add {u : ℝ} (hu : 0 < u) : Real.logb 2 (1 + u) + u * Real.logb 2 ((1 + u) / u) := by have hu' : u ≠ 0 := hu.ne' - have hone : 1 + u ≠ 0 := by linarith + have hone : 1 + u ≠ 0 := by linarith only [hu] rw [Real.logb_div hone hu'] unfold sphericalEntropy ring @@ -124,8 +133,8 @@ theorem binaryEntropy_nonneg {u : ℝ} (hu : 0 ≤ u) (hu' : u ≤ 1) : have hleft : u * Real.logb 2 u ≤ 0 := mul_nonpos_of_nonneg_of_nonpos hu h₁ have hright : (1 - u) * Real.logb 2 (1 - u) ≤ 0 := - mul_nonpos_of_nonneg_of_nonpos (by linarith) h₂ - linarith + mul_nonpos_of_nonneg_of_nonpos (by linarith only [hu']) h₂ + linarith only [hleft, hright] /-- The gamma used in the metric-code argument. -/ def Gamma (a b : ℝ) : ℝ := @@ -150,16 +159,16 @@ def classicalThreshold (s : ℝ) : ℝ := theorem classicalThreshold_pos {s : ℝ} (hs : 0 < s) (hs' : s < 1) : 0 < classicalThreshold s := by - have hrad : 0 < 1 - s ^ 2 := by nlinarith + have hrad : 0 < 1 - s ^ 2 := by nlinarith only [hs', hs] have hsqrt : 0 < Real.sqrt (1 - s ^ 2) := Real.sqrt_pos.2 hrad have hsqrt' : Real.sqrt (1 - s ^ 2) < 1 := by apply (Real.sqrt_lt' (by norm_num : (0 : ℝ) < 1)).2 - nlinarith + nlinarith only [hs] have hrecip : 1 < 1 / Real.sqrt (1 - s ^ 2) := by apply (lt_div_iff₀ hsqrt).2 simpa only [one_mul] using hsqrt' unfold classicalThreshold - linarith + linarith only [hrecip] /-- The boolean harmonic dimension used in the metric-code argument. -/ def booleanHarmonicDimension (n : ℕ) : ℕ → ℕ @@ -208,7 +217,6 @@ theorem hammingJacobiEntry_pos {n k i : ℕ} have hn' : (0 : ℝ) < n := by exact_mod_cast hn have hki' : (k : ℝ) ≤ i := by exact_mod_cast hki have hi' : (i : ℝ) + (k : ℝ) < n := by exact_mod_cast hi - have hzero : (0 : ℝ) ≤ k := Nat.cast_nonneg k unfold hammingJacobiEntry apply div_pos · apply mul_pos <;> linarith @@ -737,7 +745,7 @@ theorem dot_smul_right (f g : Function n) (c : ℝ) : simp only [dot, Pi.smul_apply, smul_eq_mul, Finset.mul_sum] apply Finset.sum_congr rfl intro S _ - ring + ac_rfl theorem normSq_nonneg (f : Function n) : 0 ≤ (dot f f) := by unfold dot @@ -1228,7 +1236,7 @@ theorem sum_dot_raiseAt (f g : Function n) : apply Finset.sum_congr rfl intro S _ rw [← Finset.mul_sum, sum_not_mem_indicator] - ring + ac_rfl theorem sum_dot_lowerAt_of_level {i : ℕ} (f g : Function n) (hf : IsLevel i f) : @@ -1248,7 +1256,7 @@ theorem sum_dot_lowerAt_of_level {i : ℕ} (f g : Function n) simp only [dot, Finset.mul_sum] apply Finset.sum_congr rfl intro S _ - ring + ac_rfl theorem sum_dot_raiseAt_of_level {i : ℕ} (f g : Function n) (hf : IsLevel i f) : @@ -1270,7 +1278,7 @@ theorem sum_dot_raiseAt_of_level {i : ℕ} (f g : Function n) simp only [dot, Finset.mul_sum] apply Finset.sum_congr rfl intro S _ - ring + ac_rfl theorem dot_smul_left (f g : Function n) (c : ℝ) : dot (c • f) g = c * dot f g := by @@ -1320,10 +1328,9 @@ theorem raise_eq_zero_iff_of_level {i : ℕ} rw [hzero] at hidentity have hi' : (2 : ℝ) * (i : ℝ) < (n : ℝ) := by exact_mod_cast hi - have hpos : 0 < (n : ℝ) - 2 * (i : ℝ) := by linarith have hnonneg := normSq_nonneg (lower f) have hfn := normSq_nonneg f - have hnorm : (dot f f) = 0 := by nlinarith + have hnorm : (dot f f) = 0 := by nlinarith only [hfn, hidentity, hnonneg, hi'] exact (normSq_eq_zero_iff f).mp hnorm · intro hfzero subst f @@ -1609,7 +1616,7 @@ theorem deleteChannel_isometry {i : ℕ} (hi : 0 < i) dot_smul_right, Finset.mul_sum] apply Finset.sum_congr rfl intro a _ - ring + ac_rfl _ = ((Real.sqrt (i : ℝ))⁻¹ * (Real.sqrt (i : ℝ))⁻¹) * ((i : ℝ) * dot f g) := by rw [sum_dot_lowerAt_of_level f g hf] _ = ((Real.sqrt (i : ℝ))⁻¹ * (Real.sqrt (i : ℝ))⁻¹ * @@ -1650,7 +1657,7 @@ theorem addChannel_isometry {i : ℕ} (hi : i < n) dot_smul_right, Finset.mul_sum] apply Finset.sum_congr rfl intro a _ - ring + ac_rfl _ = ((Real.sqrt ((n : ℝ) - (i : ℝ)))⁻¹ * (Real.sqrt ((n : ℝ) - (i : ℝ)))⁻¹) * (((n : ℝ) - (i : ℝ)) * dot f g) := by @@ -1695,7 +1702,7 @@ theorem harmonicCoefficient_pos {n k r : ℕ} exact_mod_cast hbound unfold harmonicCoefficient apply mul_pos hr' - linarith + linarith only [hbound'] theorem harmonicNormFactor_pos {n k r : ℕ} (hbound : 2 * k + r ≤ n) : @@ -1734,7 +1741,7 @@ theorem dot_raised_of_harmonic {k : ℕ} | succ r ih => rw [dot_raised_succ_of_harmonic f g hg r, ih] simp only [harmonicNormFactor, Finset.prod_range_succ] - ring + ac_rfl /-- The harmonic embedding used in the binary-code argument. -/ def harmonicEmbedding (k r : ℕ) (f : Function n) : Function n := @@ -1778,7 +1785,7 @@ theorem harmonicEmbedding_isometry {k : ℕ} (Real.sqrt (harmonicNormFactor n k r))⁻¹) * dot (raised f r) (raised g r) := by simp only [harmonicEmbedding, dot_smul_left, dot_smul_right] - ring + ac_rfl _ = ((Real.sqrt (harmonicNormFactor n k r))⁻¹ * (Real.sqrt (harmonicNormFactor n k r))⁻¹) * (harmonicNormFactor n k r * dot f g) := by @@ -2326,7 +2333,7 @@ theorem hammingAxis_inner {n : ℕ} (hn : 0 < n) rw [sum_sign_mul_eq_hammingDist] _ = MetricCodes.hammingCorrelation x y := by unfold MetricCodes.hammingCorrelation - field_simp [hsne, hn'.ne']; nlinarith [hs] + field_simp [hsne, hn'.ne']; nlinarith only [hs] theorem character_insert (x : BinaryWord n) (a : Fin n) (S : Finset (Fin n)) @@ -2372,7 +2379,7 @@ theorem raiseAt_twist _ = sign (x a) * ((sign (x a) * character x (S.erase a)) * f (S.erase a)) := by - ring + ac_rfl · simp only [raiseAt, ha, ↓reduceIte, Pi.smul_apply, twist, mul_zero, smul_eq_mul] /-- The Euclidean vector of matrix entries used to express the Hilbert–Schmidt inner product. -/ @@ -2438,7 +2445,7 @@ theorem matrixAxisLift_transpose_mul rw [Finset.mul_sum] apply Finset.sum_congr rfl intro r _ - ring + ac_rfl /-- The axis-lifted projection minus the scaled channel image of that projection. -/ def matrixAxisResidual @@ -2610,7 +2617,7 @@ theorem lower_harmonicEmbedding {k : ℕ} Real.sqrt_mul hfactor.le] congr 1 field_simp [hfactorne, hcoefficientne]; - nlinarith [Real.sq_sqrt hcoefficient.le] + linarith only [Real.sq_sqrt hcoefficient.le] /-- The Hamming Jacobi entry rescaled by the square roots of the source and target layer dimensions. -/ @@ -2693,13 +2700,13 @@ theorem hammingRecurrenceWeight_eigenrecurrence (Real.sqrt (n.choose (k + i.val) : ℝ) * v i) = (hammingSourceChannelCoefficient n k L m i * Real.sqrt (n.choose (k + i.val) : ℝ)) * v i := by - ring + ac_rfl _ = (MetricCodes.hammingJacobiMatrix n k L m i * Real.sqrt (n.choose (k + m.val) : ℝ)) * v i := by rw [h] _ = (MetricCodes.hammingJacobiMatrix n k L m i * v i) * Real.sqrt (n.choose (k + m.val) : ℝ) := by - ring + ac_rfl _ = (∑ i : Fin (L - k + 1), MetricCodes.hammingJacobiMatrix n k L m i * v i) * Real.sqrt (n.choose (k + m.val) : ℝ) := by @@ -2707,7 +2714,7 @@ theorem hammingRecurrenceWeight_eigenrecurrence _ = lam * hammingRecurrenceWeight n k L v m := by rw [hcoordinate] unfold hammingRecurrenceWeight - ring + ac_rfl theorem hammingRecurrenceWeight_pos_of_pos {n k L : ℕ} (hkL : k ≤ L) (hLn : L + k ≤ n) @@ -2846,7 +2853,7 @@ theorem hammingAdjacentBlockCoefficient_amplitude_identity hammingFibreAmplitude_sq hkL hLn v hunit (fun i => (hv i).le) source] field_simp [hlam.ne', hsource.ne', hnormal.ne'] - nlinarith + exact (sq_eq_sq₀ hleft hright).mp hsquare theorem hammingAdjacentBlockCoefficient_amplitude_sum {n k L : ℕ} (hn : 0 < n) @@ -2974,7 +2981,6 @@ theorem hammingAdjacentChannel_isometry (hammingAdjacentChannel n k L target source f) (hammingAdjacentChannel n k L target source g) = dot f g := by - have hs := source.isLt have ht := target.isLt rcases hadjacent with hdelete | hadd · simp only [hammingAdjacentChannel, hdelete, ↓reduceIte] @@ -3150,7 +3156,7 @@ theorem hammingWindowChannelMatrix_pairing rw [Finset.mul_sum] apply Finset.sum_congr rfl intro S _ - ring + ac_rfl _ = (hammingAdjacentBlockCoefficient n k L v lam target Q.1 * hammingAdjacentBlockCoefficient n k L v lam target R.1) * coordinateDot @@ -3446,8 +3452,6 @@ theorem hammingSourceChannelCoefficient_eq_deletion (hadjacent : target.val + 1 = source.val) : hammingSourceChannelCoefficient n k L source target = hammingDeletionChannelSquare n k (k + target.val) := by - have hs := source.isLt - have ht := target.isLt have hboundary : k + target.val + k < n := by omega have hdimension : 0 < (n.choose (k + target.val) : ℝ) := by exact_mod_cast Nat.choose_pos (show k + target.val ≤ n by omega) @@ -3469,8 +3473,6 @@ theorem hammingSourceChannelCoefficient_eq_insertion (hadjacent : source.val + 1 = target.val) : hammingSourceChannelCoefficient n k L source target = hammingInsertionChannelSquare n k (k + source.val) := by - have hs := source.isLt - have ht := target.isLt have hboundary : k + source.val + k < n := by omega have hdimension : 0 < (n.choose (k + target.val) : ℝ) := by exact_mod_cast Nat.choose_pos (show k + target.val ≤ n by omega) @@ -3548,7 +3550,7 @@ theorem coordinateDot_deleteChannel_hammingAxisTensor (Real.sqrt (n : ℝ))⁻¹) * ((sign (x a) * sign (x a)) * dot f (twist x (raiseAt a g))) := by - ring + ac_rfl _ = ((Real.sqrt (i : ℝ))⁻¹ * (Real.sqrt (n : ℝ))⁻¹) * dot f (twist x (raiseAt a g)) := by @@ -3590,7 +3592,7 @@ theorem coordinateDot_addChannel_hammingAxisTensor (Real.sqrt (n : ℝ))⁻¹) * ((sign (x a) * sign (x a)) * dot f (twist x (lowerAt a g))) := by - ring + ac_rfl _ = ((Real.sqrt ((n : ℝ) - (i : ℝ)))⁻¹ * (Real.sqrt (n : ℝ))⁻¹) * dot f (twist x (lowerAt a g)) := by @@ -3617,7 +3619,6 @@ theorem hammingSourceChannelCoefficient_sqrt_deletion (Real.sqrt (n : ℝ))⁻¹ * (Real.sqrt (k + source.val : ℝ))⁻¹ * Real.sqrt (harmonicCoefficient n k source.val) := by - have hs := source.isLt have hcoefficient : 0 < harmonicCoefficient n k source.val := harmonicCoefficient_pos (by omega) (by omega) have hnreal : 0 < (n : ℝ) := by exact_mod_cast hn @@ -3651,8 +3652,6 @@ theorem hammingSourceChannelCoefficient_sqrt_insertion (Real.sqrt (n : ℝ))⁻¹ * (Real.sqrt ((n : ℝ) - (k + source.val : ℝ)))⁻¹ * Real.sqrt (harmonicCoefficient n k target.val) := by - have hs := source.isLt - have ht := target.isLt have hcoefficient : 0 < harmonicCoefficient n k target.val := harmonicCoefficient_pos (by omega) (by omega) have hnreal : 0 < (n : ℝ) := by exact_mod_cast hn @@ -3825,7 +3824,7 @@ theorem hammingWindowChannelMatrix_transpose_axis_fibre rw [Finset.mul_sum] apply Finset.sum_congr rfl intro S _ - ring + ac_rfl _ = (∑ target : Fin (L - k + 1), hammingAdjacentBlockCoefficient n k L v lam target Q.1 * hammingFibreAmplitude n k L v target * @@ -3839,14 +3838,14 @@ theorem hammingWindowChannelMatrix_transpose_axis_fibre rw [Finset.sum_mul] apply Finset.sum_congr rfl intro target _ - ring + ac_rfl _ = Real.sqrt lam * (hammingFibreAmplitude n k L v Q.1 * wordHarmonicEmbedding x k Q.1.val h Q.2.val) := by rw [hammingAdjacentBlockCoefficient_amplitude_sum hn hkL hLn v hunit hv lam hlam heigen Q.1, dot_hammingWindowBasis_apply] - ring + ac_rfl theorem hammingChannelMatrix_transpose_axis_fibre {n k L : ℕ} (hn : 0 < n) (hk : 2 * k ≤ n) @@ -3922,7 +3921,7 @@ theorem matrixAxisLift_mul rw [Finset.mul_sum] apply Finset.sum_congr rfl intro r _ - ring + ac_rfl theorem hammingChannelMatrix_transpose_axis_projection {n k L : ℕ} (hn : 0 < n) (hk : 2 * k ≤ n) @@ -4473,13 +4472,10 @@ theorem factorialLogError_eq (n : ℕ) (hn : n ≠ 0) : (1 / 2 : ℝ) * Real.log (2 * (n : ℝ)) / (n : ℝ) := by have hn' : (n : ℝ) ≠ 0 := by exact_mod_cast hn have he : Real.exp (1 : ℝ) ≠ 0 := (Real.exp_pos 1).ne' - have hst := Stirling.log_stirlingSeq_formula n - rw [Real.log_div hn' he, Real.log_exp] at hst - have hlog : Real.log ((n : ℝ) * 2) = Real.log (2 * (n : ℝ)) := by - rw [mul_comm] unfold factorialLogError + rw [Stirling.log_stirlingSeq_formula, Real.log_div hn' he, Real.log_exp] field_simp [hn'] - nlinarith [hst, hlog] + ring theorem tendsto_factorialLogError : Tendsto factorialLogError atTop (nhds 0) := by @@ -4704,11 +4700,9 @@ def threshold (n d : ℕ) : ℝ := theorem threshold_lt_one {n d : ℕ} (hn : 0 < n) (hd : 0 < d) : threshold n d < 1 := by - have hn' : (0 : ℝ) < (n : ℝ) := by exact_mod_cast hn - have hd' : (0 : ℝ) < (d : ℝ) := by exact_mod_cast hd unfold threshold have hpos : 0 < 2 * (d : ℝ) / (n : ℝ) := by positivity - linarith + linarith only [hpos] /-- The index used in the binary-code argument. -/ abbrev Index (k L : ℕ) := Fin (L - k + 1) @@ -5132,10 +5126,10 @@ theorem rateSet_bddBelow (δ : ℝ) : BddBelow (rateSet δ) := by rintro r ⟨a, b, hfeasible, rfl⟩ obtain ⟨hb, hba, ha, hgamma⟩ := hfeasible have ha0 : 0 ≤ a := (lt_of_le_of_lt hb hba).le - have ha1 : a ≤ 1 := by linarith + have ha1 : a ≤ 1 := by linarith only [ha] have hapos := MetricCodes.binaryEntropy_nonneg ha0 ha1 have hble := binaryEntropy_le_one b - linarith + linarith only [hapos, hble] theorem variationalRate_le_of_feasible {δ a b : ℝ} (h : Feasible δ a b) : @@ -5153,33 +5147,33 @@ def classicalRate (δ : ℝ) : ℝ := theorem classicalParameter_lt_half {δ : ℝ} (hδ : 0 < δ) (hδ' : δ < (1 : ℝ) / 2) : classicalParameter δ < (1 : ℝ) / 2 := by - have hrad : 0 < δ * (1 - δ) := mul_pos hδ (by linarith) + have hrad : 0 < δ * (1 - δ) := mul_pos hδ (by linarith only [hδ']) unfold classicalParameter have hsqrt := Real.sqrt_pos.2 hrad - linarith + linarith only [hsqrt] theorem classicalParameter_pos {δ : ℝ} (hδ : 0 < δ) (hδ' : δ < (1 : ℝ) / 2) : 0 < classicalParameter δ := by have hsquare : 0 < (δ - (1 : ℝ) / 2) ^ 2 := - sq_pos_of_ne_zero (by linarith) - have hrad : 0 < δ * (1 - δ) := mul_pos hδ (by linarith) + sq_pos_of_ne_zero (by linarith only [hδ']) + have hrad : 0 < δ * (1 - δ) := mul_pos hδ (by linarith only [hδ']) have hrad_lt : δ * (1 - δ) < ((1 : ℝ) / 2) ^ 2 := by - nlinarith + linarith only [hsquare] have hroot : Real.sqrt (δ * (1 - δ)) < (1 : ℝ) / 2 := by exact (Real.sqrt_lt' (by norm_num)).2 hrad_lt unfold classicalParameter - linarith + linarith only [hroot] theorem classicalParameter_mul_one_sub {δ : ℝ} (hδ : 0 < δ) (hδ' : δ < (1 : ℝ) / 2) : classicalParameter δ * (1 - classicalParameter δ) = ((1 : ℝ) / 2 - δ) ^ 2 := by have hrad : 0 ≤ δ * (1 - δ) := - (mul_pos hδ (by linarith)).le + (mul_pos hδ (by linarith only [hδ'])).le have hsqrt := Real.sq_sqrt hrad unfold classicalParameter - nlinarith + linarith only [hsqrt] theorem hammingGamma_zero {a : ℝ} (ha : 0 < a) (ha' : a < 1) : MetricCodes.hammingGamma a 0 = 2 * Real.sqrt (a * (1 - a)) := by @@ -5190,7 +5184,7 @@ theorem hammingGamma_zero {a : ℝ} (ha : 0 < a) (ha' : a < 1) : unfold MetricCodes.hammingGamma simp only [sub_zero] field_simp [hsqrt] - nlinarith + linarith only [hsquare] theorem hammingGamma_classicalParameter {δ : ℝ} (hδ : 0 < δ) (hδ' : δ < (1 : ℝ) / 2) : @@ -5200,7 +5194,7 @@ theorem hammingGamma_classicalParameter {δ : ℝ} (classicalParameter_lt_half hδ hδ').trans (by norm_num) rw [hammingGamma_zero ha ha', classicalParameter_mul_one_sub hδ hδ', - Real.sqrt_sq (by linarith : 0 ≤ (1 : ℝ) / 2 - δ)] + Real.sqrt_sq (by linarith only [hδ'] : 0 ≤ (1 : ℝ) / 2 - δ)] ring /-- The slope `2 / (1 - 2 * a) + 1` used to perturb the Hamming bound parameters. -/ @@ -5213,10 +5207,10 @@ def improvementPath (a b : ℝ) : ℝ := theorem improvementSlope_gt_one {a : ℝ} (ha : a < (1 : ℝ) / 2) : 1 < improvementSlope a := by - have hden : 0 < 1 - 2 * a := by linarith + have hden : 0 < 1 - 2 * a := by linarith only [ha] have hfrac : 0 < 2 / (1 - 2 * a) := by positivity unfold improvementSlope - linarith + linarith only [hfrac] theorem tendsto_improvementPath_zero (a : ℝ) : Tendsto (improvementPath a) (𝓝[>] (0 : ℝ)) (nhds a) := by @@ -5252,7 +5246,7 @@ theorem spectralMarginPolynomial_improvement_zero {a : ℝ} (ha : a < (1 : ℝ) / 2) : spectralMarginPolynomial a (improvementSlope a) 0 = a * (1 - a) * (1 - 2 * a) := by - have hden : 1 - 2 * a ≠ 0 := by linarith + have hden : 1 - 2 * a ≠ 0 := by linarith only [ha] have hden' : 1 - a * 2 ≠ 0 := by simpa only [ne_eq, mul_comm] using hden unfold spectralMarginPolynomial improvementSlope @@ -5265,8 +5259,8 @@ theorem eventually_hammingGamma_improvement {a : ℝ} MetricCodes.hammingGamma (improvementPath a b) b := by have hzero : 0 < spectralMarginPolynomial a (improvementSlope a) 0 := by rw [spectralMarginPolynomial_improvement_zero ha'] - have ha1 : 0 < 1 - a := by linarith - have hhalf : 0 < 1 - 2 * a := by linarith + have ha1 : 0 < 1 - a := by linarith only [ha'] + have hhalf : 0 < 1 - 2 * a := by linarith only [ha'] exact mul_pos (mul_pos ha ha1) hhalf have hpoly : ∀ᶠ b : ℝ in 𝓝[>] 0, @@ -5286,13 +5280,13 @@ theorem eventually_hammingGamma_improvement {a : ℝ} with b hbpoly hbhalf (hb : 0 < b) have hbpath : b < improvementPath a b := by unfold improvementPath - nlinarith [mul_pos (sub_pos.mpr hc) hb] + linarith only [ha, mul_pos (sub_pos.mpr hc) hb] have hpath : 0 < improvementPath a b := lt_trans hb hbpath have hpath1 : improvementPath a b < 1 := hbhalf.trans (by norm_num) have htail : 0 < 1 - improvementPath a b - b := by - linarith - have hbase : 0 < a * (1 - a) := mul_pos ha (by linarith) + linarith only [hbhalf, hbpath] + have hbase : 0 < a * (1 - a) := mul_pos ha (by linarith only [ha']) have hrad : 0 < improvementPath a b * (1 - improvementPath a b) := mul_pos hpath (sub_pos.mpr hpath1) have hfactor : @@ -5331,7 +5325,9 @@ theorem eventually_hammingGamma_improvement {a : ℝ} Real.sqrt (improvementPath a b * (1 - improvementPath a b)) := mul_nonneg (Real.sqrt_nonneg _) (Real.sqrt_nonneg _) - nlinarith + apply (sq_lt_sq₀ hnonneg htarget.le).mp + rw [hsquare] + exact sub_pos.mp hmargin have hquot : Real.sqrt (a * (1 - a)) < ((improvementPath a b - b) * @@ -5339,7 +5335,7 @@ theorem eventually_hammingGamma_improvement {a : ℝ} Real.sqrt (improvementPath a b * (1 - improvementPath a b)) := (lt_div_iff₀ (Real.sqrt_pos.2 hrad)).2 hroot - rw [hammingGamma_zero ha (by linarith)] + rw [hammingGamma_zero ha (by linarith only [ha'])] unfold MetricCodes.hammingGamma calc 2 * Real.sqrt (a * (1 - a)) < @@ -5370,9 +5366,9 @@ theorem neg_mul_logb_le_binaryEntropy {b : ℝ} have hlog : Real.logb 2 (1 - b) ≤ 0 := Real.logb_nonpos (by norm_num) (by linarith) (by linarith) have hterm : (1 - b) * Real.logb 2 (1 - b) ≤ 0 := - mul_nonpos_of_nonneg_of_nonpos (by linarith) hlog + mul_nonpos_of_nonneg_of_nonpos (by linarith only [hb']) hlog unfold MetricCodes.binaryEntropy - nlinarith + linarith only [hterm] theorem eventually_binaryEntropy_improvement {a : ℝ} (ha : 0 < a) (ha' : a < (1 : ℝ) / 2) : @@ -5393,7 +5389,7 @@ theorem eventually_binaryEntropy_improvement {a : ℝ} let M : ℝ := deriv f 0 + 1 have hM : deriv f 0 < M := by dsimp [M] - linarith + linarith only [] have hslope := hf.hasDerivAt.tendsto_slope_zero_right have hupper : ∀ᶠ b : ℝ in 𝓝[>] 0, @@ -5427,7 +5423,7 @@ theorem eventually_binaryEntropy_improvement {a : ℝ} b * M < b * (-Real.logb 2 b) := mul_lt_mul_of_pos_left hlogb hb have hentropy := neg_mul_logb_le_binaryEntropy hb.le hb1.le - linarith + linarith only [houter_bound, hsingular, hentropy] theorem exists_strict_improving_feasible {δ : ℝ} (hδ : 0 < δ) (hδ' : δ < (1 : ℝ) / 2) : @@ -5455,7 +5451,7 @@ theorem exists_strict_improving_feasible {δ : ℝ} with b hgamma' hentropy' hhalf' (hb : 0 < b) have hbpath : b < improvementPath a₀ b := by unfold improvementPath - nlinarith [mul_pos (sub_pos.mpr hc) hb] + linarith only [ha₀, mul_pos (sub_pos.mpr hc) hb] constructor · refine ⟨hb.le, hbpath, hhalf'.le, ?_⟩ have hboundary : MetricCodes.hammingGamma a₀ 0 = 1 - 2 * δ := by @@ -5831,10 +5827,10 @@ theorem eventually_transverse_add_le_longitudinal let ε : ℝ := (a - b) / 2 have hε : 0 < ε := by dsimp [ε] - linarith + linarith only [hba] have hεlt : ε < a - b := by dsimp [ε] - linarith + linarith only [hba] have ha : 0 ≤ a := (lt_of_le_of_lt hb hba).le have hratio := ((tendsto_longitudinal_ratio ha).sub @@ -5859,7 +5855,7 @@ theorem eventually_transverse_add_le_longitudinal have hreal : (transverseDegree b n : ℝ) + (m : ℝ) ≤ (longitudinalDegree a n : ℝ) := by - linarith + linarith only [hnlarge, hmul] exact_mod_cast hreal /-- The terminal edge rayleigh used in the binary-code argument. -/ @@ -5927,7 +5923,7 @@ theorem eventually_topEigenvalue_gt {a b s : ℝ} (transverseDegree b n) (longitudinalDegree a n) := by have ha0 : 0 < a := lt_of_le_of_lt hb hba have ha1 : a < 1 := lt_of_le_of_lt ha (by norm_num) - have hsecond : 0 < 1 - a - b := by linarith + have hsecond : 0 < 1 - a - b := by linarith only [hba, ha] have hgamma : 0 < MetricCodes.hammingGamma a b := by unfold MetricCodes.hammingGamma apply div_pos @@ -5936,14 +5932,14 @@ theorem eventually_topEigenvalue_gt {a b s : ℝ} let ε : ℝ := (MetricCodes.hammingGamma a b - s) / 2 have hε : 0 < ε := by dsimp [ε] - linarith + linarith only [hs] obtain ⟨m, hm⟩ := exists_nat_gt (MetricCodes.hammingGamma a b / ε) have hprod : MetricCodes.hammingGamma a b < (m : ℝ) * ε := (div_lt_iff₀ hε).mp hm have hden : 0 < (m : ℝ) + 1 := by positivity have hrem : MetricCodes.hammingGamma a b / ((m : ℝ) + 1) < ε := by apply (div_lt_iff₀ hden).2 - nlinarith + linarith only [hε, hprod] have hidentity : ((m : ℝ) / ((m : ℝ) + 1)) * MetricCodes.hammingGamma a b = MetricCodes.hammingGamma a b - @@ -5953,7 +5949,7 @@ theorem eventually_topEigenvalue_gt {a b s : ℝ} s < ((m : ℝ) / ((m : ℝ) + 1)) * MetricCodes.hammingGamma a b := by rw [hidentity] dsimp [ε] at hrem - linarith + linarith only [hs, hrem] have hquot := (tendsto_terminalEdgeRayleigh ha0 ha1 hb m).eventually (lt_mem_nhds hbelow) filter_upwards [hquot, @@ -5980,7 +5976,7 @@ theorem complement_longitudinalDegree_floor_le {a : ℝ} change (1 - a) * (n : ℝ) ≤ ((n - longitudinalDegree a n : ℕ) : ℝ) rw [Nat.cast_sub hk] - nlinarith + linarith only [hfloor] theorem tendsto_complement_longitudinalDegree {a : ℝ} (ha : 0 ≤ a) (ha' : a < 1) : @@ -6068,7 +6064,7 @@ theorem longitudinalDegree_le_half {a : ℝ} Nat.floor (a * (n : ℝ)) ≤ Nat.floor ((n : ℝ) / 2) := by apply Nat.floor_mono have h := mul_le_mul_of_nonneg_right ha (Nat.cast_nonneg n) - linarith + linarith only [h] _ = n / 2 := by simpa only [Nat.cast_ofNat] using (Nat.floor_div_eq_div (K := ℝ) n 2) @@ -6144,13 +6140,13 @@ theorem choose_le_mul_hammingFibreDimension norm_num rw [hcastj] push_cast at hcast - linarith + linarith only [hcast] have hlower : (n.choose (j + 1) : ℝ) ≤ ((n.choose (j + 1) - n.choose j : ℕ) : ℝ) * ((n - j : ℕ) : ℝ) := by rw [hidentity] - nlinarith [Nat.cast_nonneg (α := ℝ) (n.choose (j + 1))] + exact le_mul_of_one_le_right (Nat.cast_nonneg _) hfactorReal have hrange : ((n - j : ℕ) : ℝ) ≤ ((n + 1 : ℕ) : ℝ) := by exact_mod_cast (show n - j ≤ n + 1 by omega) @@ -6363,7 +6359,7 @@ theorem tendsto_logb_hammingFibreDimension {b : ℝ} (MetricCodes.hammingFibreDimension n (transverseDegree b n) : ℝ) / (n : ℝ) := by apply (div_le_div_iff_of_pos_right hnreal).2 - linarith + linarith only [hlog] have hupper : ∀ᶠ n : ℕ in atTop, Real.logb 2 @@ -6438,7 +6434,7 @@ theorem windowFibreQuotient_pos_of_fit {a b : ℝ} {n : ℕ} have hfibre : 0 < (MetricCodes.hammingFibreDimension n (transverseDegree b n) : ℝ) := by exact_mod_cast hammingFibreDimension_pos hkhalf - have haone : a ≤ 1 := by linarith + have haone : a ≤ 1 := by linarith only [ha] have hchoose : 0 < (n.choose (longitudinalDegree a n) : ℝ) := by exact_mod_cast Nat.choose_pos (longitudinalDegree_le_dimension haone n) @@ -6476,7 +6472,7 @@ theorem tendsto_logb_windowFibreQuotient {a b : ℝ} have hfibre : 0 < (MetricCodes.hammingFibreDimension n (transverseDegree b n) : ℝ) := by exact_mod_cast hammingFibreDimension_pos hkhalf - have haone : a ≤ 1 := by linarith + have haone : a ≤ 1 := by linarith only [ha] have hchoose : 0 < (n.choose (longitudinalDegree a n) : ℝ) := by exact_mod_cast Nat.choose_pos (longitudinalDegree_le_dimension haone n) @@ -6559,7 +6555,7 @@ theorem threshold_ceil_numerator_le_two {δ : ℝ} apply (div_le_iff₀ hnreal).2 exact mul_le_mul_of_nonneg_left hdreal (by norm_num) unfold threshold - linarith + linarith only [hquot] /-- The spectral gap used in the binary-code argument. -/ def spectralGap (δ a b : ℝ) : ℝ := @@ -6568,7 +6564,7 @@ def spectralGap (δ a b : ℝ) : ℝ := theorem spectralGap_pos {δ a b : ℝ} (h : Feasible δ a b) : 0 < spectralGap δ a b := by unfold spectralGap - linarith [h.2.2.2] + linarith only [h.2.2.2] theorem eventually_topEigenvalue_uniform_gap_ceil {δ a b : ℝ} (hδ : 0 ≤ δ) (h : Feasible δ a b) : @@ -6584,7 +6580,7 @@ theorem eventually_topEigenvalue_uniform_gap_ceil {δ a b : ℝ} 1 - 2 * δ + 2 * spectralGap δ a b < MetricCodes.hammingGamma a b := by unfold spectralGap - linarith + linarith only [hgamma] have heigen := eventually_topEigenvalue_gt hb hba ha hstrict have hthreshold : @@ -6592,9 +6588,9 @@ theorem eventually_topEigenvalue_uniform_gap_ceil {δ a b : ℝ} threshold n (Nat.ceil (δ * (n : ℝ))) < 1 - 2 * δ + spectralGap δ a b := (tendsto_threshold_ceil hδ).eventually - (gt_mem_nhds (by linarith)) + (gt_mem_nhds (by linarith only [hgap])) filter_upwards [heigen, hthreshold] with n he hn - linarith + linarith only [he, hn] /-- The spectral prefactor used in the binary-code argument. -/ def spectralPrefactor (δ a b : ℝ) : ℝ := @@ -6706,7 +6702,7 @@ theorem binaryRate_le_variationalRate_of_positive_feasible_bounds have hcunit : c ≤ 1 := by have hca := hfeasible'.2.1 have hahalf := hfeasible'.2.2.1 - linarith + linarith only [hca, hahalf] have hentropy : 0 ≤ MetricCodes.binaryEntropy c := MetricCodes.binaryEntropy_nonneg hc.le hcunit calc @@ -6761,7 +6757,7 @@ theorem eventually_codeNumber_le_spectralPrefactor_mul_windowFibreQuotient ∀ᶠ n : ℕ in atTop, (codeNumber n (Nat.ceil (δ * (n : ℝ))) : ℝ) ≤ spectralPrefactor δ a b * windowFibreQuotient a b n := by - have hδone : δ ≤ 1 := by linarith + have hδone : δ ≤ 1 := by linarith only [hδ'] filter_upwards [ eventually_gt_atTop (0 : ℕ), eventually_transverse_add_le_longitudinal h.1 h.2.1 1, @@ -6781,7 +6777,7 @@ theorem eventually_codeNumber_le_spectralPrefactor_mul_windowFibreQuotient topEigenvalue n (transverseDegree b n) (longitudinalDegree a n) := by have hpositive := spectralGap_pos h - linarith + linarith only [hmargin, hpositive] have hfinite := finite_bound hn hd hkL hLn hgap have hquotient : 0 ≤ windowFibreQuotient a b n := (windowFibreQuotient_pos_of_fit h.2.2.1 hkL.le).le @@ -7031,7 +7027,7 @@ theorem threshold_lt_one {n w d : ℕ} positivity unfold threshold have hfrac := div_pos hnum hden - linarith + linarith only [hfrac] theorem correlation_le_threshold {n w d : ℕ} (hw : 0 < w) (hwn : w < n) @@ -7053,7 +7049,7 @@ theorem correlation_le_threshold {n w d : ℕ} have hfrac := (div_le_div_iff_of_pos_right hden).mpr hnum unfold threshold - linarith + linarith only [hfrac] theorem correlation_le_threshold_of_code {n w d : ℕ} (hw : 0 < w) (hwn : w < n) @@ -7462,29 +7458,15 @@ theorem zonalDiagonal_eq {n w j : ℕ} exact_mod_cast hhalf have hj' : (j : ℝ) ≤ (w : ℝ) := by exact_mod_cast hj - have hsmall : (2 : ℝ) * (j : ℝ) < (n : ℝ) := by - nlinarith have hw' : (w : ℝ) ≠ 0 := by exact_mod_cast Nat.ne_of_gt hw have hN' : (n : ℝ) - (w : ℝ) ≠ 0 := by - have hwn' : (w : ℝ) < (n : ℝ) := by exact_mod_cast hwn - linarith + linarith only [hhalf'] have hJ : 0 < MetricCodes.johnsonJ n j := by unfold MetricCodes.johnsonJ - nlinarith + linarith only [hhalf', hj'] have hJone : MetricCodes.johnsonJ n j + 1 ≠ 0 := by - linarith - have hD : - (n : ℝ) * 2 - (n : ℝ) * (j : ℝ) * 4 + - (n : ℝ) ^ 2 - (j : ℝ) * 4 + (j : ℝ) ^ 2 * 4 ≠ 0 := by - have hfactor : - (n : ℝ) * 2 - (n : ℝ) * (j : ℝ) * 4 + - (n : ℝ) ^ 2 - (j : ℝ) * 4 + (j : ℝ) ^ 2 * 4 = - ((n : ℝ) - 2 * (j : ℝ)) * - ((n : ℝ) - 2 * (j : ℝ) + 2) := by - ring - rw [hfactor] - exact (mul_pos (by linarith) (by linarith)).ne' + linarith only [hJ] unfold MetricCodes.johnsonZonalDiagonal MetricCodes.johnsonDiagonal MetricCodes.johnsonMu MetricCodes.johnsonM MetricCodes.johnsonJ1 MetricCodes.johnsonJ2 @@ -7505,13 +7487,13 @@ theorem zonalDiagonal_pos {n w j : ℕ} exact_mod_cast hjw have hM : 0 < MetricCodes.johnsonM n w := by unfold MetricCodes.johnsonM - nlinarith + linarith only [hhalf'] have hJ : 0 < MetricCodes.johnsonJ n j := by unfold MetricCodes.johnsonJ - nlinarith + linarith only [hhalf', hjw'] have hN : 0 < n - w := Nat.sub_pos_of_lt hwn have hlast : 0 < (n : ℝ) - (j : ℝ) + 1 := by - nlinarith + linarith only [hhalf', hjw'] positivity theorem associatedEdge_pos {n w p q j : ℕ} @@ -8052,7 +8034,7 @@ theorem johnsonRecurrenceWeight_eigenrecurrence Real.sqrt (MetricCodes.booleanHarmonicDimension n (p + q + i.val) : ℝ)) * v i := by - ring + ac_rfl _ = (matrix n w p q L m i * Real.sqrt (MetricCodes.booleanHarmonicDimension @@ -8062,7 +8044,7 @@ theorem johnsonRecurrenceWeight_eigenrecurrence Real.sqrt (MetricCodes.booleanHarmonicDimension n (p + q + m.val) : ℝ) := by - ring + ac_rfl _ = (∑ i : Index p q L, matrix n w p q L m i * v i) * Real.sqrt @@ -8071,7 +8053,7 @@ theorem johnsonRecurrenceWeight_eigenrecurrence _ = lam * johnsonRecurrenceWeight n w p q L v m := by rw [hcoordinate] unfold johnsonRecurrenceWeight - ring + ac_rfl /-- The johnson adjacent block coefficient used in the Johnson-code argument. -/ def johnsonAdjacentBlockCoefficient @@ -8233,7 +8215,7 @@ theorem johnsonAdjacentBlockCoefficient_amplitude_identity Real.sq_sqrt hlam.le, johnsonFibreAmplitude_sq h v hv source] field_simp [hlam.ne', hsource.ne', hnormal.ne'] - nlinarith + exact (sq_eq_sq₀ hleft hright).mp hsquare theorem johnsonAdjacentBlockCoefficient_amplitude_sum {n w p q L : ℕ} (h : AdmissibleDegrees n w p q L) @@ -8362,12 +8344,10 @@ theorem sqrt_one_sub_centeredDegree_sq {u : ℝ} Real.sqrt (1 - (1 - 2 * u) ^ 2) = 2 * Real.sqrt (u * (1 - u)) := by have hvariance : 0 < u * (1 - u) := - mul_pos hu (by linarith) - have hrad : 0 ≤ 1 - (1 - 2 * u) ^ 2 := by - nlinarith - have hsquare := Real.sq_sqrt hvariance.le - apply (Real.sqrt_eq_iff_eq_sq hrad (by positivity)).mpr - nlinarith + mul_pos hu (by linarith only [hhalf]) + rw [one_sub_centered_square, Real.sqrt_mul' _ hvariance.le, + show (4 : ℝ) = (2 : ℝ) ^ 2 by norm_num, + Real.sqrt_sq (by norm_num : (0 : ℝ) ≤ 2)] theorem zero_fibre_spectral_algebra (z m s : ℝ) @@ -8382,7 +8362,7 @@ theorem zero_fibre_spectral_algebra (z ^ 2 - m ^ 2) / ((1 - m ^ 2) * (1 + 2 * s)) := by have hzsq : z ^ 2 = 1 - 4 * s ^ 2 := by - nlinarith [hsquare] + linarith only [hsquare] have hzsqne : 1 - 4 * s ^ 2 ≠ 0 := by rw [← hzsq] exact pow_ne_zero 2 hz @@ -8406,16 +8386,16 @@ theorem spectralLimit_zero_fibre_boundary {α u : ℝ} let m : ℝ := (1 - 2 * α) let s : ℝ := Real.sqrt (u * (1 - u)) have ha0 : 0 < α := lt_trans hu hua - have haone : 0 < 1 - α := by linarith - have huone : 0 < 1 - u := by linarith + have haone : 0 < 1 - α := by linarith only [ha] + have huone : 0 < 1 - u := by linarith only [hua, ha] have hvariance : 0 < u * (1 - u) := mul_pos hu huone have hz : z ≠ 0 := by dsimp [z] - nlinarith + linarith only [hua, ha] have hm : 1 - m ^ 2 ≠ 0 := by - have hprod : 0 < α * (1 - α) := mul_pos ha0 haone dsimp [m] - nlinarith + rw [one_sub_centered_square] + exact mul_ne_zero (by norm_num) (mul_pos ha0 haone).ne' have hs : s ≠ 0 := by dsimp [s] exact (Real.sqrt_pos.mpr hvariance).ne' @@ -8423,11 +8403,10 @@ theorem spectralLimit_zero_fibre_boundary {α u : ℝ} have hsnonneg : 0 ≤ s := by dsimp [s] exact Real.sqrt_nonneg _ - nlinarith + linarith only [hsnonneg] have hsquare : 4 * s ^ 2 = 1 - z ^ 2 := by - have hsqrt := Real.sq_sqrt hvariance.le dsimp [s, z] - nlinarith + rw [one_sub_centered_square, Real.sq_sqrt hvariance.le] have hradical : Real.sqrt (1 - z ^ 2) = 2 * s := by simpa only using sqrt_one_sub_centeredDegree_sq hu (lt_trans hua ha) have hsig : (1 - 2 * 0 - 2 * 0 : ℝ) = 1 := by @@ -8459,16 +8438,6 @@ theorem spectralLimit_zero_fibre_boundary {α u : ℝ} ((z ^ 2 - m ^ 2) * (1 - z ^ 2)) / (z ^ 2 * (1 - m ^ 2) * Real.sqrt (1 - z ^ 2)) = _ rw [hradical] - have hA : α * (1 - α) ≠ 0 := - (mul_pos ha0 haone).ne' - have hfourA : α * 4 - α ^ 2 * 4 ≠ 0 := by - have hp : 0 < α * (1 - α) := mul_pos ha0 haone - nlinarith - have hmraw : 1 - (1 - 2 * α) ^ 2 ≠ 0 := by - simpa [m] using hm - have hplusraw : - 1 + 2 * Real.sqrt (u * (1 - u)) ≠ 0 := by - simpa only [ne_eq] using hplus calc 1 - spectralLimit α 0 0 u = (z ^ 2 - m ^ 2) / @@ -8479,7 +8448,8 @@ theorem spectralLimit_zero_fibre_boundary {α u : ℝ} (α * (1 - α) * (1 + 2 * Real.sqrt (u * (1 - u)))) := by dsimp [z, m, s] - field_simp [hmraw, hA, hfourA, hplusraw]; ring + rw [centered_square_difference, one_sub_centered_square, + mul_assoc, mul_div_mul_left _ _ (by norm_num : (4 : ℝ) ≠ 0)] /-- The asymptotic threshold used in the Johnson-code argument. -/ def asymptoticThreshold (δ α : ℝ) : ℝ := @@ -8527,32 +8497,31 @@ variable {δ α β γ u : ℝ} theorem weight_pos (h : AsymptoticParameters δ α β γ u) : 0 < α := by - nlinarith [h.distance_pos, h.weight_gt_distance] + linarith only [h.distance_pos, h.weight_gt_distance] theorem weight_complement_pos (h : AsymptoticParameters δ α β γ u) : 0 < 1 - α := by - nlinarith [h.weight_lt_half] + linarith only [h.weight_lt_half] theorem degree_pos (h : AsymptoticParameters δ α β γ u) : 0 < u := by - nlinarith [h.support_nonneg, h.complement_nonneg, - h.first_lt_degree] + linarith only [h.support_nonneg, h.complement_nonneg, h.first_lt_degree] theorem centeredDegree_pos (h : AsymptoticParameters δ α β γ u) : 0 < (1 - 2 * u) := by - nlinarith [h.degree_lt_weight, h.weight_lt_half] + linarith only [h.degree_lt_weight, h.weight_lt_half] theorem centeredWeight_pos (h : AsymptoticParameters δ α β γ u) : 0 < (1 - 2 * α) := by - nlinarith [h.weight_lt_half] + linarith only [h.weight_lt_half] theorem centeredSigma_gt_degree (h : AsymptoticParameters δ α β γ u) : (1 - 2 * u) < (1 - 2 * β - 2 * γ) := by - nlinarith [h.first_lt_degree] + linarith only [h.first_lt_degree] theorem centeredSigma_pos (h : AsymptoticParameters δ α β γ u) : @@ -8563,28 +8532,28 @@ theorem centeredEta_lt_degree (h : AsymptoticParameters δ α β γ u) : centeredEta α β γ < (1 - 2 * u) := by unfold centeredEta - nlinarith [h.degree_lt_left] + linarith only [h.degree_lt_left] theorem neg_degree_lt_centeredEta (h : AsymptoticParameters δ α β γ u) : -(1 - 2 * u) < centeredEta α β γ := by unfold centeredEta - nlinarith [h.degree_lt_right] + linarith only [h.degree_lt_right] theorem one_sub_centeredWeight_sq_pos (h : AsymptoticParameters δ α β γ u) : 0 < 1 - (1 - 2 * α) ^ 2 := by have hprod : 0 < α * (1 - α) := mul_pos h.weight_pos h.weight_complement_pos - nlinarith + linarith only [hprod] theorem one_sub_centeredDegree_sq_pos (h : AsymptoticParameters δ α β γ u) : 0 < 1 - (1 - 2 * u) ^ 2 := by have huone : 0 < 1 - u := by - nlinarith [h.degree_lt_weight, h.weight_lt_half] + linarith only [h.degree_lt_weight, h.weight_lt_half] have hprod : 0 < u * (1 - u) := mul_pos h.degree_pos huone - nlinarith + linarith only [hprod] theorem degree_sq_sub_eta_sq_pos (h : AsymptoticParameters δ α β γ u) : @@ -8592,8 +8561,9 @@ theorem degree_sq_sub_eta_sq_pos have hleft : 0 < (1 - 2 * u) - centeredEta α β γ := sub_pos.mpr h.centeredEta_lt_degree have hright : 0 < (1 - 2 * u) + centeredEta α β γ := by - linarith [h.neg_degree_lt_centeredEta] - nlinarith [mul_pos hleft hright] + linarith only [h.neg_degree_lt_centeredEta] + rw [sq_sub_sq] + exact mul_pos hright hleft theorem sigma_sq_sub_degree_sq_pos (h : AsymptoticParameters δ α β γ u) : @@ -8602,7 +8572,8 @@ theorem sigma_sq_sub_degree_sq_pos sub_pos.mpr h.centeredSigma_gt_degree have hright : 0 < (1 - 2 * β - 2 * γ) + (1 - 2 * u) := add_pos h.centeredSigma_pos h.centeredDegree_pos - nlinarith [mul_pos hleft hright] + rw [sq_sub_sq] + exact mul_pos hright hleft theorem rankPenalty_le_one (h : AsymptoticParameters δ α β γ u) : @@ -8613,17 +8584,17 @@ theorem rankPenalty_le_one (binaryEntropy_le_one (γ / (1 - α))) h.weight_complement_pos.le unfold rankPenalty - nlinarith + linarith only [hsupport, hcomplement] theorem shellRate_lower (h : AsymptoticParameters δ α β γ u) : -1 ≤ shellRate α β γ u := by have hαentropy := binaryEntropy_le_one α have huone : u ≤ 1 := by - nlinarith [h.degree_lt_weight, h.weight_lt_half] + linarith only [h.degree_lt_weight, h.weight_lt_half] have huentropy := MetricCodes.binaryEntropy_nonneg h.degree_pos.le huone unfold shellRate - nlinarith [h.rankPenalty_le_one] + linarith only [hαentropy, huentropy, h.rankPenalty_le_one] end AsymptoticParameters @@ -8681,13 +8652,13 @@ theorem mrrwG_continuous : Continuous mrrwG := by theorem mrrwG_nonneg {v : ℝ} (hv : 0 ≤ v) : 0 ≤ mrrwG v := by have hroot : Real.sqrt (1 - v) ≤ 1 := - Real.sqrt_le_one.mpr (by linarith) + Real.sqrt_le_one.mpr (by linarith only [hv]) have hroot' : 0 ≤ Real.sqrt (1 - v) := Real.sqrt_nonneg _ unfold mrrwG apply MetricCodes.binaryEntropy_nonneg - · linarith - · linarith + · linarith only [hroot] + · linarith only [hroot'] /-- The mrrw objective used in the Johnson-code argument. -/ def mrrwObjective (δ r : ℝ) : ℝ := @@ -8738,7 +8709,7 @@ theorem mrrwG_variance {u : ℝ} ring have hroot : Real.sqrt (1 - 4 * u * (1 - u)) = 1 - 2 * u := by - rw [hrad, Real.sqrt_sq (by linarith)] + rw [hrad, Real.sqrt_sq (by linarith only [hu])] unfold mrrwG rw [hroot] congr 1 @@ -8753,14 +8724,14 @@ theorem zero_fibre_boundary_variance {δ α u : ℝ} (2 * Real.sqrt (u * (1 - u))) ^ 2 + 2 * δ * (2 * Real.sqrt (u * (1 - u))) + 2 * δ := by have hα : 0 < α := lt_trans hu hua - have hαone : 0 < 1 - α := by linarith - have huone : 0 < 1 - u := by linarith + have hαone : 0 < 1 - α := by linarith only [ha] + have huone : 0 < 1 - u := by linarith only [hua, ha] have hA : α * (1 - α) ≠ 0 := (mul_pos hα hαone).ne' have hs : 0 ≤ Real.sqrt (u * (1 - u)) := Real.sqrt_nonneg _ have hplus : 1 + 2 * Real.sqrt (u * (1 - u)) ≠ 0 := by - nlinarith + linarith only [hs] have hrel : δ / (2 * α * (1 - α)) = (α * (1 - α) - u * (1 - u)) / @@ -8775,7 +8746,7 @@ theorem zero_fibre_boundary_variance {δ α u : ℝ} _ = _ := spectralLimit_zero_fibre_boundary hu hua ha have hsquare := Real.sq_sqrt (mul_pos hu huone).le field_simp [hA, hα.ne', hαone.ne', hplus] at hrel - nlinarith [hsquare] + linarith only [hrel, hsquare] theorem mrrwObjective_zero_fibre_boundary {δ α u : ℝ} (hu : 0 < u) (hua : u < α) @@ -8784,22 +8755,22 @@ theorem mrrwObjective_zero_fibre_boundary {δ α u : ℝ} spectralLimit α 0 0 u = asymptoticThreshold δ α) : mrrwObjective δ (2 * Real.sqrt (u * (1 - u))) = shellRate α 0 0 u := by - have huone : 0 < 1 - u := by linarith + have huone : 0 < 1 - u := by linarith only [hua, ha] have hsquare := Real.sq_sqrt (mul_pos hu huone).le have hvariance : (2 * Real.sqrt (u * (1 - u))) ^ 2 = 4 * u * (1 - u) := by - nlinarith [hsquare] + linarith only [hsquare] have hboundary' := zero_fibre_boundary_variance hu hua ha hboundary have hargument : 4 * u * (1 - u) + 2 * δ * (2 * Real.sqrt (u * (1 - u))) + 2 * δ = 4 * α * (1 - α) := by - nlinarith [hboundary', hvariance] + linarith only [hboundary', hvariance] unfold mrrwObjective rw [hvariance, hargument, - mrrwG_variance (by linarith : u ≤ (1 : ℝ) / 2), + mrrwG_variance (by linarith only [hua, ha] : u ≤ (1 : ℝ) / 2), mrrwG_variance ha.le, shellRate_zero_fibre] ring @@ -8818,7 +8789,7 @@ theorem mrrwRateSet_bddBelow (δ : ℝ) : unfold mrrwG exact binaryEntropy_le_one _ unfold mrrwObjective - linarith + linarith only [hfirst, hsecond] /-- The mrrw rate used in the Johnson-code argument. -/ def mrrwRate (δ : ℝ) : ℝ := @@ -8839,7 +8810,7 @@ theorem exists_mrrw_minimizer {δ : ℝ} refine ⟨0, ?_⟩ constructor · exact le_rfl - · linarith + · linarith only [hhalf] obtain ⟨r, hr, hmin⟩ := isCompact_Icc.exists_isMinOn hnonempty (mrrwObjective_continuous δ).continuousOn @@ -8865,7 +8836,7 @@ theorem mrrwRate_le_classicalRate {δ : ℝ} mrrwRate δ ≤ MetricCodes.Hamming.classicalRate δ := by calc mrrwRate δ ≤ mrrwObjective δ (1 - 2 * δ) := - mrrwRate_le_objective (by linarith) (le_refl _) + mrrwRate_le_objective (by linarith only [hhalf]) (le_refl _) _ = MetricCodes.Hamming.classicalRate δ := mrrwObjective_endpoint hδ hhalf diff --git a/LeanPool/MetricCodes/HarmonicAnalysis.lean b/LeanPool/MetricCodes/HarmonicAnalysis.lean index 56ac018d8..04dab16d8 100644 --- a/LeanPool/MetricCodes/HarmonicAnalysis.lean +++ b/LeanPool/MetricCodes/HarmonicAnalysis.lean @@ -103,16 +103,20 @@ theorem sphericalCodeNumber_lt_top {n : ℕ} {s : ℝ} have hinner : sphericalInner u v ≤ s := C.inner_le hu hv huv have hsq : 2 * (1 - s) ≤ dist (u : Ambient n) (v : Ambient n) ^ 2 := by rw [dist_eq_norm, spherical_dist_sq] - nlinarith + linarith only [hinner] have hsqrt : 0 < Real.sqrt (2 * (1 - s)) := by positivity have hsqrt_sq : Real.sqrt (2 * (1 - s)) ^ 2 = 2 * (1 - s) := - Real.sq_sqrt (by nlinarith) + Real.sq_sqrt (by linarith only [hs]) have hreal : ((2 * ε : NNReal) : ℝ) < dist (u : Ambient n) (v : Ambient n) := by change 2 * (Real.sqrt (2 * (1 - s)) / 4) < dist (u : Ambient n) (v : Ambient n) - nlinarith [show 0 ≤ dist (u : Ambient n) (v : Ambient n) from dist_nonneg] + nlinarith only [ + hsq, + hsqrt_sq, + hsqrt, + show 0 ≤ dist (u : Ambient n) (v : Ambient n) from dist_nonneg] calc (↑(2 * ε) : ENNReal) = ENNReal.ofReal (((2 * ε : NNReal) : ℝ)) := @@ -144,22 +148,22 @@ theorem sphericalEntropy_pos {u : ℝ} (hu : 0 < u) : 0 < sphericalEntropy u := by rw [sphericalEntropy_eq_log_add hu] have hfirst : 0 < Real.logb 2 (1 + u) := - Real.logb_pos (by norm_num : (1 : ℝ) < 2) (by linarith) + Real.logb_pos (by norm_num : (1 : ℝ) < 2) (by linarith only [hu]) have hratio : 1 < (1 + u) / u := by apply (lt_div_iff₀ hu).2 - linarith + linarith only [] have hsecond : 0 < Real.logb 2 ((1 + u) / u) := Real.logb_pos (by norm_num : (1 : ℝ) < 2) hratio - nlinarith + nlinarith only [hfirst, hu, hsecond] theorem Gamma_pos {a b : ℝ} (hb : 0 ≤ b) (hab : b < a) : 0 < Gamma a b := by have ha : 0 < a := lt_of_le_of_lt hb hab unfold Gamma apply div_pos - · exact mul_pos (sub_pos.mpr hab) (by linarith) - · exact mul_pos (by linarith) - (Real.sqrt_pos.2 (mul_pos ha (by linarith))) + · exact mul_pos (sub_pos.mpr hab) (by linarith only [hb, hab]) + · exact mul_pos (by linarith only [hb, hab]) + (Real.sqrt_pos.2 (mul_pos ha (by linarith only [hb, hab]))) /-- The harmonic dimension used in the metric-code argument. -/ def harmonicDimension (n : ℕ) : ℕ → ℕ @@ -277,7 +281,7 @@ theorem finite_linear_programming_bound {α : Type*} · have hcard : 0 < (C.card : ℝ) := by exact_mod_cast Nat.pos_of_ne_zero hC apply (le_div_iff₀ hc).2 - nlinarith [hpositive, hsum] + nlinarith only [hcard, hpositive, hsum] /-- The polynomial laplacian used in the spherical-code argument. -/ def polynomialLaplacian (n : ℕ) : @@ -481,7 +485,7 @@ theorem recurrenceDenominator_pos {n i : ℕ} have hn' : (2 : ℝ) ≤ n := by exact_mod_cast hn have hi' : (0 : ℝ) < i := by exact_mod_cast hi unfold recurrenceDenominator - linarith + linarith only [hn', hi'] theorem forwardCoefficient_pos {n i : ℕ} (hn : 2 ≤ n) (hi : 0 < i) : 0 < forwardCoefficient n i := by @@ -489,7 +493,7 @@ theorem forwardCoefficient_pos {n i : ℕ} have hi' : (0 : ℝ) < i := by exact_mod_cast hi unfold forwardCoefficient apply div_pos - · linarith + · linarith only [hn', hi'] · exact recurrenceDenominator_pos hn hi theorem backwardCoefficient_pos {n i : ℕ} @@ -638,8 +642,6 @@ theorem alphaSq_pos {n k i : ℕ} (hn : 3 ≤ n) (hki : k ≤ i) : 0 < alphaSq n k i := by have hn' : (3 : ℝ) ≤ n := by exact_mod_cast hn have hki' : (k : ℝ) ≤ i := by exact_mod_cast hki - have hi' : (0 : ℝ) ≤ i := Nat.cast_nonneg i - have hk' : (0 : ℝ) ≤ k := Nat.cast_nonneg k unfold alphaSq apply div_pos · apply mul_pos <;> linarith @@ -649,16 +651,14 @@ theorem jacobiCoefficient_pos {n k i : ℕ} (hn : 3 ≤ n) (hki : k ≤ i) : 0 < jacobiCoefficient n k i := by have hn' : (3 : ℝ) ≤ n := by exact_mod_cast hn have hki' : (k : ℝ) ≤ i := by exact_mod_cast hki - have hi' : (0 : ℝ) ≤ i := Nat.cast_nonneg i - have hk' : (0 : ℝ) ≤ k := Nat.cast_nonneg k unfold jacobiCoefficient apply div_pos · apply mul_pos <;> linarith · apply Real.sqrt_pos.2 - have h₁ : 0 < (i : ℝ) + 1 := by linarith - have h₂ : 0 < (i : ℝ) + (n : ℝ) - 2 := by linarith - have h₃ : 0 < 2 * (i : ℝ) + (n : ℝ) - 2 := by linarith - have h₄ : 0 < 2 * (i : ℝ) + (n : ℝ) := by linarith + have h₁ : 0 < (i : ℝ) + 1 := by linarith only [] + have h₂ : 0 < (i : ℝ) + (n : ℝ) - 2 := by linarith only [hn'] + have h₃ : 0 < 2 * (i : ℝ) + (n : ℝ) - 2 := by linarith only [hn'] + have h₄ : 0 < 2 * (i : ℝ) + (n : ℝ) := by linarith only [hn'] exact mul_pos (mul_pos (mul_pos h₁ h₂) h₃) h₄ /-- The symmetric tridiagonal matrix with Gegenbauer Jacobi coefficients between adjacent @@ -761,7 +761,7 @@ theorem directionalDerivative_mul smul_add] using h _ = directionalDerivative n x p * q + p * directionalDerivative n x q := by - ring + ac_rfl /-- The axis polynomial used in the spherical-code argument. -/ def axisPolynomial (n : ℕ) (x : Euclidean n) : @@ -1073,7 +1073,7 @@ theorem polynomialInner_comm (n : ℕ) rw [Finset.union_comm] apply Finset.sum_congr rfl intro a ha - ring + ac_rfl _ = ∑ a ∈ q.support, multiFactorial a * q.coeff a * p.coeff a := by @@ -1141,7 +1141,7 @@ theorem polynomialInner_smul_left (n : ℕ) (c : ℝ) change multiFactorial a * (c * d) * q.coeff a = c * (multiFactorial a * d * q.coeff a) - ring + ac_rfl | add p q hp hq => rw [smul_add, polynomialInner_add_left, polynomialInner_add_left, hp, hq] @@ -1156,7 +1156,7 @@ theorem polynomialInner_smul_right (n : ℕ) (c : ℝ) rw [Finset.mul_sum] apply Finset.sum_congr rfl intro a ha - ring + ac_rfl theorem polynomialInner_sum_left {ι : Type*} (n : ℕ) (s : Finset ι) (f : ι → MvPolynomial (Fin n) ℝ) @@ -1203,7 +1203,7 @@ theorem polynomialInner_X_mul (n : ℕ) (i : Fin n) rw [hmono, polynomialInner_monomial, polynomialInner_monomial, coeff_pderiv, hshift, multiFactorial_add_single] - ring + ac_rfl | add p q hp hq => rw [mul_add, polynomialInner_add_left, polynomialInner_add_left, hp, hq] @@ -1261,7 +1261,7 @@ theorem polynomialInner_axis_directional (n : ℕ) congr 1 apply Finset.sum_congr rfl intro i hi - ring + ac_rfl _ = ∑ i : Fin n, polynomialInner n (MvPolynomial.C (x i) * @@ -2100,7 +2100,7 @@ theorem polynomialLaplacian_radialPolynomial (n : ℕ) : MvPolynomial.pderiv_X, Pi.single_eq_same, smul_eq_mul, mul_one, MvPolynomial.derivation_C, mul_zero, add_zero, Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul, MvPolynomial.C_mul, map_natCast] - ring + ac_rfl theorem polynomialLaplacian_mul {n : ℕ} (p q : MvPolynomial (Fin n) ℝ) : @@ -2152,7 +2152,7 @@ theorem polynomialLaplacian_radial_mul {n m : ℕ} rw [Finset.mul_sum] apply Finset.sum_congr rfl intro i hi - ring + ac_rfl _ = _ := by rw [heuler] rw [polynomialLaplacian_mul, polynomialLaplacian_radialPolynomial] @@ -2202,7 +2202,7 @@ theorem directionalDerivative_radialPolynomial apply Finset.sum_congr rfl intro i hi rw [← MvPolynomial.C_mul'] - ring + ac_rfl _ = 2 * axisPolynomial n x := rfl theorem directionalDerivative_radial_mul @@ -2325,17 +2325,7 @@ theorem fischer_harmonicInner_eq_polynomialInner Fischer.polynomialInner n (p : MvPolynomial (Fin n) ℝ) (q : MvPolynomial (Fin n) ℝ) := by - change - Fischer.homogeneousInner n k - (Submodule.inclusion - (show harmonicHomogeneousSubmodule n k ≤ - MvPolynomial.homogeneousSubmodule (Fin n) ℝ k from - inf_le_left) p) - (Submodule.inclusion - (show harmonicHomogeneousSubmodule n k ≤ - MvPolynomial.homogeneousSubmodule (Fin n) ℝ k from - inf_le_left) q) = _ - exact Fischer.homogeneousInner_eq_polynomialInner n k _ _ + exact @Fischer.harmonicInner_eq_polynomialInner n k p q theorem fischer_harmonicInner_self_nonneg (n k : ℕ) (p : harmonicHomogeneousSubmodule n k) : @@ -2416,14 +2406,7 @@ theorem polynomialLaplacian_axis_mul_for_tangent polynomialLaplacian n (axisPolynomial n x * p) = 2 * directionalDerivative n x p + axisPolynomial n x * polynomialLaplacian n p := by - rw [polynomialLaplacian_mul, - polynomialLaplacian_axisPolynomial] - simp only [zero_mul, zero_add, pderiv_axisPolynomial] - rw [directionalDerivative_apply] - congr 2 - apply Finset.sum_congr rfl - intro i hi - exact MvPolynomial.C_mul' + exact @solidHarmonicAxis_polynomialLaplacian_axis_mul n x p /-- The denominator `2 * k + n` used to remove the radial part of an axis projection. -/ def harmonicAxisProjectionDenominator (n k : ℕ) : ℝ := @@ -2658,17 +2641,16 @@ theorem harmonicAxisProjection_correction_nonneg 0 ≤ 1 - 2 * (harmonicAxisProjectionDenominator n k)⁻¹ := by have hnreal : (2 : ℝ) ≤ (n : ℝ) := by exact_mod_cast hn - have hkreal : 0 ≤ (k : ℝ) := by positivity have hden : (2 : ℝ) ≤ harmonicAxisProjectionDenominator n k := by unfold harmonicAxisProjectionDenominator - nlinarith + linarith only [hnreal] have hpos := harmonicAxisProjectionDenominator_pos (show 0 < n by omega) k apply sub_nonneg.mpr rw [← div_eq_mul_inv] apply (div_le_iff₀ hpos).mpr - nlinarith + linarith only [hden] theorem harmonicAxisLift_injective {n : ℕ} (hn : 2 ≤ n) (k : ℕ) @@ -3009,30 +2991,30 @@ def boundaryDegree (s a : ℝ) : ℝ := theorem spectral_iff_quadratic {s a b : ℝ} (ha : 0 < a) : s < 2 * MetricCodes.Gamma a b ↔ b * (1 + b) < boundaryQuadratic s a := by - have hrad : 0 < a * (1 + a) := mul_pos ha (by linarith) + have hrad : 0 < a * (1 + a) := mul_pos ha (by linarith only [ha]) have hden : 0 < (1 + 2 * a) * Real.sqrt (a * (1 + a)) := - mul_pos (by linarith) (Real.sqrt_pos.2 hrad) + mul_pos (by linarith only [ha]) (Real.sqrt_pos.2 hrad) rw [MetricCodes.Gamma_eq_sub, ← mul_div_assoc, lt_div_iff₀ hden] unfold boundaryQuadratic - constructor <;> intro h <;> nlinarith + constructor <;> intro h <;> linarith only [h] theorem boundaryDegree_pos {s a : ℝ} (hQ : 0 < boundaryQuadratic s a) : 0 < boundaryDegree s a := by - have hrad : 0 ≤ 1 + 4 * boundaryQuadratic s a := by linarith + have hrad : 0 ≤ 1 + 4 * boundaryQuadratic s a := by linarith only [hQ] have hsquare := Real.sq_sqrt hrad have hsqrt := Real.sqrt_nonneg (1 + 4 * boundaryQuadratic s a) unfold boundaryDegree - nlinarith + nlinarith only [hQ, hsquare, hsqrt] theorem boundaryDegree_mul_one_add {s a : ℝ} (hQ : 0 ≤ boundaryQuadratic s a) : boundaryDegree s a * (1 + boundaryDegree s a) = boundaryQuadratic s a := by - have hrad : 0 ≤ 1 + 4 * boundaryQuadratic s a := by linarith + have hrad : 0 ≤ 1 + 4 * boundaryQuadratic s a := by linarith only [hQ] have hsquare := Real.sq_sqrt hrad unfold boundaryDegree - nlinarith + linarith only [hsquare] theorem quadratic_iff_boundaryDegree {s a b : ℝ} (hb : 0 ≤ b) (hQ : 0 < boundaryQuadratic s a) : @@ -3042,10 +3024,9 @@ theorem quadratic_iff_boundaryDegree {s a b : ℝ} constructor · intro h by_contra hnot - have hge : boundaryDegree s a ≤ b := le_of_not_gt hnot - nlinarith [sq_nonneg (b - boundaryDegree s a)] + nlinarith only [hroot, h, hnot, hpositive] · intro h - nlinarith [sq_nonneg (b - boundaryDegree s a)] + nlinarith only [hroot, h, hb] end @@ -3108,15 +3089,11 @@ theorem Phi_oneRow (a b : ℝ) : theorem spectralAtom_lt_half {u : ℝ} (hu : 0 ≤ u) : spectralAtom u < (1 / 2 : ℝ) := by have hrad : 0 ≤ u * (1 + u) := by positivity - have hroot : 0 ≤ Real.sqrt (u * (1 + u)) := Real.sqrt_nonneg _ have hlinear : 0 < 1 + 2 * u := by positivity have hsquare := Real.sq_sqrt hrad - have hgap : - (2 * Real.sqrt (u * (1 + u))) ^ 2 < (1 + 2 * u) ^ 2 := by - nlinarith unfold spectralAtom apply (div_lt_iff₀ hlinear).mpr - nlinarith + nlinarith only [hsquare, hu] theorem Interlacing.Gamma_nonneg {r : ℕ} {a : Fin (r + 1) → ℝ} {b : Fin r → ℝ} @@ -3334,13 +3311,7 @@ open scoped BigOperators Nat Topology theorem tendsto_natCast_div_self : Tendsto (fun n : ℕ => (n : ℝ) / (n : ℝ)) atTop (nhds 1) := by - have heq : - (fun _ : ℕ => (1 : ℝ)) =ᶠ[atTop] - (fun n : ℕ => (n : ℝ) / (n : ℝ)) := by - filter_upwards [eventually_ne_atTop (0 : ℕ)] with n hn - have hn' : (n : ℝ) ≠ 0 := by exact_mod_cast hn - exact (div_self hn').symm - exact tendsto_const_nhds.congr' heq + exact MetricCodes.Johnson.Asymptotics.tendsto_dimension_ratio theorem tendsto_nat_succ_cast_div : Tendsto (fun n : ℕ => ((n + 1 : ℕ) : ℝ) / (n : ℝ)) @@ -4187,7 +4158,7 @@ theorem finiteGramFibreAmplitudeVector_unit simpa only [finiteGramFibreAmplitudeVector] using finiteGramFibreAmplitude_sq_sum hn k L v hunit hv rw [← EuclideanSpace.real_norm_sq_eq] at hsum - nlinarith [norm_nonneg (finiteGramFibreAmplitudeVector n k L v)] + nlinarith only [hsum, norm_nonneg (finiteGramFibreAmplitudeVector n k L v)] /-- Data encoding the finite gram certificate construction. -/ structure FiniteGramCertificate (n k L : ℕ) where @@ -4314,7 +4285,7 @@ theorem finiteGramCertificate_shift_identity rw [certificate.lift_kernel x hx y hy, certificate.bulk_kernel x hx y hy, certificate.spectralCoefficient_sq] at hdecomp - linarith + linarith only [hdecomp] theorem isometricPackingKernel_nonneg {n k L : ℕ} @@ -4450,7 +4421,7 @@ theorem finiteGramCertificate_sphericalCode_bound ∑ x ∈ C.points, ∑ y ∈ C.points, isometricPackingKernel certificate.fibre x y := by apply (div_le_iff₀ hD).2 - nlinarith [htrace] + linarith only [htrace] have hpositive : (C.points.card : ℝ) ^ 2 * ((Jacobi.topEigenvalue n k L - s) * @@ -5128,7 +5099,7 @@ theorem solidHarmonicAxisFischerScale_succ ((r : ℝ) + 1) * ((r : ℝ) + harmonicAxisParameter n k - 2) := by simp only [solidHarmonicAxisFischerScale, Finset.prod_range_succ] - ring + ac_rfl theorem solidHarmonicAxisFischerScale_pos {n : ℕ} (hn : 3 ≤ n) (k r : ℕ) : @@ -5137,17 +5108,15 @@ theorem solidHarmonicAxisFischerScale_pos apply Finset.prod_pos intro j hj have hnreal : (3 : ℝ) ≤ (n : ℝ) := by exact_mod_cast hn - have hjreal : (0 : ℝ) ≤ (j : ℝ) := by positivity - have hkreal : (0 : ℝ) ≤ (k : ℝ) := by positivity have hfirst : 0 < 2 * (j : ℝ) + harmonicAxisParameter n k - 2 := by unfold harmonicAxisParameter - linarith + linarith only [hnreal] have hmiddle : 0 < (j : ℝ) + 1 := by positivity have hlast : 0 < (j : ℝ) + harmonicAxisParameter n k - 2 := by unfold harmonicAxisParameter - linarith + linarith only [hnreal] exact mul_pos (mul_pos hfirst hmiddle) hlast theorem fischer_polynomialInner_constant_mul_left @@ -5254,7 +5223,7 @@ theorem solidHarmonicAxisLift_fischer_inner | succ r ihr => rw [solidHarmonicAxisLift_fischer_inner_succ x hx p q r, ihr, solidHarmonicAxisFischerScale_succ] - ring + ac_rfl /-- The solid harmonic axis lift restricted from tangent harmonics to the target harmonic degree. -/ @@ -5472,7 +5441,7 @@ theorem positiveRadicalSymmetrization have hright : 0 ≤ (r / Real.sqrt (a * b * p * q)) * Real.sqrt e := by positivity - nlinarith + nlinarith only [hsquare, hleft, hright] theorem alphaSq_sqrt_harmonicDimension {n k i : ℕ} (hn : 3 ≤ n) (hki : k ≤ i) : @@ -5481,7 +5450,6 @@ theorem alphaSq_sqrt_harmonicDimension Gegenbauer.jacobiCoefficient n k i * Real.sqrt (Gegenbauer.harmonicDimension n (i + 1) : ℝ) := by have hnreal : (3 : ℝ) ≤ n := by exact_mod_cast hn - have hireal : (0 : ℝ) ≤ i := Nat.cast_nonneg _ have hkreal : (k : ℝ) ≤ i := by exact_mod_cast hki have hd : (0 : ℝ) < Gegenbauer.harmonicDimension n i := by exact_mod_cast @@ -5490,12 +5458,11 @@ theorem alphaSq_sqrt_harmonicDimension exact_mod_cast Gegenbauer.harmonicDimension_pos (by omega : 2 ≤ n) (i + 1) have ha : 0 < (i : ℝ) + 1 := by positivity - have hb : 0 < (i : ℝ) + n - 2 := by linarith - have hp : 0 < 2 * (i : ℝ) + n - 2 := by linarith - have hq : 0 < 2 * (i : ℝ) + n := by linarith + have hb : 0 < (i : ℝ) + n - 2 := by linarith only [hnreal] + have hp : 0 < 2 * (i : ℝ) + n - 2 := by linarith only [hnreal] + have hq : 0 < 2 * (i : ℝ) + n := by linarith only [hnreal] have hr : 0 ≤ ((i : ℝ) - k + 1) * ((i : ℝ) + k + n - 2) := by - have hkzero : (0 : ℝ) ≤ k := Nat.cast_nonneg _ exact mul_nonneg (by linarith) (by linarith) have hcross0 := JacobiSymmetrization.harmonicDimension_cross_mul hn i @@ -5519,7 +5486,6 @@ theorem betaSq_sqrt_harmonicDimension Gegenbauer.jacobiCoefficient n k i * Real.sqrt (Gegenbauer.harmonicDimension n i : ℝ) := by have hnreal : (3 : ℝ) ≤ n := by exact_mod_cast hn - have hireal : (0 : ℝ) ≤ i := Nat.cast_nonneg _ have hkreal : (k : ℝ) ≤ i := by exact_mod_cast hki have hd : (0 : ℝ) < Gegenbauer.harmonicDimension n i := by exact_mod_cast @@ -5528,12 +5494,11 @@ theorem betaSq_sqrt_harmonicDimension exact_mod_cast Gegenbauer.harmonicDimension_pos (by omega : 2 ≤ n) (i + 1) have ha : 0 < (i : ℝ) + 1 := by positivity - have hb : 0 < (i : ℝ) + n - 2 := by linarith - have hp : 0 < 2 * (i : ℝ) + n - 2 := by linarith - have hq : 0 < 2 * (i : ℝ) + n := by linarith + have hb : 0 < (i : ℝ) + n - 2 := by linarith only [hnreal] + have hp : 0 < 2 * (i : ℝ) + n - 2 := by linarith only [hnreal] + have hq : 0 < 2 * (i : ℝ) + n := by linarith only [hnreal] have hr : 0 ≤ ((i : ℝ) - k + 1) * ((i : ℝ) + k + n - 2) := by - have hkzero : (0 : ℝ) ≤ k := Nat.cast_nonneg _ exact mul_nonneg (by linarith) (by linarith) have hcross0 := JacobiSymmetrization.harmonicDimension_cross_mul hn i @@ -5620,7 +5585,7 @@ theorem finiteGramRecurrenceWeight_eigenrecurrence (sourceChannelCoefficient n k L m i * Real.sqrt (Gegenbauer.harmonicDimension n (k + i.val) : ℝ)) * v i := by - ring + ac_rfl _ = (Gegenbauer.jacobiMatrix n k L m i * Real.sqrt (Gegenbauer.harmonicDimension n (k + m.val) : ℝ)) * @@ -5629,7 +5594,7 @@ theorem finiteGramRecurrenceWeight_eigenrecurrence _ = (Gegenbauer.jacobiMatrix n k L m i * v i) * Real.sqrt (Gegenbauer.harmonicDimension n (k + m.val) : ℝ) := by - ring + ac_rfl _ = (∑ i : Jacobi.Index k L, Gegenbauer.jacobiMatrix n k L m i * v i) * Real.sqrt @@ -5638,7 +5603,7 @@ theorem finiteGramRecurrenceWeight_eigenrecurrence _ = eigenvalue * finiteGramRecurrenceWeight n k L v m := by rw [hcoordinate] unfold finiteGramRecurrenceWeight - ring + ac_rfl theorem jacobiMatrix_adjacent_pos {n k L : ℕ} (hn : 3 ≤ n) @@ -5937,7 +5902,7 @@ theorem sourceChannelCoefficient_nonneg (Gegenbauer.harmonicDimension n (k + i.val) : ℝ) := by rw [← hsource] exact mul_nonneg hmatrix (Real.sqrt_nonneg _) - nlinarith + nlinarith only [hproduct, hdimension] /-- The adjacent-block amplitude normalized by Perron recurrence weights and the top Jacobi eigenvalue. -/ @@ -6070,7 +6035,7 @@ theorem sourceAdjacentBlockCoefficient_amplitude_identity HarmonicCertificateAssembly.harmonicFibreAmplitudes_sq n k L hn source] field_simp [heigen.ne', hsource.ne', hnormal.ne'] - nlinarith + nlinarith only [hsquare, hleft, hright] theorem sourceAdjacentBlockCoefficient_amplitude_sum {n k L : ℕ} (hn : 3 ≤ n) (hkl : k < L) @@ -6529,7 +6494,7 @@ theorem sourceAdjacentChannel_inner_degreeAxisTensor (degreeFibre target x u)), adjacent.axis_projection x hx target source u, real_inner_smul_right] - ring + ac_rfl theorem harmonicWeightedFibre_ambient_inner (n k L : ℕ) (hn : 3 ≤ n) (hkl : k ≤ L) @@ -6615,7 +6580,7 @@ theorem sourceAdjacentHarmonicRow_inner_axis_fibre (block source) u (HarmonicCertificateAssembly.harmonicFibreAmplitudes n k L hn target)] - ring + ac_rfl _ = ∑ source : Jacobi.Index k L, (∑ target : Jacobi.Index k L, sourceAdjacentBlockCoefficient @@ -6639,7 +6604,7 @@ theorem sourceAdjacentHarmonicRow_inner_axis_fibre rw [Finset.mul_sum] apply Finset.sum_congr rfl intro source hsource - ring + ac_rfl _ = _ := by rw [harmonicWeightedFibre_ambient_inner] @@ -6821,7 +6786,7 @@ theorem rawLiftChannel_inner {n k L : ℕ} rw [Finset.sum_mul] apply Finset.sum_congr rfl intro a ha - ring + ac_rfl _ = ⟪x, y⟫_ℝ * isometricPackingKernel f x y := by rw [projectionMatrixFeature_inner] congr 1 @@ -7197,7 +7162,7 @@ theorem sourceSpectralBulk_lift_basis_inner euclideanChannelFeatureMap_inner, sourceSpectralBulk_lift_inner fibre source x y hy, embeddedBulkChannel_inner] - ring + ac_rfl /-- Data encoding the spectral channel remainder construction. -/ structure SpectralChannelRemainder @@ -7676,7 +7641,6 @@ theorem upperChannelDenominator_pos {n : ℕ} (hn : 0 < n) (m : ℕ) : 0 < upperChannelDenominator n m := by unfold upperChannelDenominator - have hnreal : 0 < (n : ℝ) := by exact_mod_cast hn positivity theorem upperChannelWeight_pos @@ -7794,8 +7758,7 @@ theorem lowerChannelWeight_pos 0 < lowerChannelWeight n m := by unfold lowerChannelWeight have hnreal : (3 : ℝ) ≤ n := by exact_mod_cast hn - have hmreal : 0 ≤ (m : ℝ) := by positivity - apply div_pos <;> linarith + apply div_pos <;> linarith only [hnreal] /-- The harmonic co-gradient scaled by the inverse square root of the channel denominator. -/ def lowerChannelAdjoint (n m : ℕ) : @@ -7863,7 +7826,7 @@ theorem radialGradient_derivative_sum apply congrArg₂ (· + ·) · apply Finset.sum_congr rfl intro j hj - ring + ac_rfl · rfl theorem harmonicCoordinateMultiplication_derivative_sum @@ -7985,18 +7948,17 @@ theorem lowerFischerGradientWeight_eq cases m with | zero => have hnne : (n : ℝ) ≠ 0 := by positivity - have hnsub : (n : ℝ) - 2 ≠ 0 := by linarith + have hnsub : (n : ℝ) - 2 ≠ 0 := by linarith only [hnreal] unfold lowerFischerGradientWeight upperChannelDenominator lowerChannelWeight norm_num field_simp | succ k => - have hkreal : 0 ≤ (k : ℝ) := by positivity have hden : 2 * (k : ℝ) + n ≠ 0 := by - have : 0 < 2 * (k : ℝ) + n := by linarith + have : 0 < 2 * (k : ℝ) + n := by linarith only [hnreal] exact ne_of_gt this have hden' : (n : ℝ) + (k : ℝ) * 2 ≠ 0 := by - have : 0 < (n : ℝ) + (k : ℝ) * 2 := by nlinarith + have : 0 < (n : ℝ) + (k : ℝ) * 2 := by linarith only [hnreal] exact ne_of_gt this unfold lowerFischerGradientWeight upperChannelDenominator lowerChannelWeight @@ -8074,7 +8036,7 @@ theorem harmonicCoordinateRaising_derivative_sum smul_smul, smul_smul, ← sub_smul] unfold lowerFischerGradientWeight congr 1 - ring + ac_rfl theorem harmonicCoGradient_inner {n : ℕ} (hn : 3 ≤ n) (m : ℕ) @@ -8271,7 +8233,7 @@ theorem upperChannel_harmonicAxisTensor_inner SpherePacking.Fischer.polynomialInner_smul_left, SpherePacking.Fischer.polynomialInner_smul_right, SpherePacking.Fischer.polynomialInner_smul_right] - ring + ac_rfl calc ⟪upperChannel n m (harmonicAxisTensor n m x p), q⟫_ℝ = ⟪harmonicAxisTensor n m x p, @@ -8356,13 +8318,11 @@ theorem upperChannel_solidHarmonicSource SpherePacking.solidHarmonicAxisPolynomialIsometry hn k (r + 1) x hx p := by have hnreal : (3 : ℝ) ≤ (n : ℝ) := by exact_mod_cast hn - have hkreal : (0 : ℝ) ≤ (k : ℝ) := by positivity - have hrreal : (0 : ℝ) ≤ (r : ℝ) := by positivity have hraise : 0 < 2 * (r : ℝ) + SpherePacking.harmonicAxisParameter n k - 2 := by unfold SpherePacking.harmonicAxisParameter - linarith + linarith only [hnreal] have hscale := SpherePacking.solidHarmonicAxisFischerScale_pos hn k r have hscale_next := @@ -8423,13 +8383,11 @@ theorem solidHarmonicSourceUpperCoefficient_pos {n : ℕ} (hn : 3 ≤ n) (k r : ℕ) : 0 < solidHarmonicSourceUpperCoefficient n k r := by have hnreal : (3 : ℝ) ≤ (n : ℝ) := by exact_mod_cast hn - have hkreal : (0 : ℝ) ≤ (k : ℝ) := by positivity - have hrreal : (0 : ℝ) ≤ (r : ℝ) := by positivity have hraise : 0 < 2 * (r : ℝ) + SpherePacking.harmonicAxisParameter n k - 2 := by unfold SpherePacking.harmonicAxisParameter - linarith + linarith only [hnreal] unfold solidHarmonicSourceUpperCoefficient apply div_pos · exact Real.sqrt_pos.mpr @@ -8456,13 +8414,11 @@ theorem solidHarmonicSourceUpperCoefficient_sq SpherePacking.harmonicAxisParameter n k - 2) * upperChannelDenominator n (k + r)) := by have hnreal : (3 : ℝ) ≤ (n : ℝ) := by exact_mod_cast hn - have hkreal : (0 : ℝ) ≤ (k : ℝ) := by positivity - have hrreal : (0 : ℝ) ≤ (r : ℝ) := by positivity have hraise : 0 < 2 * (r : ℝ) + SpherePacking.harmonicAxisParameter n k - 2 := by unfold SpherePacking.harmonicAxisParameter - linarith + linarith only [hnreal] have hscale := SpherePacking.solidHarmonicAxisFischerScale_pos hn k r have hscale_next := @@ -8483,15 +8439,6 @@ theorem solidHarmonicSourceUpperIsometryCoefficient_sq solidHarmonicSourceUpperIsometryCoefficient n k r ^ 2 = SpherePacking.Gegenbauer.alphaSq n k (k + r) := by have hnreal : (3 : ℝ) ≤ (n : ℝ) := by exact_mod_cast hn - have hkreal : (0 : ℝ) ≤ (k : ℝ) := by positivity - have hrreal : (0 : ℝ) ≤ (r : ℝ) := by positivity - have hraise : - 0 < 2 * (r : ℝ) + - SpherePacking.harmonicAxisParameter n k - 2 := by - unfold SpherePacking.harmonicAxisParameter - linarith - have hden := - upperChannelDenominator_pos (by omega : 0 < n) (k + r) have hweight := upperChannelWeight_pos (by omega : 0 < n) (k + r) unfold solidHarmonicSourceUpperIsometryCoefficient @@ -8525,7 +8472,7 @@ theorem solidHarmonicSourceUpperIsometryCoefficient_eq_sqrt have hroot := Real.sq_sqrt halpha.le have hroot_nonneg := Real.sqrt_nonneg (SpherePacking.Gegenbauer.alphaSq n k (k + r)) - nlinarith + nlinarith only [hsquare, hroot, hcoef, hroot_nonneg] theorem harmonic_inner_smul_right (n m : ℕ) (p q : HarmonicSpace n m) (c : ℝ) : @@ -8668,7 +8615,7 @@ theorem lowerChannel_harmonicAxisTensor_inner SpherePacking.Fischer.harmonicInner_eq_polynomialInner, harmonicCoordinateDerivative_apply, SpherePacking.Fischer.polynomialInner_smul_left] - ring + ac_rfl calc ⟪lowerChannel n m (harmonicAxisTensor n (m + 1) x p), q⟫_ℝ = ⟪harmonicAxisTensor n (m + 1) x p, @@ -8791,13 +8738,11 @@ theorem solidHarmonicSourceLowerCoefficient_pos {n : ℕ} (hn : 3 ≤ n) (k r : ℕ) : 0 < solidHarmonicSourceLowerCoefficient n k r := by have hnreal : (3 : ℝ) ≤ (n : ℝ) := by exact_mod_cast hn - have hkreal : (0 : ℝ) ≤ (k : ℝ) := by positivity - have hrreal : (0 : ℝ) ≤ (r : ℝ) := by positivity have hlast : 0 < (r : ℝ) + SpherePacking.harmonicAxisParameter n k - 2 := by unfold SpherePacking.harmonicAxisParameter - linarith + linarith only [hnreal] unfold solidHarmonicSourceLowerCoefficient apply div_pos · exact mul_pos @@ -8820,13 +8765,11 @@ theorem solidHarmonicSourceLowerCoefficient_sq SpherePacking.harmonicAxisParameter n k - 2) * upperChannelDenominator n (k + r)) := by have hnreal : (3 : ℝ) ≤ (n : ℝ) := by exact_mod_cast hn - have hkreal : (0 : ℝ) ≤ (k : ℝ) := by positivity - have hrreal : (0 : ℝ) ≤ (r : ℝ) := by positivity have hraise : 0 < 2 * (r : ℝ) + SpherePacking.harmonicAxisParameter n k - 2 := by unfold SpherePacking.harmonicAxisParameter - linarith + linarith only [hnreal] have hscale := SpherePacking.solidHarmonicAxisFischerScale_pos hn k r have hscale_next := @@ -8847,39 +8790,30 @@ theorem solidHarmonicSourceLowerIsometryCoefficient_sq solidHarmonicSourceLowerIsometryCoefficient n k r ^ 2 = SpherePacking.Gegenbauer.betaSq n k (k + (r + 1)) := by have hnreal : (3 : ℝ) ≤ (n : ℝ) := by exact_mod_cast hn - have hkreal : (0 : ℝ) ≤ (k : ℝ) := by positivity - have hrreal : (0 : ℝ) ≤ (r : ℝ) := by positivity - have hraise : - 0 < 2 * (r : ℝ) + - SpherePacking.harmonicAxisParameter n k - 2 := by - unfold SpherePacking.harmonicAxisParameter - linarith - have hden := - upperChannelDenominator_pos (by omega : 0 < n) (k + r) have hweight := lowerChannelWeight_pos hn (k + r) have hmiddle : 0 < (k : ℝ) + (r : ℝ) + (n : ℝ) - 2 := by - linarith + linarith only [hnreal] have hlowerden : 0 < 2 * ((k : ℝ) + (r : ℝ)) + (n : ℝ) - 2 := by - linarith + linarith only [hnreal] have hupperden : 0 < 2 * ((k : ℝ) + (r : ℝ)) + (n : ℝ) := by - linarith + linarith only [hnreal] have hfirstden : 0 < 2 * (r : ℝ) + ((n : ℝ) + 2 * (k : ℝ)) - 2 := by - linarith + linarith only [hnreal] have hfirstden_rev : 0 < (r : ℝ) * 2 + ((n : ℝ) + 2 * (k : ℝ)) - 2 := by - linarith + linarith only [hnreal] have hbetafirst : 0 < (k : ℝ) + ((r : ℝ) + 1) + (n : ℝ) - 3 := by - linarith + linarith only [hnreal] have hbetasecond : 0 < 2 * ((k : ℝ) + ((r : ℝ) + 1)) + (n : ℝ) - 2 := by - linarith + linarith only [hnreal] unfold solidHarmonicSourceLowerIsometryCoefficient rw [div_pow, Real.sq_sqrt hweight.le, solidHarmonicSourceLowerCoefficient_sq hn k r] @@ -8916,7 +8850,7 @@ theorem solidHarmonicSourceLowerIsometryCoefficient_eq_sqrt have hroot := Real.sq_sqrt hbeta have hroot_nonneg := Real.sqrt_nonneg (SpherePacking.Gegenbauer.betaSq n k (k + (r + 1))) - nlinarith + nlinarith only [hsquare, hroot, hcoef, hroot_nonneg] theorem lowerChannelIsometry_adjoint_solidHarmonicSource {n : ℕ} (hn : 3 ≤ n) (k r : ℕ) diff --git a/LeanPool/MetricCodes/Hierarchy.lean b/LeanPool/MetricCodes/Hierarchy.lean index f66fce0cd..ff1c9749f 100644 --- a/LeanPool/MetricCodes/Hierarchy.lean +++ b/LeanPool/MetricCodes/Hierarchy.lean @@ -136,7 +136,7 @@ theorem normalizedCoefficient_eq_Gamma (a * (1 + a)) * (1 + 2 * a) ^ 2 := by ring rw [hpoly, Real.sqrt_mul hfactor, Real.sqrt_sq hlin] - ring + ac_rfl rw [hrad] congr 1 ring @@ -170,8 +170,8 @@ theorem tendsto_terminal_coefficient {a b : ℝ} (2 * a + 1 - 2 * 0) * (2 * a + 1)) ≠ 0 := by apply ne_of_gt apply Real.sqrt_pos.2 - have hone : 0 < a + 1 := by linarith - have htwo : 0 < 2 * a + 1 := by linarith + have hone : 0 < a + 1 := by linarith only [ha] + have htwo : 0 < 2 * a + 1 := by linarith only [ha] simpa only [add_zero, mul_zero, sub_zero, gt_iff_lt] using mul_pos (mul_pos (mul_pos ha hone) htwo) htwo have hnorm := hnum.div hroot hrootne @@ -206,10 +206,10 @@ theorem eventually_transverse_add_le_longitudinal let δ : ℝ := (a - b) / 2 have hδ : 0 < δ := by dsimp [δ] - linarith + linarith only [hba] have hδlt : δ < a - b := by dsimp [δ] - linarith + linarith only [hba] have hratio := ((tendsto_longitudinal_ratio ha.le).sub (tendsto_transverse_ratio hb)).eventually @@ -234,7 +234,7 @@ theorem eventually_transverse_add_le_longitudinal have hreal : (transverseDegree b n : ℝ) + (m : ℝ) ≤ (longitudinalDegree a n : ℝ) := by - linarith + linarith only [hnlarge, hmul] exact_mod_cast hreal /-- The terminal edge rayleigh used in the spherical-code argument. -/ @@ -307,20 +307,18 @@ theorem eventually_topEigenvalue_gt {a b s : ℝ} s < SpherePacking.Jacobi.topEigenvalue n (transverseDegree b n) (longitudinalDegree a n) := by have ha : 0 < a := lt_of_le_of_lt hb hba - have hgamma : 0 < 2 * MetricCodes.Gamma a b := by - exact mul_pos (by norm_num) (MetricCodes.Gamma_pos hb hba) let g : ℝ := 2 * MetricCodes.Gamma a b let ε : ℝ := (g - s) / 2 have hε : 0 < ε := by dsimp [ε, g] - linarith + linarith only [hs] obtain ⟨m, hm⟩ := exists_nat_gt (g / ε) have hprod : g < (m : ℝ) * ε := (div_lt_iff₀ hε).mp hm have hden : 0 < (m : ℝ) + 1 := by positivity have hrem : g / ((m : ℝ) + 1) < ε := by apply (div_lt_iff₀ hden).2 - nlinarith [hgamma] + linarith only [hε, hprod] have hidentity : ((m : ℝ) / ((m : ℝ) + 1)) * g = g - g / ((m : ℝ) + 1) := by @@ -329,7 +327,7 @@ theorem eventually_topEigenvalue_gt {a b s : ℝ} s < ((m : ℝ) / ((m : ℝ) + 1)) * g := by rw [hidentity] dsimp [ε] at hrem - linarith + linarith only [hs, hrem] have hquot := (tendsto_terminalEdgeRayleigh ha hb m).eventually (lt_mem_nhds (show @@ -349,7 +347,7 @@ theorem spectralGap_pos {s a b : ℝ} (h : s < 2 * MetricCodes.Gamma a b) : 0 < spectralGap s a b := by unfold spectralGap - linarith + linarith only [h] theorem eventually_topEigenvalue_uniform_gap {a b s : ℝ} (hb : 0 ≤ b) (hba : b < a) @@ -360,7 +358,7 @@ theorem eventually_topEigenvalue_uniform_gap {a b s : ℝ} n (transverseDegree b n) (longitudinalDegree a n) := by apply eventually_topEigenvalue_gt hb hba unfold spectralGap - linarith + linarith only [hs] /-- The spectral prefactor used in the spherical-code argument. -/ def spectralPrefactor (s a b : ℝ) : ℝ := @@ -399,7 +397,7 @@ theorem eventually_sphericalCode_card_le_harmonicQuotient have heigengap : s < SpherePacking.Jacobi.topEigenvalue n (transverseDegree b n) (longitudinalDegree a n) := by - linarith + linarith only [hgap, heigen] have hactual := sphericalCode_bound_of_actual_harmonic_channels hn hkl hs.le heigengap C change @@ -411,7 +409,7 @@ theorem eventually_sphericalCode_card_le_harmonicQuotient have hden : 0 < SpherePacking.Jacobi.topEigenvalue n (transverseDegree b n) (longitudinalDegree a n) - s := by - linarith + linarith only [hgap, heigen] have hfrac : (1 - s) / (SpherePacking.Jacobi.topEigenvalue @@ -420,8 +418,8 @@ theorem eventually_sphericalCode_card_le_harmonicQuotient unfold spectralPrefactor apply (div_le_div_iff₀ hden hgap).2 apply mul_le_mul_of_nonneg_left - · linarith - · linarith + · linarith only [heigen] + · linarith only [hs] have htruncated : 0 ≤ SpherePacking.truncatedDimensionQuotient a b n := by unfold SpherePacking.truncatedDimensionQuotient @@ -755,9 +753,9 @@ theorem exists_oneRow_certificate_better_than_levelZero with b hγ hbentropy (hb : 0 < b) refine ⟨hb, ?_, ?_, hbentropy⟩ · unfold MetricCodes.Spherical.sphericalImprovementPath - nlinarith [mul_pos (sub_pos.mpr hslope) hb] + linarith only [ha, mul_pos (sub_pos.mpr hslope) hb] · rw [hclassical] at hγ - nlinarith + linarith only [hspectral, hγ] obtain ⟨b, hb, hba, hgap, hcost⟩ := hgood.exists exact ⟨MetricCodes.Spherical.sphericalImprovementPath a b, b, hb, hba, hgap, hcost⟩ @@ -776,7 +774,7 @@ theorem eventually_sphericalCode_card_lt_levelZero have hazero : a 0 = 0 := le_antisymm (le_of_not_gt hnot) ha_nonneg rw [Gamma_zero, hazero] at hspectral norm_num [spectralAtom] at hspectral - linarith + linarith only [hs, hspectral] rw [Gamma_zero] at hspectral obtain ⟨A, B, hB, hBA, hgap, hcost⟩ := exists_oneRow_certificate_better_than_levelZero ha hspectral @@ -801,7 +799,7 @@ theorem zero_fibre_spectral_iff_classicalThreshold_lt have hroot : 0 < Real.sqrt (a * (1 + a)) := Real.sqrt_pos.mpr hvariance have hroot_sq := Real.sq_sqrt hvariance.le - have hradical : 0 < 1 - s ^ 2 := by nlinarith + have hradical : 0 < 1 - s ^ 2 := by nlinarith only [hs', hs] have hclassical : 0 < Real.sqrt (1 - s ^ 2) := Real.sqrt_pos.mpr hradical have hclassical_sq := Real.sq_sqrt hradical.le @@ -828,27 +826,27 @@ theorem zero_fibre_spectral_iff_classicalThreshold_lt (mul_nonneg (by norm_num : (0 : ℝ) ≤ 2) hroot.le)).mpr h apply (sq_lt_sq₀ (by norm_num : (0 : ℝ) ≤ 1) (mul_nonneg hclassical.le hlinear.le)).mp - nlinarith [hsquares] + linarith only [hsq, hsquares] · intro h have hsq := (sq_lt_sq₀ (by norm_num : (0 : ℝ) ≤ 1) (mul_nonneg hclassical.le hlinear.le)).mpr h apply (sq_lt_sq₀ (mul_nonneg hs.le hlinear.le) (mul_nonneg (by norm_num : (0 : ℝ) ≤ 2) hroot.le)).mp - nlinarith [hsquares] + linarith only [hsq, hsquares] rw [hcompare] unfold MetricCodes.classicalThreshold constructor · intro h have hdiv : 1 / Real.sqrt (1 - s ^ 2) < 1 + 2 * a := by apply (div_lt_iff₀ hclassical).mpr - nlinarith - linarith + linarith only [h] + linarith only [hdiv] · intro h have hdiv : 1 / Real.sqrt (1 - s ^ 2) < 1 + 2 * a := by - linarith + linarith only [h] have hmul := (div_lt_iff₀ hclassical).mp hdiv - nlinarith + linarith only [hmul] theorem boundaryQuadratic_pos_iff_classicalThreshold_lt {s a : ℝ} (hs : 0 < s) (hs' : s < 1) (ha : 0 < a) : @@ -862,15 +860,13 @@ theorem boundaryDegree_lt_longitudinal {s a : ℝ} (hs : 0 < s) (ha : 0 < a) (hquadratic : 0 < boundaryQuadratic s a) : boundaryDegree s a < a := by - have hb := boundaryDegree_pos hquadratic have heq := boundaryDegree_mul_one_add hquadratic.le - have hroot : 0 < Real.sqrt (a * (1 + a)) := by positivity have hstrict : boundaryQuadratic s a < a * (1 + a) := by unfold boundaryQuadratic have hterm : 0 < (s / 2) * (1 + 2 * a) * Real.sqrt (a * (1 + a)) := by positivity - linarith - nlinarith [sq_nonneg (a - boundaryDegree s a)] + linarith only [hterm] + nlinarith only [heq, hstrict, ha] theorem feasible_iff_boundary {s a b : ℝ} (hs : 0 < s) (hs' : s < 1) : @@ -882,7 +878,7 @@ theorem feasible_iff_boundary have ha : 0 < a := hb.trans hba have hquadratic : 0 < boundaryQuadratic s a := by have hstrict := (spectral_iff_quadratic ha).mp hspectral - nlinarith [mul_pos hb (by linarith : 0 < 1 + b)] + linarith only [hstrict, mul_pos hb (by linarith : 0 < 1 + b)] exact ⟨(boundaryQuadratic_pos_iff_classicalThreshold_lt hs hs' ha).mp hquadratic, hb, (quadratic_iff_boundaryDegree hb.le hquadratic).mp @@ -1025,7 +1021,7 @@ theorem sphericalEntropy_upper_logb_add 1 / Real.log 2 := by rw [← mul_div_assoc] exact (div_le_div_iff_of_pos_right hlogtwo).mpr hupper - linarith + linarith only [hfraction] end @@ -1050,7 +1046,7 @@ theorem sliceCost_nonneg {s t : ℝ} @[simp] theorem sliceCost_self {s : ℝ} (hs : s < 1) : sliceCost s s = 0 := by unfold sliceCost - rw [div_self (by linarith : 1 - s ≠ 0)] + rw [div_self (by linarith only [hs] : 1 - s ≠ 0)] simp only [one_div, Real.logb_one, mul_zero] /-- The localized envelope used in the spherical-code argument. -/ @@ -1209,18 +1205,16 @@ theorem scaleCoordinate_nonneg {c u : ℝ} have hsquare := Real.sq_sqrt hrad have hsqrt := Real.sqrt_nonneg (1 + 4 * c * (u * (1 + u))) unfold scaleCoordinate - nlinarith [mul_nonneg hc hx] + nlinarith only [hsquare, hsqrt, mul_nonneg hc hx] theorem quadraticCoordinate_scaleCoordinate {c u : ℝ} (hc : 0 ≤ c) (hu : 0 ≤ u) : ((scaleCoordinate c u) * (1 + (scaleCoordinate c u))) = c * (u * (1 + u)) := by - have hx : 0 ≤ (u * (1 + u)) := by - positivity have hrad : 0 ≤ 1 + 4 * c * (u * (1 + u)) := by positivity have hsquare := Real.sq_sqrt hrad unfold scaleCoordinate at * - nlinarith + linarith only [hsquare] @[simp] theorem scaleCoordinate_one {u : ℝ} (hu : 0 ≤ u) : scaleCoordinate 1 u = u := by @@ -1314,36 +1308,31 @@ theorem spectralAtom_strictMonoOn : change 0 ≤ u at hu change 0 ≤ v at hv have hquad := quadraticCoordinate_strictMonoOn hu hv huv - have hqu : 0 ≤ (u * (1 + u)) := by - positivity - have hqv : 0 ≤ (v * (1 + v)) := by - positivity have hdenu : 0 < 1 + 4 * (u * (1 + u)) := by positivity have hdenv : 0 < 1 + 4 * (v * (1 + v)) := by positivity have hsquare : spectralAtom u ^ 2 < spectralAtom v ^ 2 := by rw [spectralAtom_sq hu, spectralAtom_sq hv] apply (div_lt_div_iff₀ hdenu hdenv).mpr - nlinarith - have hnonneg := spectralAtom_nonneg hu + linarith only [hquad] have hnonneg' := spectralAtom_nonneg hv - nlinarith + nlinarith only [hsquare, hnonneg'] theorem spectralAtom_scale_lt {c u : ℝ} (hc : 1 < c) (hu : 0 < u) : spectralAtom u < spectralAtom (scaleCoordinate c u) := by have hquad : (u * (1 + u)) < ((scaleCoordinate c u) * (1 + (scaleCoordinate c u))) := by - rw [quadraticCoordinate_scaleCoordinate (by linarith) hu.le] + rw [quadraticCoordinate_scaleCoordinate (by linarith only [hc]) hu.le] have hx : 0 < (u * (1 + u)) := by positivity - nlinarith + nlinarith only [hc, hx] have hcoord : u < scaleCoordinate c u := by by_contra hnot have hrev : scaleCoordinate c u ≤ u := le_of_not_gt hnot exact (not_le_of_gt hquad) (quadraticCoordinate_strictMonoOn.monotoneOn - (scaleCoordinate_nonneg (by linarith) hu.le) hu.le hrev) + (scaleCoordinate_nonneg (by linarith only [hc]) hu.le) hu.le hrev) exact spectralAtom_strictMonoOn hu.le - (scaleCoordinate_nonneg (by linarith) hu.le) hcoord + (scaleCoordinate_nonneg (by linarith only [hc]) hu.le) hcoord theorem Gamma_scale_gt {r : ℕ} {a : Fin (r + 1) → ℝ} {b : Fin r → ℝ} @@ -1354,7 +1343,7 @@ theorem Gamma_scale_gt {r : ℕ} apply Finset.sum_lt_sum_of_nonempty (Finset.univ_nonempty : (Finset.univ : Finset (Fin (r + 1))).Nonempty) intro i _ - rw [lagrangeWeight_scale h (by linarith) i] + rw [lagrangeWeight_scale h (by linarith only [hc]) i] apply mul_lt_mul_of_pos_left _ (h.lagrangeWeight_pos i) exact spectralAtom_scale_lt hc (hlast.trans_le (h.strictAnti_ambient.antitone i.le_last)) @@ -1371,7 +1360,7 @@ theorem spectralAtom_scale_sub_lower_bound {c u : ℝ} have hx : 0 ≤ x := by dsimp [x] positivity - have hcpos : 0 < c := by linarith + have hcpos : 0 < c := by linarith only [hc] have hscale : 0 ≤ scaleCoordinate c u := scaleCoordinate_nonneg hcpos.le hu have hsq : Q ^ 2 - q ^ 2 = @@ -1384,8 +1373,6 @@ theorem spectralAtom_scale_sub_lower_bound {c u : ℝ} have hden₂ : 1 + 4 * x ≠ 0 := by positivity field_simp [hden₁, hden₂] ring - have hqu : 0 ≤ q := spectralAtom_nonneg hu - have hQ : 0 ≤ Q := spectralAtom_nonneg hscale have hqhalf : q < (1 / 2 : ℝ) := spectralAtom_lt_half hu have hQhalf : Q < (1 / 2 : ℝ) := spectralAtom_lt_half hscale have hqle : q ≤ Q := by @@ -1393,7 +1380,7 @@ theorem spectralAtom_scale_sub_lower_bound {c u : ℝ} ((scaleCoordinate c u) * (1 + (scaleCoordinate c u))) := by rw [quadraticCoordinate_scaleCoordinate hcpos.le hu] dsimp [x] at hx ⊢ - nlinarith + nlinarith only [hc, hx] by_contra hnot have hreverse : Q < q := lt_of_not_ge hnot have hreverse' : scaleCoordinate c u < u := by @@ -1404,22 +1391,21 @@ theorem spectralAtom_scale_sub_lower_bound {c u : ℝ} exact (not_le_of_gt (quadraticCoordinate_strictMonoOn hscale hu hreverse')) hquad have hfactor : Q ^ 2 - q ^ 2 ≤ Q - q := by - nlinarith [mul_nonneg (sub_nonneg.mpr hqle) - (show 0 ≤ 1 - (Q + q) by linarith)] + nlinarith only [mul_nonneg (sub_nonneg.mpr hqle) (show 0 ≤ 1 - (Q + q) by linarith)] have hden₁ : 0 < (1 + 4 * c * x) * (1 + 4 * x) := by positivity have hden₂ : 0 < (1 + 8 * x) * (1 + 4 * x) := by positivity have hnum : 0 ≤ x * (c - 1) := mul_nonneg hx (sub_nonneg.mpr hc) have hdenle : (1 + 4 * c * x) * (1 + 4 * x) ≤ (1 + 8 * x) * (1 + 4 * x) := by - nlinarith [mul_nonneg (sub_nonneg.mpr hc') hx] + nlinarith only [hx, mul_nonneg (sub_nonneg.mpr hc') hx] have hfractions : x * (c - 1) / ((1 + 8 * x) * (1 + 4 * x)) ≤ x * (c - 1) / ((1 + 4 * c * x) * (1 + 4 * x)) := by exact (div_le_div_iff₀ hden₂ hden₁).mpr (mul_le_mul_of_nonneg_left hdenle hnum) dsimp [x, Q, q] at hfractions hfactor hsq ⊢ - linarith + linarith only [hsq, hfactor, hfractions] /-- The positive weighted coefficient controlling the spectral gain under parameter scaling. -/ def scalingGainCoefficient {r : ℕ} @@ -1459,7 +1445,7 @@ theorem Gamma_scale_sub_lower_bound {r : ℕ} rw [Finset.mul_sum, ← Finset.sum_sub_distrib] apply Finset.sum_le_sum intro i _ - rw [lagrangeWeight_scale h (by linarith) i] + rw [lagrangeWeight_scale h (by linarith only [hc]) i] have hbound := spectralAtom_scale_sub_lower_bound hc hc' (h.ambient_nonneg i) have hweighted := mul_le_mul_of_nonneg_left hbound @@ -1516,15 +1502,11 @@ theorem append_scaled_spectralLoss_le {r : ℕ} hlast.trans_le (h.strictAnti_ambient.antitone i.le_last) have hx : 0 < ((a i) * (1 + (a i))) := by positivity - have he : 0 ≤ (ε * (1 + ε)) := by - positivity have hatom := spectralAtom_lt_half (scaleCoordinate_nonneg hc.le hai.le) have hweight := h.lagrangeWeight_pos i field_simp [hc.ne', hx.ne'] - nlinarith [mul_nonneg he hweight.le, - mul_nonneg (mul_nonneg he hweight.le) - (sub_nonneg.mpr hatom.le)] + nlinarith only [hε, hatom] /-- The scaling slope chosen to exceed the upper bound on the appended spectral loss. -/ def compensatedScalingSlope {r : ℕ} @@ -1536,7 +1518,7 @@ theorem compensatedScalingSlope_pos {r : ℕ} (h : Interlacing a b) (hlast : 0 < a (Fin.last r)) : 0 < compensatedScalingSlope a b := by unfold compensatedScalingSlope - exact div_pos (by linarith [appendSpectralLossUpper_pos h hlast]) + exact div_pos (by linarith only [appendSpectralLossUpper_pos h hlast]) (scalingGainCoefficient_pos h hlast) /-- The parameter scaling factor compensating for an appended stabilizer coordinate `ε`. -/ @@ -1562,27 +1544,25 @@ theorem Gamma_compensated_append_gt {r : ℕ} have he : 0 < e := by dsimp [e] positivity - have hD : 0 < D := scalingGainCoefficient_pos h hlast - have hM : 0 < M := appendSpectralLossUpper_pos h hlast have hslope : 0 < compensatedScalingSlope a b := compensatedScalingSlope_pos h hlast have hc : 1 < c := by dsimp [c, compensatedScalingFactor] - nlinarith + nlinarith only [he, hslope] have hscale : Interlacing (scaleAmbient c a) (scaleStabilizer c b) := - h.scale (by linarith) + h.scale (by linarith only [hc]) have hlast' : 0 < scaleAmbient c a (Fin.last r) := - scaleCoordinate_pos (by linarith) hlast + scaleCoordinate_pos (by linarith only [hc]) hlast have hgain := Gamma_scale_sub_lower_bound h hc.le hmoderate have hloss := append_scaled_spectralLoss_le h hlast - (show 0 < c by linarith) hε.le + (show 0 < c by linarith only [hc]) hε.le have hrelation : (c - 1) * D = e * (M + 1) := by dsimp [c, D, M, compensatedScalingFactor, compensatedScalingSlope] field_simp [(scalingGainCoefficient_pos h hlast).ne'] ring rw [Gamma_append hscale hlast'] dsimp [c] at hgain hloss hrelation ⊢ - nlinarith + linarith only [he, hgain, hloss, hrelation] @[simp] theorem compensatedScalingFactor_zero {r : ℕ} (a : Fin (r + 1) → ℝ) (b : Fin r → ℝ) : @@ -1600,8 +1580,6 @@ theorem scaleCoordinate_compensated_differentiableAt_zero {r : ℕ} {u : ℝ} (hu : 0 ≤ u) : DifferentiableAt ℝ (fun ε => scaleCoordinate (compensatedScalingFactor a b ε) u) 0 := by - have hquad : 0 ≤ (u * (1 + u)) := by - positivity have hinner : DifferentiableAt ℝ (fun ε => 1 + 4 * compensatedScalingFactor a b ε * (u * (1 + u))) 0 := by @@ -1674,7 +1652,7 @@ theorem eventually_sub_sphericalEntropy_lt_of_differentiable let M : ℝ := deriv f 0 + 1 have hM : deriv f 0 < M := by dsimp [M] - linarith + linarith only [] have hslope := hf.hasDerivAt.tendsto_slope_zero_right have hupper : ∀ᶠ ε : ℝ in 𝓝[>] 0, ε⁻¹ * (f ε - f 0) < M := by @@ -1698,21 +1676,21 @@ theorem eventually_sub_sphericalEntropy_lt_of_differentiable mul_lt_mul_of_pos_left hlogε hε have hentropy := MetricCodes.Spherical.neg_mul_logb_le_sphericalEntropy hε.le - linarith + linarith only [hold, hnew, hentropy] theorem le_scaleCoordinate_of_one_le {c u : ℝ} (hc : 1 ≤ c) (hu : 0 ≤ u) : u ≤ scaleCoordinate c u := by have hquad : (u * (1 + u)) ≤ ((scaleCoordinate c u) * (1 + (scaleCoordinate c u))) := by - rw [quadraticCoordinate_scaleCoordinate (by linarith) hu] + rw [quadraticCoordinate_scaleCoordinate (by linarith only [hc]) hu] have hx : 0 ≤ (u * (1 + u)) := by positivity - nlinarith + nlinarith only [hc, hx] by_contra hnot have hreverse : scaleCoordinate c u < u := lt_of_not_ge hnot exact (not_le_of_gt (quadraticCoordinate_strictMonoOn - (scaleCoordinate_nonneg (by linarith) hu) hu hreverse)) hquad + (scaleCoordinate_nonneg (by linarith only [hc]) hu) hu hreverse)) hquad theorem eventually_Phi_compensated_append_lt {r : ℕ} {a : Fin (r + 1) → ℝ} {b : Fin r → ℝ} @@ -1733,19 +1711,20 @@ theorem eventually_Phi_compensated_append_lt {r : ℕ} positivity have hc : 1 ≤ c := by dsimp [c, compensatedScalingFactor] - nlinarith + nlinarith only [hslope, hquad] have hcoordinate : ε ≤ scaleCoordinate c ε := le_scaleCoordinate_of_one_le hc hε.le have hentropy : MetricCodes.sphericalEntropy ε ≤ MetricCodes.sphericalEntropy (scaleCoordinate c ε) := MetricCodes.Spherical.sphericalEntropy_strictMono.monotoneOn - hε.le (scaleCoordinate_nonneg (by linarith) hε.le) hcoordinate + hε.le (scaleCoordinate_nonneg + (by linarith only [hc]) hε.le) hcoordinate rw [Phi_append] change compensatedPhiPath a b ε - MetricCodes.sphericalEntropy (scaleCoordinate c ε) < Phi a b rw [← compensatedPhiPath_zero h] - linarith + linarith only [hεbound, hentropy] theorem exists_nextLevel_strict_refinement {r : ℕ} {a : Fin (r + 1) → ℝ} {b : Fin r → ℝ} @@ -1778,7 +1757,7 @@ theorem exists_nextLevel_strict_refinement {r : ℕ} have hquad : 0 < (ε * (1 + ε)) := by positivity dsimp [c, compensatedScalingFactor] - nlinarith + nlinarith only [hslope, hquad] let A := appendAmbient (scaleAmbient c a) let B := appendStabilizer (scaleStabilizer c b) (scaleCoordinate c ε) refine ⟨A, B, ?_, ?_, ?_⟩ @@ -1851,20 +1830,20 @@ theorem classical_le_levelRate_zero {s : ℝ} have ha : Interlacing a b := by constructor · dsimp [a] - linarith + linarith only [ha₀] · intro i exact Fin.elim0 i have hboundary : spectralAtom (MetricCodes.classicalThreshold s) = s / 2 := by have h := MetricCodes.Spherical.classicalThreshold_spectral hs hs' rw [MetricCodes.Spherical.Gamma_zero ha₀] at h change 2 * spectralAtom (MetricCodes.classicalThreshold s) = s at h - linarith + linarith only [h] have hgap : s < 2 * Gamma a b := by rw [Gamma_zero] have hmono := spectralAtom_strictMonoOn ha₀.le - (show 0 ≤ a 0 by dsimp [a]; linarith) - (show MetricCodes.classicalThreshold s < a 0 by dsimp [a]; linarith) - linarith + (show 0 ≤ a 0 by dsimp [a]; linarith only [ha₀]) + (show MetricCodes.classicalThreshold s < a 0 by dsimp [a]; linarith only []) + linarith only [hboundary, hmono] have hnonempty : (levelRateSet 0 s).Nonempty := ⟨Phi a b, a, b, ha, hgap, rfl⟩ unfold levelRate @@ -1878,7 +1857,7 @@ theorem classical_le_levelRate_zero {s : ℝ} have hle : A 0 ≤ MetricCodes.classicalThreshold s := le_of_not_gt hnot have hmono := spectralAtom_strictMonoOn.monotoneOn hAnonneg ha₀.le hle - linarith + linarith only [hboundary, hgapA, hmono] exact (MetricCodes.Spherical.sphericalEntropy_strictMono ha₀.le hAnonneg hstrict).le @@ -1896,7 +1875,7 @@ theorem localizedEnvelope_lt_of_minimizer κ' t + MetricCodes.Spherical.SidelnikovLocalization.sliceCost s t := MetricCodes.Spherical.SidelnikovLocalization.localizedEnvelope_le hs ht hκ' _ < κ t + MetricCodes.Spherical.SidelnikovLocalization.sliceCost s t := by - linarith + linarith only [hstrict] _ = MetricCodes.Spherical.SidelnikovLocalization.localizedEnvelope κ s := hmin.symm @@ -2340,7 +2319,7 @@ theorem sum_sphericalEntropy_update {n : ℕ} rw [Finset.sdiff_singleton_eq_erase] have hsplit := Finset.add_sum_erase (Finset.univ : Finset (Fin n)) (fun j => MetricCodes.sphericalEntropy (a j)) (Finset.mem_univ i) - linarith + linarith only [hsplit] theorem Phi_opening_eq {r : ℕ} (hr : 0 < r) @@ -2374,7 +2353,7 @@ theorem eventually_Phi_opening_lt {r : ℕ} simpa [i] using hi have hlog : 0 < Real.logb 2 ((1 + a 0) / a 0) := by apply Real.logb_pos (by norm_num : (1 : ℝ) < 2) - exact (lt_div_iff₀ ha).mpr (by linarith) + exact (lt_div_iff₀ ha).mpr (by linarith only []) have hnegative : -(η * Real.logb 2 ((1 + a 0) / a 0)) < 0 := by exact neg_neg_of_pos (mul_pos hη hlog) have hlimit := tendsto_opening_entropy_slope (η := η) ha @@ -2382,7 +2361,7 @@ theorem eventually_Phi_opening_lt {r : ℕ} filter_upwards [hevent, self_mem_nhdsWithin] with t ht (htpos : 0 < t) have hnegative' := (div_lt_iff₀ htpos).mp ht have hphi := Phi_opening_eq (b := b) hr hzero η t - linarith + linarith only [hnegative', hphi] /-- The positive opening speed bounded using the derivative of the regular spectral sum. -/ def openingContractionSpeed {r : ℕ} @@ -2413,7 +2392,7 @@ theorem opening_spectralSlope_pos {r : ℕ} have hbound : -|D| ≤ D := neg_abs_le D have hηbound := mul_le_mul_of_nonneg_left hbound hη.le dsimp [η, D, w] at hidentity hηbound ⊢ - nlinarith [abs_nonneg (deriv (openingRegularGamma a b 1) 0)] + linarith only [hw, hη, hidentity, hηbound] theorem eventually_Gamma_opening_gt {r : ℕ} {a : Fin (r + 1) → ℝ} {b : Fin r → ℝ} @@ -2431,7 +2410,7 @@ theorem eventually_Gamma_opening_gt {r : ℕ} with t ht (htpos : 0 < t) have hdiff := (lt_div_iff₀ htpos).mp ht dsimp [η] at hdiff ⊢ - linarith + linarith only [hdiff] theorem eventually_opening_interlacing {r : ℕ} {a : Fin (r + 1) → ℝ} {b : Fin r → ℝ} @@ -2501,7 +2480,7 @@ theorem exists_nextLevel_feasible_lt {r : ℕ} {s : ℝ} by_cases hlast : 0 < a (Fin.last r) · obtain ⟨A, B, hAB, hGamma, hPhi⟩ := exists_nextLevel_strict_refinement h hlast - exact ⟨A, B, hAB, by linarith, hPhi⟩ + exact ⟨A, B, hAB, by linarith only [hgap, hGamma], hPhi⟩ · have hzero : a (Fin.last r) = 0 := le_antisymm (le_of_not_gt hlast) (h.ambient_nonneg _) cases r with @@ -2510,13 +2489,13 @@ theorem exists_nextLevel_feasible_lt {r : ℕ} {s : ℝ} have ha : a 0 = 0 := by simpa only [Fin.isValue, Fin.last_zero] using hzero simp only [spectralAtom, Fin.isValue, ha, add_zero, mul_one, Real.sqrt_zero, mul_zero, div_one] at hgap - linarith + linarith only [hs, hgap] | succ r => obtain ⟨A, hlastA, hA, hGammaA, hPhiA⟩ := exists_sameLevel_opening_strict_refinement (Nat.zero_lt_succ r) h hzero obtain ⟨C, D, hCD, hGammaC, hPhiC⟩ := exists_nextLevel_strict_refinement hA hlastA - exact ⟨C, D, hCD, by linarith, lt_trans hPhiC hPhiA⟩ + exact ⟨C, D, hCD, by linarith only [hgap, hGammaA, hGammaC], lt_trans hPhiC hPhiA⟩ theorem levelRate_nonneg_of_nonempty {r : ℕ} {s : ℝ} (h : (levelRateSet r s).Nonempty) : @@ -2546,20 +2525,20 @@ theorem levelRateSet_zero_nonempty_of_interior {s : ℝ} have ha : Interlacing a b := by constructor · dsimp [a] - linarith + linarith only [hthreshold] · intro i exact Fin.elim0 i have hboundary : spectralAtom (MetricCodes.classicalThreshold s) = s / 2 := by have h := MetricCodes.Spherical.classicalThreshold_spectral hs hs' rw [MetricCodes.Spherical.Gamma_zero hthreshold] at h change 2 * spectralAtom (MetricCodes.classicalThreshold s) = s at h - linarith + linarith only [h] refine ⟨Phi a b, a, b, ha, ?_, rfl⟩ rw [Gamma_zero] have hmono := spectralAtom_strictMonoOn hthreshold.le - (show 0 ≤ a 0 by dsimp [a]; linarith) - (show MetricCodes.classicalThreshold s < a 0 by dsimp [a]; linarith) - linarith + (show 0 ≤ a 0 by dsimp [a]; linarith only [hthreshold]) + (show MetricCodes.classicalThreshold s < a 0 by dsimp [a]; linarith only []) + linarith only [hboundary, hmono] theorem levelRateSet_nonempty_of_interior (r : ℕ) {s : ℝ} (hs : 0 < s) (hs' : s < 1) : @@ -2662,7 +2641,7 @@ theorem exists_positive_localized_minimizer_of_lowerSemicontinuous have htpos : 0 < t := by rcases lt_or_eq_of_le ht.1 with htpos | rfl · exact htpos - · linarith + · linarith only [huzero, htu] exact ⟨t, ⟨htpos, ht.2⟩, heq⟩ theorem sliceCost_sub_zero {s t : ℝ} @@ -2670,8 +2649,8 @@ theorem sliceCost_sub_zero {s t : ℝ} MetricCodes.Spherical.SidelnikovLocalization.sliceCost s t - MetricCodes.Spherical.SidelnikovLocalization.sliceCost s 0 = (1 / 2 : ℝ) * Real.logb 2 (1 - t) := by - have hs' : 1 - s ≠ 0 := by linarith - have ht' : 1 - t ≠ 0 := by linarith + have hs' : 1 - s ≠ 0 := by linarith only [hs] + have ht' : 1 - t ≠ 0 := by linarith only [ht] unfold MetricCodes.Spherical.SidelnikovLocalization.sliceCost norm_num only [sub_zero] rw [Real.logb_div ht' hs', @@ -2686,8 +2665,8 @@ theorem sliceCost_sub_zero_le_neg_linear {s t : ℝ} -t / (2 * Real.log 2) := by rw [sliceCost_sub_zero hs ht] have hlog : Real.log (1 - t) ≤ -t := by - simpa only [sub_sub_cancel_left] using Real.log_le_sub_one_of_pos (by linarith : 0 < 1 - t) - have hbase : 0 < Real.log 2 := Real.log_pos (by norm_num) + simpa only [sub_sub_cancel_left] using + Real.log_le_sub_one_of_pos (by linarith only [ht] : 0 < 1 - t) unfold Real.logb calc (1 / 2 : ℝ) * (Real.log (1 - t) / Real.log 2) = @@ -2734,7 +2713,7 @@ theorem eventually_squared_spectralCertificate : (Ioi_mem_nhds (by norm_num : (1 / 2 : ℝ) < 1)) filter_upwards [hratio, self_mem_nhdsWithin] with t hratio (ht : 0 < t) have hmul := (lt_div_iff₀ ht).mp hratio - linarith + linarith only [hmul] theorem eventually_levelRate_zero_le_squared_entropy : ∀ᶠ t : ℝ in 𝓝[>] 0, @@ -2777,9 +2756,9 @@ theorem exists_sliceCost_endpoint_improvement_of_smallEntropy simpa only [neg_div] using hcost have hlinear : t / (4 * Real.log 2) < t / (2 * Real.log 2) := by exact (div_lt_div_iff_of_pos_left htpos (by positivity) (by positivity)).2 - (by nlinarith) + (by linarith only [hbase]) rw [hzero] - linarith + linarith only [hκ, hent', hcost', hlinear] theorem exists_positive_localized_minimizer_of_lsc_and_smallEntropy {κ : ℝ → ℝ} {s : ℝ} (hs : 0 < s) (hs' : s < 1) @@ -2872,10 +2851,10 @@ theorem logb_one_add_le_sphericalEntropy {u : ℝ} (hu : 0 ≤ u) : · rw [MetricCodes.sphericalEntropy_eq_log_add hu] have hratio : 1 ≤ (1 + u) / u := by apply (le_div_iff₀ hu).2 - linarith + linarith only [] have hlog : 0 ≤ Real.logb 2 ((1 + u) / u) := Real.logb_nonneg (by norm_num : (1 : ℝ) < 2) hratio - nlinarith [mul_nonneg hu.le hlog] + linarith only [mul_nonneg hu.le hlog] theorem entropy_gap_nonneg {r : ℕ} {a : Fin (r + 1) → ℝ} {b : Fin r → ℝ} @@ -2894,7 +2873,7 @@ theorem terminal_entropy_le_Phi {r : ℕ} (MetricCodes.sphericalEntropy (a i.castSucc) - MetricCodes.sphericalEntropy (b i)) := Finset.sum_nonneg fun i _ => entropy_gap_nonneg h i - linarith + linarith only [hsum] theorem entropy_gap_le_Phi {r : ℕ} {a : Fin (r + 1) → ℝ} {b : Fin r → ℝ} @@ -2916,7 +2895,7 @@ theorem entropy_gap_le_Phi {r : ℕ} MetricCodes.sphericalEntropy (b j)) := by exact Finset.single_le_sum (fun j _ => entropy_gap_nonneg h j) (Finset.mem_univ i) - linarith + linarith only [hterminal, hsum] theorem degree_le_rpow_sub_one_of_sphericalEntropy_le {u C : ℝ} (hu : 0 ≤ u) @@ -2926,8 +2905,8 @@ theorem degree_le_rpow_sub_one_of_sphericalEntropy_le (logb_one_add_le_sphericalEntropy hu).trans hC have hpow : 1 + u ≤ (2 : ℝ) ^ C := (Real.logb_le_iff_le_rpow (by norm_num : (1 : ℝ) < 2) - (by linarith : 0 < 1 + u)).mp hlog - linarith + (by linarith only [hu] : 0 < 1 + u)).mp hlog + linarith only [hpow] theorem terminal_degree_le_rpow_sub_one_of_Phi_le {r : ℕ} {a : Fin (r + 1) → ℝ} {b : Fin r → ℝ} @@ -2949,7 +2928,7 @@ theorem shifted_degree_ratio_le_rpow_of_entropy_gap_le have hlog : Real.logb 2 (1 + a) - Real.logb 2 (1 + b) ≤ C + 1 / Real.log 2 := by - linarith + linarith only [hC, hlower, hupper] have hratio : Real.logb 2 ((1 + a) / (1 + b)) ≤ C + 1 / Real.log 2 := by @@ -2971,10 +2950,10 @@ theorem degree_ratio_lower_bound_of_entropy_gap_le shifted_degree_ratio_le_rpow_of_entropy_gap_le hb₀ hba hC have hshift : 1 + a ≤ D * (1 + b) := (div_le_iff₀ (by positivity : 0 < 1 + b)).mp hratio - have hdouble : 1 + b ≤ 2 * b := by linarith + have hdouble : 1 + b ≤ 2 * b := by linarith only [hb] have hbound : a ≤ (2 * D) * b := by have hmul := mul_le_mul_of_nonneg_left hdouble hD.le - nlinarith + linarith only [hshift, hmul] apply (le_div_iff₀ ha).2 calc (2 * D)⁻¹ * a = a / (2 * D) := by ring @@ -2992,7 +2971,7 @@ theorem tendsto_sphericalEntropy_sub_logb_one_add : rw [MetricCodes.sphericalEntropy_eq_log_add ha] have hratio : (1 + a) / a = 1 + 1 / a := by field_simp - ring + ac_rfl rw [hratio] unfold Real.logb ring @@ -3050,7 +3029,7 @@ theorem sqrt_degree_mul_one_add_eq Real.sqrt (a * (1 + a)) = a * Real.sqrt (1 + a⁻¹) := by have hfactor : a * (1 + a) = a ^ 2 * (1 + a⁻¹) := by field_simp - ring + ac_rfl rw [hfactor, Real.sqrt_mul (sq_nonneg a), Real.sqrt_sq ha.le] theorem boundaryQuadratic_eq_sq_mul_normalized @@ -3061,7 +3040,7 @@ theorem boundaryQuadratic_eq_sq_mul_normalized normalizedBoundaryQuadratic rw [sqrt_degree_mul_one_add_eq ha] field_simp - ring + ac_rfl theorem boundaryDegree_div_eq_normalized {s a : ℝ} (ha : 0 < a) : @@ -3151,7 +3130,7 @@ def compactifiedHierarchyCoordinate (u : ℝ) : ℝ := (1 + u)⁻¹ theorem compactifiedHierarchyCoordinate_mem_Ioc {u : ℝ} (hu : 0 ≤ u) : compactifiedHierarchyCoordinate u ∈ Set.Ioc (0 : ℝ) 1 := by constructor - · exact inv_pos.mpr (by linarith) + · exact inv_pos.mpr (by linarith only [hu]) · exact (inv_le_one₀ (by linarith)).2 (by linarith) theorem compactifiedHierarchyCoordinate_mem_Icc {u : ℝ} (hu : 0 ≤ u) : @@ -3189,18 +3168,18 @@ theorem tendsto_atTop_of_compactifiedHierarchyCoordinate_zero let T : ℝ := max M 0 have hT : 0 < 1 + T := by dsimp [T] - linarith [le_max_right M 0] + linarith only [le_max_right M 0] have hevent : ∀ᶠ k in atTop, compactifiedHierarchyCoordinate (f k) < (1 + T)⁻¹ := (tendsto_order.1 h).2 _ (inv_pos.mpr hT) filter_upwards [hevent] with k hk - have hfk : 0 < 1 + f k := by linarith [hf k] + have hfk : 0 < 1 + f k := by linarith only [hf k] have hlt : T < f k := by have hinv : (1 + f k)⁻¹ < (1 + T)⁻¹ := hk have hraw : 1 + T < 1 + f k := (inv_lt_inv₀ hfk hT).mp hinv - linarith + linarith only [hraw] exact (le_max_left M 0).trans hlt.le theorem compactifiedHierarchyCoordinate_limit_pos_of_bddAbove @@ -3211,7 +3190,7 @@ theorem compactifiedHierarchyCoordinate_limit_pos_of_bddAbove atTop (nhds x)) : 0 < x := by have hC₀ : 0 ≤ C := (hf 0).trans (hC 0) - have hCpos : 0 < 1 + C := by linarith + have hCpos : 0 < 1 + C := by linarith only [hC₀] have hlower : (1 + C)⁻¹ ≤ x := by apply ge_of_tendsto h exact Filter.Eventually.of_forall fun k => @@ -3221,7 +3200,7 @@ theorem compactifiedHierarchyCoordinate_limit_pos_of_bddAbove theorem compactifiedHierarchyCoordinate_antitone {u v : ℝ} (hu : 0 ≤ u) (hv : 0 ≤ v) (h : u ≤ v) : compactifiedHierarchyCoordinate v ≤ compactifiedHierarchyCoordinate u := by - exact (inv_le_inv₀ (by linarith : 0 < 1 + v) + exact (inv_le_inv₀ (by linarith only [hv] : 0 < 1 + v) (by linarith : 0 < 1 + u)).mpr (by linarith) theorem compactifiedHierarchyCoordinate_recovered_nonneg @@ -3229,13 +3208,13 @@ theorem compactifiedHierarchyCoordinate_recovered_nonneg 0 ≤ x⁻¹ - 1 := by have hinv : (1 : ℝ) ≤ x⁻¹ := by simpa only [inv_one] using (inv_le_inv₀ (by norm_num : (0 : ℝ) < 1) hx).mpr hx' - linarith + linarith only [hinv] theorem compactifiedHierarchyCoordinate_recovered_antitone {x y : ℝ} (hx : 0 < x) (hy : 0 < y) (hxy : x ≤ y) : y⁻¹ - 1 ≤ x⁻¹ - 1 := by have hinv := (inv_le_inv₀ hy hx).mpr hxy - linarith + linarith only [hinv] theorem exists_levelRate_minimizing_sequence {r : ℕ} {s : ℝ} (hne : (levelRateSet r s).Nonempty) : @@ -3337,7 +3316,7 @@ theorem compactifiedHierarchyTuple_limit_weak_interlacing {r : ℕ} ((h (φ k)).stabilizer_pos i).le ((h (φ k)).ambient_nonneg i.castSucc) ((h (φ k)).2 i).1.le) - linarith + linarith only [hle] · have hlim := (hB i).sub (hA i.succ) have hle : B i - A i.succ ≤ 0 := by apply le_of_tendsto hlim @@ -3346,7 +3325,7 @@ theorem compactifiedHierarchyTuple_limit_weak_interlacing {r : ℕ} ((h (φ k)).ambient_nonneg i.succ) ((h (φ k)).stabilizer_pos i).le ((h (φ k)).2 i).2.le) - linarith + linarith only [hle] theorem compactifiedHierarchyTuple_recovered_weak_interlacing {r : ℕ} {A : Fin (r + 1) → ℝ} {B : Fin r → ℝ} @@ -3607,8 +3586,6 @@ theorem tendsto_scaleCoordinate_sq_div_atTop {c : ℝ} (hc : 0 < c) : simp [hroot] apply hlimit.congr' filter_upwards [eventually_gt_atTop (0 : ℝ)] with u hu - have hquadratic : 0 ≤ (u * (1 + u)) := by - positivity have hrad : 0 ≤ 1 + 4 * c ^ 2 * (u * (1 + u)) := by positivity have hsmall : 0 ≤ u⁻¹ ^ 2 + 4 * c ^ 2 * (u⁻¹ + 1) := by positivity @@ -3628,7 +3605,7 @@ theorem tendsto_scaleCoordinate_sq_atTop {c : ℝ} (hc : 0 < c) : have hratio := tendsto_scaleCoordinate_sq_div_atTop hc have hevent : ∀ᶠ u : ℝ in atTop, c / 2 < scaleCoordinate (c ^ 2) u / u := - hratio.eventually (Ioi_mem_nhds (by linarith)) + hratio.eventually (Ioi_mem_nhds (by linarith only [hc])) have hle : (fun u : ℝ => (c / 2) * u) ≤ᶠ[atTop] (fun u : ℝ => scaleCoordinate (c ^ 2) u) := by @@ -3636,7 +3613,7 @@ theorem tendsto_scaleCoordinate_sq_atTop {c : ℝ} (hc : 0 < c) : have hmul := (lt_div_iff₀ hupos).mp hu exact hmul.le exact tendsto_atTop_mono' atTop hle - (tendsto_id.const_mul_atTop (by linarith)) + (tendsto_id.const_mul_atTop (by linarith only [hc])) theorem scaleCoordinate_sq_lt_self {c u : ℝ} (hc : 0 < c) (hc' : c < 1) (hu : 0 < u) : @@ -3649,7 +3626,7 @@ theorem scaleCoordinate_sq_lt_self {c u : ℝ} have hle : u ≤ scaleCoordinate (c ^ 2) u := le_of_not_gt hnot have hmon := quadraticCoordinate_strictMonoOn.monotoneOn hu.le hscale hle rw [quadraticCoordinate_scaleCoordinate (sq_nonneg c) hu.le] at hmon - nlinarith [mul_pos (sub_pos.mpr hc') (by linarith : 0 < 1 + c)] + nlinarith only [hmon, hquad, mul_pos (sub_pos.mpr hc') (by linarith : 0 < 1 + c)] theorem eventually_interlacing_prepend_scale {r : ℕ} {a : Fin (r + 1) → ℝ} {b : Fin r → ℝ} @@ -3704,7 +3681,7 @@ theorem tendsto_spectralAtom_atTop_half : unfold spectralAtom have hfactor : u * (1 + u) = u ^ 2 * (1 + u⁻¹) := by field_simp [hu.ne'] - ring + ac_rfl rw [hfactor, Real.sqrt_mul (sq_nonneg u), Real.sqrt_sq_eq_abs, abs_of_pos hu] field_simp [hu.ne'] @@ -3775,7 +3752,7 @@ theorem Gamma_prepend_eq_spectralAtom_add_retained change lagrangeWeight (Fin.cons u a) (prependStabilizer v b) 0 + ∑ i : Fin (r + 1), lagrangeWeight (Fin.cons u a) (prependStabilizer v b) i.succ = 1 at hweights - nlinarith [congrArg (fun z : ℝ => z * spectralAtom u) hweights] + linarith only [congrArg (fun z : ℝ => z * spectralAtom u) hweights] theorem tendsto_lagrangeWeight_prepend_scale_succ {r : ℕ} @@ -3802,7 +3779,7 @@ theorem tendsto_lagrangeWeight_prepend_scale_succ have hquad : ((a i) * (1 + (a i))) < (u * (1 + u)) := quadraticCoordinate_strictMonoOn (h.ambient_nonneg i) hu0.le hau have hne : ((a i) * (1 + (a i))) - (u * (1 + u)) ≠ 0 := by - linarith + linarith only [hquad] rw [lagrangeWeight_prepend_succ h u (scaleCoordinate (c ^ 2) u) i hne, quadraticCoordinate_scaleCoordinate (sq_nonneg c) hu0.le] @@ -3921,7 +3898,7 @@ theorem exists_nextLevel_compactified_certificate_lt_of_spectral_limit Interlacing A B ∧ s < 2 * Gamma A B ∧ Phi A B < R := by have htarget : s < 2 * (((1 - c ^ 2) / 2) + c ^ 2 * Gamma a b) := by - nlinarith + linarith only [hscaled] have hspectral : ∀ᶠ u : ℝ in atTop, s < 2 * Gamma (prependAmbient u a) @@ -3954,7 +3931,7 @@ theorem hierarchyVariationalRate_le_compactified_certificate_of_spectral_limit obtain ⟨A, B, hAB, hgap, hPhi⟩ := exists_nextLevel_compactified_certificate_lt_of_spectral_limit (R := Phi a b - Real.logb 2 c + ε) - hc hc' a b h hscaled (by linarith) hGamma + hc hc' a b h hscaled (by linarith only [hε]) hGamma exact (hierarchyVariationalRate_le_of_feasible hAB hgap).trans hPhi.le theorem exists_nextLevel_compactified_certificate_lt @@ -3981,7 +3958,7 @@ theorem levelRate_succ_le_compactified_certificate obtain ⟨A, B, hAB, hgap, hPhi⟩ := exists_nextLevel_compactified_certificate_lt (R := Phi a b - Real.logb 2 c + ε) - hc hc' a b h hscaled (by linarith) + hc hc' a b h hscaled (by linarith only [hε]) exact (levelRate_le hAB hgap).trans hPhi.le theorem levelRate_antitone_level @@ -4005,7 +3982,7 @@ theorem levelRate_le_compactified_datum rcases hlevels with ⟨rfl, hjk⟩ | ⟨hc', hjk⟩ · have hgap : s < 2 * Gamma a b := by norm_num at hscaled ⊢ - linarith + linarith only [hscaled] simpa only [Real.logb_one, sub_zero, ge_iff_le] using (levelRate_antitone_level hs hs' hjk).trans (levelRate_le h hgap) · exact (levelRate_antitone_level hs hs' hjk).trans @@ -4065,14 +4042,14 @@ theorem levelRate_le_of_non_strict_spectral let : (𝓝[>] (1 : ℝ)).NeBot := nhdsWithin_Ioi_neBot le_rfl obtain ⟨t, ht, hPhi⟩ := (hside.and hcost).exists - have htpos : 0 < t := by linarith + have htpos : 0 < t := by linarith only [ht] have hinter : Interlacing (scaleAmbient t a) (scaleStabilizer t b) := h.scale htpos have hgain := Gamma_scale_gt h hlast ht have hgap : s < 2 * Gamma (scaleAmbient t a) (scaleStabilizer t b) := by - linarith + linarith only [hboundary, hgain] exact (levelRate_le hinter hgap).trans hPhi.le · have hzero : a (Fin.last j) = 0 := le_antisymm (le_of_not_gt hlast) h.1 @@ -4081,12 +4058,12 @@ theorem levelRate_le_of_non_strict_spectral have ha0 : a 0 = 0 := by simpa only [Fin.isValue, Fin.last_zero] using hzero rw [Gamma_zero, ha0] at hboundary norm_num [spectralAtom] at hboundary - linarith + linarith only [hs, hboundary] | succ j => obtain ⟨A, _, hA, hGamma, hPhi⟩ := exists_sameLevel_opening_strict_refinement (Nat.succ_pos j) h hzero - exact (levelRate_le hA (by linarith)).trans hPhi.le + exact (levelRate_le hA (by linarith only [hboundary, hGamma])).trans hPhi.le theorem levelRate_le_compactified_boundary_datum {r j : ℕ} {s c : ℝ} @@ -4100,12 +4077,12 @@ theorem levelRate_le_compactified_boundary_datum rcases hlevels with ⟨rfl, hjr⟩ | ⟨hc_lt, hjr⟩ · have hboundary : s ≤ 2 * Gamma a b := by norm_num at hscaled ⊢ - linarith + linarith only [hscaled] simpa only [Real.logb_one, sub_zero, ge_iff_le] using (levelRate_antitone_level hs hs' hjr).trans (levelRate_le_of_non_strict_spectral hs a b h hboundary) · have hpositive : 0 < 1 - 2 * Gamma a b := by - linarith [h.Gamma_lt_half] + linarith only [h.Gamma_lt_half] have hlog : Tendsto (fun d : ℝ => Phi a b - Real.logb 2 d) (𝓝[<] c) (𝓝 (Phi a b - Real.logb 2 c)) := by @@ -4127,10 +4104,9 @@ theorem levelRate_le_compactified_boundary_datum (hside.and (hpos.and hcost)).exists have hd_one : d < 1 := hd_lt.trans hc_lt have hsquare : d ^ 2 < c ^ 2 := by - nlinarith [mul_pos hd_pos (sub_pos.mpr hd_lt), - mul_pos hc (sub_pos.mpr hd_lt)] + nlinarith only [mul_pos hd_pos (sub_pos.mpr hd_lt)] have hstrict : s < 1 - d ^ 2 * (1 - 2 * Gamma a b) := by - nlinarith [mul_pos (sub_pos.mpr hsquare) hpositive] + nlinarith only [hscaled, mul_pos (sub_pos.mpr hsquare) hpositive] exact (levelRate_le_compactified_datum hs hs' hd_pos a b h hstrict (Or.inr ⟨hd_one, hjr⟩)).trans hd_cost.le @@ -4161,8 +4137,8 @@ theorem stieltjesPhase_nonneg {r : ℕ} · apply Finset.sum_nonneg intro i _ apply Real.log_nonneg - apply (le_div_iff₀ (by linarith [h.stabilizer_quadratic_pos i])).2 - nlinarith [h.quadratic_phase_interval i] + apply (le_div_iff₀ (by linarith only [ht, h.stabilizer_quadratic_pos i])).2 + linarith only [h.quadratic_phase_interval i] theorem stieltjesPhaseProduct_pos {r : ℕ} {a : Fin (r + 1) → ℝ} {b : Fin r → ℝ} @@ -4172,9 +4148,9 @@ theorem stieltjesPhaseProduct_pos {r : ℕ} apply div_pos · apply mul_pos ht exact Finset.prod_pos fun i _ => by - linarith [h.stabilizer_quadratic_pos i] + linarith only [ht, h.stabilizer_quadratic_pos i] · exact Finset.prod_pos fun i _ => by - linarith [h.ambient_quadratic_nonneg i] + linarith only [ht, h.ambient_quadratic_nonneg i] theorem stieltjesPhaseProduct_le_one {r : ℕ} {a : Fin (r + 1) → ℝ} {b : Fin r → ℝ} @@ -4290,7 +4266,7 @@ private theorem cancel_common_quadratic_factor_metriccodes2_79e88af7 (x * A) / (B * (x * C)) = (x * x⁻¹) * (A * (C⁻¹ * B⁻¹)) := by simp only [div_eq_mul_inv, mul_inv_rev] - ring + ac_rfl _ = A / (B * C) := by rw [mul_inv_cancel₀ hx] simp only [one_mul, div_eq_mul_inv, mul_inv_rev] @@ -4309,7 +4285,7 @@ theorem hierarchyStieltjesRatio_tail_of_head_collision {r : ℕ} rw [hierarchyStieltjesRatio_prepend] have hfactor : t + ((a 0) * (1 + (a 0))) ≠ 0 := by have ha := h.ambient_nonneg 0 - nlinarith [mul_nonneg ha (by linarith : 0 ≤ 1 + a 0)] + linarith only [ht, mul_nonneg ha (by linarith : 0 ≤ 1 + a 0)] rw [← hcollision] simp only [ne_eq, hfactor, not_false_eq_true, div_self, one_mul] @@ -4323,8 +4299,7 @@ theorem hierarchyStieltjesRatio_drop_second_of_collision {r : ℕ} (Fin.cons (a 0) (Fin.tail (Fin.tail a))) (Fin.tail b) t := by have hfactor : t + ((a (1 : Fin (r + 2))) * (1 + (a (1 : Fin (r + 2))))) ≠ 0 := by have ha := h.ambient_nonneg (1 : Fin (r + 2)) - nlinarith [mul_nonneg ha - (by linarith : 0 ≤ 1 + a (1 : Fin (r + 2)))] + nlinarith only [ht, mul_nonneg ha (by linarith : 0 ≤ 1 + a (1 : Fin (r + 2)))] simp only [hierarchyStieltjesRatio, Fin.prod_univ_succ, Fin.cons_zero, Fin.cons_succ, Fin.tail] rw [hcollision] @@ -4510,10 +4485,10 @@ theorem paired_stabilizer_tendsto_atTop_of_ambient have hmul : 1 + a (φ n) i.castSucc ≤ D * (1 + b (φ n) i) := (div_le_iff₀ - (by linarith [(h (φ n)).stabilizer_pos i])).mp hratio + (by linarith only [(h (φ n)).stabilizer_pos i])).mp hratio apply (sub_le_iff_le_add).mpr apply (div_le_iff₀ hD).mpr - nlinarith + linarith only [hmul] have hleft : Tendsto (fun n => a (φ n) i.castSucc / D - 1) atTop atTop := by convert tendsto_atTop_add_const_right atTop (-1) @@ -4836,7 +4811,6 @@ theorem exists_compactified_residual_of_closure_sequence have hbound : ∀ n, Phi (a n) (b n) ≤ R + 1 := by intro n refine (hPhi n).trans ?_ - have hn : 0 ≤ (n : ℝ) := Nat.cast_nonneg n have hden : 0 < (n : ℝ) + 1 := by linarith have hfrac : 1 / ((n : ℝ) + 1) ≤ (1 : ℝ) := (div_le_one hden).2 (by linarith) @@ -5311,11 +5285,10 @@ theorem exists_forward_residual_entropy_of_closure_sequence have hbound : ∀ n, Phi (a n) (b n) ≤ R + 1 := by intro n refine (hPhi n).trans ?_ - have hn : 0 ≤ (n : ℝ) := Nat.cast_nonneg n - have hden : 0 < (n : ℝ) + 1 := by linarith + have hden : 0 < (n : ℝ) + 1 := by linarith only [] have hfrac : 1 / ((n : ℝ) + 1) ≤ (1 : ℝ) := - (div_le_one hden).2 (by linarith) - linarith + (div_le_one hden).2 (by linarith only []) + linarith only [hfrac] have hlast : 0 < A (Fin.last r) := by have h := (hpositiveA (Fin.last j)).1 have hindex : @@ -5508,7 +5481,7 @@ theorem hierarchyStieltjesRatio_append {k r : ℕ} simp only [Fin.append_left, Fin.append_right] rw [Finset.prod_div_distrib] simp only [div_eq_mul_inv, mul_inv_rev] - ring + ac_rfl theorem tendsto_quadraticCoordinate_of_tendsto {u : ℕ → ℝ} {x : ℝ} @@ -5568,8 +5541,8 @@ theorem tendsto_hierarchyStieltjesRatio_of_coordinatewise apply Finset.prod_ne_zero_iff.mpr intro i _ have hq : 0 ≤ ((A i) * (1 + (A i))) := by - exact mul_nonneg (hA i) (by linarith [hA i]) - linarith + exact mul_nonneg (hA i) (by linarith only [hA i]) + linarith only [ht, hq] exact hnum.div hden hnonzero theorem tendsto_hierarchyStieltjesRatio_append_of_escaping @@ -5864,22 +5837,7 @@ theorem compactifiedEscapingRatioProduct_eq_filtered_prefix {R k j : ℕ} (hkj : k + j = R) (d : Fin R → ℝ) : compactifiedEscapingRatioProduct hkj d = ∏ i ∈ Finset.univ.filter (fun i : Fin R => i.val < k), d i := by - classical - subst R - unfold compactifiedEscapingRatioProduct - apply Finset.prod_bij - (fun i _ => (i.castAdd j : Fin (k + j))) - · intro i _ - exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, i.isLt⟩ - · intro i₁ _ i₂ _ heq - apply Fin.ext - simpa only [Fin.val_castAdd] using congrArg (fun z : Fin (k + j) => z.val) heq - · intro i hi - have hik : i.val < k := (Finset.mem_filter.mp hi).2 - refine ⟨⟨i.val, hik⟩, Finset.mem_univ _, ?_⟩ - exact Fin.ext rfl - · intro i _ - rfl + exact @compactifiedEscapingRatioProduct_eq_filtered R k j hkj d theorem tendsto_Gamma_of_compactified_suffix {R k j q : ℕ} (hkj : k + j = R) @@ -5993,7 +5951,7 @@ theorem compactified_certificate_residual_threshold_le s ≤ 1 - c ^ 2 * (1 - 2 * Gamma A B) := by have h := compactified_certificate_threshold_le hφ hthreshold hfeasible hspectral - nlinarith + linarith only [h] /-- Subsequential compactification of fixed-level families with bounded entropy into a residual hierarchy. -/ @@ -6056,12 +6014,12 @@ theorem fixedLevelForwardCompactifiedResidualLimit intro C a b hinter hbound have hnegative : ∀ n, (-1 : ℝ) < 2 * Gamma (a n) (b n) := by intro n - linarith [(hinter n).Gamma_nonneg] + linarith only [(hinter n).Gamma_nonneg] have herror : ∀ n : ℕ, Phi (a n) (b n) ≤ C + 1 / ((n : ℝ) + 1) := by intro n have hpos : 0 ≤ (1 : ℝ) / ((n : ℝ) + 1) := by positivity - linarith [hbound n] + linarith only [hpos, hbound n] obtain ⟨L, X, Y, d, φ, k, j, hkj, q, A, B, c, hφ, hLnonneg, hLC, hX, hY, hXlim, hYlim, hthreshold, hnegativeφ, hPhilim, hd, hdlim, @@ -6118,7 +6076,7 @@ theorem levelRate_succ_lt_of_compactified_positive_minimizer exists_nextLevel_strict_refinement h hlast have hc2 : 0 < c ^ 2 := sq_pos_of_pos hc have hgap : s < 1 - c ^ 2 * (1 - 2 * Gamma A B) := by - nlinarith + nlinarith only [hfeasible, hGamma, hc2] have hlevels : (c = 1 ∧ j + 1 ≤ r + 1) ∨ (c < 1 ∧ (j + 1) + 1 ≤ r + 1) := by @@ -6129,7 +6087,7 @@ theorem levelRate_succ_lt_of_compactified_positive_minimizer calc levelRate (r + 1) s ≤ Phi A B - Real.logb 2 c := htransfer A B hAB hgap hlevels - _ < Phi a b - Real.logb 2 c := by linarith + _ < Phi a b - Real.logb 2 c := by linarith only [hPhi] _ = levelRate r s := hmin.symm end @@ -6145,7 +6103,7 @@ theorem log_inv_lt_half_inv_sub_self {t : ℝ} have hx' : x < 1 := by dsimp [x] exact (div_lt_one (by linarith)).mpr (by linarith) - have hden : 0 < 1 - x ^ 2 := by nlinarith + have hden : 0 < 1 - x ^ 2 := by nlinarith only [hx', hx] have hratio : (1 + x) / (1 - x) = 1 / t := by dsimp [x] field_simp [ht.ne'] @@ -6186,7 +6144,7 @@ theorem lt_log_one_add_add_half_log_one_add_sq {t : ℝ} have hy : 0 ≤ y := by dsimp [y]; positivity have hy' : y < 1 := by dsimp [y] - exact (div_lt_one (by positivity)).mpr (by linarith) + exact (div_lt_one (by positivity)).mpr (by linarith only []) have hxratio : (1 + x) / (1 - x) = 1 + t := by dsimp [x] field_simp @@ -6207,7 +6165,7 @@ theorem lt_log_one_add_add_half_log_one_add_sq {t : ℝ} mul_zero, zero_add, pow_one, CharP.cast_eq_zero, div_one] using h have hrational : t < 2 * x + y := by dsimp [x, y] - have hden₁ : 0 < 2 + t := by linarith + have hden₁ : 0 < 2 + t := by linarith only [ht] have hden₂ : 0 < 2 + t ^ 2 := by positivity apply sub_pos.mp have hidentity : @@ -6219,7 +6177,7 @@ theorem lt_log_one_add_add_half_log_one_add_sq {t : ℝ} exact div_pos (mul_pos (pow_pos ht 3) (sub_pos.mpr ht')) (mul_pos hden₁ hden₂) - nlinarith + linarith only [hxlog, hylog, hrational] theorem classicalThreshold_entropy_lt_half_neg_logb {s : ℝ} (hs : 0 < s) (hs' : s < 1) : @@ -6228,24 +6186,24 @@ theorem classicalThreshold_entropy_lt_half_neg_logb let u : ℝ := Real.sqrt (1 - s ^ 2) let t : ℝ := s / (1 + u) let a : ℝ := MetricCodes.classicalThreshold s - have hrad : 0 < 1 - s ^ 2 := by nlinarith + have hrad : 0 < 1 - s ^ 2 := by nlinarith only [hs', hs] have hu : 0 < u := Real.sqrt_pos.mpr hrad have hu_sq : u ^ 2 = 1 - s ^ 2 := Real.sq_sqrt hrad.le have ht : 0 < t := by dsimp [t]; positivity have ht' : t < 1 := by dsimp [t] apply (div_lt_one (by positivity)).mpr - linarith - have htden : 0 < 1 - t ^ 2 := by nlinarith + linarith only [hs', hu] + have htden : 0 < 1 - t ^ 2 := by nlinarith only [ht', ht] have hsparam : s = 2 * t / (1 + t ^ 2) := by dsimp [t] field_simp - nlinarith [hu_sq] + linarith only [hu_sq] have ha : 0 < a := MetricCodes.classicalThreshold_pos hs hs' have ht_sq : t ^ 2 = (1 - u) / (1 + u) := by dsimp [t] field_simp - nlinarith [hu_sq] + linarith only [hu_sq] have haparam : a = t ^ 2 / (1 - t ^ 2) := by change (1 / u - 1) / 2 = t ^ 2 / (1 - t ^ 2) rw [ht_sq] @@ -6303,7 +6261,7 @@ theorem classicalThreshold_entropy_lt_half_neg_logb have hgap : 0 < Real.log (1 + t) + (1 / 2 : ℝ) * Real.log (1 + t ^ 2) - 2 * t ^ 2 / (1 - t ^ 2) * Real.log (1 / t) := by - linarith + linarith only [hfirst, hlast] have hidentity : Real.log 2 * (-(1 / 2 : ℝ) * Real.logb 2 (1 - s) - @@ -6339,13 +6297,13 @@ theorem compactified_zero_residual_cost_le (hc : 0 < c) (hfeasible : s ≤ 1 - c ^ 2) : -(1 / 2 : ℝ) * Real.logb 2 (1 - s) ≤ -Real.logb 2 c := by have hcsquare : 0 < c ^ 2 := sq_pos_of_pos hc - have hsquare : c ^ 2 ≤ 1 - s := by linarith + have hsquare : c ^ 2 ≤ 1 - s := by linarith only [hfeasible] have hlog : Real.logb 2 (c ^ 2) ≤ Real.logb 2 (1 - s) := Real.logb_le_logb_of_le (by norm_num : (1 : ℝ) < 2) hcsquare hsquare rw [Real.logb_pow] at hlog norm_num at hlog ⊢ - linarith + linarith only [hlog] theorem classicalThreshold_entropy_lt_neg_logb_of_compactified_zero {s c : ℝ} (hs : 0 < s) (hs' : s < 1) @@ -6372,20 +6330,20 @@ theorem levelRate_zero_le_entropy_of_classicalThreshold_lt have hA : Interlacing A B := by constructor · dsimp [A] - linarith + linarith only [ha, hthreshold] · intro i exact Fin.elim0 i have hboundary : spectralAtom (MetricCodes.classicalThreshold s) = s / 2 := by have h := MetricCodes.Spherical.classicalThreshold_spectral hs hs' rw [MetricCodes.Spherical.Gamma_zero hthreshold] at h change 2 * spectralAtom (MetricCodes.classicalThreshold s) = s at h - linarith + linarith only [h] have hmono := spectralAtom_strictMonoOn hthreshold.le - (show 0 ≤ a by linarith) ha + (show 0 ≤ a by linarith only [ha, hthreshold]) ha have hgap : s < 2 * Gamma A B := by rw [Gamma_zero] change s < 2 * spectralAtom a - linarith + linarith only [hboundary, hmono] simpa only [ge_iff_le, Phi_zero] using levelRate_le hA hgap theorem levelRate_zero_eq_classical_of_pos @@ -6459,7 +6417,7 @@ theorem exists_compactified_positive_levelRate_minimizer have hdrop : c < 1 → j < r := by intro hclt rcases hlevels with ⟨hcone, _⟩ | ⟨_, hj⟩ - · linarith + · linarith only [hclt, hcone] · omega have hlast : 0 < a (Fin.last j) := by by_contra hnot @@ -6475,7 +6433,7 @@ theorem exists_compactified_positive_levelRate_minimizer simp only [Phi_zero, Fin.isValue, ha, sphericalEntropy_zero] have hscaled : s ≤ 1 - c ^ 2 := by rw [hGamma] at hfeasible - nlinarith + linarith only [hfeasible] have hclassical := classicalThreshold_entropy_lt_neg_logb_of_compactified_zero hs hs' hc hscaled @@ -6488,17 +6446,17 @@ theorem exists_compactified_positive_levelRate_minimizer (MetricCodes.classicalThreshold s) := levelRate_zero_eq_classical hs.le hs' rw [hPhi] at hmin - linarith + linarith only [hmin, hclassical, hupper] | succ j => obtain ⟨A, _, hA, hGamma, hPhi⟩ := exists_sameLevel_opening_strict_refinement (Nat.succ_pos j) h hzero have hstrict : s < 1 - c ^ 2 * (1 - 2 * Gamma A b) := by - nlinarith [sq_pos_of_pos hc] + nlinarith only [hfeasible, hGamma, sq_pos_of_pos hc] have hupper := levelRate_le_compactified_datum hs hs' hc A b hA hstrict hlevels - linarith + linarith only [hmin, hPhi, hupper] exact ⟨j, c, a, b, hj, hc, hc', hdrop, h, hlast, hfeasible, hmin⟩ @@ -6549,7 +6507,7 @@ theorem boundaryQuadratic_classicalThreshold_eq_zero (fun x : ℝ => x * Real.sqrt (a * (1 + a))) hspectral change MetricCodes.Spherical.boundaryQuadratic s a = 0 unfold MetricCodes.Spherical.boundaryQuadratic - nlinarith + linarith only [hroot_sq, hmult] theorem boundaryDegree_classicalThreshold_eq_zero {s : ℝ} (hs : 0 < s) (hs' : s < 1) : @@ -6577,7 +6535,7 @@ theorem boundaryDegree_spectral_eq rw [MetricCodes.Gamma_eq_sub, ← mul_div_assoc, div_eq_iff hden.ne'] unfold MetricCodes.Spherical.boundaryQuadratic at hroot - nlinarith + linarith only [hroot] theorem exists_variationalRate_boundary_minimizer_of_limit {s L : ℝ} (hs : 0 < s) (hs' : s < 1) @@ -6609,7 +6567,7 @@ theorem exists_variationalRate_boundary_minimizer_of_limit oneRowBoundaryObjective s u < MetricCodes.sphericalEntropy (MetricCodes.classicalThreshold s) := by unfold oneRowBoundaryObjective - linarith + linarith only [himprove, hboundary] have hgood_limit : oneRowBoundaryObjective s u < L := hgood.trans hendpoint obtain ⟨A, hA⟩ := @@ -6693,7 +6651,7 @@ theorem levelRate_one_lt_variationalRate_of_boundary_minimizer rw [Gamma_oneRow ha] exact boundaryDegree_spectral_eq ha hquadratic.le have hspectral : s < 2 * Gamma A (![b]) := by - linarith + linarith only [hgamma, heq] calc levelRate 1 s ≤ Phi A (![b]) := levelRate_le hA hspectral @@ -6735,7 +6693,7 @@ theorem classicalHierarchyProfile_continuousOn_Icc exact (MetricCodes.Spherical.sphericalEntropy_continuous.continuousAt.comp (MetricCodes.Spherical.classicalThreshold_continuousAt - (by linarith [ht.1]) (lt_of_le_of_lt ht.2 hs))).continuousWithinAt + (by linarith only [ht.1]) (lt_of_le_of_lt ht.2 hs))).continuousWithinAt theorem levelRate_zero_continuousOn_Icc {s : ℝ} (hs : s < 1) : @@ -6840,15 +6798,15 @@ theorem rowVariationalRate_zero : let b : ℝ := a / 2 have ha : 0 < a := by dsimp [a]; positivity have hb : 0 < b := by dsimp [b]; positivity - have hba : b < a := by dsimp [b]; linarith + have hba : b < a := by dsimp [b]; linarith only [ha] have hgamma : 0 < MetricCodes.Gamma a b := MetricCodes.Gamma_pos hb.le hba have hfeasible : MetricCodes.Spherical.Feasible 0 a b := - ⟨hb, hba, by linarith⟩ + ⟨hb, hba, by linarith only [hgamma]⟩ have hbound := MetricCodes.Spherical.variationalRate_le_of_feasible hfeasible have hbentropy := MetricCodes.sphericalEntropy_pos hb dsimp [a] at hbound ⊢ - linarith + linarith only [hbound, hbentropy] theorem eventually_rowVariationalRate_le_squared_entropy : ∀ᶠ t : ℝ in 𝓝[>] 0, @@ -7075,15 +7033,15 @@ private theorem rowProfile_zero_metriccodes2_a5c70490 : let b : ℝ := a / 2 have ha : 0 < a := by dsimp [a]; positivity have hb : 0 < b := by dsimp [b]; positivity - have hba : b < a := by dsimp [b]; linarith + have hba : b < a := by dsimp [b]; linarith only [ha] have hgamma : 0 < MetricCodes.Gamma a b := MetricCodes.Gamma_pos hb.le hba have hfeasible : MetricCodes.Spherical.Feasible 0 a b := - ⟨hb, hba, by linarith⟩ + ⟨hb, hba, by linarith only [hgamma]⟩ have hbound := MetricCodes.Spherical.variationalRate_le_of_feasible hfeasible have hbentropy := MetricCodes.sphericalEntropy_pos hb dsimp [a] at hbound ⊢ - linarith + linarith only [hbound, hbentropy] theorem oneRowBoundaryObjective_joint_continuous : Continuous (fun p : ℝ × ℝ => oneRowBoundaryObjective p.1 p.2) := by @@ -7182,13 +7140,14 @@ theorem variationalRate_lowerSemicontinuousOn_Icc_of_jointEscape (fun n => MetricCodes.classicalThreshold (v (φ n))) atTop (nhds (MetricCodes.classicalThreshold x)) := (MetricCodes.Spherical.classicalThreshold_continuousAt - (by linarith : -1 < x) hxone).tendsto.comp hvsub + (by linarith only [hs, hs', hxpos, hx, hxzero, hux, hu] : -1 < x) + hxone).tendsto.comp hvsub have hdiff := hthresholdlim.sub halim have hle : MetricCodes.classicalThreshold x ≤ A := by have hnonpos : MetricCodes.classicalThreshold x - A ≤ 0 := le_of_tendsto hdiff (Filter.Eventually.of_forall (fun n => (sub_nonpos.mpr (hthreshold (φ n)).le))) - linarith + linarith only [hnonpos] have hpair : Tendsto (fun n => (v (φ n), a (φ n))) atTop (nhds (x, A)) := hvsub.prodMk_nhds halim @@ -7273,7 +7232,7 @@ theorem exists_strict_hierarchy_refinement_of_closed by_cases hlast : 0 < a (Fin.last r) · obtain ⟨A, B, hAB, hGamma, hPhi⟩ := exists_nextLevel_strict_refinement hinterlacing hlast - exact ⟨r + 1, A, B, hAB, by linarith, hPhi⟩ + exact ⟨r + 1, A, B, hAB, by linarith only [hspectral, hGamma], hPhi⟩ · have hzero : a (Fin.last r) = 0 := le_antisymm (le_of_not_gt hlast) hinterlacing.1 cases r with @@ -7284,12 +7243,12 @@ theorem exists_strict_hierarchy_refinement_of_closed norm_num [spectralAtom] rw [hgamma] at hspectral norm_num at hspectral - linarith + linarith only [hs, hspectral] | succ r => obtain ⟨A, _, hA, hGamma, hPhi⟩ := exists_sameLevel_opening_strict_refinement (Nat.succ_pos r) hinterlacing hzero - exact ⟨r + 1, A, b, hA, by linarith, hPhi⟩ + exact ⟨r + 1, A, b, hA, by linarith only [hspectral, hGamma], hPhi⟩ theorem closedHierarchyVariationalRate_eq_hierarchyVariationalRate {s : ℝ} (hs : 0 < s) (hs' : s < 1) : @@ -7369,7 +7328,7 @@ theorem eventually_sphericalCodeNumber_lt_hierarchyVariationalRate_of_code_bound have hlt : sInf (hierarchyRateSet s) < hierarchyVariationalRate s + ε := by change hierarchyVariationalRate s < hierarchyVariationalRate s + ε - linarith + linarith only [hε] obtain ⟨z, ⟨r, a, b, hinterlacing, hspectral, rfl⟩, hrate⟩ := exists_lt_of_csInf_lt hnonempty hlt filter_upwards [hcode hs hs' a b hinterlacing hspectral hrate] @@ -7386,7 +7345,7 @@ theorem sphericalCodeRate_le_closedHierarchyVariationalRate_of_code_bound apply le_of_forall_pos_le_add intro ε hε exact sphericalCodeRate_le_of_eventually_exponential - (by linarith [hierarchyVariationalRate_nonneg hs hs']) + (by linarith only [hε, hierarchyVariationalRate_nonneg hs hs']) (eventually_sphericalCodeNumber_lt_hierarchyVariationalRate_of_code_bound hcode hs hs' hε) @@ -7419,13 +7378,11 @@ theorem compactificationCapFactor_sq theorem compactificationCapFactor_lt_one {s t : ℝ} (hs : s < 1) (hts : t < s) : compactificationCapFactor s t < 1 := by - have hden : 0 < 1 - t := by linarith + have hden : 0 < 1 - t := by linarith only [hs, hts] have hratio : (1 - s) / (1 - t) < 1 := by - exact (div_lt_one hden).2 (by linarith) + exact (div_lt_one hden).2 (by linarith only [hts]) have hsq := compactificationCapFactor_sq hs hts.le - have hnonneg : 0 ≤ compactificationCapFactor s t := - (compactificationCapFactor_pos hs hts.le).le - nlinarith + nlinarith only [hratio, hsq] theorem neg_logb_compactificationCapFactor_eq_sliceCost {s t : ℝ} (hs : s < 1) (hts : t ≤ s) : @@ -7437,10 +7394,10 @@ theorem neg_logb_compactificationCapFactor_eq_sliceCost unfold compactificationCapFactor MetricCodes.Spherical.SidelnikovLocalization.sliceCost Real.logb rw [Real.log_sqrt hratio] - rw [Real.log_div (by linarith : 1 - s ≠ 0) - (by linarith : 1 - t ≠ 0), - Real.log_div (by linarith : 1 - t ≠ 0) - (by linarith : 1 - s ≠ 0)] + rw [Real.log_div (by linarith only [hs] : 1 - s ≠ 0) + (by linarith only [ht] : 1 - t ≠ 0), + Real.log_div (by linarith only [ht] : 1 - t ≠ 0) + (by linarith only [hs] : 1 - s ≠ 0)] ring theorem compactificationCapFactor_scaled_spectral @@ -7450,7 +7407,7 @@ theorem compactificationCapFactor_scaled_spectral (hgap : t < 2 * Gamma a b) : s < 1 - compactificationCapFactor s t ^ 2 * (1 - 2 * Gamma a b) := by - have hden : 0 < 1 - t := by linarith + have hden : 0 < 1 - t := by linarith only [hs, hts] rw [compactificationCapFactor_sq hs hts] have hrewrite : 1 - (1 - s) / (1 - t) * (1 - 2 * Gamma a b) = @@ -7459,7 +7416,7 @@ theorem compactificationCapFactor_scaled_spectral field_simp [hden.ne'] rw [hrewrite] apply (lt_div_iff₀ hden).2 - nlinarith [mul_pos (sub_pos.mpr hs) (sub_pos.mpr hgap)] + linarith only [mul_pos (sub_pos.mpr hs) (sub_pos.mpr hgap)] end @@ -7570,7 +7527,7 @@ theorem hierarchyVariationalRate_le_localizedEnvelope_of_compactification _ = Phi a b + MetricCodes.Spherical.SidelnikovLocalization.sliceCost s t := by rw [← neg_logb_compactificationCapFactor_eq_sliceCost hs' hts.le] - ring + ac_rfl theorem hierarchyVariationalRate_le_localizedHierarchyInf_of_compactification (hcompact : GenuineCompactifiedHierarchyTransfer) diff --git a/LeanPool/MetricCodes/HighestWeights.lean b/LeanPool/MetricCodes/HighestWeights.lean index 8d2ac79bf..bd76c5f73 100644 --- a/LeanPool/MetricCodes/HighestWeights.lean +++ b/LeanPool/MetricCodes/HighestWeights.lean @@ -629,9 +629,9 @@ theorem canonicalAdjacentProjectedRaiseCoefficient_sq_iff_fischerGram low mu hlow hlowGram).ne' constructor <;> intro h · field_simp [hgap, hlowpos] at h ⊢ - nlinarith [h] + linarith [h] · field_simp [hgap, hlowpos] at h ⊢ - nlinarith [h] + linarith [h] theorem canonicalAdjacentProjectedRaiseCoefficient_sq_of_fischerGram {r n : ℕ} (low : Fin (r + 2) → ℕ) @@ -3314,11 +3314,11 @@ theorem arbitraryRowAxialRaise_sameAxis_diamond (arbitraryRowAxialRaise lam i k p) = arbitraryRowAxialRaise (raiseWeight lam j) i k (arbitraryRowAxialRaise lam j k p) := by - apply LinearMap.congr_fun - ((arbitraryRowAxialRaise_sameAxis_diamond_iff_commutator - lam i j hij (hdom hij.le) k).mpr ?_) p - exact arbitraryRowAxialRaise_sameAxis_commutator - lam hdom i j hij k + exact LinearMap.congr_fun + ((arbitraryRowAxialRaise_sameAxis_diamond_iff_commutator lam i j hij (hdom (LT.lt.le hij)) + k).mpr + (arbitraryRowAxialRaise_sameAxis_commutator lam hdom i j hij k)) + p end ArbitraryRowSameAxisDiamondSpectralSuffixClosure @@ -3775,7 +3775,6 @@ theorem coeff_X_mul_pderiv_ne {σ : Type*} · have hma : a ∈ d.support := Finsupp.mem_support_iff.mpr ha rw [ite_eq_left hma, MvPolynomial.coeff_pderiv, ite_eq_right ha] - have hneq : a ≠ b := hab have hsub : (d - (Finsupp.single a 1 : σ →₀ ℕ)) b = d b := by simp only [Finsupp.coe_tsub, Pi.sub_apply, Finsupp.single_eq_of_ne hab.symm, tsub_zero] @@ -3860,7 +3859,6 @@ theorem sourceRowRoot_sourceLeadingMinor_self {r : ℕ} intro heq have hv := congrArg Fin.val heq change i.val = a.val at hv - have ha := a.isLt omega simp only [hne, ↓reduceIte] @@ -3916,7 +3914,6 @@ theorem sourceColumnRoot_sourceLeadingMinor_self {r : ℕ} intro heq have hv := congrArg Fin.val heq change i.val = b.val at hv - have hb := b.isLt omega simp only [hne, ↓reduceIte] @@ -3979,7 +3976,6 @@ theorem sourceRowRoot_sourceLeadingMinor_upper {r : ℕ} intro heq have hv := congrArg Fin.val heq change j.val = a.val at hv - have ha := a.isLt omega simp only [hne, ↓reduceIte] @@ -4872,7 +4868,7 @@ theorem ambientPositiveRoot_nullSubstitution_sourceColumnRoot · simp only [Algebra.algebraMap_self, RingHom.id_apply, hjb, ↓reduceIte, mul_zero, isotropicVariable_eq_nullRowLinearForm, sourceColumnRoot_apply, map_sum, map_mul, nullSubstitution_X, Algebra.smul_def, MvPolynomial.algebraMap_eq, zero_add, map_zero] - ring + ac_rfl theorem ambientCartan_nullSubstitution_sourceColumnRoot {r n : ℕ} (h : 2 * (r + 1) ≤ n) @@ -5143,7 +5139,6 @@ theorem sourceColumnRoot_sourceLeadingMinor_upper {r : ℕ} intro heq have hv := congrArg Fin.val heq change j.val = b.val at hv - have hb := b.isLt omega simp only [hne, ↓reduceIte] @@ -5601,7 +5596,6 @@ theorem exists_minimalBelowColumn_of_mass_pos {m : ℕ} have hpos : 0 < d (a, b) := Nat.pos_of_ne_zero hzero have hcandidate : P b.val := ⟨a, b, rfl, hba, hpos⟩ have hleast : Nat.find hex ≤ b.val := Nat.find_min' hex hcandidate - have hlt : b.val < i'.val := hbi omega theorem eq_zero_of_upperRoots_of_massZero_coeff @@ -5647,7 +5641,6 @@ theorem belowDiagonal_entry_eq_zero_of_mass_eq_zero {m : ℕ} have hproduct : belowDiagonalWeight (i, j) * d (i, j) = 0 := by omega have hweight : belowDiagonalWeight (i, j) ≠ 0 := by change i.val - j.val ≠ 0 - have hvals : j.val < i.val := hji omega exact (mul_eq_zero.mp hproduct).resolve_left hweight @@ -7102,7 +7095,6 @@ theorem pderiv_even_X_unused {r n : ℕ} intro heq have hv := congrArg Fin.val heq simp only [evenCoordinate_val] at hv - have hp := p.isLt omega simp only [MvPolynomial.pderiv_X, ne_eq, DeterminantVectors.variableIndex_eq_iff, he, and_false, not_false_eq_true, Pi.single_eq_of_ne'] @@ -7118,7 +7110,6 @@ theorem pderiv_odd_X_unused {r n : ℕ} intro heq have hv := congrArg Fin.val heq simp only [oddCoordinate_val] at hv - have hp := p.isLt omega simp only [MvPolynomial.pderiv_X, ne_eq, DeterminantVectors.variableIndex_eq_iff, ho, and_false, not_false_eq_true, Pi.single_eq_of_ne'] diff --git a/LeanPool/MetricCodes/Interlacing.lean b/LeanPool/MetricCodes/Interlacing.lean index 60b166ddc..3fae3a174 100644 --- a/LeanPool/MetricCodes/Interlacing.lean +++ b/LeanPool/MetricCodes/Interlacing.lean @@ -374,7 +374,6 @@ theorem sorted_subset_first exact hia · have hbj : b < j := (Finset.mem_filter.mp hj).2 change i.val < j.val - have hia' : i.val < a.val := hia have hbj' : b.val < j.val := hbj omega have hsort : (insert a U).sort (· ≤ ·) = @@ -387,7 +386,6 @@ theorem sorted_subset_first omega · intro h have hba : b < a := (Finset.mem_filter.mp h).2 - have hba' : b.val < a.val := hba omega rw [hins, sort_union_of_forall_lt L (insert a U) hsep, hsort] @@ -418,7 +416,6 @@ theorem sorted_subset_second · have hbj : b < j := (Finset.mem_filter.mp hj).2 change i.val < j.val have hia' : i.val < a.val := hia - have hbj' : b.val < j.val := hbj omega have hsort : (insert b U).sort (· ≤ ·) = b :: U.sort (· ≤ ·) := by @@ -485,7 +482,6 @@ theorem sorted_subset_both · have h' : a.val = b.val := congrArg Fin.val h omega · have hba : b < a := (Finset.mem_filter.mp h).2 - have hba' : b.val < a.val := hba omega rw [hins, sort_union_of_forall_lt L (insert a (insert b U)) hsep, hsorta, hsortb] @@ -804,7 +800,7 @@ theorem simpleRoot_coordinate_path_both hia hab hbj hfront hbefore htail hafter p A B hp ha hb] simp only [MvPolynomial.smul_eq_C_mul, MvPolynomial.C_add, MvPolynomial.C_sub, MvPolynomial.C_1, coordinateToggleBridge] - ring + ac_rfl theorem simpleRoot_coordinate_path_four_states {r n : ℕ} (front : List (Fin (r + 1))) @@ -2080,8 +2076,7 @@ def lowerAxisGramIdeal {r n : ℕ} (k : Fin n) (row : Fin (r + 1)) : theorem axisPolynomial_mem_lowerAxisIdeal {r n : ℕ} (k : Fin n) (row i : Fin (r + 1)) (hi : i < row) : MvPolynomial.X (variableIndex i k) ∈ lowerAxisIdeal k row := by - apply Ideal.subset_span - exact ⟨i, hi, rfl⟩ + exact Ideal.subset_span (Exists.intro i ⟨hi, rfl⟩) theorem gram_le_lowerAxisGramIdeal {r n : ℕ} (k : Fin n) (row : Fin (r + 1)) : @@ -3688,33 +3683,7 @@ theorem youngClebschLower_adjoint_tmul {r n : ℕ} (youngClebschLower mu lam hdeg row).adjoint (v ⊗ₜ[ℝ] q) = projectedCoordinateRaise lam mu hdeg row v q := by - let b := EuclideanSpace.basisFun (Fin n) ℝ - have hv : (∑ j : Fin n, v j • b j) = v := by - simpa [b] using b.sum_repr v - calc - (youngClebschLower mu lam hdeg row).adjoint (v ⊗ₜ[ℝ] q) = - (youngClebschLower mu lam hdeg row).adjoint - ((∑ j : Fin n, v j • b j) ⊗ₜ[ℝ] q) := by rw [hv] - _ = ∑ j : Fin n, - v j • (youngClebschLower mu lam hdeg row).adjoint - (b j ⊗ₜ[ℝ] q) := by - rw [TensorProduct.sum_tmul, map_sum] - apply Finset.sum_congr rfl - intro j _ - rw [← TensorProduct.smul_tmul', map_smul] - _ = ∑ j : Fin n, - v j • projectedCoordinateRaise lam mu hdeg row (b j) q := by - apply Finset.sum_congr rfl - intro j _ - rw [youngClebschLower_adjoint_basis_tmul] - _ = projectedCoordinateRaiseAxis lam mu hdeg row q - (∑ j : Fin n, v j • b j) := by - rw [map_sum] - apply Finset.sum_congr rfl - intro j _ - rw [map_smul] - rfl - _ = projectedCoordinateRaise lam mu hdeg row v q := by rw [hv]; rfl + exact @MultiplicityFreeClebsch.youngClebschLower_adjoint_tmul r n mu lam hdeg row v q namespace ClebschRotation @@ -3747,7 +3716,7 @@ theorem euclideanAmbientRotation_inner {n : ℕ} simp only [euclideanAmbientRotation_apply, EuclideanSpace.basisFun_apply, inner_sub_left, real_inner_smul_left, EuclideanSpace.inner_single_left, Real.ringHom_apply, one_mul, inner_sub_right, real_inner_smul_right, EuclideanSpace.inner_single_right, neg_sub] - ring + ac_rfl theorem euclideanAmbientRotation_adjoint {n : ℕ} (a b : Fin n) : @@ -3897,7 +3866,7 @@ theorem projectedCoordinateRaise_rotation {r n : ℕ} simp only [ambientRotation_apply, ambientCoordinateDerivation_apply, smul_eq_mul, euclideanAmbientRotation_apply, EuclideanSpace.basisFun_apply, youngAmbientRotation_apply_coe] - ring + ac_rfl _ = ⟪projectedCoordinateRaise mu lam hdeg row (euclideanAmbientRotation a b v) p + projectedCoordinateRaise mu lam hdeg row v @@ -3999,7 +3968,7 @@ theorem projectedCoordinateLower_rotation {r n : ℕ} (euclideanAmbientRotation a b v) p, q⟫_ℝ + ⟪projectedCoordinateLower mu lam hdeg row v (youngAmbientRotation lam a b p), q⟫_ℝ := by - ring + ac_rfl _ = _ := (inner_add_left _ _ _).symm theorem channel_rotation_intertwine_of_adjoint {r n : ℕ} @@ -4670,7 +4639,7 @@ theorem boundaryYoungRotationIntertwiner_casimir (youngAmbientCasimir (n := n) mu).comp A := by apply LinearMap.ext intro p - simp only [LinearMap.comp_apply, youngAmbientCasimir, + simp only [LinearMap.comp_apply, youngAmbientCasimir.eq_1, LinearMap.smul_apply, LinearMap.sum_apply, LinearMap.neg_apply, map_smul, map_sum, map_neg] congr 1 @@ -5095,8 +5064,6 @@ theorem adjacentCasimirEigenvalue_lower_lt_raise {r n : ℕ} exact_mod_cast (show i.val ≤ r by omega) have hjR : (j.val : ℝ) ≤ r := by exact_mod_cast (show j.val ≤ r by omega) - have ht : 0 ≤ (target i : ℝ) := Nat.cast_nonneg _ - have hs : 0 ≤ (source j : ℝ) := Nat.cast_nonneg _ linarith theorem adjacentCasimirEigenvalue_ne_of_distinct_oneBox_neighbors @@ -5538,7 +5505,6 @@ theorem phaseCorrectedYoungChannel_adjoint_eq_sqrt {E G : Type*} nlinarith [Real.sq_sqrt hp, Real.sqrt_nonneg p] · rw [phaseNegatedChannel_adjoint_apply, haxis, ← neg_smul] congr 1 - have hnegative : c < 0 := lt_of_not_ge h nlinarith [Real.sq_sqrt hp, Real.sqrt_nonneg p] theorem phaseCorrectedYoungChannel_rotation @@ -6340,8 +6306,6 @@ theorem reverseInterlacingHarmonicBranchGram_scalar_pos change 0 < ⟪c • p, p⟫_ℝ at hpositive have hfactor : ⟪c • p, p⟫_ℝ = c * ⟪p, p⟫_ℝ := real_inner_smul_left p p c - have hproduct : 0 < c * ⟪p, p⟫_ℝ := by - exact hfactor ▸ hpositive have hself : 0 < ⟪p, p⟫_ℝ := real_inner_self_pos.mpr hp nlinarith @@ -7510,9 +7474,9 @@ theorem downstreamCorrectedDerivative_source_mem_multihomogeneous downstreamCorrectedDerivative lam a p k a ∈ youngMultihomogeneousSubmodule n (loweredInternalYoungWeight lam a) := by - apply (mem_youngMultihomogeneousSubmodule_iff_rowEuler - (loweredInternalYoungWeight lam a) _).mpr - exact downstreamCorrectedDerivative_source_rowEuler lam a ha p k + exact (mem_youngMultihomogeneousSubmodule_iff_rowEuler (loweredInternalYoungWeight lam a) + (downstreamCorrectedDerivative lam a p k a)).mpr + (downstreamCorrectedDerivative_source_rowEuler lam a ha p k) theorem downstreamCorrectedDerivative_source_mem_harmonicYoung_of_simpleRoots {r n : ℕ} (lam : Fin (r + 1) → ℕ) @@ -8845,7 +8809,7 @@ theorem reverseCoefficient_sq_of_forward_sq_and_weylRatio minusProbability n (raiseWeight low row) mu row := by rw [hforward, hgramRatio, plusProbability_eq_weylEdgeRatio_mul_minus row h hraise] - ring + ac_rfl /-- Construct the raising projected-axis witness from the forward Gelfand–Tsetlin coefficient, the Weyl Gram ratio, and the reverse projected-axis identity. -/ @@ -9694,8 +9658,6 @@ theorem canonicalFibreAxisCoefficient_sq (hsource : 0 < sourceGram) (htarget : 0 < targetGram) : (raw * Real.sqrt targetGram / Real.sqrt sourceGram) ^ 2 = raw ^ 2 * targetGram / sourceGram := by - have hs : Real.sqrt sourceGram ≠ 0 := - (Real.sqrt_pos.mpr hsource).ne' rw [div_pow, mul_pow, Real.sq_sqrt htarget.le, Real.sq_sqrt hsource.le] diff --git a/LeanPool/MetricCodes/Rates.lean b/LeanPool/MetricCodes/Rates.lean index 7a5648f5a..843176104 100644 --- a/LeanPool/MetricCodes/Rates.lean +++ b/LeanPool/MetricCodes/Rates.lean @@ -65,23 +65,19 @@ theorem inverseVarianceFactor_continuous : apply Continuous.inv₀ · fun_prop · intro r - have hroot : 0 ≤ Real.sqrt (1 - r ^ 2) := - Real.sqrt_nonneg _ positivity theorem inverseDegree_eq_sq_mul_factor {r : ℝ} (hr : r ^ 2 ≤ 1) : inverseDegree r = r * (r * inverseVarianceFactor r) := by - have hradical : 0 ≤ 1 - r ^ 2 := by linarith + have hradical : 0 ≤ 1 - r ^ 2 := by linarith only [hr] have hsquare := Real.sq_sqrt hradical - have hroot : 0 ≤ Real.sqrt (1 - r ^ 2) := - Real.sqrt_nonneg _ have hdenominator : 1 + Real.sqrt (1 - r ^ 2) ≠ 0 := by positivity unfold inverseDegree inverseVarianceFactor field_simp [hdenominator] - nlinarith + linarith only [hsquare] /-- The combination of negative logarithmic terms used in the inverse-degree entropy estimate. -/ def inverseEntropyFactor (r : ℝ) : ℝ := @@ -196,26 +192,26 @@ theorem lowerEndpointRoot_pos {δ : ℝ} 0 < lowerEndpointRoot δ := by unfold lowerEndpointRoot apply Real.sqrt_pos.mpr - linarith + linarith only [hhalf] theorem lowerEndpointRoot_lt_one {δ : ℝ} (hδ : 0 < δ) : lowerEndpointRoot δ < 1 := by unfold lowerEndpointRoot apply (Real.sqrt_lt' (by norm_num : (0 : ℝ) < 1)).2 - linarith + linarith only [hδ] theorem lowerEndpointWeight_pos {δ : ℝ} (hδ : 0 < δ) : 0 < lowerEndpointWeight δ := by unfold lowerEndpointWeight - linarith [lowerEndpointRoot_lt_one hδ] + linarith only [lowerEndpointRoot_lt_one hδ] theorem lowerEndpointWeight_lt_half {δ : ℝ} (hhalf : δ < (1 : ℝ) / 2) : lowerEndpointWeight δ < (1 : ℝ) / 2 := by unfold lowerEndpointWeight - linarith [lowerEndpointRoot_pos hhalf] + linarith only [lowerEndpointRoot_pos hhalf] theorem lowerEndpointDerivative_pos {δ : ℝ} (hδ : 0 < δ) (hhalf : δ < (1 : ℝ) / 2) : @@ -225,10 +221,8 @@ theorem lowerEndpointDerivative_pos {δ : ℝ} have hlog : Real.log (lowerEndpointWeight δ) < Real.log (1 - lowerEndpointWeight δ) := - Real.log_lt_log hweight (by linarith) + Real.log_lt_log hweight (by linarith only [hhalfweight]) have hroot := lowerEndpointRoot_pos hhalf - have hlogtwo : 0 < Real.log (2 : ℝ) := - Real.log_pos (by norm_num) unfold lowerEndpointDerivative exact div_pos (mul_pos hδ (sub_pos.mpr hlog)) @@ -257,7 +251,7 @@ theorem hasDerivAt_mrrwG_boundary_quadratic_zero simpa only [neg_mul] using hquadratic.const_sub (1 : ℝ) have hradicalzero : 1 - ((0 : ℝ) ^ 2 + 2 * δ * 0 + 2 * δ) ≠ 0 := by - have hpositive : 0 < 1 - 2 * δ := by linarith + have hpositive : 0 < 1 - 2 * δ := by linarith only [hhalf] simpa only [ne_eq, OfNat.ofNat_ne_zero, not_false_eq_true, zero_pow, mul_zero, add_zero, zero_add] using hpositive.ne' @@ -295,7 +289,7 @@ theorem hasDerivAt_mrrwG_boundary_quadratic_zero have hweightone : lowerEndpointWeight δ ≠ 1 := by have h := lowerEndpointWeight_lt_half hhalf - linarith + linarith only [h] have hentropyfun : MetricCodes.binaryEntropy = (fun a : ℝ => Real.binEntropy a / Real.log 2) := @@ -365,14 +359,14 @@ theorem exists_mrrwObjective_lt_zero MetricCodes.Johnson.mrrwObjective δ 0) < 0 := by have h := hslope.eventually - (gt_mem_nhds (by linarith : + (gt_mem_nhds (by linarith only [hderivative] : -lowerEndpointDerivative δ < 0)) filter_upwards [h] with r hr simpa only [zero_add, smul_eq_mul] using hr have hupper : ∀ᶠ r : ℝ in 𝓝[>] 0, r < 1 - 2 * δ := nhdsWithin_le_nhds - (gt_mem_nhds (by linarith : (0 : ℝ) < 1 - 2 * δ)) + (gt_mem_nhds (by linarith only [hhalf] : (0 : ℝ) < 1 - 2 * δ)) have hwitness : ∀ᶠ r : ℝ in 𝓝[>] 0, 0 < r ∧ r < 1 - 2 * δ ∧ @@ -440,9 +434,9 @@ theorem inverse_zero_fibre_boundary MetricCodes.Johnson.asymptoticThreshold δ a ∧ MetricCodes.Johnson.mrrwObjective δ r = MetricCodes.Johnson.shellRate a 0 0 u := by - have hrplus : 0 < 1 + r := by linarith - have hrminus : 0 < 1 - r := by linarith - have hmargin : 0 < 1 - 2 * δ - r := by linarith + have hrplus : 0 < 1 + r := by linarith only [hr] + have hrminus : 0 < 1 - r := by linarith only [hδ, hupper] + have hmargin : 0 < 1 - 2 * δ - r := by linarith only [hupper] have hrvariance : 0 < 1 - r ^ 2 := by nlinarith only [mul_pos hrminus hrplus] have hquadratic : @@ -474,13 +468,13 @@ theorem inverse_zero_fibre_boundary let a : ℝ := inverseWeight δ r have hu : 0 < u := by dsimp [u, inverseDegree] - linarith + linarith only [hrootlt] have hua : u < a := by dsimp [u, a, inverseDegree, inverseWeight] - linarith + linarith only [hrootorder] have ha : a < (1 : ℝ) / 2 := by dsimp [a, inverseWeight] - linarith + linarith only [hsmallroot] have ha0 : 0 < a := lt_trans hu hua have haone : 0 < 1 - a := by linarith have huone : 0 < 1 - u := by linarith @@ -494,7 +488,7 @@ theorem inverse_zero_fibre_boundary nlinarith only [hweightsquare] have hdistancevariance : 2 * δ < 4 * a * (1 - a) := by rw [hvariancea] - nlinarith only [mul_pos hδ hr, sq_nonneg r] + nlinarith only [mul_pos hδ hr] have hvarianceweight : 4 * a * (1 - a) < 4 * a := by nlinarith only [mul_pos ha0 ha0] have hweightdistance : δ / 2 < a := by @@ -516,8 +510,11 @@ theorem inverse_zero_fibre_boundary (a * (1 - a) - u * (1 - u)) / (a * (1 - a) * (1 + r)) = δ / (2 * a * (1 - a)) := by - field_simp [ha0.ne', haone.ne', hplus]; - nlinarith only [hvariancea, hvarianceu] + have hdifference : + a * (1 - a) - u * (1 - u) = δ * (1 + r) / 2 := by + linarith only [hvariancea, hvarianceu] + rw [hdifference] + field_simp [ha0.ne', haone.ne', hplus] have hspectral : 1 - MetricCodes.Johnson.spectralLimit a 0 0 u = (a * (1 - a) - u * (1 - u)) / @@ -665,7 +662,7 @@ theorem eventually_binaryEntropy_inward_improvement let M : ℝ := deriv f 0 + 1 have hM : deriv f 0 < M := by dsimp [M] - linarith + linarith only [] have hslope := hf.hasDerivAt.tendsto_slope_zero_right have hupper : ∀ᶠ e : ℝ in 𝓝[>] 0, @@ -697,7 +694,7 @@ theorem eventually_binaryEntropy_inward_improvement mul_lt_mul_of_pos_left hlog' he have hentropy := MetricCodes.Hamming.neg_mul_logb_le_binaryEntropy he.le heone.le - linarith + linarith only [houter_bound, hsingular, hentropy] theorem eventually_shellRate_interior_improvement {a u : ℝ} (ha : 0 < a) (ha' : a < (1 : ℝ) / 2) : @@ -725,7 +722,7 @@ theorem eventually_shellRate_interior_improvement 1 - MetricCodes.binaryEntropy (a - interiorSlope a u * e) + MetricCodes.binaryEntropy u - MetricCodes.binaryEntropy e < 1 - MetricCodes.binaryEntropy a + MetricCodes.binaryEntropy u - linarith + linarith only [he] /-- The perturbed Johnson spectral limit minus its asymptotic code-distance threshold. -/ def interiorSpectralMargin (δ a u e : ℝ) : ℝ := @@ -750,11 +747,11 @@ theorem interior_boundary_delta_relation {δ a u : ℝ} MetricCodes.Johnson.asymptoticThreshold δ a) : δ * (1 + 2 * Real.sqrt (u * (1 - u))) = 2 * (a * (1 - a) - u * (1 - u)) := by - have huone : 0 < 1 - u := by linarith + have huone : 0 < 1 - u := by linarith only [hua, ha] have hsquare := Real.sq_sqrt (mul_pos hu huone).le have hvariance := MetricCodes.Johnson.zero_fibre_boundary_variance hu hua ha hboundary - nlinarith + linarith only [hsquare, hvariance] theorem interior_boundary_weight_gt_distance {δ a u : ℝ} (hδ : 0 < δ) @@ -764,15 +761,12 @@ theorem interior_boundary_weight_gt_distance {δ a u : ℝ} MetricCodes.Johnson.asymptoticThreshold δ a) : δ / 2 < a := by have ha0 : 0 < a := lt_trans hu hua - have huone : 0 < 1 - u := by linarith - have hs : 0 < Real.sqrt (u * (1 - u)) := - Real.sqrt_pos.mpr (mul_pos hu huone) + have huone : 0 < 1 - u := by linarith only [hua, ha] have hvariance := MetricCodes.Johnson.zero_fibre_boundary_variance hu hua ha hboundary have hcross : 0 < δ * (2 * Real.sqrt (u * (1 - u))) := by positivity - nlinarith [sq_nonneg (2 * Real.sqrt (u * (1 - u))), - sq_pos_of_pos ha0] + linarith only [hvariance, hcross, sq_nonneg (2 * Real.sqrt (u * (1 - u))), sq_pos_of_pos ha0] theorem spectralLimit_interior_eq (a u e : ℝ) : MetricCodes.Johnson.spectralLimit @@ -850,7 +844,7 @@ theorem eventually_interior_parameters simpa only [interiorWeight_zero, interiorSupport_zero, add_zero, interiorComplement_zero, sub_zero] using hrightcontinuous.continuousAt.tendsto.mono_left (nhdsWithin_le_nhds : 𝓝[>] (0 : ℝ) ≤ 𝓝 0) - have huright : u < 1 - a := by linarith + have huright : u < 1 - a := by linarith only [hua, ha] have hright : ∀ᶠ e : ℝ in 𝓝[>] 0, u < 1 - interiorWeight a u e + interiorSupport a u e - interiorComplement a u e := @@ -859,9 +853,9 @@ theorem eventually_interior_parameters hehalf, hedegree, hleft, hright, self_mem_nhdsWithin] with e hwd hwh hwu heh heu hel her (he : 0 < e) have hwpos : 0 < interiorWeight a u e := by - nlinarith + linarith only [hwu, heu, he] have hwcomplement : 0 < 1 - interiorWeight a u e := by - linarith + linarith only [hwh] refine { distance_pos := hδ distance_lt_half := hδ' @@ -879,11 +873,11 @@ theorem eventually_interior_parameters · unfold interiorSupport exact mul_nonneg hwpos.le he.le · unfold interiorSupport - nlinarith [mul_lt_mul_of_pos_left heh hwpos] + linarith only [mul_lt_mul_of_pos_left heh hwpos] · unfold interiorComplement exact mul_nonneg hwcomplement.le he.le · unfold interiorComplement - nlinarith [mul_lt_mul_of_pos_left heh hwcomplement] + linarith only [mul_lt_mul_of_pos_left heh hwcomplement] · rw [interiorSupport_add_complement] exact heu @@ -899,14 +893,14 @@ theorem hasDerivAt_interiorSpectralMargin (a * (1 - a) * Real.sqrt (u * (1 - u)) * (1 + 2 * Real.sqrt (u * (1 - u))))) 0 := by have ha0 : 0 < a := lt_trans hu hua - have ha1 : 0 < 1 - a := by linarith - have hu1 : 0 < 1 - u := by linarith - have hz0 : 0 < 1 - 2 * u := by linarith - have hm0 : 0 < 1 - 2 * a := by linarith + have ha1 : 0 < 1 - a := by linarith only [ha] + have hu1 : 0 < 1 - u := by linarith only [hua, ha] + have hz0 : 0 < 1 - 2 * u := by linarith only [hua, ha] + have hm0 : 0 < 1 - 2 * a := by linarith only [ha] have hrad : 0 < 1 - (1 - 2 * u) ^ 2 := by - nlinarith [mul_pos hu hu1] + linarith only [mul_pos hu hu1] have hmrad : 0 < 1 - (1 - 2 * a) ^ 2 := by - nlinarith [mul_pos ha0 ha1] + linarith only [mul_pos ha0 ha1] have hs : 0 < Real.sqrt (u * (1 - u)) := Real.sqrt_pos.mpr (mul_pos hu hu1) have hsquare := Real.sq_sqrt (mul_pos hu hu1).le @@ -1026,14 +1020,18 @@ theorem hasDerivAt_interiorSpectralMargin apply (eq_div_iff (by positivity)).2 exact hdelta rw [hdelta_div] - field_simp [ha0.ne', ha1.ne', hu.ne', hu1.ne', - hz0.ne', hm0.ne', hs.ne', hrad.ne', hmrad.ne'] - ring_nf at hsquare ⊢ - linear_combination - ((-128 * a ^ 3 * (a - 1) ^ 3 * (2 * a - 1) ^ 3 * - Real.sqrt (u - u ^ 2)) + - (64 * a ^ 2 * u * (a - 1) ^ 2 * (2 * a - 1) * (u - 1))) * - hsquare + have hdegree : + (1 - 2 * u) ^ 2 = 1 - 4 * Real.sqrt (u * (1 - u)) ^ 2 := by + linarith only [hsquare] + rw [hdegree] + generalize hradical : Real.sqrt (u * (1 - u)) = s at hsquare hs hdegree ⊢ + rw [← hsquare] + have hdegree_nonzero : 1 - 4 * s ^ 2 ≠ 0 := by + rw [← hdegree] + exact pow_ne_zero 2 hz0.ne' + field_simp [ha0.ne', ha1.ne', hm0.ne', hs.ne', + hmrad.ne', hdegree_nonzero] + ring theorem interiorSpectralMargin_derivative_pos {a u : ℝ} @@ -1044,19 +1042,17 @@ theorem interiorSpectralMargin_derivative_pos (a * (1 - a) * Real.sqrt (u * (1 - u)) * (1 + 2 * Real.sqrt (u * (1 - u)))) := by have ha0 : 0 < a := lt_trans hu hua - have ha1 : 0 < 1 - a := by linarith - have hu1 : 0 < 1 - u := by linarith - have hs : 0 < Real.sqrt (u * (1 - u)) := - Real.sqrt_pos.mpr (mul_pos hu hu1) + have ha1 : 0 < 1 - a := by linarith only [ha] + have hu1 : 0 < 1 - u := by linarith only [hua, ha] have hvariance : u * (1 - u) < (1 : ℝ) / 4 := by - nlinarith [sq_pos_of_pos (by linarith : 0 < 1 - 2 * u)] + linarith only [sq_pos_of_pos (by linarith : 0 < 1 - 2 * u)] have hshalf : Real.sqrt (u * (1 - u)) < (1 : ℝ) / 2 := by exact (Real.sqrt_lt' (by norm_num : (0 : ℝ) < 1 / 2)).mpr - (by nlinarith) + (by linarith only [hvariance]) have hweight : 0 < 1 - 2 * (a * (1 - a)) := by - nlinarith [sq_nonneg (a - (1 : ℝ) / 2)] + linarith only [sq_nonneg (a - (1 : ℝ) / 2)] exact div_pos - (mul_pos hweight (by linarith)) + (mul_pos hweight (by linarith only [hshalf])) (by positivity) theorem eventually_interiorSpectralMargin_pos @@ -1131,9 +1127,9 @@ theorem interior_shell_improvement ∀ᶠ e : ℝ in 𝓝[>] 0, 0 < 1 - interiorWeight a u e := by filter_upwards [hweight.eventually - (gt_mem_nhds (show a < (1 : ℝ) by linarith))] + (gt_mem_nhds (show a < (1 : ℝ) by linarith only [ha]))] with e he - linarith + linarith only [he] have hall : ∀ᶠ e : ℝ in 𝓝[>] 0, 0 < interiorSupport a u e ∧ 0 < interiorComplement a u e ∧ @@ -1406,7 +1402,7 @@ theorem johnsonWindowChannelMatrix_pairing rw [Finset.mul_sum] apply Finset.sum_congr rfl intro b _ - ring + ac_rfl _ = _ := by unfold MetricCodes.Boolean.coordinateDot congr 1 @@ -1640,7 +1636,7 @@ theorem johnsonAdjacentChannel_coordinate_axisDot intro b _ simp only [coupledDegreeCoordinates, johnsonHarmonicCoordinates, coupledDegreeVector] - ring + ac_rfl _ = geometricAxis x k * MetricCodes.Boolean.dot (johnsonAdjacentChannel n w p q L target source f k) @@ -1751,7 +1747,7 @@ theorem johnsonWindowChannelMatrix_transpose_axis_fibre rw [Finset.mul_sum] apply Finset.sum_congr rfl intro b _ - ring + ac_rfl _ = ∑ target : Index p q L, (johnsonAdjacentBlockCoefficient n w p q L v lam target Q.1 * johnsonFibreAmplitude n w p q L v target) * @@ -1782,14 +1778,14 @@ theorem johnsonWindowChannelMatrix_transpose_axis_fibre rw [Finset.sum_mul] apply Finset.sum_congr rfl intro target _ - ring + ac_rfl _ = Real.sqrt lam * (johnsonFibreAmplitude n w p q L v Q.1 * coupledDegreeCoordinates h x Q.1 a Q.2) := by rw [johnsonAdjacentBlockCoefficient_amplitude_sum h hstrict v hv lam hlam heigen Q.1, johnsonWindowBasis_dot_coupled h x Q.1 a Q.2] - ring + ac_rfl theorem johnsonChannelMatrix_transpose_axis_fibre {n w p q L : ℕ} @@ -2290,7 +2286,7 @@ theorem tendsto_johnsonMu_div (supportDegree b n) (complementDegree g n) (terminalIndex u r n) / (n : ℝ)) atTop (nhds (muLimit a b g u)) := by - have haone : a ≤ 1 := by linarith [h.weight_lt_half] + have haone : a ≤ 1 := by linarith only [h.weight_lt_half] have hj₁ := tendsto_johnsonJ1_ratio h.weight_pos.le h.support_nonneg have hj₂ := tendsto_johnsonJ2_ratio @@ -2406,7 +2402,7 @@ theorem tendsto_johnsonDiagonal (supportDegree b n) (complementDegree g n) (terminalIndex u r n)) atTop (nhds (diagonalLimit a b g u)) := by - have haone : a ≤ 1 := by linarith [h.weight_lt_half] + have haone : a ≤ 1 := by linarith only [h.weight_lt_half] have hmu := tendsto_johnsonMu_div h r have hm := tendsto_johnsonM_ratio h.weight_pos.le have hw := tendsto_shellWeight_ratio h.weight_pos.le @@ -2495,7 +2491,7 @@ theorem normalizedNu_scale ((2 * (J / N) - 1 / N) * (2 * (J / N) + 1 / N)) := by field_simp [hN.ne'] - have hJ : 0 < J := by linarith + have hJ : 0 < J := by linarith only [hstep] have hleft : 0 < 2 * (J / N) - 1 / N := by have heq : 2 * (J / N) - 1 / N = (2 * J - 1) / N := by @@ -2507,7 +2503,7 @@ theorem normalizedNu_scale 2 * (J / N) + 1 / N = (2 * J + 1) / N := by field_simp [hN.ne'] rw [heq] - exact div_pos (by linarith) hN + exact div_pos (by linarith only [hstep]) hN have hroot : Real.sqrt ((2 * (J / N) - 1 / N) * @@ -2596,7 +2592,7 @@ theorem tendsto_johnsonNu_div (supportDegree b n) (complementDegree g n) (terminalIndex u r n) / (n : ℝ)) atTop (nhds (nuLimit a b g u)) := by - have haone : a ≤ 1 := by linarith [h.weight_lt_half] + have haone : a ≤ 1 := by linarith only [h.weight_lt_half] have hj := tendsto_johnsonJ_ratio h.degree_pos r have hm := tendsto_johnsonM_ratio h.weight_pos.le have heta := tendsto_johnsonDelta_ratio @@ -2626,7 +2622,7 @@ theorem tendsto_johnsonNu_div 0 < (2 * ((1 - 2 * u) / 2) - 0) * (2 * ((1 - 2 * u) / 2) + 0) := by - apply mul_pos <;> linarith + apply mul_pos <;> linarith only [hz] exact (mul_pos (mul_pos (by norm_num) hhalf) (Real.sqrt_pos.mpr hrad)).ne' @@ -2661,7 +2657,7 @@ theorem tendsto_johnsonNu_div have hscaled := (htwo.mul hj).sub he have hlimit : 0 < 2 * ((1 - 2 * u) / 2) - 0 := by - linarith [h.centeredDegree_pos] + linarith only [h.centeredDegree_pos] filter_upwards [hscaled.eventually (Ioi_mem_nhds hlimit), eventually_gt_atTop (0 : ℕ)] with n hscaled' hn have hnreal : (0 : ℝ) < (n : ℝ) := by exact_mod_cast hn @@ -2714,7 +2710,7 @@ theorem tendsto_johnsonEdge (supportDegree b n) (complementDegree g n) (terminalIndex u r n)) atTop (nhds (edgeLimit a b g u)) := by - have haone : a ≤ 1 := by linarith [h.weight_lt_half] + have haone : a ≤ 1 := by linarith only [h.weight_lt_half] have hnu := tendsto_johnsonNu_div h r have hw := tendsto_shellWeight_ratio h.weight_pos.le have hc := tendsto_complementWeight_ratio @@ -2754,11 +2750,11 @@ theorem zeroFibreParameters refine ⟨h.distance_pos, h.distance_lt_half, h.weight_gt_distance, h.weight_lt_half, le_rfl, ?_, le_rfl, ?_, ?_, h.degree_lt_weight, ?_, ?_⟩ - · linarith [h.weight_pos] - · linarith [h.weight_complement_pos] + · linarith only [h.weight_pos] + · linarith only [h.weight_complement_pos] · simpa only [add_zero] using h.degree_pos · simpa only [sub_zero, add_zero] using h.degree_lt_weight - · nlinarith [h.degree_lt_weight, h.weight_lt_half] + · linarith only [h.degree_lt_weight, h.weight_lt_half] /-- The limiting hatted Johnson diagonal coefficient under proportional degree scaling. -/ def hattedDiagonalLimit (a b g u : ℝ) : ℝ := @@ -3325,17 +3321,16 @@ theorem eventually_topEigenvalue_gt let E : ℝ := hattedEdgeLimit a b g u let S : ℝ := MetricCodes.Johnson.spectralLimit a b g u let ε : ℝ := (S - s) / 2 - have hE : 0 < E := hattedEdgeLimit_pos h have hε : 0 < ε := by dsimp [ε, S] - linarith + linarith only [hs] obtain ⟨m, hm⟩ := exists_nat_gt (2 * E / ε) have hprod : 2 * E < (m : ℝ) * ε := (div_lt_iff₀ hε).mp hm have hden : 0 < (m : ℝ) + 1 := by positivity have hrem : 2 * E / ((m : ℝ) + 1) < ε := by apply (div_lt_iff₀ hden).mpr - nlinarith + linarith only [hε, hprod] have hidentity : (((m : ℝ) + 1) * hattedDiagonalLimit a b g u + 2 * (m : ℝ) * hattedEdgeLimit a b g u) / @@ -3351,7 +3346,7 @@ theorem eventually_topEigenvalue_gt ((m : ℝ) + 1) := by rw [hidentity] dsimp [ε] at hrem - linarith + linarith only [hs, hrem] have hquot := (tendsto_terminalRayleigh h m).eventually (lt_mem_nhds hbelow) filter_upwards [hquot, eventually_terminal_block_fit h m] @@ -3372,7 +3367,7 @@ theorem spectralGap_pos MetricCodes.Johnson.asymptoticThreshold d a < MetricCodes.Johnson.spectralLimit a b g u := h.2 unfold spectralGap - linarith + linarith only [hgap] theorem eventually_spectralGap_lt {d a b g u : ℝ} @@ -3388,9 +3383,9 @@ theorem eventually_spectralGap_lt let A := MetricCodes.Johnson.asymptoticThreshold d a let S := MetricCodes.Johnson.spectralLimit a b g u have hupper : S - spectralGap d a b g u < S := by - linarith + linarith only [hpositive] have hlower : A < A + spectralGap d a b g u := by - linarith + linarith only [hpositive] have heigen := eventually_topEigenvalue_gt h.1 hupper have hthreshold := (MetricCodes.Johnson.Asymptotics.tendsto_threshold_ceil h.1).eventually @@ -3398,7 +3393,7 @@ theorem eventually_spectralGap_lt filter_upwards [heigen, hthreshold] with n hn ht dsimp [A, S] at hn ht unfold spectralGap at hpositive hn ht ⊢ - linarith + linarith only [hpositive, hn, ht] theorem asymptoticThreshold_lt_one {d a b g u : ℝ} @@ -3409,7 +3404,7 @@ theorem asymptoticThreshold_lt_one exact mul_pos (mul_pos (by norm_num) h.weight_pos) h.weight_complement_pos have hquot := div_pos h.distance_pos hden - linarith + linarith only [hquot] theorem eventually_one_sub_threshold_lt {d a b g u : ℝ} @@ -3420,12 +3415,12 @@ theorem eventually_one_sub_threshold_lt 2 - MetricCodes.Johnson.asymptoticThreshold d a := by have hlimit : MetricCodes.Johnson.asymptoticThreshold d a - 1 < - MetricCodes.Johnson.asymptoticThreshold d a := by linarith + MetricCodes.Johnson.asymptoticThreshold d a := by linarith only [] have hthreshold := (MetricCodes.Johnson.Asymptotics.tendsto_threshold_ceil h).eventually (Ioi_mem_nhds hlimit) filter_upwards [hthreshold] with n hn - linarith + linarith only [hn] end @@ -3454,7 +3449,7 @@ theorem certificateConstant_pos 0 < certificateConstant d a b g u := by unfold certificateConstant apply div_pos - · linarith [asymptoticThreshold_lt_one h.1] + · linarith only [asymptoticThreshold_lt_one h.1] · exact spectralGap_pos h theorem exists_zero_fibre_feasible @@ -3464,26 +3459,26 @@ theorem exists_zero_fibre_feasible let u : ℝ := d / 4 + 1 / 4 have ha : a < (1 : ℝ) / 2 := by dsimp [a] - linarith + linarith only [hdhalf] have hu : 0 < u := by dsimp [u] - linarith + linarith only [hd] have hua : u < a := by dsimp [a, u] - linarith + linarith only [hd] have ha0 : 0 < a := lt_trans hu hua - have hac : 0 < 1 - a := by linarith + have hac : 0 < 1 - a := by linarith only [ha] have hparams : MetricCodes.Johnson.AsymptoticParameters d a 0 0 u := by refine ⟨hd, hdhalf, ?_, ha, by norm_num, ?_, by norm_num, ?_, ?_, hua, ?_, ?_⟩ · dsimp [a] - linarith - · linarith - · linarith + linarith only [] + · linarith only [hu, hua] + · linarith only [ha] · simpa only [add_zero] using hu · simpa only [sub_zero, add_zero] using hua · norm_num - linarith + linarith only [ha, hua] let A := a * (1 - a) let U := u * (1 - u) have hA : 0 < A := by @@ -3493,10 +3488,10 @@ theorem exists_zero_fibre_feasible have hsden : 0 < 1 + 2 * Real.sqrt U := by positivity have hdiff : 2 * (A - U) < d := by dsimp [A, U, a, u] - nlinarith [sq_nonneg d] + linarith only [hd, sq_nonneg d] have hinner : (A - U) / (1 + 2 * Real.sqrt U) < d / 2 := by apply (div_lt_iff₀ hsden).mpr - nlinarith [mul_nonneg hd.le hs] + linarith only [hdiff, mul_nonneg hd.le hs] have hquot : (A - U) / (A * (1 + 2 * Real.sqrt U)) < d / (2 * A) := by calc @@ -3518,7 +3513,7 @@ theorem exists_zero_fibre_feasible (a * (1 - a) * (1 + 2 * Real.sqrt (u * (1 - u)))) < d / (2 * a * (1 - a)) := by convert hquot using 1; ring - linarith + linarith only [hboundary, hquot'] theorem rateSet_nonempty_of_interior {d : ℝ} (hd : 0 < d) (hdhalf : d < (1 : ℝ) / 2) : @@ -3534,7 +3529,7 @@ theorem eventually_strict_weight_half have hw := tendsto_shellWeight_ratio h.weight_pos.le have hww := tendsto_add_degree_ratio hw hw have hstrict := eventually_degree_lt_of_ratio hww - tendsto_dimension_ratio (by linarith [h.weight_lt_half]) + tendsto_dimension_ratio (by linarith only [h.weight_lt_half]) filter_upwards [hstrict] with n hn omega @@ -3566,15 +3561,10 @@ theorem binaryRate_le_shellRate_of_projectionGrams have hG : 0 < G := spectralGap_pos h have hB : 0 < B := by dsimp [B] - linarith [asymptoticThreshold_lt_one h.1] + linarith only [asymptoticThreshold_lt_one h.1] have hden : 0 < lam - t := by dsimp [lam, t, G] at hgap ⊢ - linarith [spectralGap_pos h] - have ht : 0 < 1 - t := by - dsimp [t] - exact sub_pos.mpr - (MetricCodes.Johnson.threshold_lt_one hadmissible.weight_pos - hadmissible.weight_lt hd) + linarith only [hgap, spectralGap_pos h] have hratio : (1 - t) / (lam - t) ≤ B / G := by apply (div_le_div_iff₀ hden hG).mpr calc @@ -3614,7 +3604,7 @@ theorem binaryRate_le_shellRate_of_projectionGrams bassalygoWindowFibreQuotient a b g u n := by unfold certificateConstant bassalygoWindowFibreQuotient dsimp [B, G] - ring + ac_rfl theorem binaryRate_le_variationalRate_of_projectionGrams {d : ℝ} (hd : 0 < d) (hdhalf : d < (1 : ℝ) / 2) @@ -3714,13 +3704,13 @@ theorem log_ratio_lower {x : ℝ} (hx : 0 ≤ x) (hx' : x < 1) (m : ℕ) : logSeriesLower x m ≤ Real.log ((1 + x) / (1 - x)) := by have h := Real.sum_range_le_log_div hx hx' m unfold logSeriesLower - nlinarith + linarith only [h] theorem log_ratio_upper {x : ℝ} (hx : 0 ≤ x) (hx' : x < 1) (m : ℕ) : Real.log ((1 + x) / (1 - x)) ≤ logSeriesUpper x m := by have h := Real.log_div_le_sum_range_add hx hx' m unfold logSeriesUpper logSeriesLower - nlinarith + linarith only [h] theorem log_interval_of_series {r x lo hi : ℝ} (m : ℕ) (hx : 0 ≤ x) (hx' : x < 1) @@ -3815,7 +3805,7 @@ theorem kissing_spectral_certificate : apply (lt_div_iff₀ hden).2 have hupper := kissing_sqrt_upper norm_num [kissingA, kissingB] at hupper ⊢ - nlinarith + linarith only [hupper] theorem log_kissing_a : Real.log kissingA = Real.log (16 * kissingA) - 4 * Real.log 2 := by @@ -3826,7 +3816,7 @@ theorem log_kissing_a : convert Real.log_pow (2 : ℝ) 4 using 1 norm_num rw [hpow] at hmul - linarith + linarith only [hmul] theorem log_kissing_b : Real.log kissingB = @@ -3841,7 +3831,7 @@ theorem log_kissing_b : -Real.log (256 * kissingB) := by rw [one_div, Real.log_inv] rw [hpow] at hmul - linarith + linarith only [hmul, hinv] theorem kissing_entropy_certificate : MetricCodes.sphericalEntropy kissingA - MetricCodes.sphericalEntropy kissingB < @@ -3859,7 +3849,7 @@ theorem kissing_entropy_certificate : (-8 * Real.log 2 - Real.log (1 / (256 * kissingB)))) < (0.397305601680 : ℝ) * Real.log 2 := by norm_num [kissingA, kissingB] at htwo h1a hsa h1b hib ⊢ - linarith + linarith only [htwo, h1a, hsa, h1b, hib] have hlog : 0 < Real.log 2 := Real.log_pos (by norm_num) calc MetricCodes.sphericalEntropy kissingA - MetricCodes.sphericalEntropy kissingB = @@ -3902,7 +3892,7 @@ theorem hasDerivAt_sphericalEntropy {u : ℝ} (hu : 0 < u) : HasDerivAt MetricCodes.sphericalEntropy (Real.logb 2 ((1 + u) / u)) u := by have hplus := - (Real.hasDerivAt_mul_log (by linarith : 1 + u ≠ 0)).comp u + (Real.hasDerivAt_mul_log (by linarith only [hu] : 1 + u ≠ 0)).comp u ((hasDerivAt_const u (1 : ℝ)).add (hasDerivAt_id u)) have hself := Real.hasDerivAt_mul_log hu.ne' have hderiv := (hplus.sub hself).div_const (Real.log 2) @@ -3918,7 +3908,7 @@ theorem hasDerivAt_sphericalEntropy {u : ℝ} (hu : 0 < u) : (((Real.log (1 + u) + 1) * (0 + 1) - (Real.log u + 1)) / Real.log 2) := by unfold Real.logb - rw [Real.log_div (by linarith : 1 + u ≠ 0) hu.ne'] + rw [Real.log_div (by linarith only [hu] : 1 + u ≠ 0) hu.ne'] ring rw [hfun, hvalue] simpa only [Function.comp_apply, Pi.sub_apply] using hderiv @@ -3933,7 +3923,7 @@ theorem sphericalEntropy_strictMono : rw [(hasDerivAt_sphericalEntropy hu').deriv] apply Real.logb_pos (by norm_num : (1 : ℝ) < 2) apply (lt_div_iff₀ hu').2 - linarith + linarith only [] theorem sphericalEntropy_sub_nonneg {a b : ℝ} (hb : 0 ≤ b) (hba : b ≤ a) : @@ -3983,14 +3973,14 @@ theorem Gamma_zero {a : ℝ} (ha : 0 < a) : rw [MetricCodes.Gamma_eq_sub] simp only [zero_mul, add_zero, sub_zero] field_simp [hroot, hlin] - nlinarith + linarith only [hsquare] theorem classicalThreshold_spectral {s : ℝ} (hs : 0 < s) (hs' : s < 1) : 2 * MetricCodes.Gamma (MetricCodes.classicalThreshold s) 0 = s := by have ha : 0 < MetricCodes.classicalThreshold s := MetricCodes.classicalThreshold_pos hs hs' - have hrad : 0 < 1 - s ^ 2 := by nlinarith + have hrad : 0 < 1 - s ^ 2 := by nlinarith only [hs', hs] have hroot : 0 < Real.sqrt (1 - s ^ 2) := Real.sqrt_pos.2 hrad have hrootsq := Real.sq_sqrt hrad.le @@ -4000,7 +3990,7 @@ theorem classicalThreshold_spectral s ^ 2 * (1 + 2 * MetricCodes.classicalThreshold s) ^ 2 := by unfold MetricCodes.classicalThreshold field_simp [hroot.ne'] - nlinarith + linarith only [hrootsq] have hinner : 0 < MetricCodes.classicalThreshold s * (1 + MetricCodes.classicalThreshold s) := by positivity @@ -4033,7 +4023,7 @@ def sphericalImprovementPath (a b : ℝ) : ℝ := theorem sphericalImprovementSlope_gt_one {a : ℝ} (ha : 0 < a) : 1 < (4 * a + 3) := by - linarith + linarith only [ha] /-- The polynomial expression used to certify positivity of the spherical spectral margin. -/ def sphericalSpectralMarginPolynomial (a c b : ℝ) : ℝ := @@ -4097,7 +4087,7 @@ theorem eventually_Gamma_improvement {a : ℝ} (ha : 0 < a) : with b hbpoly (hb : 0 < b) have hbpath : b < sphericalImprovementPath a b := by unfold sphericalImprovementPath - nlinarith [mul_pos (sub_pos.mpr hc) hb] + linarith only [ha, mul_pos (sub_pos.mpr hc) hb] have hpath : 0 < sphericalImprovementPath a b := hb.trans hbpath have hbase : 0 < a * (1 + a) := by positivity @@ -4110,7 +4100,7 @@ theorem eventually_Gamma_improvement {a : ℝ} (ha : 0 < a) : have hfactor : 0 < (sphericalImprovementPath a b - b) * (1 + sphericalImprovementPath a b + b) := by positivity - nlinarith + linarith only [hfactor] have hmargin : 0 < ((sphericalImprovementPath a b * @@ -4155,7 +4145,7 @@ theorem eventually_Gamma_improvement {a : ℝ} (ha : 0 < a) : (1 + sphericalImprovementPath a b)) := by rw [mul_pow, mul_pow, Real.sq_sqrt hbase.le, Real.sq_sqrt hrad.le] - ring + ac_rfl have hcross : Real.sqrt (a * (1 + a)) * ((1 + 2 * sphericalImprovementPath a b) * @@ -4165,7 +4155,9 @@ theorem eventually_Gamma_improvement {a : ℝ} (ha : 0 < a) : (sphericalImprovementPath a b * (1 + sphericalImprovementPath a b) - b * (1 + b)) * (1 + 2 * a) := by - nlinarith + apply (sq_lt_sq₀ hleftnonneg hrightpos.le).mp + rw [hsquare] + exact sub_pos.mp hmargin rw [Gamma_zero ha, MetricCodes.Gamma_eq_sub] have hlin : 0 < 1 + 2 * a := by positivity have hden : @@ -4178,11 +4170,11 @@ theorem eventually_Gamma_improvement {a : ℝ} (ha : 0 < a) : theorem neg_mul_logb_le_sphericalEntropy {b : ℝ} (hb : 0 ≤ b) : b * (-Real.logb 2 b) ≤ MetricCodes.sphericalEntropy b := by have hlog : 0 ≤ Real.logb 2 (1 + b) := - Real.logb_nonneg (by norm_num) (by linarith) + Real.logb_nonneg (by norm_num) (by linarith only [hb]) have hterm : 0 ≤ (1 + b) * Real.logb 2 (1 + b) := by - exact mul_nonneg (by linarith) hlog + exact mul_nonneg (by linarith only [hb]) hlog unfold MetricCodes.sphericalEntropy - nlinarith + linarith only [hterm] theorem eventually_sphericalEntropy_improvement {a : ℝ} (ha : 0 < a) : ∀ᶠ b : ℝ in 𝓝[>] 0, @@ -4203,7 +4195,7 @@ theorem eventually_sphericalEntropy_improvement {a : ℝ} (ha : 0 < a) : let M : ℝ := deriv f 0 + 1 have hM : deriv f 0 < M := by dsimp [M] - linarith + linarith only [] have hslope := hf.hasDerivAt.tendsto_slope_zero_right have hupper : ∀ᶠ b : ℝ in 𝓝[>] 0, @@ -4237,7 +4229,7 @@ theorem eventually_sphericalEntropy_improvement {a : ℝ} (ha : 0 < a) : b * M < b * (-Real.logb 2 b) := mul_lt_mul_of_pos_left hlogb hb have hentropy := neg_mul_logb_le_sphericalEntropy hb.le - linarith + linarith only [houter_bound, hsingular, hentropy] theorem exists_strict_improving_spherical_feasible {s : ℝ} (hs : 0 < s) (hs' : s < 1) : @@ -4260,13 +4252,13 @@ theorem exists_strict_improving_spherical_feasible with b hgamma' hentropy' (hb : 0 < b) have hbpath : b < sphericalImprovementPath a₀ b := by unfold sphericalImprovementPath - nlinarith [mul_pos (sub_pos.mpr hc) hb] + linarith only [ha₀, mul_pos (sub_pos.mpr hc) hb] constructor · refine ⟨hb, hbpath, ?_⟩ have hboundary : 2 * MetricCodes.Gamma a₀ 0 = s := by dsimp [a₀] exact classicalThreshold_spectral hs hs' - nlinarith + linarith only [hgamma', hboundary] · simpa only using hentropy' obtain ⟨b, hb⟩ := hall.exists exact ⟨sphericalImprovementPath a₀ b, b, hb⟩ @@ -4291,7 +4283,7 @@ open scoped Topology theorem classicalThreshold_continuousAt {s : ℝ} (hs : -1 < s) (hs' : s < 1) : ContinuousAt MetricCodes.classicalThreshold s := by - have hrad : 0 < 1 - s ^ 2 := by nlinarith + have hrad : 0 < 1 - s ^ 2 := by nlinarith only [hs, hs'] have hroot : Real.sqrt (1 - s ^ 2) ≠ 0 := (Real.sqrt_pos.mpr hrad).ne' unfold MetricCodes.classicalThreshold @@ -4375,7 +4367,7 @@ theorem quadraticCoordinate_strictMonoOn : change 0 ≤ x at hx change 0 ≤ y at hy change x * (1 + x) < y * (1 + y) - nlinarith [mul_pos (sub_pos.mpr hxy) (by linarith : 0 < 1 + x + y)] + linarith only [mul_pos (sub_pos.mpr hxy) (by linarith : 0 < 1 + x + y)] theorem Interlacing.quadratic_injective {r : ℕ} {a : Fin (r + 1) → ℝ} {b : Fin r → ℝ} @@ -4568,17 +4560,17 @@ theorem integral_inv_add_mul_cos (a b : ℝ) (h : |b| < a) : (∫ θ in (0 : ℝ)..Real.pi, (a + b * Real.cos θ)⁻¹) = Real.pi / Real.sqrt (a ^ 2 - b ^ 2) := by have hab : -a < b ∧ b < a := abs_lt.mp h - have hplus : 0 < a + b := by linarith [hab.1] - have hminus : 0 < a - b := by linarith [hab.2] + have hplus : 0 < a + b := by linarith only [hab.1] + have hminus : 0 < a - b := by linarith only [hab.2] have hdisc : 0 < a ^ 2 - b ^ 2 := by - nlinarith [mul_pos hplus hminus] + linarith only [mul_pos hplus hminus] let c : ℝ := Real.sqrt (a ^ 2 - b ^ 2) have hc : 0 < c := Real.sqrt_pos.2 hdisc have hden (θ : ℝ) : 0 < a + b * Real.cos θ := by have hbound : |b * Real.cos θ| ≤ |b| := by rw [abs_mul] simpa only [mul_one] using mul_le_mul_of_nonneg_left (Real.abs_cos_le_one θ) (abs_nonneg b) - linarith [neg_le_of_abs_le hbound] + linarith only [h, neg_le_of_abs_le hbound] let q : ℝ → ℝ := fun θ => (a * Real.cos θ + b) / (a + b * Real.cos θ) let F : ℝ → ℝ := fun θ => -Real.arcsin (q θ) / c @@ -4605,7 +4597,7 @@ theorem integral_inv_add_mul_cos (a b : ℝ) (h : |b| < a) : (a ^ 2 - b ^ 2) * (Real.sin θ) ^ 2 / (a + b * Real.cos θ) ^ 2 := by have htrig : (Real.sin θ) ^ 2 = 1 - (Real.cos θ) ^ 2 := by - linarith [Real.sin_sq_add_cos_sq θ] + linarith only [Real.sin_sq_add_cos_sq θ] have hd2 : (a + b * Real.cos θ) ^ 2 ≠ 0 := pow_ne_zero 2 (hden θ).ne' rw [htrig] @@ -4627,9 +4619,9 @@ theorem integral_inv_add_mul_cos (a b : ℝ) (h : |b| < a) : (a + b * Real.cos θ) ^ 2 := div_pos (mul_pos hdisc (sq_pos_of_pos hsin)) (sq_pos_of_pos (hden θ)) - linarith [hqidentity] - have hqlower : -1 < q θ := by nlinarith [sq_nonneg (q θ + 1)] - have hqupper : q θ < 1 := by nlinarith [sq_nonneg (q θ - 1)] + linarith only [hpos, hqidentity] + have hqlower : -1 < q θ := by linarith [sq_nonneg (q θ + 1)] + have hqupper : q θ < 1 := by linarith [sq_nonneg (q θ - 1)] have hroot : Real.sqrt (1 - (q θ) ^ 2) = c * Real.sin θ / (a + b * Real.cos θ) := by @@ -4659,7 +4651,7 @@ theorem integral_inv_add_mul_cos (a b : ℝ) (h : |b| < a) : have hcsq : c ^ 2 = a ^ 2 - b ^ 2 := Real.sq_sqrt hdisc.le field_simp [hc.ne', (hden θ).ne', hsin.ne'] - nlinarith + linarith only [hcsq] rw [intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le Real.pi_pos.le hFcont.continuousOn hderiv hintegrable] dsimp [F, q] @@ -4694,7 +4686,7 @@ theorem betaPDFReal_half_half_eq (u : ℝ) (hu₀ : 0 < u) (hu₁ : u < 1) : rw [betaPDFReal, ite_eq_left ⟨hu₀, hu₁⟩, MetricCodes.Spherical.HigherHierarchy.Arcsine.beta_half_half_eq_pi] have hu : 0 ≤ u := hu₀.le - have hv : 0 ≤ 1 - u := by linarith + have hv : 0 ≤ 1 - u := by linarith only [hu₁] have hpow₁ : u ^ ((1 / 2 : ℝ) - 1) = (Real.sqrt u)⁻¹ := by convert Real.rpow_neg hu (1 / 2 : ℝ) using 1 <;> norm_num [Real.sqrt_eq_rpow] @@ -4703,7 +4695,7 @@ theorem betaPDFReal_half_half_eq (u : ℝ) (hu₀ : 0 < u) (hu₁ : u < 1) : convert Real.rpow_neg hv (1 / 2 : ℝ) using 1 <;> norm_num [Real.sqrt_eq_rpow] rw [hpow₁, hpow₂, Real.sqrt_mul hu, mul_inv_rev] - ring + ac_rfl theorem integral_beta_half_half_eq_integral_measureT (f : ℝ → ℝ) : (∫ u, f u ∂betaMeasure (1 / 2 : ℝ) (1 / 2 : ℝ)) = @@ -4810,7 +4802,7 @@ theorem betaMap_half_half_ae_pos : by_contra hnot have htzero : t ≤ 0 := by have : t / 4 ≤ 0 := le_of_not_gt hnot - linarith + linarith only [hnot] apply ht simp only [betaPDF, betaPDFReal, not_lt_of_ge htzero, false_and, ↓reduceIte, ENNReal.ofReal_zero] @@ -4828,10 +4820,9 @@ theorem arcsine_stieltjes_integrable {x : ℝ} (hx : 0 ≤ x) : apply (integrable_const (1 : ℝ)).mono' ((by fun_prop : Measurable (fun t : ℝ => x / (x + t))).aestronglyMeasurable) filter_upwards [betaMap_half_half_ae_pos] with t ht - have hden : 0 < x + t := by linarith - have hnonneg : 0 ≤ x / (x + t) := div_nonneg hx hden.le + have hden : 0 < x + t := by linarith only [hx, ht] simpa only [norm_div, norm_eq_abs, abs_of_nonneg hx, abs_of_pos hden, ge_iff_le] using - ((div_le_one hden).2 (by linarith : x ≤ x + t)) + ((div_le_one hden).2 (by linarith only [ht] : x ≤ x + t)) theorem arcsine_integral_x_div_add {x : ℝ} (hx : 0 < x) : (∫ t, x / (x + t) ∂(betaMeasure (1 / 2 : ℝ) (1 / 2 : ℝ)).map @@ -4855,15 +4846,15 @@ theorem arcsine_integral_x_div_add {x : ℝ} (hx : 0 < x) : MetricCodes.Spherical.HigherHierarchy.ArcsineIntegral.integral_inv_add_mul_cos (x + 1 / 8) (1 / 8) (by norm_num [abs_of_nonneg (by norm_num : (0 : ℝ) ≤ 1 / 8)] - linarith)] + linarith only [hx])] have hquad : (x + 1 / 8) ^ 2 - (1 / 8 : ℝ) ^ 2 = x * (x + 1 / 4) := by ring rw [hquad, Real.sqrt_mul hx.le, Real.sqrt_div hx.le] have hsx : Real.sqrt x ≠ 0 := (Real.sqrt_pos.mpr hx).ne' have hsy : Real.sqrt (x + 1 / 4) ≠ 0 := - (Real.sqrt_pos.mpr (by linarith)).ne' + (Real.sqrt_pos.mpr (by linarith only [hx])).ne' field_simp [Real.pi_pos.ne', hsx, hsy] - nlinarith [Real.sq_sqrt hx.le] + linarith only [Real.sq_sqrt hx.le] theorem arcsine_integral_self_div_add {x : ℝ} (hx : 0 ≤ x) : (∫ t, t / (t + x) ∂(betaMeasure (1 / 2 : ℝ) (1 / 2 : ℝ)).map @@ -4888,7 +4879,7 @@ theorem arcsine_integral_self_div_add {x : ℝ} (hx : 0 ≤ x) : (1 / 2 : ℝ)).map (fun t : ℝ => t / 4) := by apply integral_congr_ae filter_upwards [betaMap_half_half_ae_pos] with t ht - have hden : x + t ≠ 0 := ne_of_gt (by linarith) + have hden : x + t ≠ 0 := ne_of_gt (by linarith only [ht, hx]) field_simp ring _ = 1 - (∫ t, x / (x + t) ∂(betaMeasure (1 / 2 : ℝ) @@ -5015,16 +5006,16 @@ theorem kissing_spectral_certificate : lagrangeDenominator, Fin.prod_univ_two] at h₀ h₁ h₂ ⊢ - linarith + linarith only [h₀, h₁, h₂] theorem rational_log_lower {r lo : ℝ} (hr : 1 ≤ r) (m : ℕ) (hlo : lo < MetricCodes.Numerics.logSeriesLower ((r - 1) / (r + 1)) m) : lo < Real.log r := by - have hden : 0 < r + 1 := by linarith + have hden : 0 < r + 1 := by linarith only [hr] have hx : 0 ≤ (r - 1) / (r + 1) := div_nonneg (sub_nonneg.mpr hr) hden.le have hx' : (r - 1) / (r + 1) < 1 := - (div_lt_one hden).mpr (by linarith) + (div_lt_one hden).mpr (by linarith only []) calc lo < MetricCodes.Numerics.logSeriesLower ((r - 1) / (r + 1)) m := hlo @@ -5038,11 +5029,11 @@ theorem rational_log_lower {r lo : ℝ} (hr : 1 ≤ r) (m : ℕ) theorem rational_log_upper {r hi : ℝ} (hr : 1 ≤ r) (m : ℕ) (hhi : MetricCodes.Numerics.logSeriesUpper ((r - 1) / (r + 1)) m < hi) : Real.log r < hi := by - have hden : 0 < r + 1 := by linarith + have hden : 0 < r + 1 := by linarith only [hr] have hx : 0 ≤ (r - 1) / (r + 1) := div_nonneg (sub_nonneg.mpr hr) hden.le have hx' : (r - 1) / (r + 1) < 1 := - (div_lt_one hden).mpr (by linarith) + (div_lt_one hden).mpr (by linarith only []) calc Real.log r = Real.log ((1 + (r - 1) / (r + 1)) / (1 - (r - 1) / (r + 1))) := by @@ -5058,7 +5049,7 @@ theorem log_scaled_pow_two {u : ℝ} (hu : u ≠ 0) (k : ℕ) : have h := Real.log_mul (pow_ne_zero k (by norm_num : (2 : ℝ) ≠ 0)) hu rw [Real.log_pow] at h - linarith + linarith only [h] theorem kissing_entropy_certificate : Phi kissingAmbient kissingStabilizer < (0.396605 : ℝ) := by @@ -5132,7 +5123,18 @@ theorem kissing_entropy_certificate : (0.396605 : ℝ) * Real.log 2 := by norm_num at htwo ha₀plus ha₀scale ha₁plus ha₁scale ha₂plus ha₂scale norm_num at hb₀plus hb₀scale hb₁plus hb₁scale ⊢ - linarith + linarith only [ + htwo, + ha₀plus, + ha₀scale, + ha₁plus, + ha₁scale, + ha₂plus, + ha₂scale, + hb₀plus, + hb₀scale, + hb₁plus, + hb₁scale] have hlog : 0 < Real.log 2 := Real.log_pos (by norm_num) calc Phi kissingAmbient kissingStabilizer = @@ -5247,13 +5249,13 @@ theorem Interlacing.ambient_quadratic_nonneg {r : ℕ} {a : Fin (r + 1) → ℝ} {b : Fin r → ℝ} (h : Interlacing a b) (i : Fin (r + 1)) : 0 ≤ ((a i) * (1 + (a i))) := by - exact mul_nonneg (h.ambient_nonneg i) (by linarith [h.ambient_nonneg i]) + exact mul_nonneg (h.ambient_nonneg i) (by linarith only [h.ambient_nonneg i]) theorem Interlacing.stabilizer_quadratic_pos {r : ℕ} {a : Fin (r + 1) → ℝ} {b : Fin r → ℝ} (h : Interlacing a b) (i : Fin r) : 0 < ((b i) * (1 + (b i))) := by - exact mul_pos (h.stabilizer_pos i) (by linarith [h.stabilizer_pos i]) + exact mul_pos (h.stabilizer_pos i) (by linarith only [h.stabilizer_pos i]) theorem integral_inv_add_eq_log_div {t p q : ℝ} (hp : 0 < t + p) (hq : 0 < t + q) : @@ -5297,13 +5299,13 @@ theorem exp_neg_stieltjesPhase_eq_product {r : ℕ} Real.exp (-stieltjesPhase a b t) = stieltjesPhaseProduct a b t := by have hlast : 0 < t + ((a (Fin.last r)) * (1 + (a (Fin.last r)))) := by - linarith [h.ambient_quadratic_nonneg (Fin.last r)] + linarith only [ht, h.ambient_quadratic_nonneg (Fin.last r)] have hambient (i : Fin (r + 1)) : 0 < t + ((a i) * (1 + (a i))) := by - linarith [h.ambient_quadratic_nonneg i] + linarith only [ht, h.ambient_quadratic_nonneg i] have hstabilizer (i : Fin r) : 0 < t + ((b i) * (1 + (b i))) := by - linarith [h.stabilizer_quadratic_pos i] + linarith only [ht, h.stabilizer_quadratic_pos i] have hexp : Real.exp (stieltjesPhase a b t) = ((t + ((a (Fin.last r)) * (1 + (a (Fin.last r))))) / t) * @@ -5389,7 +5391,7 @@ theorem stieltjesPartialFraction {r : ℕ} have hraw := polynomial_partialFraction h.quadratic_injective P hdegree (z := -t) (fun i => by have hnode := h.ambient_quadratic_nonneg i - linarith) + linarith only [ht, hnode]) have hrewrite : (∏ i : Fin r, (-t - ((b i) * (1 + (b i))))) / (∏ i : Fin (r + 1), (-t - ((a i) * (1 + (a i))))) = @@ -5414,7 +5416,7 @@ theorem stieltjesPartialFraction {r : ℕ} apply Finset.prod_ne_zero_iff.mpr intro i _ have hnode := h.ambient_quadratic_nonneg i - exact ne_of_gt (by linarith) + exact ne_of_gt (by linarith only [ht, hnode]) have hleft : ((-1 : ℝ) ^ r * (∏ i : Fin r, (t + ((b i) * (1 + (b i)))))) / @@ -5452,8 +5454,7 @@ theorem quadratic_spectralAtom_identity {u : ℝ} (hu : 0 ≤ u) : 2 * spectralAtom u := by have hA : 0 ≤ (u * (1 + u)) := by positivity - have hlinear : 0 < 1 + 2 * u := by linarith - have hden : 0 < (u * (1 + u)) + 1 / 4 := by linarith + have hden : 0 < (u * (1 + u)) + 1 / 4 := by linarith only [hA] have hroot : Real.sqrt ((u * (1 + u)) + 1 / 4) = (1 + 2 * u) / 2 := by @@ -5463,7 +5464,8 @@ theorem quadratic_spectralAtom_identity {u : ℝ} (hu : 0 ≤ u) : have htarget : ((1 + 2 * u) / 2) ^ 2 = (u * (1 + u)) + 1 / 4 := by ring - nlinarith + apply (sq_eq_sq₀ hnonneg (by positivity)).mp + exact hsquare.trans htarget.symm rw [Real.sqrt_div hA, hroot] unfold spectralAtom field_simp @@ -5476,11 +5478,11 @@ theorem stieltjesKernel_integrable apply (integrable_const (α := ℝ) (μ := μ) (c := (1 : ℝ))).mono' (measurable_id.div (measurable_id.add measurable_const)).aestronglyMeasurable filter_upwards [hpositive] with t ht - have hden : 0 < t + x := by linarith + have hden : 0 < t + x := by linarith only [hx, ht] have hnonneg : 0 ≤ t / (t + x) := div_nonneg ht.le hden.le simp only [Pi.div_apply, Pi.add_apply, id_eq] rw [Real.norm_eq_abs, abs_of_nonneg hnonneg] - simpa only [ge_iff_le] using (div_le_one hden).mpr (by linarith) + simpa only [ge_iff_le] using (div_le_one hden).mpr (by linarith only [hx]) theorem integral_exp_neg_stieltjesPhase_eq_one_sub_two_Gamma {r : ℕ} {a : Fin (r + 1) → ℝ} {b : Fin r → ℝ} @@ -5527,7 +5529,7 @@ theorem integral_exp_neg_stieltjesPhase_eq_one_sub_two_Gamma rw [Finset.mul_sum] apply Finset.sum_congr rfl intro i _ - ring + ac_rfl end diff --git a/LeanPool/MetricCodes/Representation.lean b/LeanPool/MetricCodes/Representation.lean index fc46f3a82..d0e8849ee 100644 --- a/LeanPool/MetricCodes/Representation.lean +++ b/LeanPool/MetricCodes/Representation.lean @@ -55,9 +55,8 @@ def normalizedSequence (n : ℕ) (hn : 2 ≤ n) : Polynomial.Sequence ℝ where theorem normalizedSequence_leadingCoeff_isUnit (n : ℕ) (hn : 2 ≤ n) (i : ℕ) : IsUnit ((normalizedSequence n hn i).leadingCoeff) := by - apply isUnit_iff_ne_zero.mpr - exact Polynomial.leadingCoeff_ne_zero.mpr - (Polynomial.Sequence.ne_zero (normalizedSequence n hn) i) + exact isUnit_iff_ne_zero.mpr (leadingCoeff_ne_zero.mpr (Sequence.ne_zero (normalizedSequence n hn) + i)) /-- The basis of real polynomials given by the normalized Gegenbauer sequence. -/ def normalizedBasis (n : ℕ) (hn : 2 ≤ n) : @@ -1575,7 +1574,6 @@ theorem rowFactor_pos {r n : ℕ} · apply mul_pos · apply div_pos · have h := linearDenominator_pos hn i - have hlam : 0 ≤ (lam i : ℝ) := Nat.cast_nonneg _ linarith · exact linearDenominator_pos hn i · positivity @@ -1614,8 +1612,6 @@ theorem pairFactor_pos {r n : ℕ} linarith · apply div_pos · have hden := sumDenominator_pos hn i j - have hi : 0 ≤ (lam i : ℝ) := Nat.cast_nonneg _ - have hj : 0 ≤ (lam j : ℝ) := Nat.cast_nonneg _ linarith · exact sumDenominator_pos hn i j @@ -1680,7 +1676,6 @@ theorem rowFactor_update_succ_self {r n : ℕ} have hsmall : ((lam ell + rowTail ell).factorial : ℝ) ≠ 0 := by positivity have hsmalllin : (lam ell : ℝ) + (rowTail ell : ℝ) + 1 ≠ 0 := by have hl : 0 ≤ (lam ell : ℝ) := Nat.cast_nonneg _ - have hr : 0 ≤ (rowTail ell : ℝ) := Nat.cast_nonneg _ linarith have hargbig : lam ell + 1 + tailLength n r ell = @@ -2697,7 +2692,7 @@ theorem weighted_eigenvector_equation (source : I) : A.eigenvalue * (Real.sqrt (A.dimension source : ℝ) * A.eigenvector source) - ring + ac_rfl /-- The square root of the vertex weight divided by the total weight. -/ def amplitude (i : I) : ℝ := @@ -2925,7 +2920,7 @@ theorem edgeCoefficient_axis_sum [Nonempty I] (source : I) : have ha : A.amplitude source ≠ 0 := (A.amplitude_pos source).ne' field_simp - nlinarith [Real.sq_sqrt A.eigenvalue_pos.le] + linarith [Real.sq_sqrt A.eigenvalue_pos.le] theorem assembledChannel_axis [Nonempty I] (x : X) : (A.assembledChannel)ᵀ * A.axis x * A.combinedFibre x = @@ -3697,10 +3692,10 @@ theorem rowEuler_mul {r n : ℕ} (i : Fin (r + 1)) congr 1 · apply Finset.sum_congr rfl intro j _ - ring + ac_rfl · apply Finset.sum_congr rfl intro j _ - ring + ac_rfl theorem polarization_mul {r n : ℕ} (i j : Fin (r + 1)) (p q : PolynomialSpace r n) : @@ -3712,10 +3707,10 @@ theorem polarization_mul {r n : ℕ} (i j : Fin (r + 1)) congr 1 · apply Finset.sum_congr rfl intro k _ - ring + ac_rfl · apply Finset.sum_congr rfl intro k _ - ring + ac_rfl end HigherHarmonicYoung.GelfandTsetlin @@ -4350,15 +4345,7 @@ theorem polynomialInner_sub_left_harmonicLift {N : ℕ} SpherePacking.Fischer.polynomialInner N (p - q) s = SpherePacking.Fischer.polynomialInner N p s - SpherePacking.Fischer.polynomialInner N q s := by - rw [sub_eq_add_neg, SpherePacking.Fischer.polynomialInner_add_left] - have hneg : - SpherePacking.Fischer.polynomialInner N (-q) s = - -SpherePacking.Fischer.polynomialInner N q s := by - rw [← neg_one_smul ℝ q, - SpherePacking.Fischer.polynomialInner_smul_left] - ring - rw [hneg] - rfl + exact @SpherePacking.fischer_polynomialInner_sub_left N p q s theorem simultaneousHarmonicProjection_polarization {r n m : ℕ} (i j : Fin (r + 1)) @@ -4615,16 +4602,7 @@ theorem polarization_mul_euler {r n : ℕ} (i j : Fin (r + 1)) (p q : PolynomialSpace r n) : polarization r n i j (p * q) = polarization r n i j p * q + p * polarization r n i j q := by - classical - simp only [polarization_apply, MvPolynomial.pderiv_mul, - mul_add, Finset.sum_add_distrib, Finset.sum_mul, Finset.mul_sum] - apply congrArg₂ (· + ·) - · apply Finset.sum_congr rfl - intro k _ - ring - · apply Finset.sum_congr rfl - intro k _ - ring + exact @GelfandTsetlin.polarization_mul r n i j p q theorem polarization_X_euler {r n : ℕ} (i j a : Fin (r + 1)) (k : Fin n) : @@ -4714,7 +4692,6 @@ theorem polarization_mem_youngMultihomogeneous_transfer simp only [Function.update, ↓reduceDIte, Nat.cast_add, Nat.cast_one, polarization_apply, add_smul, one_smul, hji, ↓reduceIte, add_zero, add_sub_cancel_right] · have hki' : i ≠ k := Ne.symm hki - have hkj' : j ≠ k := Ne.symm hkj simp only [Function.update, hkj, ↓reduceDIte, polarization_apply, hki, ↓reduceIte, add_zero, sub_zero] @@ -5220,13 +5197,7 @@ theorem sum_nullCoordinateCoefficient_mul {m n : ℕ} theorem variableIndex_eq_iff {r n : ℕ} (i j : Fin (r + 1)) (k l : Fin n) : variableIndex i k = variableIndex j l ↔ i = j ∧ k = l := by - constructor - · intro h - have hp : (i, k) = (j, l) := - variableIndex_injective (r := r) (n := n) h - exact ⟨congrArg Prod.fst hp, congrArg Prod.snd hp⟩ - · rintro ⟨rfl, rfl⟩ - rfl + exact @variableIndex_eq_iff_harmonicLift r n i j k l /-- The null row linear form used in the spherical-code argument. -/ def nullRowLinearForm {r m n : ℕ} (hn : 2 * m ≤ n) @@ -5300,7 +5271,7 @@ theorem pderiv_nullSubstitution {r m n : ℕ} · rw [Finset.sum_mul] apply Finset.sum_congr rfl intro x _ - ring + ac_rfl · simp only [↓reduceIte, mul_comm, true_and, MonoidWithZeroHom.map_ite_one_zero, ite_mul, one_mul, zero_mul, mul_ite, Finset.sum_ite_eq, Finset.mem_univ] · have hrow' : h ≠ i := Ne.symm hrow @@ -5309,7 +5280,7 @@ theorem pderiv_nullSubstitution {r m n : ℕ} rw [Finset.sum_mul] apply Finset.sum_congr rfl intro x _ - ring + ac_rfl theorem complexTraceOperator_nullSubstitution {r m n : ℕ} (hn : 2 * m ≤ n) (i j : Fin (r + 1)) @@ -5360,7 +5331,7 @@ theorem complexPolarization_nullSubstitution {r m n : ℕ} rw [nullRowLinearForm, Finset.sum_mul] apply Finset.sum_congr rfl intro k _ - ring + ac_rfl theorem nullRowLinearForm_eq_even_add_I_odd {r m n : ℕ} (hn : 2 * m ≤ n) (i : Fin (r + 1)) (j : Fin m) : @@ -5514,12 +5485,7 @@ theorem evenCoordinate_ne_oddCoordinate {r n : ℕ} @[simp] theorem variableIndex_eq_iff {r n : ℕ} (i j : Fin (r + 1)) (a b : Fin n) : variableIndex i a = variableIndex j b ↔ i = j ∧ a = b := by - constructor - · intro heq - have hpair : (i, a) = (j, b) := variableIndex_injective heq - exact ⟨congrArg Prod.fst hpair, congrArg Prod.snd hpair⟩ - · rintro ⟨rfl, rfl⟩ - rfl + exact @variableIndex_eq_iff_harmonicLift r n i j a b /-- The isotropic variable used in the spherical-code argument. -/ def isotropicVariable {r n : ℕ} (h : 2 * (r + 1) ≤ n) @@ -5753,7 +5719,6 @@ theorem rowDerivation_leadingMinor_upper {r n : ℕ} intro heq have hv := congrArg Fin.val heq change j.val = a.val at hv - have ha := a.isLt omega simp only [hne, ↓reduceIte] @@ -5809,7 +5774,6 @@ theorem rowDerivation_leadingMinor_self {r n : ℕ} intro heq have hv := congrArg Fin.val heq change i.val = a.val at hv - have ha := a.isLt omega simp only [hne, ↓reduceIte] @@ -6693,7 +6657,7 @@ theorem ambientCartan_highestWeightPolynomial {r n : ℕ} mul_zero, CharP.cast_eq_zero, zero_smul] | succ m => simp [Algebra.smul_def, pow_succ, smul_eq_mul] - ring + ac_rfl · simp only [hpk, ↓reduceIte, smul_eq_mul, mul_zero, nsmul_zero, CharP.cast_eq_zero, zero_smul] theorem ambientCartan_dominantHighestWeightWitness {r n : ℕ} diff --git a/LeanPool/MetricCodes/Rigidity.lean b/LeanPool/MetricCodes/Rigidity.lean index 7349ec86e..9a5b4b54b 100644 --- a/LeanPool/MetricCodes/Rigidity.lean +++ b/LeanPool/MetricCodes/Rigidity.lean @@ -191,7 +191,7 @@ theorem actualExteriorRootCreation_contraction_contraction_cubic_anticommute split_ifs <;> simp only [mul_one, mul_zero, zero_mul, sub_zero, zero_sub, add_zero, zero_add, sub_self] <;> - noncomm_ring + ac_rfl end @@ -280,14 +280,6 @@ theorem fullRootExteriorBracketUnordered_eq_two_smul apply Finset.sum_congr rfl intro γ hγ exact fullRootExteriorBracket_weightedAtom_swap α β γ - have hdiag : ∀ α : PositiveRoot r, F α α = 0 := by - intro α - dsimp [F] - apply Finset.sum_eq_zero - intro γ hγ - have h := rootStructureConstant_swap α α γ - have hz : rootStructureConstant α α γ = 0 := by linarith - simp only [hz, zero_smul] have hincomparable : ∀ α β : PositiveRoot r, (¬ α < β) → (¬ β < α) → F α β = 0 := by intro α β hαβ hβα @@ -941,7 +933,7 @@ theorem fullRootExteriorBracketAtom_single_apply rw [hSα, ← hW] simp only [smul_smul] congr 1 - ring + ac_rfl · have hnot : ¬ (α ∈ S.val ∧ β ∈ S.val.erase α ∧ γ ∉ (S.val.erase α).erase β ∧ T.val = insert γ ((S.val.erase α).erase β)) := by @@ -1096,7 +1088,7 @@ theorem smul_operator_anticommutator intro x simp only [LinearMap.add_apply, Module.End.mul_apply, LinearMap.smul_apply, map_smul, smul_smul, smul_add] - module + ac_rfl end @@ -1179,7 +1171,7 @@ theorem fullRootExteriorBracketUnordered_square_eq_cubicIncidences simp only [I, Fintype.sum_prod_type] at * dsimp [A] simp_rw [smul_operator_anticommutator] - simp only [fullRootExteriorBracketAtom] + simp only [fullRootExteriorBracketAtom.eq_1] simp_rw [actualExteriorRootCreation_contraction_contraction_cubic_anticommute] simp only [smul_add, smul_sub, Finset.sum_add_distrib, Finset.sum_sub_distrib, smul_ite, smul_zero] @@ -2402,26 +2394,7 @@ theorem rootJointHarmonicActionUpperRootStructureCross_apply_coe PolynomialSpace r n) else 0 else 0 := by - classical - rw [rootJointHarmonicActionUpperRootStructureCross_apply] - simp only [Submodule.coe_sum] - apply Finset.sum_congr rfl - intro α _ - split_ifs with hα - · simp only [Submodule.coe_sum] - apply Finset.sum_congr rfl - intro β _ - split_ifs with hβ hadm - · simp only [ZeroMemClass.coe_zero] - · simp only [Submodule.coe_sum] - apply Finset.sum_congr rfl - intro γ _ - split_ifs with hγ - · simp only [ZeroMemClass.coe_zero] - · simp only [Submodule.coe_smul] - rw [rootSwapUpperStructureEdge_coe] - · simp only [ZeroMemClass.coe_zero] - · simp only [ZeroMemClass.coe_zero] + exact @rootJointHarmonicActionUpperRootStructureCross_polynomial_apply r n k lam f S end @@ -2875,43 +2848,14 @@ theorem weightedChevalleyEilenbergDifferential_comp_self_of_unweighted (rootChevalleyEilenbergBoundary r n (k + 1)) = 0) : (weightedChevalleyEilenbergDifferential n lam k).comp (weightedChevalleyEilenbergDifferential n lam (k + 1)) = 0 := by - apply LinearMap.ext - intro f - apply (rootJointHarmonicPolynomialInclusion_injective lam) - change - rootJointHarmonicPolynomialInclusion n lam k - (weightedChevalleyEilenbergDifferential n lam k - (weightedChevalleyEilenbergDifferential n lam (k + 1) f)) = - rootJointHarmonicPolynomialInclusion n lam k 0 - rw [map_zero] - have hfirst := LinearMap.congr_fun - (rootJointHarmonicPolynomialInclusion_chevalley_intertwines - (n := n) (k := k) lam) - (weightedChevalleyEilenbergDifferential n lam (k + 1) f) - change - rootJointHarmonicPolynomialInclusion n lam k - (weightedChevalleyEilenbergDifferential n lam k - (weightedChevalleyEilenbergDifferential n lam (k + 1) f)) = - rootChevalleyEilenbergBoundary r n k - (rootJointHarmonicPolynomialInclusion n lam (k + 1) - (weightedChevalleyEilenbergDifferential n lam (k + 1) f)) - at hfirst - have hsecond := LinearMap.congr_fun - (rootJointHarmonicPolynomialInclusion_chevalley_intertwines - (n := n) (k := k + 1) lam) f - change - rootJointHarmonicPolynomialInclusion n lam (k + 1) - (weightedChevalleyEilenbergDifferential n lam (k + 1) f) = - rootChevalleyEilenbergBoundary r n (k + 1) - (rootJointHarmonicPolynomialInclusion n lam (k + 2) f) - at hsecond - change - rootJointHarmonicPolynomialInclusion n lam k - (weightedChevalleyEilenbergDifferential n lam k - (weightedChevalleyEilenbergDifferential n lam (k + 1) f)) = 0 - rw [hfirst, hsecond] - exact LinearMap.congr_fun h - (rootJointHarmonicPolynomialInclusion n lam (k + 2) f) + apply (LinearMap.cancel_left + (f := rootJointHarmonicPolynomialInclusion n lam k) + (rootJointHarmonicPolynomialInclusion_injective lam)).mp + rw [LinearMap.comp_zero, ← LinearMap.comp_assoc, + rootJointHarmonicPolynomialInclusion_chevalley_intertwines, + LinearMap.comp_assoc, + rootJointHarmonicPolynomialInclusion_chevalley_intertwines, + ← LinearMap.comp_assoc, h, LinearMap.zero_comp] end @@ -3389,12 +3333,8 @@ open MetricCodes.Spherical.HigherYoungPenultimateRowProjectedLower theorem loweredInternalYoungWeight_raiseWeight {r : ℕ} (low : Fin (r + 1) → ℕ) (row : Fin (r + 1)) : loweredInternalYoungWeight (raiseWeight low row) row = low := by - funext j - by_cases hj : j = row - · subst j - simp only [loweredInternalYoungWeight, raiseWeight, Function.update_self, add_tsub_cancel_right] - · simp only [loweredInternalYoungWeight, raiseWeight, Function.update_self, add_tsub_cancel_right, - ne_eq, hj, not_false_eq_true, Function.update_of_ne] + exact @HigherYoungArbitraryRowLoweringProjectedAxisWitness.loweredInternalYoungWeight_raiseWeight + r low row theorem finrank_raiseWeight_eq_finrank_mul_weylEdgeRatio {r n : ℕ} (low : Fin (r + 1) → ℕ) (mu : Fin r → ℕ) @@ -5386,9 +5326,8 @@ theorem unusedMixedHessian_of_mem_fullYoungComplexPolynomialSpan (antiholomorphicDerivative h b p f) + antiholomorphicDerivative h a p (holomorphicDerivative h b p f)))) := by - apply unusedMixedHessian_eq_neg_isotropicDerivative_of_traceFree - exact complexTraceOperator_of_mem_fullYoungComplexPolynomialSpan - lam hf a b + exact unusedMixedHessian_eq_neg_isotropicDerivative_of_traceFree h a b f + (complexTraceOperator_of_mem_fullYoungComplexPolynomialSpan lam hf a b) end @@ -5949,7 +5888,7 @@ theorem ambientPositiveRoot_antiholomorphicDerivative_commutator_apply MvPolynomial.algebraMap_eq] rw [map_ofNat (MvPolynomial.C : ℂ →+* MvPolynomial (Fin ((r + 1) * n)) ℂ) 2] - ring + ac_rfl · simp only [HigherYoungIsotropicComplexTraceDecomposition.antiholomorphicDerivative_apply, map_add, Derivation.leibniz, smul_eq_mul, MvPolynomial.derivation_C, mul_zero, add_zero, hsq, and_false, ↓reduceIte, sub_self] @@ -6240,7 +6179,7 @@ theorem sum_ambientSumPositiveRoot_holomorphicDerivative_of_all_positive_root_hi rw [hcount] congr 1 push_cast - ring + ac_rfl end HigherYoungAmbientSumRootAllHighestHolomorphicEvaluation @@ -7482,7 +7421,7 @@ theorem coeff_signedDiagonalDerivation rw [Finset.mul_sum, Finset.sum_mul] apply Finset.sum_congr rfl intro i _ - ring + ac_rfl theorem signedDiagonal_weightedHomogeneousComponent {ι : Type*} [Finite ι] {m : ℕ} diff --git a/LeanPool/MetricCodes/RootComplex.lean b/LeanPool/MetricCodes/RootComplex.lean index 4e29cdb7c..c4857d0d7 100644 --- a/LeanPool/MetricCodes/RootComplex.lean +++ b/LeanPool/MetricCodes/RootComplex.lean @@ -845,7 +845,7 @@ theorem naturalDiagonalDerivation_coeff {ι : Type*} [Fintype ι] rw [Finset.sum_mul] apply Finset.sum_congr rfl intro i _ - ring + ac_rfl theorem conjugatedTotalAmbientCartan_X {r n : ℕ} (h : 2 * (r + 1) ≤ n) @@ -1167,7 +1167,7 @@ theorem complex_smul_youngComplexPair Complex.I • polynomialComplexification ((q : PolynomialSpace r n) + (q' : PolynomialSpace r n)) = _ rw [map_add, map_add, smul_add] - module + ac_rfl theorem complexRotationCombination_youngComplexPair {r n k : ℕ} (lam : Fin (r + 1) → ℕ) @@ -4590,7 +4590,7 @@ theorem det_orthogonal_denominator det_chebyshev_geometric_sum, det_quadratic_projective_vandermonde, ← upper_gram_pair_product] - ring + ac_rfl end OrthogonalDenominator @@ -5495,8 +5495,6 @@ theorem rootJointHarmonicChainDifferential_top_eq_zero rw [weightedRootBracketBoundary_apply] apply Finset.sum_eq_zero intro S _ - have hzero : rootBracketBoundaryCoefficient S.val T.val = 0 := - rootBracketBoundaryCoefficient_degree_zero S.val T.val simp only [Nat.reduceAdd, rootBracketBoundaryCoefficient_degree_zero, ↓reduceDIte] @[simp] theorem weightedChevalleyEilenbergDifferential_degree_zero @@ -5540,12 +5538,6 @@ theorem finrank_harmonicYoung_eq_rootExteriorEulerCharacteristic_of_rootExact change rootExteriorEulerCharacteristic n lam = (Module.finrank ℝ (RootJointHarmonicChain n lam 0) : ℤ) - (Module.finrank ℝ (LinearMap.range (d 0)) : ℤ) at h - have hzero' : - (Module.finrank ℝ - (LinearMap.ker (rootDegreeZeroPositiveCochain n lam)) : ℤ) + - (Module.finrank ℝ (LinearMap.range (d 0)) : ℤ) = - (Module.finrank ℝ (RootJointHarmonicChain n lam 0) : ℤ) := by - exact_mod_cast hzero have hker := finrank_rootDegreeZeroPositiveCochain_kernel (n := n) lam omega diff --git a/LeanPool/MetricCodes/SpectralDecomposition.lean b/LeanPool/MetricCodes/SpectralDecomposition.lean index 81e0f93a4..39f9a7151 100644 --- a/LeanPool/MetricCodes/SpectralDecomposition.lean +++ b/LeanPool/MetricCodes/SpectralDecomposition.lean @@ -28,6 +28,43 @@ namespace Spherical section +open scoped InnerProductSpace + +/-- Spanning ranges detect vanishing of an adjoint composition. -/ +theorem adjoint_composition_eq_zero_of_spanning_ranges + {ι E F G : Type*} + [NormedAddCommGroup E] [InnerProductSpace ℝ E] [FiniteDimensional ℝ E] + [NormedAddCommGroup F] [InnerProductSpace ℝ F] [FiniteDimensional ℝ F] + [AddCommGroup G] [Module ℝ G] + (V : ι → Type*) [∀ i, AddCommGroup (V i)] [∀ i, Module ℝ (V i)] + (L : (i : ι) → V i →ₗ[ℝ] E) + (hspan : (⨆ i, LinearMap.range (L i)) = ⊤) + (C : E →ₗ[ℝ] F) (A : G →ₗ[ℝ] F) + (hzero : ∀ i x p, ⟪C (L i x), A p⟫_ℝ = 0) : + C.adjoint.comp A = 0 := by + apply LinearMap.ext + intro p + change C.adjoint (A p) = 0 + apply ext_inner_left ℝ + intro q + rw [inner_zero_right] + have hq : q ∈ ⨆ i, LinearMap.range (L i) := by + rw [hspan] + trivial + refine Submodule.iSup_induction + (motive := fun z => ⟪z, C.adjoint (A p)⟫_ℝ = 0) _ hq ?_ ?_ ?_ + · intro i z hz + obtain ⟨x, rfl⟩ := hz + exact (LinearMap.adjoint_inner_right C _ _).trans (hzero i x p) + · exact inner_zero_left _ + · intro u v hu hv + exact (inner_add_left (𝕜 := ℝ) u v (C.adjoint (A p))).trans + (by rw [hu, hv, add_zero]) + +end + +section + namespace HigherYoungAllRankInvariantPositiveRootKernel @@ -376,11 +413,11 @@ theorem dominantHighestRotationWordSpan_eq_top_of_orthogonalPositiveRootRigidity orthogonalPositiveRootDerivation hn α z = 0) → z ∈ ambientIsotropicHighestSubmodule hn lam) : dominantHighestRotationWordSpan hn lam hdom = ⊤ := by - apply (allRankRotationIrreducible_of_orthogonalPositiveRootRigidity - hn lam hdom N hnil hhighest - (dominantHighestRotationWordSpan hn lam hdom) - (dominantHighestRotationWordSpan_rotationInvariant hn lam hdom)).resolve_left - exact dominantHighestRotationWordSpan_ne_bot hn lam hdom + exact Or.resolve_left + (allRankRotationIrreducible_of_orthogonalPositiveRootRigidity hn lam hdom N hnil hhighest + (dominantHighestRotationWordSpan hn lam hdom) + (dominantHighestRotationWordSpan_rotationInvariant hn lam hdom)) + (dominantHighestRotationWordSpan_ne_bot hn lam hdom) theorem orthogonalPositiveRootWord_eq_zero_of_mem_fullYoungComplexPolynomialSpan {r n : ℕ} (hn : 2 * (r + 1) ≤ n) @@ -472,12 +509,8 @@ theorem finiteInterlacing_two_mul_row_count_le theorem canonicalEdge_loweredInternalYoungWeight_raiseWeight {r : ℕ} (low : Fin (r + 1) → ℕ) (row : Fin (r + 1)) : loweredInternalYoungWeight (raiseWeight low row) row = low := by - funext j - by_cases hj : j = row - · subst j - simp only [loweredInternalYoungWeight, raiseWeight, Function.update_self, add_tsub_cancel_right] - · simp only [loweredInternalYoungWeight, raiseWeight, Function.update_self, add_tsub_cancel_right, - ne_eq, hj, not_false_eq_true, Function.update_of_ne] + exact @HigherYoungArbitraryRowLoweringProjectedAxisWitness.loweredInternalYoungWeight_raiseWeight + r low row theorem canonicalEdge_raiseWeight_strictly_removable {r : ℕ} (low : Fin (r + 1) → ℕ) (hdom : Antitone low) @@ -3190,7 +3223,7 @@ theorem cartanCharacteristicInterpolationBasis_mul_eq_nodal rw [Lagrange.basis_eq_prod_sub_inv_mul_nodal_div (Finset.mem_univ i), ← Lagrange.nodal_erase_eq_nodal_div (Finset.mem_univ i), Lagrange.nodal_eq_mul_nodal_erase (Finset.mem_univ i)] - ring + ac_rfl theorem signedAmbientCharacteristicNodes_injective {r n : ℕ} {lam : Fin (r + 1) → ℕ} {mu : Fin r → ℕ} @@ -3667,9 +3700,9 @@ theorem allRankCartanCharacteristicProjector_raise_channel (p : HarmonicYoungSpace (n := n) (raiseWeight target row)) : allRankCartanCharacteristicProjector target selected (A p) = if selected = (row, true) then A p else 0 := by - apply allRankCartanCharacteristicProjector_apply_eigenvector - target mu h selected (row, true) (A p) - exact gtRelativeCasimir_raise_channel target row A hA p + exact allRankCartanCharacteristicProjector_apply_eigenvector target mu h selected (row, true) (A + p) + (gtRelativeCasimir_raise_channel target row A hA p) theorem allRankCartanCharacteristicProjector_lower_channel {r n : ℕ} (target : Fin (r + 1) → ℕ) @@ -3686,9 +3719,9 @@ theorem allRankCartanCharacteristicProjector_lower_channel (p : HarmonicYoungSpace (n := n) source) : allRankCartanCharacteristicProjector target selected (A p) = if selected = (row, false) then A p else 0 := by - apply allRankCartanCharacteristicProjector_apply_eigenvector - target mu h selected (row, false) (A p) - exact gtRelativeCasimir_lower_channel target source row hsource A hA p + exact allRankCartanCharacteristicProjector_apply_eigenvector target mu h selected (row, false) (A + p) + (gtRelativeCasimir_lower_channel target source row hsource A hA p) theorem allRankCartanCharacteristicProjector_youngClebschLower {r n : ℕ} (target : Fin (r + 1) → ℕ) @@ -4232,11 +4265,17 @@ theorem canonicalGelfandTsetlinFibre_selectedClebschCompression_iff_reverse (reverseInterlacingHarmonicBranch low mu hlow p))) = plusProbability (n + 1) low mu row • reverseInterlacingHarmonicBranch low mu hlow p := by - have hscalar := (canonicalGelfandTsetlinFibre_phase_pos - low mu hlow hgram).ne' - simp only [canonicalGelfandTsetlinFibre_apply, map_smul, smul_smul] - rw [mul_comm (plusProbability (n + 1) low mu row), mul_smul, - smul_right_inj hscalar] + let A := gtYoungAxisTensor low + (EuclideanSpace.basisFun (Fin (n + 1)) ℝ (Fin.last n)) + let T := A.adjoint.comp ((gtSelectedRowClebschRangeProjector low row).comp A) + let c : ℝ := (Real.sqrt (canonicalGelfandTsetlinFischerGram + low mu hlow hgram))⁻¹ + let d := plusProbability (n + 1) low mu row + let x := reverseInterlacingHarmonicBranch low mu hlow p + have hc : c ≠ 0 := (canonicalGelfandTsetlinFibre_phase_pos low mu hlow hgram).ne' + rw [canonicalGelfandTsetlinFibre_apply] + change T (c • x) = d • (c • x) ↔ T x = d • x + rw [map_smul, smul_comm d c, smul_right_inj hc] theorem gtSelectedRowClebschRangeProjector_axisCompression_mem_reverseBranch_range {r n : ℕ} (low : Fin (r + 2) → ℕ) @@ -4434,7 +4473,7 @@ theorem gtSelectedProjectorCompression_eq_plusProbability_of_minor (plusProbability (n + 1) lam mu row • (q : PolynomialSpace r n)) rw [SpherePacking.Fischer.polynomialInner_smul_right] - ring + ac_rfl /-- The selected Clebsch range projector compressed along tensoring with the last coordinate axis. -/ @@ -4913,7 +4952,6 @@ theorem orthogonalTensorPieriCoefficient_padded_zero_lt (n r j : ℕ) (hj : j < r) : orthogonalTensorPieriCoefficient n (-(r : ℤ)) (j : ℤ) = 0 := by unfold orthogonalTensorPieriCoefficient - have hj' : (j : ℤ) < (r : ℤ) := by exact_mod_cast hj have hfirst : -(r : ℤ) + (j : ℤ) < 0 := by omega have hsecond : -(r : ℤ) - (j : ℤ) - 2 < 0 := by omega rw [orthogonalCompleteSymmetricCoefficient_of_neg n hfirst, @@ -6102,7 +6140,7 @@ theorem orthogonalTensorPieriNextColumn_last rw [harg] convert orthogonalTensorPieriCoefficient_padded_zero_succ n r using 1 push_cast - ring + ac_rfl theorem sum_det_updateRow_orthogonalTensorPieriSignedShiftMatrix {r : ℕ} (n : ℕ) (lam : Fin (r + 1) → ℕ) @@ -6537,7 +6575,7 @@ theorem zeroRowTensorIsometryEquiv_symm_tensorCasimir_intertwine ((zeroRowTensorIsometryEquiv (n := n) lam).symm.toLinearMap y) := LinearMap.congr_fun (zeroRowTensorIsometryEquiv_symm_rotation_intertwine lam a b) y - simp only [LinearMap.comp_apply, gtTensorCasimir, LinearMap.smul_apply, + simp only [LinearMap.comp_apply, gtTensorCasimir.eq_1, LinearMap.smul_apply, LinearMap.sum_apply, LinearMap.neg_apply, map_smul, map_sum, map_neg] simp_rw [hrot] @@ -6552,7 +6590,7 @@ theorem zeroRowTensorIsometryEquiv_symm_relativeCasimir_intertwine have h := LinearMap.congr_fun (zeroRowTensorIsometryEquiv_symm_tensorCasimir_intertwine lam) x simp only [LinearMap.comp_apply] at h - simp only [gtRelativeCasimir, LinearMap.comp_apply, LinearMap.smul_apply, + simp only [gtRelativeCasimir.eq_1, LinearMap.comp_apply, LinearMap.smul_apply, LinearMap.sub_apply, LinearMap.id_apply, map_smul, map_sub] rw [allRankCasimirEigenvalue_appendZeroWeight, h] @@ -8529,27 +8567,15 @@ theorem appendedPaddedPieriLower_adjoint_originalPaddedSelectedAxisTensor_eq_zer let C := (normalizedPaddedPieriLower (n := n + 1) (appendZeroWeight lam) hdominant (Fin.last (r + 2)) hsource).toLinearMap let A := originalPaddedSelectedAxisTensor lam mu h hgram - apply LinearMap.ext - intro p - change C.adjoint (A p) = 0 - apply ext_inner_left ℝ - intro q - rw [inner_zero_right] - have hsum := canonicalFullBranch_sum_projection source hn hsource q - rw [← hsum, sum_inner] - apply Finset.sum_eq_zero - intro nu _ - let F := (canonicalFullBranchFibre source hn nu).toLinearMap - obtain ⟨z, hz⟩ := Submodule.starProjection_apply_mem - (LinearMap.range F) q - change F z = (LinearMap.range F).starProjection q at hz - rw [← hz] - calc - ⟪F z, C.adjoint (A p)⟫_ℝ = ⟪C (F z), A p⟫_ℝ := - LinearMap.adjoint_inner_right C (F z) (A p) - _ = ⟪A p, C (F z)⟫_ℝ := real_inner_comm (A p) (C (F z)) - _ = 0 := originalAppendedFullBranchAxis_inner_eq_zero - lam mu h hgram hdominant hsource hn nu p z + apply adjoint_composition_eq_zero_of_spanning_ranges + (fun nu : FullBranchWeight source => + HarmonicYoungSpace (n := n) (fullBranchSignature nu)) + (fun nu => (canonicalFullBranchFibre source hn nu).toLinearMap) + (canonicalFullBranch_iSup_range_eq_top_unconditional source hn hsource) C A + intro nu x p + exact (real_inner_comm _ _).trans + (originalAppendedFullBranchAxis_inner_eq_zero + lam mu h hgram hdominant hsource hn nu p x) theorem appendedPaddedPieriLower_originalCanonicalAxis_orthogonal {r n : ℕ} (lam : Fin (r + 2) → ℕ) diff --git a/LeanPool/MetricCodes/Weyl.lean b/LeanPool/MetricCodes/Weyl.lean index c8bca76e3..a56b7b0f5 100644 --- a/LeanPool/MetricCodes/Weyl.lean +++ b/LeanPool/MetricCodes/Weyl.lean @@ -1353,7 +1353,6 @@ theorem weylTargetExponent_sub_reversePermutationExponent_apply (weylTargetExponent lam - reversePermutationExponent σ) i = (weylShift lam σ i).toNat := by have h := hσ i - have hi := i.isLt have hσi := (σ i).isLt simp only [reversePermutationExponent_apply, weylTargetExponent_apply, tsub_le_iff_right, Finsupp.coe_tsub, Pi.sub_apply, weylShift] at h ⊢ @@ -1652,7 +1651,7 @@ theorem alternatingGramKoszulCoefficient_eq_orthogonalJacobiTrudiDimension (r + j.val + 2))).coeff (weylTargetExponent lam) := by rw [hdenominator] congr 2 - ring + ac_rfl _ = orthogonalJacobiTrudiDimension n lam := coeff_ambientBinomialPolynomial_mul_orthogonalDenominator lam hB @@ -1673,7 +1672,7 @@ theorem risingFactorProduct_eq_ascFactorial (M q : ℕ) : apply Finset.prod_congr rfl intro a _ simp only [Nat.cast_add, Nat.cast_one] - ring + ac_rfl theorem risingFactorProduct_pos (M q : ℕ) : 0 < risingFactorProduct M q := by @@ -1989,7 +1988,7 @@ def centeredProduct (x : ℝ) (j : ℕ) : ℝ := @[simp] theorem centeredProduct_zero (x : ℝ) : centeredProduct x 0 = (x - 1) * x := by norm_num [centeredProduct, Finset.prod_range_succ] - ring + ac_rfl theorem centeredProduct_succ (x : ℝ) (j : ℕ) : centeredProduct x (j + 1) = @@ -2920,7 +2919,7 @@ theorem orthogonalJacobiTrudiMatrix_entry_of_factored_transport (risingFactorProduct_pos _ _).ne' unfold orthogonalRowScale field_simp [hD] - nlinarith [hfact] + linarith [hfact] /-- The difference of the two reflected factorial products in an orthogonal determinant entry. -/ def orthogonalReflectedBracket (n z : ℝ) (r j : ℕ) : ℝ := @@ -4500,7 +4499,9 @@ def rootJointHarmonicIncludedDescendingFischerLaplacian {r : ℕ} (f : RootJointHarmonicChain n lam k) (S : AdmissibleRootWedge lam k) : rootJointHarmonicIncludedDescendingFischerLaplacian n lam k f S = - includedDescendingPositiveRootFischerLaplacian n lam S (f S) := rfl + includedDescendingPositiveRootFischerLaplacian n lam S (f S) := by + simp only [rootJointHarmonicIncludedDescendingFischerLaplacian, + LinearMap.pi_apply, LinearMap.comp_apply, LinearMap.proj_apply] theorem rootJointHarmonicIncludedDescendingFischerLaplacian_energy_ge_self {r n k : ℕ} (lam : Fin (r + 1) → ℕ) @@ -4698,7 +4699,9 @@ def rootJointHarmonicHodgeDiagonal {r : ℕ} rootJointHarmonicHodgeDiagonal n lam k f S = includedDescendingPositiveRootFischerLaplacian n lam S (f S) + includedNondescendingPositiveRootFischerLaplacian n lam S (f S) + - excludedActivePositiveRootFischerLaplacian n lam S (f S) := rfl + excludedActivePositiveRootFischerLaplacian n lam S (f S) := by + simp only [rootJointHarmonicHodgeDiagonal, LinearMap.pi_apply, + LinearMap.comp_apply, LinearMap.proj_apply, LinearMap.add_apply] theorem includedNondescendingPositiveRootFischerLaplacian_energy {r n k : ℕ} (lam : Fin (r + 1) → ℕ) @@ -7534,10 +7537,6 @@ theorem rootActionCoboundary_eq_exteriorCreation_zeroExtension · have hcard : (S.val.erase α).card = k := by rw [Finset.card_erase_of_mem hα, S.property] omega - have hwedge : rootWedgeErase S α hα = - (⟨S.val.erase α, hcard⟩ : RootWedge r k) := by - apply Subtype.ext - rfl simp only [hα, ↓reduceDIte, actualExteriorRootCreation_apply, ↓reduceIte, rootPolynomialChainZeroExtension_apply, map_smul] @@ -8070,7 +8069,7 @@ theorem fullRootExteriorPolynomialAction_orderedBracketCoboundary_commute actualExteriorRootCreation (PolynomialSpace r n) α) * (actualExteriorRootCreation (PolynomialSpace r n) β * actualExteriorRootContraction (PolynomialSpace r n) δ) := by - noncomm_ring + ac_rfl _ = (actualExteriorRootCreation (PolynomialSpace r n) α * fullRootExteriorPolynomialAction r n γ) * (actualExteriorRootCreation (PolynomialSpace r n) β * @@ -8080,7 +8079,7 @@ theorem fullRootExteriorPolynomialAction_orderedBracketCoboundary_commute (fullRootExteriorPolynomialAction r n γ * actualExteriorRootCreation (PolynomialSpace r n) β) * actualExteriorRootContraction (PolynomialSpace r n) δ := by - noncomm_ring + ac_rfl _ = actualExteriorRootCreation (PolynomialSpace r n) α * (actualExteriorRootCreation (PolynomialSpace r n) β * fullRootExteriorPolynomialAction r n γ) * @@ -8090,7 +8089,7 @@ theorem fullRootExteriorPolynomialAction_orderedBracketCoboundary_commute actualExteriorRootCreation (PolynomialSpace r n) β * (fullRootExteriorPolynomialAction r n γ * actualExteriorRootContraction (PolynomialSpace r n) δ) := by - noncomm_ring + ac_rfl _ = actualExteriorRootCreation (PolynomialSpace r n) α * actualExteriorRootCreation (PolynomialSpace r n) β * (actualExteriorRootContraction (PolynomialSpace r n) δ * @@ -8208,26 +8207,7 @@ theorem rootJointHarmonicActionLowerRootStructureCross_apply_coe PolynomialSpace r n) else 0 else 0 := by - classical - rw [rootJointHarmonicActionLowerRootStructureCross_apply] - simp only [Submodule.coe_sum] - apply Finset.sum_congr rfl - intro α _ - split_ifs with hα - · simp only [Submodule.coe_sum] - apply Finset.sum_congr rfl - intro β _ - split_ifs with hβ hadm - · simp only [ZeroMemClass.coe_zero] - · simp only [Submodule.coe_sum] - apply Finset.sum_congr rfl - intro γ _ - split_ifs with hγ - · simp only [ZeroMemClass.coe_zero] - · simp only [Submodule.coe_smul] - rw [rootSwapLowerStructureEdge_coe] - · simp only [ZeroMemClass.coe_zero] - · simp only [ZeroMemClass.coe_zero] + exact @rootJointHarmonicActionLowerRootStructureCross_polynomial_apply r n k lam f S end