Theorem: PosNum.cmp_to_nat
File: Mathlib/Data/Num/Lemmas.lean

tactic: dsimp [cmp]
state_before: α : Type u_1
a b : PosNum
⊢ Ordering.casesOn (a.bit0.cmp b.bit0) (↑a.bit0 < ↑b.bit0) (a.bit0 = b.bit0) (↑b.bit0 < ↑a.bit0)
state_after: α : Type u_1
a b : PosNum
⊢ Ordering.rec (_root_.bit0 ↑a < _root_.bit0 ↑b) (a.bit0 = b.bit0) (_root_.bit0 ↑b < _root_.bit0 ↑a) (a.cmp b)

tactic: have := cmp_to_nat a b
state_before: α : Type u_1
a b : PosNum
⊢ Ordering.rec (_root_.bit0 ↑a < _root_.bit0 ↑b) (a.bit0 = b.bit0) (_root_.bit0 ↑b < _root_.bit0 ↑a) (a.cmp b)
state_after: α : Type u_1
a b : PosNum
this : Ordering.casesOn (a.cmp b) (↑a < ↑b) (a = b) (↑b < ↑a)
⊢ Ordering.rec (_root_.bit0 ↑a < _root_.bit0 ↑b) (a.bit0 = b.bit0) (_root_.bit0 ↑b < _root_.bit0 ↑a) (a.cmp b)

tactic: revert this
state_before: α : Type u_1
a b : PosNum
this : Ordering.casesOn (a.cmp b) (↑a < ↑b) (a = b) (↑b < ↑a)
⊢ Ordering.rec (_root_.bit0 ↑a < _root_.bit0 ↑b) (a.bit0 = b.bit0) (_root_.bit0 ↑b < _root_.bit0 ↑a) (a.cmp b)
state_after: α : Type u_1
a b : PosNum
⊢ Ordering.casesOn (a.cmp b) (↑a < ↑b) (a = b) (↑b < ↑a) →
    Ordering.rec (_root_.bit0 ↑a < _root_.bit0 ↑b) (a.bit0 = b.bit0) (_root_.bit0 ↑b < _root_.bit0 ↑a) (a.cmp b)

tactic: cases cmp a b <;> dsimp <;> intro this
state_before: α : Type u_1
a b : PosNum
⊢ Ordering.casesOn (a.cmp b) (↑a < ↑b) (a = b) (↑b < ↑a) →
    Ordering.rec (_root_.bit0 ↑a < _root_.bit0 ↑b) (a.bit0 = b.bit0) (_root_.bit0 ↑b < _root_.bit0 ↑a) (a.cmp b)
state_after: case lt
α : Type u_1
a b : PosNum
this : ↑a < ↑b
⊢ _root_.bit0 ↑a < _root_.bit0 ↑b

case eq
α : Type u_1
a b : PosNum
this : a = b
⊢ a.bit0 = b.bit0

case gt
α : Type u_1
a b : PosNum
this : ↑b < ↑a
⊢ _root_.bit0 ↑b < _root_.bit0 ↑a

tactic: exact Nat.add_lt_add this this
state_before: case lt
α : Type u_1
a b : PosNum
this : ↑a < ↑b
⊢ _root_.bit0 ↑a < _root_.bit0 ↑b
state_after: no goals

tactic: rw [this]
state_before: case eq
α : Type u_1
a b : PosNum
this : a = b
⊢ a.bit0 = b.bit0
state_after: no goals

tactic: exact Nat.add_lt_add this this
state_before: case gt
α : Type u_1
a b : PosNum
this : ↑b < ↑a
⊢ _root_.bit0 ↑b < _root_.bit0 ↑a
state_after: no goals

tactic: dsimp [cmp]
state_before: α : Type u_1
a b : PosNum
⊢ Ordering.casesOn (a.bit0.cmp b.bit1) (↑a.bit0 < ↑b.bit1) (a.bit0 = b.bit1) (↑b.bit1 < ↑a.bit0)
state_after: α : Type u_1
a b : PosNum
⊢ Ordering.rec (_root_.bit0 ↑a < _root_.bit1 ↑b) (a.bit0 = b.bit1) (_root_.bit1 ↑b < _root_.bit0 ↑a)
    (Ordering.rec Ordering.lt Ordering.lt Ordering.gt (a.cmp b))

