l3lab/ntp-mathlib huggingface dataset:
theorem nat_cast_eq_iff (x y : ℕ) : (x : PerfectClosure K p) = y ↔ (x : K) = y := by
  constructor <;> intro H
  · rw [nat_cast K p 0, nat_cast K p 0, eq_iff'] at H
    

Proof state:
case mp
K : Type u
inst✝² : CommRing K
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : CharP K p
x y : ℕ
H : ∃ z, (⇑(frobenius K p))^[(0, ↑y).1 + z] (0, ↑x).2 = (⇑(frobenius K p))^[(0, ↑x).1 + z] (0, ↑y).2
⊢ ↑x = ↑y

Next tactic:
cases' H with z H
theorem nat_cast_eq_iff (x y : ℕ) : (x : PerfectClosure K p) = y ↔ (x : K) = y := by
  constructor <;> intro H
  · rw [nat_cast K p 0, nat_cast K p 0, eq_iff'] at H
    cases' H with z H
    

Proof state:
case mp.intro
K : Type u
inst✝² : CommRing K
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : CharP K p
x y z : ℕ
H : (⇑(frobenius K p))^[(0, ↑y).1 + z] (0, ↑x).2 = (⇑(frobenius K p))^[(0, ↑x).1 + z] (0, ↑y).2
⊢ ↑x = ↑y

Next tactic:
simpa only [zero_add, iterate_fixed (frobenius_nat_cast K p _)] using H
theorem nat_cast_eq_iff (x y : ℕ) : (x : PerfectClosure K p) = y ↔ (x : K) = y := by
  constructor <;> intro H
  · rw [nat_cast K p 0, nat_cast K p 0, eq_iff'] at H
    cases' H with z H
    simpa only [zero_add, iterate_fixed (frobenius_nat_cast K p _)] using H
  

Proof state:
case mpr
K : Type u
inst✝² : CommRing K
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : CharP K p
x y : ℕ
H : ↑x = ↑y
⊢ ↑x = ↑y

Next tactic:
rw [nat_cast K p 0, nat_cast K p 0, H]
instance : CharP (PerfectClosure K p) p := by
  

Proof state:
K : Type u
inst✝² : CommRing K
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : CharP K p
⊢ CharP (PerfectClosure K p) p

Next tactic:
constructor
instance : CharP (PerfectClosure K p) p := by
  constructor; 

Proof state:
case cast_eq_zero_iff'
K : Type u
inst✝² : CommRing K
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : CharP K p
⊢ ∀ (x : ℕ), ↑x = 0 ↔ p ∣ x

Next tactic:
intro x
instance : CharP (PerfectClosure K p) p := by
  constructor; intro x; 

Proof state:
case cast_eq_zero_iff'
K : Type u
inst✝² : CommRing K
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : CharP K p
x : ℕ
⊢ ↑x = 0 ↔ p ∣ x

Next tactic:
rw [← CharP.cast_eq_zero_iff K]
instance : CharP (PerfectClosure K p) p := by
  constructor; intro x; rw [← CharP.cast_eq_zero_iff K]
  

Proof state:
case cast_eq_zero_iff'
K : Type u
inst✝² : CommRing K
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : CharP K p
x : ℕ
⊢ ↑x = 0 ↔ ↑x = 0

Next tactic:
rw [← Nat.cast_zero, nat_cast_eq_iff, Nat.cast_zero]
theorem frobenius_mk (x : ℕ × K) :
    (frobenius (PerfectClosure K p) p : PerfectClosure K p → PerfectClosure K p) (mk K p x) =
      mk _ _ (x.1, x.2 ^ p) := by
  

Proof state:
K : Type u
inst✝² : CommRing K
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : CharP K p
x : ℕ × K
⊢ (frobenius (PerfectClosure K p) p) (mk K p x) = mk K p (x.1, x.2 ^ p)

Next tactic:
simp only [frobenius_def]
theorem frobenius_mk (x : ℕ × K) :
    (frobenius (PerfectClosure K p) p : PerfectClosure K p → PerfectClosure K p) (mk K p x) =
      mk _ _ (x.1, x.2 ^ p) := by
  simp only [frobenius_def]
  

Proof state:
K : Type u
inst✝² : CommRing K
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : CharP K p
x : ℕ × K
⊢ mk K p x ^ p = mk K p (x.1, x.2 ^ p)

Next tactic:
cases' x with n x
theorem frobenius_mk (x : ℕ × K) :
    (frobenius (PerfectClosure K p) p : PerfectClosure K p → PerfectClosure K p) (mk K p x) =
      mk _ _ (x.1, x.2 ^ p) := by
  simp only [frobenius_def]
  cases' x with n x
  

Proof state:
case mk
K : Type u
inst✝² : CommRing K
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : CharP K p
n : ℕ
x : K
⊢ mk K p (n, x) ^ p = mk K p ((n, x).1, (n, x).2 ^ p)

Next tactic:
dsimp only
theorem frobenius_mk (x : ℕ × K) :
    (frobenius (PerfectClosure K p) p : PerfectClosure K p → PerfectClosure K p) (mk K p x) =
      mk _ _ (x.1, x.2 ^ p) := by
  simp only [frobenius_def]
  cases' x with n x
  dsimp only
  

Proof state:
case mk
K : Type u
inst✝² : CommRing K
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : CharP K p
n : ℕ
x : K
⊢ mk K p (n, x) ^ p = mk K p (n, x ^ p)

Next tactic:
suffices ∀ p' : ℕ, mk K p (n, x) ^ p' = mk K p (n, x ^ p') by apply this
theorem frobenius_mk (x : ℕ × K) :
    (frobenius (PerfectClosure K p) p : PerfectClosure K p → PerfectClosure K p) (mk K p x) =
      mk _ _ (x.1, x.2 ^ p) := by
  simp only [frobenius_def]
  cases' x with n x
  dsimp only
  suffices ∀ p' : ℕ, mk K p (n, x) ^ p' = mk K p (n, x ^ p') by 

Proof state:
K : Type u
inst✝² : CommRing K
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : CharP K p
n : ℕ
x : K
this : ∀ (p' : ℕ), mk K p (n, x) ^ p' = mk K p (n, x ^ p')
⊢ mk K p (n, x) ^ p = mk K p (n, x ^ p)

Next tactic:
apply this
theorem frobenius_mk (x : ℕ × K) :
    (frobenius (PerfectClosure K p) p : PerfectClosure K p → PerfectClosure K p) (mk K p x) =
      mk _ _ (x.1, x.2 ^ p) := by
  simp only [frobenius_def]
  cases' x with n x
  dsimp only
  suffices ∀ p' : ℕ, mk K p (n, x) ^ p' = mk K p (n, x ^ p') by apply this
  

Proof state:
case mk
K : Type u
inst✝² : CommRing K
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : CharP K p
n : ℕ
x : K
⊢ ∀ (p' : ℕ), mk K p (n, x) ^ p' = mk K p (n, x ^ p')

Next tactic:
intro p
theorem frobenius_mk (x : ℕ × K) :
    (frobenius (PerfectClosure K p) p : PerfectClosure K p → PerfectClosure K p) (mk K p x) =
      mk _ _ (x.1, x.2 ^ p) := by
  simp only [frobenius_def]
  cases' x with n x
  dsimp only
  suffices ∀ p' : ℕ, mk K p (n, x) ^ p' = mk K p (n, x ^ p') by apply this
  intro p
  

Proof state:
case mk
K : Type u
inst✝² : CommRing K
p✝ : ℕ
inst✝¹ : Fact (Nat.Prime p✝)
inst✝ : CharP K p✝
n : ℕ
x : K
p : ℕ
⊢ mk K p✝ (n, x) ^ p = mk K p✝ (n, x ^ p)

Next tactic:
induction' p with p ih
theorem frobenius_mk (x : ℕ × K) :
    (frobenius (PerfectClosure K p) p : PerfectClosure K p → PerfectClosure K p) (mk K p x) =
      mk _ _ (x.1, x.2 ^ p) := by
  simp only [frobenius_def]
  cases' x with n x
  dsimp only
  suffices ∀ p' : ℕ, mk K p (n, x) ^ p' = mk K p (n, x ^ p') by apply this
  intro p
  induction' p with p ih
  

Proof state:
case mk.zero
K : Type u
inst✝² : CommRing K
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : CharP K p
n : ℕ
x : K
⊢ mk K p (n, x) ^ Nat.zero = mk K p (n, x ^ Nat.zero)
case mk.succ
K : Type u
inst✝² : CommRing K
p✝ : ℕ
inst✝¹ : Fact (Nat.Prime p✝)
inst✝ : CharP K p✝
n : ℕ
x : K
p : ℕ
ih : mk K p✝ (n, x) ^ p = mk K p✝ (n, x ^ p)
⊢ mk K p✝ (n, x) ^ Nat.succ p = mk K p✝ (n, x ^ Nat.succ p)

Next tactic:
case zero => apply R.sound; rw [(frobenius _ _).iterate_map_one, pow_zero]
theorem frobenius_mk (x : ℕ × K) :
    (frobenius (PerfectClosure K p) p : PerfectClosure K p → PerfectClosure K p) (mk K p x) =
      mk _ _ (x.1, x.2 ^ p) := by
  simp only [frobenius_def]
  cases' x with n x
  dsimp only
  suffices ∀ p' : ℕ, mk K p (n, x) ^ p' = mk K p (n, x ^ p') by apply this
  intro p
  induction' p with p ih
  

Proof state:
K : Type u
inst✝² : CommRing K
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : CharP K p
n : ℕ
x : K
⊢ mk K p (n, x) ^ Nat.zero = mk K p (n, x ^ Nat.zero)

Next tactic:
case zero => apply R.sound; rw [(frobenius _ _).iterate_map_one, pow_zero]
theorem frobenius_mk (x : ℕ × K) :
    (frobenius (PerfectClosure K p) p : PerfectClosure K p → PerfectClosure K p) (mk K p x) =
      mk _ _ (x.1, x.2 ^ p) := by
  simp only [frobenius_def]
  cases' x with n x
  dsimp only
  suffices ∀ p' : ℕ, mk K p (n, x) ^ p' = mk K p (n, x ^ p') by apply this
  intro p
  induction' p with p ih
  case zero => 

Proof state:
K : Type u
inst✝² : CommRing K
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : CharP K p
n : ℕ
x : K
⊢ mk K p (n, x) ^ Nat.zero = mk K p (n, x ^ Nat.zero)

Next tactic:
apply R.sound
theorem frobenius_mk (x : ℕ × K) :
    (frobenius (PerfectClosure K p) p : PerfectClosure K p → PerfectClosure K p) (mk K p x) =
      mk _ _ (x.1, x.2 ^ p) := by
  simp only [frobenius_def]
  cases' x with n x
  dsimp only
  suffices ∀ p' : ℕ, mk K p (n, x) ^ p' = mk K p (n, x ^ p') by apply this
  intro p
  induction' p with p ih
  case zero => apply R.sound; 

Proof state:
case H
K : Type u
inst✝² : CommRing K
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : CharP K p
n : ℕ
x : K
⊢ (⇑(frobenius K p))^[n] 1 = x ^ Nat.zero

Next tactic:
rw [(frobenius _ _).iterate_map_one, pow_zero]
theorem frobenius_mk (x : ℕ × K) :
    (frobenius (PerfectClosure K p) p : PerfectClosure K p → PerfectClosure K p) (mk K p x) =
      mk _ _ (x.1, x.2 ^ p) := by
  simp only [frobenius_def]
  cases' x with n x
  dsimp only
  suffices ∀ p' : ℕ, mk K p (n, x) ^ p' = mk K p (n, x ^ p') by apply this
  intro p
  induction' p with p ih
  case zero => apply R.sound; rw [(frobenius _ _).iterate_map_one, pow_zero]
  

Proof state:
case mk.succ
K : Type u
inst✝² : CommRing K
p✝ : ℕ
inst✝¹ : Fact (Nat.Prime p✝)
inst✝ : CharP K p✝
n : ℕ
x : K
p : ℕ
ih : mk K p✝ (n, x) ^ p = mk K p✝ (n, x ^ p)
⊢ mk K p✝ (n, x) ^ Nat.succ p = mk K p✝ (n, x ^ Nat.succ p)

Next tactic:
case succ =>
    rw [pow_succ, ih]
    symm
    apply R.sound
    simp only [pow_succ, iterate_map_mul]
theorem frobenius_mk (x : ℕ × K) :
    (frobenius (PerfectClosure K p) p : PerfectClosure K p → PerfectClosure K p) (mk K p x) =
      mk _ _ (x.1, x.2 ^ p) := by
  simp only [frobenius_def]
  cases' x with n x
  dsimp only
  suffices ∀ p' : ℕ, mk K p (n, x) ^ p' = mk K p (n, x ^ p') by apply this
  intro p
  induction' p with p ih
  case zero => apply R.sound; rw [(frobenius _ _).iterate_map_one, pow_zero]
  

Proof state:
K : Type u
inst✝² : CommRing K
p✝ : ℕ
inst✝¹ : Fact (Nat.Prime p✝)
inst✝ : CharP K p✝
n : ℕ
x : K
p : ℕ
ih : mk K p✝ (n, x) ^ p = mk K p✝ (n, x ^ p)
⊢ mk K p✝ (n, x) ^ Nat.succ p = mk K p✝ (n, x ^ Nat.succ p)

Next tactic:
case succ =>
    rw [pow_succ, ih]
    symm
    apply R.sound
    simp only [pow_succ, iterate_map_mul]
theorem frobenius_mk (x : ℕ × K) :
    (frobenius (PerfectClosure K p) p : PerfectClosure K p → PerfectClosure K p) (mk K p x) =
      mk _ _ (x.1, x.2 ^ p) := by
  simp only [frobenius_def]
  cases' x with n x
  dsimp only
  suffices ∀ p' : ℕ, mk K p (n, x) ^ p' = mk K p (n, x ^ p') by apply this
  intro p
  induction' p with p ih
  case zero => apply R.sound; rw [(frobenius _ _).iterate_map_one, pow_zero]
  case succ =>
    

Proof state:
K : Type u
inst✝² : CommRing K
p✝ : ℕ
inst✝¹ : Fact (Nat.Prime p✝)
inst✝ : CharP K p✝
n : ℕ
x : K
p : ℕ
ih : mk K p✝ (n, x) ^ p = mk K p✝ (n, x ^ p)
⊢ mk K p✝ (n, x) ^ Nat.succ p = mk K p✝ (n, x ^ Nat.succ p)

Next tactic:
rw [pow_succ, ih]
theorem frobenius_mk (x : ℕ × K) :
    (frobenius (PerfectClosure K p) p : PerfectClosure K p → PerfectClosure K p) (mk K p x) =
      mk _ _ (x.1, x.2 ^ p) := by
  simp only [frobenius_def]
  cases' x with n x
  dsimp only
  suffices ∀ p' : ℕ, mk K p (n, x) ^ p' = mk K p (n, x ^ p') by apply this
  intro p
  induction' p with p ih
  case zero => apply R.sound; rw [(frobenius _ _).iterate_map_one, pow_zero]
  case succ =>
    rw [pow_succ, ih]
    

Proof state:
K : Type u
inst✝² : CommRing K
p✝ : ℕ
inst✝¹ : Fact (Nat.Prime p✝)
inst✝ : CharP K p✝
n : ℕ
x : K
p : ℕ
ih : mk K p✝ (n, x) ^ p = mk K p✝ (n, x ^ p)
⊢ mk K p✝ (n, x) * mk K p✝ (n, x ^ p) = mk K p✝ (n, x ^ Nat.succ p)

Next tactic:
symm
theorem frobenius_mk (x : ℕ × K) :
    (frobenius (PerfectClosure K p) p : PerfectClosure K p → PerfectClosure K p) (mk K p x) =
      mk _ _ (x.1, x.2 ^ p) := by
  simp only [frobenius_def]
  cases' x with n x
  dsimp only
  suffices ∀ p' : ℕ, mk K p (n, x) ^ p' = mk K p (n, x ^ p') by apply this
  intro p
  induction' p with p ih
  case zero => apply R.sound; rw [(frobenius _ _).iterate_map_one, pow_zero]
  case succ =>
    rw [pow_succ, ih]
    symm
    

Proof state:
K : Type u
inst✝² : CommRing K
p✝ : ℕ
inst✝¹ : Fact (Nat.Prime p✝)
inst✝ : CharP K p✝
n : ℕ
x : K
p : ℕ
ih : mk K p✝ (n, x) ^ p = mk K p✝ (n, x ^ p)
⊢ mk K p✝ (n, x ^ Nat.succ p) = mk K p✝ (n, x) * mk K p✝ (n, x ^ p)

Next tactic:
apply R.sound
theorem frobenius_mk (x : ℕ × K) :
    (frobenius (PerfectClosure K p) p : PerfectClosure K p → PerfectClosure K p) (mk K p x) =
      mk _ _ (x.1, x.2 ^ p) := by
  simp only [frobenius_def]
  cases' x with n x
  dsimp only
  suffices ∀ p' : ℕ, mk K p (n, x) ^ p' = mk K p (n, x ^ p') by apply this
  intro p
  induction' p with p ih
  case zero => apply R.sound; rw [(frobenius _ _).iterate_map_one, pow_zero]
  case succ =>
    rw [pow_succ, ih]
    symm
    apply R.sound
    

Proof state:
case H
K : Type u
inst✝² : CommRing K
p✝ : ℕ
inst✝¹ : Fact (Nat.Prime p✝)
inst✝ : CharP K p✝
n : ℕ
x : K
p : ℕ
ih : mk K p✝ (n, x) ^ p = mk K p✝ (n, x ^ p)
⊢ (⇑(frobenius K p✝))^[(n, x).1] (x ^ Nat.succ p) =
    (⇑(frobenius K p✝))^[(n, x ^ p).1] (n, x).2 * (⇑(frobenius K p✝))^[(n, x).1] (n, x ^ p).2

Next tactic:
simp only [pow_succ, iterate_map_mul]
theorem eq_iff [CommRing K] [IsReduced K] (p : ℕ) [Fact p.Prime] [CharP K p] (x y : ℕ × K) :
    Quot.mk (R K p) x = Quot.mk (R K p) y ↔ (frobenius K p)^[y.1] x.2 = (frobenius K p)^[x.1] y.2 :=
  (eq_iff' K p x y).trans
    ⟨fun ⟨z, H⟩ => (frobenius_inj K p).iterate z <| by 

Proof state:
K : Type u
inst✝³ : CommRing K
inst✝² : IsReduced K
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : CharP K p
x y : ℕ × K
x✝ : ∃ z, (⇑(frobenius K p))^[y.1 + z] x.2 = (⇑(frobenius K p))^[x.1 + z] y.2
z : ℕ
H : (⇑(frobenius K p))^[y.1 + z] x.2 = (⇑(frobenius K p))^[x.1 + z] y.2
⊢ (⇑(frobenius K p))^[z] ((⇑(frobenius K p))^[y.1] x.2) = (⇑(frobenius K p))^[z] ((⇑(frobenius K p))^[x.1] y.2)

Next tactic:
simpa only [add_comm, iterate_add] using H
instance : Inv (PerfectClosure K p) :=
  ⟨Quot.lift (fun x : ℕ × K => Quot.mk (R K p) (x.1, x.2⁻¹)) fun x y (H : R K p x y) =>
      match x, y, H with
      | _, _, R.intro n x =>
        Quot.sound <| by
          

Proof state:
K : Type u
inst✝² : Field K
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : CharP K p
x✝ y : ℕ × K
H : R K p x✝ y
n : ℕ
x : K
⊢ R K p ((n, x).1, (n, x).2⁻¹) ((n + 1, (frobenius K p) x).1, (n + 1, (frobenius K p) x).2⁻¹)

Next tactic:
simp only [frobenius_def]
instance : Inv (PerfectClosure K p) :=
  ⟨Quot.lift (fun x : ℕ × K => Quot.mk (R K p) (x.1, x.2⁻¹)) fun x y (H : R K p x y) =>
      match x, y, H with
      | _, _, R.intro n x =>
        Quot.sound <| by
          simp only [frobenius_def]
          

Proof state:
K : Type u
inst✝² : Field K
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : CharP K p
x✝ y : ℕ × K
H : R K p x✝ y
n : ℕ
x : K
⊢ R K p (n, x⁻¹) (n + 1, (x ^ p)⁻¹)

Next tactic:
rw [← inv_pow]
instance : Inv (PerfectClosure K p) :=
  ⟨Quot.lift (fun x : ℕ × K => Quot.mk (R K p) (x.1, x.2⁻¹)) fun x y (H : R K p x y) =>
      match x, y, H with
      | _, _, R.intro n x =>
        Quot.sound <| by
          simp only [frobenius_def]
          rw [← inv_pow]
          

Proof state:
K : Type u
inst✝² : Field K
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : CharP K p
x✝ y : ℕ × K
H : R K p x✝ y
n : ℕ
x : K
⊢ R K p (n, x⁻¹) (n + 1, x⁻¹ ^ p)

Next tactic:
apply R.intro
instance : DivisionRing (PerfectClosure K p) :=
  { (inferInstance : Inv (PerfectClosure K p)) with
    exists_pair_ne := ⟨0, 1, fun H => zero_ne_one ((eq_iff _ _ _ _).1 H)⟩
    mul_inv_cancel := fun e =>
      induction_on e fun ⟨m, x⟩ H => by
        -- Porting note: restructured
        

Proof state:
K : Type u
inst✝² : Field K
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : CharP K p
src✝ : Inv (PerfectClosure K p) := inferInstance
e : PerfectClosure K p
x✝ : ℕ × K
m : ℕ
x : K
H : mk K p (m, x) ≠ 0
⊢ mk K p (m, x) * (mk K p (m, x))⁻¹ = 1

Next tactic:
have := mt (eq_iff _ _ _ _).2 H
instance : DivisionRing (PerfectClosure K p) :=
  { (inferInstance : Inv (PerfectClosure K p)) with
    exists_pair_ne := ⟨0, 1, fun H => zero_ne_one ((eq_iff _ _ _ _).1 H)⟩
    mul_inv_cancel := fun e =>
      induction_on e fun ⟨m, x⟩ H => by
        -- Porting note: restructured
        have := mt (eq_iff _ _ _ _).2 H
        

Proof state:
K : Type u
inst✝² : Field K
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : CharP K p
src✝ : Inv (PerfectClosure K p) := inferInstance
e : PerfectClosure K p
x✝ : ℕ × K
m : ℕ
x : K
H : mk K p (m, x) ≠ 0
this : ¬(⇑(frobenius K p))^[(0, 0).1] (m, x).2 = (⇑(frobenius K p))^[(m, x).1] (0, 0).2
⊢ mk K p (m, x) * (mk K p (m, x))⁻¹ = 1

Next tactic:
rw [mk_inv, mk_mul_mk]
instance : DivisionRing (PerfectClosure K p) :=
  { (inferInstance : Inv (PerfectClosure K p)) with
    exists_pair_ne := ⟨0, 1, fun H => zero_ne_one ((eq_iff _ _ _ _).1 H)⟩
    mul_inv_cancel := fun e =>
      induction_on e fun ⟨m, x⟩ H => by
        -- Porting note: restructured
        have := mt (eq_iff _ _ _ _).2 H
        rw [mk_inv, mk_mul_mk]
        

Proof state:
K : Type u
inst✝² : Field K
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : CharP K p
src✝ : Inv (PerfectClosure K p) := inferInstance
e : PerfectClosure K p
x✝ : ℕ × K
m : ℕ
x : K
H : mk K p (m, x) ≠ 0
this : ¬(⇑(frobenius K p))^[(0, 0).1] (m, x).2 = (⇑(frobenius K p))^[(m, x).1] (0, 0).2
⊢ mk K p
      ((m, x).1 + ((m, x).1, (m, x).2⁻¹).1,
        (⇑(frobenius K p))^[((m, x).1, (m, x).2⁻¹).1] (m, x).2 *
          (⇑(frobenius K p))^[(m, x).1] ((m, x).1, (m, x).2⁻¹).2) =
    1

Next tactic:
refine (eq_iff K p _ _).2 ?_
instance : DivisionRing (PerfectClosure K p) :=
  { (inferInstance : Inv (PerfectClosure K p)) with
    exists_pair_ne := ⟨0, 1, fun H => zero_ne_one ((eq_iff _ _ _ _).1 H)⟩
    mul_inv_cancel := fun e =>
      induction_on e fun ⟨m, x⟩ H => by
        -- Porting note: restructured
        have := mt (eq_iff _ _ _ _).2 H
        rw [mk_inv, mk_mul_mk]
        refine (eq_iff K p _ _).2 ?_
        

Proof state:
K : Type u
inst✝² : Field K
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : CharP K p
src✝ : Inv (PerfectClosure K p) := inferInstance
e : PerfectClosure K p
x✝ : ℕ × K
m : ℕ
x : K
H : mk K p (m, x) ≠ 0
this : ¬(⇑(frobenius K p))^[(0, 0).1] (m, x).2 = (⇑(frobenius K p))^[(m, x).1] (0, 0).2
⊢ (⇑(frobenius K p))^[(0, 1).1]
      ((m, x).1 + ((m, x).1, (m, x).2⁻¹).1,
          (⇑(frobenius K p))^[((m, x).1, (m, x).2⁻¹).1] (m, x).2 *
            (⇑(frobenius K p))^[(m, x).1] ((m, x).1, (m, x).2⁻¹).2).2 =
    (⇑(frobenius K
            p))^[((m, x).1 + ((m, x).1, (m, x).2⁻¹).1,
            (⇑(frobenius K p))^[((m, x).1, (m, x).2⁻¹).1] (m, x).2 *
              (⇑(frobenius K p))^[(m, x).1] ((m, x).1, (m, x).2⁻¹).2).1]
      (0, 1).2

Next tactic:
simp only [(frobenius _ _).iterate_map_one, (frobenius K p).iterate_map_zero,
            iterate_zero_apply, ← iterate_map_mul] at this ⊢
instance : DivisionRing (PerfectClosure K p) :=
  { (inferInstance : Inv (PerfectClosure K p)) with
    exists_pair_ne := ⟨0, 1, fun H => zero_ne_one ((eq_iff _ _ _ _).1 H)⟩
    mul_inv_cancel := fun e =>
      induction_on e fun ⟨m, x⟩ H => by
        -- Porting note: restructured
        have := mt (eq_iff _ _ _ _).2 H
        rw [mk_inv, mk_mul_mk]
        refine (eq_iff K p _ _).2 ?_
        simp only [(frobenius _ _).iterate_map_one, (frobenius K p).iterate_map_zero,
            iterate_zero_apply, ← iterate_map_mul] at this ⊢
        

Proof state:
K : Type u
inst✝² : Field K
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : CharP K p
src✝ : Inv (PerfectClosure K p) := inferInstance
e : PerfectClosure K p
x✝ : ℕ × K
m : ℕ
x : K
H : mk K p (m, x) ≠ 0
this : ¬x = 0
⊢ (⇑(frobenius K p))^[m] (x * x⁻¹) = 1

Next tactic:
rw [mul_inv_cancel this, (frobenius _ _).iterate_map_one]
instance : DivisionRing (PerfectClosure K p) :=
  { (inferInstance : Inv (PerfectClosure K p)) with
    exists_pair_ne := ⟨0, 1, fun H => zero_ne_one ((eq_iff _ _ _ _).1 H)⟩
    mul_inv_cancel := fun e =>
      induction_on e fun ⟨m, x⟩ H => by
        -- Porting note: restructured
        have := mt (eq_iff _ _ _ _).2 H
        rw [mk_inv, mk_mul_mk]
        refine (eq_iff K p _ _).2 ?_
        simp only [(frobenius _ _).iterate_map_one, (frobenius K p).iterate_map_zero,
            iterate_zero_apply, ← iterate_map_mul] at this ⊢
        rw [mul_inv_cancel this, (frobenius _ _).iterate_map_one]
    inv_zero := congr_arg (Quot.mk (R K p)) (by 

Proof state:
K : Type u
inst✝² : Field K
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : CharP K p
src✝ : Inv (PerfectClosure K p) := inferInstance
⊢ ((0, 0).1, (0, 0).2⁻¹) = (0, 0)

Next tactic:
rw [inv_zero]
instance : PerfectRing (PerfectClosure K p) p where
  bijective_frobenius := by
    

Proof state:
K : Type u
inst✝² : Field K
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : CharP K p
⊢ Bijective ⇑(frobenius (PerfectClosure K p) p)

Next tactic:
let f : PerfectClosure K p → PerfectClosure K p := fun e ↦
      liftOn e (fun x => mk K p (x.1 + 1, x.2)) fun x y H =>
      match x, y, H with
      | _, _, R.intro n x => Quot.sound (R.intro _ _)
instance : PerfectRing (PerfectClosure K p) p where
  bijective_frobenius := by
    let f : PerfectClosure K p → PerfectClosure K p := fun e ↦
      liftOn e (fun x => mk K p (x.1 + 1, x.2)) fun x y H =>
      match x, y, H with
      | _, _, R.intro n x => Quot.sound (R.intro _ _)
    

Proof state:
K : Type u
inst✝² : Field K
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : CharP K p
f : PerfectClosure K p → PerfectClosure K p :=
  fun e =>
    liftOn e (fun x => mk K p (x.1 + 1, x.2))
      (_ : ∀ (x y : ℕ × K), R K p x y → (fun x => mk K p (x.1 + 1, x.2)) x = (fun x => mk K p (x.1 + 1, x.2)) y)
⊢ Bijective ⇑(frobenius (PerfectClosure K p) p)

Next tactic:
have hl : LeftInverse f (frobenius (PerfectClosure K p) p) := fun e ↦
      induction_on e fun ⟨n, x⟩ => by
        simp only [liftOn_mk, frobenius_mk]
        exact (Quot.sound <| R.intro _ _).symm
instance : PerfectRing (PerfectClosure K p) p where
  bijective_frobenius := by
    let f : PerfectClosure K p → PerfectClosure K p := fun e ↦
      liftOn e (fun x => mk K p (x.1 + 1, x.2)) fun x y H =>
      match x, y, H with
      | _, _, R.intro n x => Quot.sound (R.intro _ _)
    have hl : LeftInverse f (frobenius (PerfectClosure K p) p) := fun e ↦
      induction_on e fun ⟨n, x⟩ => by
        

Proof state:
K : Type u
inst✝² : Field K
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : CharP K p
f : PerfectClosure K p → PerfectClosure K p :=
  fun e =>
    liftOn e (fun x => mk K p (x.1 + 1, x.2))
      (_ : ∀ (x y : ℕ × K), R K p x y → (fun x => mk K p (x.1 + 1, x.2)) x = (fun x => mk K p (x.1 + 1, x.2)) y)
e : PerfectClosure K p
x✝ : ℕ × K
n : ℕ
x : K
⊢ f ((frobenius (PerfectClosure K p) p) (mk K p (n, x))) = mk K p (n, x)

Next tactic:
simp only [liftOn_mk, frobenius_mk]
instance : PerfectRing (PerfectClosure K p) p where
  bijective_frobenius := by
    let f : PerfectClosure K p → PerfectClosure K p := fun e ↦
      liftOn e (fun x => mk K p (x.1 + 1, x.2)) fun x y H =>
      match x, y, H with
      | _, _, R.intro n x => Quot.sound (R.intro _ _)
    have hl : LeftInverse f (frobenius (PerfectClosure K p) p) := fun e ↦
      induction_on e fun ⟨n, x⟩ => by
        simp only [liftOn_mk, frobenius_mk]
        

Proof state:
K : Type u
inst✝² : Field K
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : CharP K p
f : PerfectClosure K p → PerfectClosure K p :=
  fun e =>
    liftOn e (fun x => mk K p (x.1 + 1, x.2))
      (_ : ∀ (x y : ℕ × K), R K p x y → (fun x => mk K p (x.1 + 1, x.2)) x = (fun x => mk K p (x.1 + 1, x.2)) y)
e : PerfectClosure K p
x✝ : ℕ × K
n : ℕ
x : K
⊢ mk K p (n + 1, x ^ p) = mk K p (n, x)

Next tactic:
exact (Quot.sound <| R.intro _ _).symm
instance : PerfectRing (PerfectClosure K p) p where
  bijective_frobenius := by
    let f : PerfectClosure K p → PerfectClosure K p := fun e ↦
      liftOn e (fun x => mk K p (x.1 + 1, x.2)) fun x y H =>
      match x, y, H with
      | _, _, R.intro n x => Quot.sound (R.intro _ _)
    have hl : LeftInverse f (frobenius (PerfectClosure K p) p) := fun e ↦
      induction_on e fun ⟨n, x⟩ => by
        simp only [liftOn_mk, frobenius_mk]
        exact (Quot.sound <| R.intro _ _).symm
    

Proof state:
K : Type u
inst✝² : Field K
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : CharP K p
f : PerfectClosure K p → PerfectClosure K p :=
  fun e =>
    liftOn e (fun x => mk K p (x.1 + 1, x.2))
      (_ : ∀ (x y : ℕ × K), R K p x y → (fun x => mk K p (x.1 + 1, x.2)) x = (fun x => mk K p (x.1 + 1, x.2)) y)
hl : LeftInverse f ⇑(frobenius (PerfectClosure K p) p)
⊢ Bijective ⇑(frobenius (PerfectClosure K p) p)

Next tactic:
have hr : RightInverse f (frobenius (PerfectClosure K p) p) := fun e ↦
      induction_on e fun ⟨n, x⟩ => by
        simp only [liftOn_mk, frobenius_mk]
        exact (Quot.sound <| R.intro _ _).symm