Documentation

Mathlib.Algebra.Field.Defs

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 FieldTheory 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 GroupWithZero. If you cannot find a division ring / field lemma that does not involve +, you can try looking for a GroupWithZero lemma instead.

Tags #

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

def Rat.castRec {K : Type u_3} [NatCast K] [IntCast K] [Mul K] [Inv K] :
K

The default definition of the coercion (↑(a : ℚ) : K) for a division ring K is defined as (a / b : K) = (a : K) * (b : K)⁻¹. Use coe instead of Rat.castRec for better definitional behaviour.

Equations
Instances For
    def qsmulRec {K : Type u_3} (coe : K) [Mul K] (a : ) (x : K) :
    K

    The default definition of the scalar multiplication (a : ℚ) • (x : K) for a division ring K is given by a • x = (↑ a) * x. Use (a : ℚ) • (x : K) instead of qsmulRec for better definitional behaviour.

    Equations
    Instances For
      class DivisionSemiring (α : Type u_4) extends Semiring , Inv , Div , Nontrivial :
      Type u_4

      A DivisionSemiring is a Semiring with multiplicative inverses for nonzero elements.

      Instances
        class DivisionRing (K : Type u) extends Ring , Inv , Div , Nontrivial , RatCast :

        A DivisionRing is a Ring with multiplicative inverses for nonzero elements.

        An instance of DivisionRing K includes maps ratCast : ℚ → K and qsmul : ℚ → K → K. If the division ring has positive characteristic p, we define ratCast (1 / p) = 1 / 0 = 0 for consistency with our division by zero convention. The fields ratCast and qsmul are needed to implement the algebraRat [DivisionRing K] : Algebra ℚ K instance, since we need to control the specific definitions for some special cases of K (in particular K = ℚ itself). See also Note [forgetful inheritance].

        Instances
          Equations
          class Semifield (α : Type u_4) extends CommSemiring , Inv , Div , Nontrivial :
          Type u_4

          A Semifield is a CommSemiring with multiplicative inverses for nonzero elements.

          Instances
            class Field (K : Type u) extends CommRing , Inv , Div , Nontrivial , RatCast :

            A Field is a CommRing with multiplicative inverses for nonzero elements.

            An instance of Field K includes maps ratCast : ℚ → K and qsmul : ℚ → K → K. If the field has positive characteristic p, we define ratCast (1 / p) = 1 / 0 = 0 for consistency with our division by zero convention. The fields ratCast and qsmul are needed to implement the algebraRat [DivisionRing K] : Algebra ℚ K instance, since we need to control the specific definitions for some special cases of K (in particular K = ℚ itself). See also Note [forgetful inheritance].

            Instances
              theorem Rat.cast_mk' {K : Type u_3} [DivisionRing K] (a : ) (b : ) (h1 : b 0) (h2 : Nat.Coprime (Int.natAbs a) b) :
              ↑(Rat.mk' a b) = a * (b)⁻¹
              theorem Rat.cast_def {K : Type u_3} [DivisionRing K] (r : ) :
              r = r.num / r.den
              instance Rat.smulDivisionRing {K : Type u_3} [DivisionRing K] :
              Equations
              • Rat.smulDivisionRing = { smul := DivisionRing.qsmul }
              theorem Rat.smul_def {K : Type u_3} [DivisionRing K] (a : ) (x : K) :
              a x = a * x
              @[simp]
              theorem Rat.smul_one_eq_coe (A : Type u_4) [DivisionRing A] (m : ) :
              m 1 = m
              Equations
              • DivisionRing.toOfScientific = { ofScientific := fun m b d => ↑(Rat.ofScientific m b d) }
              instance Field.toSemifield {K : Type u_3} [Field K] :
              Equations