tactic: have := cmp_to_nat a b
state_before: α : Type u_1
a b : PosNum
⊢ Ordering.rec (_root_.bit0 ↑a < _root_.bit1 ↑b) (a.bit0 = b.bit1) (_root_.bit1 ↑b < _root_.bit0 ↑a)
    (Ordering.rec Ordering.lt Ordering.lt Ordering.gt (a.cmp b))
state_after: α : Type u_1
a b : PosNum
this : Ordering.casesOn (a.cmp b) (↑a < ↑b) (a = b) (↑b < ↑a)
⊢ Ordering.rec (_root_.bit0 ↑a < _root_.bit1 ↑b) (a.bit0 = b.bit1) (_root_.bit1 ↑b < _root_.bit0 ↑a)
    (Ordering.rec Ordering.lt Ordering.lt Ordering.gt (a.cmp b))

tactic: revert this
state_before: α : Type u_1
a b : PosNum
this : Ordering.casesOn (a.cmp b) (↑a < ↑b) (a = b) (↑b < ↑a)
⊢ Ordering.rec (_root_.bit0 ↑a < _root_.bit1 ↑b) (a.bit0 = b.bit1) (_root_.bit1 ↑b < _root_.bit0 ↑a)
    (Ordering.rec Ordering.lt Ordering.lt Ordering.gt (a.cmp b))
state_after: α : Type u_1
a b : PosNum
⊢ Ordering.casesOn (a.cmp b) (↑a < ↑b) (a = b) (↑b < ↑a) →
    Ordering.rec (_root_.bit0 ↑a < _root_.bit1 ↑b) (a.bit0 = b.bit1) (_root_.bit1 ↑b < _root_.bit0 ↑a)
      (Ordering.rec Ordering.lt Ordering.lt Ordering.gt (a.cmp b))

tactic: cases cmp a b <;> dsimp <;> intro this
state_before: α : Type u_1
a b : PosNum
⊢ Ordering.casesOn (a.cmp b) (↑a < ↑b) (a = b) (↑b < ↑a) →
    Ordering.rec (_root_.bit0 ↑a < _root_.bit1 ↑b) (a.bit0 = b.bit1) (_root_.bit1 ↑b < _root_.bit0 ↑a)
      (Ordering.rec Ordering.lt Ordering.lt Ordering.gt (a.cmp b))
state_after: case lt
α : Type u_1
a b : PosNum
this : ↑a < ↑b
⊢ _root_.bit0 ↑a < _root_.bit1 ↑b

case eq
α : Type u_1
a b : PosNum
this : a = b
⊢ _root_.bit0 ↑a < _root_.bit1 ↑b

case gt
α : Type u_1
a b : PosNum
this : ↑b < ↑a
⊢ _root_.bit1 ↑b < _root_.bit0 ↑a

tactic: exact Nat.le_succ_of_le (Nat.add_lt_add this this)
state_before: case lt
α : Type u_1
a b : PosNum
this : ↑a < ↑b
⊢ _root_.bit0 ↑a < _root_.bit1 ↑b
state_after: no goals

tactic: rw [this]
state_before: case eq
α : Type u_1
a b : PosNum
this : a = b
⊢ _root_.bit0 ↑a < _root_.bit1 ↑b
state_after: case eq
α : Type u_1
a b : PosNum
this : a = b
⊢ _root_.bit0 ↑b < _root_.bit1 ↑b

tactic: apply Nat.lt_succ_self
state_before: case eq
α : Type u_1
a b : PosNum
this : a = b
⊢ _root_.bit0 ↑b < _root_.bit1 ↑b
state_after: no goals

