Theorem: Num.castNum_shiftRight
File: Mathlib/Data/Num/Lemmas.lean

tactic: cases' m with m <;> dsimp only [← shiftr_eq_shiftRight, shiftr]
state_before: α : Type u_1
m : Num
n : ℕ
⊢ ↑(m >>> n) = ↑m >>> n
state_after: case zero
α : Type u_1
n : ℕ
⊢ ↑0 = ↑zero >>> n

case pos
α : Type u_1
n : ℕ
m : PosNum
⊢ ↑(m >>> n) = ↑(pos m) >>> n

tactic: induction' n with n IH generalizing m
state_before: case pos
α : Type u_1
n : ℕ
m : PosNum
⊢ ↑(m >>> n) = ↑(pos m) >>> n
state_after: case pos.zero
α : Type u_1
m : PosNum
⊢ ↑(m >>> 0) = ↑(pos m) >>> 0

case pos.succ
α : Type u_1
n : ℕ
IH : ∀ (m : PosNum), ↑(m >>> n) = ↑(pos m) >>> n
m : PosNum
⊢ ↑(m >>> (n + 1)) = ↑(pos m) >>> (n + 1)

tactic: cases' m with m m <;> dsimp only [PosNum.shiftr, ← PosNum.shiftr_eq_shiftRight]
state_before: case pos.succ
α : Type u_1
n : ℕ
IH : ∀ (m : PosNum), ↑(m >>> n) = ↑(pos m) >>> n
m : PosNum
⊢ ↑(m >>> (n + 1)) = ↑(pos m) >>> (n + 1)
state_after: case pos.succ.one
α : Type u_1
n : ℕ
IH : ∀ (m : PosNum), ↑(m >>> n) = ↑(pos m) >>> n
⊢ ↑0 = ↑(pos one) >>> (n + 1)

case pos.succ.bit1
α : Type u_1
n : ℕ
IH : ∀ (m : PosNum), ↑(m >>> n) = ↑(pos m) >>> n
m : PosNum
⊢ ↑(m.shiftr n) = ↑(pos m.bit1) >>> (n + 1)

case pos.succ.bit0
α : Type u_1
n : ℕ
IH : ∀ (m : PosNum), ↑(m >>> n) = ↑(pos m) >>> n
m : PosNum
⊢ ↑(m.shiftr n) = ↑(pos m.bit0) >>> (n + 1)

tactic: symm
state_before: case zero
α : Type u_1
n : ℕ
⊢ ↑0 = ↑zero >>> n
state_after: case zero
α : Type u_1
n : ℕ
⊢ ↑zero >>> n = ↑0

tactic: apply Nat.zero_shiftRight
state_before: case zero
α : Type u_1
n : ℕ
⊢ ↑zero >>> n = ↑0
state_after: no goals

tactic: cases m <;> rfl
state_before: case pos.zero
α : Type u_1
m : PosNum
⊢ ↑(m >>> 0) = ↑(pos m) >>> 0
state_after: no goals

tactic: rw [Nat.shiftRight_eq_div_pow]
state_before: case pos.succ.one
α : Type u_1
n : ℕ
IH : ∀ (m : PosNum), ↑(m >>> n) = ↑(pos m) >>> n
⊢ ↑0 = ↑(pos one) >>> (n + 1)
state_after: case pos.succ.one
α : Type u_1
n : ℕ
IH : ∀ (m : PosNum), ↑(m >>> n) = ↑(pos m) >>> n
⊢ ↑0 = ↑(pos one) / 2 ^ (n + 1)

tactic: symm
state_before: case pos.succ.one
α : Type u_1
n : ℕ
IH : ∀ (m : PosNum), ↑(m >>> n) = ↑(pos m) >>> n
⊢ ↑0 = ↑(pos one) / 2 ^ (n + 1)
state_after: case pos.succ.one
α : Type u_1
n : ℕ
IH : ∀ (m : PosNum), ↑(m >>> n) = ↑(pos m) >>> n
⊢ ↑(pos one) / 2 ^ (n + 1) = ↑0

