Theorem: Int.cast_injOn_of_ringChar_ne_two
File: Mathlib/Algebra/CharP/Basic.lean

tactic: intro a ha b hb h
state_before: R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
⊢ Set.InjOn Int.cast {0, 1, -1}

tactic: apply eq_of_sub_eq_zero
state_before: R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a : ℤ
ha : a ∈ {0, 1, -1}
b : ℤ
hb : b ∈ {0, 1, -1}
h : ↑a = ↑b
⊢ a = b

tactic: by_contra hf
state_before: case h
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a : ℤ
ha : a ∈ {0, 1, -1}
b : ℤ
hb : b ∈ {0, 1, -1}
h : ↑a = ↑b
⊢ a - b = 0

tactic: replace ha : a = 0 ∨ a = 1 ∨ a = -1 := ha
state_before: case h
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a : ℤ
ha : a ∈ {0, 1, -1}
b : ℤ
hb : b ∈ {0, 1, -1}
h : ↑a = ↑b
hf : ¬a - b = 0
⊢ False

tactic: replace hb : b = 0 ∨ b = 1 ∨ b = -1 := hb
state_before: case h
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
hb : b ∈ {0, 1, -1}
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 0 ∨ a = 1 ∨ a = -1
⊢ False

tactic: have hh : a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2 := by
  rcases ha with (ha | ha | ha) <;> rcases hb with (hb | hb | hb)
  pick_goal 5
  pick_goal 9
  iterate 3 rw [ha, hb, sub_self] at hf; tauto
  all_goals rw [ha, hb]; norm_num
state_before: case h
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 0 ∨ a = 1 ∨ a = -1
hb : b = 0 ∨ b = 1 ∨ b = -1
⊢ False

tactic: have h' : ((a - b : ℤ) : R) = 0 := by exact_mod_cast sub_eq_zero_of_eq h
state_before: case h
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 0 ∨ a = 1 ∨ a = -1
hb : b = 0 ∨ b = 1 ∨ b = -1
hh : a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2
⊢ False

tactic: have h'' : ((b - a : ℤ) : R) = 0 := by exact_mod_cast sub_eq_zero_of_eq h.symm
state_before: case h
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 0 ∨ a = 1 ∨ a = -1
hb : b = 0 ∨ b = 1 ∨ b = -1
hh : a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2
h' : ↑(a - b) = 0
⊢ False

tactic: rcases hh with (hh | hh | hh | hh)
state_before: case h
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 0 ∨ a = 1 ∨ a = -1
hb : b = 0 ∨ b = 1 ∨ b = -1
hh : a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2
h' : ↑(a - b) = 0
h'' : ↑(b - a) = 0
⊢ False

tactic: rcases ha with (ha | ha | ha) <;> rcases hb with (hb | hb | hb)
state_before: R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 0 ∨ a = 1 ∨ a = -1
hb : b = 0 ∨ b = 1 ∨ b = -1
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

tactic: pick_goal 5
state_before: case inl.inl
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 0
hb : b = 0
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

case inl.inr.inl
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 0
hb : b = 1
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

case inl.inr.inr
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 0
hb : b = -1
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

case inr.inl.inl
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 1
hb : b = 0
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

case inr.inl.inr.inl
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 1
hb : b = 1
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

case inr.inl.inr.inr
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 1
hb : b = -1
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

case inr.inr.inl
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = -1
hb : b = 0
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

case inr.inr.inr.inl
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = -1
hb : b = 1
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

case inr.inr.inr.inr
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = -1
hb : b = -1
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

tactic: pick_goal 9
state_before: case inr.inl.inr.inl
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 1
hb : b = 1
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

case inl.inl
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 0
hb : b = 0
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

case inl.inr.inl
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 0
hb : b = 1
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

case inl.inr.inr
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 0
hb : b = -1
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

case inr.inl.inl
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 1
hb : b = 0
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

case inr.inl.inr.inr
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 1
hb : b = -1
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

case inr.inr.inl
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = -1
hb : b = 0
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

case inr.inr.inr.inl
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = -1
hb : b = 1
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

case inr.inr.inr.inr
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = -1
hb : b = -1
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

tactic: iterate 3 rw [ha, hb, sub_self] at hf; tauto
state_before: case inr.inr.inr.inr
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = -1
hb : b = -1
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

case inr.inl.inr.inl
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 1
hb : b = 1
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

case inl.inl
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 0
hb : b = 0
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

case inl.inr.inl
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 0
hb : b = 1
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

case inl.inr.inr
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 0
hb : b = -1
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

case inr.inl.inl
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 1
hb : b = 0
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

case inr.inl.inr.inr
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 1
hb : b = -1
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

case inr.inr.inl
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = -1
hb : b = 0
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

case inr.inr.inr.inl
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = -1
hb : b = 1
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

tactic: all_goals rw [ha, hb]; norm_num
state_before: case inl.inr.inl
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 0
hb : b = 1
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

case inl.inr.inr
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 0
hb : b = -1
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

case inr.inl.inl
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 1
hb : b = 0
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

case inr.inl.inr.inr
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 1
hb : b = -1
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

case inr.inr.inl
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = -1
hb : b = 0
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

case inr.inr.inr.inl
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = -1
hb : b = 1
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

tactic: rw [ha, hb, sub_self] at hf
state_before: case inl.inl
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 0
hb : b = 0
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

case inl.inr.inl
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 0
hb : b = 1
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

case inl.inr.inr
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 0
hb : b = -1
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

case inr.inl.inl
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 1
hb : b = 0
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

case inr.inl.inr.inr
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 1
hb : b = -1
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

case inr.inr.inl
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = -1
hb : b = 0
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

