Theorem: PadicInt.norm_sub_modPart_aux
File: Mathlib/NumberTheory/Padics/RingHoms.lean

Proof steps:
state_before: p : ℕ
hp_prime : Fact (Nat.Prime p)
r✝ r : ℚ
h : ‖↑r‖ ≤ 1
⊢ ↑p ∣ r.num - r.num * r.den.gcdA p % ↑p * ↑r.den
state_after: p : ℕ
hp_prime : Fact (Nat.Prime p)
r✝ r : ℚ
h : ‖↑r‖ ≤ 1
⊢ ↑(r.num - r.num * r.den.gcdA p % ↑p * ↑r.den) = 0
tactic: rw [← ZMod.intCast_zmod_eq_zero_iff_dvd]
state_before: p : ℕ
hp_prime : Fact (Nat.Prime p)
r✝ r : ℚ
h : ‖↑r‖ ≤ 1
⊢ ↑(r.num - r.num * r.den.gcdA p % ↑p * ↑r.den) = 0
state_after: p : ℕ
hp_prime : Fact (Nat.Prime p)
r✝ r : ℚ
h : ‖↑r‖ ≤ 1
⊢ ↑r.num - ↑(r.num * r.den.gcdA p % ↑p) * ↑r.den = 0
tactic: simp only [Int.cast_natCast, ZMod.natCast_mod, Int.cast_mul, Int.cast_sub]
state_before: p : ℕ
hp_prime : Fact (Nat.Prime p)
r✝ r : ℚ
h : ‖↑r‖ ≤ 1
⊢ ↑r.num - ↑(r.num * r.den.gcdA p % ↑p) * ↑r.den = 0
state_after: p : ℕ
hp_prime : Fact (Nat.Prime p)
r✝ r : ℚ
h : ‖↑r‖ ≤ 1
this : (fun x => ↑x % ↑p) ↑(r.den.gcd p) = (fun x => ↑x % ↑p) (↑r.den * r.den.gcdA p + ↑p * r.den.gcdB p)
⊢ ↑r.num - ↑(r.num * r.den.gcdA p % ↑p) * ↑r.den = 0
tactic: have := congr_arg (fun x => x % p : ℤ → ZMod p) (gcd_eq_gcd_ab r.den p)
state_before: p : ℕ
hp_prime : Fact (Nat.Prime p)
r✝ r : ℚ
h : ‖↑r‖ ≤ 1
this : (fun x => ↑x % ↑p) ↑(r.den.gcd p) = (fun x => ↑x % ↑p) (↑r.den * r.den.gcdA p + ↑p * r.den.gcdB p)
⊢ ↑r.num - ↑(r.num * r.den.gcdA p % ↑p) * ↑r.den = 0
state_after: p : ℕ
hp_prime : Fact (Nat.Prime p)
r✝ r : ℚ
h : ‖↑r‖ ≤ 1
this : ↑(r.den.gcd p) = ↑r.den * ↑(r.den.gcdA p)
⊢ ↑r.num - ↑(r.num * r.den.gcdA p % ↑p) * ↑r.den = 0
tactic: simp only [Int.cast_natCast, CharP.cast_eq_zero, EuclideanDomain.mod_zero, Int.cast_add,
    Int.cast_mul, zero_mul, add_zero] at this
state_before: p : ℕ
hp_prime : Fact (Nat.Prime p)
r✝ r : ℚ
h : ‖↑r‖ ≤ 1
this : ↑(r.den.gcd p) = ↑r.den * ↑(r.den.gcdA p)
⊢ ↑r.num - ↑(r.num * r.den.gcdA p % ↑p) * ↑r.den = 0
state_after: p : ℕ
hp_prime : Fact (Nat.Prime p)
r✝ r : ℚ
h : ‖↑r‖ ≤ 1
this : ↑(r.den.gcd p) = ↑r.den * ↑(r.den.gcdA p)
⊢ ↑r.num - ↑r.num * ↑(r.den.gcdA p) * ↑r.den = 0
tactic: push_cast
state_before: p : ℕ
hp_prime : Fact (Nat.Prime p)
r✝ r : ℚ
h : ‖↑r‖ ≤ 1
this : ↑(r.den.gcd p) = ↑r.den * ↑(r.den.gcdA p)
⊢ ↑r.num - ↑r.num * ↑(r.den.gcdA p) * ↑r.den = 0
state_after: p : ℕ
hp_prime : Fact (Nat.Prime p)
r✝ r : ℚ
h : ‖↑r‖ ≤ 1
this : ↑(r.den.gcd p) = ↑r.den * ↑(r.den.gcdA p)
⊢ ↑r.num - ↑r.num * ↑(r.den.gcd p) = 0
tactic: rw [mul_right_comm, mul_assoc, ← this]
state_before: p : ℕ
hp_prime : Fact (Nat.Prime p)
r✝ r : ℚ
h : ‖↑r‖ ≤ 1
this : ↑(r.den.gcd p) = ↑r.den * ↑(r.den.gcdA p)
⊢ ↑r.num - ↑r.num * ↑(r.den.gcd p) = 0
state_after: p : ℕ
hp_prime : Fact (Nat.Prime p)
r✝ r : ℚ
h : ‖↑r‖ ≤ 1
this : ↑(r.den.gcd p) = ↑r.den * ↑(r.den.gcdA p)
⊢ r.den.Coprime p
tactic: suffices rdcp : r.den.Coprime p by
    rw [rdcp.gcd_eq_one]
    simp only [mul_one, cast_one, sub_self]
