Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions Mathlib/Algebra/Module/ZLattice/Summable.lean

@themathqueen themathqueen Jun 18, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely sure where this PR stands because of @b-mehta's comments in both here and #39692, so I'm not sure what to do.

But the golf here looks fine and doesn't use anything else in the PR, so

splice-bot maintainer merge

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unknown splice-bot command

No label command matched keyword 'maintainer-merge'.

Failed step(s): Resolve configured trigger command.

Advice:

  • Either remove the keyword to run the default split-PR flow, or add a matching entry to label_commands.

Run logs: https://github.com/leanprover-community/mathlib4/actions/runs/27756166287/attempts/1

Step outcomes
  • Consume bridge artifact: success
  • Fetch and parse trigger comment: success
  • Resolve configured trigger command: failure
  • Authorize commenter: success
  • Check out BASE: skipped
  • Check out HEAD: skipped
  • Stage file changes: skipped
  • Validate create-pull-request inputs: skipped
  • Create Pull Request: skipped
  • Apply label to split PR: skipped
  • Post comment on split PR: skipped
Token diagnostics
  • token source: inputs.token
  • branch token source: inputs.branch_token
  • authz token source: inputs.authz_token
  • commenter: themathqueen
  • pr author: YaelDillies
  • base repo: leanprover-community/mathlib4
  • allow_pr_author: true
  • min_repo_permission: disabled
  • observed_repo_permission: not-checked
  • allowed_users: (none)
  • allowed_teams: leanprover-community/mathlib-reviewers, leanprover-community/mathlib-maintainers
  • matched_rules: team:leanprover-community/mathlib-reviewers
  • authz token source: inputs.authz_token
  • trigger keyword: maintainer-merge
  • label authz token source: inputs.authz_token

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think editing worked, might have to do this again:

splice-bot maintainer merge

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Split PR created and commented

