Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
This forward ports the changes introduced by leanprover-community/mathlib#17483

No change is needed to `Mathlib.Data.EReal` as the proofs have been golfed in a different way.



Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
  • Loading branch information
MichaelStollBayreuth and eric-wieser committed Mar 15, 2023
1 parent 19a7e60 commit 4267362
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 34 deletions.
23 changes: 6 additions & 17 deletions Mathlib/Algebra/Group/Basic.lean
Expand Up @@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Jeremy Avigad, Leonardo de Moura, Simon Hudon, Mario Carneiro
! This file was ported from Lean 3 source module algebra.group.basic
! leanprover-community/mathlib commit 966e0cf0685c9cedf8a3283ac69eef4d5f2eaca2
! leanprover-community/mathlib commit 2196ab363eb097c008d4497125e0dde23fb36db2
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
Expand Down Expand Up @@ -241,21 +241,10 @@ theorem inv_inj {a b : G} : a⁻¹ = b⁻¹ ↔ a = b :=
#align neg_inj neg_inj

@[to_additive]
theorem eq_inv_of_eq_inv (h : a = b⁻¹) : b = a⁻¹ := by simp [h]
#align eq_inv_of_eq_inv eq_inv_of_eq_inv
#align eq_neg_of_eq_neg eq_neg_of_eq_neg

@[to_additive]
theorem eq_inv_iff_eq_inv : a = b⁻¹ ↔ b = a⁻¹ :=
⟨eq_inv_of_eq_inv, eq_inv_of_eq_inv⟩
#align eq_inv_iff_eq_inv eq_inv_iff_eq_inv
#align eq_neg_iff_eq_neg eq_neg_iff_eq_neg

@[to_additive]
theorem inv_eq_iff_inv_eq : a⁻¹ = b ↔ b⁻¹ = a :=
eq_comm.trans <| eq_inv_iff_eq_inv.trans eq_comm
#align inv_eq_iff_inv_eq inv_eq_iff_inv_eq
#align neg_eq_iff_neg_eq neg_eq_iff_neg_eq
theorem inv_eq_iff_eq_inv : a⁻¹ = b ↔ a = b⁻¹ :=
fun h => h ▸ (inv_inv a).symm, fun h => h.symm ▸ inv_inv b⟩
#align inv_eq_iff_eq_inv inv_eq_iff_eq_inv
#align neg_eq_iff_eq_neg neg_eq_iff_eq_neg

variable (G)

Expand Down Expand Up @@ -663,7 +652,7 @@ theorem mul_eq_one_iff_eq_inv : a * b = 1 ↔ a = b⁻¹ :=

@[to_additive]
theorem mul_eq_one_iff_inv_eq : a * b = 1 ↔ a⁻¹ = b :=
by rw [mul_eq_one_iff_eq_inv, eq_inv_iff_eq_inv, eq_comm]
by rw [mul_eq_one_iff_eq_inv, inv_eq_iff_eq_inv]
#align mul_eq_one_iff_inv_eq mul_eq_one_iff_inv_eq
#align add_eq_zero_iff_neg_eq add_eq_zero_iff_neg_eq

Expand Down
4 changes: 2 additions & 2 deletions Mathlib/Algebra/GroupWithZero/Basic.lean
Expand Up @@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin
! This file was ported from Lean 3 source module algebra.group_with_zero.basic
! leanprover-community/mathlib commit 2f3994e1b117b1e1da49bcfb67334f33460c3ce4
! leanprover-community/mathlib commit 2196ab363eb097c008d4497125e0dde23fb36db2
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
Expand Down Expand Up @@ -371,7 +371,7 @@ theorem one_div_ne_zero {a : G₀} (h : a ≠ 0) : 1 / a ≠ 0 := by
#align one_div_ne_zero one_div_ne_zero

@[simp]
theorem inv_eq_zero {a : G₀} : a⁻¹ = 0 ↔ a = 0 := by rw [inv_eq_iff_inv_eq, inv_zero, eq_comm]
theorem inv_eq_zero {a : G₀} : a⁻¹ = 0 ↔ a = 0 := by rw [inv_eq_iff_eq_inv, inv_zero]
#align inv_eq_zero inv_eq_zero

