mathlib documentation

algebra.field.basic

Division (semi)rings and (semi)fields #

This file introduces fields and division rings (also known as skewfields) and proves some basic statements about them. For a more extensive theory of fields, see the field_theory folder.

Main definitions #

Implementation details #

By convention 0⁻¹ = 0 in a field or division ring. This is due to the fact that working with total functions has the advantage of not constantly having to check that x ≠ 0 when writing x⁻¹. With this convention in place, some statements like (a + b) * c⁻¹ = a * c⁻¹ + b * c⁻¹ still remain true, while others like the defining property a * a⁻¹ = 1 need the assumption a ≠ 0. If you are a beginner in using Lean and are confused by that, you can read more about why this convention is taken in Kevin Buzzard's blogpost

A division ring or field is an example of a group_with_zero. If you cannot find a division ring / field lemma that does not involve +, you can try looking for a group_with_zero lemma instead.

Tags #

field, division ring, skew field, skew-field, skewfield

@[class]
structure division_semiring (α : Type u_4) :
Type u_4

A division_semiring is a semiring with multiplicative inverses for nonzero elements.

Instances of this typeclass
Instances of other typeclasses for division_semiring
  • division_semiring.has_sizeof_inst
@[instance]
@[instance]
def division_semiring.to_semiring (α : Type u_4) [self : division_semiring α] :
@[instance]
def division_ring.to_nontrivial (α : Type u_4) [self : division_ring α] :
@[instance]
def division_ring.to_div_inv_monoid (α : Type u_4) [self : division_ring α] :
@[class]
structure division_ring (α : Type u_4) :
Type u_4

A division_ring is a ring with multiplicative inverses for nonzero elements.

Instances of this typeclass
Instances of other typeclasses for division_ring
  • division_ring.has_sizeof_inst
@[instance]
def division_ring.to_ring (α : Type u_4) [self : division_ring α] :
ring α
@[instance]
def semifield.to_comm_semiring (α : Type u_4) [self : semifield α] :
@[instance]
def semifield.to_comm_group_with_zero (α : Type u_4) [self : semifield α] :
@[instance]
def semifield.to_division_semiring (α : Type u_4) [self : semifield α] :
@[class]
structure semifield (α : Type u_4) :
Type u_4

A semifield is a comm_semiring with multiplicative inverses for nonzero elements.

Instances of this typeclass
Instances of other typeclasses for semifield
  • semifield.has_sizeof_inst
@[instance]
def field.to_comm_ring (α : Type u_4) [self : field α] :
@[instance]
def field.to_division_ring (α : Type u_4) [self : field α] :
@[class]
structure field (α : Type u_4) :
Type u_4

A field is a comm_ring with multiplicative inverses for nonzero elements.

Instances of this typeclass
Instances of other typeclasses for field
  • field.has_sizeof_inst
