File: Mathlib/Algebra/Ring/Defs.lean

full_name: Distrib
code: /-- A typeclass stating that multiplication is left and right distributive
over addition. -/
class Distrib (R : Type*) extends Mul R, Add R where
  /-- Multiplication is left distributive over addition -/
  protected left_distrib : ∀ a b c : R, a * (b + c) = a * b + a * c
  /-- Multiplication is right distributive over addition -/
  protected right_distrib : ∀ a b c : R, (a + b) * c = a * c + b * c
goal: Type u_1

full_name: Distrib.right_distrib
code: /-- A typeclass stating that multiplication is left and right distributive
over addition. -/
class Distrib (R : Type*) extends Mul R, Add R where
  /-- Multiplication is left distributive over addition -/
  protected left_distrib : ∀ a b c : R, a * (b + c) = a * b + a * c
  /-- Multiplication is right distributive over addition -/
  protected right_distrib : ∀ a b c : R, (a + b) * c = a * c + b * c
goal: (a + b) * c = a * c + b * c

full_name: Distrib.left_distrib
code: /-- A typeclass stating that multiplication is left and right distributive
over addition. -/
class Distrib (R : Type*) extends Mul R, Add R where
  /-- Multiplication is left distributive over addition -/
  protected left_distrib : ∀ a b c : R, a * (b + c) = a * b + a * c
  /-- Multiplication is right distributive over addition -/
  protected right_distrib : ∀ a b c : R, (a + b) * c = a * c + b * c
goal: a * (b + c) = a * b + a * c

full_name: LeftDistribClass.left_distrib
code: /-- A typeclass stating that multiplication is left distributive over addition. -/
class LeftDistribClass (R : Type*) [Mul R] [Add R] : Prop where
  /-- Multiplication is left distributive over addition -/
  protected left_distrib : ∀ a b c : R, a * (b + c) = a * b + a * c
goal: a * (b + c) = a * b + a * c

full_name: LeftDistribClass
code: /-- A typeclass stating that multiplication is left distributive over addition. -/
class LeftDistribClass (R : Type*) [Mul R] [Add R] : Prop where
  /-- Multiplication is left distributive over addition -/
  protected left_distrib : ∀ a b c : R, a * (b + c) = a * b + a * c
goal: Prop

full_name: RightDistribClass
code: /-- A typeclass stating that multiplication is right distributive over addition. -/
class RightDistribClass (R : Type*) [Mul R] [Add R] : Prop where
  /-- Multiplication is right distributive over addition -/
  protected right_distrib : ∀ a b c : R, (a + b) * c = a * c + b * c
goal: Prop

full_name: RightDistribClass.right_distrib
code: /-- A typeclass stating that multiplication is right distributive over addition. -/
class RightDistribClass (R : Type*) [Mul R] [Add R] : Prop where
  /-- Multiplication is right distributive over addition -/
  protected right_distrib : ∀ a b c : R, (a + b) * c = a * c + b * c
goal: (a + b) * c = a * c + b * c

full_name: Distrib.leftDistribClass
code: instance (priority := 100) Distrib.leftDistribClass (R : Type*) [Distrib R] : LeftDistribClass R 
goal: LeftDistribClass R

full_name: Distrib.rightDistribClass
code: instance (priority := 100) Distrib.rightDistribClass (R : Type*) [Distrib R] :
    RightDistribClass R 
goal: RightDistribClass R

full_name: left_distrib
code: theorem left_distrib [Mul R] [Add R] [LeftDistribClass R] (a b c : R) :
    a * (b + c) = a * b + a * c 
goal: a * (b + c) = a * b + a * c

full_name: right_distrib
code: theorem right_distrib [Mul R] [Add R] [RightDistribClass R] (a b c : R) :
    (a + b) * c = a * c + b * c 
goal: (a + b) * c = a * c + b * c

full_name: distrib_three_right
code: theorem distrib_three_right [Mul R] [Add R] [RightDistribClass R] (a b c d : R) :
    (a + b + c) * d = a * d + b * d + c * d 
