Theorem: Int.fract_div_natCast_eq_div_natCast_mod
File: Mathlib/Algebra/Order/Floor.lean

tactic: rcases n.eq_zero_or_pos with (rfl | hn)
state_before: F : Type ?u.187926
α : Type ?u.187929
β : Type ?u.187932
inst✝³ : LinearOrderedRing α
inst✝² : FloorRing α
z : ℤ
a : α
k : Type u_1
inst✝¹ : LinearOrderedField k
inst✝ : FloorRing k
b : k
m n : ℕ
⊢ fract (↑m / ↑n) = ↑(m % n) / ↑n

tactic: have hn' : 0 < (n : k) := by
  norm_cast
state_before: case inr
F : Type ?u.187926
α : Type ?u.187929
β : Type ?u.187932
inst✝³ : LinearOrderedRing α
inst✝² : FloorRing α
z : ℤ
a : α
k : Type u_1
inst✝¹ : LinearOrderedField k
inst✝ : FloorRing k
b : k
m n : ℕ
hn : n > 0
⊢ fract (↑m / ↑n) = ↑(m % n) / ↑n

tactic: refine fract_eq_iff.mpr ⟨?_, ?_, m / n, ?_⟩
state_before: case inr
F : Type ?u.187926
α : Type ?u.187929
β : Type ?u.187932
inst✝³ : LinearOrderedRing α
inst✝² : FloorRing α
z : ℤ
a : α
k : Type u_1
inst✝¹ : LinearOrderedField k
inst✝ : FloorRing k
b : k
m n : ℕ
hn : n > 0
hn' : 0 < ↑n
⊢ fract (↑m / ↑n) = ↑(m % n) / ↑n

tactic: simp
state_before: case inl
F : Type ?u.187926
α : Type ?u.187929
β : Type ?u.187932
inst✝³ : LinearOrderedRing α
inst✝² : FloorRing α
z : ℤ
a : α
k : Type u_1
inst✝¹ : LinearOrderedField k
inst✝ : FloorRing k
b : k
m : ℕ
⊢ fract (↑m / ↑0) = ↑(m % 0) / ↑0

tactic: norm_cast
state_before: F : Type ?u.187926
α : Type ?u.187929
β : Type ?u.187932
inst✝³ : LinearOrderedRing α
inst✝² : FloorRing α
z : ℤ
a : α
k : Type u_1
inst✝¹ : LinearOrderedField k
inst✝ : FloorRing k
b : k
m n : ℕ
hn : n > 0
⊢ 0 < ↑n

tactic: positivity
state_before: case inr.refine_1
F : Type ?u.187926
α : Type ?u.187929
β : Type ?u.187932
inst✝³ : LinearOrderedRing α
inst✝² : FloorRing α
z : ℤ
a : α
k : Type u_1
inst✝¹ : LinearOrderedField k
inst✝ : FloorRing k
b : k
m n : ℕ
hn : n > 0
hn' : 0 < ↑n
⊢ 0 ≤ ↑(m % n) / ↑n

tactic: simpa only [div_lt_one hn', Nat.cast_lt] using m.mod_lt hn
state_before: case inr.refine_2
F : Type ?u.187926
α : Type ?u.187929
β : Type ?u.187932
inst✝³ : LinearOrderedRing α
inst✝² : FloorRing α
z : ℤ
a : α
k : Type u_1
inst✝¹ : LinearOrderedField k
inst✝ : FloorRing k
b : k
m n : ℕ
hn : n > 0
hn' : 0 < ↑n
⊢ ↑(m % n) / ↑n < 1

tactic: rw [sub_eq_iff_eq_add', ← mul_right_inj' hn'.ne', mul_div_cancel' _ hn'.ne', mul_add,
  mul_div_cancel' _ hn'.ne']
state_before: case inr.refine_3
F : Type ?u.187926
α : Type ?u.187929
β : Type ?u.187932
inst✝³ : LinearOrderedRing α
inst✝² : FloorRing α
z : ℤ
a : α
k : Type u_1
inst✝¹ : LinearOrderedField k
inst✝ : FloorRing k
b : k
m n : ℕ
hn : n > 0
hn' : 0 < ↑n
⊢ ↑m / ↑n - ↑(m % n) / ↑n = ↑(↑m / ↑n)

tactic: norm_cast
state_before: case inr.refine_3
F : Type ?u.187926
α : Type ?u.187929
β : Type ?u.187932
inst✝³ : LinearOrderedRing α
inst✝² : FloorRing α
z : ℤ
a : α
k : Type u_1
inst✝¹ : LinearOrderedField k
inst✝ : FloorRing k
b : k
m n : ℕ
hn : n > 0
hn' : 0 < ↑n
⊢ ↑m = ↑(m % n) + ↑n * ↑(↑m / ↑n)

tactic: rw [← Nat.cast_add, Nat.mod_add_div m n]
state_before: case inr.refine_3
F : Type ?u.187926
α : Type ?u.187929
β : Type ?u.187932
inst✝³ : LinearOrderedRing α
inst✝² : FloorRing α
z : ℤ
a : α
k : Type u_1
inst✝¹ : LinearOrderedField k
inst✝ : FloorRing k
b : k
m n : ℕ
hn : n > 0
hn' : 0 < ↑n
⊢ ↑m = ↑(m % n) + ↑(n * (m / n))