tactic: apply Nat.div_eq_of_lt
state_before: case pos.succ.one
α : Type u_1
n : ℕ
IH : ∀ (m : PosNum), ↑(m >>> n) = ↑(pos m) >>> n
⊢ ↑(pos one) / 2 ^ (n + 1) = ↑0
state_after: case pos.succ.one.h₀
α : Type u_1
n : ℕ
IH : ∀ (m : PosNum), ↑(m >>> n) = ↑(pos m) >>> n
⊢ ↑(pos one) < 2 ^ (n + 1)

tactic: simp
state_before: case pos.succ.one.h₀
α : Type u_1
n : ℕ
IH : ∀ (m : PosNum), ↑(m >>> n) = ↑(pos m) >>> n
⊢ ↑(pos one) < 2 ^ (n + 1)
state_after: no goals

tactic: trans
state_before: case pos.succ.bit1
α : Type u_1
n : ℕ
IH : ∀ (m : PosNum), ↑(m >>> n) = ↑(pos m) >>> n
m : PosNum
⊢ ↑(m.shiftr n) = ↑(pos m.bit1) >>> (n + 1)
state_after: α : Type u_1
n : ℕ
IH : ∀ (m : PosNum), ↑(m >>> n) = ↑(pos m) >>> n
m : PosNum
⊢ ↑(m.shiftr n) = ?m.213174

α : Type u_1
n : ℕ
IH : ∀ (m : PosNum), ↑(m >>> n) = ↑(pos m) >>> n
m : PosNum
⊢ ?m.213174 = ↑(pos m.bit1) >>> (n + 1)

α : Type u_1
n : ℕ
IH : ∀ (m : PosNum), ↑(m >>> n) = ↑(pos m) >>> n
m : PosNum
⊢ ℕ

tactic: change Nat.shiftRight m n = Nat.shiftRight (_root_.bit1 m) (n + 1)
state_before: α : Type u_1
n : ℕ
IH : ∀ (m : PosNum), ↑(m >>> n) = ↑(pos m) >>> n
m : PosNum
⊢ ↑(pos m) >>> n = ↑(pos m.bit1) >>> (n + 1)
state_after: α : Type u_1
n : ℕ
IH : ∀ (m : PosNum), ↑(m >>> n) = ↑(pos m) >>> n
m : PosNum
⊢ (↑m).shiftRight n = (_root_.bit1 ↑m).shiftRight (n + 1)

tactic: rw [add_comm n 1, @Nat.shiftRight_eq _ (1 + n), Nat.shiftRight_add]
state_before: α : Type u_1
n : ℕ
IH : ∀ (m : PosNum), ↑(m >>> n) = ↑(pos m) >>> n
m : PosNum
⊢ (↑m).shiftRight n = (_root_.bit1 ↑m).shiftRight (n + 1)
state_after: α : Type u_1
n : ℕ
IH : ∀ (m : PosNum), ↑(m >>> n) = ↑(pos m) >>> n
m : PosNum
⊢ (↑m).shiftRight n = _root_.bit1 ↑m >>> 1 >>> n

tactic: apply congr_arg fun x => Nat.shiftRight x n
state_before: α : Type u_1
n : ℕ
IH : ∀ (m : PosNum), ↑(m >>> n) = ↑(pos m) >>> n
m : PosNum
⊢ (↑m).shiftRight n = _root_.bit1 ↑m >>> 1 >>> n
state_after: α : Type u_1
n : ℕ
IH : ∀ (m : PosNum), ↑(m >>> n) = ↑(pos m) >>> n
m : PosNum
⊢ ↑m = _root_.bit1 ↑m >>> 1

