ring_theory.perfectionMathlib.RingTheory.Perfection

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)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -7,7 +7,7 @@ import Algebra.CharP.Pi
 import Algebra.CharP.Quotient
 import Algebra.CharP.Subring
 import Algebra.Ring.Pi
-import Analysis.SpecialFunctions.Pow.Nnreal
+import Analysis.SpecialFunctions.Pow.NNReal
 import FieldTheory.PerfectClosure
 import RingTheory.Localization.FractionRing
 import RingTheory.Subring.Basic
@@ -672,7 +672,7 @@ theorem valAux_eq {f : PreTilt K v O hv p} {n : ℕ} (hfn : coeff _ _ n f ≠ 0)
     exact coeff_nat_find_add_ne_zero k
   erw [ih (coeff_nat_find_add_ne_zero k), ← hx, ← coeff_pow_p, RingHom.map_pow, ← hx, ←
     RingHom.map_pow, ModP.preVal_mk h1, ModP.preVal_mk h2, RingHom.map_pow, v.map_pow, ← pow_mul,
-    pow_succ]
+    pow_succ']
   rfl
 #align pre_tilt.val_aux_eq PreTilt.valAux_eq
 -/
Diff
@@ -561,10 +561,10 @@ theorem preVal_add (x y : ModP K v O hv p) :
 theorem v_p_lt_preVal {x : ModP K v O hv p} : v p < preVal K v O hv p x ↔ x ≠ 0 :=
   by
   refine'
-    ⟨fun h hx => by rw [hx, pre_val_zero] at h ; exact not_lt_zero' h, fun h =>
+    ⟨fun h hx => by rw [hx, pre_val_zero] at h; exact not_lt_zero' h, fun h =>
       lt_of_not_le fun hp => h _⟩
   obtain ⟨r, rfl⟩ := Ideal.Quotient.mk_surjective x
-  rw [pre_val_mk h, ← map_natCast (algebraMap O K) p, hv.le_iff_dvd] at hp 
+  rw [pre_val_mk h, ← map_natCast (algebraMap O K) p, hv.le_iff_dvd] at hp
   rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton]; exact hp
 #align mod_p.v_p_lt_pre_val ModP.v_p_lt_preVal
 -/
@@ -572,7 +572,7 @@ theorem v_p_lt_preVal {x : ModP K v O hv p} : v p < preVal K v O hv p x ↔ x 
 #print ModP.preVal_eq_zero /-
 theorem preVal_eq_zero {x : ModP K v O hv p} : preVal K v O hv p x = 0 ↔ x = 0 :=
   ⟨fun hvx =>
-    by_contradiction fun hx0 : x ≠ 0 => by rw [← v_p_lt_pre_val, hvx] at hx0 ;
+    by_contradiction fun hx0 : x ≠ 0 => by rw [← v_p_lt_pre_val, hvx] at hx0;
       exact not_lt_zero' hx0,
     fun hx => hx.symm ▸ preVal_zero⟩
 #align mod_p.pre_val_eq_zero ModP.preVal_eq_zero
@@ -598,10 +598,10 @@ theorem mul_ne_zero_of_pow_p_ne_zero {x y : ModP K v O hv p} (hx : x ^ p ≠ 0)
   obtain ⟨r, rfl⟩ := Ideal.Quotient.mk_surjective x
   obtain ⟨s, rfl⟩ := Ideal.Quotient.mk_surjective y
   have h1p : (0 : ℝ) < 1 / p := one_div_pos.2 (Nat.cast_pos.2 hp.1.Pos)
-  rw [← RingHom.map_mul]; rw [← RingHom.map_pow] at hx hy 
+  rw [← RingHom.map_mul]; rw [← RingHom.map_pow] at hx hy
   rw [← v_p_lt_val hv] at hx hy ⊢
   rw [RingHom.map_pow, v.map_pow, ← rpow_lt_rpow_iff h1p, ← rpow_nat_cast, ← rpow_mul,
-    mul_one_div_cancel (Nat.cast_ne_zero.2 hp.1.NeZero : (p : ℝ) ≠ 0), rpow_one] at hx hy 
+    mul_one_div_cancel (Nat.cast_ne_zero.2 hp.1.NeZero : (p : ℝ) ≠ 0), rpow_one] at hx hy
   rw [RingHom.map_mul, v.map_mul]; refine' lt_of_le_of_lt _ (mul_lt_mul₀ hx hy)
   by_cases hvp : v p = 0; · rw [hvp]; exact zero_le _; replace hvp := zero_lt_iff.2 hvp
   conv_lhs => rw [← rpow_one (v p)]; rw [← rpow_add (ne_of_gt hvp)]
@@ -764,7 +764,7 @@ theorem map_eq_zero {f : PreTilt K v O hv p} : val K v O hv p f = 0 ↔ f = 0 :=
   by_cases hf0 : f = 0; · rw [hf0]; exact iff_of_true (Valuation.map_zero _) rfl
   obtain ⟨n, hn⟩ : ∃ n, coeff _ _ n f ≠ 0 := Classical.not_forall.1 fun h => hf0 <| Perfection.ext h
   show val_aux K v O hv p f = 0 ↔ f = 0; refine' iff_of_false (fun hvf => hn _) hf0
-  rw [val_aux_eq hn] at hvf ; replace hvf := pow_eq_zero hvf; rwa [ModP.preVal_eq_zero] at hvf 
+  rw [val_aux_eq hn] at hvf; replace hvf := pow_eq_zero hvf; rwa [ModP.preVal_eq_zero] at hvf
 #align pre_tilt.map_eq_zero PreTilt.map_eq_zero
 -/
 
Diff
@@ -735,8 +735,8 @@ theorem valAux_add (f g : PreTilt K v O hv p) :
     le_max_iff.1
       (ModP.preVal_add (coeff _ _ (max (max m n) k) f) (coeff _ _ (max (max m n) k) g)) with
     h h
