data.real.sign
⟷
Mathlib.Data.Real.Sign
The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(last sync)
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -95,8 +95,8 @@ theorem sign_eq_zero_iff {r : ℝ} : sign r = 0 ↔ r = 0 :=
#align real.sign_eq_zero_iff Real.sign_eq_zero_iff
-/
-#print Real.sign_int_cast /-
-theorem sign_int_cast (z : ℤ) : sign (z : ℝ) = ↑(Int.sign z) :=
+#print Real.sign_intCast /-
+theorem sign_intCast (z : ℤ) : sign (z : ℝ) = ↑(Int.sign z) :=
by
obtain hn | rfl | hp := lt_trichotomy z (0 : ℤ)
·
@@ -104,7 +104,7 @@ theorem sign_int_cast (z : ℤ) : sign (z : ℝ) = ↑(Int.sign z) :=
Int.cast_one]
· rw [Int.cast_zero, sign_zero, Int.sign_zero, Int.cast_zero]
· rw [sign_of_pos (int.cast_pos.mpr hp), Int.sign_eq_one_of_pos hp, Int.cast_one]
-#align real.sign_int_cast Real.sign_int_cast
+#align real.sign_int_cast Real.sign_intCast
-/
#print Real.sign_neg /-
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -89,9 +89,9 @@ theorem sign_eq_zero_iff {r : ℝ} : sign r = 0 ↔ r = 0 :=
by
refine' ⟨fun h => _, fun h => h.symm ▸ sign_zero⟩
obtain hn | rfl | hp := lt_trichotomy r (0 : ℝ)
- · rw [sign_of_neg hn, neg_eq_zero] at h ; exact (one_ne_zero h).elim
+ · rw [sign_of_neg hn, neg_eq_zero] at h; exact (one_ne_zero h).elim
· rfl
- · rw [sign_of_pos hp] at h ; exact (one_ne_zero h).elim
+ · rw [sign_of_pos hp] at h; exact (one_ne_zero h).elim
#align real.sign_eq_zero_iff Real.sign_eq_zero_iff
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,7 +3,7 @@ Copyright (c) 2021 Kexing Ying. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kexing Ying, Eric Wieser
-/
-import Mathbin.Data.Real.Basic
+import Data.Real.Basic
#align_import data.real.sign from "leanprover-community/mathlib"@"cc70d9141824ea8982d1562ce009952f2c3ece30"
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,14 +2,11 @@
Copyright (c) 2021 Kexing Ying. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kexing Ying, Eric Wieser
-
-! This file was ported from Lean 3 source module data.real.sign
-! leanprover-community/mathlib commit cc70d9141824ea8982d1562ce009952f2c3ece30
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathbin.Data.Real.Basic
+#align_import data.real.sign from "leanprover-community/mathlib"@"cc70d9141824ea8982d1562ce009952f2c3ece30"
+
/-!
# Real sign function
mathlib commit https://github.com/leanprover-community/mathlib/commit/9fb8964792b4237dac6200193a0d533f1b3f7423
@@ -41,22 +41,31 @@ noncomputable def sign (r : ℝ) : ℝ :=
#align real.sign Real.sign
-/
+#print Real.sign_of_neg /-
theorem sign_of_neg {r : ℝ} (hr : r < 0) : sign r = -1 := by rw [SignType.sign, if_pos hr]
#align real.sign_of_neg Real.sign_of_neg
+-/
+#print Real.sign_of_pos /-
theorem sign_of_pos {r : ℝ} (hr : 0 < r) : sign r = 1 := by
rw [SignType.sign, if_pos hr, if_neg hr.not_lt]
#align real.sign_of_pos Real.sign_of_pos
+-/
+#print Real.sign_zero /-
@[simp]
theorem sign_zero : sign 0 = 0 := by rw [SignType.sign, if_neg (lt_irrefl _), if_neg (lt_irrefl _)]
#align real.sign_zero Real.sign_zero
+-/
+#print Real.sign_one /-
@[simp]
theorem sign_one : sign 1 = 1 :=
sign_of_pos <| by norm_num
#align real.sign_one Real.sign_one
+-/
+#print Real.sign_apply_eq /-
theorem sign_apply_eq (r : ℝ) : sign r = -1 ∨ sign r = 0 ∨ sign r = 1 :=
by
obtain hn | rfl | hp := lt_trichotomy r (0 : ℝ)
@@ -64,7 +73,9 @@ theorem sign_apply_eq (r : ℝ) : sign r = -1 ∨ sign r = 0 ∨ sign r = 1 :=
· exact Or.inr <| Or.inl <| sign_zero
· exact Or.inr <| Or.inr <| sign_of_pos hp
#align real.sign_apply_eq Real.sign_apply_eq
+-/
+#print Real.sign_apply_eq_of_ne_zero /-
/-- This lemma is useful for working with `ℝˣ` -/
theorem sign_apply_eq_of_ne_zero (r : ℝ) (h : r ≠ 0) : sign r = -1 ∨ sign r = 1 :=
by
@@ -73,7 +84,9 @@ theorem sign_apply_eq_of_ne_zero (r : ℝ) (h : r ≠ 0) : sign r = -1 ∨ sign
· exact (h rfl).elim
· exact Or.inr <| sign_of_pos hp
#align real.sign_apply_eq_of_ne_zero Real.sign_apply_eq_of_ne_zero
+-/
+#print Real.sign_eq_zero_iff /-
@[simp]
theorem sign_eq_zero_iff {r : ℝ} : sign r = 0 ↔ r = 0 :=
by
@@ -83,7 +96,9 @@ theorem sign_eq_zero_iff {r : ℝ} : sign r = 0 ↔ r = 0 :=
· rfl
· rw [sign_of_pos hp] at h ; exact (one_ne_zero h).elim
#align real.sign_eq_zero_iff Real.sign_eq_zero_iff
+-/
+#print Real.sign_int_cast /-
theorem sign_int_cast (z : ℤ) : sign (z : ℝ) = ↑(Int.sign z) :=
by
obtain hn | rfl | hp := lt_trichotomy z (0 : ℤ)
@@ -93,7 +108,9 @@ theorem sign_int_cast (z : ℤ) : sign (z : ℝ) = ↑(Int.sign z) :=
· rw [Int.cast_zero, sign_zero, Int.sign_zero, Int.cast_zero]
· rw [sign_of_pos (int.cast_pos.mpr hp), Int.sign_eq_one_of_pos hp, Int.cast_one]
#align real.sign_int_cast Real.sign_int_cast
+-/
+#print Real.sign_neg /-
theorem sign_neg {r : ℝ} : sign (-r) = -sign r :=
by
obtain hn | rfl | hp := lt_trichotomy r (0 : ℝ)
@@ -101,7 +118,9 @@ theorem sign_neg {r : ℝ} : sign (-r) = -sign r :=
· rw [sign_zero, neg_zero, sign_zero]
· rw [sign_of_pos hp, sign_of_neg (neg_lt_zero.mpr hp)]
#align real.sign_neg Real.sign_neg
+-/
+#print Real.sign_mul_nonneg /-
theorem sign_mul_nonneg (r : ℝ) : 0 ≤ sign r * r :=
by
obtain hn | rfl | hp := lt_trichotomy r (0 : ℝ)
@@ -111,14 +130,18 @@ theorem sign_mul_nonneg (r : ℝ) : 0 ≤ sign r * r :=
· rw [sign_of_pos hp, one_mul]
exact hp.le
#align real.sign_mul_nonneg Real.sign_mul_nonneg
+-/
+#print Real.sign_mul_pos_of_ne_zero /-
theorem sign_mul_pos_of_ne_zero (r : ℝ) (hr : r ≠ 0) : 0 < sign r * r :=
by
refine' lt_of_le_of_ne (sign_mul_nonneg r) fun h => hr _
have hs0 := (zero_eq_mul.mp h).resolve_right hr
exact sign_eq_zero_iff.mp hs0
#align real.sign_mul_pos_of_ne_zero Real.sign_mul_pos_of_ne_zero
+-/
+#print Real.inv_sign /-
@[simp]
theorem inv_sign (r : ℝ) : (sign r)⁻¹ = sign r :=
by
@@ -127,7 +150,9 @@ theorem inv_sign (r : ℝ) : (sign r)⁻¹ = sign r :=
· rw [hz]; exact inv_zero
· rw [hp]; exact inv_one
#align real.inv_sign Real.inv_sign
+-/
+#print Real.sign_inv /-
@[simp]
theorem sign_inv (r : ℝ) : sign r⁻¹ = sign r :=
by
@@ -136,6 +161,7 @@ theorem sign_inv (r : ℝ) : sign r⁻¹ = sign r :=
· rw [sign_zero, inv_zero, sign_zero]
· rw [sign_of_pos hp, sign_of_pos (inv_pos.mpr hp)]
#align real.sign_inv Real.sign_inv
+-/
end Real
mathlib commit https://github.com/leanprover-community/mathlib/commit/cca40788df1b8755d5baf17ab2f27dacc2e17acb
@@ -79,9 +79,9 @@ theorem sign_eq_zero_iff {r : ℝ} : sign r = 0 ↔ r = 0 :=
by
refine' ⟨fun h => _, fun h => h.symm ▸ sign_zero⟩
obtain hn | rfl | hp := lt_trichotomy r (0 : ℝ)
- · rw [sign_of_neg hn, neg_eq_zero] at h; exact (one_ne_zero h).elim
+ · rw [sign_of_neg hn, neg_eq_zero] at h ; exact (one_ne_zero h).elim
· rfl
- · rw [sign_of_pos hp] at h; exact (one_ne_zero h).elim
+ · rw [sign_of_pos hp] at h ; exact (one_ne_zero h).elim
#align real.sign_eq_zero_iff Real.sign_eq_zero_iff
theorem sign_int_cast (z : ℤ) : sign (z : ℝ) = ↑(Int.sign z) :=
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -41,52 +41,22 @@ noncomputable def sign (r : ℝ) : ℝ :=
#align real.sign Real.sign
-/
-/- warning: real.sign_of_neg -> Real.sign_of_neg is a dubious translation:
-lean 3 declaration is
- forall {r : Real}, (LT.lt.{0} Real Real.hasLt r (OfNat.ofNat.{0} Real 0 (OfNat.mk.{0} Real 0 (Zero.zero.{0} Real Real.hasZero)))) -> (Eq.{1} Real (Real.sign r) (Neg.neg.{0} Real Real.hasNeg (OfNat.ofNat.{0} Real 1 (OfNat.mk.{0} Real 1 (One.one.{0} Real Real.hasOne)))))
-but is expected to have type
- forall {r : Real}, (LT.lt.{0} Real Real.instLTReal r (OfNat.ofNat.{0} Real 0 (Zero.toOfNat0.{0} Real Real.instZeroReal))) -> (Eq.{1} Real (Real.sign r) (Neg.neg.{0} Real Real.instNegReal (OfNat.ofNat.{0} Real 1 (One.toOfNat1.{0} Real Real.instOneReal))))
-Case conversion may be inaccurate. Consider using '#align real.sign_of_neg Real.sign_of_negₓ'. -/
theorem sign_of_neg {r : ℝ} (hr : r < 0) : sign r = -1 := by rw [SignType.sign, if_pos hr]
#align real.sign_of_neg Real.sign_of_neg
-/- warning: real.sign_of_pos -> Real.sign_of_pos is a dubious translation:
-lean 3 declaration is
- forall {r : Real}, (LT.lt.{0} Real Real.hasLt (OfNat.ofNat.{0} Real 0 (OfNat.mk.{0} Real 0 (Zero.zero.{0} Real Real.hasZero))) r) -> (Eq.{1} Real (Real.sign r) (OfNat.ofNat.{0} Real 1 (OfNat.mk.{0} Real 1 (One.one.{0} Real Real.hasOne))))
-but is expected to have type
- forall {r : Real}, (LT.lt.{0} Real Real.instLTReal (OfNat.ofNat.{0} Real 0 (Zero.toOfNat0.{0} Real Real.instZeroReal)) r) -> (Eq.{1} Real (Real.sign r) (OfNat.ofNat.{0} Real 1 (One.toOfNat1.{0} Real Real.instOneReal)))
-Case conversion may be inaccurate. Consider using '#align real.sign_of_pos Real.sign_of_posₓ'. -/
theorem sign_of_pos {r : ℝ} (hr : 0 < r) : sign r = 1 := by
rw [SignType.sign, if_pos hr, if_neg hr.not_lt]
#align real.sign_of_pos Real.sign_of_pos
-/- warning: real.sign_zero -> Real.sign_zero is a dubious translation:
-lean 3 declaration is
- Eq.{1} Real (Real.sign (OfNat.ofNat.{0} Real 0 (OfNat.mk.{0} Real 0 (Zero.zero.{0} Real Real.hasZero)))) (OfNat.ofNat.{0} Real 0 (OfNat.mk.{0} Real 0 (Zero.zero.{0} Real Real.hasZero)))
-but is expected to have type
- Eq.{1} Real (Real.sign (OfNat.ofNat.{0} Real 0 (Zero.toOfNat0.{0} Real Real.instZeroReal))) (OfNat.ofNat.{0} Real 0 (Zero.toOfNat0.{0} Real Real.instZeroReal))
-Case conversion may be inaccurate. Consider using '#align real.sign_zero Real.sign_zeroₓ'. -/
@[simp]
theorem sign_zero : sign 0 = 0 := by rw [SignType.sign, if_neg (lt_irrefl _), if_neg (lt_irrefl _)]
#align real.sign_zero Real.sign_zero
-/- warning: real.sign_one -> Real.sign_one is a dubious translation:
-lean 3 declaration is
- Eq.{1} Real (Real.sign (OfNat.ofNat.{0} Real 1 (OfNat.mk.{0} Real 1 (One.one.{0} Real Real.hasOne)))) (OfNat.ofNat.{0} Real 1 (OfNat.mk.{0} Real 1 (One.one.{0} Real Real.hasOne)))
-but is expected to have type
- Eq.{1} Real (Real.sign (OfNat.ofNat.{0} Real 1 (One.toOfNat1.{0} Real Real.instOneReal))) (OfNat.ofNat.{0} Real 1 (One.toOfNat1.{0} Real Real.instOneReal))
-Case conversion may be inaccurate. Consider using '#align real.sign_one Real.sign_oneₓ'. -/
@[simp]
theorem sign_one : sign 1 = 1 :=
sign_of_pos <| by norm_num
#align real.sign_one Real.sign_one
-/- warning: real.sign_apply_eq -> Real.sign_apply_eq is a dubious translation:
-lean 3 declaration is
- forall (r : Real), Or (Eq.{1} Real (Real.sign r) (Neg.neg.{0} Real Real.hasNeg (OfNat.ofNat.{0} Real 1 (OfNat.mk.{0} Real 1 (One.one.{0} Real Real.hasOne))))) (Or (Eq.{1} Real (Real.sign r) (OfNat.ofNat.{0} Real 0 (OfNat.mk.{0} Real 0 (Zero.zero.{0} Real Real.hasZero)))) (Eq.{1} Real (Real.sign r) (OfNat.ofNat.{0} Real 1 (OfNat.mk.{0} Real 1 (One.one.{0} Real Real.hasOne)))))
-but is expected to have type
- forall (r : Real), Or (Eq.{1} Real (Real.sign r) (Neg.neg.{0} Real Real.instNegReal (OfNat.ofNat.{0} Real 1 (One.toOfNat1.{0} Real Real.instOneReal)))) (Or (Eq.{1} Real (Real.sign r) (OfNat.ofNat.{0} Real 0 (Zero.toOfNat0.{0} Real Real.instZeroReal))) (Eq.{1} Real (Real.sign r) (OfNat.ofNat.{0} Real 1 (One.toOfNat1.{0} Real Real.instOneReal))))
-Case conversion may be inaccurate. Consider using '#align real.sign_apply_eq Real.sign_apply_eqₓ'. -/
theorem sign_apply_eq (r : ℝ) : sign r = -1 ∨ sign r = 0 ∨ sign r = 1 :=
by
obtain hn | rfl | hp := lt_trichotomy r (0 : ℝ)
@@ -95,12 +65,6 @@ theorem sign_apply_eq (r : ℝ) : sign r = -1 ∨ sign r = 0 ∨ sign r = 1 :=
· exact Or.inr <| Or.inr <| sign_of_pos hp
#align real.sign_apply_eq Real.sign_apply_eq
-/- warning: real.sign_apply_eq_of_ne_zero -> Real.sign_apply_eq_of_ne_zero is a dubious translation:
-lean 3 declaration is
- forall (r : Real), (Ne.{1} Real r (OfNat.ofNat.{0} Real 0 (OfNat.mk.{0} Real 0 (Zero.zero.{0} Real Real.hasZero)))) -> (Or (Eq.{1} Real (Real.sign r) (Neg.neg.{0} Real Real.hasNeg (OfNat.ofNat.{0} Real 1 (OfNat.mk.{0} Real 1 (One.one.{0} Real Real.hasOne))))) (Eq.{1} Real (Real.sign r) (OfNat.ofNat.{0} Real 1 (OfNat.mk.{0} Real 1 (One.one.{0} Real Real.hasOne)))))
-but is expected to have type
- forall (r : Real), (Ne.{1} Real r (OfNat.ofNat.{0} Real 0 (Zero.toOfNat0.{0} Real Real.instZeroReal))) -> (Or (Eq.{1} Real (Real.sign r) (Neg.neg.{0} Real Real.instNegReal (OfNat.ofNat.{0} Real 1 (One.toOfNat1.{0} Real Real.instOneReal)))) (Eq.{1} Real (Real.sign r) (OfNat.ofNat.{0} Real 1 (One.toOfNat1.{0} Real Real.instOneReal))))
-Case conversion may be inaccurate. Consider using '#align real.sign_apply_eq_of_ne_zero Real.sign_apply_eq_of_ne_zeroₓ'. -/
/-- This lemma is useful for working with `ℝˣ` -/
theorem sign_apply_eq_of_ne_zero (r : ℝ) (h : r ≠ 0) : sign r = -1 ∨ sign r = 1 :=
by
@@ -110,12 +74,6 @@ theorem sign_apply_eq_of_ne_zero (r : ℝ) (h : r ≠ 0) : sign r = -1 ∨ sign
· exact Or.inr <| sign_of_pos hp
#align real.sign_apply_eq_of_ne_zero Real.sign_apply_eq_of_ne_zero
-/- warning: real.sign_eq_zero_iff -> Real.sign_eq_zero_iff is a dubious translation:
-lean 3 declaration is
- forall {r : Real}, Iff (Eq.{1} Real (Real.sign r) (OfNat.ofNat.{0} Real 0 (OfNat.mk.{0} Real 0 (Zero.zero.{0} Real Real.hasZero)))) (Eq.{1} Real r (OfNat.ofNat.{0} Real 0 (OfNat.mk.{0} Real 0 (Zero.zero.{0} Real Real.hasZero))))
-but is expected to have type
- forall {r : Real}, Iff (Eq.{1} Real (Real.sign r) (OfNat.ofNat.{0} Real 0 (Zero.toOfNat0.{0} Real Real.instZeroReal))) (Eq.{1} Real r (OfNat.ofNat.{0} Real 0 (Zero.toOfNat0.{0} Real Real.instZeroReal)))
-Case conversion may be inaccurate. Consider using '#align real.sign_eq_zero_iff Real.sign_eq_zero_iffₓ'. -/
@[simp]
theorem sign_eq_zero_iff {r : ℝ} : sign r = 0 ↔ r = 0 :=
by
@@ -126,12 +84,6 @@ theorem sign_eq_zero_iff {r : ℝ} : sign r = 0 ↔ r = 0 :=
· rw [sign_of_pos hp] at h; exact (one_ne_zero h).elim
#align real.sign_eq_zero_iff Real.sign_eq_zero_iff
-/- warning: real.sign_int_cast -> Real.sign_int_cast is a dubious translation:
-lean 3 declaration is
- forall (z : Int), Eq.{1} Real (Real.sign ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Int Real (HasLiftT.mk.{1, 1} Int Real (CoeTCₓ.coe.{1, 1} Int Real (Int.castCoe.{0} Real Real.hasIntCast))) z)) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Int Real (HasLiftT.mk.{1, 1} Int Real (CoeTCₓ.coe.{1, 1} Int Real (Int.castCoe.{0} Real Real.hasIntCast))) (Int.sign z))
-but is expected to have type
- forall (z : Int), Eq.{1} Real (Real.sign (Int.cast.{0} Real Real.intCast z)) (Int.cast.{0} Real Real.intCast (Int.sign z))
-Case conversion may be inaccurate. Consider using '#align real.sign_int_cast Real.sign_int_castₓ'. -/
theorem sign_int_cast (z : ℤ) : sign (z : ℝ) = ↑(Int.sign z) :=
by
obtain hn | rfl | hp := lt_trichotomy z (0 : ℤ)
@@ -142,12 +94,6 @@ theorem sign_int_cast (z : ℤ) : sign (z : ℝ) = ↑(Int.sign z) :=
· rw [sign_of_pos (int.cast_pos.mpr hp), Int.sign_eq_one_of_pos hp, Int.cast_one]
#align real.sign_int_cast Real.sign_int_cast
-/- warning: real.sign_neg -> Real.sign_neg is a dubious translation:
-lean 3 declaration is
- forall {r : Real}, Eq.{1} Real (Real.sign (Neg.neg.{0} Real Real.hasNeg r)) (Neg.neg.{0} Real Real.hasNeg (Real.sign r))
-but is expected to have type
- forall {r : Real}, Eq.{1} Real (Real.sign (Neg.neg.{0} Real Real.instNegReal r)) (Neg.neg.{0} Real Real.instNegReal (Real.sign r))
-Case conversion may be inaccurate. Consider using '#align real.sign_neg Real.sign_negₓ'. -/
theorem sign_neg {r : ℝ} : sign (-r) = -sign r :=
by
obtain hn | rfl | hp := lt_trichotomy r (0 : ℝ)
@@ -156,12 +102,6 @@ theorem sign_neg {r : ℝ} : sign (-r) = -sign r :=
· rw [sign_of_pos hp, sign_of_neg (neg_lt_zero.mpr hp)]
#align real.sign_neg Real.sign_neg
-/- warning: real.sign_mul_nonneg -> Real.sign_mul_nonneg is a dubious translation:
-lean 3 declaration is
- forall (r : Real), LE.le.{0} Real Real.hasLe (OfNat.ofNat.{0} Real 0 (OfNat.mk.{0} Real 0 (Zero.zero.{0} Real Real.hasZero))) (HMul.hMul.{0, 0, 0} Real Real Real (instHMul.{0} Real Real.hasMul) (Real.sign r) r)
-but is expected to have type
- forall (r : Real), LE.le.{0} Real Real.instLEReal (OfNat.ofNat.{0} Real 0 (Zero.toOfNat0.{0} Real Real.instZeroReal)) (HMul.hMul.{0, 0, 0} Real Real Real (instHMul.{0} Real Real.instMulReal) (Real.sign r) r)
-Case conversion may be inaccurate. Consider using '#align real.sign_mul_nonneg Real.sign_mul_nonnegₓ'. -/
theorem sign_mul_nonneg (r : ℝ) : 0 ≤ sign r * r :=
by
obtain hn | rfl | hp := lt_trichotomy r (0 : ℝ)
@@ -172,12 +112,6 @@ theorem sign_mul_nonneg (r : ℝ) : 0 ≤ sign r * r :=
exact hp.le
#align real.sign_mul_nonneg Real.sign_mul_nonneg
-/- warning: real.sign_mul_pos_of_ne_zero -> Real.sign_mul_pos_of_ne_zero is a dubious translation:
-lean 3 declaration is
- forall (r : Real), (Ne.{1} Real r (OfNat.ofNat.{0} Real 0 (OfNat.mk.{0} Real 0 (Zero.zero.{0} Real Real.hasZero)))) -> (LT.lt.{0} Real Real.hasLt (OfNat.ofNat.{0} Real 0 (OfNat.mk.{0} Real 0 (Zero.zero.{0} Real Real.hasZero))) (HMul.hMul.{0, 0, 0} Real Real Real (instHMul.{0} Real Real.hasMul) (Real.sign r) r))
-but is expected to have type
- forall (r : Real), (Ne.{1} Real r (OfNat.ofNat.{0} Real 0 (Zero.toOfNat0.{0} Real Real.instZeroReal))) -> (LT.lt.{0} Real Real.instLTReal (OfNat.ofNat.{0} Real 0 (Zero.toOfNat0.{0} Real Real.instZeroReal)) (HMul.hMul.{0, 0, 0} Real Real Real (instHMul.{0} Real Real.instMulReal) (Real.sign r) r))
-Case conversion may be inaccurate. Consider using '#align real.sign_mul_pos_of_ne_zero Real.sign_mul_pos_of_ne_zeroₓ'. -/
theorem sign_mul_pos_of_ne_zero (r : ℝ) (hr : r ≠ 0) : 0 < sign r * r :=
by
refine' lt_of_le_of_ne (sign_mul_nonneg r) fun h => hr _
@@ -185,12 +119,6 @@ theorem sign_mul_pos_of_ne_zero (r : ℝ) (hr : r ≠ 0) : 0 < sign r * r :=
exact sign_eq_zero_iff.mp hs0
#align real.sign_mul_pos_of_ne_zero Real.sign_mul_pos_of_ne_zero
-/- warning: real.inv_sign -> Real.inv_sign is a dubious translation:
-lean 3 declaration is
- forall (r : Real), Eq.{1} Real (Inv.inv.{0} Real Real.hasInv (Real.sign r)) (Real.sign r)
-but is expected to have type
- forall (r : Real), Eq.{1} Real (Inv.inv.{0} Real Real.instInvReal (Real.sign r)) (Real.sign r)
-Case conversion may be inaccurate. Consider using '#align real.inv_sign Real.inv_signₓ'. -/
@[simp]
theorem inv_sign (r : ℝ) : (sign r)⁻¹ = sign r :=
by
@@ -200,12 +128,6 @@ theorem inv_sign (r : ℝ) : (sign r)⁻¹ = sign r :=
· rw [hp]; exact inv_one
#align real.inv_sign Real.inv_sign
-/- warning: real.sign_inv -> Real.sign_inv is a dubious translation:
-lean 3 declaration is
- forall (r : Real), Eq.{1} Real (Real.sign (Inv.inv.{0} Real Real.hasInv r)) (Real.sign r)
-but is expected to have type
- forall (r : Real), Eq.{1} Real (Real.sign (Inv.inv.{0} Real Real.instInvReal r)) (Real.sign r)
-Case conversion may be inaccurate. Consider using '#align real.sign_inv Real.sign_invₓ'. -/
@[simp]
theorem sign_inv (r : ℝ) : sign r⁻¹ = sign r :=
by
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -121,11 +121,9 @@ theorem sign_eq_zero_iff {r : ℝ} : sign r = 0 ↔ r = 0 :=
by
refine' ⟨fun h => _, fun h => h.symm ▸ sign_zero⟩
obtain hn | rfl | hp := lt_trichotomy r (0 : ℝ)
- · rw [sign_of_neg hn, neg_eq_zero] at h
- exact (one_ne_zero h).elim
+ · rw [sign_of_neg hn, neg_eq_zero] at h; exact (one_ne_zero h).elim
· rfl
- · rw [sign_of_pos hp] at h
- exact (one_ne_zero h).elim
+ · rw [sign_of_pos hp] at h; exact (one_ne_zero h).elim
#align real.sign_eq_zero_iff Real.sign_eq_zero_iff
/- warning: real.sign_int_cast -> Real.sign_int_cast is a dubious translation:
@@ -197,12 +195,9 @@ Case conversion may be inaccurate. Consider using '#align real.inv_sign Real.inv
theorem inv_sign (r : ℝ) : (sign r)⁻¹ = sign r :=
by
obtain hn | hz | hp := sign_apply_eq r
- · rw [hn]
- norm_num
- · rw [hz]
- exact inv_zero
- · rw [hp]
- exact inv_one
+ · rw [hn]; norm_num
+ · rw [hz]; exact inv_zero
+ · rw [hp]; exact inv_one
#align real.inv_sign Real.inv_sign
/- warning: real.sign_inv -> Real.sign_inv is a dubious translation:
mathlib commit https://github.com/leanprover-community/mathlib/commit/3180fab693e2cee3bff62675571264cb8778b212
@@ -169,7 +169,7 @@ theorem sign_mul_nonneg (r : ℝ) : 0 ≤ sign r * r :=
obtain hn | rfl | hp := lt_trichotomy r (0 : ℝ)
· rw [sign_of_neg hn]
exact mul_nonneg_of_nonpos_of_nonpos (by norm_num) hn.le
- · rw [mul_zero]
+ · rw [MulZeroClass.mul_zero]
· rw [sign_of_pos hp, one_mul]
exact hp.le
#align real.sign_mul_nonneg Real.sign_mul_nonneg
mathlib commit https://github.com/leanprover-community/mathlib/commit/bd9851ca476957ea4549eb19b40e7b5ade9428cc
nat_cast
/int_cast
/rat_cast
to natCast
/intCast
/ratCast
(#11486)
Now that I am defining NNRat.cast
, I want a definitive answer to this naming issue. Plenty of lemmas in mathlib already use natCast
/intCast
/ratCast
over nat_cast
/int_cast
/rat_cast
, and this matches with the general expectation that underscore-separated name parts correspond to a single declaration.
@@ -71,13 +71,13 @@ theorem sign_eq_zero_iff {r : ℝ} : sign r = 0 ↔ r = 0 := by
exact (one_ne_zero h).elim
#align real.sign_eq_zero_iff Real.sign_eq_zero_iff
-theorem sign_int_cast (z : ℤ) : sign (z : ℝ) = ↑(Int.sign z) := by
+theorem sign_intCast (z : ℤ) : sign (z : ℝ) = ↑(Int.sign z) := by
obtain hn | rfl | hp := lt_trichotomy z (0 : ℤ)
· rw [sign_of_neg (Int.cast_lt_zero.mpr hn), Int.sign_eq_neg_one_of_neg hn, Int.cast_neg,
Int.cast_one]
· rw [Int.cast_zero, sign_zero, Int.sign_zero, Int.cast_zero]
· rw [sign_of_pos (Int.cast_pos.mpr hp), Int.sign_eq_one_of_pos hp, Int.cast_one]
-#align real.sign_int_cast Real.sign_int_cast
+#align real.sign_int_cast Real.sign_intCast
theorem sign_neg {r : ℝ} : sign (-r) = -sign r := by
obtain hn | rfl | hp := lt_trichotomy r (0 : ℝ)
@@ -2,14 +2,11 @@
Copyright (c) 2021 Kexing Ying. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kexing Ying, Eric Wieser
-
-! This file was ported from Lean 3 source module data.real.sign
-! leanprover-community/mathlib commit 9003f28797c0664a49e4179487267c494477d853
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.Data.Real.Basic
+#align_import data.real.sign from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
+
/-!
# Real sign function
@@ -59,11 +59,8 @@ theorem sign_apply_eq (r : ℝ) : sign r = -1 ∨ sign r = 0 ∨ sign r = 1 := b
#align real.sign_apply_eq Real.sign_apply_eq
/-- This lemma is useful for working with `ℝˣ` -/
-theorem sign_apply_eq_of_ne_zero (r : ℝ) (h : r ≠ 0) : sign r = -1 ∨ sign r = 1 := by
- obtain hn | rfl | hp := lt_trichotomy r (0 : ℝ)
- · exact Or.inl <| sign_of_neg hn
- · exact (h rfl).elim
- · exact Or.inr <| sign_of_pos hp
+theorem sign_apply_eq_of_ne_zero (r : ℝ) (h : r ≠ 0) : sign r = -1 ∨ sign r = 1 :=
+ h.lt_or_lt.imp sign_of_neg sign_of_pos
#align real.sign_apply_eq_of_ne_zero Real.sign_apply_eq_of_ne_zero
@[simp]
The unported dependencies are