theorem add_div {α : Type u_1} [division_semiring α] (a b c : α) :
(a + b) / c = a / c + b / c
theorem div_add_div_same {α : Type u_1} [division_semiring α] (a b c : α) :
a / c + b / c = (a + b) / c
theorem same_add_div {α : Type u_1} [division_semiring α] {a b : α} (h : b 0) :
(b + a) / b = 1 + a / b
theorem div_add_same {α : Type u_1} [division_semiring α] {a b : α} (h : b 0) :
(a + b) / b = a / b + 1
theorem one_add_div {α : Type u_1} [division_semiring α] {a b : α} (h : b 0) :
1 + a / b = (b + a) / b
theorem div_add_one {α : Type u_1} [division_semiring α] {a b : α} (h : b 0) :
a / b + 1 = (a + b) / b
theorem one_div_mul_add_mul_one_div_eq_one_div_add_one_div {α : Type u_1} [division_semiring α] {a b : α} (ha : a 0) (hb : b 0) :
1 / a * (a + b) * (1 / b) = 1 / a + 1 / b
theorem add_div_eq_mul_add_div {α : Type u_1} [division_semiring α] {c : α} (a b : α) (hc : c 0) :
a + b / c = (a * c + b) / c
theorem add_div' {α : Type u_1} [division_semiring α] (a b c : α) (hc : c 0) :
b + a / c = (b * c + a) / c
theorem div_add' {α : Type u_1} [division_semiring α] (a b c : α) (hc : c 0) :
a / c + b = (a + b * c) / c
theorem one_div_neg_one_eq_neg_one {K : Type u_3} [division_ring K] :
1 / -1 = -1
theorem one_div_neg_eq_neg_one_div {K : Type u_3} [division_ring K] (a : K) :
1 / -a = -(1 / a)
theorem div_neg_eq_neg_div {K : Type u_3} [division_ring K] (a b : K) :
b / -a = -(b / a)
theorem neg_div {K : Type u_3} [division_ring K] (a b : K) :
-b / a = -(b / a)
theorem neg_div' {K : Type u_3} [division_ring K] (a b : K) :
-(b / a) = -b / a
theorem neg_div_neg_eq {K : Type u_3} [division_ring K] (a b : K) :
-a / -b = a / b
@[simp]
theorem div_neg_self {K : Type u_3} [division_ring K] {a : K} (h : a 0) :
a / -a = -1
@[simp]
theorem neg_div_self {K : Type u_3} [division_ring K] {a : K} (h : a 0) :
-a / a = -1
theorem div_sub_div_same {K : Type u_3} [division_ring K] (a b c : K) :
a / c - b / c = (a - b) / c
theorem same_sub_div {K : Type u_3} [division_ring K] {a b : K} (h : b 0) :
(b - a) / b = 1 - a / b
theorem one_sub_div {K : Type u_3} [division_ring K] {a b : K} (h : b 0) :
1 - a / b = (b - a) / b
theorem div_sub_same {K : Type u_3} [division_ring K] {a b : K} (h : b 0) :
(a - b) / b = a / b - 1
theorem div_sub_one {K : Type u_3} [division_ring K] {a b : K} (h : b 0) :
a / b - 1 = (a - b) / b
theorem neg_inv {K : Type u_3} [division_ring K] {a : K} :
theorem sub_div {K : Type u_3} [division_ring K] (a b c : K) :
(a - b) / c = a / c - b / c
theorem div_neg {K : Type u_3} [division_ring K] {b : K} (a : K) :
a / -b = -(a / b)
theorem inv_neg {K : Type u_3} [division_ring K] {a : K} :
theorem one_div_mul_sub_mul_one_div_eq_one_div_add_one_div {K : Type u_3} [division_ring K] {a b : K} (ha : a 0) (hb : b 0) :
1 / a * (b - a) * (1 / b) = 1 / a - 1 / b
@[protected, instance]
def division_ring.is_domain {K : Type u_3} [division_ring K] :
theorem div_add_div {α : Type u_1} [semifield α] {b d : α} (a c : α) (hb : b 0) (hd : d 0) :
a / b + c / d = (a * d + b * c) / (b * d)
theorem one_div_add_one_div {α : Type u_1} [semifield α] {a b : α} (ha : a 0) (hb : b 0) :
1 / a + 1 / b = (a + b) / (a * b)
theorem inv_add_inv {α : Type u_1} [semifield α] {a b : α} (ha : a 0) (hb : b 0) :
a⁻¹ + b⁻¹ = (a + b) / (a * b)
@[protected, instance]
def field.to_semifield {K : Type u_3} [field K] :
Equations
theorem div_sub_div {K : Type u_3} [field K] (a : K) {b : K} (c : K) {d : K} (hb : b 0) (hd : d 0) :
a / b - c / d = (a * d - b * c) / (b * d)
theorem inv_sub_inv {K : Type u_3} [field K] {a b : K} (ha : a 0) (hb : b 0) :
a⁻¹ - b⁻¹ = (b - a) / (a * b)
theorem sub_div' {K : Type u_3} [field K] (a b c : K) (hc : c 0) :
b - a / c = (b * c - a) / c
theorem div_sub' {K : Type u_3} [field K] (a b c : K) (hc : c 0) :
a / c - b = (a - c * b) / c
@[protected, instance]
def field.is_domain {K : Type u_3} [field K] :
structure is_field (R : Type u) [semiring R] :
Prop
  • exists_pair_ne : ∃ (x y : R), x y
  • mul_comm : ∀ (x y : R), x * y = y * x
  • mul_inv_cancel : ∀ {a : R}, a 0(∃ (b : R), a * b = 1)