-  · exact le_max_of_le_left (pow_le_pow_of_le_left' h _)
-  · exact le_max_of_le_right (pow_le_pow_of_le_left' h _)
+  · exact le_max_of_le_left (pow_le_pow_left' h _)
+  · exact le_max_of_le_right (pow_le_pow_left' h _)
 #align pre_tilt.val_aux_add PreTilt.valAux_add
 -/
 
Diff
@@ -700,8 +700,8 @@ theorem valAux_mul (f g : PreTilt K v O hv p) :
   by
   by_cases hf : f = 0; · rw [hf, MulZeroClass.zero_mul, val_aux_zero, MulZeroClass.zero_mul]
   by_cases hg : g = 0; · rw [hg, MulZeroClass.mul_zero, val_aux_zero, MulZeroClass.mul_zero]
-  obtain ⟨m, hm⟩ : ∃ n, coeff _ _ n f ≠ 0 := not_forall.1 fun h => hf <| Perfection.ext h
-  obtain ⟨n, hn⟩ : ∃ n, coeff _ _ n g ≠ 0 := not_forall.1 fun h => hg <| Perfection.ext h
+  obtain ⟨m, hm⟩ : ∃ n, coeff _ _ n f ≠ 0 := Classical.not_forall.1 fun h => hf <| Perfection.ext h
+  obtain ⟨n, hn⟩ : ∃ n, coeff _ _ n g ≠ 0 := Classical.not_forall.1 fun h => hg <| Perfection.ext h
   replace hm := coeff_ne_zero_of_le hm (le_max_left m n)
   replace hn := coeff_ne_zero_of_le hn (le_max_right m n)
   have hfg : coeff _ _ (max m n + 1) (f * g) ≠ 0 :=
@@ -722,9 +722,10 @@ theorem valAux_add (f g : PreTilt K v O hv p) :
   by_cases hf : f = 0; · rw [hf, zero_add, val_aux_zero, max_eq_right]; exact zero_le _
   by_cases hg : g = 0; · rw [hg, add_zero, val_aux_zero, max_eq_left]; exact zero_le _
   by_cases hfg : f + g = 0; · rw [hfg, val_aux_zero]; exact zero_le _
-  replace hf : ∃ n, coeff _ _ n f ≠ 0 := not_forall.1 fun h => hf <| Perfection.ext h
-  replace hg : ∃ n, coeff _ _ n g ≠ 0 := not_forall.1 fun h => hg <| Perfection.ext h
-  replace hfg : ∃ n, coeff _ _ n (f + g) ≠ 0 := not_forall.1 fun h => hfg <| Perfection.ext h
+  replace hf : ∃ n, coeff _ _ n f ≠ 0 := Classical.not_forall.1 fun h => hf <| Perfection.ext h
+  replace hg : ∃ n, coeff _ _ n g ≠ 0 := Classical.not_forall.1 fun h => hg <| Perfection.ext h
+  replace hfg : ∃ n, coeff _ _ n (f + g) ≠ 0 :=
+    Classical.not_forall.1 fun h => hfg <| Perfection.ext h
   obtain ⟨m, hm⟩ := hf; obtain ⟨n, hn⟩ := hg; obtain ⟨k, hk⟩ := hfg
   replace hm := coeff_ne_zero_of_le hm (le_trans (le_max_left m n) (le_max_left _ k))
   replace hn := coeff_ne_zero_of_le hn (le_trans (le_max_right m n) (le_max_left _ k))
@@ -761,7 +762,7 @@ variable {K v O hv p}
 theorem map_eq_zero {f : PreTilt K v O hv p} : val K v O hv p f = 0 ↔ f = 0 :=
   by
   by_cases hf0 : f = 0; · rw [hf0]; exact iff_of_true (Valuation.map_zero _) rfl
-  obtain ⟨n, hn⟩ : ∃ n, coeff _ _ n f ≠ 0 := not_forall.1 fun h => hf0 <| Perfection.ext h
+  obtain ⟨n, hn⟩ : ∃ n, coeff _ _ n f ≠ 0 := Classical.not_forall.1 fun h => hf0 <| Perfection.ext h
   show val_aux K v O hv p f = 0 ↔ f = 0; refine' iff_of_false (fun hvf => hn _) hf0
   rw [val_aux_eq hn] at hvf ; replace hvf := pow_eq_zero hvf; rwa [ModP.preVal_eq_zero] at hvf 
 #align pre_tilt.map_eq_zero PreTilt.map_eq_zero
Diff
@@ -3,15 +3,15 @@ Copyright (c) 2020 Kenny Lau. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Kenny Lau
 -/
-import Mathbin.Algebra.CharP.Pi
-import Mathbin.Algebra.CharP.Quotient
-import Mathbin.Algebra.CharP.Subring
-import Mathbin.Algebra.Ring.Pi
-import Mathbin.Analysis.SpecialFunctions.Pow.Nnreal
-import Mathbin.FieldTheory.PerfectClosure
-import Mathbin.RingTheory.Localization.FractionRing
-import Mathbin.RingTheory.Subring.Basic
-import Mathbin.RingTheory.Valuation.Integers
+import Algebra.CharP.Pi
+import Algebra.CharP.Quotient
+import Algebra.CharP.Subring
+import Algebra.Ring.Pi
+import Analysis.SpecialFunctions.Pow.Nnreal
+import FieldTheory.PerfectClosure
+import RingTheory.Localization.FractionRing
+import RingTheory.Subring.Basic
+import RingTheory.Valuation.Integers
 
 #align_import ring_theory.perfection from "leanprover-community/mathlib"@"087c325ae0ab42dbdd5dee55bc37d3d5a0bf2197"
 
Diff
@@ -43,7 +43,7 @@ def Monoid.perfection (M : Type u₁) [CommMonoid M] (p : ℕ) : Submonoid (ℕ
     where
   carrier := {f | ∀ n, f (n + 1) ^ p = f n}
   one_mem' n := one_pow _
-  mul_mem' f g hf hg n := (mul_pow _ _ _).trans <| congr_arg₂ _ (hf n) (hg n)
+  hMul_mem' f g hf hg n := (mul_pow _ _ _).trans <| congr_arg₂ _ (hf n) (hg n)
 #align monoid.perfection Monoid.perfection
 -/
 
@@ -243,7 +243,7 @@ def lift (R : Type u₁) [CommSemiring R] [CharP R p] [PerfectRing R p] (S : Typ
           rw [← f.map_pow, Function.iterate_succ_apply', pthRoot_pow_p]⟩
       map_one' := ext fun n => (congr_arg f <| RingHom.iterate_map_one _ _).trans f.map_one
       map_mul' := fun x y =>
-        ext fun n => (congr_arg f <| RingHom.iterate_map_mul _ _ _ _).trans <| f.map_mul _ _
+        ext fun n => (congr_arg f <| RingHom.iterate_map_hMul _ _ _ _).trans <| f.map_hMul _ _
       map_zero' := ext fun n => (congr_arg f <| RingHom.iterate_map_zero _ _).trans f.map_zero
       map_add' := fun x y =>
         ext fun n => (congr_arg f <| RingHom.iterate_map_add _ _ _ _).trans <| f.map_add _ _ }
@@ -275,7 +275,7 @@ def map (φ : R →+* S) : Ring.Perfection R p →+* Ring.Perfection S p
     where
   toFun f := ⟨fun n => φ (coeff R p n f), fun n => by rw [← φ.map_pow, coeff_pow_p']⟩
   map_one' := Subtype.eq <| funext fun n => φ.map_one
-  map_mul' f g := Subtype.eq <| funext fun n => φ.map_mul _ _
+  map_mul' f g := Subtype.eq <| funext fun n => φ.map_hMul _ _
   map_zero' := Subtype.eq <| funext fun n => φ.map_zero
   map_add' f g := Subtype.eq <| funext fun n => φ.map_add _ _
 #align perfection.map Perfection.map
Diff
@@ -2,11 +2,6 @@
 Copyright (c) 2020 Kenny Lau. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Kenny Lau
-
-! This file was ported from Lean 3 source module ring_theory.perfection
-! leanprover-community/mathlib commit 087c325ae0ab42dbdd5dee55bc37d3d5a0bf2197
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Algebra.CharP.Pi
 import Mathbin.Algebra.CharP.Quotient
@@ -18,6 +13,8 @@ import Mathbin.RingTheory.Localization.FractionRing
 import Mathbin.RingTheory.Subring.Basic
 import Mathbin.RingTheory.Valuation.Integers
 
+#align_import ring_theory.perfection from "leanprover-community/mathlib"@"087c325ae0ab42dbdd5dee55bc37d3d5a0bf2197"
+
 /-!
 # Ring Perfection and Tilt
 
Diff
@@ -62,6 +62,7 @@ def Ring.perfectionSubsemiring (R : Type u₁) [CommSemiring R] (p : ℕ) [hp :
 #align ring.perfection_subsemiring Ring.perfectionSubsemiring
 -/
 
+#print Ring.perfectionSubring /-
 /-- The perfection of a ring `R` with characteristic `p`, as a subring,
 defined to be the projective limit of `R` using the Frobenius maps `R → R`
 indexed by the natural numbers, implemented as `{ f : ℕ → R | ∀ n, f (n + 1) ^ p = f n }`. -/
@@ -70,6 +71,7 @@ def Ring.perfectionSubring (R : Type u₁) [CommRing R] (p : ℕ) [hp : Fact p.P
   (Ring.perfectionSubsemiring R p).toSubring fun n => by
     simp_rw [← frobenius_def, Pi.neg_apply, Pi.one_apply, RingHom.map_neg, RingHom.map_one]
 #align ring.perfection_subring Ring.perfectionSubring
+-/
 
 #print Ring.Perfection /-
 /-- The perfection of a ring `R` with characteristic `p`,
@@ -84,21 +86,23 @@ namespace Perfection
 
 variable (R : Type u₁) [CommSemiring R] (p : ℕ) [hp : Fact p.Prime] [CharP R p]
 
-include hp
-
 instance : CommSemiring (Ring.Perfection R p) :=
   (Ring.perfectionSubsemiring R p).toCommSemiring
 
 instance : CharP (Ring.Perfection R p) p :=
   CharP.subsemiring (ℕ → R) p (Ring.perfectionSubsemiring R p)
 
+#print Perfection.ring /-
 instance ring (R : Type u₁) [CommRing R] [CharP R p] : Ring (Ring.Perfection R p) :=
   (Ring.perfectionSubring R p).toRing
 #align perfection.ring Perfection.ring
+-/
 
+#print Perfection.commRing /-
 instance commRing (R : Type u₁) [CommRing R] [CharP R p] : CommRing (Ring.Perfection R p) :=
   (Ring.perfectionSubring R p).toCommRing
 #align perfection.comm_ring Perfection.commRing
+-/
 
 instance : Inhabited (Ring.Perfection R p) :=
   ⟨0⟩
@@ -117,10 +121,12 @@ def coeff (n : ℕ) : Ring.Perfection R p →+* R
 
 variable {R p}
 
+#print Perfection.ext /-
 @[ext]
 theorem ext {f g : Ring.Perfection R p} (h : ∀ n, coeff R p n f = coeff R p n g) : f = g :=
   Subtype.eq <| funext h
 #align perfection.ext Perfection.ext
+-/
 
 variable (R p)
 
@@ -138,38 +144,52 @@ def pthRoot : Ring.Perfection R p →+* Ring.Perfection R p
 
 variable {R p}
 
+#print Perfection.coeff_mk /-
 @[simp]
 theorem coeff_mk (f : ℕ → R) (hf) (n : ℕ) : coeff R p n ⟨f, hf⟩ = f n :=
   rfl
 #align perfection.coeff_mk Perfection.coeff_mk
+-/
 
+#print Perfection.coeff_pthRoot /-
 theorem coeff_pthRoot (f : Ring.Perfection R p) (n : ℕ) :
     coeff R p n (pthRoot R p f) = coeff R p (n + 1) f :=
   rfl
 #align perfection.coeff_pth_root Perfection.coeff_pthRoot
+-/
 
+#print Perfection.coeff_pow_p /-
 theorem coeff_pow_p (f : Ring.Perfection R p) (n : ℕ) : coeff R p (n + 1) (f ^ p) = coeff R p n f :=
   by rw [RingHom.map_pow]; exact f.2 n
 #align perfection.coeff_pow_p Perfection.coeff_pow_p
+-/
 
+#print Perfection.coeff_pow_p' /-
 theorem coeff_pow_p' (f : Ring.Perfection R p) (n : ℕ) : coeff R p (n + 1) f ^ p = coeff R p n f :=
   f.2 n
 #align perfection.coeff_pow_p' Perfection.coeff_pow_p'
+-/
 
+#print Perfection.coeff_frobenius /-
 theorem coeff_frobenius (f : Ring.Perfection R p) (n : ℕ) :
     coeff R p (n + 1) (frobenius _ p f) = coeff R p n f := by apply coeff_pow_p f n
 #align perfection.coeff_frobenius Perfection.coeff_frobenius
+-/
 
+#print Perfection.coeff_iterate_frobenius /-
 -- `coeff_pow_p f n` also works but is slow!
 theorem coeff_iterate_frobenius (f : Ring.Perfection R p) (n m : ℕ) :
     coeff R p (n + m) ((frobenius _ p^[m]) f) = coeff R p n f :=
   Nat.recOn m rfl fun m ih => by erw [Function.iterate_succ_apply', coeff_frobenius, ih]
 #align perfection.coeff_iterate_frobenius Perfection.coeff_iterate_frobenius
+-/
 
+#print Perfection.coeff_iterate_frobenius' /-
 theorem coeff_iterate_frobenius' (f : Ring.Perfection R p) (n m : ℕ) (hmn : m ≤ n) :
     coeff R p n ((frobenius _ p^[m]) f) = coeff R p (n - m) f :=
   Eq.symm <| (coeff_iterate_frobenius _ _ m).symm.trans <| (tsub_add_cancel_of_le hmn).symm ▸ rfl
 #align perfection.coeff_iterate_frobenius' Perfection.coeff_iterate_frobenius'
+-/
 
 #print Perfection.pthRoot_frobenius /-
 theorem pthRoot_frobenius : (pthRoot R p).comp (frobenius _ p) = RingHom.id _ :=
@@ -187,16 +207,20 @@ theorem frobenius_pthRoot : (frobenius _ p).comp (pthRoot R p) = RingHom.id _ :=
 #align perfection.frobenius_pth_root Perfection.frobenius_pthRoot
 -/
 
+#print Perfection.coeff_add_ne_zero /-
 theorem coeff_add_ne_zero {f : Ring.Perfection R p} {n : ℕ} (hfn : coeff R p n f ≠ 0) (k : ℕ) :
     coeff R p (n + k) f ≠ 0 :=
   Nat.recOn k hfn fun k ih h => ih <| by erw [← coeff_pow_p, RingHom.map_pow, h, zero_pow hp.1.Pos]
 #align perfection.coeff_add_ne_zero Perfection.coeff_add_ne_zero
+-/
 
+#print Perfection.coeff_ne_zero_of_le /-
 theorem coeff_ne_zero_of_le {f : Ring.Perfection R p} {m n : ℕ} (hfm : coeff R p m f ≠ 0)
     (hmn : m ≤ n) : coeff R p n f ≠ 0 :=
   let ⟨k, hk⟩ := Nat.exists_eq_add_of_le hmn
   hk.symm ▸ coeff_add_ne_zero hfm k
 #align perfection.coeff_ne_zero_of_le Perfection.coeff_ne_zero_of_le
+-/
 
 variable (R p)
 
@@ -237,11 +261,13 @@ def lift (R : Type u₁) [CommSemiring R] [CharP R p] [PerfectRing R p] (S : Typ
 #align perfection.lift Perfection.lift
 -/
 
+#print Perfection.hom_ext /-
 theorem hom_ext {R : Type u₁} [CommSemiring R] [CharP R p] [PerfectRing R p] {S : Type u₂}
     [CommSemiring S] [CharP S p] {f g : R →+* Ring.Perfection S p}
     (hfg : ∀ x, coeff S p 0 (f x) = coeff S p 0 (g x)) : f = g :=
   (lift p R S).symm.Injective <| RingHom.ext hfg
 #align perfection.hom_ext Perfection.hom_ext
+-/
 
 variable {R} {S : Type u₂} [CommSemiring S] [CharP S p]
 
@@ -258,10 +284,12 @@ def map (φ : R →+* S) : Ring.Perfection R p →+* Ring.Perfection S p
 #align perfection.map Perfection.map
 -/
 
+#print Perfection.coeff_map /-
 theorem coeff_map (φ : R →+* S) (f : Ring.Perfection R p) (n : ℕ) :
     coeff S p n (map p φ f) = φ (coeff R p n f) :=
   rfl
 #align perfection.coeff_map Perfection.coeff_map
+-/
 
 end Perfection
 
@@ -284,6 +312,7 @@ variable {R : Type u₁} [CommSemiring R] [CharP R p]
 
 variable {P : Type u₃} [CommSemiring P] [CharP P p] [PerfectRing P p]
 
+#print PerfectionMap.mk' /-
 /-- Create a `perfection_map` from an isomorphism to the perfection. -/
 @[simps]
 theorem mk' {f : P →+* R} (g : P ≃+* Ring.Perfection R p) (hfg : Perfection.lift p P R f = g) :
@@ -298,6 +327,7 @@ theorem mk' {f : P →+* R} (g : P ≃+* Ring.Perfection R p) (hfg : Perfection.
         show Perfection.coeff R p n (Perfection.lift p P R f x) = Perfection.coeff R p n ⟨y, hy⟩ by
           rw [hfg, ← coeFn_coeBase, hx]⟩ }
 #align perfection_map.mk' PerfectionMap.mk'
+-/
 
 variable (p R P)
 
@@ -322,6 +352,7 @@ theorem id [PerfectRing R p] : PerfectionMap p (RingHom.id R) :=
 
 variable {p R P}
 
+#print PerfectionMap.equiv /-
 /-- A perfection map induces an isomorphism to the prefection. -/
 noncomputable def equiv {π : P →+* R} (m : PerfectionMap p π) : P ≃+* Ring.Perfection R p :=
   RingEquiv.ofBijective (Perfection.lift p P R π)
@@ -329,6 +360,7 @@ noncomputable def equiv {π : P →+* R} (m : PerfectionMap p π) : P ≃+* Ring
       let ⟨x, hx⟩ := m.Surjective f.1 f.2
       ⟨x, Perfection.ext <| hx⟩⟩
 #align perfection_map.equiv PerfectionMap.equiv
+-/
 
 #print PerfectionMap.equiv_apply /-
 theorem equiv_apply {π : P →+* R} (m : PerfectionMap p π) (x : P) :
@@ -337,25 +369,33 @@ theorem equiv_apply {π : P →+* R} (m : PerfectionMap p π) (x : P) :
 #align perfection_map.equiv_apply PerfectionMap.equiv_apply
 -/
 
+#print PerfectionMap.comp_equiv /-
 theorem comp_equiv {π : P →+* R} (m : PerfectionMap p π) (x : P) :
     Perfection.coeff R p 0 (m.Equiv x) = π x :=
   rfl
 #align perfection_map.comp_equiv PerfectionMap.comp_equiv
+-/
 
+#print PerfectionMap.comp_equiv' /-
 theorem comp_equiv' {π : P →+* R} (m : PerfectionMap p π) :
     (Perfection.coeff R p 0).comp ↑m.Equiv = π :=
   RingHom.ext fun x => rfl
 #align perfection_map.comp_equiv' PerfectionMap.comp_equiv'
+-/
 
+#print PerfectionMap.comp_symm_equiv /-
 theorem comp_symm_equiv {π : P →+* R} (m : PerfectionMap p π) (f : Ring.Perfection R p) :
     π (m.Equiv.symm f) = Perfection.coeff R p 0 f :=
   (m.comp_equiv _).symm.trans <| congr_arg _ <| m.Equiv.apply_symm_apply f
 #align perfection_map.comp_symm_equiv PerfectionMap.comp_symm_equiv
+-/
 
+#print PerfectionMap.comp_symm_equiv' /-
 theorem comp_symm_equiv' {π : P →+* R} (m : PerfectionMap p π) :
     π.comp ↑m.Equiv.symm = Perfection.coeff R p 0 :=
   RingHom.ext m.comp_symm_equiv
 #align perfection_map.comp_symm_equiv' PerfectionMap.comp_symm_equiv'
+-/
 
 variable (p R P)
 
@@ -384,11 +424,13 @@ noncomputable def lift [PerfectRing R p] (S : Type u₂) [CommSemiring S] [CharP
 
 variable {R p}
 
+#print PerfectionMap.hom_ext /-
 theorem hom_ext [PerfectRing R p] {S : Type u₂} [CommSemiring S] [CharP S p] {P : Type u₃}
     [CommSemiring P] [CharP P p] [PerfectRing P p] (π : P →+* S) (m : PerfectionMap p π)
     {f g : R →+* P} (hfg : ∀ x, π (f x) = π (g x)) : f = g :=
   (lift p R S P π m).symm.Injective <| RingHom.ext hfg
 #align perfection_map.hom_ext PerfectionMap.hom_ext
+-/
 
 variable {R P} (p) {S : Type u₂} [CommSemiring S] [CharP S p]
 
@@ -410,10 +452,12 @@ theorem comp_map {π : P →+* R} (m : PerfectionMap p π) {σ : Q →+* S} (n :
 #align perfection_map.comp_map PerfectionMap.comp_map
 -/
 
+#print PerfectionMap.map_map /-
 theorem map_map {π : P →+* R} (m : PerfectionMap p π) {σ : Q →+* S} (n : PerfectionMap p σ)
     (φ : R →+* S) (x : P) : σ (map p m n φ x) = φ (π x) :=
   RingHom.ext_iff.1 (comp_map p m n φ) x
 #align perfection_map.map_map PerfectionMap.map_map
+-/
 
 #print PerfectionMap.map_eq_map /-
 -- Why is this slow?
@@ -433,13 +477,13 @@ variable (O : Type u₂) [CommRing O] [Algebra O K] (hv : v.Integers O)
 
 variable (p : ℕ)
 
-include hv
-
+#print ModP /-
 /-- `O/(p)` for `O`, ring of integers of `K`. -/
 @[nolint unused_arguments has_nonempty_instance]
 def ModP :=
   O ⧸ (Ideal.span {p} : Ideal O)
 #align mod_p ModP
+-/
 
 variable [hp : Fact p.Prime] [hvp : Fact (v p ≠ 1)]
 
@@ -448,8 +492,6 @@ namespace ModP
 instance : CommRing (ModP K v O hv p) :=
   Ideal.Quotient.commRing _
 
-include hp hvp
-
 instance : CharP (ModP K v O hv p) p :=
   CharP.quotient O p <| mt hv.one_of_isUnit <| (map_natCast (algebraMap O K) p).symm ▸ hvp.1
 
@@ -460,16 +502,17 @@ section Classical
 
 attribute [local instance] Classical.dec
 
-omit hp hvp
-
+#print ModP.preVal /-
 /-- For a field `K` with valuation `v : K → ℝ≥0` and ring of integers `O`,
 a function `O/(p) → ℝ≥0` that sends `0` to `0` and `x + (p)` to `v(x)` as long as `x ∉ (p)`. -/
 noncomputable def preVal (x : ModP K v O hv p) : ℝ≥0 :=
   if x = 0 then 0 else v (algebraMap O K x.out')
 #align mod_p.pre_val ModP.preVal
+-/
 
 variable {K v O hv p}
 
+#print ModP.preVal_mk /-
 theorem preVal_mk {x : O} (hx : (Ideal.Quotient.mk _ x : ModP K v O hv p) ≠ 0) :
     preVal K v O hv p (Ideal.Quotient.mk _ x) = v (algebraMap O K x) :=
   by
@@ -482,11 +525,15 @@ theorem preVal_mk {x : O} (hx : (Ideal.Quotient.mk _ x : ModP K v O hv p) ≠ 0)
   exact fun hprx =>
     hx (Ideal.Quotient.eq_zero_iff_mem.2 <| Ideal.mem_span_singleton.2 <| dvd_of_mul_left_dvd hprx)
 #align mod_p.pre_val_mk ModP.preVal_mk
+-/
 
+#print ModP.preVal_zero /-
 theorem preVal_zero : preVal K v O hv p 0 = 0 :=
   if_pos rfl
 #align mod_p.pre_val_zero ModP.preVal_zero
+-/
 
+#print ModP.preVal_mul /-
 theorem preVal_mul {x y : ModP K v O hv p} (hxy0 : x * y ≠ 0) :
     preVal K v O hv p (x * y) = preVal K v O hv p x * preVal K v O hv p y :=
   by
@@ -497,7 +544,9 @@ theorem preVal_mul {x y : ModP K v O hv p} (hxy0 : x * y ≠ 0) :
   rw [← RingHom.map_mul] at hxy0 ⊢
   rw [pre_val_mk hx0, pre_val_mk hy0, pre_val_mk hxy0, RingHom.map_mul, v.map_mul]
 #align mod_p.pre_val_mul ModP.preVal_mul
+-/
 
+#print ModP.preVal_add /-
 theorem preVal_add (x y : ModP K v O hv p) :
     preVal K v O hv p (x + y) ≤ max (preVal K v O hv p x) (preVal K v O hv p y) :=
   by
@@ -509,7 +558,9 @@ theorem preVal_add (x y : ModP K v O hv p) :
   rw [← RingHom.map_add] at hxy0 ⊢
   rw [pre_val_mk hx0, pre_val_mk hy0, pre_val_mk hxy0, RingHom.map_add]; exact v.map_add _ _
 #align mod_p.pre_val_add ModP.preVal_add
+-/
 
+#print ModP.v_p_lt_preVal /-
 theorem v_p_lt_preVal {x : ModP K v O hv p} : v p < preVal K v O hv p x ↔ x ≠ 0 :=
   by
   refine'
@@ -519,28 +570,32 @@ theorem v_p_lt_preVal {x : ModP K v O hv p} : v p < preVal K v O hv p x ↔ x 
   rw [pre_val_mk h, ← map_natCast (algebraMap O K) p, hv.le_iff_dvd] at hp 
   rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton]; exact hp
 #align mod_p.v_p_lt_pre_val ModP.v_p_lt_preVal
+-/
 
+#print ModP.preVal_eq_zero /-
 theorem preVal_eq_zero {x : ModP K v O hv p} : preVal K v O hv p x = 0 ↔ x = 0 :=
   ⟨fun hvx =>
     by_contradiction fun hx0 : x ≠ 0 => by rw [← v_p_lt_pre_val, hvx] at hx0 ;
       exact not_lt_zero' hx0,
     fun hx => hx.symm ▸ preVal_zero⟩
 #align mod_p.pre_val_eq_zero ModP.preVal_eq_zero
+-/
 
 variable (hv hvp)
 
+#print ModP.v_p_lt_val /-
 theorem v_p_lt_val {x : O} :
     v p < v (algebraMap O K x) ↔ (Ideal.Quotient.mk _ x : ModP K v O hv p) ≠ 0 := by
   rw [lt_iff_not_le, not_iff_not, ← map_natCast (algebraMap O K) p, hv.le_iff_dvd,
     Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton]
 #align mod_p.v_p_lt_val ModP.v_p_lt_val
+-/
 
 open NNReal
 
 variable {hv} (hvp)
 
-include hp
-
+#print ModP.mul_ne_zero_of_pow_p_ne_zero /-
 theorem mul_ne_zero_of_pow_p_ne_zero {x y : ModP K v O hv p} (hx : x ^ p ≠ 0) (hy : y ^ p ≠ 0) :
     x * y ≠ 0 := by
   obtain ⟨r, rfl⟩ := Ideal.Quotient.mk_surjective x
@@ -556,18 +611,19 @@ theorem mul_ne_zero_of_pow_p_ne_zero {x y : ModP K v O hv p} (hx : x ^ p ≠ 0)
   refine' rpow_le_rpow_of_exponent_ge hvp (map_natCast (algebraMap O K) p ▸ hv.2 _) _
   rw [← add_div, div_le_one (Nat.cast_pos.2 hp.1.Pos : 0 < (p : ℝ))]; exact_mod_cast hp.1.two_le
 #align mod_p.mul_ne_zero_of_pow_p_ne_zero ModP.mul_ne_zero_of_pow_p_ne_zero
+-/
 
 end Classical
 
 end ModP
 
+#print PreTilt /-
 /-- Perfection of `O/(p)` where `O` is the ring of integers of `K`. -/
 @[nolint has_nonempty_instance]
 def PreTilt :=
   Ring.Perfection (ModP K v O hv p) p
 #align pre_tilt PreTilt
-
-include hp hvp
+-/
 
 namespace PreTilt
 
@@ -583,6 +639,7 @@ open scoped Classical
 
 open Perfection
 
+#print PreTilt.valAux /-
 /-- The valuation `Perfection(O/(p)) → ℝ≥0` as a function.
 Given `f ∈ Perfection(O/(p))`, if `f = 0` then output `0`;
 otherwise output `pre_val(f(n))^(p^n)` for any `n` such that `f(n) ≠ 0`. -/
@@ -591,14 +648,18 @@ noncomputable def valAux (f : PreTilt K v O hv p) : ℝ≥0 :=
     ModP.preVal K v O hv p (coeff _ _ (Nat.find h) f) ^ p ^ Nat.find h
   else 0
 #align pre_tilt.val_aux PreTilt.valAux
+-/
 
 variable {K v O hv p}
 
+#print PreTilt.coeff_nat_find_add_ne_zero /-
 theorem coeff_nat_find_add_ne_zero {f : PreTilt K v O hv p} {h : ∃ n, coeff _ _ n f ≠ 0} (k : ℕ) :
     coeff _ _ (Nat.find h + k) f ≠ 0 :=
   coeff_add_ne_zero (Nat.find_spec h) k
 #align pre_tilt.coeff_nat_find_add_ne_zero PreTilt.coeff_nat_find_add_ne_zero
+-/
 
+#print PreTilt.valAux_eq /-
 theorem valAux_eq {f : PreTilt K v O hv p} {n : ℕ} (hfn : coeff _ _ n f ≠ 0) :
     valAux K v O hv p f = ModP.preVal K v O hv p (coeff _ _ n f) ^ p ^ n :=
   by
@@ -617,11 +678,15 @@ theorem valAux_eq {f : PreTilt K v O hv p} {n : ℕ} (hfn : coeff _ _ n f ≠ 0)
     pow_succ]
   rfl
 #align pre_tilt.val_aux_eq PreTilt.valAux_eq
+-/
 
+#print PreTilt.valAux_zero /-
 theorem valAux_zero : valAux K v O hv p 0 = 0 :=
   dif_neg fun ⟨n, hn⟩ => hn rfl
 #align pre_tilt.val_aux_zero PreTilt.valAux_zero
+-/
 
+#print PreTilt.valAux_one /-
 theorem valAux_one : valAux K v O hv p 1 = 1 :=
   (valAux_eq <| show coeff (ModP K v O hv p) p 0 1 ≠ 0 from one_ne_zero).trans <|
     by
@@ -630,7 +695,9 @@ theorem valAux_one : valAux K v O hv p 1 = 1 :=
     change (1 : ModP K v O hv p) ≠ 0
     exact one_ne_zero
 #align pre_tilt.val_aux_one PreTilt.valAux_one
+-/
 
+#print PreTilt.valAux_mul /-
 theorem valAux_mul (f g : PreTilt K v O hv p) :
     valAux K v O hv p (f * g) = valAux K v O hv p f * valAux K v O hv p g :=
   by
@@ -649,7 +716,9 @@ theorem valAux_mul (f g : PreTilt K v O hv p) :
   rw [val_aux_eq (coeff_add_ne_zero hm 1), val_aux_eq (coeff_add_ne_zero hn 1), val_aux_eq hfg]
   rw [RingHom.map_mul] at hfg ⊢; rw [ModP.preVal_mul hfg, mul_pow]
 #align pre_tilt.val_aux_mul PreTilt.valAux_mul
+-/
 
+#print PreTilt.valAux_add /-
 theorem valAux_add (f g : PreTilt K v O hv p) :
     valAux K v O hv p (f + g) ≤ max (valAux K v O hv p f) (valAux K v O hv p g) :=
   by
@@ -671,9 +740,11 @@ theorem valAux_add (f g : PreTilt K v O hv p) :
   · exact le_max_of_le_left (pow_le_pow_of_le_left' h _)
   · exact le_max_of_le_right (pow_le_pow_of_le_left' h _)
 #align pre_tilt.val_aux_add PreTilt.valAux_add
+-/
 
 variable (K v O hv p)
 
+#print PreTilt.val /-
 /-- The valuation `Perfection(O/(p)) → ℝ≥0`.
 Given `f ∈ Perfection(O/(p))`, if `f = 0` then output `0`;
 otherwise output `pre_val(f(n))^(p^n)` for any `n` such that `f(n) ≠ 0`. -/
@@ -685,9 +756,11 @@ noncomputable def val : Valuation (PreTilt K v O hv p) ℝ≥0
   map_zero' := valAux_zero
   map_add_le_max' := valAux_add
 #align pre_tilt.val PreTilt.val
+-/
 
 variable {K v O hv p}
 
+#print PreTilt.map_eq_zero /-
 theorem map_eq_zero {f : PreTilt K v O hv p} : val K v O hv p f = 0 ↔ f = 0 :=
   by
   by_cases hf0 : f = 0; · rw [hf0]; exact iff_of_true (Valuation.map_zero _) rfl
@@ -695,6 +768,7 @@ theorem map_eq_zero {f : PreTilt K v O hv p} : val K v O hv p f = 0 ↔ f = 0 :=
   show val_aux K v O hv p f = 0 ↔ f = 0; refine' iff_of_false (fun hvf => hn _) hf0
   rw [val_aux_eq hn] at hvf ; replace hvf := pow_eq_zero hvf; rwa [ModP.preVal_eq_zero] at hvf 
 #align pre_tilt.map_eq_zero PreTilt.map_eq_zero
+-/
 
 end Classical
 
@@ -709,6 +783,7 @@ instance : IsDomain (PreTilt K v O hv p) :=
 
 end PreTilt
 
+#print Tilt /-
 /-- The tilt of a field, as defined in Perfectoid Spaces by Peter Scholze, as in
 [scholze2011perfectoid]. Given a field `K` with valuation `K → ℝ≥0` and ring of integers `O`,
 this is implemented as the fraction field of the perfection of `O/(p)`. -/
@@ -716,6 +791,7 @@ this is implemented as the fraction field of the perfection of `O/(p)`. -/
 def Tilt :=
   FractionRing (PreTilt K v O hv p)
 #align tilt Tilt
+-/
 
 namespace Tilt
 
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Kenny Lau
 
 ! This file was ported from Lean 3 source module ring_theory.perfection
-! leanprover-community/mathlib commit 0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8
+! leanprover-community/mathlib commit 087c325ae0ab42dbdd5dee55bc37d3d5a0bf2197
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -21,6 +21,9 @@ import Mathbin.RingTheory.Valuation.Integers
 /-!
 # Ring Perfection and Tilt
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 In this file we define the perfection of a ring of characteristic p, and the tilt of a field
 given a valuation to `ℝ≥0`.
 
Diff
@@ -35,6 +35,7 @@ universe u₁ u₂ u₃ u₄
 
 open scoped NNReal
 
+#print Monoid.perfection /-
 /-- The perfection of a monoid `M`, defined to be the projective limit of `M`
 using the `p`-th power maps `M → M` indexed by the natural numbers, implemented as
 `{ f : ℕ → M | ∀ n, f (n + 1) ^ p = f n }`. -/
@@ -44,7 +45,9 @@ def Monoid.perfection (M : Type u₁) [CommMonoid M] (p : ℕ) : Submonoid (ℕ
   one_mem' n := one_pow _
   mul_mem' f g hf hg n := (mul_pow _ _ _).trans <| congr_arg₂ _ (hf n) (hg n)
 #align monoid.perfection Monoid.perfection
+-/
 
+#print Ring.perfectionSubsemiring /-
 /-- The perfection of a ring `R` with characteristic `p`, as a subsemiring,
 defined to be the projective limit of `R` using the Frobenius maps `R → R`
 indexed by the natural numbers, implemented as `{ f : ℕ → R | ∀ n, f (n + 1) ^ p = f n }`. -/
@@ -54,6 +57,7 @@ def Ring.perfectionSubsemiring (R : Type u₁) [CommSemiring R] (p : ℕ) [hp :
     zero_mem' := fun n => zero_pow <| hp.1.Pos
     add_mem' := fun f g hf hg n => (frobenius_add R p _ _).trans <| congr_arg₂ _ (hf n) (hg n) }
 #align ring.perfection_subsemiring Ring.perfectionSubsemiring
+-/
 
 /-- The perfection of a ring `R` with characteristic `p`, as a subring,
 defined to be the projective limit of `R` using the Frobenius maps `R → R`
@@ -64,12 +68,14 @@ def Ring.perfectionSubring (R : Type u₁) [CommRing R] (p : ℕ) [hp : Fact p.P
     simp_rw [← frobenius_def, Pi.neg_apply, Pi.one_apply, RingHom.map_neg, RingHom.map_one]
 #align ring.perfection_subring Ring.perfectionSubring
 
+#print Ring.Perfection /-
 /-- The perfection of a ring `R` with characteristic `p`,
 defined to be the projective limit of `R` using the Frobenius maps `R → R`
 indexed by the natural numbers, implemented as `{f : ℕ → R // ∀ n, f (n + 1) ^ p = f n}`. -/
 def Ring.Perfection (R : Type u₁) [CommSemiring R] (p : ℕ) : Type u₁ :=
   { f // ∀ n : ℕ, (f : ℕ → R) (n + 1) ^ p = f n }
 #align ring.perfection Ring.Perfection
+-/
 
 namespace Perfection
 
@@ -94,6 +100,7 @@ instance commRing (R : Type u₁) [CommRing R] [CharP R p] : CommRing (Ring.Perf
 instance : Inhabited (Ring.Perfection R p) :=
   ⟨0⟩
 
+#print Perfection.coeff /-
 /-- The `n`-th coefficient of an element of the perfection. -/
 def coeff (n : ℕ) : Ring.Perfection R p →+* R
     where
@@ -103,6 +110,7 @@ def coeff (n : ℕ) : Ring.Perfection R p →+* R
   map_zero' := rfl
   map_add' f g := rfl
 #align perfection.coeff Perfection.coeff
+-/
 
 variable {R p}
 
@@ -113,6 +121,7 @@ theorem ext {f g : Ring.Perfection R p} (h : ∀ n, coeff R p n f = coeff R p n
 
 variable (R p)
 
+#print Perfection.pthRoot /-
 /-- The `p`-th root of an element of the perfection. -/
 def pthRoot : Ring.Perfection R p →+* Ring.Perfection R p
     where
@@ -122,6 +131,7 @@ def pthRoot : Ring.Perfection R p →+* Ring.Perfection R p
   map_zero' := rfl
   map_add' f g := rfl
 #align perfection.pth_root Perfection.pthRoot
+-/
 
 variable {R p}
 
@@ -158,17 +168,21 @@ theorem coeff_iterate_frobenius' (f : Ring.Perfection R p) (n m : ℕ) (hmn : m
   Eq.symm <| (coeff_iterate_frobenius _ _ m).symm.trans <| (tsub_add_cancel_of_le hmn).symm ▸ rfl
 #align perfection.coeff_iterate_frobenius' Perfection.coeff_iterate_frobenius'
 
+#print Perfection.pthRoot_frobenius /-
 theorem pthRoot_frobenius : (pthRoot R p).comp (frobenius _ p) = RingHom.id _ :=
   RingHom.ext fun x =>
     ext fun n => by rw [RingHom.comp_apply, RingHom.id_apply, coeff_pth_root, coeff_frobenius]
 #align perfection.pth_root_frobenius Perfection.pthRoot_frobenius
+-/
 
+#print Perfection.frobenius_pthRoot /-
 theorem frobenius_pthRoot : (frobenius _ p).comp (pthRoot R p) = RingHom.id _ :=
   RingHom.ext fun x =>
     ext fun n => by
       rw [RingHom.comp_apply, RingHom.id_apply, RingHom.map_frobenius, coeff_pth_root, ←
         RingHom.map_frobenius, coeff_frobenius]
 #align perfection.frobenius_pth_root Perfection.frobenius_pthRoot
+-/
 
 theorem coeff_add_ne_zero {f : Ring.Perfection R p} {n : ℕ} (hfn : coeff R p n f ≠ 0) (k : ℕ) :
     coeff R p (n + k) f ≠ 0 :=
@@ -183,13 +197,16 @@ theorem coeff_ne_zero_of_le {f : Ring.Perfection R p} {m n : ℕ} (hfm : coeff R
 
 variable (R p)
 
+#print Perfection.perfectRing /-
 instance perfectRing : PerfectRing (Ring.Perfection R p) p
     where
   pthRoot' := pthRoot R p
   frobenius_pthRoot' := congr_fun <| congr_arg RingHom.toFun <| @frobenius_pthRoot R _ p _ _
   pth_root_frobenius' := congr_fun <| congr_arg RingHom.toFun <| @pthRoot_frobenius R _ p _ _
 #align perfection.perfect_ring Perfection.perfectRing
+-/
 
+#print Perfection.lift /-
 /-- Given rings `R` and `S` of characteristic `p`, with `R` being perfect,
 any homomorphism `R →+* S` can be lifted to a homomorphism `R →+* perfection S p`. -/
 @[simps]
@@ -215,6 +232,7 @@ def lift (R : Type u₁) [CommSemiring R] [CharP R p] [PerfectRing R p] (S : Typ
           rw [← coeff_iterate_frobenius _ 0 n, zero_add, ← RingHom.map_iterate_frobenius,
             right_inverse_pth_root_frobenius.iterate]
 #align perfection.lift Perfection.lift
+-/
 
 theorem hom_ext {R : Type u₁} [CommSemiring R] [CharP R p] [PerfectRing R p] {S : Type u₂}
     [CommSemiring S] [CharP S p] {f g : R →+* Ring.Perfection S p}
@@ -224,6 +242,7 @@ theorem hom_ext {R : Type u₁} [CommSemiring R] [CharP R p] [PerfectRing R p] {
 
 variable {R} {S : Type u₂} [CommSemiring S] [CharP S p]
 
+#print Perfection.map /-
 /-- A ring homomorphism `R →+* S` induces `perfection R p →+* perfection S p` -/
 @[simps]
 def map (φ : R →+* S) : Ring.Perfection R p →+* Ring.Perfection S p
@@ -234,6 +253,7 @@ def map (φ : R →+* S) : Ring.Perfection R p →+* Ring.Perfection S p
   map_zero' := Subtype.eq <| funext fun n => φ.map_zero
   map_add' f g := Subtype.eq <| funext fun n => φ.map_add _ _
 #align perfection.map Perfection.map
+-/
 
 theorem coeff_map (φ : R →+* S) (f : Ring.Perfection R p) (n : ℕ) :
     coeff S p n (map p φ f) = φ (coeff R p n f) :=
@@ -242,6 +262,7 @@ theorem coeff_map (φ : R →+* S) (f : Ring.Perfection R p) (n : ℕ) :
 
 end Perfection
 
+#print PerfectionMap /-
 /-- A perfection map to a ring of characteristic `p` is a map that is isomorphic
 to its perfection. -/
 @[nolint has_nonempty_instance]
@@ -250,6 +271,7 @@ structure PerfectionMap (p : ℕ) [Fact p.Prime] {R : Type u₁} [CommSemiring R
   Injective : ∀ ⦃x y : P⦄, (∀ n, π ((pthRoot P p^[n]) x) = π ((pthRoot P p^[n]) y)) → x = y
   Surjective : ∀ f : ℕ → R, (∀ n, f (n + 1) ^ p = f n) → ∃ x : P, ∀ n, π ((pthRoot P p^[n]) x) = f n
 #align perfection_map PerfectionMap
+-/
 
 namespace PerfectionMap
 
@@ -276,11 +298,14 @@ theorem mk' {f : P →+* R} (g : P ≃+* Ring.Perfection R p) (hfg : Perfection.
 
 variable (p R P)
 
+#print PerfectionMap.of /-
 /-- The canonical perfection map from the perfection of a ring. -/
 theorem of : PerfectionMap p (Perfection.coeff R p 0) :=
   mk' (RingEquiv.refl _) <| (Equiv.apply_eq_iff_eq_symm_apply _).2 rfl
 #align perfection_map.of PerfectionMap.of
+-/
 
+#print PerfectionMap.id /-
 /-- For a perfect ring, it itself is the perfection. -/
 theorem id [PerfectRing R p] : PerfectionMap p (RingHom.id R) :=
   { Injective := fun x y hxy => hxy 0
@@ -290,6 +315,7 @@ theorem id [PerfectRing R p] : PerfectionMap p (RingHom.id R) :=
           Nat.recOn n rfl fun n ih =>
             injective_pow_p p <| by rw [Function.iterate_succ_apply', pthRoot_pow_p _, ih, hf]⟩ }
 #align perfection_map.id PerfectionMap.id
+-/
 
 variable {p R P}
 
@@ -301,10 +327,12 @@ noncomputable def equiv {π : P →+* R} (m : PerfectionMap p π) : P ≃+* Ring
       ⟨x, Perfection.ext <| hx⟩⟩
 #align perfection_map.equiv PerfectionMap.equiv
 
+#print PerfectionMap.equiv_apply /-
 theorem equiv_apply {π : P →+* R} (m : PerfectionMap p π) (x : P) :
     m.Equiv x = Perfection.lift p P R π x :=
   rfl
 #align perfection_map.equiv_apply PerfectionMap.equiv_apply
+-/
 
 theorem comp_equiv {π : P →+* R} (m : PerfectionMap p π) (x : P) :
     Perfection.coeff R p 0 (m.Equiv x) = π x :=
@@ -328,6 +356,7 @@ theorem comp_symm_equiv' {π : P →+* R} (m : PerfectionMap p π) :
 
 variable (p R P)
 
+#print PerfectionMap.lift /-
 /-- Given rings `R` and `S` of characteristic `p`, with `R` being perfect,
 any homomorphism `R →+* S` can be lifted to a homomorphism `R →+* P`,
 where `P` is any perfection of `S`. -/
@@ -348,6 +377,7 @@ noncomputable def lift [PerfectRing R p] (S : Type u₂) [CommSemiring S] [CharP
           show Perfection.lift p R S (π.comp f) x = RingHom.comp (↑m.Equiv) f x from
             RingHom.ext_iff.1 ((Perfection.lift p R S).apply_eq_iff_eq_symm_apply.2 rfl) _
 #align perfection_map.lift PerfectionMap.lift
+-/
 
 variable {R p}
 
@@ -361,28 +391,34 @@ variable {R P} (p) {S : Type u₂} [CommSemiring S] [CharP S p]
 
 variable {Q : Type u₄} [CommSemiring Q] [CharP Q p] [PerfectRing Q p]
 
+#print PerfectionMap.map /-
 /-- A ring homomorphism `R →+* S` induces `P →+* Q`, a map of the respective perfections. -/
 @[nolint unused_arguments]
 noncomputable def map {π : P →+* R} (m : PerfectionMap p π) {σ : Q →+* S} (n : PerfectionMap p σ)
     (φ : R →+* S) : P →+* Q :=
   lift p P S Q σ n <| φ.comp π
 #align perfection_map.map PerfectionMap.map
+-/
 
+#print PerfectionMap.comp_map /-
 theorem comp_map {π : P →+* R} (m : PerfectionMap p π) {σ : Q →+* S} (n : PerfectionMap p σ)
     (φ : R →+* S) : σ.comp (map p m n φ) = φ.comp π :=
   (lift p P S Q σ n).symm_apply_apply _
 #align perfection_map.comp_map PerfectionMap.comp_map
+-/
 
 theorem map_map {π : P →+* R} (m : PerfectionMap p π) {σ : Q →+* S} (n : PerfectionMap p σ)
     (φ : R →+* S) (x : P) : σ (map p m n φ x) = φ (π x) :=
   RingHom.ext_iff.1 (comp_map p m n φ) x
 #align perfection_map.map_map PerfectionMap.map_map
 
+#print PerfectionMap.map_eq_map /-
 -- Why is this slow?
 theorem map_eq_map (φ : R →+* S) :
     @map p _ R _ _ _ _ _ _ S _ _ _ _ _ _ _ (of p R) _ (of p S) φ = Perfection.map p φ :=
   hom_ext _ (of p S) fun f => by rw [map_map, Perfection.coeff_map]
 #align perfection_map.map_eq_map PerfectionMap.map_eq_map
+-/
 
 end PerfectionMap
 
Diff
@@ -40,7 +40,7 @@ using the `p`-th power maps `M → M` indexed by the natural numbers, implemente
 `{ f : ℕ → M | ∀ n, f (n + 1) ^ p = f n }`. -/
 def Monoid.perfection (M : Type u₁) [CommMonoid M] (p : ℕ) : Submonoid (ℕ → M)
     where
-  carrier := { f | ∀ n, f (n + 1) ^ p = f n }
+  carrier := {f | ∀ n, f (n + 1) ^ p = f n}
   one_mem' n := one_pow _
   mul_mem' f g hf hg n := (mul_pow _ _ _).trans <| congr_arg₂ _ (hf n) (hg n)
 #align monoid.perfection Monoid.perfection
Diff
@@ -246,7 +246,7 @@ end Perfection
 to its perfection. -/
 @[nolint has_nonempty_instance]
 structure PerfectionMap (p : ℕ) [Fact p.Prime] {R : Type u₁} [CommSemiring R] [CharP R p]
-  {P : Type u₂} [CommSemiring P] [CharP P p] [PerfectRing P p] (π : P →+* R) : Prop where
+    {P : Type u₂} [CommSemiring P] [CharP P p] [PerfectRing P p] (π : P →+* R) : Prop where
   Injective : ∀ ⦃x y : P⦄, (∀ n, π ((pthRoot P p^[n]) x) = π ((pthRoot P p^[n]) y)) → x = y
   Surjective : ∀ f : ℕ → R, (∀ n, f (n + 1) ^ p = f n) → ∃ x : P, ∀ n, π ((pthRoot P p^[n]) x) = f n
 #align perfection_map PerfectionMap
@@ -455,7 +455,7 @@ theorem preVal_mul {x y : ModP K v O hv p} (hxy0 : x * y ≠ 0) :
   have hy0 : y ≠ 0 := mt (by rintro rfl; rw [MulZeroClass.mul_zero]) hxy0
   obtain ⟨r, rfl⟩ := Ideal.Quotient.mk_surjective x
   obtain ⟨s, rfl⟩ := Ideal.Quotient.mk_surjective y
-  rw [← RingHom.map_mul] at hxy0⊢
+  rw [← RingHom.map_mul] at hxy0 ⊢
   rw [pre_val_mk hx0, pre_val_mk hy0, pre_val_mk hxy0, RingHom.map_mul, v.map_mul]
 #align mod_p.pre_val_mul ModP.preVal_mul
 
@@ -467,23 +467,23 @@ theorem preVal_add (x y : ModP K v O hv p) :
   by_cases hxy0 : x + y = 0; · rw [hxy0, pre_val_zero]; exact zero_le _
   obtain ⟨r, rfl⟩ := Ideal.Quotient.mk_surjective x
   obtain ⟨s, rfl⟩ := Ideal.Quotient.mk_surjective y
-  rw [← RingHom.map_add] at hxy0⊢
+  rw [← RingHom.map_add] at hxy0 ⊢
   rw [pre_val_mk hx0, pre_val_mk hy0, pre_val_mk hxy0, RingHom.map_add]; exact v.map_add _ _
 #align mod_p.pre_val_add ModP.preVal_add
 
 theorem v_p_lt_preVal {x : ModP K v O hv p} : v p < preVal K v O hv p x ↔ x ≠ 0 :=
   by
   refine'
-    ⟨fun h hx => by rw [hx, pre_val_zero] at h; exact not_lt_zero' h, fun h =>
+    ⟨fun h hx => by rw [hx, pre_val_zero] at h ; exact not_lt_zero' h, fun h =>
       lt_of_not_le fun hp => h _⟩
   obtain ⟨r, rfl⟩ := Ideal.Quotient.mk_surjective x
-  rw [pre_val_mk h, ← map_natCast (algebraMap O K) p, hv.le_iff_dvd] at hp
+  rw [pre_val_mk h, ← map_natCast (algebraMap O K) p, hv.le_iff_dvd] at hp 
   rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton]; exact hp
 #align mod_p.v_p_lt_pre_val ModP.v_p_lt_preVal
 
 theorem preVal_eq_zero {x : ModP K v O hv p} : preVal K v O hv p x = 0 ↔ x = 0 :=
   ⟨fun hvx =>
-    by_contradiction fun hx0 : x ≠ 0 => by rw [← v_p_lt_pre_val, hvx] at hx0;
+    by_contradiction fun hx0 : x ≠ 0 => by rw [← v_p_lt_pre_val, hvx] at hx0 ;
       exact not_lt_zero' hx0,
     fun hx => hx.symm ▸ preVal_zero⟩
 #align mod_p.pre_val_eq_zero ModP.preVal_eq_zero
@@ -507,10 +507,10 @@ theorem mul_ne_zero_of_pow_p_ne_zero {x y : ModP K v O hv p} (hx : x ^ p ≠ 0)
   obtain ⟨r, rfl⟩ := Ideal.Quotient.mk_surjective x
   obtain ⟨s, rfl⟩ := Ideal.Quotient.mk_surjective y
   have h1p : (0 : ℝ) < 1 / p := one_div_pos.2 (Nat.cast_pos.2 hp.1.Pos)
-  rw [← RingHom.map_mul]; rw [← RingHom.map_pow] at hx hy
-  rw [← v_p_lt_val hv] at hx hy⊢
+  rw [← RingHom.map_mul]; rw [← RingHom.map_pow] at hx hy 
+  rw [← v_p_lt_val hv] at hx hy ⊢
   rw [RingHom.map_pow, v.map_pow, ← rpow_lt_rpow_iff h1p, ← rpow_nat_cast, ← rpow_mul,
-    mul_one_div_cancel (Nat.cast_ne_zero.2 hp.1.NeZero : (p : ℝ) ≠ 0), rpow_one] at hx hy
+    mul_one_div_cancel (Nat.cast_ne_zero.2 hp.1.NeZero : (p : ℝ) ≠ 0), rpow_one] at hx hy 
   rw [RingHom.map_mul, v.map_mul]; refine' lt_of_le_of_lt _ (mul_lt_mul₀ hx hy)
   by_cases hvp : v p = 0; · rw [hvp]; exact zero_le _; replace hvp := zero_lt_iff.2 hvp
   conv_lhs => rw [← rpow_one (v p)]; rw [← rpow_add (ne_of_gt hvp)]
@@ -608,7 +608,7 @@ theorem valAux_mul (f g : PreTilt K v O hv p) :
     · rw [← RingHom.map_pow, coeff_pow_p f]; assumption
     · rw [← RingHom.map_pow, coeff_pow_p g]; assumption
   rw [val_aux_eq (coeff_add_ne_zero hm 1), val_aux_eq (coeff_add_ne_zero hn 1), val_aux_eq hfg]
-  rw [RingHom.map_mul] at hfg⊢; rw [ModP.preVal_mul hfg, mul_pow]
+  rw [RingHom.map_mul] at hfg ⊢; rw [ModP.preVal_mul hfg, mul_pow]
 #align pre_tilt.val_aux_mul PreTilt.valAux_mul
 
 theorem valAux_add (f g : PreTilt K v O hv p) :
@@ -654,7 +654,7 @@ theorem map_eq_zero {f : PreTilt K v O hv p} : val K v O hv p f = 0 ↔ f = 0 :=
   by_cases hf0 : f = 0; · rw [hf0]; exact iff_of_true (Valuation.map_zero _) rfl
   obtain ⟨n, hn⟩ : ∃ n, coeff _ _ n f ≠ 0 := not_forall.1 fun h => hf0 <| Perfection.ext h
   show val_aux K v O hv p f = 0 ↔ f = 0; refine' iff_of_false (fun hvf => hn _) hf0
-  rw [val_aux_eq hn] at hvf; replace hvf := pow_eq_zero hvf; rwa [ModP.preVal_eq_zero] at hvf
+  rw [val_aux_eq hn] at hvf ; replace hvf := pow_eq_zero hvf; rwa [ModP.preVal_eq_zero] at hvf 
 #align pre_tilt.map_eq_zero PreTilt.map_eq_zero
 
 end Classical
@@ -664,7 +664,7 @@ instance : IsDomain (PreTilt K v O hv p) :=
   haveI : Nontrivial (PreTilt K v O hv p) := ⟨(CharP.nontrivial_of_char_ne_one hp.1.ne_one).1⟩
   haveI : NoZeroDivisors (PreTilt K v O hv p) :=
     ⟨fun f g hfg => by
-      simp_rw [← map_eq_zero] at hfg⊢; contrapose! hfg; rw [Valuation.map_mul]
+      simp_rw [← map_eq_zero] at hfg ⊢; contrapose! hfg; rw [Valuation.map_mul]
       exact mul_ne_zero hfg.1 hfg.2⟩
   exact NoZeroDivisors.to_isDomain _
 
Diff
@@ -33,7 +33,7 @@ Define the valuation on the tilt, and define a characteristic predicate for the
 
 universe u₁ u₂ u₃ u₄
 
-open NNReal
+open scoped NNReal
 
 /-- The perfection of a monoid `M`, defined to be the projective limit of `M`
 using the `p`-th power maps `M → M` indexed by the natural numbers, implemented as
@@ -540,7 +540,7 @@ instance : CharP (PreTilt K v O hv p) p :=
 
 section Classical
 
-open Classical
+open scoped Classical
 
 open Perfection
 
Diff
@@ -136,9 +136,7 @@ theorem coeff_pthRoot (f : Ring.Perfection R p) (n : ℕ) :
 #align perfection.coeff_pth_root Perfection.coeff_pthRoot
 
 theorem coeff_pow_p (f : Ring.Perfection R p) (n : ℕ) : coeff R p (n + 1) (f ^ p) = coeff R p n f :=
-  by
-  rw [RingHom.map_pow]
-  exact f.2 n
+  by rw [RingHom.map_pow]; exact f.2 n
 #align perfection.coeff_pow_p Perfection.coeff_pow_p
 
 theorem coeff_pow_p' (f : Ring.Perfection R p) (n : ℕ) : coeff R p (n + 1) f ^ p = coeff R p n f :=
@@ -453,18 +451,8 @@ theorem preVal_zero : preVal K v O hv p 0 = 0 :=
 theorem preVal_mul {x y : ModP K v O hv p} (hxy0 : x * y ≠ 0) :
     preVal K v O hv p (x * y) = preVal K v O hv p x * preVal K v O hv p y :=
   by
-  have hx0 : x ≠ 0 :=
-    mt
-      (by
-        rintro rfl
-        rw [MulZeroClass.zero_mul])
-      hxy0
-  have hy0 : y ≠ 0 :=
-    mt
-      (by
-        rintro rfl
-        rw [MulZeroClass.mul_zero])
-      hxy0
+  have hx0 : x ≠ 0 := mt (by rintro rfl; rw [MulZeroClass.zero_mul]) hxy0
+  have hy0 : y ≠ 0 := mt (by rintro rfl; rw [MulZeroClass.mul_zero]) hxy0
   obtain ⟨r, rfl⟩ := Ideal.Quotient.mk_surjective x
   obtain ⟨s, rfl⟩ := Ideal.Quotient.mk_surjective y
   rw [← RingHom.map_mul] at hxy0⊢
@@ -474,15 +462,9 @@ theorem preVal_mul {x y : ModP K v O hv p} (hxy0 : x * y ≠ 0) :
 theorem preVal_add (x y : ModP K v O hv p) :
     preVal K v O hv p (x + y) ≤ max (preVal K v O hv p x) (preVal K v O hv p y) :=
   by
-  by_cases hx0 : x = 0;
-  · rw [hx0, zero_add]
-    exact le_max_right _ _
-  by_cases hy0 : y = 0;
-  · rw [hy0, add_zero]
-    exact le_max_left _ _
-  by_cases hxy0 : x + y = 0;
-  · rw [hxy0, pre_val_zero]
-    exact zero_le _
+  by_cases hx0 : x = 0; · rw [hx0, zero_add]; exact le_max_right _ _
+  by_cases hy0 : y = 0; · rw [hy0, add_zero]; exact le_max_left _ _
+  by_cases hxy0 : x + y = 0; · rw [hxy0, pre_val_zero]; exact zero_le _
   obtain ⟨r, rfl⟩ := Ideal.Quotient.mk_surjective x
   obtain ⟨s, rfl⟩ := Ideal.Quotient.mk_surjective y
   rw [← RingHom.map_add] at hxy0⊢
@@ -492,9 +474,8 @@ theorem preVal_add (x y : ModP K v O hv p) :
 theorem v_p_lt_preVal {x : ModP K v O hv p} : v p < preVal K v O hv p x ↔ x ≠ 0 :=
   by
   refine'
-    ⟨fun h hx => by
-      rw [hx, pre_val_zero] at h
-      exact not_lt_zero' h, fun h => lt_of_not_le fun hp => h _⟩
+    ⟨fun h hx => by rw [hx, pre_val_zero] at h; exact not_lt_zero' h, fun h =>
+      lt_of_not_le fun hp => h _⟩
   obtain ⟨r, rfl⟩ := Ideal.Quotient.mk_surjective x
   rw [pre_val_mk h, ← map_natCast (algebraMap O K) p, hv.le_iff_dvd] at hp
   rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton]; exact hp
@@ -502,9 +483,7 @@ theorem v_p_lt_preVal {x : ModP K v O hv p} : v p < preVal K v O hv p x ↔ x 
 
 theorem preVal_eq_zero {x : ModP K v O hv p} : preVal K v O hv p x = 0 ↔ x = 0 :=
   ⟨fun hvx =>
-    by_contradiction fun hx0 : x ≠ 0 =>
-      by
-      rw [← v_p_lt_pre_val, hvx] at hx0
+    by_contradiction fun hx0 : x ≠ 0 => by rw [← v_p_lt_pre_val, hvx] at hx0;
       exact not_lt_zero' hx0,
     fun hx => hx.symm ▸ preVal_zero⟩
 #align mod_p.pre_val_eq_zero ModP.preVal_eq_zero
@@ -533,9 +512,7 @@ theorem mul_ne_zero_of_pow_p_ne_zero {x y : ModP K v O hv p} (hx : x ^ p ≠ 0)
   rw [RingHom.map_pow, v.map_pow, ← rpow_lt_rpow_iff h1p, ← rpow_nat_cast, ← rpow_mul,
     mul_one_div_cancel (Nat.cast_ne_zero.2 hp.1.NeZero : (p : ℝ) ≠ 0), rpow_one] at hx hy
   rw [RingHom.map_mul, v.map_mul]; refine' lt_of_le_of_lt _ (mul_lt_mul₀ hx hy)
-  by_cases hvp : v p = 0;
-  · rw [hvp]
-    exact zero_le _; replace hvp := zero_lt_iff.2 hvp
+  by_cases hvp : v p = 0; · rw [hvp]; exact zero_le _; replace hvp := zero_lt_iff.2 hvp
   conv_lhs => rw [← rpow_one (v p)]; rw [← rpow_add (ne_of_gt hvp)]
   refine' rpow_le_rpow_of_exponent_ge hvp (map_natCast (algebraMap O K) p ▸ hv.2 _) _
   rw [← add_div, div_le_one (Nat.cast_pos.2 hp.1.Pos : 0 < (p : ℝ))]; exact_mod_cast hp.1.two_le
@@ -589,8 +566,7 @@ theorem valAux_eq {f : PreTilt K v O hv p} {n : ℕ} (hfn : coeff _ _ n f ≠ 0)
   have h : ∃ n, coeff _ _ n f ≠ 0 := ⟨n, hfn⟩
   rw [val_aux, dif_pos h]
   obtain ⟨k, rfl⟩ := Nat.exists_eq_add_of_le (Nat.find_min' h hfn)
-  induction' k with k ih
-  · rfl
+  induction' k with k ih; · rfl
   obtain ⟨x, hx⟩ := Ideal.Quotient.mk_surjective (coeff _ _ (Nat.find h + k + 1) f)
   have h1 : (Ideal.Quotient.mk _ x : ModP K v O hv p) ≠ 0 := hx.symm ▸ hfn
   have h2 : (Ideal.Quotient.mk _ (x ^ p) : ModP K v O hv p) ≠ 0 :=
@@ -619,10 +595,8 @@ theorem valAux_one : valAux K v O hv p 1 = 1 :=
 theorem valAux_mul (f g : PreTilt K v O hv p) :
     valAux K v O hv p (f * g) = valAux K v O hv p f * valAux K v O hv p g :=
   by
-  by_cases hf : f = 0
-  · rw [hf, MulZeroClass.zero_mul, val_aux_zero, MulZeroClass.zero_mul]
-  by_cases hg : g = 0
-  · rw [hg, MulZeroClass.mul_zero, val_aux_zero, MulZeroClass.mul_zero]
+  by_cases hf : f = 0; · rw [hf, MulZeroClass.zero_mul, val_aux_zero, MulZeroClass.zero_mul]
+  by_cases hg : g = 0; · rw [hg, MulZeroClass.mul_zero, val_aux_zero, MulZeroClass.mul_zero]
   obtain ⟨m, hm⟩ : ∃ n, coeff _ _ n f ≠ 0 := not_forall.1 fun h => hf <| Perfection.ext h
   obtain ⟨n, hn⟩ : ∃ n, coeff _ _ n g ≠ 0 := not_forall.1 fun h => hg <| Perfection.ext h
   replace hm := coeff_ne_zero_of_le hm (le_max_left m n)
@@ -631,27 +605,18 @@ theorem valAux_mul (f g : PreTilt K v O hv p) :
     by
     rw [RingHom.map_mul]
     refine' ModP.mul_ne_zero_of_pow_p_ne_zero _ _
-    · rw [← RingHom.map_pow, coeff_pow_p f]
-      assumption
-    · rw [← RingHom.map_pow, coeff_pow_p g]
-      assumption
+    · rw [← RingHom.map_pow, coeff_pow_p f]; assumption
+    · rw [← RingHom.map_pow, coeff_pow_p g]; assumption
   rw [val_aux_eq (coeff_add_ne_zero hm 1), val_aux_eq (coeff_add_ne_zero hn 1), val_aux_eq hfg]
-  rw [RingHom.map_mul] at hfg⊢
-  rw [ModP.preVal_mul hfg, mul_pow]
+  rw [RingHom.map_mul] at hfg⊢; rw [ModP.preVal_mul hfg, mul_pow]
 #align pre_tilt.val_aux_mul PreTilt.valAux_mul
 
 theorem valAux_add (f g : PreTilt K v O hv p) :
     valAux K v O hv p (f + g) ≤ max (valAux K v O hv p f) (valAux K v O hv p g) :=
   by
-  by_cases hf : f = 0;
-  · rw [hf, zero_add, val_aux_zero, max_eq_right]
-    exact zero_le _
-  by_cases hg : g = 0;
-  · rw [hg, add_zero, val_aux_zero, max_eq_left]
-    exact zero_le _
-  by_cases hfg : f + g = 0;
-  · rw [hfg, val_aux_zero]
-    exact zero_le _
+  by_cases hf : f = 0; · rw [hf, zero_add, val_aux_zero, max_eq_right]; exact zero_le _
+  by_cases hg : g = 0; · rw [hg, add_zero, val_aux_zero, max_eq_left]; exact zero_le _
+  by_cases hfg : f + g = 0; · rw [hfg, val_aux_zero]; exact zero_le _
   replace hf : ∃ n, coeff _ _ n f ≠ 0 := not_forall.1 fun h => hf <| Perfection.ext h
   replace hg : ∃ n, coeff _ _ n g ≠ 0 := not_forall.1 fun h => hg <| Perfection.ext h
   replace hfg : ∃ n, coeff _ _ n (f + g) ≠ 0 := not_forall.1 fun h => hfg <| Perfection.ext h
@@ -686,9 +651,7 @@ variable {K v O hv p}
 
 theorem map_eq_zero {f : PreTilt K v O hv p} : val K v O hv p f = 0 ↔ f = 0 :=
   by
-  by_cases hf0 : f = 0;
-  · rw [hf0]
-    exact iff_of_true (Valuation.map_zero _) rfl
+  by_cases hf0 : f = 0; · rw [hf0]; exact iff_of_true (Valuation.map_zero _) rfl
   obtain ⟨n, hn⟩ : ∃ n, coeff _ _ n f ≠ 0 := not_forall.1 fun h => hf0 <| Perfection.ext h
   show val_aux K v O hv p f = 0 ↔ f = 0; refine' iff_of_false (fun hvf => hn _) hf0
   rw [val_aux_eq hn] at hvf; replace hvf := pow_eq_zero hvf; rwa [ModP.preVal_eq_zero] at hvf
@@ -701,9 +664,7 @@ instance : IsDomain (PreTilt K v O hv p) :=
   haveI : Nontrivial (PreTilt K v O hv p) := ⟨(CharP.nontrivial_of_char_ne_one hp.1.ne_one).1⟩
   haveI : NoZeroDivisors (PreTilt K v O hv p) :=
     ⟨fun f g hfg => by
-      simp_rw [← map_eq_zero] at hfg⊢
-      contrapose! hfg
-      rw [Valuation.map_mul]
+      simp_rw [← map_eq_zero] at hfg⊢; contrapose! hfg; rw [Valuation.map_mul]
       exact mul_ne_zero hfg.1 hfg.2⟩
   exact NoZeroDivisors.to_isDomain _
 
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Kenny Lau
 
 ! This file was ported from Lean 3 source module ring_theory.perfection
-! leanprover-community/mathlib commit b1d911acd60ab198808e853292106ee352b648ea
+! leanprover-community/mathlib commit 0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -12,7 +12,7 @@ import Mathbin.Algebra.CharP.Pi
 import Mathbin.Algebra.CharP.Quotient
 import Mathbin.Algebra.CharP.Subring
 import Mathbin.Algebra.Ring.Pi
-import Mathbin.Analysis.SpecialFunctions.Pow
+import Mathbin.Analysis.SpecialFunctions.Pow.Nnreal
 import Mathbin.FieldTheory.PerfectClosure
 import Mathbin.RingTheory.Localization.FractionRing
 import Mathbin.RingTheory.Subring.Basic
Diff
@@ -457,13 +457,13 @@ theorem preVal_mul {x y : ModP K v O hv p} (hxy0 : x * y ≠ 0) :
     mt
       (by
         rintro rfl
-        rw [zero_mul])
+        rw [MulZeroClass.zero_mul])
       hxy0
   have hy0 : y ≠ 0 :=
     mt
       (by
         rintro rfl
-        rw [mul_zero])
+        rw [MulZeroClass.mul_zero])
       hxy0
   obtain ⟨r, rfl⟩ := Ideal.Quotient.mk_surjective x
   obtain ⟨s, rfl⟩ := Ideal.Quotient.mk_surjective y
@@ -620,9 +620,9 @@ theorem valAux_mul (f g : PreTilt K v O hv p) :
     valAux K v O hv p (f * g) = valAux K v O hv p f * valAux K v O hv p g :=
   by
   by_cases hf : f = 0
-  · rw [hf, zero_mul, val_aux_zero, zero_mul]
+  · rw [hf, MulZeroClass.zero_mul, val_aux_zero, MulZeroClass.zero_mul]
   by_cases hg : g = 0
-  · rw [hg, mul_zero, val_aux_zero, mul_zero]
+  · rw [hg, MulZeroClass.mul_zero, val_aux_zero, MulZeroClass.mul_zero]
   obtain ⟨m, hm⟩ : ∃ n, coeff _ _ n f ≠ 0 := not_forall.1 fun h => hf <| Perfection.ext h
   obtain ⟨n, hn⟩ : ∃ n, coeff _ _ n g ≠ 0 := not_forall.1 fun h => hg <| Perfection.ext h
   replace hm := coeff_ne_zero_of_le hm (le_max_left m n)

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
@@ -477,7 +477,7 @@ theorem mul_ne_zero_of_pow_p_ne_zero {x y : ModP K v O hv p} (hx : x ^ p ≠ 0)
   rw [← (Ideal.Quotient.mk (Ideal.span {(p : O)})).map_mul]
   rw [← (Ideal.Quotient.mk (Ideal.span {(p : O)})).map_pow] at hx hy
   rw [← v_p_lt_val hv] at hx hy ⊢
-  rw [RingHom.map_pow, v.map_pow, ← rpow_lt_rpow_iff h1p, ← rpow_nat_cast, ← rpow_mul,
+  rw [RingHom.map_pow, v.map_pow, ← rpow_lt_rpow_iff h1p, ← rpow_natCast, ← rpow_mul,
     mul_one_div_cancel (Nat.cast_ne_zero.2 hp.1.ne_zero : (p : ℝ) ≠ 0), rpow_one] at hx hy
   rw [RingHom.map_mul, v.map_mul]; refine' lt_of_le_of_lt _ (mul_lt_mul₀ hx hy)
   by_cases hvp : v p = 0
chore: classify porting notes referring to missing linters (#12098)

Reference the newly created issues #12094 and #12096, as well as the pre-existing #5171. Change all references to #10927 to #5171. Some of these changes were not labelled as "porting note"; change this for good measure.

Diff
@@ -229,7 +229,7 @@ end Perfection
 
 /-- A perfection map to a ring of characteristic `p` is a map that is isomorphic
 to its perfection. -/
--- @[nolint has_nonempty_instance] -- Porting note: This linter does not exist yet.
+-- @[nolint has_nonempty_instance] -- Porting note(#5171): This linter does not exist yet.
 structure PerfectionMap (p : ℕ) [Fact p.Prime] {R : Type u₁} [CommSemiring R] [CharP R p]
     {P : Type u₂} [CommSemiring P] [CharP P p] [PerfectRing P p] (π : P →+* R) : Prop where
   injective : ∀ ⦃x y : P⦄,
@@ -372,7 +372,7 @@ variable (p : ℕ)
 
 -- Porting note: Specified all arguments explicitly
 /-- `O/(p)` for `O`, ring of integers of `K`. -/
-@[nolint unusedArguments] -- Porting note: Removed `nolint has_nonempty_instance`
+@[nolint unusedArguments] -- Porting note(#5171): removed `nolint has_nonempty_instance`
 def ModP (K : Type u₁) [Field K] (v : Valuation K ℝ≥0) (O : Type u₂) [CommRing O] [Algebra O K]
     (_ : v.Integers O) (p : ℕ) :=
   O ⧸ (Ideal.span {(p : O)} : Ideal O)
@@ -494,7 +494,7 @@ end Classical
 end ModP
 
 /-- Perfection of `O/(p)` where `O` is the ring of integers of `K`. -/
--- @[nolint has_nonempty_instance] -- Porting note: This linter does not exist yet.
+-- @[nolint has_nonempty_instance] -- Porting note(#5171): This linter does not exist yet.
 def PreTilt :=
   Ring.Perfection (ModP K v O hv p) p
 #align pre_tilt PreTilt
@@ -638,7 +638,7 @@ end PreTilt
 /-- The tilt of a field, as defined in Perfectoid Spaces by Peter Scholze, as in
 [scholze2011perfectoid]. Given a field `K` with valuation `K → ℝ≥0` and ring of integers `O`,
 this is implemented as the fraction field of the perfection of `O/(p)`. -/
--- @[nolint has_nonempty_instance] -- Porting note: This linter does not exist yet.
+-- @[nolint has_nonempty_instance] -- Porting note(#5171): This linter does not exist yet.
 def Tilt :=
   FractionRing (PreTilt K v O hv p)
 #align tilt Tilt
change the order of operation in zsmulRec and nsmulRec (#11451)

We change the following field in the definition of an additive commutative monoid:

 nsmul_succ : ∀ (n : ℕ) (x : G),
-  AddMonoid.nsmul (n + 1) x = x + AddMonoid.nsmul n x
+  AddMonoid.nsmul (n + 1) x = AddMonoid.nsmul n x + x

where the latter is more natural

We adjust the definitions of ^ in monoids, groups, etc. Originally there was a warning comment about why this natural order was preferred

use x * npowRec n x and not npowRec n x * x in the definition to make sure that definitional unfolding of npowRec is blocked, to avoid deep recursion issues.

but it seems to no longer apply.

Remarks on the PR :

  • pow_succ and pow_succ' have switched their meanings.
  • Most of the time, the proofs were adjusted by priming/unpriming one lemma, or exchanging left and right; a few proofs were more complicated to adjust.
  • In particular, [Mathlib/NumberTheory/RamificationInertia.lean] used Ideal.IsPrime.mul_mem_pow which is defined in [Mathlib/RingTheory/DedekindDomain/Ideal.lean]. Changing the order of operation forced me to add the symmetric lemma Ideal.IsPrime.mem_pow_mul.
  • the docstring for Cauchy condensation test in [Mathlib/Analysis/PSeries.lean] was mathematically incorrect, I added the mention that the function is antitone.
Diff
@@ -543,7 +543,7 @@ theorem valAux_eq {f : PreTilt K v O hv p} {n : ℕ} (hfn : coeff _ _ n f ≠ 0)
     exact coeff_nat_find_add_ne_zero k
   erw [ih (coeff_nat_find_add_ne_zero k), ← hx, ← coeff_pow_p, RingHom.map_pow, ← hx,
     ← RingHom.map_pow, ModP.preVal_mk h1, ModP.preVal_mk h2, RingHom.map_pow, v.map_pow, ← pow_mul,
-    pow_succ]
+    pow_succ']
   rfl
 #align pre_tilt.val_aux_eq PreTilt.valAux_eq
 
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
@@ -190,10 +190,10 @@ noncomputable def lift (R : Type u₁) [CommSemiring R] [CharP R p] [PerfectRing
   toFun f :=
     { toFun := fun r => ⟨fun n => f (((frobeniusEquiv R p).symm : R →+* R)^[n] r),
         fun n => by erw [← f.map_pow, Function.iterate_succ_apply', frobeniusEquiv_symm_pow_p]⟩
-      map_one' := ext fun n => (congr_arg f <| RingHom.iterate_map_one _ _).trans f.map_one
+      map_one' := ext fun n => (congr_arg f <| iterate_map_one _ _).trans f.map_one
       map_mul' := fun x y =>
         ext fun n => (congr_arg f <| iterate_map_mul _ _ _ _).trans <| f.map_mul _ _
-      map_zero' := ext fun n => (congr_arg f <| RingHom.iterate_map_zero _ _).trans f.map_zero
+      map_zero' := ext fun n => (congr_arg f <| iterate_map_zero _ _).trans f.map_zero
       map_add' := fun x y =>
         ext fun n => (congr_arg f <| iterate_map_add _ _ _ _).trans <| f.map_add _ _ }
   invFun := RingHom.comp <| coeff S p 0
chore(*): remove empty lines between variable statements (#11418)

Empty lines were removed by executing the following Python script twice

import os
import re


# Loop through each file in the repository
for dir_path, dirs, files in os.walk('.'):
  for filename in files:
    if filename.endswith('.lean'):
      file_path = os.path.join(dir_path, filename)

      # Open the file and read its contents
      with open(file_path, 'r') as file:
        content = file.read()

      # Use a regular expression to replace sequences of "variable" lines separated by empty lines
      # with sequences without empty lines
      modified_content = re.sub(r'(variable.*\n)\n(variable(?! .* in))', r'\1\2', content)

      # Write the modified content back to the file
      with open(file_path, 'w') as file:
        file.write(modified_content)
Diff
@@ -241,9 +241,7 @@ structure PerfectionMap (p : ℕ) [Fact p.Prime] {R : Type u₁} [CommSemiring R
 namespace PerfectionMap
 
 variable {p : ℕ} [Fact p.Prime]
-
 variable {R : Type u₁} [CommSemiring R] [CharP R p]
-
 variable {P : Type u₃} [CommSemiring P] [CharP P p] [PerfectRing P p]
 
 /-- Create a `PerfectionMap` from an isomorphism to the perfection. -/
@@ -340,9 +338,7 @@ theorem hom_ext [PerfectRing R p] {S : Type u₂} [CommSemiring S] [CharP S p] {
 #align perfection_map.hom_ext PerfectionMap.hom_ext
 
 variable {P} (p)
-
 variable {S : Type u₂} [CommSemiring S] [CharP S p]
-
 variable {Q : Type u₄} [CommSemiring Q] [CharP Q p] [PerfectRing Q p]
 
 /-- A ring homomorphism `R →+* S` induces `P →+* Q`, a map of the respective perfections. -/
@@ -371,9 +367,7 @@ end PerfectionMap
 section Perfectoid
 
 variable (K : Type u₁) [Field K] (v : Valuation K ℝ≥0)
-
 variable (O : Type u₂) [CommRing O] [Algebra O K] (hv : v.Integers O)
-
 variable (p : ℕ)
 
 -- Porting note: Specified all arguments explicitly
chore: tidy various files (#10362)
Diff
@@ -480,8 +480,9 @@ theorem mul_ne_zero_of_pow_p_ne_zero {x y : ModP K v O hv p} (hx : x ^ p ≠ 0)
   obtain ⟨r, rfl⟩ := Ideal.Quotient.mk_surjective x
   obtain ⟨s, rfl⟩ := Ideal.Quotient.mk_surjective y
   have h1p : (0 : ℝ) < 1 / p := one_div_pos.2 (Nat.cast_pos.2 hp.1.pos)
-  erw [← RingHom.map_mul]; erw [← RingHom.map_pow] at hx hy
-  erw [← v_p_lt_val hv] at hx hy ⊢
+  rw [← (Ideal.Quotient.mk (Ideal.span {(p : O)})).map_mul]
+  rw [← (Ideal.Quotient.mk (Ideal.span {(p : O)})).map_pow] at hx hy
+  rw [← v_p_lt_val hv] at hx hy ⊢
   rw [RingHom.map_pow, v.map_pow, ← rpow_lt_rpow_iff h1p, ← rpow_nat_cast, ← rpow_mul,
     mul_one_div_cancel (Nat.cast_ne_zero.2 hp.1.ne_zero : (p : ℝ) ≠ 0), rpow_one] at hx hy
   rw [RingHom.map_mul, v.map_mul]; refine' lt_of_le_of_lt _ (mul_lt_mul₀ hx hy)
feat: The support of f ^ n (#9617)

This involves moving lemmas from Algebra.GroupPower.Ring to Algebra.GroupWithZero.Basic and changing some 0 < n assumptions to n ≠ 0.

From LeanAPAP

Diff
@@ -47,7 +47,7 @@ indexed by the natural numbers, implemented as `{ f : ℕ → R | ∀ n, f (n +
 def Ring.perfectionSubsemiring (R : Type u₁) [CommSemiring R] (p : ℕ) [hp : Fact p.Prime]
     [CharP R p] : Subsemiring (ℕ → R) :=
   { Monoid.perfection R p with
-    zero_mem' := fun _ => zero_pow <| hp.1.pos
+    zero_mem' := fun _ ↦ zero_pow hp.1.ne_zero
     add_mem' := fun hf hg n => (frobenius_add R p _ _).trans <| congr_arg₂ _ (hf n) (hg n) }
 #align ring.perfection_subsemiring Ring.perfectionSubsemiring
 
@@ -163,7 +163,8 @@ theorem frobenius_pthRoot : (frobenius _ p).comp (pthRoot R p) = RingHom.id _ :=
 
 theorem coeff_add_ne_zero {f : Ring.Perfection R p} {n : ℕ} (hfn : coeff R p n f ≠ 0) (k : ℕ) :
     coeff R p (n + k) f ≠ 0 :=
-  Nat.recOn k hfn fun k ih h => ih <| by erw [← coeff_pow_p, RingHom.map_pow, h, zero_pow hp.1.pos]
+  Nat.recOn k hfn fun k ih h => ih <| by
+    erw [← coeff_pow_p, RingHom.map_pow, h, zero_pow hp.1.ne_zero]
 #align perfection.coeff_add_ne_zero Perfection.coeff_add_ne_zero
 
 theorem coeff_ne_zero_of_le {f : Ring.Perfection R p} {m n : ℕ} (hfm : coeff R p m f ≠ 0)
chore(*): rename FunLike to DFunLike (#9785)

This prepares for the introduction of a non-dependent synonym of FunLike, which helps a lot with keeping #8386 readable.

This is entirely search-and-replace in 680197f combined with manual fixes in 4145626, e900597 and b8428f8. The commands that generated this change:

sed -i 's/\bFunLike\b/DFunLike/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean
sed -i 's/\btoFunLike\b/toDFunLike/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean
sed -i 's/import Mathlib.Data.DFunLike/import Mathlib.Data.FunLike/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean
sed -i 's/\bHom_FunLike\b/Hom_DFunLike/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean     
sed -i 's/\binstFunLike\b/instDFunLike/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean
sed -i 's/\bfunLike\b/instDFunLike/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean
sed -i 's/\btoo many metavariables to apply `fun_like.has_coe_to_fun`/too many metavariables to apply `DFunLike.hasCoeToFun`/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean

Co-authored-by: Anne Baanen <Vierkantor@users.noreply.github.com>

Diff
@@ -177,8 +177,8 @@ variable (R p)
 instance perfectRing : PerfectRing (Ring.Perfection R p) p where
   bijective_frobenius := Function.bijective_iff_has_inverse.mpr
     ⟨pthRoot R p,
-     FunLike.congr_fun <| @frobenius_pthRoot R _ p _ _,
-     FunLike.congr_fun <| @pthRoot_frobenius R _ p _ _⟩
+     DFunLike.congr_fun <| @frobenius_pthRoot R _ p _ _,
+     DFunLike.congr_fun <| @pthRoot_frobenius R _ p _ _⟩
 #align perfection.perfect_ring Perfection.perfectRing
 
 /-- Given rings `R` and `S` of characteristic `p`, with `R` being perfect,
chore: Rename pow monotonicity lemmas (#9095)

The names for lemmas about monotonicity of (a ^ ·) and (· ^ n) were a mess. This PR tidies up everything related by following the naming convention for (a * ·) and (· * b). Namely, (a ^ ·) is pow_right and (· ^ n) is pow_left in lemma names. All lemma renames follow the corresponding multiplication lemma names closely.

Renames

Algebra.GroupPower.Order

  • pow_monopow_right_mono
  • pow_le_powpow_le_pow_right
  • pow_le_pow_of_le_leftpow_le_pow_left
  • pow_lt_pow_of_lt_leftpow_lt_pow_left
  • strictMonoOn_powpow_left_strictMonoOn
  • pow_strictMono_rightpow_right_strictMono
  • pow_lt_powpow_lt_pow_right
  • pow_lt_pow_iffpow_lt_pow_iff_right
  • pow_le_pow_iffpow_le_pow_iff_right
  • self_lt_powlt_self_pow
  • strictAnti_powpow_right_strictAnti
  • pow_lt_pow_iff_of_lt_onepow_lt_pow_iff_right_of_lt_one
  • pow_lt_pow_of_lt_onepow_lt_pow_right_of_lt_one
  • lt_of_pow_lt_powlt_of_pow_lt_pow_left
  • le_of_pow_le_powle_of_pow_le_pow_left
  • pow_lt_pow₀pow_lt_pow_right₀

Algebra.GroupPower.CovariantClass

  • pow_le_pow_of_le_left'pow_le_pow_left'
  • nsmul_le_nsmul_of_le_rightnsmul_le_nsmul_right
  • pow_lt_pow'pow_lt_pow_right'
  • nsmul_lt_nsmulnsmul_lt_nsmul_left
  • pow_strictMono_leftpow_right_strictMono'
  • nsmul_strictMono_rightnsmul_left_strictMono
  • StrictMono.pow_right'StrictMono.pow_const
  • StrictMono.nsmul_leftStrictMono.const_nsmul
  • pow_strictMono_right'pow_left_strictMono
  • nsmul_strictMono_leftnsmul_right_strictMono
  • Monotone.pow_rightMonotone.pow_const
  • Monotone.nsmul_leftMonotone.const_nsmul
  • lt_of_pow_lt_pow'lt_of_pow_lt_pow_left'
  • lt_of_nsmul_lt_nsmullt_of_nsmul_lt_nsmul_right
  • pow_le_pow'pow_le_pow_right'
  • nsmul_le_nsmulnsmul_le_nsmul_left
  • pow_le_pow_of_le_one'pow_le_pow_right_of_le_one'
  • nsmul_le_nsmul_of_nonposnsmul_le_nsmul_left_of_nonpos
  • le_of_pow_le_pow'le_of_pow_le_pow_left'
  • le_of_nsmul_le_nsmul'le_of_nsmul_le_nsmul_right'
  • pow_le_pow_iff'pow_le_pow_iff_right'
  • nsmul_le_nsmul_iffnsmul_le_nsmul_iff_left
  • pow_lt_pow_iff'pow_lt_pow_iff_right'
  • nsmul_lt_nsmul_iffnsmul_lt_nsmul_iff_left

Data.Nat.Pow

  • Nat.pow_lt_pow_of_lt_leftNat.pow_lt_pow_left
  • Nat.pow_le_iff_le_leftNat.pow_le_pow_iff_left
  • Nat.pow_lt_iff_lt_leftNat.pow_lt_pow_iff_left

Lemmas added

  • pow_le_pow_iff_left
  • pow_lt_pow_iff_left
  • pow_right_injective
  • pow_right_inj
  • Nat.pow_le_pow_left to have the correct name since Nat.pow_le_pow_of_le_left is in Std.
  • Nat.pow_le_pow_right to have the correct name since Nat.pow_le_pow_of_le_right is in Std.

Lemmas removed

  • self_le_pow was a duplicate of le_self_pow.
  • Nat.pow_lt_pow_of_lt_right is defeq to pow_lt_pow_right.
  • Nat.pow_right_strictMono is defeq to pow_right_strictMono.
  • Nat.pow_le_iff_le_right is defeq to pow_le_pow_iff_right.
  • Nat.pow_lt_iff_lt_right is defeq to pow_lt_pow_iff_right.

Other changes

  • A bunch of proofs have been golfed.
  • Some lemma assumptions have been turned from 0 < n or 1 ≤ n to n ≠ 0.
  • A few Nat lemmas have been protected.
  • One docstring has been fixed.
Diff
@@ -600,8 +600,8 @@ theorem valAux_add (f g : PreTilt K v O hv p) :
   rw [valAux_eq hm, valAux_eq hn, valAux_eq hk, RingHom.map_add]
   cases' le_max_iff.1
       (ModP.preVal_add (coeff _ _ (max (max m n) k) f) (coeff _ _ (max (max m n) k) g)) with h h
-  · exact le_max_of_le_left (pow_le_pow_of_le_left' h _)
-  · exact le_max_of_le_right (pow_le_pow_of_le_left' h _)
+  · exact le_max_of_le_left (pow_le_pow_left' h _)
+  · exact le_max_of_le_right (pow_le_pow_left' h _)
 #align pre_tilt.val_aux_add PreTilt.valAux_add
 
 variable (K v O hv p)
chore: replace exact_mod_cast tactic with mod_cast elaborator where possible (#8404)

We still have the exact_mod_cast tactic, used in a few places, which somehow (?) works a little bit harder to prevent the expected type influencing the elaboration of the term. I would like to get to the bottom of this, and it will be easier once the only usages of exact_mod_cast are the ones that don't work using the term elaborator by itself.

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -490,7 +490,7 @@ theorem mul_ne_zero_of_pow_p_ne_zero {x y : ModP K v O hv p} (hx : x ^ p ≠ 0)
   conv_lhs => rw [← rpow_one (v p)]
   rw [← rpow_add (ne_of_gt hvp)]
   refine' rpow_le_rpow_of_exponent_ge hvp (map_natCast (algebraMap O K) p ▸ hv.2 _) _
-  rw [← add_div, div_le_one (Nat.cast_pos.2 hp.1.pos : 0 < (p : ℝ))]; exact_mod_cast hp.1.two_le
+  rw [← add_div, div_le_one (Nat.cast_pos.2 hp.1.pos : 0 < (p : ℝ))]; exact mod_cast hp.1.two_le
 #align mod_p.mul_ne_zero_of_pow_p_ne_zero ModP.mul_ne_zero_of_pow_p_ne_zero
 
 end Classical
perf(FunLike.Basic): beta reduce CoeFun.coe (#7905)

This eliminates (fun a ↦ β) α in the type when applying a FunLike.

Co-authored-by: Matthew Ballard <matt@mrb.email> Co-authored-by: Eric Wieser <wieser.eric@gmail.com>

Diff
@@ -428,7 +428,7 @@ theorem preVal_mul {x y : ModP K v O hv p} (hxy0 : x * y ≠ 0) :
   have hy0 : y ≠ 0 := mt (by rintro rfl; rw [mul_zero]) hxy0
   obtain ⟨r, rfl⟩ := Ideal.Quotient.mk_surjective x
   obtain ⟨s, rfl⟩ := Ideal.Quotient.mk_surjective y
-  rw [← RingHom.map_mul] at hxy0 ⊢
+  rw [← map_mul (Ideal.Quotient.mk (Ideal.span {↑p})) r s] at hxy0 ⊢
   rw [preVal_mk hx0, preVal_mk hy0, preVal_mk hxy0, RingHom.map_mul, v.map_mul]
 #align mod_p.pre_val_mul ModP.preVal_mul
 
@@ -442,7 +442,7 @@ theorem preVal_add (x y : ModP K v O hv p) :
   · rw [hxy0, preVal_zero]; exact zero_le _
   obtain ⟨r, rfl⟩ := Ideal.Quotient.mk_surjective x
   obtain ⟨s, rfl⟩ := Ideal.Quotient.mk_surjective y
-  rw [← RingHom.map_add] at hxy0 ⊢
+  rw [← map_add (Ideal.Quotient.mk (Ideal.span {↑p})) r s] at hxy0 ⊢
   rw [preVal_mk hx0, preVal_mk hy0, preVal_mk hxy0, RingHom.map_add]; exact v.map_add _ _
 #align mod_p.pre_val_add ModP.preVal_add
 
@@ -479,8 +479,8 @@ theorem mul_ne_zero_of_pow_p_ne_zero {x y : ModP K v O hv p} (hx : x ^ p ≠ 0)
   obtain ⟨r, rfl⟩ := Ideal.Quotient.mk_surjective x
   obtain ⟨s, rfl⟩ := Ideal.Quotient.mk_surjective y
   have h1p : (0 : ℝ) < 1 / p := one_div_pos.2 (Nat.cast_pos.2 hp.1.pos)
-  rw [← RingHom.map_mul]; rw [← RingHom.map_pow] at hx hy
-  rw [← v_p_lt_val hv] at hx hy ⊢
+  erw [← RingHom.map_mul]; erw [← RingHom.map_pow] at hx hy
+  erw [← v_p_lt_val hv] at hx hy ⊢
   rw [RingHom.map_pow, v.map_pow, ← rpow_lt_rpow_iff h1p, ← rpow_nat_cast, ← rpow_mul,
     mul_one_div_cancel (Nat.cast_ne_zero.2 hp.1.ne_zero : (p : ℝ) ≠ 0), rpow_one] at hx hy
   rw [RingHom.map_mul, v.map_mul]; refine' lt_of_le_of_lt _ (mul_lt_mul₀ hx hy)
@@ -540,7 +540,7 @@ theorem valAux_eq {f : PreTilt K v O hv p} {n : ℕ} (hfn : coeff _ _ n f ≠ 0)
   obtain ⟨k, rfl⟩ := Nat.exists_eq_add_of_le (Nat.find_min' h hfn)
   induction' k with k ih
   · rfl
-  obtain ⟨x, hx⟩ := Ideal.Quotient.mk_surjective (coeff _ _ (Nat.find h + k + 1) f)
+  obtain ⟨x, hx⟩ := Ideal.Quotient.mk_surjective (coeff (ModP K v O hv p) p (Nat.find h + k + 1) f)
   have h1 : (Ideal.Quotient.mk _ x : ModP K v O hv p) ≠ 0 := hx.symm ▸ hfn
   have h2 : (Ideal.Quotient.mk _ (x ^ p) : ModP K v O hv p) ≠ 0 := by
     erw [RingHom.map_pow, hx, ← RingHom.map_pow, coeff_pow_p]
chore: cleanup some spaces (#7484)

Purely cosmetic PR.

Diff
@@ -327,7 +327,7 @@ noncomputable def lift [PerfectRing R p] (S : Type u₂) [CommSemiring S] [CharP
   right_inv f := by
     exact RingHom.ext fun x => m.equiv.injective <| (m.equiv.apply_symm_apply _).trans
       <| show Perfection.lift p R S (π.comp f) x = RingHom.comp (↑m.equiv) f x from
-        RingHom.ext_iff.1 (by rw [Equiv.apply_eq_iff_eq_symm_apply]; rfl ) _
+        RingHom.ext_iff.1 (by rw [Equiv.apply_eq_iff_eq_symm_apply]; rfl) _
 #align perfection_map.lift PerfectionMap.lift
 
 variable {R p}
chore: tidy various files (#7035)
Diff
@@ -231,9 +231,9 @@ to its perfection. -/
 -- @[nolint has_nonempty_instance] -- Porting note: This linter does not exist yet.
 structure PerfectionMap (p : ℕ) [Fact p.Prime] {R : Type u₁} [CommSemiring R] [CharP R p]
     {P : Type u₂} [CommSemiring P] [CharP P p] [PerfectRing P p] (π : P →+* R) : Prop where
-  Injective : ∀ ⦃x y : P⦄,
+  injective : ∀ ⦃x y : P⦄,
     (∀ n, π (((frobeniusEquiv P p).symm)^[n] x) = π (((frobeniusEquiv P p).symm)^[n] y)) → x = y
-  Surjective : ∀ f : ℕ → R, (∀ n, f (n + 1) ^ p = f n) → ∃ x : P, ∀ n,
+  surjective : ∀ f : ℕ → R, (∀ n, f (n + 1) ^ p = f n) → ∃ x : P, ∀ n,
     π (((frobeniusEquiv P p).symm)^[n] x) = f n
 #align perfection_map PerfectionMap
 
@@ -249,11 +249,11 @@ variable {P : Type u₃} [CommSemiring P] [CharP P p] [PerfectRing P p]
 @[simps]
 theorem mk' {f : P →+* R} (g : P ≃+* Ring.Perfection R p) (hfg : Perfection.lift p P R f = g) :
     PerfectionMap p f :=
-  { Injective := fun x y hxy =>
+  { injective := fun x y hxy =>
       g.injective <|
         (RingHom.ext_iff.1 hfg x).symm.trans <|
           Eq.symm <| (RingHom.ext_iff.1 hfg y).symm.trans <| Perfection.ext fun n => (hxy n).symm
-    Surjective := fun y hy =>
+    surjective := fun y hy =>
       let ⟨x, hx⟩ := g.surjective ⟨y, hy⟩
       ⟨x, fun n =>
         show Perfection.coeff R p n (Perfection.lift p P R f x) = Perfection.coeff R p n ⟨y, hy⟩ by
@@ -269,8 +269,8 @@ theorem of : PerfectionMap p (Perfection.coeff R p 0) :=
 
 /-- For a perfect ring, it itself is the perfection. -/
 theorem id [PerfectRing R p] : PerfectionMap p (RingHom.id R) :=
-  { Injective := fun x y hxy => hxy 0
-    Surjective := fun f hf =>
+  { injective := fun x y hxy => hxy 0
+    surjective := fun f hf =>
       ⟨f 0, fun n =>
         show ((frobeniusEquiv R p).symm)^[n] (f 0) = f n from
           Nat.recOn n rfl fun n ih => injective_pow_p R p <| by
@@ -282,8 +282,8 @@ variable {p R P}
 /-- A perfection map induces an isomorphism to the perfection. -/
 noncomputable def equiv {π : P →+* R} (m : PerfectionMap p π) : P ≃+* Ring.Perfection R p :=
   RingEquiv.ofBijective (Perfection.lift p P R π)
-    ⟨fun _ _ hxy => m.Injective fun n => (congr_arg (Perfection.coeff R p n) hxy : _), fun f =>
-      let ⟨x, hx⟩ := m.Surjective f.1 f.2
+    ⟨fun _ _ hxy => m.injective fun n => (congr_arg (Perfection.coeff R p n) hxy : _), fun f =>
+      let ⟨x, hx⟩ := m.surjective f.1 f.2
       ⟨x, Perfection.ext <| hx⟩⟩
 #align perfection_map.equiv PerfectionMap.equiv
 
chore: drop MulZeroClass. in mul_zero/zero_mul (#6682)

Search&replace MulZeroClass.mul_zero -> mul_zero, MulZeroClass.zero_mul -> zero_mul.

These were introduced by Mathport, as the full name of mul_zero is actually MulZeroClass.mul_zero (it's exported with the short name).

Diff
@@ -424,8 +424,8 @@ theorem preVal_zero : preVal K v O hv p 0 = 0 :=
 
 theorem preVal_mul {x y : ModP K v O hv p} (hxy0 : x * y ≠ 0) :
     preVal K v O hv p (x * y) = preVal K v O hv p x * preVal K v O hv p y := by
-  have hx0 : x ≠ 0 := mt (by rintro rfl; rw [MulZeroClass.zero_mul]) hxy0
-  have hy0 : y ≠ 0 := mt (by rintro rfl; rw [MulZeroClass.mul_zero]) hxy0
+  have hx0 : x ≠ 0 := mt (by rintro rfl; rw [zero_mul]) hxy0
+  have hy0 : y ≠ 0 := mt (by rintro rfl; rw [mul_zero]) hxy0
   obtain ⟨r, rfl⟩ := Ideal.Quotient.mk_surjective x
   obtain ⟨s, rfl⟩ := Ideal.Quotient.mk_surjective y
   rw [← RingHom.map_mul] at hxy0 ⊢
@@ -566,9 +566,9 @@ theorem valAux_one : valAux K v O hv p 1 = 1 :=
 theorem valAux_mul (f g : PreTilt K v O hv p) :
     valAux K v O hv p (f * g) = valAux K v O hv p f * valAux K v O hv p g := by
   by_cases hf : f = 0
-  · rw [hf, MulZeroClass.zero_mul, valAux_zero, MulZeroClass.zero_mul]
+  · rw [hf, zero_mul, valAux_zero, zero_mul]
   by_cases hg : g = 0
-  · rw [hg, MulZeroClass.mul_zero, valAux_zero, MulZeroClass.mul_zero]
+  · rw [hg, mul_zero, valAux_zero, mul_zero]
   obtain ⟨m, hm⟩ : ∃ n, coeff _ _ n f ≠ 0 := not_forall.1 fun h => hf <| Perfection.ext h
   obtain ⟨n, hn⟩ : ∃ n, coeff _ _ n g ≠ 0 := not_forall.1 fun h => hg <| Perfection.ext h
   replace hm := coeff_ne_zero_of_le hm (le_max_left m n)
chore: refactor perfect rings / fields (#6182)

The main changes are:

  • we replace the data-bearing PerfectRing typeclass with a Prop-valued (non-constructive) version,
  • we introduce a new typeclass PerfectField,
  • we add a proof that a perfect field of positive characteristic has surjective Frobenius map,
  • we add some basic facts such as perfection of finite rings / fields and products of perfect rings.
Diff
@@ -8,7 +8,7 @@ import Mathlib.Algebra.CharP.Quotient
 import Mathlib.Algebra.CharP.Subring
 import Mathlib.Algebra.Ring.Pi
 import Mathlib.Analysis.SpecialFunctions.Pow.NNReal
-import Mathlib.FieldTheory.PerfectClosure
+import Mathlib.FieldTheory.Perfect
 import Mathlib.RingTheory.Localization.FractionRing
 import Mathlib.RingTheory.Subring.Basic
 import Mathlib.RingTheory.Valuation.Integers
@@ -175,31 +175,32 @@ theorem coeff_ne_zero_of_le {f : Ring.Perfection R p} {m n : ℕ} (hfm : coeff R
 variable (R p)
 
 instance perfectRing : PerfectRing (Ring.Perfection R p) p where
-  pthRoot' := pthRoot R p
-  frobenius_pthRoot' := FunLike.congr_fun <| @frobenius_pthRoot R _ p _ _
-  pthRoot_frobenius' := FunLike.congr_fun <| @pthRoot_frobenius R _ p _ _
+  bijective_frobenius := Function.bijective_iff_has_inverse.mpr
+    ⟨pthRoot R p,
+     FunLike.congr_fun <| @frobenius_pthRoot R _ p _ _,
+     FunLike.congr_fun <| @pthRoot_frobenius R _ p _ _⟩
 #align perfection.perfect_ring Perfection.perfectRing
 
 /-- Given rings `R` and `S` of characteristic `p`, with `R` being perfect,
 any homomorphism `R →+* S` can be lifted to a homomorphism `R →+* Perfection S p`. -/
 @[simps]
-def lift (R : Type u₁) [CommSemiring R] [CharP R p] [PerfectRing R p] (S : Type u₂) [CommSemiring S]
-    [CharP S p] : (R →+* S) ≃ (R →+* Ring.Perfection S p) where
+noncomputable def lift (R : Type u₁) [CommSemiring R] [CharP R p] [PerfectRing R p]
+    (S : Type u₂) [CommSemiring S] [CharP S p] : (R →+* S) ≃ (R →+* Ring.Perfection S p) where
   toFun f :=
-    { toFun := fun r => ⟨fun n => f ((_root_.pthRoot R p)^[n] r),
-        fun n => by rw [← f.map_pow, Function.iterate_succ_apply', pthRoot_pow_p]⟩
+    { toFun := fun r => ⟨fun n => f (((frobeniusEquiv R p).symm : R →+* R)^[n] r),
+        fun n => by erw [← f.map_pow, Function.iterate_succ_apply', frobeniusEquiv_symm_pow_p]⟩
       map_one' := ext fun n => (congr_arg f <| RingHom.iterate_map_one _ _).trans f.map_one
       map_mul' := fun x y =>
-        ext fun n => (congr_arg f <| RingHom.iterate_map_mul _ _ _ _).trans <| f.map_mul _ _
+        ext fun n => (congr_arg f <| iterate_map_mul _ _ _ _).trans <| f.map_mul _ _
       map_zero' := ext fun n => (congr_arg f <| RingHom.iterate_map_zero _ _).trans f.map_zero
       map_add' := fun x y =>
-        ext fun n => (congr_arg f <| RingHom.iterate_map_add _ _ _ _).trans <| f.map_add _ _ }
+        ext fun n => (congr_arg f <| iterate_map_add _ _ _ _).trans <| f.map_add _ _ }
   invFun := RingHom.comp <| coeff S p 0
   left_inv f := RingHom.ext fun r => rfl
   right_inv f := RingHom.ext fun r => ext fun n =>
-    show coeff S p 0 (f ((_root_.pthRoot R p)^[n] r)) = coeff S p n (f r) by
+    show coeff S p 0 (f (((frobeniusEquiv R p).symm)^[n] r)) = coeff S p n (f r) by
       rw [← coeff_iterate_frobenius _ 0 n, zero_add, ← RingHom.map_iterate_frobenius,
-        rightInverse_pthRoot_frobenius.iterate]
+        Function.RightInverse.iterate (frobenius_apply_frobeniusEquiv_symm R p) n]
 
 theorem hom_ext {R : Type u₁} [CommSemiring R] [CharP R p] [PerfectRing R p] {S : Type u₂}
     [CommSemiring S] [CharP S p] {f g : R →+* Ring.Perfection S p}
@@ -230,8 +231,10 @@ to its perfection. -/
 -- @[nolint has_nonempty_instance] -- Porting note: This linter does not exist yet.
 structure PerfectionMap (p : ℕ) [Fact p.Prime] {R : Type u₁} [CommSemiring R] [CharP R p]
     {P : Type u₂} [CommSemiring P] [CharP P p] [PerfectRing P p] (π : P →+* R) : Prop where
-  Injective : ∀ ⦃x y : P⦄, (∀ n, π ((pthRoot P p)^[n] x) = π ((pthRoot P p)^[n] y)) → x = y
-  Surjective : ∀ f : ℕ → R, (∀ n, f (n + 1) ^ p = f n) → ∃ x : P, ∀ n, π ((pthRoot P p)^[n] x) = f n
+  Injective : ∀ ⦃x y : P⦄,
+    (∀ n, π (((frobeniusEquiv P p).symm)^[n] x) = π (((frobeniusEquiv P p).symm)^[n] y)) → x = y
+  Surjective : ∀ f : ℕ → R, (∀ n, f (n + 1) ^ p = f n) → ∃ x : P, ∀ n,
+    π (((frobeniusEquiv P p).symm)^[n] x) = f n
 #align perfection_map PerfectionMap
 
 namespace PerfectionMap
@@ -269,9 +272,9 @@ theorem id [PerfectRing R p] : PerfectionMap p (RingHom.id R) :=
   { Injective := fun x y hxy => hxy 0
     Surjective := fun f hf =>
       ⟨f 0, fun n =>
-        show (pthRoot R p)^[n] (f 0) = f n from
-          Nat.recOn n rfl fun n ih =>
-            injective_pow_p p <| by rw [Function.iterate_succ_apply', pthRoot_pow_p _, ih, hf]⟩ }
+        show ((frobeniusEquiv R p).symm)^[n] (f 0) = f n from
+          Nat.recOn n rfl fun n ih => injective_pow_p R p <| by
+            rw [Function.iterate_succ_apply', frobeniusEquiv_symm_pow_p, ih, hf]⟩ }
 #align perfection_map.id PerfectionMap.id
 
 variable {p R P}
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,11 +2,6 @@
 Copyright (c) 2020 Kenny Lau. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Kenny Lau
-
-! This file was ported from Lean 3 source module ring_theory.perfection
-! leanprover-community/mathlib commit 0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Algebra.CharP.Pi
 import Mathlib.Algebra.CharP.Quotient
@@ -18,6 +13,8 @@ import Mathlib.RingTheory.Localization.FractionRing
 import Mathlib.RingTheory.Subring.Basic
 import Mathlib.RingTheory.Valuation.Integers
 
+#align_import ring_theory.perfection from "leanprover-community/mathlib"@"0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8"
+
 /-!
 # Ring Perfection and Tilt
 
fix precedence of Nat.iterate (#5589)
Diff
@@ -143,12 +143,12 @@ theorem coeff_frobenius (f : Ring.Perfection R p) (n : ℕ) :
 
 -- `coeff_pow_p f n` also works but is slow!
 theorem coeff_iterate_frobenius (f : Ring.Perfection R p) (n m : ℕ) :
-    coeff R p (n + m) ((frobenius _ p^[m]) f) = coeff R p n f :=
+    coeff R p (n + m) ((frobenius _ p)^[m] f) = coeff R p n f :=
   Nat.recOn m rfl fun m ih => by erw [Function.iterate_succ_apply', coeff_frobenius, ih]
 #align perfection.coeff_iterate_frobenius Perfection.coeff_iterate_frobenius
 
 theorem coeff_iterate_frobenius' (f : Ring.Perfection R p) (n m : ℕ) (hmn : m ≤ n) :
-    coeff R p n ((frobenius _ p^[m]) f) = coeff R p (n - m) f :=
+    coeff R p n ((frobenius _ p)^[m] f) = coeff R p (n - m) f :=
   Eq.symm <| (coeff_iterate_frobenius _ _ m).symm.trans <| (tsub_add_cancel_of_le hmn).symm ▸ rfl
 #align perfection.coeff_iterate_frobenius' Perfection.coeff_iterate_frobenius'
 
@@ -189,7 +189,7 @@ any homomorphism `R →+* S` can be lifted to a homomorphism `R →+* Perfection
 def lift (R : Type u₁) [CommSemiring R] [CharP R p] [PerfectRing R p] (S : Type u₂) [CommSemiring S]
     [CharP S p] : (R →+* S) ≃ (R →+* Ring.Perfection S p) where
   toFun f :=
-    { toFun := fun r => ⟨fun n => f ((_root_.pthRoot R p^[n]) r),
+    { toFun := fun r => ⟨fun n => f ((_root_.pthRoot R p)^[n] r),
         fun n => by rw [← f.map_pow, Function.iterate_succ_apply', pthRoot_pow_p]⟩
       map_one' := ext fun n => (congr_arg f <| RingHom.iterate_map_one _ _).trans f.map_one
       map_mul' := fun x y =>
@@ -200,7 +200,7 @@ def lift (R : Type u₁) [CommSemiring R] [CharP R p] [PerfectRing R p] (S : Typ
   invFun := RingHom.comp <| coeff S p 0
   left_inv f := RingHom.ext fun r => rfl
   right_inv f := RingHom.ext fun r => ext fun n =>
-    show coeff S p 0 (f ((_root_.pthRoot R p^[n]) r)) = coeff S p n (f r) by
+    show coeff S p 0 (f ((_root_.pthRoot R p)^[n] r)) = coeff S p n (f r) by
       rw [← coeff_iterate_frobenius _ 0 n, zero_add, ← RingHom.map_iterate_frobenius,
         rightInverse_pthRoot_frobenius.iterate]
 
@@ -233,8 +233,8 @@ to its perfection. -/
 -- @[nolint has_nonempty_instance] -- Porting note: This linter does not exist yet.
 structure PerfectionMap (p : ℕ) [Fact p.Prime] {R : Type u₁} [CommSemiring R] [CharP R p]
     {P : Type u₂} [CommSemiring P] [CharP P p] [PerfectRing P p] (π : P →+* R) : Prop where
-  Injective : ∀ ⦃x y : P⦄, (∀ n, π ((pthRoot P p^[n]) x) = π ((pthRoot P p^[n]) y)) → x = y
-  Surjective : ∀ f : ℕ → R, (∀ n, f (n + 1) ^ p = f n) → ∃ x : P, ∀ n, π ((pthRoot P p^[n]) x) = f n
+  Injective : ∀ ⦃x y : P⦄, (∀ n, π ((pthRoot P p)^[n] x) = π ((pthRoot P p)^[n] y)) → x = y
+  Surjective : ∀ f : ℕ → R, (∀ n, f (n + 1) ^ p = f n) → ∃ x : P, ∀ n, π ((pthRoot P p)^[n] x) = f n
 #align perfection_map PerfectionMap
 
 namespace PerfectionMap
@@ -272,7 +272,7 @@ theorem id [PerfectRing R p] : PerfectionMap p (RingHom.id R) :=
   { Injective := fun x y hxy => hxy 0
     Surjective := fun f hf =>
       ⟨f 0, fun n =>
-        show (pthRoot R p^[n]) (f 0) = f n from
+        show (pthRoot R p)^[n] (f 0) = f n from
           Nat.recOn n rfl fun n ih =>
             injective_pow_p p <| by rw [Function.iterate_succ_apply', pthRoot_pow_p _, ih, hf]⟩ }
 #align perfection_map.id PerfectionMap.id
chore: fix many typos (#4983)

These are all doc fixes

Diff
@@ -279,7 +279,7 @@ theorem id [PerfectRing R p] : PerfectionMap p (RingHom.id R) :=
 
 variable {p R P}
 
-/-- A perfection map induces an isomorphism to the prefection. -/
+/-- A perfection map induces an isomorphism to the perfection. -/
 noncomputable def equiv {π : P →+* R} (m : PerfectionMap p π) : P ≃+* Ring.Perfection R p :=
   RingEquiv.ofBijective (Perfection.lift p P R π)
     ⟨fun _ _ hxy => m.Injective fun n => (congr_arg (Perfection.coeff R p n) hxy : _), fun f =>
feat: port RingTheory.Perfection (#4629)

Co-authored-by: Xavier-François Roblot <46200072+xroblot@users.noreply.github.com> Co-authored-by: int-y1 <jason_yuen2007@hotmail.com>

Dependencies 12 + 756

757 files ported (98.4%)
332723 lines ported (98.3%)
Show graph

The unported dependencies are

The following 1 dependencies have changed in mathlib3 since they were ported, which may complicate porting this file