l3lab/ntp-mathlib huggingface dataset:
theorem cmp_swap (m) : ∀ n, (cmp m n).swap = cmp n m := by
  induction' m with m IH m IH <;> intro n <;> cases' n with n n <;> 

Proof state:
case bit1.bit1
α : Type u_1
m : PosNum
IH : ∀ (n : PosNum), Ordering.swap (cmp m n) = cmp n m
n : PosNum
⊢ Ordering.swap (cmp (bit1 m) (bit1 n)) = cmp (bit1 n) (bit1 m)

Next tactic:
unfold cmp
theorem cmp_swap (m) : ∀ n, (cmp m n).swap = cmp n m := by
  induction' m with m IH m IH <;> intro n <;> cases' n with n n <;> 

Proof state:
case bit1.bit0
α : Type u_1
m : PosNum
IH : ∀ (n : PosNum), Ordering.swap (cmp m n) = cmp n m
n : PosNum
⊢ Ordering.swap (cmp (bit1 m) (bit0 n)) = cmp (bit0 n) (bit1 m)

Next tactic:
unfold cmp
theorem cmp_swap (m) : ∀ n, (cmp m n).swap = cmp n m := by
  induction' m with m IH m IH <;> intro n <;> cases' n with n n <;> 

Proof state:
case bit0.one
α : Type u_1
m : PosNum
IH : ∀ (n : PosNum), Ordering.swap (cmp m n) = cmp n m
⊢ Ordering.swap (cmp (bit0 m) one) = cmp one (bit0 m)

Next tactic:
unfold cmp
theorem cmp_swap (m) : ∀ n, (cmp m n).swap = cmp n m := by
  induction' m with m IH m IH <;> intro n <;> cases' n with n n <;> 

Proof state:
case bit0.bit1
α : Type u_1
m : PosNum
IH : ∀ (n : PosNum), Ordering.swap (cmp m n) = cmp n m
n : PosNum
⊢ Ordering.swap (cmp (bit0 m) (bit1 n)) = cmp (bit1 n) (bit0 m)

Next tactic:
unfold cmp
theorem cmp_swap (m) : ∀ n, (cmp m n).swap = cmp n m := by
  induction' m with m IH m IH <;> intro n <;> cases' n with n n <;> 

Proof state:
case bit0.bit0
α : Type u_1
m : PosNum
IH : ∀ (n : PosNum), Ordering.swap (cmp m n) = cmp n m
n : PosNum
⊢ Ordering.swap (cmp (bit0 m) (bit0 n)) = cmp (bit0 n) (bit0 m)

Next tactic:
unfold cmp
theorem cmp_swap (m) : ∀ n, (cmp m n).swap = cmp n m := by
  induction' m with m IH m IH <;> intro n <;> cases' n with n n <;> unfold cmp <;>
    

Proof state:
case one.one
α : Type u_1
⊢ Ordering.swap Ordering.eq = Ordering.eq

Next tactic:
try { rfl }
theorem cmp_swap (m) : ∀ n, (cmp m n).swap = cmp n m := by
  induction' m with m IH m IH <;> intro n <;> cases' n with n n <;> unfold cmp <;>
    try 

Proof state:
case one.one
α : Type u_1
⊢ Ordering.swap Ordering.eq = Ordering.eq

