Skip to content

Commit 5f571ee

Browse files
committed
A few more gcongr golfs, probably unrelated
1 parent 2b568cc commit 5f571ee

File tree

10 files changed

+20
-21
lines changed

10 files changed

+20
-21
lines changed

Archive/Wiedijk100Theorems/SumOfPrimeReciprocalsDiverges.lean

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,10 @@ theorem card_le_mul_sum {x k : ℕ} : #(U x k) ≤ x * ∑ p ∈ P x k, 1 / (p :
117117
have h : #(P.biUnion N) ≤ ∑ p ∈ P, #(N p) := card_biUnion_le
118118
calc
119119
(#(P.biUnion N) : ℝ) ≤ ∑ p ∈ P, (#(N p) : ℝ) := by assumption_mod_cast
120-
_ ≤ ∑ p ∈ P, x * (1 / (p : ℝ)) := sum_le_sum fun p _ => ?_
120+
_ ≤ ∑ p ∈ P, x * (1 / (p : ℝ)) := by
121+
gcongr with p _
122+
simp only [N, mul_one_div, Nat.card_multiples, Nat.cast_div_le]
121123
_ = x * ∑ p ∈ P, 1 / (p : ℝ) := by rw [mul_sum]
122-
simp only [N, mul_one_div, Nat.card_multiples, Nat.cast_div_le]
123124

124125
/--
125126
The number of `e < x` for which `e + 1` is a squarefree product of primes smaller than or equal to

Mathlib/Algebra/Order/GroupWithZero/Unbundled/Basic.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,8 +1273,8 @@ lemma div_lt_div_of_pos_left (ha : 0 < a) (hc : 0 < c) (h : c < b) : a / b < a /
12731273
@[mono, gcongr, bound]
12741274
lemma div_le_div₀ (hc : 0 ≤ c) (hac : a ≤ c) (hd : 0 < d) (hdb : d ≤ b) : a / b ≤ c / d := by
12751275
rw [div_eq_mul_inv, div_eq_mul_inv]
1276-
exact mul_le_mul hac ((inv_le_inv₀ (hd.trans_le hdb) hd).2 hdb)
1277-
(inv_nonneg.2 <| hd.le.trans hdb) hc
1276+
gcongr
1277+
exacts [inv_nonneg.2 <| hd.le.trans hdb, hc, hd]
12781278

12791279
@[gcongr]
12801280
lemma div_lt_div₀ (hac : a < c) (hdb : d ≤ b) (hc : 0 ≤ c) (hd : 0 < d) : a / b < c / d := by

Mathlib/Algebra/Order/Ring/Abs.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,8 @@ private theorem abs_geomSum_le [IsOrderedRing α] : |geomSum a b n| ≤ (n + 1)
173173
rw [abs_mul, abs_pow, Nat.cast_succ, add_one_mul]
174174
refine add_le_add ?_ (pow_le_pow_left₀ (abs_nonneg _) le_sup_right _)
175175
rw [pow_succ, ← mul_assoc, mul_comm |a|]
176-
exact mul_le_mul ih le_sup_left (abs_nonneg _) (mul_nonneg
177-
(@Nat.cast_succ α .. ▸ Nat.cast_nonneg _) <| pow_nonneg ((abs_nonneg _).trans le_sup_left) _)
176+
gcongr
177+
exacts [abs_nonneg _, (abs_nonneg _).trans ih, le_sup_left]
178178

179179
omit [LinearOrder α] in
180180
private theorem pow_sub_pow_eq_sub_mul_geomSum :

Mathlib/Analysis/Calculus/ContDiff/Bounds.lean

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,7 @@ theorem norm_iteratedFDerivWithin_prod_le [DecidableEq ι] [NormOneClass A'] {u
307307
(by simp) (by simp only [← comp_apply (g := Finset.symInsertEquiv hi), comp_assoc]; simp)]
308308
rw [← Finset.univ_sigma_univ, Finset.sum_sigma, Finset.sum_range]
309309
simp +instances only [comp_apply, Finset.symInsertEquiv_symm_apply_coe]
310-
refine Finset.sum_le_sum ?_
311-
intro m _
310+
gcongr with m _
312311
specialize IH hf.2 (n := n - m) (le_trans (by exact_mod_cast n.sub_le m) hn)
313312
grw [IH]
314313
rw [Finset.mul_sum, ← Finset.sum_coe_sort]

Mathlib/Analysis/SpecialFunctions/Pochhammer.lean

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,11 @@ lemma monotoneOn_deriv_descPochhammer_eval (n : ℕ) :
5959
intro a ha b hb hab
6060
rw [Set.mem_Ioi, Nat.cast_add_one, add_sub_cancel_right] at ha hb
6161
simp_rw [deriv_descPochhammer_eval_eq_sum_prod_range_erase]
62-
apply Finset.sum_le_sum; intro i hi
63-
apply Finset.prod_le_prod
64-
· intro j hj
65-
rw [Finset.mem_erase, Finset.mem_range] at hj
66-
apply sub_nonneg_of_le
67-
exact ha.le.trans' (mod_cast Nat.le_pred_of_lt hj.2)
68-
· intro j hj
69-
rwa [← sub_le_sub_iff_right (j : ℝ)] at hab
62+
gcongr with i hi
63+
intro j hj
64+
rw [Finset.mem_erase, Finset.mem_range] at hj
65+
apply sub_nonneg_of_le
66+
exact ha.le.trans' (mod_cast Nat.le_pred_of_lt hj.2)
7067

7168
/-- `descPochhammer ℝ n` is convex on `[n-1, ∞)`. -/
7269
theorem convexOn_descPochhammer_eval (n : ℕ) :

Mathlib/Analysis/SumIntegralComparisons.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ theorem AntitoneOn.integral_le_sum (hf : AntitoneOn f (Icc x₀ (x₀ + a))) :
9393
convert (intervalIntegral.sum_integral_adjacent_intervals hint).symm
9494
simp only [Nat.cast_zero, add_zero]
9595
_ ≤ ∑ i ∈ Finset.range a, ∫ _ in x₀ + i..x₀ + (i + 1 : ℕ), f (x₀ + i) := by
96-
apply Finset.sum_le_sum fun i hi => ?_
96+
gcongr with i hi
9797
have ia : i < a := Finset.mem_range.1 hi
9898
refine intervalIntegral.integral_mono_on (by simp) (hint _ ia) (by simp) fun x hx => ?_
9999
apply hf _ _ hx.1

Mathlib/Combinatorics/SimpleGraph/Regularity/Chunk.lean

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ private theorem card_nonuniformWitness_sdiff_biUnion_star (hV : V ∈ P.parts) (
108108
B ⊆ G.nonuniformWitness ε U V ∧ B.Nonempty, m
109109
· suffices ∀ B ∈ (atomise U <| P.nonuniformWitnesses G ε U).parts,
110110
#(B \ {A ∈ (chunk hP G ε hU).parts | A ⊆ B}.biUnion id) ≤ m by
111-
exact sum_le_sum fun B hB => this B <| filter_subset _ _ hB
111+
gcongr with B hB
112+
exact this B <| filter_subset _ _ hB
112113
intro B hB
113114
unfold chunk
114115
split_ifs with h₁

Mathlib/Data/Finsupp/Order.lean

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ lemma sum_le_sum_index [DecidableEq ι] {f₁ f₂ : ι →₀ α} {h : ι →
8888
classical
8989
rw [sum_of_support_subset _ Finset.subset_union_left _ hh₀,
9090
sum_of_support_subset _ Finset.subset_union_right _ hh₀]
91-
exact Finset.sum_le_sum fun i hi ↦ hh _ hi <| hf _
91+
gcongr with i hi
92+
exact hh _ hi <| hf _
9293

9394
end Preorder
9495

Mathlib/GroupTheory/SpecificGroups/Cyclic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ theorem card_orderOf_eq_totient_aux₂ {d : ℕ} (hd : d ∣ Fintype.card α) :
127127
exact mem_erase_of_ne_of_mem hm₂ hm₁
128128
simp [this, h0]
129129
_ ≤ ∑ m ∈ c.divisors.erase d, φ m := by
130-
refine sum_le_sum fun m hm => ?_
130+
gcongr with m hm
131131
have hmc : m ∣ c := by
132132
simp only [mem_erase, mem_divisors] at hm
133133
tauto

Mathlib/NumberTheory/Chebyshev.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ theorem abs_psi_sub_theta_le_sqrt_mul_log {x : ℝ} (hx : 1 ≤ x) :
223223
apply le_trans <| abs_sum_le_sum_abs ..
224224
simp_rw [abs_of_nonneg <| theta_nonneg _]
225225
trans ∑ i ∈ Icc 2 ⌊log x / log 2⌋₊, log 4 * x.sqrt
226-
· apply sum_le_sum fun i hi ↦ ?_
226+
· gcongr with i hi
227227
apply le_trans (theta_le_log4_mul_x (rpow_nonneg (by linarith) _))
228228
rw [sqrt_eq_rpow]
229229
gcongr; simp_all

0 commit comments

Comments
 (0)