Sign type #
This file defines the type of signs $\{-1, 0, 1\}$ and its basic arithmetic instances.
@[instance_reducible]
@[instance_reducible]
Equations
- instInhabitedSignType = { default := instInhabitedSignType.default }
@[instance_reducible]
Equations
- instFintypeSignType = { elems := { val := ↑SignType.enumList, nodup := SignType.enumList_nodup }, complete := instFintypeSignType._proof_1 }
@[instance_reducible]
Equations
- SignType.instZero = { zero := SignType.zero }
@[instance_reducible]
Equations
- SignType.instOne = { one := SignType.pos }
@[instance_reducible]
Equations
- SignType.instNeg = { neg := fun (s : SignType) => match s with | SignType.neg => SignType.pos | SignType.zero => SignType.zero | SignType.pos => SignType.neg }
@[instance_reducible]
Equations
- SignType.instMul = { mul := fun (x y : SignType) => match x with | SignType.neg => -y | SignType.zero => SignType.zero | SignType.pos => y }
The less-than-or-equal relation on signs.
- of_neg (a : SignType) : neg.LE a
- zero : SignType.zero.LE SignType.zero
- of_pos (a : SignType) : a.LE pos
Instances For
@[instance_reducible]
Equations
- SignType.instLE = { le := SignType.LE }
@[instance_reducible]
Equations
- One or more equations did not get rendered due to their size.
@[instance_reducible]
We can define a Field instance on SignType, but it's not mathematically sensible,
so we only define the CommGroupWithZero.
Equations
- One or more equations did not get rendered due to their size.
@[instance_reducible]
Equations
- One or more equations did not get rendered due to their size.
@[instance_reducible]
Equations
- SignType.instBoundedOrder = { top := 1, le_top := SignType.LE.of_pos, bot := -1, bot_le := SignType.instBoundedOrder._proof_1 }
@[instance_reducible]
Equations
- One or more equations did not get rendered due to their size.
Turn a SignType into zero, one, or minus one. This is a coercion instance.
Equations
- ↑SignType.zero = 0
- ↑SignType.pos = 1
- ↑SignType.neg = -1
Instances For
@[instance_reducible]
This can't be a CoeTail or Coe instance because we don't want it to fire when SignType isn't
involved in the coercion (or CoeHead or CoeOut because of outParams). The only other
user-exposed option is CoeDep then, which allows us to match on both given and expected type.
Equations
- s.instCoeDep = { coe := ↑s }
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) :
Casting out of SignType respects composition with suitable bundled homomorphism types.
@[simp]
@[simp]
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]
@[simp]
@[simp]
theorem sign_eq_sign_or_eq_neg {α : Type u_1} [Zero α] [LinearOrder α] {a b : α} (ha : a ≠ 0) (hb : b ≠ 0) :
theorem sign_one {α : Type u_1} [Semiring α] [PartialOrder α] [IsOrderedRing α] [DecidableLT α] [Nontrivial α] :
theorem Left.sign_neg {α : Type u_1} [AddGroup α] [Preorder α] [DecidableLT α] [AddLeftStrictMono α] (a : α) :
theorem Right.sign_neg {α : Type u_1} [AddGroup α] [Preorder α] [DecidableLT α] [AddRightStrictMono α] (a : α) :