tactic: exact cmp_to_nat_lemma this
state_before: case gt
α : Type u_1
a b : PosNum
this : ↑b < ↑a
⊢ _root_.bit1 ↑b < _root_.bit0 ↑a
state_after: no goals

tactic: dsimp [cmp]
state_before: α : Type u_1
a b : PosNum
⊢ Ordering.casesOn (a.bit1.cmp b.bit0) (↑a.bit1 < ↑b.bit0) (a.bit1 = b.bit0) (↑b.bit0 < ↑a.bit1)
state_after: α : Type u_1
a b : PosNum
⊢ Ordering.rec (_root_.bit1 ↑a < _root_.bit0 ↑b) (a.bit1 = b.bit0) (_root_.bit0 ↑b < _root_.bit1 ↑a)
    (Ordering.rec Ordering.lt Ordering.gt Ordering.gt (a.cmp b))

tactic: have := cmp_to_nat a b
state_before: α : Type u_1
a b : PosNum
⊢ Ordering.rec (_root_.bit1 ↑a < _root_.bit0 ↑b) (a.bit1 = b.bit0) (_root_.bit0 ↑b < _root_.bit1 ↑a)
    (Ordering.rec Ordering.lt Ordering.gt Ordering.gt (a.cmp b))
state_after: α : Type u_1
a b : PosNum
this : Ordering.casesOn (a.cmp b) (↑a < ↑b) (a = b) (↑b < ↑a)
⊢ Ordering.rec (_root_.bit1 ↑a < _root_.bit0 ↑b) (a.bit1 = b.bit0) (_root_.bit0 ↑b < _root_.bit1 ↑a)
    (Ordering.rec Ordering.lt Ordering.gt Ordering.gt (a.cmp b))

tactic: revert this
state_before: α : Type u_1
a b : PosNum
this : Ordering.casesOn (a.cmp b) (↑a < ↑b) (a = b) (↑b < ↑a)
⊢ Ordering.rec (_root_.bit1 ↑a < _root_.bit0 ↑b) (a.bit1 = b.bit0) (_root_.bit0 ↑b < _root_.bit1 ↑a)
    (Ordering.rec Ordering.lt Ordering.gt Ordering.gt (a.cmp b))
state_after: α : Type u_1
a b : PosNum
⊢ Ordering.casesOn (a.cmp b) (↑a < ↑b) (a = b) (↑b < ↑a) →
    Ordering.rec (_root_.bit1 ↑a < _root_.bit0 ↑b) (a.bit1 = b.bit0) (_root_.bit0 ↑b < _root_.bit1 ↑a)
      (Ordering.rec Ordering.lt Ordering.gt Ordering.gt (a.cmp b))

tactic: cases cmp a b <;> dsimp <;> intro this
state_before: α : Type u_1
a b : PosNum
⊢ Ordering.casesOn (a.cmp b) (↑a < ↑b) (a = b) (↑b < ↑a) →
    Ordering.rec (_root_.bit1 ↑a < _root_.bit0 ↑b) (a.bit1 = b.bit0) (_root_.bit0 ↑b < _root_.bit1 ↑a)
      (Ordering.rec Ordering.lt Ordering.gt Ordering.gt (a.cmp b))
state_after: case lt
α : Type u_1
a b : PosNum
this : ↑a < ↑b
⊢ _root_.bit1 ↑a < _root_.bit0 ↑b

case eq
α : Type u_1
a b : PosNum
this : a = b
⊢ _root_.bit0 ↑b < _root_.bit1 ↑a

case gt
α : Type u_1
a b : PosNum
this : ↑b < ↑a
⊢ _root_.bit0 ↑b < _root_.bit1 ↑a

tactic: exact cmp_to_nat_lemma this
state_before: case lt
α : Type u_1
a b : PosNum
this : ↑a < ↑b
⊢ _root_.bit1 ↑a < _root_.bit0 ↑b
state_after: no goals

tactic: rw [this]
state_before: case eq
α : Type u_1
a b : PosNum
this : a = b
⊢ _root_.bit0 ↑b < _root_.bit1 ↑a
state_after: case eq
α : Type u_1
a b : PosNum
this : a = b
⊢ _root_.bit0 ↑b < _root_.bit1 ↑b