case inr.inr.inr.inl
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = -1
hb : b = 1
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

tactic: tauto
state_before: case inl.inl
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬0 = 0
ha : a = 0
hb : b = 0
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

case inl.inr.inl
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 0
hb : b = 1
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

case inl.inr.inr
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 0
hb : b = -1
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

case inr.inl.inl
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 1
hb : b = 0
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

case inr.inl.inr.inr
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 1
hb : b = -1
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

case inr.inr.inl
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = -1
hb : b = 0
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

case inr.inr.inr.inl
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = -1
hb : b = 1
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

tactic: rw [ha, hb]
state_before: case inr.inr.inr.inl
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = -1
hb : b = 1
⊢ a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2

tactic: norm_num
state_before: case inr.inr.inr.inl
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = -1
hb : b = 1
⊢ -1 - 1 = 1 ∨ 1 - -1 = 1 ∨ -1 - 1 = 2 ∨ 1 - -1 = 2

tactic: exact_mod_cast sub_eq_zero_of_eq h
state_before: R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 0 ∨ a = 1 ∨ a = -1
hb : b = 0 ∨ b = 1 ∨ b = -1
hh : a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2
⊢ ↑(a - b) = 0

tactic: exact_mod_cast sub_eq_zero_of_eq h.symm
state_before: R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 0 ∨ a = 1 ∨ a = -1
hb : b = 0 ∨ b = 1 ∨ b = -1
hh : a - b = 1 ∨ b - a = 1 ∨ a - b = 2 ∨ b - a = 2
h' : ↑(a - b) = 0
⊢ ↑(b - a) = 0

tactic: rw [hh, (by norm_cast : ((1 : ℤ) : R) = 1)] at h'
state_before: case h.inl
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 0 ∨ a = 1 ∨ a = -1
hb : b = 0 ∨ b = 1 ∨ b = -1
h' : ↑(a - b) = 0
h'' : ↑(b - a) = 0
hh : a - b = 1
⊢ False

tactic: exact one_ne_zero h'
state_before: case h.inl
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 0 ∨ a = 1 ∨ a = -1
hb : b = 0 ∨ b = 1 ∨ b = -1
h' : 1 = 0
h'' : ↑(b - a) = 0
hh : a - b = 1
⊢ False

tactic: norm_cast
state_before: R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 0 ∨ a = 1 ∨ a = -1
hb : b = 0 ∨ b = 1 ∨ b = -1
h' : ↑1 = 0
h'' : ↑(b - a) = 0
hh : a - b = 1
⊢ ↑1 = 1

tactic: rw [hh, (by norm_cast : ((1 : ℤ) : R) = 1)] at h''
state_before: case h.inr.inl
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 0 ∨ a = 1 ∨ a = -1
hb : b = 0 ∨ b = 1 ∨ b = -1
h' : ↑(a - b) = 0
h'' : ↑(b - a) = 0
hh : b - a = 1
⊢ False

tactic: exact one_ne_zero h''
state_before: case h.inr.inl
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 0 ∨ a = 1 ∨ a = -1
hb : b = 0 ∨ b = 1 ∨ b = -1
h' : ↑(a - b) = 0
h'' : 1 = 0
hh : b - a = 1
⊢ False

tactic: norm_cast
state_before: R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 0 ∨ a = 1 ∨ a = -1
hb : b = 0 ∨ b = 1 ∨ b = -1
h' : ↑(a - b) = 0
h'' : ↑1 = 0
hh : b - a = 1
⊢ ↑1 = 1

tactic: rw [hh, (by norm_cast : ((2 : ℤ) : R) = 2)] at h'
state_before: case h.inr.inr.inl
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 0 ∨ a = 1 ∨ a = -1
hb : b = 0 ∨ b = 1 ∨ b = -1
h' : ↑(a - b) = 0
h'' : ↑(b - a) = 0
hh : a - b = 2
⊢ False

tactic: exact Ring.two_ne_zero hR h'
state_before: case h.inr.inr.inl
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 0 ∨ a = 1 ∨ a = -1
hb : b = 0 ∨ b = 1 ∨ b = -1
h' : 2 = 0
h'' : ↑(b - a) = 0
hh : a - b = 2
⊢ False

tactic: norm_cast
state_before: R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 0 ∨ a = 1 ∨ a = -1
hb : b = 0 ∨ b = 1 ∨ b = -1
h' : ↑2 = 0
h'' : ↑(b - a) = 0
hh : a - b = 2
⊢ ↑2 = 2

tactic: rw [hh, (by norm_cast : ((2 : ℤ) : R) = 2)] at h''
state_before: case h.inr.inr.inr
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 0 ∨ a = 1 ∨ a = -1
hb : b = 0 ∨ b = 1 ∨ b = -1
h' : ↑(a - b) = 0
h'' : ↑(b - a) = 0
hh : b - a = 2
⊢ False

tactic: exact Ring.two_ne_zero hR h''
state_before: case h.inr.inr.inr
R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 0 ∨ a = 1 ∨ a = -1
hb : b = 0 ∨ b = 1 ∨ b = -1
h' : ↑(a - b) = 0
h'' : 2 = 0
hh : b - a = 2
⊢ False

tactic: norm_cast
state_before: R✝ : Type ?u.964532
R : Type u_1
inst✝¹ : NonAssocRing R
inst✝ : Nontrivial R
hR : ringChar R ≠ 2
a b : ℤ
h : ↑a = ↑b
hf : ¬a - b = 0
ha : a = 0 ∨ a = 1 ∨ a = -1
hb : b = 0 ∨ b = 1 ∨ b = -1
h' : ↑(a - b) = 0
h'' : ↑2 = 0
hh : b - a = 2
⊢ ↑2 = 2