state_before: p : ℕ
hp_prime : Fact (Nat.Prime p)
r✝ r : ℚ
h : ‖↑r‖ ≤ 1
this : ↑(r.den.gcd p) = ↑r.den * ↑(r.den.gcdA p)
⊢ r.den.Coprime p
state_after: case a
p : ℕ
hp_prime : Fact (Nat.Prime p)
r✝ r : ℚ
h : ‖↑r‖ ≤ 1
this : ↑(r.den.gcd p) = ↑r.den * ↑(r.den.gcdA p)
⊢ p.Coprime r.den
tactic: apply Coprime.symm
state_before: case a
p : ℕ
hp_prime : Fact (Nat.Prime p)
r✝ r : ℚ
h : ‖↑r‖ ≤ 1
this : ↑(r.den.gcd p) = ↑r.den * ↑(r.den.gcdA p)
⊢ p.Coprime r.den
state_after: case a
p : ℕ
hp_prime : Fact (Nat.Prime p)
r✝ r : ℚ
h : ‖↑r‖ ≤ 1
this : ↑(r.den.gcd p) = ↑r.den * ↑(r.den.gcdA p)
⊢ ¬p ∣ r.den
tactic: apply (coprime_or_dvd_of_prime hp_prime.1 _).resolve_right
state_before: case a
p : ℕ
hp_prime : Fact (Nat.Prime p)
r✝ r : ℚ
h : ‖↑r‖ ≤ 1
this : ↑(r.den.gcd p) = ↑r.den * ↑(r.den.gcdA p)
⊢ ¬p ∣ r.den
state_after: case a
p : ℕ
hp_prime : Fact (Nat.Prime p)
r✝ r : ℚ
h : ‖↑r‖ ≤ 1
this : ↑(r.den.gcd p) = ↑r.den * ↑(r.den.gcdA p)
⊢ 1 ≤ ‖↑↑r.den‖
tactic: rw [← Int.natCast_dvd_natCast, ← norm_int_lt_one_iff_dvd, not_lt]
state_before: case a
p : ℕ
hp_prime : Fact (Nat.Prime p)
r✝ r : ℚ
h : ‖↑r‖ ≤ 1
this : ↑(r.den.gcd p) = ↑r.den * ↑(r.den.gcdA p)
⊢ 1 ≤ ‖↑↑r.den‖
state_after: case a.h
p : ℕ
hp_prime : Fact (Nat.Prime p)
r✝ r : ℚ
h : ‖↑r‖ ≤ 1
this : ↑(r.den.gcd p) = ↑r.den * ↑(r.den.gcdA p)
⊢ ‖↑↑r.den‖ = 1
tactic: apply ge_of_eq
state_before: case a.h
p : ℕ
hp_prime : Fact (Nat.Prime p)
r✝ r : ℚ
h : ‖↑r‖ ≤ 1
this : ↑(r.den.gcd p) = ↑r.den * ↑(r.den.gcdA p)
⊢ ‖↑↑r.den‖ = 1
state_after: case a.h
p : ℕ
hp_prime : Fact (Nat.Prime p)
r✝ r : ℚ
h : ‖↑r‖ ≤ 1
this : ↑(r.den.gcd p) = ↑r.den * ↑(r.den.gcdA p)
⊢ IsUnit ↑↑r.den
tactic: rw [← isUnit_iff]
state_before: case a.h
p : ℕ
hp_prime : Fact (Nat.Prime p)
r✝ r : ℚ
h : ‖↑r‖ ≤ 1
this : ↑(r.den.gcd p) = ↑r.den * ↑(r.den.gcdA p)
⊢ IsUnit ↑↑r.den
state_after: no goals
tactic: exact isUnit_den r h