Skip to content

Commit 2fb8709

Browse files
feat(ENNReal): x⁻¹ ^ n = (x ^ n)⁻¹ (#28090)
Co-authored-by: FormulaRabbit81 <122625239+FormulaRabbit81@users.noreply.github.com> Co-authored-by: Yaël Dillies <yael.dillies@gmail.com>
1 parent ed5dc59 commit 2fb8709

1 file changed

Lines changed: 27 additions & 4 deletions

File tree

Mathlib/Data/ENNReal/Inv.lean

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,12 @@ theorem coe_zpow (hr : r ≠ 0) (n : ℤ) : (↑(r ^ n) : ℝ≥0∞) = (r : ℝ
643643
· have : r ^ n.succ ≠ 0 := pow_ne_zero (n + 1) hr
644644
simp only [zpow_negSucc, coe_inv this, coe_pow]
645645

646+
lemma zero_zpow_def (n : ℤ) : (0 : ℝ≥0∞) ^ n = if n = 0 then 1 else if 0 < n then 0 else ⊤ := by
647+
obtain ((_ | n) | n) := n <;> simp [-Nat.cast_add, -Int.natCast_add]
648+
649+
lemma top_zpow_def (n : ℤ) : (⊤ : ℝ≥0∞) ^ n = if n = 0 then 1 else if 0 < n thenelse 0 := by
650+
obtain ((_ | n) | n) := n <;> simp [-Nat.cast_add, -Int.natCast_add]
651+
646652
theorem zpow_pos (ha : a ≠ 0) (h'a : a ≠ ∞) (n : ℤ) : 0 < a ^ n := by
647653
cases n
648654
· simpa using ENNReal.pow_pos ha.bot_lt _
@@ -718,13 +724,30 @@ protected theorem zpow_add {x : ℝ≥0∞} (hx : x ≠ 0) (h'x : x ≠ ∞) (m
718724
replace hx : x ≠ 0 := by simpa only [Ne, coe_eq_zero] using hx
719725
simp only [← coe_zpow hx, zpow_add₀ hx, coe_mul]
720726

721-
protected theorem zpow_neg {x : ℝ≥0∞} (x_ne_zero : x ≠ 0) (x_ne_top : x ≠ ⊤) (m : ℤ) :
722-
x ^ (-m) = (x ^ m)⁻¹ :=
723-
ENNReal.eq_inv_of_mul_eq_one_left (by simp [← ENNReal.zpow_add x_ne_zero x_ne_top])
727+
protected theorem zpow_neg (x : ℝ≥0∞) (m : ℤ) : x ^ (-m) = (x ^ m)⁻¹ := by
728+
obtain hx₀ | hx₀ := eq_or_ne x 0
729+
· obtain hm | hm | hm := lt_trichotomy m 0 <;>
730+
simp_all [zero_zpow_def, ne_of_lt, ne_of_gt, lt_asymm]
731+
obtain hx | hx := eq_or_ne x ⊤
732+
· obtain hm | hm | hm := lt_trichotomy m 0 <;>
733+
simp_all [top_zpow_def, ne_of_lt, ne_of_gt, lt_asymm]
734+
exact ENNReal.eq_inv_of_mul_eq_one_left (by simp [← ENNReal.zpow_add hx₀ hx])
724735

725736
protected theorem zpow_sub {x : ℝ≥0∞} (x_ne_zero : x ≠ 0) (x_ne_top : x ≠ ⊤) (m n : ℤ) :
726737
x ^ (m - n) = (x ^ m) * (x ^ n)⁻¹ := by
727-
rw [sub_eq_add_neg, ENNReal.zpow_add x_ne_zero x_ne_top, ENNReal.zpow_neg x_ne_zero x_ne_top n]
738+
rw [sub_eq_add_neg, ENNReal.zpow_add x_ne_zero x_ne_top, ENNReal.zpow_neg]
739+
740+
protected lemma inv_zpow (x : ℝ≥0∞) (n : ℤ) : x⁻¹ ^ n = (x ^ n)⁻¹ := by
741+
cases n <;> simp [ENNReal.inv_pow]
742+
743+
protected lemma inv_zpow' (x : ℝ≥0∞) (n : ℤ) : x⁻¹ ^ n = x ^ (-n) := by
744+
rw [ENNReal.zpow_neg, ENNReal.inv_zpow]
745+
746+
lemma zpow_le_one_of_nonpos {n : ℤ} (hn : n ≤ 0) {x : ℝ≥0∞} (hx : 1 ≤ x) : x ^ n ≤ 1 := by
747+
obtain ⟨m, rfl⟩ := neg_surjective n
748+
lift m to ℕ using by simpa using hn
749+
rw [← ENNReal.inv_zpow', ENNReal.inv_zpow, ENNReal.inv_le_one]
750+
exact mod_cast one_le_pow₀ hx
728751

729752
lemma isUnit_iff : IsUnit a ↔ a ≠ 0 ∧ a ≠ ∞ := by
730753
refine ⟨fun ha ↦ ⟨ha.ne_zero, ?_⟩,

0 commit comments

Comments
 (0)