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

tactic: rw [← ZMod.int_cast_zmod_eq_zero_iff_dvd]
state_before: p : ℕ
hp_prime : Fact (Nat.Prime p)
r✝ r : ℚ
h : ‖↑r‖ ≤ 1
⊢ ↑p ∣ r.num - r.num * gcdA r.den p % ↑p * ↑r.den

tactic: simp only [Int.cast_ofNat, ZMod.nat_cast_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 * gcdA r.den 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
⊢ ↑r.num - ↑(r.num * gcdA r.den p % ↑p) * ↑r.den = 0

tactic: simp only [Int.cast_ofNat, 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 : (fun x => ↑x % ↑p) ↑(Nat.gcd r.den p) = (fun x => ↑x % ↑p) (↑r.den * gcdA r.den p + ↑p * gcdB r.den p)
⊢ ↑r.num - ↑(r.num * gcdA r.den p % ↑p) * ↑r.den = 0

tactic: push_cast
state_before: p : ℕ
hp_prime : Fact (Nat.Prime p)
r✝ r : ℚ
h : ‖↑r‖ ≤ 1
this : ↑(Nat.gcd r.den p) = ↑r.den * ↑(gcdA r.den p)
⊢ ↑r.num - ↑(r.num * gcdA r.den p % ↑p) * ↑r.den = 0

tactic: rw [mul_right_comm, mul_assoc, ← this]
state_before: p : ℕ
hp_prime : Fact (Nat.Prime p)
r✝ r : ℚ
h : ‖↑r‖ ≤ 1
this : ↑(Nat.gcd r.den p) = ↑r.den * ↑(gcdA r.den p)
⊢ ↑r.num - ↑r.num * ↑(gcdA r.den p) * ↑r.den = 0

tactic: suffices rdcp : r.den.coprime p
state_before: p : ℕ
hp_prime : Fact (Nat.Prime p)
r✝ r : ℚ
h : ‖↑r‖ ≤ 1
this : ↑(Nat.gcd r.den p) = ↑r.den * ↑(gcdA r.den p)
⊢ ↑r.num - ↑r.num * ↑(Nat.gcd r.den p) = 0

tactic: apply coprime.symm
state_before: case rdcp
p : ℕ
hp_prime : Fact (Nat.Prime p)
r✝ r : ℚ
h : ‖↑r‖ ≤ 1
this : ↑(Nat.gcd r.den p) = ↑r.den * ↑(gcdA r.den p)
⊢ coprime r.den p

tactic: apply (coprime_or_dvd_of_prime hp_prime.1 _).resolve_right
state_before: case rdcp.a
p : ℕ
hp_prime : Fact (Nat.Prime p)
r✝ r : ℚ
h : ‖↑r‖ ≤ 1
this : ↑(Nat.gcd r.den p) = ↑r.den * ↑(gcdA r.den p)
⊢ coprime p r.den

tactic: rw [← Int.coe_nat_dvd, ← norm_int_lt_one_iff_dvd, not_lt]
state_before: case rdcp.a
p : ℕ
hp_prime : Fact (Nat.Prime p)
r✝ r : ℚ
h : ‖↑r‖ ≤ 1
this : ↑(Nat.gcd r.den p) = ↑r.den * ↑(gcdA r.den p)
⊢ ¬p ∣ r.den

tactic: apply ge_of_eq
state_before: case rdcp.a
p : ℕ
hp_prime : Fact (Nat.Prime p)
r✝ r : ℚ
h : ‖↑r‖ ≤ 1
this : ↑(Nat.gcd r.den p) = ↑r.den * ↑(gcdA r.den p)
⊢ 1 ≤ ‖↑↑r.den‖

tactic: rw [← isUnit_iff]
state_before: case rdcp.a.h
p : ℕ
hp_prime : Fact (Nat.Prime p)
r✝ r : ℚ
h : ‖↑r‖ ≤ 1
this : ↑(Nat.gcd r.den p) = ↑r.den * ↑(gcdA r.den p)
⊢ ‖↑↑r.den‖ = 1

tactic: exact isUnit_den r h
state_before: case rdcp.a.h
p : ℕ
hp_prime : Fact (Nat.Prime p)
r✝ r : ℚ
h : ‖↑r‖ ≤ 1
this : ↑(Nat.gcd r.den p) = ↑r.den * ↑(gcdA r.den p)
⊢ IsUnit ↑↑r.den

tactic: rw [rdcp.gcd_eq_one]
state_before: p : ℕ
hp_prime : Fact (Nat.Prime p)
r✝ r : ℚ
h : ‖↑r‖ ≤ 1
this : ↑(Nat.gcd r.den p) = ↑r.den * ↑(gcdA r.den p)
rdcp : coprime r.den p
⊢ ↑r.num - ↑r.num * ↑(Nat.gcd r.den p) = 0

tactic: simp only [mul_one, cast_one, sub_self]
state_before: p : ℕ
hp_prime : Fact (Nat.Prime p)
r✝ r : ℚ
h : ‖↑r‖ ≤ 1
this : ↑(Nat.gcd r.den p) = ↑r.den * ↑(gcdA r.den p)
rdcp : coprime r.den p
⊢ ↑r.num - ↑r.num * ↑1 = 0