Next tactic:
{ rfl }
theorem cmp_swap (m) : ∀ n, (cmp m n).swap = cmp n m := by
  induction' m with m IH m IH <;> intro n <;> cases' n with n n <;> unfold cmp <;>
    try { 

Proof state:
case one.one
α : Type u_1
⊢ Ordering.swap Ordering.eq = Ordering.eq

Next tactic:
rfl
theorem cmp_swap (m) : ∀ n, (cmp m n).swap = cmp n m := by
  induction' m with m IH m IH <;> intro n <;> cases' n with n n <;> unfold cmp <;>
    

Proof state:
case one.bit1
α : Type u_1
n : PosNum
⊢ Ordering.swap Ordering.lt = Ordering.gt

Next tactic:
try { rfl }
theorem cmp_swap (m) : ∀ n, (cmp m n).swap = cmp n m := by
  induction' m with m IH m IH <;> intro n <;> cases' n with n n <;> unfold cmp <;>
    try 

Proof state:
case one.bit1
α : Type u_1
n : PosNum
⊢ Ordering.swap Ordering.lt = Ordering.gt

Next tactic:
{ rfl }
theorem cmp_swap (m) : ∀ n, (cmp m n).swap = cmp n m := by
  induction' m with m IH m IH <;> intro n <;> cases' n with n n <;> unfold cmp <;>
    try { 

Proof state:
case one.bit1
α : Type u_1
n : PosNum
⊢ Ordering.swap Ordering.lt = Ordering.gt

Next tactic:
rfl
theorem cmp_swap (m) : ∀ n, (cmp m n).swap = cmp n m := by
  induction' m with m IH m IH <;> intro n <;> cases' n with n n <;> unfold cmp <;>
    

Proof state:
case one.bit0
α : Type u_1
n : PosNum
⊢ Ordering.swap Ordering.lt = Ordering.gt

Next tactic:
try { rfl }
theorem cmp_swap (m) : ∀ n, (cmp m n).swap = cmp n m := by
  induction' m with m IH m IH <;> intro n <;> cases' n with n n <;> unfold cmp <;>
    try 

Proof state:
case one.bit0
α : Type u_1
n : PosNum
⊢ Ordering.swap Ordering.lt = Ordering.gt

Next tactic:
{ rfl }
theorem cmp_swap (m) : ∀ n, (cmp m n).swap = cmp n m := by
  induction' m with m IH m IH <;> intro n <;> cases' n with n n <;> unfold cmp <;>
    try { 

Proof state:
case one.bit0
α : Type u_1
n : PosNum
⊢ Ordering.swap Ordering.lt = Ordering.gt

Next tactic:
rfl
theorem cmp_swap (m) : ∀ n, (cmp m n).swap = cmp n m := by
  induction' m with m IH m IH <;> intro n <;> cases' n with n n <;> unfold cmp <;>
    

Proof state:
case bit1.one
α : Type u_1
m : PosNum
IH : ∀ (n : PosNum), Ordering.swap (cmp m n) = cmp n m
⊢ Ordering.swap Ordering.gt = Ordering.lt

Next tactic:
try { rfl }
theorem cmp_swap (m) : ∀ n, (cmp m n).swap = cmp n m := by
  induction' m with m IH m IH <;> intro n <;> cases' n with n n <;> unfold cmp <;>
    try 

Proof state:
case bit1.one
α : Type u_1
m : PosNum
IH : ∀ (n : PosNum), Ordering.swap (cmp m n) = cmp n m
⊢ Ordering.swap Ordering.gt = Ordering.lt

Next tactic:
{ rfl }
theorem cmp_swap (m) : ∀ n, (cmp m n).swap = cmp n m := by
  induction' m with m IH m IH <;> intro n <;> cases' n with n n <;> unfold cmp <;>
    try { 

Proof state:
case bit1.one
α : Type u_1
m : PosNum
IH : ∀ (n : PosNum), Ordering.swap (cmp m n) = cmp n m
⊢ Ordering.swap Ordering.gt = Ordering.lt

Next tactic:
rfl
theorem cmp_swap (m) : ∀ n, (cmp m n).swap = cmp n m := by
  induction' m with m IH m IH <;> intro n <;> cases' n with n n <;> unfold cmp <;>
    

Proof state:
case bit1.bit1
α : Type u_1
m : PosNum
IH : ∀ (n : PosNum), Ordering.swap (cmp m n) = cmp n m
n : PosNum
⊢ Ordering.swap (cmp m n) = cmp n m

Next tactic:
try { rfl }
theorem cmp_swap (m) : ∀ n, (cmp m n).swap = cmp n m := by
  induction' m with m IH m IH <;> intro n <;> cases' n with n n <;> unfold cmp <;>
    try 

Proof state:
case bit1.bit1
α : Type u_1
m : PosNum
IH : ∀ (n : PosNum), Ordering.swap (cmp m n) = cmp n m
n : PosNum
⊢ Ordering.swap (cmp m n) = cmp n m

Next tactic:
{ rfl }
theorem cmp_swap (m) : ∀ n, (cmp m n).swap = cmp n m := by
  induction' m with m IH m IH <;> intro n <;> cases' n with n n <;> unfold cmp <;>
    try { 

Proof state:
case bit1.bit1
α : Type u_1
m : PosNum
IH : ∀ (n : PosNum), Ordering.swap (cmp m n) = cmp n m
n : PosNum
⊢ Ordering.swap (cmp m n) = cmp n m

Next tactic:
rfl
theorem cmp_swap (m) : ∀ n, (cmp m n).swap = cmp n m := by
  induction' m with m IH m IH <;> intro n <;> cases' n with n n <;> unfold cmp <;>
    

Proof state:
case bit1.bit0
α : Type u_1
m : PosNum
IH : ∀ (n : PosNum), Ordering.swap (cmp m n) = cmp n m
n : PosNum
⊢ Ordering.swap (Ordering.casesOn (cmp m n) Ordering.lt Ordering.gt Ordering.gt) =
    Ordering.casesOn (cmp n m) Ordering.lt Ordering.lt Ordering.gt

Next tactic:
try { rfl }
theorem cmp_swap (m) : ∀ n, (cmp m n).swap = cmp n m := by
  induction' m with m IH m IH <;> intro n <;> cases' n with n n <;> unfold cmp <;>
    try 

Proof state:
case bit1.bit0
α : Type u_1
m : PosNum
IH : ∀ (n : PosNum), Ordering.swap (cmp m n) = cmp n m
n : PosNum
⊢ Ordering.swap (Ordering.casesOn (cmp m n) Ordering.lt Ordering.gt Ordering.gt) =
    Ordering.casesOn (cmp n m) Ordering.lt Ordering.lt Ordering.gt

Next tactic:
{ rfl }
theorem cmp_swap (m) : ∀ n, (cmp m n).swap = cmp n m := by
  induction' m with m IH m IH <;> intro n <;> cases' n with n n <;> unfold cmp <;>
    try { 

Proof state:
case bit1.bit0
α : Type u_1
m : PosNum
IH : ∀ (n : PosNum), Ordering.swap (cmp m n) = cmp n m
n : PosNum
⊢ Ordering.swap (Ordering.casesOn (cmp m n) Ordering.lt Ordering.gt Ordering.gt) =
    Ordering.casesOn (cmp n m) Ordering.lt Ordering.lt Ordering.gt

Next tactic:
rfl
theorem cmp_swap (m) : ∀ n, (cmp m n).swap = cmp n m := by
  induction' m with m IH m IH <;> intro n <;> cases' n with n n <;> unfold cmp <;>
    

Proof state:
case bit0.one
α : Type u_1
m : PosNum
IH : ∀ (n : PosNum), Ordering.swap (cmp m n) = cmp n m
⊢ Ordering.swap Ordering.gt = Ordering.lt

Next tactic:
try { rfl }
theorem cmp_swap (m) : ∀ n, (cmp m n).swap = cmp n m := by
  induction' m with m IH m IH <;> intro n <;> cases' n with n n <;> unfold cmp <;>
    try 

Proof state:
case bit0.one
α : Type u_1
m : PosNum
IH : ∀ (n : PosNum), Ordering.swap (cmp m n) = cmp n m
⊢ Ordering.swap Ordering.gt = Ordering.lt

Next tactic:
{ rfl }
theorem cmp_swap (m) : ∀ n, (cmp m n).swap = cmp n m := by
  induction' m with m IH m IH <;> intro n <;> cases' n with n n <;> unfold cmp <;>
    try { 

Proof state:
case bit0.one
α : Type u_1
m : PosNum
IH : ∀ (n : PosNum), Ordering.swap (cmp m n) = cmp n m
⊢ Ordering.swap Ordering.gt = Ordering.lt

Next tactic:
rfl
theorem cmp_swap (m) : ∀ n, (cmp m n).swap = cmp n m := by
  induction' m with m IH m IH <;> intro n <;> cases' n with n n <;> unfold cmp <;>
    

Proof state:
case bit0.bit1
α : Type u_1
m : PosNum
IH : ∀ (n : PosNum), Ordering.swap (cmp m n) = cmp n m
n : PosNum
⊢ Ordering.swap (Ordering.casesOn (cmp m n) Ordering.lt Ordering.lt Ordering.gt) =
    Ordering.casesOn (cmp n m) Ordering.lt Ordering.gt Ordering.gt

Next tactic:
try { rfl }
theorem cmp_swap (m) : ∀ n, (cmp m n).swap = cmp n m := by
  induction' m with m IH m IH <;> intro n <;> cases' n with n n <;> unfold cmp <;>
    try 

Proof state:
case bit0.bit1
α : Type u_1
m : PosNum
IH : ∀ (n : PosNum), Ordering.swap (cmp m n) = cmp n m
n : PosNum
⊢ Ordering.swap (Ordering.casesOn (cmp m n) Ordering.lt Ordering.lt Ordering.gt) =
    Ordering.casesOn (cmp n m) Ordering.lt Ordering.gt Ordering.gt

Next tactic:
{ rfl }
theorem cmp_swap (m) : ∀ n, (cmp m n).swap = cmp n m := by
  induction' m with m IH m IH <;> intro n <;> cases' n with n n <;> unfold cmp <;>
    try { 

Proof state:
case bit0.bit1
α : Type u_1
m : PosNum
IH : ∀ (n : PosNum), Ordering.swap (cmp m n) = cmp n m
n : PosNum
⊢ Ordering.swap (Ordering.casesOn (cmp m n) Ordering.lt Ordering.lt Ordering.gt) =
    Ordering.casesOn (cmp n m) Ordering.lt Ordering.gt Ordering.gt

Next tactic:
rfl
theorem cmp_swap (m) : ∀ n, (cmp m n).swap = cmp n m := by
  induction' m with m IH m IH <;> intro n <;> cases' n with n n <;> unfold cmp <;>
    

Proof state:
case bit0.bit0
α : Type u_1
m : PosNum
IH : ∀ (n : PosNum), Ordering.swap (cmp m n) = cmp n m
n : PosNum
⊢ Ordering.swap (cmp m n) = cmp n m

Next tactic:
try { rfl }
theorem cmp_swap (m) : ∀ n, (cmp m n).swap = cmp n m := by
  induction' m with m IH m IH <;> intro n <;> cases' n with n n <;> unfold cmp <;>
    try 

Proof state:
case bit0.bit0
α : Type u_1
m : PosNum
IH : ∀ (n : PosNum), Ordering.swap (cmp m n) = cmp n m
n : PosNum
⊢ Ordering.swap (cmp m n) = cmp n m

Next tactic:
{ rfl }
theorem cmp_swap (m) : ∀ n, (cmp m n).swap = cmp n m := by
  induction' m with m IH m IH <;> intro n <;> cases' n with n n <;> unfold cmp <;>
    try { 

Proof state:
case bit0.bit0
α : Type u_1
m : PosNum
IH : ∀ (n : PosNum), Ordering.swap (cmp m n) = cmp n m
n : PosNum
⊢ Ordering.swap (cmp m n) = cmp n m

Next tactic:
rfl
theorem cmp_swap (m) : ∀ n, (cmp m n).swap = cmp n m := by
  induction' m with m IH m IH <;> intro n <;> cases' n with n n <;> unfold cmp <;>
    try { rfl } <;> 

Proof state:
case bit1.bit1
α : Type u_1
m : PosNum
IH : ∀ (n : PosNum), Ordering.swap (cmp m n) = cmp n m
n : PosNum
⊢ Ordering.swap (cmp m n) = cmp n m

Next tactic:
rw [← IH]
theorem cmp_swap (m) : ∀ n, (cmp m n).swap = cmp n m := by
  induction' m with m IH m IH <;> intro n <;> cases' n with n n <;> unfold cmp <;>
    try { rfl } <;> 

Proof state:
case bit1.bit0
α : Type u_1
m : PosNum
IH : ∀ (n : PosNum), Ordering.swap (cmp m n) = cmp n m
n : PosNum
⊢ Ordering.swap (Ordering.casesOn (cmp m n) Ordering.lt Ordering.gt Ordering.gt) =
    Ordering.casesOn (cmp n m) Ordering.lt Ordering.lt Ordering.gt

Next tactic:
rw [← IH]
theorem cmp_swap (m) : ∀ n, (cmp m n).swap = cmp n m := by
  induction' m with m IH m IH <;> intro n <;> cases' n with n n <;> unfold cmp <;>
    try { rfl } <;> 

Proof state:
case bit0.bit1
α : Type u_1
m : PosNum
IH : ∀ (n : PosNum), Ordering.swap (cmp m n) = cmp n m
n : PosNum
⊢ Ordering.swap (Ordering.casesOn (cmp m n) Ordering.lt Ordering.lt Ordering.gt) =
    Ordering.casesOn (cmp n m) Ordering.lt Ordering.gt Ordering.gt

Next tactic:
rw [← IH]
theorem cmp_swap (m) : ∀ n, (cmp m n).swap = cmp n m := by
  induction' m with m IH m IH <;> intro n <;> cases' n with n n <;> unfold cmp <;>
    try { rfl } <;> 

Proof state:
case bit0.bit0
α : Type u_1
m : PosNum
IH : ∀ (n : PosNum), Ordering.swap (cmp m n) = cmp n m
n : PosNum
⊢ Ordering.swap (cmp m n) = cmp n m

Next tactic:
rw [← IH]
theorem cmp_swap (m) : ∀ n, (cmp m n).swap = cmp n m := by
  induction' m with m IH m IH <;> intro n <;> cases' n with n n <;> unfold cmp <;>
    try { rfl } <;> rw [← IH] <;> 

Proof state:
case bit1.bit0
α : Type u_1
m : PosNum
IH : ∀ (n : PosNum), Ordering.swap (cmp m n) = cmp n m
n : PosNum
⊢ Ordering.swap (Ordering.casesOn (cmp m n) Ordering.lt Ordering.gt Ordering.gt) =
    Ordering.casesOn (Ordering.swap (cmp m n)) Ordering.lt Ordering.lt Ordering.gt

Next tactic:
cases cmp m n
theorem cmp_swap (m) : ∀ n, (cmp m n).swap = cmp n m := by
  induction' m with m IH m IH <;> intro n <;> cases' n with n n <;> unfold cmp <;>
    try { rfl } <;> rw [← IH] <;> 

Proof state:
case bit0.bit1
α : Type u_1
m : PosNum
IH : ∀ (n : PosNum), Ordering.swap (cmp m n) = cmp n m
n : PosNum
⊢ Ordering.swap (Ordering.casesOn (cmp m n) Ordering.lt Ordering.lt Ordering.gt) =
    Ordering.casesOn (Ordering.swap (cmp m n)) Ordering.lt Ordering.gt Ordering.gt

Next tactic:
cases cmp m n
theorem cmp_swap (m) : ∀ n, (cmp m n).swap = cmp n m := by
  induction' m with m IH m IH <;> intro n <;> cases' n with n n <;> unfold cmp <;>
    try { rfl } <;> rw [← IH] <;> cases cmp m n <;> 

Proof state:
case bit1.bit0.lt
α : Type u_1
m : PosNum
IH : ∀ (n : PosNum), Ordering.swap (cmp m n) = cmp n m
n : PosNum
⊢ Ordering.swap (Ordering.casesOn Ordering.lt Ordering.lt Ordering.gt Ordering.gt) =
    Ordering.casesOn (Ordering.swap Ordering.lt) Ordering.lt Ordering.lt Ordering.gt

Next tactic:
rfl
theorem cmp_swap (m) : ∀ n, (cmp m n).swap = cmp n m := by
  induction' m with m IH m IH <;> intro n <;> cases' n with n n <;> unfold cmp <;>
    try { rfl } <;> rw [← IH] <;> cases cmp m n <;> 

Proof state:
case bit1.bit0.eq
α : Type u_1
m : PosNum
IH : ∀ (n : PosNum), Ordering.swap (cmp m n) = cmp n m
n : PosNum
⊢ Ordering.swap (Ordering.casesOn Ordering.eq Ordering.lt Ordering.gt Ordering.gt) =
    Ordering.casesOn (Ordering.swap Ordering.eq) Ordering.lt Ordering.lt Ordering.gt

Next tactic:
rfl
theorem cmp_swap (m) : ∀ n, (cmp m n).swap = cmp n m := by
  induction' m with m IH m IH <;> intro n <;> cases' n with n n <;> unfold cmp <;>
    try { rfl } <;> rw [← IH] <;> cases cmp m n <;> 

Proof state:
case bit1.bit0.gt
α : Type u_1
m : PosNum
IH : ∀ (n : PosNum), Ordering.swap (cmp m n) = cmp n m
n : PosNum
⊢ Ordering.swap (Ordering.casesOn Ordering.gt Ordering.lt Ordering.gt Ordering.gt) =
    Ordering.casesOn (Ordering.swap Ordering.gt) Ordering.lt Ordering.lt Ordering.gt

Next tactic:
rfl
theorem cmp_swap (m) : ∀ n, (cmp m n).swap = cmp n m := by
  induction' m with m IH m IH <;> intro n <;> cases' n with n n <;> unfold cmp <;>
    try { rfl } <;> rw [← IH] <;> cases cmp m n <;> 

Proof state:
case bit0.bit1.lt
α : Type u_1
m : PosNum
IH : ∀ (n : PosNum), Ordering.swap (cmp m n) = cmp n m
n : PosNum
⊢ Ordering.swap (Ordering.casesOn Ordering.lt Ordering.lt Ordering.lt Ordering.gt) =
    Ordering.casesOn (Ordering.swap Ordering.lt) Ordering.lt Ordering.gt Ordering.gt

Next tactic:
rfl
theorem cmp_swap (m) : ∀ n, (cmp m n).swap = cmp n m := by
  induction' m with m IH m IH <;> intro n <;> cases' n with n n <;> unfold cmp <;>
    try { rfl } <;> rw [← IH] <;> cases cmp m n <;> 

Proof state:
case bit0.bit1.eq
α : Type u_1
m : PosNum
IH : ∀ (n : PosNum), Ordering.swap (cmp m n) = cmp n m
n : PosNum
⊢ Ordering.swap (Ordering.casesOn Ordering.eq Ordering.lt Ordering.lt Ordering.gt) =
    Ordering.casesOn (Ordering.swap Ordering.eq) Ordering.lt Ordering.gt Ordering.gt

Next tactic:
rfl
theorem cmp_swap (m) : ∀ n, (cmp m n).swap = cmp n m := by
  induction' m with m IH m IH <;> intro n <;> cases' n with n n <;> unfold cmp <;>
    try { rfl } <;> rw [← IH] <;> cases cmp m n <;> 

Proof state:
case bit0.bit1.gt
α : Type u_1
m : PosNum
IH : ∀ (n : PosNum), Ordering.swap (cmp m n) = cmp n m
n : PosNum
⊢ Ordering.swap (Ordering.casesOn Ordering.gt Ordering.lt Ordering.lt Ordering.gt) =
    Ordering.casesOn (Ordering.swap Ordering.gt) Ordering.lt Ordering.gt Ordering.gt

Next tactic:
rfl
theorem cmp_to_nat : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℕ) < n) (m = n) ((n : ℕ) < m) : Prop)
  | 1, 1 => rfl
  | bit0 a, 1 =>
    let h : (1 : ℕ) ≤ a := to_nat_pos a
    add_le_add h h
  | bit1 a, 1 => Nat.succ_lt_succ <| to_nat_pos <| bit0 a
  | 1, bit0 b =>
    let h : (1 : ℕ) ≤ b := to_nat_pos b
    add_le_add h h
  | 1, bit1 b => Nat.succ_lt_succ <| to_nat_pos <| bit0 b
  | bit0 a, bit0 b => by
    

Proof state:
α : Type u_1
a b : PosNum
⊢ Ordering.casesOn (cmp (bit0 a) (bit0 b)) (↑(bit0 a) < ↑(bit0 b)) (bit0 a = bit0 b) (↑(bit0 b) < ↑(bit0 a))

Next tactic:
have := cmp_to_nat a b
theorem cmp_to_nat : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℕ) < n) (m = n) ((n : ℕ) < m) : Prop)
  | 1, 1 => rfl
  | bit0 a, 1 =>
    let h : (1 : ℕ) ≤ a := to_nat_pos a
    add_le_add h h
  | bit1 a, 1 => Nat.succ_lt_succ <| to_nat_pos <| bit0 a
  | 1, bit0 b =>
    let h : (1 : ℕ) ≤ b := to_nat_pos b
    add_le_add h h
  | 1, bit1 b => Nat.succ_lt_succ <| to_nat_pos <| bit0 b
  | bit0 a, bit0 b => by
    have := cmp_to_nat a b; 

Proof state:
α : Type u_1
a b : PosNum
this : Ordering.casesOn (cmp a b) (↑a < ↑b) (a = b) (↑b < ↑a)
⊢ Ordering.casesOn (cmp (bit0 a) (bit0 b)) (↑(bit0 a) < ↑(bit0 b)) (bit0 a = bit0 b) (↑(bit0 b) < ↑(bit0 a))

Next tactic:
revert this
theorem cmp_to_nat : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℕ) < n) (m = n) ((n : ℕ) < m) : Prop)
  | 1, 1 => rfl
  | bit0 a, 1 =>
    let h : (1 : ℕ) ≤ a := to_nat_pos a
    add_le_add h h
  | bit1 a, 1 => Nat.succ_lt_succ <| to_nat_pos <| bit0 a
  | 1, bit0 b =>
    let h : (1 : ℕ) ≤ b := to_nat_pos b
    add_le_add h h
  | 1, bit1 b => Nat.succ_lt_succ <| to_nat_pos <| bit0 b
  | bit0 a, bit0 b => by
    have := cmp_to_nat a b; revert this; 

