Built with
doc-gen4 , running Lean4.
Bubbles (
) indicate interactive fragments: hover for details, tap to reveal contents.
Use
Ctrl+↑ Ctrl+↓ to navigate,
Ctrl+🖱️ to focus.
On Mac, use
Cmd instead of
Ctrl .
/-
Copyright (c) 2014 Jeremy Avigad. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Jeremy Avigad, Leonardo de Moura, Floris van Doorn, Yury Kudryashov, Neil Strickland
! This file was ported from Lean 3 source module algebra.ring.commute
! leanprover-community/mathlib commit 70d50ecfd4900dd6d328da39ab7ebd516abe4025
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
import Mathlib.Algebra.Ring.Semiconj
import Mathlib.Algebra.Ring.Units
import Mathlib.Algebra.Group.Commute
/-!
# Semirings and rings
This file gives lemmas about semirings, rings and domains.
This is analogous to `Mathlib.Algebra.Group.Basic`,
the difference being that the former is about `+` and `*` separately, while
the present file is about their interaction.
For the definitions of semirings and rings see `Mathlib.Algebra.Ring.Defs`.
-/
universe u v w x
variable { α : Type u } { β : Type v } { γ : Type w } { R : Type x }
open Function
namespace Commute
@[ simp ]
theorem add_right [ Distrib R ] { a b c : R } : Commute : {S : Type ?u.28} → [inst : Mul S ] → S → S → Prop Commute a b → Commute : {S : Type ?u.147} → [inst : Mul S ] → S → S → Prop Commute a c → Commute : {S : Type ?u.161} → [inst : Mul S ] → S → S → Prop Commute a ( b + c ) :=
SemiconjBy.add_right
#align commute.add_right Commute.add_rightₓ
-- for some reason mathport expected `Semiring` instead of `Distrib`?
@[ simp ]
theorem add_left [ Distrib R ] { a b c : R } : Commute : {S : Type ?u.311} → [inst : Mul S ] → S → S → Prop Commute a c → Commute : {S : Type ?u.430} → [inst : Mul S ] → S → S → Prop Commute b c → Commute : {S : Type ?u.444} → [inst : Mul S ] → S → S → Prop Commute ( a + b ) c :=
SemiconjBy.add_left
#align commute.add_left Commute.add_leftₓ
-- for some reason mathport expected `Semiring` instead of `Distrib`?
section deprecated
set_option linter.deprecated false
@[ deprecated ]
theorem bit0_right [ Distrib R ] { x y : R } ( h : Commute : {S : Type ?u.590} → [inst : Mul S ] → S → S → Prop Commute x y ) : Commute : {S : Type ?u.709} → [inst : Mul S ] → S → S → Prop Commute x ( bit0 : {α : Type ?u.722} → [inst : Add α ] → α → α bit0 y ) :=
h . add_right h
#align commute.bit0_right Commute.bit0_right
@[ deprecated ]
theorem bit0_left [ Distrib R ] { x y : R } ( h : Commute : {S : Type ?u.796} → [inst : Mul S ] → S → S → Prop Commute x y ) : Commute : {S : Type ?u.915} → [inst : Mul S ] → S → S → Prop Commute ( bit0 : {α : Type ?u.928} → [inst : Add α ] → α → α bit0 x ) y :=
h . add_left h
#align commute.bit0_left Commute.bit0_left
@[ deprecated ]
theorem bit1_right [ NonAssocSemiring : Type ?u.995 → Type ?u.995 NonAssocSemiring R ] { x y : R } ( h : Commute : {S : Type ?u.1002} → [inst : Mul S ] → S → S → Prop Commute x y ) : Commute : {S : Type ?u.1075} → [inst : Mul S ] → S → S → Prop Commute x ( bit1 : {α : Type ?u.1088} → [inst : One α ] → [inst : Add α ] → α → α bit1 y ) :=
h . bit0_right . add_right ( Commute.one_right x )
#align commute.bit1_right Commute.bit1_right
@[ deprecated ]
theorem bit1_left [ NonAssocSemiring : Type ?u.1306 → Type ?u.1306 NonAssocSemiring R ] { x y : R } ( h : Commute : {S : Type ?u.1313} → [inst : Mul S ] → S → S → Prop Commute x y ) : Commute : {S : Type ?u.1386} → [inst : Mul S ] → S → S → Prop Commute ( bit1 : {α : Type ?u.1399} → [inst : One α ] → [inst : Add α ] → α → α bit1 x ) y :=
h . bit0_left . add_left ( Commute.one_left y )
#align commute.bit1_left Commute.bit1_left
end deprecated
/-- Representation of a difference of two squares of commuting elements as a product. -/
theorem mul_self_sub_mul_self_eq [ NonUnitalNonAssocRing : Type ?u.1617 → Type ?u.1617 NonUnitalNonAssocRing R ] { a b : R } ( h : Commute : {S : Type ?u.1624} → [inst : Mul S ] → S → S → Prop Commute a b ) :
a * a - b * b = ( a + b ) * ( a - b ) := by
rw [ add_mul , mul_sub , mul_sub , h . eq , sub_add_sub_cancel : ∀ {G : Type ?u.2325} [inst : AddGroup G ] (a b c : G ), a - b + (b - c ) = a - c sub_add_sub_cancel]
#align commute.mul_self_sub_mul_self_eq Commute.mul_self_sub_mul_self_eq
theorem mul_self_sub_mul_self_eq' [ NonUnitalNonAssocRing : Type ?u.2407 → Type ?u.2407 NonUnitalNonAssocRing R ] { a b : R } ( h : Commute : {S : Type ?u.2414} → [inst : Mul S ] → S → S → Prop Commute a b ) :
a * a - b * b = ( a - b ) * ( a + b ) := by
rw [ mul_add , sub_mul , sub_mul , h . eq , sub_add_sub_cancel : ∀ {G : Type ?u.3121} [inst : AddGroup G ] (a b c : G ), a - b + (b - c ) = a - c sub_add_sub_cancel]
#align commute.mul_self_sub_mul_self_eq' Commute.mul_self_sub_mul_self_eq'
theorem mul_self_eq_mul_self_iff [ NonUnitalNonAssocRing : Type ?u.3203 → Type ?u.3203 NonUnitalNonAssocRing R ] [ NoZeroDivisors : (M₀ : Type ?u.3206) → [inst : Mul M₀ ] → [inst : Zero M₀ ] → Prop NoZeroDivisors R ] { a b : R }
( h : Commute : {S : Type ?u.3388} → [inst : Mul S ] → S → S → Prop Commute a b ) : a * a = b * b ↔ a = b ∨ a = - b := by
rw [ ← sub_eq_zero : ∀ {G : Type ?u.3583} [inst : AddGroup G ] {a b : G }, a - b = 0 ↔ a = b sub_eq_zero, h . mul_self_sub_mul_self_eq , mul_eq_zero , or_comm : ∀ {a b : Prop }, a ∨ b ↔ b ∨ a or_comm, sub_eq_zero : ∀ {G : Type ?u.3747} [inst : AddGroup G ] {a b : G }, a - b = 0 ↔ a = b sub_eq_zero,
add_eq_zero_iff_eq_neg : ∀ {G : Type ?u.3782} [inst : AddGroup G ] {a b : G }, a + b = 0 ↔ a = - b add_eq_zero_iff_eq_neg]
#align commute.mul_self_eq_mul_self_iff Commute.mul_self_eq_mul_self_iff
section
variable [ Mul R ] [ HasDistribNeg : (α : Type ?u.4253) → [inst : Mul α ] → Type ?u.4253 HasDistribNeg R ] { a b : R }
theorem neg_right : Commute : {S : Type ?u.3900} → [inst : Mul S ] → S → S → Prop Commute a b → Commute : {S : Type ?u.3923} → [inst : Mul S ] → S → S → Prop Commute a (- b ) :=
SemiconjBy.neg_right
#align commute.neg_right Commute.neg_right
@[ simp ]
theorem neg_right_iff : Commute : {S : Type ?u.4270} → [inst : Mul S ] → S → S → Prop Commute a (- b ) ↔ Commute : {S : Type ?u.4544} → [inst : Mul S ] → S → S → Prop Commute a b :=
SemiconjBy.neg_right_iff
#align commute.neg_right_iff Commute.neg_right_iff
theorem neg_left : Commute : {S : Type ?u.4644} → [inst : Mul S ] → S → S → Prop Commute a b → Commute : {S : Type ?u.4667} → [inst : Mul S ] → S → S → Prop Commute (- a ) b :=
SemiconjBy.neg_left
#align commute.neg_left Commute.neg_left
@[ simp ]
theorem neg_left_iff : Commute : {S : Type ?u.5014} → [inst : Mul S ] → S → S → Prop Commute (- a ) b ↔ Commute : {S : Type ?u.5288} → [inst : Mul S ] → S → S → Prop Commute a b :=
SemiconjBy.neg_left_iff
#align commute.neg_left_iff Commute.neg_left_iff
end
section
variable [ MulOneClass : Type ?u.6445 → Type ?u.6445 MulOneClass R ] [ HasDistribNeg : (α : Type ?u.5370) → [inst : Mul α ] → Type ?u.5370 HasDistribNeg R ] { a : R }
-- Porting note: no longer needs to be `@[simp]` since `simp` can prove it.
-- @[simp]
theorem neg_one_right : ∀ (a : R ), Commute a (- 1 ) neg_one_right ( a : R ) : Commute : {S : Type ?u.5747} → [inst : Mul S ] → S → S → Prop Commute a (- 1 ) :=
SemiconjBy.neg_one_right a
#align commute.neg_one_right Commute.neg_one_right
-- Porting note: no longer needs to be `@[simp]` since `simp` can prove it.
-- @[simp]
theorem neg_one_left ( a : R ) : Commute : {S : Type ?u.6632} → [inst : Mul S ] → S → S → Prop Commute (- 1 ) a :=
SemiconjBy.neg_one_left a
#align commute.neg_one_left Commute.neg_one_left
end
section
variable [ NonUnitalNonAssocRing : Type ?u.7360 → Type ?u.7360 NonUnitalNonAssocRing R ] { a b c : R }
@[ simp ]
theorem sub_right : Commute : {S : Type ?u.7370} → [inst : Mul S ] → S → S → Prop Commute a b → Commute : {S : Type ?u.7401} → [inst : Mul S ] → S → S → Prop Commute a c → Commute : {S : Type ?u.7415} → [inst : Mul S ] → S → S → Prop Commute a ( b - c ) :=
SemiconjBy.sub_right
#align commute.sub_right Commute.sub_right
@[ simp ]
theorem sub_left : Commute : {S : Type ?u.7655} → [inst : Mul S ] → S → S → Prop Commute a c → Commute : {S : Type ?u.7686} → [inst : Mul S ] → S → S → Prop Commute b c → Commute : {S : Type ?u.7700} → [inst : Mul S ] → S → S → Prop Commute ( a - b ) c :=
SemiconjBy.sub_left
#align commute.sub_left Commute.sub_left
end
end Commute
/-- Representation of a difference of two squares in a commutative ring as a product. -/
theorem mul_self_sub_mul_self : ∀ {R : Type x} [inst : CommRing R ] (a b : R ), a * a - b * b = (a + b ) * (a - b ) mul_self_sub_mul_self [ CommRing R ] ( a b : R ) : a * a - b * b = ( a + b ) * ( a - b ) :=
( Commute.all a b ). mul_self_sub_mul_self_eq
#align mul_self_sub_mul_self mul_self_sub_mul_self : ∀ {R : Type x} [inst : CommRing R ] (a b : R ), a * a - b * b = (a + b ) * (a - b ) mul_self_sub_mul_self
theorem mul_self_sub_one [ NonAssocRing : Type ?u.8325 → Type ?u.8325 NonAssocRing R ] ( a : R ) : a * a - 1 = ( a + 1 ) * ( a - 1 ) := by
rw [ ← ( Commute.one_right a ). mul_self_sub_mul_self_eq , mul_one ]
#align mul_self_sub_one mul_self_sub_one
theorem mul_self_eq_mul_self_iff [ CommRing R ] [ NoZeroDivisors : (M₀ : Type ?u.8874) → [inst : Mul M₀ ] → [inst : Zero M₀ ] → Prop NoZeroDivisors R ] { a b : R } :
a * a = b * b ↔ a = b ∨ a = - b :=
( Commute.all a b ). mul_self_eq_mul_self_iff
#align mul_self_eq_mul_self_iff mul_self_eq_mul_self_iff
theorem mul_self_eq_one_iff [ NonAssocRing : Type ?u.9152 → Type ?u.9152 NonAssocRing R ] [ NoZeroDivisors : (M₀ : Type ?u.9155) → [inst : Mul M₀ ] → [inst : Zero M₀ ] → Prop NoZeroDivisors R ] { a : R } :
a * a = 1 ↔ a = 1 ∨ a = - 1 := by
rw [ ← ( Commute.one_right a ). mul_self_eq_mul_self_iff , mul_one ]
#align mul_self_eq_one_iff mul_self_eq_one_iff
namespace Units
/-- In the unit group of an integral domain, a unit is its own inverse iff the unit is one or
one's additive inverse. -/
theorem inv_eq_self_iff [ Ring R ] [ NoZeroDivisors : (M₀ : Type ?u.9610) → [inst : Mul M₀ ] → [inst : Zero M₀ ] → Prop NoZeroDivisors R ] ( u : R ˣ) : u ⁻¹ = u ↔ u = 1 ∨ u = - 1 := by
rw [ inv_eq_iff_mul_eq_one : ∀ {G : Type ?u.9985} [inst : Group G ] {a b : G }, a ⁻¹ = b ↔ a * b = 1 inv_eq_iff_mul_eq_one]
simp only [ ext_iff : ∀ {α : Type ?u.10038} [inst : Monoid α ] {a b : α ˣ }, a = b ↔ ↑a = ↑b ext_iff] ↑(u * u ) = ↑1 ↔ ↑u = ↑1 ∨ ↑u = ↑(- 1 )
push_cast
exact mul_self_eq_one_iff
#align units.inv_eq_self_iff Units.inv_eq_self_iff
end Units