goal: (a + b + c) * d = a * d + b * d + c * d

full_name: NonUnitalNonAssocSemiring
code: /-- A not-necessarily-unital, not-necessarily-associative semiring. -/
class NonUnitalNonAssocSemiring (α : Type u) extends AddCommMonoid α, Distrib α, MulZeroClass α
goal: Type u

full_name: NonUnitalSemiring
code: /-- An associative but not-necessarily unital semiring. -/
class NonUnitalSemiring (α : Type u) extends NonUnitalNonAssocSemiring α, SemigroupWithZero α
goal: Type u

full_name: NonAssocSemiring
code: /-- A unital but not-necessarily-associative semiring. -/
class NonAssocSemiring (α : Type u) extends NonUnitalNonAssocSemiring α, MulZeroOneClass α,
    AddCommMonoidWithOne α
goal: Type u

full_name: NonUnitalNonAssocRing
code: /-- A not-necessarily-unital, not-necessarily-associative ring. -/
class NonUnitalNonAssocRing (α : Type u) extends AddCommGroup α, NonUnitalNonAssocSemiring α
goal: Type u

full_name: NonUnitalRing
code: /-- An associative but not-necessarily unital ring. -/
class NonUnitalRing (α : Type*) extends NonUnitalNonAssocRing α, NonUnitalSemiring α
goal: Type u_1

full_name: NonAssocRing
code: /-- A unital but not-necessarily-associative ring. -/
class NonAssocRing (α : Type*) extends NonUnitalNonAssocRing α, NonAssocSemiring α,
    AddCommGroupWithOne α
goal: Type u_1

full_name: Semiring
code: /-- A `Semiring` is a type with addition, multiplication, a `0` and a `1` where addition is
commutative and associative, multiplication is associative and left and right distributive over
addition, and `0` and `1` are additive and multiplicative identities. -/
class Semiring (α : Type u) extends NonUnitalSemiring α, NonAssocSemiring α, MonoidWithZero α
goal: Type u

full_name: Ring
code: /-- A `Ring` is a `Semiring` with negation making it an additive group. -/
class Ring (R : Type u) extends Semiring R, AddCommGroup R, AddGroupWithOne R
goal: Type u

full_name: add_one_mul
code: theorem add_one_mul [RightDistribClass α] (a b : α) : (a + 1) * b = a * b + b 
goal: (a + 1) * b = a * b + b

full_name: mul_add_one
code: theorem mul_add_one [LeftDistribClass α] (a b : α) : a * (b + 1) = a * b + a 
goal: a * (b + 1) = a * b + a

full_name: one_add_mul
code: theorem one_add_mul [RightDistribClass α] (a b : α) : (1 + a) * b = b + a * b 
goal: (1 + a) * b = b + a * b

full_name: mul_one_add
code: theorem mul_one_add [LeftDistribClass α] (a b : α) : a * (1 + b) = a + a * b 
goal: a * (1 + b) = a + a * b

full_name: two_mul
code: theorem two_mul (n : α) : 2 * n = n + n 
goal: 2 * n = n + n

full_name: mul_two
code: theorem mul_two (n : α) : n * 2 = n + n 
goal: n * 2 = n + n

full_name: mul_ite
code: @[to_additive]
theorem mul_ite {α} [Mul α] (P : Prop) [Decidable P] (a b c : α) :
    (a * if P then b else c) = if P then a * b else a * c 
goal: (a * if P then b else c) = if P then a * b else a * c

full_name: add_ite
code: @[to_additive]
theorem mul_ite {α} [Mul α] (P : Prop) [Decidable P] (a b c : α) :
    (a * if P then b else c) = if P then a * b else a * c 
goal: (a + if P then b else c) = if P then a + b else a + c

full_name: ite_add
code: @[to_additive]
theorem ite_mul {α} [Mul α] (P : Prop) [Decidable P] (a b c : α) :
    (if P then a else b) * c = if P then a * c else b * c 
goal: (if P then a else b) + c = if P then a + c else b + c