Proof state:
α : Type u_1
a b : PosNum
⊢ Ordering.casesOn (cmp a b) (↑a < ↑b) (a = b) (↑b < ↑a) →
    Ordering.casesOn (cmp (bit0 a) (bit0 b)) (↑(bit0 a) < ↑(bit0 b)) (bit0 a = bit0 b) (↑(bit0 b) < ↑(bit0 a))

Next tactic:
cases cmp a b
theorem cmp_to_nat : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℕ) < n) (m = n) ((n : ℕ) < m) : Prop)
  | 1, 1 => rfl
  | bit0 a, 1 =>
    let h : (1 : ℕ) ≤ a := to_nat_pos a
    add_le_add h h
  | bit1 a, 1 => Nat.succ_lt_succ <| to_nat_pos <| bit0 a
  | 1, bit0 b =>
    let h : (1 : ℕ) ≤ b := to_nat_pos b
    add_le_add h h
  | 1, bit1 b => Nat.succ_lt_succ <| to_nat_pos <| bit0 b
  | bit0 a, bit0 b => by
    have := cmp_to_nat a b; revert this; cases cmp a b <;> 

Proof state:
case lt
α : Type u_1
a b : PosNum
⊢ Ordering.casesOn Ordering.lt (↑a < ↑b) (a = b) (↑b < ↑a) →
    Ordering.casesOn Ordering.lt (↑(bit0 a) < ↑(bit0 b)) (bit0 a = bit0 b) (↑(bit0 b) < ↑(bit0 a))