A predicate to express that a (semi)ring is a (semi)field.

This is mainly useful because such a predicate does not contain data, and can therefore be easily transported along ring isomorphisms. Additionaly, this is useful when trying to prove that a particular ring structure extends to a (semi)field.

theorem semifield.to_is_field (R : Type u) [semifield R] :

Transferring from semifield to is_field.

theorem field.to_is_field (R : Type u) [field R] :

Transferring from field to is_field.

@[simp]
theorem is_field.nontrivial {R : Type u} [semiring R] (h : is_field R) :
@[simp]
theorem not_is_field_of_subsingleton (R : Type u) [semiring R] [subsingleton R] :
noncomputable def is_field.to_semifield {R : Type u} [semiring R] (h : is_field R) :

Transferring from is_field to semifield.

Equations
noncomputable def is_field.to_field {R : Type u} [ring R] (h : is_field R) :

Transferring from is_field to field.

Equations
theorem uniq_inv_of_is_field (R : Type u) [ring R] (hf : is_field R) (x : R) :
x 0(∃! (y : R), x * y = 1)

For each field, and for each nonzero element of said field, there is a unique inverse. Since is_field doesn't remember the data of an inv function and as such, a lemma that there is a unique inverse could be useful.

@[simp]
theorem ring_hom.map_units_inv {α : Type u_1} {β : Type u_2} [semiring α] [division_semiring β] (f : α →+* β) (u : αˣ) :
@[simp]
theorem ring_hom.map_eq_zero {α : Type u_1} {β : Type u_2} [semiring α] [division_semiring β] [nontrivial α] (f : β →+* α) {a : β} :
f a = 0 a = 0
theorem ring_hom.map_ne_zero {α : Type u_1} {β : Type u_2} [semiring α] [division_semiring β] [nontrivial α] (f : β →+* α) {a : β} :
f a 0 a 0
theorem ring_hom.map_inv {α : Type u_1} {β : Type u_2} [division_semiring α] [division_semiring β] (f : α →+* β) (a : α) :
theorem ring_hom.map_div {α : Type u_1} {β : Type u_2} [division_semiring α] [division_semiring β] (f : α →+* β) (a b : α) :
f (a / b) = f a / f b
@[protected]
theorem ring_hom.injective {α : Type u_1} {β : Type u_2} [division_ring α] [semiring β] [nontrivial β] (f : α →+* β) :
noncomputable def field_of_is_unit_or_eq_zero {R : Type u_4} [nontrivial R] [hR : comm_ring R] (h : ∀ (a : R), is_unit a a = 0) :

Constructs a field structure on a comm_ring consisting only of units and 0. See note [reducible non-instances].

Equations
@[protected]
def function.injective.division_semiring {α : Type u_1} {β : Type u_2} [division_semiring β] [has_zero α] [has_mul α] [has_add α] [has_one α] [has_inv α] [has_div α] [has_scalar α] [has_pow α ] [has_pow α ] [has_nat_cast α] (f : α → β) (hf : function.injective f) (zero : f 0 = 0) (one : f 1 = 1) (add : ∀ (x y : α), f (x + y) = f x + f y) (mul : ∀ (x y : α), f (x * y) = f x * f y) (inv : ∀ (x : α), f x⁻¹ = (f x)⁻¹) (div : ∀ (x y : α), f (x / y) = f x / f y) (nsmul : ∀ (x : α) (n : ), f (n x) = n f x) (npow : ∀ (x : α) (n : ), f (x ^ n) = f x ^ n) (zpow : ∀ (x : α) (n : ), f (x ^ n) = f x ^ n) (nat_cast : ∀ (n : ), f n = n) :