full_name: ite_mul
code: @[to_additive]
theorem ite_mul {α} [Mul α] (P : Prop) [Decidable P] (a b c : α) :
    (if P then a else b) * c = if P then a * c else b * c 
goal: (if P then a else b) * c = if P then a * c else b * c

full_name: ite_sub_ite
code: theorem ite_sub_ite {α} [Sub α] (P : Prop) [Decidable P] (a b c d : α) :
    ((if P then a else b) - if P then c else d) = if P then a - c else b - d 
goal: ((if P then a else b) - if P then c else d) = if P then a - c else b - d

full_name: ite_add_ite
code: theorem ite_add_ite {α} [Add α] (P : Prop) [Decidable P] (a b c d : α) :
    ((if P then a else b) + if P then c else d) = if P then a + c else b + d 
goal: ((if P then a else b) + if P then c else d) = if P then a + c else b + d

full_name: ite_zero_mul
code: lemma ite_zero_mul : ite P a 0 * b = ite P (a * b) 0 
goal: (if P then a else 0) * b = if P then a * b else 0

full_name: mul_ite_zero
code: lemma mul_ite_zero : a * ite P b 0 = ite P (a * b) 0 
goal: (a * if P then b else 0) = if P then a * b else 0

full_name: ite_zero_mul_ite_zero
code: lemma ite_zero_mul_ite_zero : ite P a 0 * ite Q b 0 = ite (P ∧ Q) (a * b) 0 
goal: ((if P then a else 0) * if Q then b else 0) = if P ∧ Q then a * b else 0

full_name: mul_boole
code: theorem mul_boole {α} [MulZeroOneClass α] (P : Prop) [Decidable P] (a : α) :
    (a * if P then 1 else 0) = if P then a else 0 
goal: (a * if P then 1 else 0) = if P then a else 0

full_name: boole_mul
code: theorem boole_mul {α} [MulZeroOneClass α] (P : Prop) [Decidable P] (a : α) :
    (if P then 1 else 0) * a = if P then a else 0 
goal: (if P then 1 else 0) * a = if P then a else 0

full_name: NonUnitalNonAssocCommSemiring
code: /-- A not-necessarily-unital, not-necessarily-associative, but commutative semiring. -/
class NonUnitalNonAssocCommSemiring (α : Type u) extends NonUnitalNonAssocSemiring α, CommMagma α
goal: Type u

full_name: NonUnitalCommSemiring
code: /-- A non-unital commutative semiring is a `NonUnitalSemiring` with commutative multiplication.
In other words, it is a type with the following structures: additive commutative monoid
(`AddCommMonoid`), commutative semigroup (`CommSemigroup`), distributive laws (`Distrib`), and
multiplication by zero law (`MulZeroClass`). -/
class NonUnitalCommSemiring (α : Type u) extends NonUnitalSemiring α, CommSemigroup α
goal: Type u

full_name: CommSemiring
code: /-- A commutative semiring is a semiring with commutative multiplication. -/
class CommSemiring (R : Type u) extends Semiring R, CommMonoid R
goal: Type u

full_name: CommSemiring.toNonUnitalCommSemiring
code: instance (priority := 100) CommSemiring.toNonUnitalCommSemiring [CommSemiring α] :
    NonUnitalCommSemiring α 
goal: NonUnitalCommSemiring α

full_name: CommSemiring.toCommMonoidWithZero
code: instance (priority := 100) CommSemiring.toCommMonoidWithZero [CommSemiring α] :
    CommMonoidWithZero α 
goal: CommMonoidWithZero α

full_name: add_mul_self_eq
code: theorem add_mul_self_eq (a b : α) : (a + b) * (a + b) = a * a + 2 * a * b + b * b 
goal: (a + b) * (a + b) = a * a + 2 * a * b + b * b

full_name: add_sq
code: lemma add_sq (a b : α) : (a + b) ^ 2 = a ^ 2 + 2 * a * b + b ^ 2 
goal: (a + b) ^ 2 = a ^ 2 + 2 * a * b + b ^ 2

