algebra.char_p.exp_charMathlib.Algebra.CharP.ExpChar

This file has been ported!

Changes since the initial port

The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.

Changes in mathlib3

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -66,7 +66,7 @@ theorem char_eq_expChar_iff (p q : ℕ) [hp : CharP R p] [hq : ExpChar R q] : p
     · rintro rfl
       exact one_ne_zero (hp.eq R (CharP.ofCharZero R))
     · intro pprime
-      rw [(CharP.eq R hp inferInstance : p = 0)] at pprime 
+      rw [(CharP.eq R hp inferInstance : p = 0)] at pprime
       exact Nat.not_prime_zero pprime
   · exact ⟨fun hpq => hpq.symm ▸ hq_prime, fun _ => CharP.eq R hp hq_hchar⟩
 #align char_eq_exp_char_iff char_eq_expChar_iff
@@ -136,7 +136,7 @@ theorem expChar_is_prime_or_one (q : ℕ) [hq : ExpChar R q] : Nat.Prime q ∨ q
       contradiction
     have p_eq_q : p = q := (char_eq_expChar_iff R p q).mpr (char_prime_of_ne_zero R p_ne_zero)
     cases' CharP.char_is_prime_or_zero R p with pprime
-    · rwa [p_eq_q] at pprime 
+    · rwa [p_eq_q] at pprime
     · contradiction
 #align exp_char_is_prime_or_one expChar_is_prime_or_one
 -/
Diff
@@ -126,7 +126,7 @@ theorem char_prime_of_ne_zero {p : ℕ} [hp : CharP R p] (p_ne_zero : p ≠ 0) :
 #print expChar_is_prime_or_one /-
 /-- The exponential characteristic is a prime number or one. -/
 theorem expChar_is_prime_or_one (q : ℕ) [hq : ExpChar R q] : Nat.Prime q ∨ q = 1 :=
-  or_iff_not_imp_right.mpr fun h =>
+  Classical.or_iff_not_imp_right.mpr fun h =>
     by
     cases' CharP.exists R with p hp
     have p_ne_zero : p ≠ 0 := by
Diff
@@ -3,8 +3,8 @@ Copyright (c) 2021 Jakob Scholbach. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jakob Scholbach
 -/
-import Mathbin.Algebra.CharP.Basic
-import Mathbin.Data.Nat.Prime
+import Algebra.CharP.Basic
+import Data.Nat.Prime
 
 #align_import algebra.char_p.exp_char from "leanprover-community/mathlib"@"932872382355f00112641d305ba0619305dc8642"
 
Diff
@@ -2,15 +2,12 @@
 Copyright (c) 2021 Jakob Scholbach. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jakob Scholbach
-
-! This file was ported from Lean 3 source module algebra.char_p.exp_char
-! leanprover-community/mathlib commit 932872382355f00112641d305ba0619305dc8642
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Algebra.CharP.Basic
 import Mathbin.Data.Nat.Prime
 
+#align_import algebra.char_p.exp_char from "leanprover-community/mathlib"@"932872382355f00112641d305ba0619305dc8642"
+
 /-!
 # Exponential characteristic
 
Diff
@@ -116,6 +116,7 @@ section NoZeroDivisors
 
 variable [NoZeroDivisors R]
 
+#print char_prime_of_ne_zero /-
 /-- A helper lemma: the characteristic is prime if it is non-zero. -/
 theorem char_prime_of_ne_zero {p : ℕ} [hp : CharP R p] (p_ne_zero : p ≠ 0) : Nat.Prime p :=
   by
@@ -123,7 +124,9 @@ theorem char_prime_of_ne_zero {p : ℕ} [hp : CharP R p] (p_ne_zero : p ≠ 0) :
   · exact h
   · contradiction
 #align char_prime_of_ne_zero char_prime_of_ne_zero
+-/
 
+#print expChar_is_prime_or_one /-
 /-- The exponential characteristic is a prime number or one. -/
 theorem expChar_is_prime_or_one (q : ℕ) [hq : ExpChar R q] : Nat.Prime q ∨ q = 1 :=
   or_iff_not_imp_right.mpr fun h =>
@@ -139,6 +142,7 @@ theorem expChar_is_prime_or_one (q : ℕ) [hq : ExpChar R q] : Nat.Prime q ∨ q
     · rwa [p_eq_q] at pprime 
     · contradiction
 #align exp_char_is_prime_or_one expChar_is_prime_or_one
+-/
 
 end NoZeroDivisors
 
Diff
@@ -69,7 +69,7 @@ theorem char_eq_expChar_iff (p q : ℕ) [hp : CharP R p] [hq : ExpChar R q] : p
     · rintro rfl
       exact one_ne_zero (hp.eq R (CharP.ofCharZero R))
     · intro pprime
-      rw [(CharP.eq R hp inferInstance : p = 0)] at pprime
+      rw [(CharP.eq R hp inferInstance : p = 0)] at pprime 
       exact Nat.not_prime_zero pprime
   · exact ⟨fun hpq => hpq.symm ▸ hq_prime, fun _ => CharP.eq R hp hq_hchar⟩
 #align char_eq_exp_char_iff char_eq_expChar_iff
@@ -136,7 +136,7 @@ theorem expChar_is_prime_or_one (q : ℕ) [hq : ExpChar R q] : Nat.Prime q ∨ q
       contradiction
     have p_eq_q : p = q := (char_eq_expChar_iff R p q).mpr (char_prime_of_ne_zero R p_ne_zero)
     cases' CharP.char_is_prime_or_zero R p with pprime
-    · rwa [p_eq_q] at pprime
+    · rwa [p_eq_q] at pprime 
     · contradiction
 #align exp_char_is_prime_or_one expChar_is_prime_or_one
 
Diff
@@ -116,12 +116,6 @@ section NoZeroDivisors
 
 variable [NoZeroDivisors R]
 
-/- warning: char_prime_of_ne_zero -> char_prime_of_ne_zero is a dubious translation:
-lean 3 declaration is
-  forall (R : Type.{u1}) [_inst_1 : Semiring.{u1} R] [_inst_2 : Nontrivial.{u1} R] [_inst_3 : NoZeroDivisors.{u1} R (Distrib.toHasMul.{u1} R (NonUnitalNonAssocSemiring.toDistrib.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R _inst_1)))) (MulZeroClass.toHasZero.{u1} R (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R _inst_1))))] {p : Nat} [hp : CharP.{u1} R (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} R (NonAssocSemiring.toAddCommMonoidWithOne.{u1} R (Semiring.toNonAssocSemiring.{u1} R _inst_1))) p], (Ne.{1} Nat p (OfNat.ofNat.{0} Nat 0 (OfNat.mk.{0} Nat 0 (Zero.zero.{0} Nat Nat.hasZero)))) -> (Nat.Prime p)
-but is expected to have type
-  forall (R : Type.{u1}) [_inst_1 : Semiring.{u1} R] [_inst_2 : Nontrivial.{u1} R] [_inst_3 : NoZeroDivisors.{u1} R (NonUnitalNonAssocSemiring.toMul.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R _inst_1))) (MonoidWithZero.toZero.{u1} R (Semiring.toMonoidWithZero.{u1} R _inst_1))] {p : Nat} [hp : CharP.{u1} R (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} R (NonAssocSemiring.toAddCommMonoidWithOne.{u1} R (Semiring.toNonAssocSemiring.{u1} R _inst_1))) p], (Ne.{1} Nat p (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) -> (Nat.Prime p)
-Case conversion may be inaccurate. Consider using '#align char_prime_of_ne_zero char_prime_of_ne_zeroₓ'. -/
 /-- A helper lemma: the characteristic is prime if it is non-zero. -/
 theorem char_prime_of_ne_zero {p : ℕ} [hp : CharP R p] (p_ne_zero : p ≠ 0) : Nat.Prime p :=
   by
@@ -130,12 +124,6 @@ theorem char_prime_of_ne_zero {p : ℕ} [hp : CharP R p] (p_ne_zero : p ≠ 0) :
   · contradiction
 #align char_prime_of_ne_zero char_prime_of_ne_zero
 
-/- warning: exp_char_is_prime_or_one -> expChar_is_prime_or_one is a dubious translation:
-lean 3 declaration is
-  forall (R : Type.{u1}) [_inst_1 : Semiring.{u1} R] [_inst_2 : Nontrivial.{u1} R] [_inst_3 : NoZeroDivisors.{u1} R (Distrib.toHasMul.{u1} R (NonUnitalNonAssocSemiring.toDistrib.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R _inst_1)))) (MulZeroClass.toHasZero.{u1} R (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R _inst_1))))] (q : Nat) [hq : ExpChar.{u1} R _inst_1 q], Or (Nat.Prime q) (Eq.{1} Nat q (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))
-but is expected to have type
-  forall (R : Type.{u1}) [_inst_1 : Semiring.{u1} R] (_inst_2 : Nat) [_inst_3 : ExpChar.{u1} R _inst_1 _inst_2], Or (Nat.Prime _inst_2) (Eq.{1} Nat _inst_2 (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))
-Case conversion may be inaccurate. Consider using '#align exp_char_is_prime_or_one expChar_is_prime_or_oneₓ'. -/
 /-- The exponential characteristic is a prime number or one. -/
 theorem expChar_is_prime_or_one (q : ℕ) [hq : ExpChar R q] : Nat.Prime q ∨ q = 1 :=
   or_iff_not_imp_right.mpr fun h =>
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jakob Scholbach
 
 ! This file was ported from Lean 3 source module algebra.char_p.exp_char