Next tactic:
dsimp
theorem cmp_to_nat : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℕ) < n) (m = n) ((n : ℕ) < m) : Prop)
  | 1, 1 => rfl
  | bit0 a, 1 =>
    let h : (1 : ℕ) ≤ a := to_nat_pos a
    add_le_add h h
  | bit1 a, 1 => Nat.succ_lt_succ <| to_nat_pos <| bit0 a
  | 1, bit0 b =>
    let h : (1 : ℕ) ≤ b := to_nat_pos b
    add_le_add h h
  | 1, bit1 b => Nat.succ_lt_succ <| to_nat_pos <| bit0 b
  | bit0 a, bit0 b => by
    have := cmp_to_nat a b; revert this; cases cmp a b <;> 

Proof state:
case eq
α : Type u_1
a b : PosNum
⊢ Ordering.casesOn Ordering.eq (↑a < ↑b) (a = b) (↑b < ↑a) →
    Ordering.casesOn Ordering.eq (↑(bit0 a) < ↑(bit0 b)) (bit0 a = bit0 b) (↑(bit0 b) < ↑(bit0 a))

Next tactic:
dsimp
theorem cmp_to_nat : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℕ) < n) (m = n) ((n : ℕ) < m) : Prop)
  | 1, 1 => rfl
  | bit0 a, 1 =>
    let h : (1 : ℕ) ≤ a := to_nat_pos a
    add_le_add h h
  | bit1 a, 1 => Nat.succ_lt_succ <| to_nat_pos <| bit0 a
  | 1, bit0 b =>
    let h : (1 : ℕ) ≤ b := to_nat_pos b
    add_le_add h h
  | 1, bit1 b => Nat.succ_lt_succ <| to_nat_pos <| bit0 b
  | bit0 a, bit0 b => by
    have := cmp_to_nat a b; revert this; cases cmp a b <;> 