full_name: add_sq'
code: lemma add_sq' (a b : α) : (a + b) ^ 2 = a ^ 2 + b ^ 2 + 2 * a * b 
goal: (a + b) ^ 2 = a ^ 2 + b ^ 2 + 2 * a * b

full_name: HasDistribNeg.mul_neg
code: /-- Typeclass for a negation operator that distributes across multiplication.

This is useful for dealing with submonoids of a ring that contain `-1` without having to duplicate
lemmas. -/
class HasDistribNeg (α : Type*) [Mul α] extends InvolutiveNeg α where
  /-- Negation is left distributive over multiplication -/
  neg_mul : ∀ x y : α, -x * y = -(x * y)
  /-- Negation is right distributive over multiplication -/
  mul_neg : ∀ x y : α, x * -y = -(x * y)
goal: x * -y = -(x * y)

full_name: HasDistribNeg
code: /-- Typeclass for a negation operator that distributes across multiplication.

This is useful for dealing with submonoids of a ring that contain `-1` without having to duplicate
lemmas. -/
class HasDistribNeg (α : Type*) [Mul α] extends InvolutiveNeg α where
  /-- Negation is left distributive over multiplication -/
  neg_mul : ∀ x y : α, -x * y = -(x * y)
  /-- Negation is right distributive over multiplication -/
  mul_neg : ∀ x y : α, x * -y = -(x * y)
goal: Type u_1

full_name: HasDistribNeg.neg_mul
code: /-- Typeclass for a negation operator that distributes across multiplication.

This is useful for dealing with submonoids of a ring that contain `-1` without having to duplicate
lemmas. -/
class HasDistribNeg (α : Type*) [Mul α] extends InvolutiveNeg α where
  /-- Negation is left distributive over multiplication -/
  neg_mul : ∀ x y : α, -x * y = -(x * y)
  /-- Negation is right distributive over multiplication -/
  mul_neg : ∀ x y : α, x * -y = -(x * y)
goal: -x * y = -(x * y)

full_name: neg_mul
code: @[simp]
theorem neg_mul (a b : α) : -a * b = -(a * b) 
goal: -a * b = -(a * b)

full_name: mul_neg
code: @[simp]
theorem mul_neg (a b : α) : a * -b = -(a * b) 
goal: a * -b = -(a * b)

full_name: neg_mul_neg
code: theorem neg_mul_neg (a b : α) : -a * -b = a * b 
goal: -a * -b = a * b

full_name: neg_mul_eq_neg_mul
code: theorem neg_mul_eq_neg_mul (a b : α) : -(a * b) = -a * b 
goal: -(a * b) = -a * b

full_name: neg_mul_eq_mul_neg
code: theorem neg_mul_eq_mul_neg (a b : α) : -(a * b) = a * -b 
goal: -(a * b) = a * -b

full_name: neg_mul_comm
code: theorem neg_mul_comm (a b : α) : -a * b = a * -b 
goal: -a * b = a * -b

full_name: neg_eq_neg_one_mul
code: theorem neg_eq_neg_one_mul (a : α) : -a = -1 * a 
goal: -a = -1 * a

full_name: mul_neg_one
code: /-- An element of a ring multiplied by the additive inverse of one is the element's additive
  inverse. -/
theorem mul_neg_one (a : α) : a * -1 = -a 
goal: a * -1 = -a

full_name: neg_one_mul
code: /-- The additive inverse of one multiplied by an element of a ring is the element's additive
  inverse. -/
theorem neg_one_mul (a : α) : -1 * a = -a 
goal: -1 * a = -a

full_name: MulZeroClass.negZeroClass
code: instance (priority := 100) MulZeroClass.negZeroClass : NegZeroClass α 
goal: NegZeroClass α

full_name: NonUnitalNonAssocRing.toHasDistribNeg
code: instance (priority := 100) NonUnitalNonAssocRing.toHasDistribNeg : HasDistribNeg α 
goal: HasDistribNeg α