-! leanprover-community/mathlib commit 70fd9563a21e7b963887c9360bd29b2393e6225a
+! leanprover-community/mathlib commit 932872382355f00112641d305ba0619305dc8642
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -14,6 +14,9 @@ import Mathbin.Data.Nat.Prime
 /-!
 # Exponential characteristic
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 This file defines the exponential characteristic and 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
Diff
@@ -131,7 +131,7 @@ theorem char_prime_of_ne_zero {p : ℕ} [hp : CharP R p] (p_ne_zero : p ≠ 0) :
 lean 3 declaration is
   forall (R : Type.{u1}) [_inst_1 : Semiring.{u1} R] [_inst_2 : Nontrivial.{u1} R] [_inst_3 : NoZeroDivisors.{u1} R (Distrib.toHasMul.{u1} R (NonUnitalNonAssocSemiring.toDistrib.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R _inst_1)))) (MulZeroClass.toHasZero.{u1} R (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R _inst_1))))] (q : Nat) [hq : ExpChar.{u1} R _inst_1 q], Or (Nat.Prime q) (Eq.{1} Nat q (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))
 but is expected to have type
-  forall (R : Type.{u1}) [_inst_1 : Semiring.{u1} R] [_inst_2 : Nontrivial.{u1} R] [_inst_3 : NoZeroDivisors.{u1} R (NonUnitalNonAssocSemiring.toMul.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R _inst_1))) (MonoidWithZero.toZero.{u1} R (Semiring.toMonoidWithZero.{u1} R _inst_1))] (q : Nat) [hq : ExpChar.{u1} R _inst_1 q], Or (Nat.Prime q) (Eq.{1} Nat q (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))
+  forall (R : Type.{u1}) [_inst_1 : Semiring.{u1} R] (_inst_2 : Nat) [_inst_3 : ExpChar.{u1} R _inst_1 _inst_2], Or (Nat.Prime _inst_2) (Eq.{1} Nat _inst_2 (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))
 Case conversion may be inaccurate. Consider using '#align exp_char_is_prime_or_one expChar_is_prime_or_oneₓ'. -/
 /-- The exponential characteristic is a prime number or one. -/
 theorem expChar_is_prime_or_one (q : ℕ) [hq : ExpChar R q] : Nat.Prime q ∨ q = 1 :=
Diff
@@ -39,12 +39,15 @@ section Semiring
 
 variable [Semiring R]
 
+#print ExpChar /-
 /-- The definition of the exponential characteristic of a semiring. -/
 class inductive ExpChar (R : Type u) [Semiring R] : ℕ → Prop
   | zero [CharZero R] : ExpChar 1
   | Prime {q : ℕ} (hprime : q.Prime) [hchar : CharP R q] : ExpChar q
 #align exp_char ExpChar
+-/
 
+#print expChar_one_of_char_zero /-
 /-- The exponential characteristic is one if the characteristic is zero. -/
 theorem expChar_one_of_char_zero (q : ℕ) [hp : CharP R 0] [hq : ExpChar R q] : q = 1 :=
   by
@@ -52,7 +55,9 @@ theorem expChar_one_of_char_zero (q : ℕ) [hp : CharP R 0] [hq : ExpChar R q] :
   · rfl
   · exact False.elim (lt_irrefl _ ((hp.eq R hq_hchar).symm ▸ hq_prime : (0 : ℕ).Prime).Pos)
 #align exp_char_one_of_char_zero expChar_one_of_char_zero
+-/
 
+#print char_eq_expChar_iff /-
 /-- The characteristic equals the exponential characteristic iff the former is prime. -/
 theorem char_eq_expChar_iff (p q : ℕ) [hp : CharP R p] [hq : ExpChar R q] : p = q ↔ p.Prime :=
   by
@@ -65,11 +70,13 @@ theorem char_eq_expChar_iff (p q : ℕ) [hp : CharP R p] [hq : ExpChar R q] : p
       exact Nat.not_prime_zero pprime
   · exact ⟨fun hpq => hpq.symm ▸ hq_prime, fun _ => CharP.eq R hp hq_hchar⟩
 #align char_eq_exp_char_iff char_eq_expChar_iff
+-/
 
 section Nontrivial
 
 variable [Nontrivial R]
 
+#print char_zero_of_expChar_one /-
 /-- The exponential characteristic is one if the characteristic is zero. -/
 theorem char_zero_of_expChar_one (p : ℕ) [hp : CharP R p] [hq : ExpChar R 1] : p = 0 :=
   by
@@ -77,7 +84,9 @@ theorem char_zero_of_expChar_one (p : ℕ) [hp : CharP R p] [hq : ExpChar R 1] :
   · exact CharP.eq R hp inferInstance
   · exact False.elim (CharP.char_ne_one R 1 rfl)
 #align char_zero_of_exp_char_one char_zero_of_expChar_one
+-/
 
+#print charZero_of_expChar_one' /-
 -- see Note [lower instance priority]
 /-- The characteristic is zero if the exponential characteristic is one. -/
 instance (priority := 100) charZero_of_expChar_one' [hq : ExpChar R 1] : CharZero R :=
@@ -86,7 +95,9 @@ instance (priority := 100) charZero_of_expChar_one' [hq : ExpChar R 1] : CharZer
   · assumption
   · exact False.elim (CharP.char_ne_one R 1 rfl)
 #align char_zero_of_exp_char_one' charZero_of_expChar_one'
+-/
 
+#print expChar_one_iff_char_zero /-
 /-- The exponential characteristic is one iff the characteristic is zero. -/
 theorem expChar_one_iff_char_zero (p q : ℕ) [CharP R p] [ExpChar R q] : q = 1 ↔ p = 0 :=
   by
@@ -96,11 +107,18 @@ theorem expChar_one_iff_char_zero (p q : ℕ) [CharP R p] [ExpChar R q] : q = 1
   · rintro rfl
     exact expChar_one_of_char_zero R q
 #align exp_char_one_iff_char_zero expChar_one_iff_char_zero
+-/
 
 section NoZeroDivisors
 
 variable [NoZeroDivisors R]
 
