Documentation

Mathlib.Algebra.CharP.Defs

Characteristic of semirings #

Main definitions #

class CharP (R : Type u_2) [AddMonoidWithOne R] (p : outParam ℕ) :

The generator of the kernel of the unique homomorphism ℕ → R for a semiring R.

Warning: for a semiring R, CharP R 0 and CharZero R need not coincide.

  • CharP R 0 asks that only 0 : ℕ maps to 0 : R under the map ℕ → R;
  • CharZero R requires an injection ℕ ↪ R.

For instance, endowing {0, 1} with addition given by max (i.e. 1 is absorbing), shows that CharZero {0, 1} does not hold and yet CharP {0, 1} 0 does. This example is formalized in Counterexamples/CharPZeroNeCharZero.lean.

Instances
    theorem charP_iff (R : Type u_2) [AddMonoidWithOne R] (p : outParam ℕ) :
    CharP R p ↔ ∀ (x : ℕ), ↑x = 0 ↔ p ∣ x
    theorem CharP.ofNat_eq_zero' (R : Type u_1) [AddMonoidWithOne R] (p : ℕ) [CharP R p] (a : ℕ) [a.AtLeastTwo] (h : p ∣ a) :
    theorem CharP.congr {R : Type u_1} [AddMonoidWithOne R] (p : ℕ) [CharP R p] {q : ℕ} (h : p = q) :
    CharP R q
    @[simp]
    theorem CharP.cast_eq_zero (R : Type u_1) [AddMonoidWithOne R] (p : ℕ) [CharP R p] :
    ↑p = 0
    theorem CharP.cast_eq_mod (R : Type u_1) [AddMonoidWithOne R] (p : ℕ) [CharP R p] (k : ℕ) :
    ↑k = ↑(k % p)
    theorem CharP.cast_eq_iff_mod_eq (R : Type u_1) [AddMonoidWithOne R] (p : ℕ) [CharP R p] {a b : ℕ} [IsLeftCancelAdd R] :
    ↑a = ↑b ↔ a % p = b % p
    theorem CharP.ofNat_eq_zero (R : Type u_1) [AddMonoidWithOne R] (p : ℕ) [CharP R p] [p.AtLeastTwo] :
    theorem CharP.eq (R : Type u_1) [AddMonoidWithOne R] {p q : ℕ} (hp : CharP R p) (hq : CharP R q) :
    p = q
    theorem CharP.intCast_eq_zero_iff (R : Type u_1) [AddGroupWithOne R] (p : ℕ) [CharP R p] (a : ℤ) :
    ↑a = 0 ↔ ↑p ∣ a
    noncomputable def ringChar (R : Type u_1) [NonAssocSemiring R] :

    Noncomputable function that outputs the unique characteristic of a semiring.

    Equations
    Instances For
      theorem ringChar.spec (R : Type u_1) [NonAssocSemiring R] (x : ℕ) :
      ↑x = 0 ↔ ringChar R ∣ x
      theorem ringChar.eq (R : Type u_1) [NonAssocSemiring R] (p : ℕ) [C : CharP R p] :
      @[instance 100]
      instance ringChar.charP (R : Type u_1) [NonAssocSemiring R] :
      theorem ringChar.of_eq {R : Type u_1} [NonAssocSemiring R] {p : ℕ} (h : ringChar R = p) :
      CharP R p
      theorem ringChar.eq_iff {R : Type u_1} [NonAssocSemiring R] {p : ℕ} :
      theorem ringChar.dvd {R : Type u_1} [NonAssocSemiring R] {x : ℕ} (hx : ↑x = 0) :
      @[simp]
      theorem ringChar.eq_zero {R : Type u_1} [NonAssocSemiring R] [CharZero R] :
      theorem CharP.neg_one_ne_one (R : Type u_1) [AddGroupWithOne R] (p : ℕ) [CharP R p] [Fact (2 < p)] :
      -1 ≠ 1
      theorem CharP.char_ne_one (R : Type u_1) [NonAssocSemiring R] [Nontrivial R] (p : ℕ) [hc : CharP R p] :
      p ≠ 1
      theorem CharP.char_prime_of_ne_zero (R : Type u_1) [NonAssocSemiring R] [NoZeroDivisors R] [Nontrivial R] {p : ℕ} [CharP R p] (hp : p ≠ 0) :

      The characteristic is prime if it is non-zero.

      theorem CharP.nontrivial_of_char_ne_one {R : Type u_1} [NonAssocSemiring R] {v : ℕ} (hv : v ≠ 1) [hr : CharP R v] :
      theorem NeZero.of_not_dvd (R : Type u_1) [AddMonoidWithOne R] {n p : ℕ} [CharP R p] (h : ¬p ∣ n) :
      NeZero ↑n
      theorem NeZero.not_char_dvd (R : Type u_1) [AddMonoidWithOne R] (p : ℕ) [CharP R p] (k : ℕ) [h : NeZero ↑k] :
      ¬p ∣ k

      Exponential characteristic #

      This section defines the exponential characteristic, which is defined to be 1 for a ring with characteristic 0 and the same as the ordinary characteristic, if the ordinary characteristic is prime. This concept is useful to simplify some theorem statements. This file establishes a few basic results relating it to the (ordinary characteristic). The definition is stated for a semiring, but the actual results are for nontrivial rings (as far as exponential characteristic one is concerned), respectively a ring without zero-divisors (for prime characteristic).

      class inductive ExpChar (R : Type u_1) [AddMonoidWithOne R] :
      ℕ → Prop

      The definition of the exponential characteristic of a semiring.

      Instances
        instance expChar_prime (R : Type u_1) [AddMonoidWithOne R] (p : ℕ) [CharP R p] [Fact (Nat.Prime p)] :
        instance expChar_one (R : Type u_1) [AddMonoidWithOne R] [CharZero R] :
        theorem expChar_ne_zero (R : Type u_1) [AddMonoidWithOne R] (p : ℕ) [hR : ExpChar R p] :
        p ≠ 0
        theorem ExpChar.eq {R : Type u_1} [AddMonoidWithOne R] {p q : ℕ} (hp : ExpChar R p) (hq : ExpChar R q) :
        p = q

        The exponential characteristic is unique.

        theorem ExpChar.congr (R : Type u_1) [AddMonoidWithOne R] {p : ℕ} (q : ℕ) [hq : ExpChar R q] (h : q = p) :
        theorem expChar_one_of_char_zero (R : Type u_1) [AddMonoidWithOne R] (q : ℕ) [hp : CharP R 0] [hq : ExpChar R q] :
        q = 1

        The exponential characteristic is one if the characteristic is zero.

        theorem char_eq_expChar_iff (R : Type u_1) [AddMonoidWithOne R] (p q : ℕ) [hp : CharP R p] [hq : ExpChar R q] :

        The characteristic equals the exponential characteristic iff the former is prime.

        theorem expChar_is_prime_or_one (R : Type u_1) [AddMonoidWithOne R] (q : ℕ) [hq : ExpChar R q] :

        The exponential characteristic is a prime number or one. See also CharP.char_is_prime_or_zero.

        theorem expChar_pos (R : Type u_1) [AddMonoidWithOne R] (q : ℕ) [ExpChar R q] :
        0 < q

        The exponential characteristic is positive.

        theorem expChar_pow_pos (R : Type u_1) [AddMonoidWithOne R] (q : ℕ) [ExpChar R q] (n : ℕ) :
        0 < q ^ n

        Any power of the exponential characteristic is positive.

        noncomputable def ringExpChar (R : Type u_1) [NonAssocSemiring R] :

        Noncomputable function that outputs the unique exponential characteristic of a semiring.

        Equations
        Instances For
          theorem ringExpChar.eq (R : Type u_1) [NonAssocSemiring R] (q : ℕ) [h : ExpChar R q] :
          @[simp]
          theorem char_zero_of_expChar_one (R : Type u_1) [NonAssocSemiring R] [Nontrivial R] (p : ℕ) [hp : CharP R p] [hq : ExpChar R 1] :
          p = 0

          The exponential characteristic is one if the characteristic is zero.

          The characteristic is zero if the exponential characteristic is one.

          theorem expChar_one_iff_char_zero (R : Type u_1) [NonAssocSemiring R] [Nontrivial R] (p q : ℕ) [CharP R p] [ExpChar R q] :
          q = 1 ↔ p = 0

          The exponential characteristic is one iff the characteristic is zero.

          theorem ExpChar.exists (R : Type u_1) [Ring R] [IsDomain R] :
          theorem ExpChar.exists_unique (R : Type u_1) [Ring R] [IsDomain R] :
          theorem ringExpChar.of_eq {R : Type u_1} [Ring R] [IsDomain R] {q : ℕ} (h : ringExpChar R = q) :
          theorem ringExpChar.eq_iff {R : Type u_1} [Ring R] [IsDomain R] {q : ℕ} :