# Documentation

Mathlib.Data.Real.Sign

# Real sign function #

This file introduces and contains some results about Real.sign which maps negative real numbers to -1, positive real numbers to 1, and 0 to 0.

## Main definitions #

• Real.sign r is $\begin{cases} -1 & \text{if } r < 0, \ ~~, 0 & \text{if } r = 0, \ ~~, 1 & \text{if } r > 0. \end{cases}$

## Tags #

sign function

noncomputable def Real.sign (r : ) :

The sign function that maps negative real numbers to -1, positive numbers to 1, and 0 otherwise.

Equations
• = if r < 0 then -1 else if 0 < r then 1 else 0
theorem Real.sign_of_neg {r : } (hr : r < 0) :
= -1
theorem Real.sign_of_pos {r : } (hr : 0 < r) :
= 1
@[simp]
theorem Real.sign_zero :
= 0
@[simp]
theorem Real.sign_one :
= 1
theorem Real.sign_apply_eq (r : ) :
= -1 = 0 = 1
theorem Real.sign_apply_eq_of_ne_zero (r : ) (h : r 0) :
= -1 = 1

This lemma is useful for working with ℝˣ

@[simp]
theorem Real.sign_eq_zero_iff {r : } :
= 0 r = 0
theorem Real.sign_int_cast (z : ) :
= ↑()
theorem Real.sign_mul_pos_of_ne_zero (r : ) (hr : r 0) :
0 < * r
@[simp]
theorem Real.inv_sign (r : ) :
()⁻¹ =
@[simp]
theorem Real.sign_inv (r : ) :