@[simp]
Expand Down
6 changes: 3 additions & 3 deletions Mathlib/Algebra/Order/Group/Abs.lean
Expand Up @@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Jeremy Avigad, Leonardo de Moura, Mario Carneiro, Johannes Hölzl
! This file was ported from Lean 3 source module algebra.order.group.abs
! leanprover-community/mathlib commit a95b16cbade0f938fc24abd05412bde1e84bab9b
! leanprover-community/mathlib commit 2196ab363eb097c008d4497125e0dde23fb36db2
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
Expand Down Expand Up @@ -88,13 +88,13 @@ theorem abs_neg (a : α) : |(-a)| = |a| := by rw [abs_eq_max_neg, max_comm, neg_
#align abs_neg abs_neg

theorem eq_or_eq_neg_of_abs_eq {a b : α} (h : |a| = b) : a = b ∨ a = -b := by
simpa only [← h, eq_comm, eq_neg_iff_eq_neg] using abs_choice a
simpa only [← h, eq_comm (a := |a|), neg_eq_iff_eq_neg] using abs_choice a
#align eq_or_eq_neg_of_abs_eq eq_or_eq_neg_of_abs_eq

theorem abs_eq_abs {a b : α} : |a| = |b| ↔ a = b ∨ a = -b := by
refine' ⟨fun h => _, fun h => _⟩
· obtain rfl | rfl := eq_or_eq_neg_of_abs_eq h <;>
simpa only [neg_eq_iff_neg_eq, neg_inj, or_comm, @eq_comm _ (-b)] using abs_choice b
simpa only [neg_eq_iff_eq_neg (a := |b|), neg_inj, or_comm] using abs_choice b
· cases' h with h h <;>
simp [h, abs_neg]
#align abs_eq_abs abs_eq_abs
Expand Down
6 changes: 3 additions & 3 deletions Mathlib/Algebra/Periodic.lean
Expand Up @@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Benjamin Davidson
! This file was ported from Lean 3 source module algebra.periodic
! leanprover-community/mathlib commit 4c19a16e4b705bf135cf9a80ac18fcc99c438514
! leanprover-community/mathlib commit 2196ab363eb097c008d4497125e0dde23fb36db2
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
Expand Down Expand Up @@ -371,7 +371,7 @@ protected theorem Antiperiodic.funext [Add α] [Neg β] (h : Antiperiodic f c) :

protected theorem Antiperiodic.funext' [Add α] [InvolutiveNeg β] (h : Antiperiodic f c) :
(fun x => -f (x + c)) = f :=
(eq_neg_iff_eq_neg.mp h.funext).symm
neg_eq_iff_eq_neg.mpr h.funext
#align function.antiperiodic.funext' Function.Antiperiodic.funext'

/-- If a function is `antiperiodic` with antiperiod `c`, then it is also `periodic` with period
Expand Down Expand Up @@ -405,7 +405,7 @@ theorem Antiperiodic.int_odd_mul_antiperiodic [Ring α] [InvolutiveNeg β] (h :
#align function.antiperiodic.int_odd_mul_antiperiodic Function.Antiperiodic.int_odd_mul_antiperiodic

theorem Antiperiodic.sub_eq [AddGroup α] [InvolutiveNeg β] (h : Antiperiodic f c) (x : α) :
f (x - c) = -f x := by simp only [eq_neg_iff_eq_neg.mp (h (x - c)), sub_add_cancel]
f (x - c) = -f x := by simp only [← neg_eq_iff_eq_neg, ← h (x - c), sub_add_cancel]
#align function.antiperiodic.sub_eq Function.Antiperiodic.sub_eq

theorem Antiperiodic.sub_eq' [AddCommGroup α] [Neg β] (h : Antiperiodic f c) :
Expand Down
4 changes: 2 additions & 2 deletions Mathlib/Data/Int/Basic.lean
Expand Up @@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Jeremy Avigad
! This file was ported from Lean 3 source module data.int.basic
! leanprover-community/mathlib commit e1bccd6e40ae78370f01659715d3c948716e3b7e
! leanprover-community/mathlib commit 2196ab363eb097c008d4497125e0dde23fb36db2
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
Expand Down Expand Up @@ -153,7 +153,7 @@ theorem succ_neg_succ (a : ℤ) : succ (-succ a) = -a := by rw [neg_succ, succ_p
#align int.succ_neg_succ Int.succ_neg_succ

theorem neg_pred (a : ℤ) : -pred a = succ (-a) := by
rw [eq_neg_of_eq_neg (neg_succ (-a)).symm, neg_neg]
rw [neg_eq_iff_eq_neg.mp (neg_succ (-a)), neg_neg]
#align int.neg_pred Int.neg_pred

theorem pred_neg_pred (a : ℤ) : pred (-pred a) = -a := by rw [neg_pred, pred_succ]
Expand Down
7 changes: 3 additions & 4 deletions Mathlib/Data/Real/ConjugateExponents.lean
Expand Up @@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Sébastien Gouëzel, Yury Kudryashov
! This file was ported from Lean 3 source module data.real.conjugate_exponents
! leanprover-community/mathlib commit bd9851ca476957ea4549eb19b40e7b5ade9428cc
! leanprover-community/mathlib commit 2196ab363eb097c008d4497125e0dde23fb36db2
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
Expand Down Expand Up @@ -73,8 +73,8 @@ theorem one_div_ne_zero : 1 / p ≠ 0 := ne_of_gt h.one_div_pos

theorem conj_eq : q = p / (p - 1) := by
have := h.inv_add_inv_conj
rw [← eq_sub_iff_add_eq', one_div, inv_eq_iff_inv_eq] at this
field_simp [this, h.ne_zero]
rw [← eq_sub_iff_add_eq', one_div, inv_eq_iff_eq_inv] at this
field_simp [this, h.ne_zero]
#align real.is_conjugate_exponent.conj_eq Real.IsConjugateExponent.conj_eq

theorem conjugate_eq : conjugateExponent p = q := h.conj_eq.symm
Expand Down Expand Up @@ -134,4 +134,3 @@ theorem isConjugateExponent_one_div {a b : ℝ} (ha : 0 < a) (hb : 0 < b) (hab :
#align real.is_conjugate_exponent_one_div Real.isConjugateExponent_one_div

end Real

2 changes: 1 addition & 1 deletion Mathlib/Data/Real/EReal.lean
Expand Up @@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kevin Buzzard
! This file was ported from Lean 3 source module data.real.ereal
! leanprover-community/mathlib commit afdb4fa3b32d41106a4a09b371ce549ad7958abd
! leanprover-community/mathlib commit 2196ab363eb097c008d4497125e0dde23fb36db2
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
Expand Down
4 changes: 2 additions & 2 deletions Mathlib/Data/Set/Pointwise/Interval.lean
Expand Up @@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury G. Kudryashov, Patrick Massot
! This file was ported from Lean 3 source module data.set.pointwise.interval
! leanprover-community/mathlib commit 59694bd07f0a39c5beccba34bd9f413a160782bf
! leanprover-community/mathlib commit 2196ab363eb097c008d4497125e0dde23fb36db2
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
Expand Down Expand Up @@ -770,7 +770,7 @@ theorem inv_Ioo_0_left {a : α} (ha : 0 < a) : (Ioo 0 a)⁻¹ = Ioi a⁻¹ := by
#align set.inv_Ioo_0_left Set.inv_Ioo_0_left

theorem inv_Ioi {a : α} (ha : 0 < a) : (Ioi a)⁻¹ = Ioo 0 a⁻¹ := by
rw [inv_eq_iff_inv_eq, inv_Ioo_0_left (inv_pos.2 ha), inv_inv]
rw [inv_eq_iff_eq_inv, inv_Ioo_0_left (inv_pos.2 ha), inv_inv]
#align set.inv_Ioi Set.inv_Ioi

theorem image_const_mul_Ioi_zero {k : Type _} [LinearOrderedField k] {x : k} (hx : 0 < x) :
Expand Down

0 comments on commit 4267362

Please sign in to comment.