Theorem: Rat.cast_divInt_of_ne_zero
File: Mathlib/Data/Rat/Cast/Defs.lean

Proof steps:
state_before: F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝ : DivisionRing α
p q : ℚ
a b : ℤ
b0 : ↑b ≠ 0
⊢ ↑(a /. b) = ↑a / ↑b
state_after: F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝ : DivisionRing α
p q : ℚ
a b : ℤ
b0 : ↑b ≠ 0
b0' : b ≠ 0
⊢ ↑(a /. b) = ↑a / ↑b
tactic: have b0' : b ≠ 0 := by
    refine mt ?_ b0
    simp (config := { contextual := true })
state_before: F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝ : DivisionRing α
p q : ℚ
a b : ℤ
b0 : ↑b ≠ 0
b0' : b ≠ 0
⊢ ↑(a /. b) = ↑a / ↑b
state_after: case mk'
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝ : DivisionRing α
p q : ℚ
a b : ℤ
b0 : ↑b ≠ 0
b0' : b ≠ 0
n : ℤ
d : ℕ
h : d ≠ 0
c : n.natAbs.Coprime d
e : a /. b = { num := n, den := d, den_nz := h, reduced := c }
⊢ ↑{ num := n, den := d, den_nz := h, reduced := c } = ↑a / ↑b
tactic: cases' e : a /. b with n d h c
state_before: case mk'
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝ : DivisionRing α
p q : ℚ
a b : ℤ
b0 : ↑b ≠ 0
b0' : b ≠ 0
n : ℤ
d : ℕ
h : d ≠ 0
c : n.natAbs.Coprime d
e : a /. b = { num := n, den := d, den_nz := h, reduced := c }
⊢ ↑{ num := n, den := d, den_nz := h, reduced := c } = ↑a / ↑b
state_after: case mk'
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝ : DivisionRing α
p q : ℚ
a b : ℤ
b0 : ↑b ≠ 0
b0' : b ≠ 0
n : ℤ
d : ℕ
h : d ≠ 0
c : n.natAbs.Coprime d
e : a /. b = { num := n, den := d, den_nz := h, reduced := c }
d0 : ↑d ≠ 0
⊢ ↑{ num := n, den := d, den_nz := h, reduced := c } = ↑a / ↑b
tactic: have d0 : (d : α) ≠ 0 := by
    intro d0
    have dd := den_dvd a b
    cases' show (d : ℤ) ∣ b by rwa [e] at dd with k ke
    have : (b : α) = (d : α) * (k : α) := by rw [ke, Int.cast_mul, Int.cast_natCast]
    rw [d0, zero_mul] at this
    contradiction
state_before: case mk'
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝ : DivisionRing α
p q : ℚ
a b : ℤ
b0 : ↑b ≠ 0
b0' : b ≠ 0
n : ℤ
d : ℕ
h : d ≠ 0
c : n.natAbs.Coprime d
e : a /. b = { num := n, den := d, den_nz := h, reduced := c }
d0 : ↑d ≠ 0
⊢ ↑{ num := n, den := d, den_nz := h, reduced := c } = ↑a / ↑b
state_after: case mk'
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝ : DivisionRing α
p q : ℚ
a b : ℤ
b0 : ↑b ≠ 0
b0' : b ≠ 0
n : ℤ
d : ℕ
h : d ≠ 0
c : n.natAbs.Coprime d
e : a /. b = n /. ↑d
d0 : ↑d ≠ 0
⊢ ↑{ num := n, den := d, den_nz := h, reduced := c } = ↑a / ↑b
tactic: rw [mk'_eq_divInt] at e
state_before: case mk'
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝ : DivisionRing α
p q : ℚ
a b : ℤ
b0 : ↑b ≠ 0
b0' : b ≠ 0
n : ℤ
d : ℕ
h : d ≠ 0
c : n.natAbs.Coprime d
e : a /. b = n /. ↑d
d0 : ↑d ≠ 0
⊢ ↑{ num := n, den := d, den_nz := h, reduced := c } = ↑a / ↑b
state_after: case mk'
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝ : DivisionRing α
p q : ℚ
a b : ℤ
b0 : ↑b ≠ 0
b0' : b ≠ 0
n : ℤ
d : ℕ
h : d ≠ 0
c : n.natAbs.Coprime d
e : a /. b = n /. ↑d
d0 : ↑d ≠ 0
this : ↑(a * ↑d) = ↑(n * b)
⊢ ↑{ num := n, den := d, den_nz := h, reduced := c } = ↑a / ↑b
tactic: have := congr_arg ((↑) : ℤ → α)
    ((divInt_eq_iff b0' <| ne_of_gt <| Int.natCast_pos.2 h.bot_lt).1 e)
state_before: case mk'
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝ : DivisionRing α
p q : ℚ
a b : ℤ
b0 : ↑b ≠ 0
b0' : b ≠ 0
n : ℤ
d : ℕ
h : d ≠ 0
c : n.natAbs.Coprime d
e : a /. b = n /. ↑d
d0 : ↑d ≠ 0
this : ↑(a * ↑d) = ↑(n * b)
⊢ ↑{ num := n, den := d, den_nz := h, reduced := c } = ↑a / ↑b
state_after: case mk'
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝ : DivisionRing α
p q : ℚ
a b : ℤ
b0 : ↑b ≠ 0
b0' : b ≠ 0
n : ℤ
d : ℕ
h : d ≠ 0
c : n.natAbs.Coprime d
e : a /. b = n /. ↑d
d0 : ↑d ≠ 0
this : ↑a * ↑d = ↑n * ↑b
⊢ ↑{ num := n, den := d, den_nz := h, reduced := c } = ↑a / ↑b
tactic: rw [Int.cast_mul, Int.cast_mul, Int.cast_natCast] at this
state_before: case mk'
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝ : DivisionRing α
p q : ℚ
a b : ℤ
b0 : ↑b ≠ 0
b0' : b ≠ 0
n : ℤ
d : ℕ
h : d ≠ 0
c : n.natAbs.Coprime d
e : a /. b = n /. ↑d
d0 : ↑d ≠ 0
this : ↑a * ↑d = ↑n * ↑b
⊢ ↑{ num := n, den := d, den_nz := h, reduced := c } = ↑a / ↑b
state_after: no goals
tactic: rw [eq_comm, cast_def, div_eq_mul_inv, eq_div_iff_mul_eq d0, mul_assoc, (d.commute_cast _).eq,
    ← mul_assoc, this, mul_assoc, mul_inv_cancel b0, mul_one]