tactic: exact Nat.le_succ_of_le (Nat.add_lt_add this this)
state_before: case gt
α : Type u_1
a b : PosNum
this : ↑b < ↑a
⊢ _root_.bit0 ↑b < _root_.bit1 ↑a
state_after: no goals

tactic: dsimp [cmp]
state_before: α : Type u_1
a b : PosNum
⊢ Ordering.casesOn (a.bit1.cmp b.bit1) (↑a.bit1 < ↑b.bit1) (a.bit1 = b.bit1) (↑b.bit1 < ↑a.bit1)
state_after: α : Type u_1
a b : PosNum
⊢ Ordering.rec (_root_.bit1 ↑a < _root_.bit1 ↑b) (a.bit1 = b.bit1) (_root_.bit1 ↑b < _root_.bit1 ↑a) (a.cmp b)

tactic: have := cmp_to_nat a b
state_before: α : Type u_1
a b : PosNum
⊢ Ordering.rec (_root_.bit1 ↑a < _root_.bit1 ↑b) (a.bit1 = b.bit1) (_root_.bit1 ↑b < _root_.bit1 ↑a) (a.cmp b)
state_after: α : Type u_1
a b : PosNum
this : Ordering.casesOn (a.cmp b) (↑a < ↑b) (a = b) (↑b < ↑a)
⊢ Ordering.rec (_root_.bit1 ↑a < _root_.bit1 ↑b) (a.bit1 = b.bit1) (_root_.bit1 ↑b < _root_.bit1 ↑a) (a.cmp b)

tactic: revert this
state_before: α : Type u_1
a b : PosNum
this : Ordering.casesOn (a.cmp b) (↑a < ↑b) (a = b) (↑b < ↑a)
⊢ Ordering.rec (_root_.bit1 ↑a < _root_.bit1 ↑b) (a.bit1 = b.bit1) (_root_.bit1 ↑b < _root_.bit1 ↑a) (a.cmp b)
state_after: α : Type u_1
a b : PosNum
⊢ Ordering.casesOn (a.cmp b) (↑a < ↑b) (a = b) (↑b < ↑a) →
    Ordering.rec (_root_.bit1 ↑a < _root_.bit1 ↑b) (a.bit1 = b.bit1) (_root_.bit1 ↑b < _root_.bit1 ↑a) (a.cmp b)

tactic: cases cmp a b <;> dsimp <;> intro this
state_before: α : Type u_1
a b : PosNum
⊢ Ordering.casesOn (a.cmp b) (↑a < ↑b) (a = b) (↑b < ↑a) →
    Ordering.rec (_root_.bit1 ↑a < _root_.bit1 ↑b) (a.bit1 = b.bit1) (_root_.bit1 ↑b < _root_.bit1 ↑a) (a.cmp b)
state_after: case lt
α : Type u_1
a b : PosNum
this : ↑a < ↑b
⊢ _root_.bit1 ↑a < _root_.bit1 ↑b

case eq
α : Type u_1
a b : PosNum
this : a = b
⊢ a.bit1 = b.bit1

case gt
α : Type u_1
a b : PosNum
this : ↑b < ↑a
⊢ _root_.bit1 ↑b < _root_.bit1 ↑a

tactic: exact Nat.succ_lt_succ (Nat.add_lt_add this this)
state_before: case lt
α : Type u_1
a b : PosNum
this : ↑a < ↑b
⊢ _root_.bit1 ↑a < _root_.bit1 ↑b
state_after: no goals

tactic: rw [this]
state_before: case eq
α : Type u_1
a b : PosNum
this : a = b
⊢ a.bit1 = b.bit1
state_after: no goals

tactic: exact Nat.succ_lt_succ (Nat.add_lt_add this this)
state_before: case gt
α : Type u_1
a b : PosNum
this : ↑b < ↑a
⊢ _root_.bit1 ↑b < _root_.bit1 ↑a
state_after: no goals