+/- warning: char_prime_of_ne_zero -> char_prime_of_ne_zero is a dubious translation:
+lean 3 declaration is
+  forall (R : Type.{u1}) [_inst_1 : Semiring.{u1} R] [_inst_2 : Nontrivial.{u1} R] [_inst_3 : NoZeroDivisors.{u1} R (Distrib.toHasMul.{u1} R (NonUnitalNonAssocSemiring.toDistrib.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R _inst_1)))) (MulZeroClass.toHasZero.{u1} R (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R _inst_1))))] {p : Nat} [hp : CharP.{u1} R (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} R (NonAssocSemiring.toAddCommMonoidWithOne.{u1} R (Semiring.toNonAssocSemiring.{u1} R _inst_1))) p], (Ne.{1} Nat p (OfNat.ofNat.{0} Nat 0 (OfNat.mk.{0} Nat 0 (Zero.zero.{0} Nat Nat.hasZero)))) -> (Nat.Prime p)
+but is expected to have type
+  forall (R : Type.{u1}) [_inst_1 : Semiring.{u1} R] [_inst_2 : Nontrivial.{u1} R] [_inst_3 : NoZeroDivisors.{u1} R (NonUnitalNonAssocSemiring.toMul.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R _inst_1))) (MonoidWithZero.toZero.{u1} R (Semiring.toMonoidWithZero.{u1} R _inst_1))] {p : Nat} [hp : CharP.{u1} R (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} R (NonAssocSemiring.toAddCommMonoidWithOne.{u1} R (Semiring.toNonAssocSemiring.{u1} R _inst_1))) p], (Ne.{1} Nat p (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) -> (Nat.Prime p)
+Case conversion may be inaccurate. Consider using '#align char_prime_of_ne_zero char_prime_of_ne_zeroₓ'. -/
 /-- A helper lemma: the characteristic is prime if it is non-zero. -/
 theorem char_prime_of_ne_zero {p : ℕ} [hp : CharP R p] (p_ne_zero : p ≠ 0) : Nat.Prime p :=
   by
@@ -109,6 +127,12 @@ theorem char_prime_of_ne_zero {p : ℕ} [hp : CharP R p] (p_ne_zero : p ≠ 0) :
   · contradiction
 #align char_prime_of_ne_zero char_prime_of_ne_zero
 
+/- warning: exp_char_is_prime_or_one -> expChar_is_prime_or_one is a dubious translation:
+lean 3 declaration is
+  forall (R : Type.{u1}) [_inst_1 : Semiring.{u1} R] [_inst_2 : Nontrivial.{u1} R] [_inst_3 : NoZeroDivisors.{u1} R (Distrib.toHasMul.{u1} R (NonUnitalNonAssocSemiring.toDistrib.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R _inst_1)))) (MulZeroClass.toHasZero.{u1} R (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R _inst_1))))] (q : Nat) [hq : ExpChar.{u1} R _inst_1 q], Or (Nat.Prime q) (Eq.{1} Nat q (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))
+but is expected to have type
+  forall (R : Type.{u1}) [_inst_1 : Semiring.{u1} R] [_inst_2 : Nontrivial.{u1} R] [_inst_3 : NoZeroDivisors.{u1} R (NonUnitalNonAssocSemiring.toMul.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R _inst_1))) (MonoidWithZero.toZero.{u1} R (Semiring.toMonoidWithZero.{u1} R _inst_1))] (q : Nat) [hq : ExpChar.{u1} R _inst_1 q], Or (Nat.Prime q) (Eq.{1} Nat q (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))
+Case conversion may be inaccurate. Consider using '#align exp_char_is_prime_or_one expChar_is_prime_or_oneₓ'. -/
 /-- The exponential characteristic is a prime number or one. -/
 theorem expChar_is_prime_or_one (q : ℕ) [hq : ExpChar R q] : Nat.Prime q ∨ q = 1 :=
   or_iff_not_imp_right.mpr fun h =>
Diff
@@ -59,7 +59,7 @@ theorem char_eq_expChar_iff (p q : ℕ) [hp : CharP R p] [hq : ExpChar R q] : p
   cases' hq with q hq_one hq_prime
   · apply iff_of_false
     · rintro rfl
-      exact one_ne_zero (hp.eq R (CharP.of_charZero R))
+      exact one_ne_zero (hp.eq R (CharP.ofCharZero R))
     · intro pprime
       rw [(CharP.eq R hp inferInstance : p = 0)] at pprime
       exact Nat.not_prime_zero pprime

Changes in mathlib4