Proof state:
case gt
α : Type u_1
a b : PosNum
⊢ Ordering.casesOn Ordering.gt (↑a < ↑b) (a = b) (↑b < ↑a) →
    Ordering.casesOn Ordering.gt (↑(bit0 a) < ↑(bit0 b)) (bit0 a = bit0 b) (↑(bit0 b) < ↑(bit0 a))

Next tactic:
dsimp
theorem cmp_to_nat : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℕ) < n) (m = n) ((n : ℕ) < m) : Prop)
  | 1, 1 => rfl
  | bit0 a, 1 =>
    let h : (1 : ℕ) ≤ a := to_nat_pos a
    add_le_add h h
  | bit1 a, 1 => Nat.succ_lt_succ <| to_nat_pos <| bit0 a
  | 1, bit0 b =>
    let h : (1 : ℕ) ≤ b := to_nat_pos b
    add_le_add h h
  | 1, bit1 b => Nat.succ_lt_succ <| to_nat_pos <| bit0 b
  | bit0 a, bit0 b => by
    have := cmp_to_nat a b; revert this; cases cmp a b <;> dsimp <;> 

Proof state:
case lt
α : Type u_1
a b : PosNum
⊢ ↑a < ↑b → _root_.bit0 ↑a < _root_.bit0 ↑b