Split off the changes to Mathlib/Algebra/Module/ZLattice/Summable.lean in #40752 and posted a comment via splice-bot command maintainer.

Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,7 @@ lemma sum_piFinset_Icc_rpow_le {ι : Type*} [Fintype ι] [DecidableEq ι]
rw [← Real.rpow_natCast, ← Real.rpow_add (by positivity), Nat.cast_sub hd]
norm_cast
_ ≤ 2 * d * 3 ^ (d - 1) * ε ^ r * ∑ k ∈ range (n + 1), (k : ℝ) ^ (d - 1 + r) := by
gcongr
rw [Finset.sum_range_succ', le_add_iff_nonneg_right]
positivity
grw [Finset.sum_range_succ', Nat.cast_zero, ← Real.rpow_nonneg le_rfl, add_zero]
_ ≤ 2 * d * 3 ^ (d - 1) * ε ^ r * ∑' k : ℕ, (k : ℝ) ^ (d - 1 + r) := by
gcongr
refine Summable.sum_le_tsum _ (fun _ _ ↦ by positivity) (Real.summable_nat_rpow.mpr ?_)
Expand Down
26 changes: 19 additions & 7 deletions Mathlib/Algebra/Order/BigOperators/Group/Finset.lean
Comment thread
YaelDillies marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,26 @@ theorem one_le_prod'' [MulLeftMono N] (h : ∀ i : ι, 1 ≤ f i) : 1 ≤ ∏ i
theorem prod_le_one' [MulLeftMono N] (h : ∀ i ∈ s, f i ≤ 1) : ∏ i ∈ s, f i ≤ 1 :=
(prod_le_prod' h).trans_eq (by rw [prod_const_one])

@[to_additive (attr := gcongr) sum_le_sum_of_subset_of_nonneg]
theorem prod_le_prod_of_subset_of_one_le' [MulLeftMono N] (h : s ⊆ t)
(hf : ∀ i ∈ t, i ∉ s → 1 ≤ f i) : ∏ i ∈ s, f i ≤ ∏ i ∈ t, f i := by
@[to_additive (attr := gcongr)]
lemma prod_mono_of_subset_of_one_le [MulLeftMono N] (h : s ⊆ t) (hfg : ∀ i ∈ s, f i ≤ g i)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one should have a prime in the name, since that's the established naming convention for these lemmas.
I'm conscious that you would like to enforce your personal new convention, but this is not widely applied, and never applied for finset lemmas, so let's not start new half-refactors.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition, the renames are clearly scope-creep!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #39692

(hg : ∀ i ∈ t, i ∉ s → 1 ≤ g i) : ∏ i ∈ s, f i ≤ ∏ i ∈ t, g i := by
classical calc
∏ i ∈ s, f i ≤ (∏ i ∈ t \ s, f i) * ∏ i ∈ s, f i :=
le_mul_of_one_le_left' <| one_le_prod' <| by simpa only [mem_sdiff, and_imp]
_ = ∏ i ∈ t \ s ∪ s, f i := (prod_union sdiff_disjoint).symm
_ = ∏ i ∈ t, f i := by rw [sdiff_union_of_subset h]
∏ i ∈ s, f i
_ ≤ ∏ i ∈ s, g i := by gcongr with i hi; exact hfg i hi
_ ≤ (∏ i ∈ t \ s, g i) * ∏ i ∈ s, g i :=
le_mul_of_one_le_left' <| one_le_prod' <| by simpa only [mem_sdiff, and_imp]
_ = ∏ i ∈ t \ s ∪ s, g i := (prod_union sdiff_disjoint).symm
_ = ∏ i ∈ t, g i := by rw [sdiff_union_of_subset h]

@[to_additive]
lemma prod_mono_of_subset_of_le_one [MulLeftMono N] (h : s ⊆ t) (hfg : ∀ i ∈ s, f i ≤ g i)
(hf : ∀ i ∈ t, i ∉ s → f i ≤ 1) : ∏ i ∈ t, f i ≤ ∏ i ∈ s, g i :=
prod_mono_of_subset_of_one_le (N := Nᵒᵈ) h hfg hf

@[to_additive sum_le_sum_of_subset_of_nonneg]
theorem prod_le_prod_of_subset_of_one_le' [MulLeftMono N] (h : s ⊆ t)
(hf : ∀ i ∈ t, i ∉ s → 1 ≤ f i) : ∏ i ∈ s, f i ≤ ∏ i ∈ t, f i :=
prod_mono_of_subset_of_one_le h (by simp) hf

@[to_additive]
theorem prod_le_prod_of_subset_of_le_one'
Expand Down
42 changes: 28 additions & 14 deletions Mathlib/Algebra/Order/BigOperators/GroupWithZero/Finset.lean
Original file line number Diff line number Diff line change
Expand Up @@ -67,27 +67,41 @@ lemma le_prod_max_one {M : Type*} [CommMonoidWithZero M] [LinearOrder M] [ZeroLE
exact this ▸ prod_le_prod (fun _ _ ↦ by grind [zero_le_one]) fun _ _ ↦ by grind

@[gcongr]
theorem prod_le_prod_of_subset_of_one_le (h : s ⊆ t)
(hf0 : ∀ i ∈ s, 0 ≤ f i)
(hf : ∀ i ∈ t, i ∉ s → 1 ≤ f i) : ∏ i ∈ s, f i ≤ ∏ i ∈ t, f i := by
lemma prod_mono_of_subset_of_one_le₀ (h : s ⊆ t) (hf₀ : ∀ i ∈ s, 0 ≤ f i) (hfg : ∀ i ∈ s, f i ≤ g i)
(hf : ∀ i ∈ t, i ∉ s → 1 ≤ g i) : ∏ i ∈ s, f i ≤ ∏ i ∈ t, g i := by
have := posMulMono_iff_mulPosMono.1 ‹PosMulMono R›
classical
calc
∏ i ∈ s, f i ≤ (∏ i ∈ t \ s, f i) * ∏ i ∈ s, f i :=
le_mul_of_one_le_left (prod_nonneg hf0) <| one_le_prod <| by simpa only [mem_sdiff, and_imp]
_ = ∏ i ∈ t \ s ∪ s, f i := (prod_union sdiff_disjoint).symm
_ = ∏ i ∈ t, f i := by rw [sdiff_union_of_subset h]

theorem prod_le_prod_of_subset_of_le_one (h : s ⊆ t) (hf0 : ∀ i ∈ t, 0 ≤ f i)
(hf : ∀ i ∈ t, i ∉ s → f i ≤ 1) :
∏ i ∈ t, f i ≤ ∏ i ∈ s, f i := by
∏ i ∈ s, f i
_ ≤ ∏ i ∈ s, g i := by gcongr with i hi; exacts [hf₀, hfg i hi]
_ ≤ (∏ i ∈ t \ s, g i) * ∏ i ∈ s, g i :=
le_mul_of_one_le_left (prod_nonneg fun i hi ↦ (hf₀ i hi).trans (hfg i hi)) <|
one_le_prod <| by simpa only [mem_sdiff, and_imp]
_ = ∏ i ∈ t \ s ∪ s, g i := (prod_union sdiff_disjoint).symm
_ = ∏ i ∈ t, g i := by rw [sdiff_union_of_subset h]

lemma prod_mono_of_subset_of_le_one₀ (h : s ⊆ t) (hg₀ : ∀ i ∈ t, 0 ≤ g i) (hgf : ∀ i ∈ s, g i ≤ f i)
(hf : ∀ i ∈ t, i ∉ s → g i ≤ 1) :
∏ i ∈ t, g i ≤ ∏ i ∈ s, f i := by
have := posMulMono_iff_mulPosMono.1 ‹PosMulMono R›
classical
calc
∏ i ∈ t, f i = ∏ i ∈ t \ s ∪ s, f i := by rw [sdiff_union_of_subset h]
_ = (∏ i ∈ t \ s, f i) * ∏ i ∈ s, f i := prod_union sdiff_disjoint
_ ≤ ∏ i ∈ s, f i :=
∏ i ∈ t, g i
_ = ∏ i ∈ t \ s ∪ s, g i := by rw [sdiff_union_of_subset h]
_ = (∏ i ∈ t \ s, g i) * ∏ i ∈ s, g i := prod_union sdiff_disjoint
_ ≤ ∏ i ∈ s, g i :=
mul_le_of_le_one_left (prod_nonneg (by grind)) (prod_le_one (by grind) (by grind))
_ ≤ ∏ i ∈ s, f i := by gcongr with i hi; exacts [fun i hi ↦ hg₀ _ <| h hi, hgf i hi]

@[gcongr]
lemma prod_le_prod_of_subset_of_one_le (h : s ⊆ t) (hf₀ : ∀ i ∈ s, 0 ≤ f i)
(hf : ∀ i ∈ t, i ∉ s → 1 ≤ f i) : ∏ i ∈ s, f i ≤ ∏ i ∈ t, f i :=
prod_mono_of_subset_of_one_le₀ h hf₀ (by simp) hf

lemma prod_le_prod_of_subset_of_le_one (h : s ⊆ t) (hf₀ : ∀ i ∈ t, 0 ≤ f i)
(hf : ∀ i ∈ t, i ∉ s → f i ≤ 1) :
∏ i ∈ t, f i ≤ ∏ i ∈ s, f i :=
prod_mono_of_subset_of_le_one₀ h hf₀ (by simp) hf

theorem prod_mono_set_of_one_le (hf : ∀ x, 1 ≤ f x) :
Monotone fun s ↦ ∏ x ∈ s, f x :=
Expand Down
3 changes: 1 addition & 2 deletions Mathlib/Analysis/Complex/Exponential.lean
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,7 @@ theorem sum_le_exp_of_nonneg {x : ℝ} (hx : 0 ≤ x) (n : ℕ) : ∑ i ∈ rang
refine le_lim (CauSeq.le_of_exists ⟨n, fun j hj => ?_⟩)
simp only [exp', const_apply, re_sum]
norm_cast
refine sum_le_sum_of_subset_of_nonneg (range_mono hj) fun _ _ _ ↦ ?_
positivity
gcongr
_ = exp x := by rw [exp, Complex.exp, ← cauSeqRe, lim_re]

lemma pow_div_factorial_le_exp (hx : 0 ≤ x) (n : ℕ) : x ^ n / n ! ≤ exp x :=
Expand Down
Loading