full_name: mul_sub_left_distrib
code: theorem mul_sub_left_distrib (a b c : α) : a * (b - c) = a * b - a * c 
goal: a * (b - c) = a * b - a * c

full_name: mul_sub_right_distrib
code: theorem mul_sub_right_distrib (a b c : α) : (a - b) * c = a * c - b * c 
goal: (a - b) * c = a * c - b * c

full_name: sub_one_mul
code: theorem sub_one_mul (a b : α) : (a - 1) * b = a * b - b 
goal: (a - 1) * b = a * b - b

full_name: mul_sub_one
code: theorem mul_sub_one (a b : α) : a * (b - 1) = a * b - a 
goal: a * (b - 1) = a * b - a

full_name: one_sub_mul
code: theorem one_sub_mul (a b : α) : (1 - a) * b = b - a * b 
goal: (1 - a) * b = b - a * b

full_name: mul_one_sub
code: theorem mul_one_sub (a b : α) : a * (1 - b) = a - a * b 
goal: a * (1 - b) = a - a * b

full_name: Ring.toNonUnitalRing
code: instance (priority := 100) Ring.toNonUnitalRing : NonUnitalRing α 
goal: NonUnitalRing α

full_name: Ring.toNonAssocRing
code: instance (priority := 100) Ring.toNonAssocRing : NonAssocRing α 
goal: NonAssocRing α

full_name: instSemiring
code: /-- The instance from `Ring` to `Semiring` happens often in linear algebra, for which all the basic
definitions are given in terms of semirings, but many applications use rings or fields. We increase
a little bit its priority above 100 to try it quickly, but remaining below the default 1000 so that
more specific instances are tried first. -/
instance (priority := 200) : Semiring α 
goal: Semiring α

full_name: NonUnitalNonAssocCommRing
code: /-- A non-unital non-associative commutative ring is a `NonUnitalNonAssocRing` with commutative
multiplication. -/
class NonUnitalNonAssocCommRing (α : Type u)
  extends NonUnitalNonAssocRing α, NonUnitalNonAssocCommSemiring α
goal: Type u

full_name: NonUnitalCommRing
code: /-- A non-unital commutative ring is a `NonUnitalRing` with commutative multiplication. -/
class NonUnitalCommRing (α : Type u) extends NonUnitalRing α, NonUnitalNonAssocCommRing α
goal: Type u

full_name: NonUnitalCommRing.toNonUnitalCommSemiring
code: instance (priority := 100) NonUnitalCommRing.toNonUnitalCommSemiring [s : NonUnitalCommRing α] :
    NonUnitalCommSemiring α 
goal: NonUnitalCommSemiring α

full_name: CommRing
code: /-- A commutative ring is a ring with commutative multiplication. -/
class CommRing (α : Type u) extends Ring α, CommMonoid α
goal: Type u

full_name: CommRing.toCommSemiring
code: instance (priority := 100) CommRing.toCommSemiring [s : CommRing α] : CommSemiring α 
goal: CommSemiring α

full_name: CommRing.toNonUnitalCommRing
code: instance (priority := 100) CommRing.toNonUnitalCommRing [s : CommRing α] : NonUnitalCommRing α 
goal: NonUnitalCommRing α

full_name: CommRing.toAddCommGroupWithOne
code: instance (priority := 100) CommRing.toAddCommGroupWithOne [s : CommRing α] :
    AddCommGroupWithOne α 
goal: AddCommGroupWithOne α

full_name: IsDomain
code: /-- A domain is a nontrivial semiring such that multiplication by a non zero element
is cancellative on both sides. In other words, a nontrivial semiring `R` satisfying
`∀ {a b c : R}, a ≠ 0 → a * b = a * c → b = c` and
`∀ {a b c : R}, b ≠ 0 → a * b = c * b → a = c`.

This is implemented as a mixin for `Semiring α`.
To obtain an integral domain use `[CommRing α] [IsDomain α]`. -/
class IsDomain (α : Type u) [Semiring α] extends IsCancelMulZero α, Nontrivial α : Prop
goal: Prop