Next tactic:
intro this
theorem cmp_to_nat : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℕ) < n) (m = n) ((n : ℕ) < m) : Prop)
  | 1, 1 => rfl
  | bit0 a, 1 =>
    let h : (1 : ℕ) ≤ a := to_nat_pos a
    add_le_add h h
  | bit1 a, 1 => Nat.succ_lt_succ <| to_nat_pos <| bit0 a
  | 1, bit0 b =>
    let h : (1 : ℕ) ≤ b := to_nat_pos b
    add_le_add h h
  | 1, bit1 b => Nat.succ_lt_succ <| to_nat_pos <| bit0 b
  | bit0 a, bit0 b => by
    have := cmp_to_nat a b; revert this; cases cmp a b <;> dsimp <;> 

Proof state:
case eq
α : Type u_1
a b : PosNum
⊢ a = b → bit0 a = bit0 b

Next tactic:
intro this
theorem cmp_to_nat : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℕ) < n) (m = n) ((n : ℕ) < m) : Prop)
  | 1, 1 => rfl
  | bit0 a, 1 =>
    let h : (1 : ℕ) ≤ a := to_nat_pos a
    add_le_add h h
  | bit1 a, 1 => Nat.succ_lt_succ <| to_nat_pos <| bit0 a
  | 1, bit0 b =>
    let h : (1 : ℕ) ≤ b := to_nat_pos b
    add_le_add h h
  | 1, bit1 b => Nat.succ_lt_succ <| to_nat_pos <| bit0 b
  | bit0 a, bit0 b => by
    have := cmp_to_nat a b; revert this; cases cmp a b <;> dsimp <;> 

