Documentation

Mathlib.Data.Sign.Defs

Sign type #

This file defines the type of signs $\{-1, 0, 1\}$ and its basic arithmetic instances.

inductive SignType :

The type of signs.

Instances For
    @[simp]
    @[simp]
    inductive SignType.LE :

    The less-than-or-equal relation on signs.

    Instances For
      Equations

        SignType is equivalent to Fin 3.

        Equations
          Instances For
            theorem SignType.nonneg_iff {a : SignType} :
            0 a a = 0 a = 1
            theorem SignType.nonpos_iff {a : SignType} :
            a 0 a = -1 a = 0
            theorem SignType.lt_one_iff {a : SignType} :
            a < 1 a 0
            @[simp]
            theorem SignType.neg_iff {a : SignType} :
            a < 0 a = -1
            @[simp]
            theorem SignType.le_neg_one_iff {a : SignType} :
            a -1 a = -1
            @[simp]
            theorem SignType.pos_iff {a : SignType} :
            0 < a a = 1
            @[simp]
            theorem SignType.one_le_iff {a : SignType} :
            1 a a = 1
            @[simp]
            theorem SignType.neg_one_le (a : SignType) :
            -1 a
            @[simp]
            theorem SignType.le_one (a : SignType) :
            a 1
            @[simp]
            @[simp]
            theorem SignType.not_one_lt (a : SignType) :
            ¬1 < a
            @[simp]
            theorem SignType.self_eq_neg_iff {a : SignType} :
            a = -a a = 0
            @[simp]
            theorem SignType.neg_eq_self_iff {a : SignType} :
            -a = a a = 0
            @[simp]
            theorem SignType.neg_eq_zero_iff {a : SignType} :
            -a = 0 a = 0
            @[simp]
            def SignType.cast {α : Type u_1} [Zero α] [One α] [Neg α] :
            SignTypeα

            Turn a SignType into zero, one, or minus one. This is a coercion instance.

            Equations
              Instances For
                instance SignType.instCoeTail {α : Type u_1} [Zero α] [One α] [Neg α] :

                This is a CoeTail since the type on the right (trivially) determines the type on the left.

                outParam-wise it could be a Coe, but we don't want to try applying this instance for a coercion to any α.

                Equations
                  theorem SignType.map_cast' {α : Type u_1} [Zero α] [One α] [Neg α] {β : Type u_2} [One β] [Neg β] [Zero β] (f : αβ) (h₁ : f 1 = 1) (h₂ : f 0 = 0) (h₃ : f (-1) = -1) (s : SignType) :
                  f s = s

                  Casting out of SignType respects composition with functions preserving 0, 1, -1.

                  theorem SignType.map_cast {α : Type u_2} {β : Type u_3} {F : Type u_4} [AddGroupWithOne α] [One β] [SubtractionMonoid β] [FunLike F α β] [AddMonoidHomClass F α β] [OneHomClass F α β] (f : F) (s : SignType) :
                  f s = s

                  Casting out of SignType respects composition with suitable bundled homomorphism types.

                  @[simp]
                  theorem SignType.coe_zero {α : Type u_1} [Zero α] [One α] [Neg α] :
                  0 = 0
                  @[simp]
                  theorem SignType.coe_one {α : Type u_1} [Zero α] [One α] [Neg α] :
                  1 = 1
                  @[simp]
                  theorem SignType.coe_neg_one {α : Type u_1} [Zero α] [One α] [Neg α] :
                  (-1) = -1
                  @[simp]
                  theorem SignType.coe_neg {α : Type u_2} [One α] [SubtractionMonoid α] (s : SignType) :
                  ↑(-s) = -s
                  def SignType.sign {α : Type u_1} [Zero α] [Preorder α] [DecidableLT α] :

                  The sign of an element is 1 if it's positive, -1 if negative, 0 otherwise.

                  Equations
                    Instances For
                      theorem sign_apply {α : Type u_1} [Zero α] [Preorder α] [DecidableLT α] {a : α} :
                      SignType.sign a = if 0 < a then 1 else if a < 0 then -1 else 0
                      @[simp]
                      theorem sign_zero {α : Type u_1} [Zero α] [Preorder α] [DecidableLT α] :
                      @[simp]
                      theorem sign_pos {α : Type u_1} [Zero α] [Preorder α] [DecidableLT α] {a : α} (ha : 0 < a) :
                      @[simp]
                      theorem sign_neg {α : Type u_1} [Zero α] [Preorder α] [DecidableLT α] {a : α} (ha : a < 0) :
                      theorem sign_eq_one_iff {α : Type u_1} [Zero α] [Preorder α] [DecidableLT α] {a : α} :
                      theorem sign_eq_neg_one_iff {α : Type u_1} [Zero α] [Preorder α] [DecidableLT α] {a : α} :
                      SignType.sign a = -1 a < 0
                      theorem StrictMono.sign_comp {α : Type u_1} [Zero α] [LinearOrder α] {β : Type u_2} {F : Type u_3} [Zero β] [Preorder β] [DecidableLT β] [FunLike F α β] [ZeroHomClass F α β] {f : F} (hf : StrictMono f) (a : α) :

                      SignType.sign respects strictly monotone zero-preserving maps.

                      @[simp]
                      theorem sign_eq_zero_iff {α : Type u_1} [Zero α] [LinearOrder α] {a : α} :
                      theorem sign_ne_zero {α : Type u_1} [Zero α] [LinearOrder α] {a : α} :
                      @[simp]
                      theorem sign_nonneg_iff {α : Type u_1} [Zero α] [LinearOrder α] {a : α} :
                      @[simp]
                      theorem sign_nonpos_iff {α : Type u_1} [Zero α] [LinearOrder α] {a : α} :