tactic: simp [Nat.shiftRight_succ, Nat.shiftRight_zero, ← Nat.div2_val]
state_before: α : Type u_1
n : ℕ
IH : ∀ (m : PosNum), ↑(m >>> n) = ↑(pos m) >>> n
m : PosNum
⊢ ↑m = _root_.bit1 ↑m >>> 1
state_after: no goals

tactic: apply IH
state_before: α : Type u_1
n : ℕ
IH : ∀ (m : PosNum), ↑(m >>> n) = ↑(pos m) >>> n
m : PosNum
⊢ ↑(m.shiftr n) = ?m.213174
state_after: no goals

tactic: trans
state_before: case pos.succ.bit0
α : Type u_1
n : ℕ
IH : ∀ (m : PosNum), ↑(m >>> n) = ↑(pos m) >>> n
m : PosNum
⊢ ↑(m.shiftr n) = ↑(pos m.bit0) >>> (n + 1)
state_after: α : Type u_1
n : ℕ
IH : ∀ (m : PosNum), ↑(m >>> n) = ↑(pos m) >>> n
m : PosNum
⊢ ↑(m.shiftr n) = ?m.213983

α : Type u_1
n : ℕ
IH : ∀ (m : PosNum), ↑(m >>> n) = ↑(pos m) >>> n
m : PosNum
⊢ ?m.213983 = ↑(pos m.bit0) >>> (n + 1)

α : Type u_1
n : ℕ
IH : ∀ (m : PosNum), ↑(m >>> n) = ↑(pos m) >>> n
m : PosNum
⊢ ℕ

tactic: change Nat.shiftRight m n = Nat.shiftRight (_root_.bit0 m) (n + 1)
state_before: α : Type u_1
n : ℕ
IH : ∀ (m : PosNum), ↑(m >>> n) = ↑(pos m) >>> n
m : PosNum
⊢ ↑(pos m) >>> n = ↑(pos m.bit0) >>> (n + 1)
state_after: α : Type u_1
n : ℕ
IH : ∀ (m : PosNum), ↑(m >>> n) = ↑(pos m) >>> n
m : PosNum
⊢ (↑m).shiftRight n = (_root_.bit0 ↑m).shiftRight (n + 1)

tactic: rw [add_comm n 1,  @Nat.shiftRight_eq _ (1 + n), Nat.shiftRight_add]
state_before: α : Type u_1
n : ℕ
IH : ∀ (m : PosNum), ↑(m >>> n) = ↑(pos m) >>> n
m : PosNum
⊢ (↑m).shiftRight n = (_root_.bit0 ↑m).shiftRight (n + 1)
state_after: α : Type u_1
n : ℕ
IH : ∀ (m : PosNum), ↑(m >>> n) = ↑(pos m) >>> n
m : PosNum
⊢ (↑m).shiftRight n = _root_.bit0 ↑m >>> 1 >>> n

tactic: apply congr_arg fun x => Nat.shiftRight x n
state_before: α : Type u_1
n : ℕ
IH : ∀ (m : PosNum), ↑(m >>> n) = ↑(pos m) >>> n
m : PosNum
⊢ (↑m).shiftRight n = _root_.bit0 ↑m >>> 1 >>> n
state_after: α : Type u_1
n : ℕ
IH : ∀ (m : PosNum), ↑(m >>> n) = ↑(pos m) >>> n
m : PosNum
⊢ ↑m = _root_.bit0 ↑m >>> 1

tactic: simp [Nat.shiftRight_succ, Nat.shiftRight_zero, ← Nat.div2_val]
state_before: α : Type u_1
n : ℕ
IH : ∀ (m : PosNum), ↑(m >>> n) = ↑(pos m) >>> n
m : PosNum
⊢ ↑m = _root_.bit0 ↑m >>> 1
state_after: no goals

tactic: apply IH
state_before: α : Type u_1
n : ℕ
IH : ∀ (m : PosNum), ↑(m >>> n) = ↑(pos m) >>> n
m : PosNum
⊢ ↑(m.shiftr n) = ?m.213983
state_after: no goals