Proof state:
case gt
α : Type u_1
a b : PosNum
⊢ ↑b < ↑a → _root_.bit0 ↑b < _root_.bit0 ↑a

Next tactic:
intro this
theorem cmp_to_nat : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℕ) < n) (m = n) ((n : ℕ) < m) : Prop)
  | 1, 1 => rfl
  | bit0 a, 1 =>
    let h : (1 : ℕ) ≤ a := to_nat_pos a
    add_le_add h h
  | bit1 a, 1 => Nat.succ_lt_succ <| to_nat_pos <| bit0 a
  | 1, bit0 b =>
    let h : (1 : ℕ) ≤ b := to_nat_pos b
    add_le_add h h
  | 1, bit1 b => Nat.succ_lt_succ <| to_nat_pos <| bit0 b
  | bit0 a, bit0 b => by
    have := cmp_to_nat a b; revert this; cases cmp a b <;> dsimp <;> intro this
    · 

Proof state:
case lt
α : Type u_1
a b : PosNum
this : ↑a < ↑b
⊢ _root_.bit0 ↑a < _root_.bit0 ↑b

Next tactic:
exact add_lt_add this this
theorem cmp_to_nat : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℕ) < n) (m = n) ((n : ℕ) < m) : Prop)
  | 1, 1 => rfl
  | bit0 a, 1 =>
    let h : (1 : ℕ) ≤ a := to_nat_pos a
    add_le_add h h
  | bit1 a, 1 => Nat.succ_lt_succ <| to_nat_pos <| bit0 a
  | 1, bit0 b =>
    let h : (1 : ℕ) ≤ b := to_nat_pos b
    add_le_add h h
  | 1, bit1 b => Nat.succ_lt_succ <| to_nat_pos <| bit0 b
  | bit0 a, bit0 b => by
    have := cmp_to_nat a b; revert this; cases cmp a b <;> dsimp <;> intro this
    · exact add_lt_add this this
    · 

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

Next tactic:
rw [this]
theorem cmp_to_nat : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℕ) < n) (m = n) ((n : ℕ) < m) : Prop)
  | 1, 1 => rfl
  | bit0 a, 1 =>
    let h : (1 : ℕ) ≤ a := to_nat_pos a
    add_le_add h h
  | bit1 a, 1 => Nat.succ_lt_succ <| to_nat_pos <| bit0 a
  | 1, bit0 b =>
    let h : (1 : ℕ) ≤ b := to_nat_pos b
    add_le_add h h
  | 1, bit1 b => Nat.succ_lt_succ <| to_nat_pos <| bit0 b
  | bit0 a, bit0 b => by
    have := cmp_to_nat a b; revert this; cases cmp a b <;> dsimp <;> intro this
    · exact add_lt_add this this
    · rw [this]
    · 

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

Next tactic:
exact add_lt_add this this