Zulip Chat Archive
Stream: Is there code for X?
Topic: le_iff_sq_le
Eric Rodriguez (Jan 03 2024 at 17:56):
Patrick Massot said:
I think it isn't the first time I don't manage to find the first lemma above. Is it really missing?
I think you're meant to use docs#pow_left_strictMonoOn
Jireh Loreaux (Jan 03 2024 at 17:56):
Indeed, I think the first lemma is missing.
Jireh Loreaux (Jan 03 2024 at 17:58):
Eric, that only gives you one direction of the ↔
Eric Rodriguez (Jan 03 2024 at 17:58):
Jireh Loreaux (Jan 03 2024 at 18:00):
Oh I see what you mean. That seems really messy, I vote for just adding the lemma.
Eric Rodriguez (Jan 03 2024 at 18:00):
cc @Yaël Dillies; this little discussion should be moved to a separate thread probably
Patrick Massot (Jan 03 2024 at 18:03):
Eric, do you mean
lemma le_iff_sq_le {R : Type*} [LinearOrderedRing R] {x y : R} (hx : 0 ≤ x) (hy : 0 ≤ y) :
x ≤ y ↔ x^2 ≤ y^2 :=
((pow_left_strictMonoOn zero_lt_two.ne').le_iff_le hx hy).symm
Patrick Massot (Jan 03 2024 at 18:03):
If there is nothing simpler then I think it is worth adding the lemma.
Eric Rodriguez (Jan 03 2024 at 18:04):
it's what I've been using for the past little bit; in some slight solace it holds for linear ordered semirings too! but I agree it's messy
Yaël Dillies (Jan 03 2024 at 18:45):
Your lemma is not there because you wrote it the wrong way around!
Patrick Massot (Jan 03 2024 at 18:46):
Do you mean switching sides of the iff?
Patrick Massot (Jan 03 2024 at 18:46):
It doesn't change anything, right?
Kevin Buzzard (Jan 03 2024 at 18:46):
I guess it changes whether the lemma obeys the "left hand side should be more complicated than the right hand side" rule
Patrick Massot (Jan 03 2024 at 18:47):
The proof is still the complicated
lemma le_iff_sq_le {R : Type*} [LinearOrderedSemiring R] {x y : R} (hx : 0 ≤ x) (hy : 0 ≤ y) :
x^2 ≤ y^2 ↔ x ≤ y :=
(pow_left_strictMonoOn zero_lt_two.ne').le_iff_le hx hy
Patrick Massot (Jan 03 2024 at 18:47):
right?
Patrick Massot (Jan 03 2024 at 18:49):
I would be happy to add to Mathlib
lemma pow_le_pow_iff {R : Type*} [LinearOrderedSemiring R] {x y : R} (n : ℕ)
(hx : 0 ≤ x) (hy : 0 ≤ y) : x^(n+1) ≤ y^(n+1) ↔ x ≤ y :=
(pow_left_strictMonoOn n.succ_ne_zero).le_iff_le hx hy
lemma sq_le_sq_iff {R : Type*} [LinearOrderedSemiring R] {x y : R} (hx : 0 ≤ x) (hy : 0 ≤ y) :
x^2 ≤ y^2 ↔ x ≤ y :=
pow_le_pow_iff 1 hx hy
What do you think @Yaël Dillies?
Patrick Massot (Jan 03 2024 at 18:51):
Golfing/finding the right general statement for
lemma abs_le_of_mem_uIoc_zero {A : Type*} [LinearOrderedAddCommGroup A] {x y : A} (h : x ∈ Ι 0 y) :
|x| ≤ |y| := by
rcases Set.mem_uIoc.1 h with (⟨hx, hxy⟩ | ⟨hxy, hx⟩)
· rwa [abs_of_pos hx, abs_of_pos <| hx.trans_le hxy]
· rw [abs_of_nonpos hx, abs_of_neg <| hxy.trans_le hx]
exact neg_le_neg hxy.le
lemma sq_le_of_mem_uIoc_zero {R : Type*} [LinearOrderedRing R] {x y : R} (h : x ∈ Ι 0 y) :
x^2 ≤ y^2 := by
simpa using pow_le_pow_left (abs_nonneg x) (abs_le_of_mem_uIoc_zero h) 2
would also be nice.
Yaël Dillies (Jan 03 2024 at 18:54):
I think docs#pow_le_pow_iff_left is good enough?
Yaël Dillies (Jan 03 2024 at 18:55):
Note that I added this lemma two weeks ago.
Yaël Dillies (Jan 03 2024 at 18:56):
Btw please don't touch anything in the algebraic order part of mathlib right now.I have a 5.5k lines PR to get merged, and the lemmas you care about are right in the middle of my diff.
Yaël Dillies (Jan 03 2024 at 18:56):
#9411 for reference
Yaël Dillies (Jan 03 2024 at 18:58):
I can't think of a much better way to state your lemmas. You should use uIcc
but that's it.
Patrick Massot (Jan 03 2024 at 19:01):
Yaël Dillies said:
I think docs#pow_le_pow_iff_left is good enough?
Great. That's one more mysterious exact? failure...
Patrick Massot (Jan 03 2024 at 19:01):
Yaël Dillies said:
I can't think of a much better way to state your lemmas. You should use
uIcc
but that's it.
The relevant one for interval integral is uIoc
.
Yaël Dillies (Jan 03 2024 at 19:08):
Ah sure but one is easily a subset of the other
Patrick Massot (Jan 03 2024 at 19:09):
Of course I agree the uIoc version should be deduced from a uIcc one.
Patrick Massot (Jan 03 2024 at 19:09):
And I won't touch this, don't worry about your PR.
Patrick Massot (Jan 03 2024 at 19:10):
I was only trying to help Alex K in another thread.
Last updated: May 02 2025 at 03:31 UTC