mathlib3
mathlib4
chore: Rename nat_cast/int_cast/rat_cast to natCast/intCast/ratCast (#11486)

Now that I am defining NNRat.cast, I want a definitive answer to this naming issue. Plenty of lemmas in mathlib already use natCast/intCast/ratCast over nat_cast/int_cast/rat_cast, and this matches with the general expectation that underscore-separated name parts correspond to a single declaration.

Diff
@@ -397,9 +397,9 @@ theorem frobenius_add : frobenius R p (x + y) = frobenius R p x + frobenius R p
   (frobenius R p).map_add x y
 #align frobenius_add frobenius_add
 
-theorem frobenius_nat_cast (n : ℕ) : frobenius R p n = n :=
+theorem frobenius_natCast (n : ℕ) : frobenius R p n = n :=
   map_natCast (frobenius R p) n
-#align frobenius_nat_cast frobenius_nat_cast
+#align frobenius_nat_cast frobenius_natCast
 
 open BigOperators
 
chore(Algebra/BigOperators): delete RingHom.map_* lemmas (#11663)
Diff
@@ -335,7 +335,7 @@ theorem coe_iterateFrobenius_mul : iterateFrobenius R p (m * n) = (iterateFroben
 variable {R}
 
 theorem frobenius_mul : frobenius R p (x * y) = frobenius R p x * frobenius R p y :=
-  (frobenius R p).map_mul x y
+  map_mul (frobenius R p) x y
 #align frobenius_mul frobenius_mul
 
 theorem frobenius_one : frobenius R p 1 = 1 :=
@@ -343,11 +343,11 @@ theorem frobenius_one : frobenius R p 1 = 1 :=
 #align frobenius_one frobenius_one
 
 theorem MonoidHom.map_frobenius : f (frobenius R p x) = frobenius S p (f x) :=
-  f.map_pow x p
+  map_pow f x p
 #align monoid_hom.map_frobenius MonoidHom.map_frobenius
 
 theorem RingHom.map_frobenius : g (frobenius R p x) = frobenius S p (g x) :=
-  g.map_pow x p
+  map_pow g x p
 #align ring_hom.map_frobenius RingHom.map_frobenius
 
 theorem MonoidHom.map_iterate_frobenius (n : ℕ) :
@@ -406,30 +406,30 @@ open BigOperators
 variable {R}
 
 theorem list_sum_pow_char (l : List R) : l.sum ^ p = (l.map (· ^ p : R → R)).sum :=
-  (frobenius R p).map_list_sum _
+  map_list_sum (frobenius R p) _
 #align list_sum_pow_char list_sum_pow_char
 
 theorem multiset_sum_pow_char (s : Multiset R) : s.sum ^ p = (s.map (· ^ p : R → R)).sum :=
-  (frobenius R p).map_multiset_sum _
+  map_multiset_sum (frobenius R p) _
 #align multiset_sum_pow_char multiset_sum_pow_char
 
 theorem sum_pow_char {ι : Type*} (s : Finset ι) (f : ι → R) :
     (∑ i in s, f i) ^ p = ∑ i in s, f i ^ p :=
-  (frobenius R p).map_sum _ _
+  map_sum (frobenius R p) _ _
 #align sum_pow_char sum_pow_char
 
 variable (n : ℕ)
 
 theorem list_sum_pow_char_pow (l : List R) : l.sum ^ p ^ n = (l.map (· ^ p ^ n : R → R)).sum :=
-  (iterateFrobenius R p n).map_list_sum _
+  map_list_sum (iterateFrobenius R p n) _
 
 theorem multiset_sum_pow_char_pow (s : Multiset R) :
     s.sum ^ p ^ n = (s.map (· ^ p ^ n : R → R)).sum :=
-  (iterateFrobenius R p n).map_multiset_sum _
+  map_multiset_sum (iterateFrobenius R p n) _
 
 theorem sum_pow_char_pow {ι : Type*} (s : Finset ι) (f : ι → R) :
     (∑ i in s, f i) ^ p ^ n = ∑ i in s, f i ^ p ^ n :=
-  (iterateFrobenius R p n).map_sum _ _
+  map_sum (iterateFrobenius R p n) _ _
 
 end CommSemiring
 
@@ -438,11 +438,11 @@ section CommRing
 variable [CommRing R] (p : ℕ) [ExpChar R p] (x y : R)
 
 theorem frobenius_neg : frobenius R p (-x) = -frobenius R p x :=
-  (frobenius R p).map_neg x
+  map_neg ..
 #align frobenius_neg frobenius_neg
 
 theorem frobenius_sub : frobenius R p (x - y) = frobenius R p x - frobenius R p y :=
-  (frobenius R p).map_sub x y
+  map_sub ..
 #align frobenius_sub frobenius_sub
 
 end CommRing
refactor(Algebra/GroupPower/IterateHom): Use HomClass to generalize map_iterate statements (#11266)

This PR uses the HomClass architecture to generalize the map_iterate statements in Algebra/GroupPower/IterateHom.lean.

Diff
@@ -362,12 +362,12 @@ theorem RingHom.map_iterate_frobenius (n : ℕ) :
 
 theorem MonoidHom.iterate_map_frobenius (f : R →* R) (p : ℕ) [ExpChar R p] (n : ℕ) :
     f^[n] (frobenius R p x) = frobenius R p (f^[n] x) :=
-  f.iterate_map_pow _ _ _
+  iterate_map_pow f _ _ _
 #align monoid_hom.iterate_map_frobenius MonoidHom.iterate_map_frobenius
 
 theorem RingHom.iterate_map_frobenius (f : R →+* R) (p : ℕ) [ExpChar R p] (n : ℕ) :
     f^[n] (frobenius R p x) = frobenius R p (f^[n] x) :=
-  f.iterate_map_pow _ _ _
+  iterate_map_pow f _ _ _
 #align ring_hom.iterate_map_frobenius RingHom.iterate_map_frobenius
 
 variable (R S)
feat(Algebra/CharP/*): add RingHom.(charP|expChar)[_iff] (#10574)

similar to RingHom.charZero[_iff]

Diff
@@ -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*}
feat(FieldTheory/Perfect): add various convenient lemmas for iterateFrobenius[Equiv] (#10405)
Diff
@@ -289,23 +289,35 @@ variable (R)
 theorem coe_iterateFrobenius : iterateFrobenius R p n = (frobenius R p)^[n] :=
   (pow_iterate p n).symm
 
+theorem iterateFrobenius_one_apply : iterateFrobenius R p 1 x = x ^ p := by
+  rw [iterateFrobenius_def, pow_one]
+
 @[simp]
-theorem iterateFrobenius_one : iterateFrobenius R p 1 = frobenius R p := by
-  simp_rw [iterateFrobenius, frobenius, pow_one]
+theorem iterateFrobenius_one : iterateFrobenius R p 1 = frobenius R p :=
+  RingHom.ext (iterateFrobenius_one_apply R p)
+
+theorem iterateFrobenius_zero_apply : iterateFrobenius R p 0 x = x := by
+  rw [iterateFrobenius_def, pow_zero, pow_one]
 
 @[simp]
-theorem iterateFrobenius_zero : iterateFrobenius R p 0 = RingHom.id R := by
-  simp_rw [iterateFrobenius, powMonoidHom, pow_zero, pow_one]
-  rfl
+theorem iterateFrobenius_zero : iterateFrobenius R p 0 = RingHom.id R :=
+  RingHom.ext (iterateFrobenius_zero_apply R p)
+
+theorem iterateFrobenius_add_apply :
+    iterateFrobenius R p (m + n) x = iterateFrobenius R p m (iterateFrobenius R p n x) := by
+  simp_rw [iterateFrobenius_def, add_comm m n, pow_add, pow_mul]
 
 theorem iterateFrobenius_add :
-    iterateFrobenius R p (m + n) = (iterateFrobenius R p m).comp (iterateFrobenius R p n) := by
-  ext x
-  simp_rw [RingHom.comp_apply, iterateFrobenius_def, add_comm m n, pow_add, pow_mul]
+    iterateFrobenius R p (m + n) = (iterateFrobenius R p m).comp (iterateFrobenius R p n) :=
+  RingHom.ext (iterateFrobenius_add_apply R p m n)
 
-theorem coe_iterateFrobenius_mul : iterateFrobenius R p (m * n) = (iterateFrobenius R p m)^[n] := by
+theorem iterateFrobenius_mul_apply :
+    iterateFrobenius R p (m * n) x = (iterateFrobenius R p m)^[n] x := by
   simp_rw [coe_iterateFrobenius, Function.iterate_mul]
 
+theorem coe_iterateFrobenius_mul : iterateFrobenius R p (m * n) = (iterateFrobenius R p m)^[n] :=
+  funext (iterateFrobenius_mul_apply R p m n)
+
 variable {R}
 
 theorem frobenius_mul : frobenius R p (x * y) = frobenius R p x * frobenius R p y :=
refactor: generalize CharP+Prime to ExpChar in frobenius (#10016)

Consequently, the part about frobenius in Algebra/CharP/Basic is moved to CharP/ExpChar, and imports are adjusted as necessary.

  • Add instances from CharP+Fact(Nat.Prime) and CharZero to ExpChar, to allow lemmas generalized to ExpChar still apply to CharP.

  • Remove lemmas in Algebra/CharP/ExpChar from [#9799](https://github.com/leanprover-community/mathlib4/commit/1e74fcfff8d5ffe5a3a9881864cf10fa39f619e6) because they coincide with the generalized lemmas, and golf the other lemmas (in Algebra/CharP/Basic).

  • Define the RingHom iterateFrobenius and the semilinear map LinearMap.(iterate)Frobenius for an algebra. When the characteristic is zero (ExpChar is 1), these are all equal to the identity map (· ^ 1). Also define iterateFrobeniusEquiv for perfect rings.

  • Fix and/or generalize other files.

Co-authored-by: Junyan Xu <junyanxu.math@gmail.com> Co-authored-by: acmepjz <acme_pjz@hotmail.com>

Diff
@@ -46,6 +46,16 @@ class inductive ExpChar (R : Type u) [Semiring R] : ℕ → Prop
 #align exp_char ExpChar
 #align exp_char.prime ExpChar.prime
 
+instance expChar_prime (p) [CharP R p] [Fact p.Prime] : ExpChar R p := ExpChar.prime Fact.out
+instance expChar_zero [CharZero R] : ExpChar R 1 := ExpChar.zero
+
+instance (S : Type*) [Semiring S] (p) [ExpChar R p] [ExpChar S p] : ExpChar (R × S) p := by
+  obtain hp | ⟨hp⟩ := ‹ExpChar R p›
+  · have := Prod.charZero_of_left R S; exact .zero
+  obtain _ | _ := ‹ExpChar S p›
+  · exact (Nat.not_prime_one hp).elim
+  · have := Prod.charP R S p; exact .prime hp
+
 variable {R} in
 /-- The exponential characteristic is unique. -/
 theorem ExpChar.eq {p q : ℕ} (hp : ExpChar R p) (hq : ExpChar R q) : p = q := by
@@ -244,46 +254,171 @@ theorem ExpChar.neg_one_pow_expChar_pow [Ring R] (q n : ℕ) [hR : ExpChar R q]
   · simp only [one_pow, pow_one]
   haveI := Fact.mk hprime; exact CharP.neg_one_pow_char_pow R q n
 
-section BigOperators
+section frobenius
+
+section CommSemiring
+
+variable [CommSemiring R] {S : Type*} [CommSemiring S] (f : R →* S) (g : R →+* S) (p m n : ℕ)
+  [ExpChar R p] [ExpChar S p] (x y : R)
+
+/-- The frobenius map that sends x to x^p -/
+def frobenius : R →+* R where
+  __ := powMonoidHom p
+  map_zero' := zero_pow (expChar_pos R p).ne'
+  map_add' := add_pow_expChar R
+#align frobenius frobenius
+
+/-- The iterated frobenius map sending x to x^p^n -/
+def iterateFrobenius : R →+* R where
+  __ := powMonoidHom (p ^ n)
+  map_zero' := zero_pow (expChar_pow_pos R p n).ne'
+  map_add' := add_pow_expChar_pow R
+
+variable {R}
+
+theorem frobenius_def : frobenius R p x = x ^ p := rfl
+#align frobenius_def frobenius_def
+
+theorem iterateFrobenius_def : iterateFrobenius R p n x = x ^ p ^ n := rfl
+
+theorem iterate_frobenius : (frobenius R p)^[n] x = x ^ p ^ n := congr_fun (pow_iterate p n) x
+#align iterate_frobenius iterate_frobenius
+
+variable (R)
+
+theorem coe_iterateFrobenius : iterateFrobenius R p n = (frobenius R p)^[n] :=
+  (pow_iterate p n).symm
+
+@[simp]
+theorem iterateFrobenius_one : iterateFrobenius R p 1 = frobenius R p := by
+  simp_rw [iterateFrobenius, frobenius, pow_one]
+
+@[simp]
+theorem iterateFrobenius_zero : iterateFrobenius R p 0 = RingHom.id R := by
+  simp_rw [iterateFrobenius, powMonoidHom, pow_zero, pow_one]
+  rfl
+
+theorem iterateFrobenius_add :
+    iterateFrobenius R p (m + n) = (iterateFrobenius R p m).comp (iterateFrobenius R p n) := by
+  ext x
+  simp_rw [RingHom.comp_apply, iterateFrobenius_def, add_comm m n, pow_add, pow_mul]
+
+theorem coe_iterateFrobenius_mul : iterateFrobenius R p (m * n) = (iterateFrobenius R p m)^[n] := by
+  simp_rw [coe_iterateFrobenius, Function.iterate_mul]
+
+variable {R}
+
+theorem frobenius_mul : frobenius R p (x * y) = frobenius R p x * frobenius R p y :=
+  (frobenius R p).map_mul x y
+#align frobenius_mul frobenius_mul
+
+theorem frobenius_one : frobenius R p 1 = 1 :=
+  one_pow _
+#align frobenius_one frobenius_one
+
+theorem MonoidHom.map_frobenius : f (frobenius R p x) = frobenius S p (f x) :=
+  f.map_pow x p
+#align monoid_hom.map_frobenius MonoidHom.map_frobenius
+
+theorem RingHom.map_frobenius : g (frobenius R p x) = frobenius S p (g x) :=
+  g.map_pow x p
+#align ring_hom.map_frobenius RingHom.map_frobenius
+
+theorem MonoidHom.map_iterate_frobenius (n : ℕ) :
+    f ((frobenius R p)^[n] x) = (frobenius S p)^[n] (f x) :=
+  Function.Semiconj.iterate_right (f.map_frobenius p) n x
+#align monoid_hom.map_iterate_frobenius MonoidHom.map_iterate_frobenius
+
+theorem RingHom.map_iterate_frobenius (n : ℕ) :
+    g ((frobenius R p)^[n] x) = (frobenius S p)^[n] (g x) :=
+  g.toMonoidHom.map_iterate_frobenius p x n
+#align ring_hom.map_iterate_frobenius RingHom.map_iterate_frobenius
+
+theorem MonoidHom.iterate_map_frobenius (f : R →* R) (p : ℕ) [ExpChar R p] (n : ℕ) :
+    f^[n] (frobenius R p x) = frobenius R p (f^[n] x) :=
+  f.iterate_map_pow _ _ _
+#align monoid_hom.iterate_map_frobenius MonoidHom.iterate_map_frobenius
+
+theorem RingHom.iterate_map_frobenius (f : R →+* R) (p : ℕ) [ExpChar R p] (n : ℕ) :
+    f^[n] (frobenius R p x) = frobenius R p (f^[n] x) :=
+  f.iterate_map_pow _ _ _
+#align ring_hom.iterate_map_frobenius RingHom.iterate_map_frobenius
+
+variable (R S)
+
+/-- The frobenius map of an algebra as a frobenius-semilinear map. -/
+nonrec def LinearMap.frobenius [Algebra R S] : S →ₛₗ[frobenius R p] S where
+  __ := frobenius S p
+  map_smul' r s := show frobenius S p _ = _ by
+    simp_rw [Algebra.smul_def, map_mul, ← (algebraMap R S).map_frobenius]; rfl
+
+/-- The iterated frobenius map of an algebra as a iterated-frobenius-semilinear map. -/
+nonrec def LinearMap.iterateFrobenius [Algebra R S] : S →ₛₗ[iterateFrobenius R p n] S where
+  __ := iterateFrobenius S p n
+  map_smul' f s := show iterateFrobenius S p n _ = _ by
+    simp_rw [iterateFrobenius_def, Algebra.smul_def, mul_pow, ← map_pow]; rfl
+
+theorem LinearMap.frobenius_def [Algebra R S] (x : S) : frobenius R S p x = x ^ p := rfl
+
+theorem LinearMap.iterateFrobenius_def [Algebra R S] (n : ℕ) (x : S) :
+    iterateFrobenius R S p n x = x ^ p ^ n := rfl
+
+theorem frobenius_zero : frobenius R p 0 = 0 :=
+  (frobenius R p).map_zero
+#align frobenius_zero frobenius_zero
+
+theorem frobenius_add : frobenius R p (x + y) = frobenius R p x + frobenius R p y :=
+  (frobenius R p).map_add x y
+#align frobenius_add frobenius_add
+
+theorem frobenius_nat_cast (n : ℕ) : frobenius R p n = n :=
+  map_natCast (frobenius R p) n
+#align frobenius_nat_cast frobenius_nat_cast
 
 open BigOperators
 
 variable {R}
 
-variable [CommSemiring R] (q : ℕ) [hR : ExpChar R q] (n : ℕ)
-
-theorem list_sum_pow_expChar (l : List R) : l.sum ^ q = (l.map (· ^ q : R → R)).sum := by
-  cases hR with
-  | zero => simp_rw [pow_one, List.map_id']
-  | prime hprime => haveI := Fact.mk hprime; exact list_sum_pow_char q l
-
-theorem multiset_sum_pow_expChar (s : Multiset R) : s.sum ^ q = (s.map (· ^ q : R → R)).sum := by
-  cases hR with
-  | zero => simp_rw [pow_one, Multiset.map_id']
-  | prime hprime => haveI := Fact.mk hprime; exact multiset_sum_pow_char q s
-
-theorem sum_pow_expChar {ι : Type*} (s : Finset ι) (f : ι → R) :
-    (∑ i in s, f i) ^ q = ∑ i in s, f i ^ q := by
-  cases hR with
-  | zero => simp_rw [pow_one]
-  | prime hprime => haveI := Fact.mk hprime; exact sum_pow_char q s f
-
-theorem list_sum_pow_expChar_pow (l : List R) :
-    l.sum ^ q ^ n = (l.map (· ^ q ^ n : R → R)).sum := by
-  cases hR with
-  | zero => simp_rw [one_pow, pow_one, List.map_id']
-  | prime hprime => haveI := Fact.mk hprime; exact list_sum_pow_char_pow q n l
-
-theorem multiset_sum_pow_expChar_pow (s : Multiset R) :
-    s.sum ^ q ^ n = (s.map (· ^ q ^ n : R → R)).sum := by
-  cases hR with
-  | zero => simp_rw [one_pow, pow_one, Multiset.map_id']
-  | prime hprime => haveI := Fact.mk hprime; exact multiset_sum_pow_char_pow q n s
-
-theorem sum_pow_expChar_pow {ι : Type*} (s : Finset ι) (f : ι → R) :
-    (∑ i in s, f i) ^ q ^ n = ∑ i in s, f i ^ q ^ n := by
-  cases hR with
-  | zero => simp_rw [one_pow, pow_one]
-  | prime hprime => haveI := Fact.mk hprime; exact sum_pow_char_pow q n s f
-
-end BigOperators
+theorem list_sum_pow_char (l : List R) : l.sum ^ p = (l.map (· ^ p : R → R)).sum :=
+  (frobenius R p).map_list_sum _
+#align list_sum_pow_char list_sum_pow_char
+
+theorem multiset_sum_pow_char (s : Multiset R) : s.sum ^ p = (s.map (· ^ p : R → R)).sum :=
+  (frobenius R p).map_multiset_sum _
+#align multiset_sum_pow_char multiset_sum_pow_char
+
+theorem sum_pow_char {ι : Type*} (s : Finset ι) (f : ι → R) :
+    (∑ i in s, f i) ^ p = ∑ i in s, f i ^ p :=
+  (frobenius R p).map_sum _ _
+#align sum_pow_char sum_pow_char
+
+variable (n : ℕ)
+
+theorem list_sum_pow_char_pow (l : List R) : l.sum ^ p ^ n = (l.map (· ^ p ^ n : R → R)).sum :=
+  (iterateFrobenius R p n).map_list_sum _
+
+theorem multiset_sum_pow_char_pow (s : Multiset R) :
+    s.sum ^ p ^ n = (s.map (· ^ p ^ n : R → R)).sum :=
+  (iterateFrobenius R p n).map_multiset_sum _
+
+theorem sum_pow_char_pow {ι : Type*} (s : Finset ι) (f : ι → R) :
+    (∑ i in s, f i) ^ p ^ n = ∑ i in s, f i ^ p ^ n :=
+  (iterateFrobenius R p n).map_sum _ _
+
+end CommSemiring
+
+section CommRing
+
+variable [CommRing R] (p : ℕ) [ExpChar R p] (x y : R)
+
+theorem frobenius_neg : frobenius R p (-x) = -frobenius R p x :=
+  (frobenius R p).map_neg x
+#align frobenius_neg frobenius_neg
+
+theorem frobenius_sub : frobenius R p (x - y) = frobenius R p x - frobenius R p y :=
+  (frobenius R p).map_sub x y
+#align frobenius_sub frobenius_sub
+
+end CommRing
+
+end frobenius
chore: tidy various files (#9903)
Diff
@@ -253,37 +253,37 @@ variable {R}
 variable [CommSemiring R] (q : ℕ) [hR : ExpChar R q] (n : ℕ)
 
 theorem list_sum_pow_expChar (l : List R) : l.sum ^ q = (l.map (· ^ q : R → R)).sum := by
-  cases hR
-  case zero => simp_rw [pow_one, List.map_id']
-  case prime hprime _ => haveI := Fact.mk hprime; exact list_sum_pow_char q l
+  cases hR with
+  | zero => simp_rw [pow_one, List.map_id']
+  | prime hprime => haveI := Fact.mk hprime; exact list_sum_pow_char q l
 
 theorem multiset_sum_pow_expChar (s : Multiset R) : s.sum ^ q = (s.map (· ^ q : R → R)).sum := by
-  cases hR
-  case zero => simp_rw [pow_one, Multiset.map_id']
-  case prime hprime _ => haveI := Fact.mk hprime; exact multiset_sum_pow_char q s
+  cases hR with
+  | zero => simp_rw [pow_one, Multiset.map_id']
+  | prime hprime => haveI := Fact.mk hprime; exact multiset_sum_pow_char q s
 
 theorem sum_pow_expChar {ι : Type*} (s : Finset ι) (f : ι → R) :
     (∑ i in s, f i) ^ q = ∑ i in s, f i ^ q := by
-  cases hR
-  case zero => simp_rw [pow_one]
-  case prime hprime _ => haveI := Fact.mk hprime; exact sum_pow_char q s f
+  cases hR with
+  | zero => simp_rw [pow_one]
+  | prime hprime => haveI := Fact.mk hprime; exact sum_pow_char q s f
 
 theorem list_sum_pow_expChar_pow (l : List R) :
     l.sum ^ q ^ n = (l.map (· ^ q ^ n : R → R)).sum := by
-  cases hR
-  case zero => simp_rw [one_pow, pow_one, List.map_id']
-  case prime hprime _ => haveI := Fact.mk hprime; exact list_sum_pow_char_pow q n l
+  cases hR with
+  | zero => simp_rw [one_pow, pow_one, List.map_id']
+  | prime hprime => haveI := Fact.mk hprime; exact list_sum_pow_char_pow q n l
 
 theorem multiset_sum_pow_expChar_pow (s : Multiset R) :
     s.sum ^ q ^ n = (s.map (· ^ q ^ n : R → R)).sum := by
-  cases hR
-  case zero => simp_rw [one_pow, pow_one, Multiset.map_id']
-  case prime hprime _ => haveI := Fact.mk hprime; exact multiset_sum_pow_char_pow q n s
+  cases hR with
+  | zero => simp_rw [one_pow, pow_one, Multiset.map_id']
+  | prime hprime => haveI := Fact.mk hprime; exact multiset_sum_pow_char_pow q n s
 
 theorem sum_pow_expChar_pow {ι : Type*} (s : Finset ι) (f : ι → R) :
     (∑ i in s, f i) ^ q ^ n = ∑ i in s, f i ^ q ^ n := by
-  cases hR
-  case zero => simp_rw [one_pow, pow_one]
-  case prime hprime _ => haveI := Fact.mk hprime; exact sum_pow_char_pow q n s f
+  cases hR with
+  | zero => simp_rw [one_pow, pow_one]
+  | prime hprime => haveI := Fact.mk hprime; exact sum_pow_char_pow q n s f
 
 end BigOperators
feat(Algebra/CharP/{Basic|ExpChar}): add sum_pow_{char|expChar}_pow (#9799)
Diff
@@ -243,3 +243,47 @@ theorem ExpChar.neg_one_pow_expChar_pow [Ring R] (q n : ℕ) [hR : ExpChar R q]
   cases' hR with _ _ hprime _
   · simp only [one_pow, pow_one]
   haveI := Fact.mk hprime; exact CharP.neg_one_pow_char_pow R q n
+
+section BigOperators
+
+open BigOperators
+
+variable {R}
+
+variable [CommSemiring R] (q : ℕ) [hR : ExpChar R q] (n : ℕ)
+
+theorem list_sum_pow_expChar (l : List R) : l.sum ^ q = (l.map (· ^ q : R → R)).sum := by
+  cases hR
+  case zero => simp_rw [pow_one, List.map_id']
+  case prime hprime _ => haveI := Fact.mk hprime; exact list_sum_pow_char q l
+
+theorem multiset_sum_pow_expChar (s : Multiset R) : s.sum ^ q = (s.map (· ^ q : R → R)).sum := by
+  cases hR
+  case zero => simp_rw [pow_one, Multiset.map_id']
+  case prime hprime _ => haveI := Fact.mk hprime; exact multiset_sum_pow_char q s
+
+theorem sum_pow_expChar {ι : Type*} (s : Finset ι) (f : ι → R) :
+    (∑ i in s, f i) ^ q = ∑ i in s, f i ^ q := by
+  cases hR
+  case zero => simp_rw [pow_one]
+  case prime hprime _ => haveI := Fact.mk hprime; exact sum_pow_char q s f
+
+theorem list_sum_pow_expChar_pow (l : List R) :
+    l.sum ^ q ^ n = (l.map (· ^ q ^ n : R → R)).sum := by
+  cases hR
+  case zero => simp_rw [one_pow, pow_one, List.map_id']
+  case prime hprime _ => haveI := Fact.mk hprime; exact list_sum_pow_char_pow q n l
+
+theorem multiset_sum_pow_expChar_pow (s : Multiset R) :
+    s.sum ^ q ^ n = (s.map (· ^ q ^ n : R → R)).sum := by
+  cases hR
+  case zero => simp_rw [one_pow, pow_one, Multiset.map_id']
+  case prime hprime _ => haveI := Fact.mk hprime; exact multiset_sum_pow_char_pow q n s
+
+theorem sum_pow_expChar_pow {ι : Type*} (s : Finset ι) (f : ι → R) :
+    (∑ i in s, f i) ^ q ^ n = ∑ i in s, f i ^ q ^ n := by
+  cases hR
+  case zero => simp_rw [one_pow, pow_one]
+  case prime hprime _ => haveI := Fact.mk hprime; exact sum_pow_char_pow q n s f
+
+end BigOperators
chore: tidy various files (#9728)
Diff
@@ -70,13 +70,13 @@ theorem ringExpChar.eq (q : ℕ) [h : ExpChar R q] : ringExpChar R = q := by
 
 @[simp]
 theorem ringExpChar.eq_one (R : Type*) [NonAssocSemiring R] [CharZero R] : ringExpChar R = 1 := by
-  rw [ringExpChar, ringChar.eq_zero]; rfl
+  rw [ringExpChar, ringChar.eq_zero, max_eq_right zero_le_one]
 
 /-- The exponential characteristic is one if the characteristic is zero. -/
 theorem expChar_one_of_char_zero (q : ℕ) [hp : CharP R 0] [hq : ExpChar R q] : q = 1 := by
   cases' hq with q hq_one hq_prime hq_hchar
   · rfl
-  · exact False.elim (lt_irrefl _ ((hp.eq R hq_hchar).symm ▸ hq_prime : (0 : ℕ).Prime).pos)
+  · exact False.elim <| hq_prime.ne_zero <| hq_hchar.eq R hp
 #align exp_char_one_of_char_zero expChar_one_of_char_zero
 
 /-- The characteristic equals the exponential characteristic iff the former is prime. -/
feat(Algebra/CharP/ExpChar): add more results for ExpChar parallel to CharP (#9573)
Diff
@@ -46,6 +46,32 @@ class inductive ExpChar (R : Type u) [Semiring R] : ℕ → Prop
 #align exp_char ExpChar
 #align exp_char.prime ExpChar.prime
 
+variable {R} in
+/-- The exponential characteristic is unique. -/
+theorem ExpChar.eq {p q : ℕ} (hp : ExpChar R p) (hq : ExpChar R q) : p = q := by
+  cases' hp with hp _ hp' hp
+  · cases' hq with hq _ hq' hq
+    exacts [rfl, False.elim (Nat.not_prime_zero (CharP.eq R hq (CharP.ofCharZero R) ▸ hq'))]
+  · cases' hq with hq _ hq' hq
+    exacts [False.elim (Nat.not_prime_zero (CharP.eq R hp (CharP.ofCharZero R) ▸ hp')),
+      CharP.eq R hp hq]
+
+theorem ExpChar.congr {p : ℕ} (q : ℕ) [hq : ExpChar R q] (h : q = p) : ExpChar R p := h ▸ hq
+
+/-- Noncomputable function that outputs the unique exponential characteristic of a semiring. -/
+noncomputable def ringExpChar (R : Type*) [NonAssocSemiring R] : ℕ := max (ringChar R) 1
+
+theorem ringExpChar.eq (q : ℕ) [h : ExpChar R q] : ringExpChar R = q := by
+  cases' h with _ _ h _
+  · haveI := CharP.ofCharZero R
+    rw [ringExpChar, ringChar.eq R 0]; rfl
+  rw [ringExpChar, ringChar.eq R q]
+  exact Nat.max_eq_left h.one_lt.le
+
+@[simp]
+theorem ringExpChar.eq_one (R : Type*) [NonAssocSemiring R] [CharZero R] : ringExpChar R = 1 := by
+  rw [ringExpChar, ringChar.eq_zero]; rfl
+
 /-- The exponential characteristic is one if the characteristic is zero. -/
 theorem expChar_one_of_char_zero (q : ℕ) [hp : CharP R 0] [hq : ExpChar R q] : q = 1 := by
   cases' hq with q hq_one hq_prime hq_hchar
@@ -100,7 +126,8 @@ theorem char_prime_of_ne_zero {p : ℕ} [hp : CharP R p] (p_ne_zero : p ≠ 0) :
   · contradiction
 #align char_prime_of_ne_zero char_prime_of_ne_zero
 
-/-- The exponential characteristic is a prime number or one. -/
+/-- The exponential characteristic is a prime number or one.
+See also `CharP.char_is_prime_or_zero`. -/
 theorem expChar_is_prime_or_one (q : ℕ) [hq : ExpChar R q] : Nat.Prime q ∨ q = 1 := by
   cases hq with
   | zero => exact .inr rfl
@@ -123,10 +150,24 @@ end Nontrivial
 end Semiring
 
 theorem ExpChar.exists [Ring R] [IsDomain R] : ∃ q, ExpChar R q := by
-  obtain ⟨p, h⟩ := CharP.exists R
-  by_cases hp : p = 0
-  · exact ⟨1, by rw [hp] at h; haveI := CharP.charP_to_charZero R; exact .zero⟩
-  exact ⟨p, haveI := NeZero.mk hp; .prime (CharP.char_is_prime_of_pos R p).out⟩
+  obtain _ | ⟨p, ⟨hp⟩, _⟩ := CharP.exists' R
+  exacts [⟨1, .zero⟩, ⟨p, .prime hp⟩]
+
+theorem ExpChar.exists_unique [Ring R] [IsDomain R] : ∃! q, ExpChar R q :=
+  let ⟨q, H⟩ := ExpChar.exists R
+  ⟨q, H, fun _ H2 ↦ ExpChar.eq H2 H⟩
+
+instance ringExpChar.expChar [Ring R] [IsDomain R] : ExpChar R (ringExpChar R) := by
+  obtain ⟨q, _⟩ := ExpChar.exists R
+  rwa [ringExpChar.eq R q]
+
+variable {R} in
+theorem ringExpChar.of_eq [Ring R] [IsDomain R] {q : ℕ} (h : ringExpChar R = q) : ExpChar R q :=
+  h ▸ ringExpChar.expChar R
+
+variable {R} in
+theorem ringExpChar.eq_iff [Ring R] [IsDomain R] {q : ℕ} : ringExpChar R = q ↔ ExpChar R q :=
+  ⟨ringExpChar.of_eq, fun _ ↦ ringExpChar.eq R q⟩
 
 /-- If a ring homomorphism `R →+* A` is injective then `A` has the same exponential characteristic
 as `R`. -/
style: use cases x with | ... instead of cases x; case => ... (#9321)

This converts usages of the pattern

cases h
case inl h' => ...
case inr h' => ...

which derive from mathported code, to the "structured cases" syntax:

cases h with
| inl h' => ...
| inr h' => ...

The case where the subgoals are handled with · instead of case is more contentious (and much more numerous) so I left those alone. This pattern also appears with cases', induction, induction', and rcases. Furthermore, there is a similar transformation for by_cases:

by_cases h : cond
case pos => ...
case neg => ...

is replaced by:

if h : cond then
  ...
else
  ...

Co-authored-by: Mario Carneiro <di.gama@gmail.com>

Diff
@@ -102,9 +102,9 @@ theorem char_prime_of_ne_zero {p : ℕ} [hp : CharP R p] (p_ne_zero : p ≠ 0) :
 
 /-- The exponential characteristic is a prime number or one. -/
 theorem expChar_is_prime_or_one (q : ℕ) [hq : ExpChar R q] : Nat.Prime q ∨ q = 1 := by
-  cases hq
-  case zero => exact .inr rfl
-  case prime hp _ => exact .inl hp
+  cases hq with
+  | zero => exact .inr rfl
+  | prime hp => exact .inl hp
 #align exp_char_is_prime_or_one expChar_is_prime_or_one
 
 /-- The exponential characteristic is positive. -/
feat(Algebra/CharP/ExpChar): add expChar[_pow]_pos (#9260)

... which states that (the power of) exponential characteristic is positive.

Diff
@@ -107,6 +107,15 @@ theorem expChar_is_prime_or_one (q : ℕ) [hq : ExpChar R q] : Nat.Prime q ∨ q
   case prime hp _ => exact .inl hp
 #align exp_char_is_prime_or_one expChar_is_prime_or_one
 
+/-- The exponential characteristic is positive. -/
+theorem expChar_pos (q : ℕ) [ExpChar R q] : 0 < q := by
+  rcases expChar_is_prime_or_one R q with h | rfl
+  exacts [Nat.Prime.pos h, Nat.one_pos]
+
+/-- Any power of the exponential characteristic is positive. -/
+theorem expChar_pow_pos (q : ℕ) [ExpChar R q] (n : ℕ) : 0 < q ^ n :=
+  Nat.pos_pow_of_pos n (expChar_pos R q)
+
 end NoZeroDivisors
 
 end Nontrivial
feat(Algebra/CharP/ExpChar): add some results parallel to CharP (#8860)
  • change the condition of CharP.neg_one_pow_char and CharP.neg_one_pow_char_pow from CommRing to Ring
  • add ExpChar.exists, expChar_of_injective_algebraMap
  • add add_pow_expChar and 9 similar functions parallel to that of CharP
  • add {charP|charZero|expChar}_of_injective_ringHom
Diff
@@ -4,6 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jakob Scholbach
 -/
 import Mathlib.Algebra.CharP.Basic
+import Mathlib.Algebra.CharP.Algebra
 import Mathlib.Data.Nat.Prime
 
 #align_import algebra.char_p.exp_char from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
@@ -111,3 +112,84 @@ end NoZeroDivisors
 end Nontrivial
 
 end Semiring
+
+theorem ExpChar.exists [Ring R] [IsDomain R] : ∃ q, ExpChar R q := by
+  obtain ⟨p, h⟩ := CharP.exists R
+  by_cases hp : p = 0
+  · exact ⟨1, by rw [hp] at h; haveI := CharP.charP_to_charZero R; exact .zero⟩
+  exact ⟨p, haveI := NeZero.mk hp; .prime (CharP.char_is_prime_of_pos R p).out⟩
+
+/-- If a ring homomorphism `R →+* A` is injective then `A` has the same exponential characteristic
+as `R`. -/
+theorem expChar_of_injective_ringHom {R A : Type*}
+    [Semiring R] [Semiring A] {f : R →+* A} (h : Function.Injective f)
+    (q : ℕ) [hR : ExpChar R q] : ExpChar A q := by
+  cases' hR with _ _ hprime _
+  · haveI := charZero_of_injective_ringHom h; exact .zero
+  haveI := charP_of_injective_ringHom h q; exact .prime hprime
+
+/-- 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*}
+    [CommSemiring R] [Semiring A] [Algebra R A] (h : Function.Injective (algebraMap R A))
+    (q : ℕ) [ExpChar R q] : ExpChar A q := expChar_of_injective_ringHom h q
+
+theorem add_pow_expChar_of_commute [Semiring R] {q : ℕ} [hR : ExpChar R q]
+    (x y : R) (h : Commute x y) : (x + y) ^ q = x ^ q + y ^ q := by
+  cases' hR with _ _ hprime _
+  · simp only [pow_one]
+  haveI := Fact.mk hprime; exact add_pow_char_of_commute R x y h
+
+theorem add_pow_expChar_pow_of_commute [Semiring R] {q : ℕ} [hR : ExpChar R q]
+    {n : ℕ} (x y : R) (h : Commute x y) : (x + y) ^ q ^ n = x ^ q ^ n + y ^ q ^ n := by
+  cases' hR with _ _ hprime _
+  · simp only [one_pow, pow_one]
+  haveI := Fact.mk hprime; exact add_pow_char_pow_of_commute R x y h
+
+theorem sub_pow_expChar_of_commute [Ring R] {q : ℕ} [hR : ExpChar R q]
+    (x y : R) (h : Commute x y) : (x - y) ^ q = x ^ q - y ^ q := by
+  cases' hR with _ _ hprime _
+  · simp only [pow_one]
+  haveI := Fact.mk hprime; exact sub_pow_char_of_commute R x y h
+
+theorem sub_pow_expChar_pow_of_commute [Ring R] {q : ℕ} [hR : ExpChar R q]
+    {n : ℕ} (x y : R) (h : Commute x y) : (x - y) ^ q ^ n = x ^ q ^ n - y ^ q ^ n := by
+  cases' hR with _ _ hprime _
+  · simp only [one_pow, pow_one]
+  haveI := Fact.mk hprime; exact sub_pow_char_pow_of_commute R x y h
+
+theorem add_pow_expChar [CommSemiring R] {q : ℕ} [hR : ExpChar R q]
+    (x y : R) : (x + y) ^ q = x ^ q + y ^ q := by
+  cases' hR with _ _ hprime _
+  · simp only [pow_one]
+  haveI := Fact.mk hprime; exact add_pow_char R x y
+
+theorem add_pow_expChar_pow [CommSemiring R] {q : ℕ} [hR : ExpChar R q]
+    {n : ℕ} (x y : R) : (x + y) ^ q ^ n = x ^ q ^ n + y ^ q ^ n := by
+  cases' hR with _ _ hprime _
+  · simp only [one_pow, pow_one]
+  haveI := Fact.mk hprime; exact add_pow_char_pow R x y
+
+theorem sub_pow_expChar [CommRing R] {q : ℕ} [hR : ExpChar R q]
+    (x y : R) : (x - y) ^ q = x ^ q - y ^ q := by
+  cases' hR with _ _ hprime _
+  · simp only [pow_one]
+  haveI := Fact.mk hprime; exact sub_pow_char R x y
+
+theorem sub_pow_expChar_pow [CommRing R] {q : ℕ} [hR : ExpChar R q]
+    {n : ℕ} (x y : R) : (x - y) ^ q ^ n = x ^ q ^ n - y ^ q ^ n := by
+  cases' hR with _ _ hprime _
+  · simp only [one_pow, pow_one]
+  haveI := Fact.mk hprime; exact sub_pow_char_pow R x y
+
+theorem ExpChar.neg_one_pow_expChar [Ring R] (q : ℕ) [hR : ExpChar R q] :
+    (-1 : R) ^ q = -1 := by
+  cases' hR with _ _ hprime _
+  · simp only [pow_one]
+  haveI := Fact.mk hprime; exact CharP.neg_one_pow_char R q
+
+theorem ExpChar.neg_one_pow_expChar_pow [Ring R] (q n : ℕ) [hR : ExpChar R q] :
+    (-1 : R) ^ q ^ n = -1 := by
+  cases' hR with _ _ hprime _
+  · simp only [one_pow, pow_one]
+  haveI := Fact.mk hprime; exact CharP.neg_one_pow_char_pow R q n
chore: demote charZero_of_expChar_one' instance to a theorem (#7777)

The low-priority instance charZero_of_expChar_one' takes as an input a Nontrivial R and a ExpChar R 1 instance, but there are no such ExpChar instances in Mathlib. It is tried before StrictOrderedSemiring.to_charZero when synthesizing CharZero Nat, and the former takes a long time to fail (~100ms) because Lean tries to construct Nontrivial Nat in all possible ways before giving up, for some reason. See Zulip thread and the synthInstance trace for context.

Co-authored-by: Mario Carneiro <di.gama@gmail.com>

Diff
@@ -71,9 +71,9 @@ theorem char_zero_of_expChar_one (p : ℕ) [hp : CharP R p] [hq : ExpChar R 1] :
   · exact False.elim (CharP.char_ne_one R 1 rfl)
 #align char_zero_of_exp_char_one char_zero_of_expChar_one
 
--- see Note [lower instance priority]
+-- This could be an instance, but there are no `ExpChar R 1` instances in mathlib.
 /-- The characteristic is zero if the exponential characteristic is one. -/
-instance (priority := 100) charZero_of_expChar_one' [hq : ExpChar R 1] : CharZero R := by
+theorem charZero_of_expChar_one' [hq : ExpChar R 1] : CharZero R := by
   cases hq
   · assumption
   · exact False.elim (CharP.char_ne_one R 1 rfl)
chore: script to replace headers with #align_import statements (#5979)

Open in Gitpod

Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -2,15 +2,12 @@
 Copyright (c) 2021 Jakob Scholbach. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jakob Scholbach
-
-! This file was ported from Lean 3 source module algebra.char_p.exp_char
-! leanprover-community/mathlib commit 70fd9563a21e7b963887c9360bd29b2393e6225a
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Algebra.CharP.Basic
 import Mathlib.Data.Nat.Prime
 
+#align_import algebra.char_p.exp_char from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
+
 /-!
 # Exponential characteristic
 
feat: improvements in ExpChar (#2907)
  • Improve some proofs and documentation
  • Rename ExpChar.Prime to ExpChar.prime
  • I don't think this needs to be backported to Lean 3, since this cannot cause breaking changes.
Diff
@@ -14,8 +14,10 @@ import Mathlib.Data.Nat.Prime
 /-!
 # Exponential characteristic
 
-This file defines the exponential characteristic and establishes a few basic results relating
-it to the (ordinary characteristic).
+This file 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).
@@ -42,8 +44,9 @@ variable [Semiring R]
 /-- The definition of the exponential characteristic of a semiring. -/
 class inductive ExpChar (R : Type u) [Semiring R] : ℕ → Prop
   | zero [CharZero R] : ExpChar R 1
-  | Prime {q : ℕ} (hprime : q.Prime) [hchar : CharP R q] : ExpChar R q
+  | prime {q : ℕ} (hprime : q.Prime) [hchar : CharP R q] : ExpChar R q
 #align exp_char ExpChar
+#align exp_char.prime ExpChar.prime
 
 /-- The exponential characteristic is one if the characteristic is zero. -/
 theorem expChar_one_of_char_zero (q : ℕ) [hp : CharP R 0] [hq : ExpChar R q] : q = 1 := by
@@ -55,12 +58,8 @@ theorem expChar_one_of_char_zero (q : ℕ) [hp : CharP R 0] [hq : ExpChar R q] :
 /-- The characteristic equals the exponential characteristic iff the former is prime. -/
 theorem char_eq_expChar_iff (p q : ℕ) [hp : CharP R p] [hq : ExpChar R q] : p = q ↔ p.Prime := by
   cases' hq with q hq_one hq_prime hq_hchar
-  · apply iff_of_false
-    · rintro rfl
-      exact one_ne_zero (hp.eq R (CharP.ofCharZero R))
-    · intro pprime
-      rw [(CharP.eq R hp inferInstance : p = 0)] at pprime
-      exact Nat.not_prime_zero pprime
+  · rw [(CharP.eq R hp inferInstance : p = 0)]
+    decide
   · exact ⟨fun hpq => hpq.symm ▸ hq_prime, fun _ => CharP.eq R hp hq_hchar⟩
 #align char_eq_exp_char_iff char_eq_expChar_iff
 
@@ -104,19 +103,10 @@ theorem char_prime_of_ne_zero {p : ℕ} [hp : CharP R p] (p_ne_zero : p ≠ 0) :
 #align char_prime_of_ne_zero char_prime_of_ne_zero
 
 /-- The exponential characteristic is a prime number or one. -/
-theorem expChar_is_prime_or_one (q : ℕ) [hq : ExpChar R q] : Nat.Prime q ∨ q = 1 :=
-  or_iff_not_imp_right.mpr fun h => by
-    cases' CharP.exists R with p hp
-    have p_ne_zero : p ≠ 0 := by
-      intro p_zero
-      have : CharP R 0 := by rwa [← p_zero]
-      have : q = 1 := expChar_one_of_char_zero R q
-      contradiction
-    haveI : CharP R p := hp -- porting note: added because using `cases` instead of `casesI` above
-    have p_eq_q : p = q := (char_eq_expChar_iff R p q).mpr (char_prime_of_ne_zero R p_ne_zero)
-    cases' CharP.char_is_prime_or_zero R p with pprime
-    · rwa [p_eq_q] at pprime
-    · contradiction
+theorem expChar_is_prime_or_one (q : ℕ) [hq : ExpChar R q] : Nat.Prime q ∨ q = 1 := by
+  cases hq
+  case zero => exact .inr rfl
+  case prime hp _ => exact .inl hp
 #align exp_char_is_prime_or_one expChar_is_prime_or_one
 
 end NoZeroDivisors
feat: port Algebra.CharP.ExpChar (#2894)

Co-authored-by: Parcly Taxel <reddeloostw@gmail.com> Co-authored-by: Oliver Nash <github@olivernash.org>

Dependencies 8 + 478

479 files ported (98.4%)
197128 lines ported (98.4%)
Show graph

The unported dependencies are