Skip to content

Commit

Permalink
feat(Algebra/CharP/*): add RingHom.(charP|expChar)[_iff] (#10574)
Browse files Browse the repository at this point in the history
similar to `RingHom.charZero[_iff]`
  • Loading branch information
acmepjz authored and dagurtomas committed Mar 22, 2024
1 parent 1ab553e commit b176891
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
21 changes: 17 additions & 4 deletions Mathlib/Algebra/CharP/Algebra.lean
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ Instances constructed from this result:


/-- If a ring homomorphism `R →+* A` is injective then `A` has the same characteristic as `R`. -/
theorem charP_of_injective_ringHom {R A : Type*} [Semiring R] [Semiring A] {f : R →+* A}
(h : Function.Injective f) (p : ℕ) [CharP R p] : CharP A p where
theorem charP_of_injective_ringHom {R A : Type*} [NonAssocSemiring R] [NonAssocSemiring A]
{f : R →+* A} (h : Function.Injective f) (p : ℕ) [CharP R p] : CharP A p where
cast_eq_zero_iff' x := by
rw [← CharP.cast_eq_zero_iff R p x, ← map_natCast f x, map_eq_zero_iff f h]

Expand All @@ -49,8 +49,8 @@ theorem charP_of_injective_algebraMap' (R A : Type*) [Field R] [Semiring A] [Alg

/-- If a ring homomorphism `R →+* A` is injective and `R` has characteristic zero
then so does `A`. -/
theorem charZero_of_injective_ringHom {R A : Type*} [Semiring R] [Semiring A] {f : R →+* A}
(h : Function.Injective f) [CharZero R] : CharZero A where
theorem charZero_of_injective_ringHom {R A : Type*} [NonAssocSemiring R] [NonAssocSemiring A]
{f : R →+* A} (h : Function.Injective f) [CharZero R] : CharZero A where
cast_injective _ _ _ := CharZero.cast_injective <| h <| by simpa only [map_natCast f]

/-- If the algebra map `R →+* A` is injective and `R` has characteristic zero then so does `A`. -/
Expand All @@ -59,6 +59,19 @@ theorem charZero_of_injective_algebraMap {R A : Type*} [CommSemiring R] [Semirin
charZero_of_injective_ringHom h
#align char_zero_of_injective_algebra_map charZero_of_injective_algebraMap

/-- If `R →+* A` is injective, and `A` is of characteristic `p`, then `R` is also of
characteristic `p`. Similar to `RingHom.charZero`. -/
theorem RingHom.charP {R A : Type*} [NonAssocSemiring R] [NonAssocSemiring A] (f : R →+* A)
(H : Function.Injective f) (p : ℕ) [CharP A p] : CharP R p := by
obtain ⟨q, h⟩ := CharP.exists R
exact CharP.eq _ (charP_of_injective_ringHom H q) ‹CharP A p› ▸ h

/-- If `R →+* A` is injective, then `R` is of characteristic `p` if and only if `A` is also of
characteristic `p`. Similar to `RingHom.charZero_iff`. -/
theorem RingHom.charP_iff {R A : Type*} [NonAssocSemiring R] [NonAssocSemiring A] (f : R →+* A)
(H : Function.Injective f) (p : ℕ) : CharP R p ↔ CharP A p :=
fun _ ↦ charP_of_injective_ringHom H p, fun _ ↦ f.charP H p⟩

/-!
As an application, a `ℚ`-algebra has characteristic zero.
-/
Expand Down
14 changes: 14 additions & 0 deletions Mathlib/Algebra/CharP/ExpChar.lean
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,20 @@ theorem expChar_of_injective_ringHom {R A : Type*}
· haveI := charZero_of_injective_ringHom h; exact .zero
haveI := charP_of_injective_ringHom h q; exact .prime hprime

/-- If `R →+* A` is injective, and `A` is of exponential characteristic `p`, then `R` is also of
exponential characteristic `p`. Similar to `RingHom.charZero`. -/
theorem RingHom.expChar {R A : Type*} [Semiring R] [Semiring A] (f : R →+* A)
(H : Function.Injective f) (p : ℕ) [ExpChar A p] : ExpChar R p := by
cases ‹ExpChar A p› with
| zero => haveI := f.charZero; exact .zero
| prime hp => haveI := f.charP H p; exact .prime hp

/-- If `R →+* A` is injective, then `R` is of exponential characteristic `p` if and only if `A` is
also of exponential characteristic `p`. Similar to `RingHom.charZero_iff`. -/
theorem RingHom.expChar_iff {R A : Type*} [Semiring R] [Semiring A] (f : R →+* A)
(H : Function.Injective f) (p : ℕ) : ExpChar R p ↔ ExpChar A p :=
fun _ ↦ expChar_of_injective_ringHom H p, fun _ ↦ f.expChar H p⟩

/-- If the algebra map `R →+* A` is injective then `A` has the same exponential characteristic
as `R`. -/
theorem expChar_of_injective_algebraMap {R A : Type*}
Expand Down

0 comments on commit b176891

Please sign in to comment.