Pullback a division_semiring along an injective function.

Equations
@[protected]
def function.injective.division_ring {K : Type u_3} [division_ring K] {K' : Type u_1} [has_zero K'] [has_one K'] [has_add K'] [has_mul K'] [has_neg K'] [has_sub K'] [has_inv K'] [has_div K'] [has_scalar K'] [has_scalar K'] [has_pow K' ] [has_pow K' ] [has_nat_cast K'] [has_int_cast K'] (f : K' → K) (hf : function.injective f) (zero : f 0 = 0) (one : f 1 = 1) (add : ∀ (x y : K'), f (x + y) = f x + f y) (mul : ∀ (x y : K'), f (x * y) = f x * f y) (neg : ∀ (x : K'), f (-x) = -f x) (sub : ∀ (x y : K'), f (x - y) = f x - f y) (inv : ∀ (x : K'), f x⁻¹ = (f x)⁻¹) (div : ∀ (x y : K'), f (x / y) = f x / f y) (nsmul : ∀ (x : K') (n : ), f (n x) = n f x) (zsmul : ∀ (x : K') (n : ), f (n x) = n f x) (npow : ∀ (x : K') (n : ), f (x ^ n) = f x ^ n) (zpow : ∀ (x : K') (n : ), f (x ^ n) = f x ^ n) (nat_cast : ∀ (n : ), f n = n) (int_cast : ∀ (n : ), f n = n) :

Pullback a division_ring along an injective function. See note [reducible non-instances].

Equations
@[protected]
def function.injective.semifield {α : Type u_1} {β : Type u_2} [semifield β] [has_zero α] [has_mul α] [has_add α] [has_one α] [has_inv α] [has_div α] [has_scalar α] [has_pow α ] [has_pow α ] [has_nat_cast α] (f : α → β) (hf : function.injective f) (zero : f 0 = 0) (one : f 1 = 1) (add : ∀ (x y : α), f (x + y) = f x + f y) (mul : ∀ (x y : α), f (x * y) = f x * f y) (inv : ∀ (x : α), f x⁻¹ = (f x)⁻¹) (div : ∀ (x y : α), f (x / y) = f x / f y) (nsmul : ∀ (x : α) (n : ), f (n x) = n f x) (npow : ∀ (x : α) (n : ), f (x ^ n) = f x ^ n) (zpow : ∀ (x : α) (n : ), f (x ^ n) = f x ^ n) (nat_cast : ∀ (n : ), f n = n) :

Pullback a field along an injective function.

Equations
@[protected]
def function.injective.field {K : Type u_3} [field K] {K' : Type u_1} [has_zero K'] [has_mul K'] [has_add K'] [has_neg K'] [has_sub K'] [has_one K'] [has_inv K'] [has_div K'] [has_scalar K'] [has_scalar K'] [has_pow K' ] [has_pow K' ] [has_nat_cast K'] [has_int_cast K'] (f : K' → K) (hf : function.injective f) (zero : f 0 = 0) (one : f 1 = 1) (add : ∀ (x y : K'), f (x + y) = f x + f y) (mul : ∀ (x y : K'), f (x * y) = f x * f y) (neg : ∀ (x : K'), f (-x) = -f x) (sub : ∀ (x y : K'), f (x - y) = f x - f y) (inv : ∀ (x : K'), f x⁻¹ = (f x)⁻¹) (div : ∀ (x y : K'), f (x / y) = f x / f y) (nsmul : ∀ (x : K') (n : ), f (n x) = n f x) (zsmul : ∀ (x : K') (n : ), f (n x) = n f x) (npow : ∀ (x : K') (n : ), f (x ^ n) = f x ^ n) (zpow : ∀ (x : K') (n : ), f (x ^ n) = f x ^ n) (nat_cast : ∀ (n : ), f n = n) (int_cast : ∀ (n : ), f n = n) :

Pullback a field along an injective function. See note [reducible non-instances].

Equations