l3lab/ntp-mathlib huggingface dataset:
@[simp]
theorem cmp_eq (m n) : cmp m n = Ordering.eq ↔ m = n := by
  have := cmp_to_nat m n
  -- Porting note: `cases` didn't rewrite at `this`, so `revert` & `intro` are required.
  revert this; cases cmp m n <;> intro this <;> 

Proof state:
case gt
α : Type u_1
m n : PosNum
this : Ordering.casesOn Ordering.gt (↑m < ↑n) (m = n) (↑n < ↑m)
⊢ Ordering.gt = Ordering.eq ↔ m = n

Next tactic:
simp at this ⊢
@[simp]
theorem cmp_eq (m n) : cmp m n = Ordering.eq ↔ m = n := by
  have := cmp_to_nat m n
  -- Porting note: `cases` didn't rewrite at `this`, so `revert` & `intro` are required.
  revert this; cases cmp m n <;> intro this <;> simp at this ⊢ <;> 

Proof state:
case lt
α : Type u_1
m n : PosNum
this : ↑m < ↑n
⊢ ¬m = n

Next tactic:
try { exact this }
@[simp]
theorem cmp_eq (m n) : cmp m n = Ordering.eq ↔ m = n := by
  have := cmp_to_nat m n
  -- Porting note: `cases` didn't rewrite at `this`, so `revert` & `intro` are required.
  revert this; cases cmp m n <;> intro this <;> simp at this ⊢ <;> try 

Proof state:
case lt
α : Type u_1
m n : PosNum
this : ↑m < ↑n
⊢ ¬m = n

Next tactic:
{ exact this }
@[simp]
theorem cmp_eq (m n) : cmp m n = Ordering.eq ↔ m = n := by
  have := cmp_to_nat m n
  -- Porting note: `cases` didn't rewrite at `this`, so `revert` & `intro` are required.
  revert this; cases cmp m n <;> intro this <;> simp at this ⊢ <;> try { 

Proof state:
case lt
α : Type u_1
m n : PosNum
this : ↑m < ↑n
⊢ ¬m = n

Next tactic:
exact this
@[simp]
theorem cmp_eq (m n) : cmp m n = Ordering.eq ↔ m = n := by
  have := cmp_to_nat m n
  -- Porting note: `cases` didn't rewrite at `this`, so `revert` & `intro` are required.
  revert this; cases cmp m n <;> intro this <;> simp at this ⊢ <;> 

Proof state:
case eq
α : Type u_1
m n : PosNum
this : m = n
⊢ m = n

Next tactic:
try { exact this }
@[simp]
theorem cmp_eq (m n) : cmp m n = Ordering.eq ↔ m = n := by
  have := cmp_to_nat m n
  -- Porting note: `cases` didn't rewrite at `this`, so `revert` & `intro` are required.
  revert this; cases cmp m n <;> intro this <;> simp at this ⊢ <;> try 

Proof state:
case eq
α : Type u_1
m n : PosNum
this : m = n
⊢ m = n

Next tactic:
{ exact this }
@[simp]
theorem cmp_eq (m n) : cmp m n = Ordering.eq ↔ m = n := by
  have := cmp_to_nat m n
  -- Porting note: `cases` didn't rewrite at `this`, so `revert` & `intro` are required.
  revert this; cases cmp m n <;> intro this <;> simp at this ⊢ <;> try { 

Proof state:
case eq
α : Type u_1
m n : PosNum
this : m = n
⊢ m = n

Next tactic:
exact this
@[simp]
theorem cmp_eq (m n) : cmp m n = Ordering.eq ↔ m = n := by
  have := cmp_to_nat m n
  -- Porting note: `cases` didn't rewrite at `this`, so `revert` & `intro` are required.
  revert this; cases cmp m n <;> intro this <;> simp at this ⊢ <;> 

Proof state:
case gt
α : Type u_1
m n : PosNum
this : ↑n < ↑m
⊢ ¬m = n

Next tactic:
try { exact this }
@[simp]
theorem cmp_eq (m n) : cmp m n = Ordering.eq ↔ m = n := by
  have := cmp_to_nat m n
  -- Porting note: `cases` didn't rewrite at `this`, so `revert` & `intro` are required.
  revert this; cases cmp m n <;> intro this <;> simp at this ⊢ <;> try 

Proof state:
case gt
α : Type u_1
m n : PosNum
this : ↑n < ↑m
⊢ ¬m = n

Next tactic:
{ exact this }
@[simp]
theorem cmp_eq (m n) : cmp m n = Ordering.eq ↔ m = n := by
  have := cmp_to_nat m n
  -- Porting note: `cases` didn't rewrite at `this`, so `revert` & `intro` are required.
  revert this; cases cmp m n <;> intro this <;> simp at this ⊢ <;> try { 

Proof state:
case gt
α : Type u_1
m n : PosNum
this : ↑n < ↑m
⊢ ¬m = n

Next tactic:
exact this
@[simp]
theorem cmp_eq (m n) : cmp m n = Ordering.eq ↔ m = n := by
  have := cmp_to_nat m n
  -- Porting note: `cases` didn't rewrite at `this`, so `revert` & `intro` are required.
  revert this; cases cmp m n <;> intro this <;> simp at this ⊢ <;> try { exact this } <;>
    

Proof state:
case lt
α : Type u_1
m n : PosNum
this : ↑m < ↑n
⊢ ¬m = n

Next tactic:
simp [show m ≠ n from fun e => by rw [e] at this;exact lt_irrefl _ this]
@[simp]
theorem cmp_eq (m n) : cmp m n = Ordering.eq ↔ m = n := by
  have := cmp_to_nat m n
  -- Porting note: `cases` didn't rewrite at `this`, so `revert` & `intro` are required.
  revert this; cases cmp m n <;> intro this <;> simp at this ⊢ <;> try { exact this } <;>
    simp [show m ≠ n from fun e => by 

Proof state:
α : Type u_1
m n : PosNum
this : ↑m < ↑n
e : m = n
⊢ False

Next tactic:
rw [e] at this
@[simp]
theorem cmp_eq (m n) : cmp m n = Ordering.eq ↔ m = n := by
  have := cmp_to_nat m n
  -- Porting note: `cases` didn't rewrite at `this`, so `revert` & `intro` are required.
  revert this; cases cmp m n <;> intro this <;> simp at this ⊢ <;> try { exact this } <;>
    simp [show m ≠ n from fun e => by rw [e] at this;

Proof state:
α : Type u_1
m n : PosNum
this : ↑n < ↑n
e : m = n
⊢ False

Next tactic:
exact lt_irrefl _ this
@[simp]
theorem cmp_eq (m n) : cmp m n = Ordering.eq ↔ m = n := by
  have := cmp_to_nat m n
  -- Porting note: `cases` didn't rewrite at `this`, so `revert` & `intro` are required.
  revert this; cases cmp m n <;> intro this <;> simp at this ⊢ <;> try { exact this } <;>
    

Proof state:
case gt
α : Type u_1
m n : PosNum
this : ↑n < ↑m
⊢ ¬m = n

Next tactic:
simp [show m ≠ n from fun e => by rw [e] at this;exact lt_irrefl _ this]
@[simp]
theorem cmp_eq (m n) : cmp m n = Ordering.eq ↔ m = n := by
  have := cmp_to_nat m n
  -- Porting note: `cases` didn't rewrite at `this`, so `revert` & `intro` are required.
  revert this; cases cmp m n <;> intro this <;> simp at this ⊢ <;> try { exact this } <;>
    simp [show m ≠ n from fun e => by 

Proof state:
α : Type u_1
m n : PosNum
this : ↑n < ↑m
e : m = n
⊢ False

Next tactic:
rw [e] at this
@[simp, norm_cast]
theorem cast_lt [LinearOrderedSemiring α] {m n : PosNum} : (m : α) < n ↔ m < n := by
  

Proof state:
α : Type u_1
inst✝ : LinearOrderedSemiring α
m n : PosNum
⊢ ↑m < ↑n ↔ m < n

Next tactic:
rw [← cast_to_nat m, ← cast_to_nat n, Nat.cast_lt (α := α), lt_to_nat]
@[simp, norm_cast]
theorem cast_le [LinearOrderedSemiring α] {m n : PosNum} : (m : α) ≤ n ↔ m ≤ n := by
  

Proof state:
α : Type u_1
inst✝ : LinearOrderedSemiring α
m n : PosNum
⊢ ↑m ≤ ↑n ↔ m ≤ n

Next tactic:
rw [← not_lt]
@[simp, norm_cast]
theorem cast_le [LinearOrderedSemiring α] {m n : PosNum} : (m : α) ≤ n ↔ m ≤ n := by
  rw [← not_lt]; 

Proof state:
α : Type u_1
inst✝ : LinearOrderedSemiring α
m n : PosNum
⊢ ¬↑n < ↑m ↔ m ≤ n

Next tactic:
exact not_congr cast_lt
theorem bit_to_nat (b n) : (bit b n : ℕ) = Nat.bit b n := by 

Proof state:
α : Type u_1
b : Bool
n : Num
⊢ ↑(bit b n) = Nat.bit b ↑n

Next tactic:
cases b
theorem bit_to_nat (b n) : (bit b n : ℕ) = Nat.bit b n := by cases b <;> 

Proof state:
case false
α : Type u_1
n : Num
⊢ ↑(bit false n) = Nat.bit false ↑n

Next tactic:
cases n
theorem bit_to_nat (b n) : (bit b n : ℕ) = Nat.bit b n := by cases b <;> 

Proof state:
case true
α : Type u_1
n : Num
⊢ ↑(bit true n) = Nat.bit true ↑n

Next tactic:
cases n
theorem bit_to_nat (b n) : (bit b n : ℕ) = Nat.bit b n := by cases b <;> cases n <;> 

Proof state:
case false.zero
α : Type u_1
⊢ ↑(bit false zero) = Nat.bit false ↑zero

Next tactic:
rfl
theorem bit_to_nat (b n) : (bit b n : ℕ) = Nat.bit b n := by cases b <;> cases n <;> 

Proof state:
case false.pos
α : Type u_1
a✝ : PosNum
⊢ ↑(bit false (pos a✝)) = Nat.bit false ↑(pos a✝)

Next tactic:
rfl
theorem bit_to_nat (b n) : (bit b n : ℕ) = Nat.bit b n := by cases b <;> cases n <;> 

Proof state:
case true.zero
α : Type u_1
⊢ ↑(bit true zero) = Nat.bit true ↑zero

Next tactic:
rfl
theorem bit_to_nat (b n) : (bit b n : ℕ) = Nat.bit b n := by cases b <;> cases n <;> 

Proof state:
case true.pos
α : Type u_1
a✝ : PosNum
⊢ ↑(bit true (pos a✝)) = Nat.bit true ↑(pos a✝)

Next tactic:
rfl
theorem cast_succ' [AddMonoidWithOne α] (n) : (succ' n : α) = n + 1 := by
  

Proof state:
α : Type u_1
inst✝ : AddMonoidWithOne α
n : Num
⊢ ↑(succ' n) = ↑n + 1

Next tactic:
rw [← PosNum.cast_to_nat, succ'_to_nat, Nat.cast_add_one, cast_to_nat]
@[simp, norm_cast]
theorem cast_add [Semiring α] (m n) : ((m + n : Num) : α) = m + n := by
  

Proof state:
α : Type u_1
inst✝ : Semiring α
m n : Num
⊢ ↑(m + n) = ↑m + ↑n

Next tactic:
rw [← cast_to_nat, add_to_nat, Nat.cast_add, cast_to_nat, cast_to_nat]
@[simp, norm_cast]
theorem cast_bit0 [Semiring α] (n : Num) : (n.bit0 : α) = _root_.bit0 (n : α) := by
  

Proof state:
α : Type u_1
inst✝ : Semiring α
n : Num
⊢ ↑(Num.bit0 n) = _root_.bit0 ↑n

Next tactic:
rw [← bit0_of_bit0, _root_.bit0, cast_add]
@[simp, norm_cast]
theorem cast_bit0 [Semiring α] (n : Num) : (n.bit0 : α) = _root_.bit0 (n : α) := by
  rw [← bit0_of_bit0, _root_.bit0, cast_add]; 

Proof state:
α : Type u_1
inst✝ : Semiring α
n : Num
⊢ ↑n + ↑n = _root_.bit0 ↑n

Next tactic:
rfl
@[simp, norm_cast]
theorem cast_bit1 [Semiring α] (n : Num) : (n.bit1 : α) = _root_.bit1 (n : α) := by
  

Proof state:
α : Type u_1
inst✝ : Semiring α
n : Num
⊢ ↑(Num.bit1 n) = _root_.bit1 ↑n

Next tactic:
rw [← bit1_of_bit1, _root_.bit1, bit0_of_bit0, cast_add, cast_bit0]
@[simp, norm_cast]
theorem cast_bit1 [Semiring α] (n : Num) : (n.bit1 : α) = _root_.bit1 (n : α) := by
  rw [← bit1_of_bit1, _root_.bit1, bit0_of_bit0, cast_add, cast_bit0]; 

Proof state:
α : Type u_1
inst✝ : Semiring α
n : Num
⊢ _root_.bit0 ↑n + ↑1 = _root_.bit1 ↑n

Next tactic:
rfl
theorem natSize_to_nat (n) : natSize n = Nat.size n := by 

Proof state:
α : Type u_1
n : Num
⊢ natSize n = Nat.size ↑n

Next tactic:
rw [← size_eq_natSize, size_to_nat]
@[simp 999]
theorem ofNat'_eq : ∀ n, Num.ofNat' n = n :=
  Nat.binaryRec (by 

Proof state:
α : Type u_1
⊢ ofNat' 0 = ↑0

Next tactic:
simp
@[simp 999]
theorem ofNat'_eq : ∀ n, Num.ofNat' n = n :=
  Nat.binaryRec (by simp) fun b n IH => by
    

Proof state:
α : Type u_1
b : Bool
n : ℕ
IH : ofNat' n = ↑n
⊢ ofNat' (Nat.bit b n) = ↑(Nat.bit b n)

Next tactic:
rw [ofNat'] at IH ⊢
@[simp 999]
theorem ofNat'_eq : ∀ n, Num.ofNat' n = n :=
  Nat.binaryRec (by simp) fun b n IH => by
    rw [ofNat'] at IH ⊢
    

Proof state:
α : Type u_1
b : Bool
n : ℕ
IH : Nat.binaryRec 0 (fun b x => bif b then Num.bit1 else Num.bit0) n = ↑n
⊢ Nat.binaryRec 0 (fun b x => bif b then Num.bit1 else Num.bit0) (Nat.bit b n) = ↑(Nat.bit b n)

Next tactic:
rw [Nat.binaryRec_eq, IH]
@[simp 999]
theorem ofNat'_eq : ∀ n, Num.ofNat' n = n :=
  Nat.binaryRec (by simp) fun b n IH => by
    rw [ofNat'] at IH ⊢
    rw [Nat.binaryRec_eq, IH]
    -- Porting note: `Nat.cast_bit0` & `Nat.cast_bit1` are not `simp` theorems anymore.
    · 

Proof state:
α : Type u_1
b : Bool
n : ℕ
IH : Nat.binaryRec 0 (fun b x => bif b then Num.bit1 else Num.bit0) n = ↑n
⊢ cond b Num.bit1 Num.bit0 ↑n = ↑(Nat.bit b n)

Next tactic:
cases b
@[simp 999]
theorem ofNat'_eq : ∀ n, Num.ofNat' n = n :=
  Nat.binaryRec (by simp) fun b n IH => by
    rw [ofNat'] at IH ⊢
    rw [Nat.binaryRec_eq, IH]
    -- Porting note: `Nat.cast_bit0` & `Nat.cast_bit1` are not `simp` theorems anymore.
    · cases b <;> 

Proof state:
case false
α : Type u_1
n : ℕ
IH : Nat.binaryRec 0 (fun b x => bif b then Num.bit1 else Num.bit0) n = ↑n
⊢ cond false Num.bit1 Num.bit0 ↑n = ↑(Nat.bit false n)

Next tactic:
simp [Nat.bit, bit0_of_bit0, bit1_of_bit1, Nat.cast_bit0, Nat.cast_bit1]
@[simp 999]
theorem ofNat'_eq : ∀ n, Num.ofNat' n = n :=
  Nat.binaryRec (by simp) fun b n IH => by
    rw [ofNat'] at IH ⊢
    rw [Nat.binaryRec_eq, IH]
    -- Porting note: `Nat.cast_bit0` & `Nat.cast_bit1` are not `simp` theorems anymore.
    · cases b <;> 

Proof state:
case true
α : Type u_1
n : ℕ
IH : Nat.binaryRec 0 (fun b x => bif b then Num.bit1 else Num.bit0) n = ↑n
⊢ cond true Num.bit1 Num.bit0 ↑n = ↑(Nat.bit true n)

Next tactic:
simp [Nat.bit, bit0_of_bit0, bit1_of_bit1, Nat.cast_bit0, Nat.cast_bit1]
@[simp 999]
theorem ofNat'_eq : ∀ n, Num.ofNat' n = n :=
  Nat.binaryRec (by simp) fun b n IH => by
    rw [ofNat'] at IH ⊢
    rw [Nat.binaryRec_eq, IH]
    -- Porting note: `Nat.cast_bit0` & `Nat.cast_bit1` are not `simp` theorems anymore.
    · cases b <;> simp [Nat.bit, bit0_of_bit0, bit1_of_bit1, Nat.cast_bit0, Nat.cast_bit1]
    · 

Proof state:
case h
α : Type u_1
b : Bool
n : ℕ
IH : Nat.binaryRec 0 (fun b x => bif b then Num.bit1 else Num.bit0) n = ↑n
⊢ cond false Num.bit1 Num.bit0 0 = 0

Next tactic:
rfl
theorem zneg_toZNum (n : Num) : -n.toZNum = n.toZNumNeg := by 

Proof state:
α : Type u_1
n : Num
⊢ -toZNum n = toZNumNeg n

Next tactic:
cases n
theorem zneg_toZNum (n : Num) : -n.toZNum = n.toZNumNeg := by cases n <;> 

Proof state:
case zero
α : Type u_1
⊢ -toZNum zero = toZNumNeg zero

Next tactic:
rfl
theorem zneg_toZNum (n : Num) : -n.toZNum = n.toZNumNeg := by cases n <;> 

Proof state:
case pos
α : Type u_1
a✝ : PosNum
⊢ -toZNum (pos a✝) = toZNumNeg (pos a✝)

Next tactic:
rfl
theorem zneg_toZNumNeg (n : Num) : -n.toZNumNeg = n.toZNum := by 

Proof state:
α : Type u_1
n : Num
⊢ -toZNumNeg n = toZNum n

Next tactic:
cases n
theorem zneg_toZNumNeg (n : Num) : -n.toZNumNeg = n.toZNum := by cases n <;> 

Proof state:
case zero
α : Type u_1
⊢ -toZNumNeg zero = toZNum zero

Next tactic:
rfl
theorem zneg_toZNumNeg (n : Num) : -n.toZNumNeg = n.toZNum := by cases n <;> 

Proof state:
case pos
α : Type u_1
a✝ : PosNum
⊢ -toZNumNeg (pos a✝) = toZNum (pos a✝)

Next tactic:
rfl
theorem toZNum_inj {m n : Num} : m.toZNum = n.toZNum ↔ m = n :=
  ⟨fun h => by 

Proof state:
α : Type u_1
m n : Num
h : toZNum m = toZNum n
⊢ m = n

Next tactic:
cases m
theorem toZNum_inj {m n : Num} : m.toZNum = n.toZNum ↔ m = n :=
  ⟨fun h => by cases m <;> 

Proof state:
case zero
α : Type u_1
n : Num
h : toZNum zero = toZNum n
⊢ zero = n

Next tactic:
cases n
theorem toZNum_inj {m n : Num} : m.toZNum = n.toZNum ↔ m = n :=
  ⟨fun h => by cases m <;> 

Proof state:
case pos
α : Type u_1
n : Num
a✝ : PosNum
h : toZNum (pos a✝) = toZNum n
⊢ pos a✝ = n

Next tactic:
cases n
theorem toZNum_inj {m n : Num} : m.toZNum = n.toZNum ↔ m = n :=
  ⟨fun h => by cases m <;> cases n <;> 

Proof state:
case zero.zero
α : Type u_1
h : toZNum zero = toZNum zero
⊢ zero = zero

Next tactic:
cases h
theorem toZNum_inj {m n : Num} : m.toZNum = n.toZNum ↔ m = n :=
  ⟨fun h => by cases m <;> cases n <;> 

Proof state:
case zero.pos
α : Type u_1
a✝ : PosNum
h : toZNum zero = toZNum (pos a✝)
⊢ zero = pos a✝

Next tactic:
cases h
theorem toZNum_inj {m n : Num} : m.toZNum = n.toZNum ↔ m = n :=
  ⟨fun h => by cases m <;> cases n <;> 

Proof state:
case pos.zero
α : Type u_1
a✝ : PosNum
h : toZNum (pos a✝) = toZNum zero
⊢ pos a✝ = zero

Next tactic:
cases h
theorem toZNum_inj {m n : Num} : m.toZNum = n.toZNum ↔ m = n :=
  ⟨fun h => by cases m <;> cases n <;> 

Proof state:
case pos.pos
α : Type u_1
a✝¹ a✝ : PosNum
h : toZNum (pos a✝¹) = toZNum (pos a✝)
⊢ pos a✝¹ = pos a✝

Next tactic:
cases h
theorem toZNum_inj {m n : Num} : m.toZNum = n.toZNum ↔ m = n :=
  ⟨fun h => by cases m <;> cases n <;> cases h <;> 

Proof state:
case zero.zero.refl
α : Type u_1
⊢ zero = zero

Next tactic:
rfl
theorem toZNum_inj {m n : Num} : m.toZNum = n.toZNum ↔ m = n :=
  ⟨fun h => by cases m <;> cases n <;> cases h <;> 

Proof state:
case pos.pos.refl
α : Type u_1
a✝ : PosNum
⊢ pos a✝ = pos a✝

Next tactic:
rfl
@[simp]
theorem add_toZNum (m n : Num) : Num.toZNum (m + n) = m.toZNum + n.toZNum := by
  

Proof state:
α : Type u_1
m n : Num
⊢ toZNum (m + n) = toZNum m + toZNum n

Next tactic:
cases m
@[simp]
theorem add_toZNum (m n : Num) : Num.toZNum (m + n) = m.toZNum + n.toZNum := by
  cases m <;> 

Proof state:
case zero
α : Type u_1
n : Num
⊢ toZNum (zero + n) = toZNum zero + toZNum n

Next tactic:
cases n
@[simp]
theorem add_toZNum (m n : Num) : Num.toZNum (m + n) = m.toZNum + n.toZNum := by
  cases m <;> 

Proof state:
case pos
α : Type u_1
n : Num
a✝ : PosNum
⊢ toZNum (pos a✝ + n) = toZNum (pos a✝) + toZNum n

Next tactic:
cases n
@[simp]
theorem add_toZNum (m n : Num) : Num.toZNum (m + n) = m.toZNum + n.toZNum := by
  cases m <;> cases n <;> 

Proof state:
case zero.zero
α : Type u_1
⊢ toZNum (zero + zero) = toZNum zero + toZNum zero

Next tactic:
rfl
@[simp]
theorem add_toZNum (m n : Num) : Num.toZNum (m + n) = m.toZNum + n.toZNum := by
  cases m <;> cases n <;> 

Proof state:
case zero.pos
α : Type u_1
a✝ : PosNum
⊢ toZNum (zero + pos a✝) = toZNum zero + toZNum (pos a✝)

Next tactic:
rfl
@[simp]
theorem add_toZNum (m n : Num) : Num.toZNum (m + n) = m.toZNum + n.toZNum := by
  cases m <;> cases n <;> 

Proof state:
case pos.zero
α : Type u_1
a✝ : PosNum
⊢ toZNum (pos a✝ + zero) = toZNum (pos a✝) + toZNum zero

Next tactic:
rfl
@[simp]
theorem add_toZNum (m n : Num) : Num.toZNum (m + n) = m.toZNum + n.toZNum := by
  cases m <;> cases n <;> 

Proof state:
case pos.pos
α : Type u_1
a✝¹ a✝ : PosNum
⊢ toZNum (pos a✝¹ + pos a✝) = toZNum (pos a✝¹) + toZNum (pos a✝)

Next tactic:
rfl
theorem pred_to_nat {n : PosNum} (h : 1 < n) : (pred n : ℕ) = Nat.pred n := by
  

Proof state:
n : PosNum
h : 1 < n
⊢ ↑(pred n) = Nat.pred ↑n

Next tactic:
unfold pred
theorem pred_to_nat {n : PosNum} (h : 1 < n) : (pred n : ℕ) = Nat.pred n := by
  unfold pred
  

Proof state:
n : PosNum
h : 1 < n
⊢ ↑(Num.casesOn (pred' n) 1 id) = Nat.pred ↑n

Next tactic:
cases e : pred' n
theorem pred_to_nat {n : PosNum} (h : 1 < n) : (pred n : ℕ) = Nat.pred n := by
  unfold pred
  cases e : pred' n
  · 

Proof state:
case zero
n : PosNum
h : 1 < n
e : pred' n = zero
⊢ ↑(Num.casesOn zero 1 id) = Nat.pred ↑n

Next tactic:
have : (1 : ℕ) ≤ Nat.pred n := Nat.pred_le_pred ((@cast_lt ℕ _ _ _).2 h)
theorem pred_to_nat {n : PosNum} (h : 1 < n) : (pred n : ℕ) = Nat.pred n := by
  unfold pred
  cases e : pred' n
  · have : (1 : ℕ) ≤ Nat.pred n := Nat.pred_le_pred ((@cast_lt ℕ _ _ _).2 h)
    

Proof state:
case zero
n : PosNum
h : 1 < n
e : pred' n = zero
this : 1 ≤ Nat.pred ↑n
⊢ ↑(Num.casesOn zero 1 id) = Nat.pred ↑n

Next tactic:
rw [← pred'_to_nat, e] at this
theorem pred_to_nat {n : PosNum} (h : 1 < n) : (pred n : ℕ) = Nat.pred n := by
  unfold pred
  cases e : pred' n
  · have : (1 : ℕ) ≤ Nat.pred n := Nat.pred_le_pred ((@cast_lt ℕ _ _ _).2 h)
    rw [← pred'_to_nat, e] at this
    

Proof state:
case zero
n : PosNum
h : 1 < n
e : pred' n = zero
this : 1 ≤ ↑zero
⊢ ↑(Num.casesOn zero 1 id) = Nat.pred ↑n

Next tactic:
exact absurd this (by decide)
theorem pred_to_nat {n : PosNum} (h : 1 < n) : (pred n : ℕ) = Nat.pred n := by
  unfold pred
  cases e : pred' n
  · have : (1 : ℕ) ≤ Nat.pred n := Nat.pred_le_pred ((@cast_lt ℕ _ _ _).2 h)
    rw [← pred'_to_nat, e] at this
    exact absurd this (by 

Proof state:
n : PosNum
h : 1 < n
e : pred' n = zero
this : 1 ≤ ↑zero
⊢ ¬1 ≤ ↑zero

Next tactic:
decide
theorem pred_to_nat {n : PosNum} (h : 1 < n) : (pred n : ℕ) = Nat.pred n := by
  unfold pred
  cases e : pred' n
  · have : (1 : ℕ) ≤ Nat.pred n := Nat.pred_le_pred ((@cast_lt ℕ _ _ _).2 h)
    rw [← pred'_to_nat, e] at this
    exact absurd this (by decide)
  · 

Proof state:
case pos
n : PosNum
h : 1 < n
a✝ : PosNum
e : pred' n = pos a✝
⊢ ↑(Num.casesOn (pos a✝) 1 id) = Nat.pred ↑n

Next tactic:
rw [← pred'_to_nat, e]
theorem pred_to_nat {n : PosNum} (h : 1 < n) : (pred n : ℕ) = Nat.pred n := by
  unfold pred
  cases e : pred' n
  · have : (1 : ℕ) ≤ Nat.pred n := Nat.pred_le_pred ((@cast_lt ℕ _ _ _).2 h)
    rw [← pred'_to_nat, e] at this
    exact absurd this (by decide)
  · rw [← pred'_to_nat, e]
    

Proof state:
case pos
n : PosNum
h : 1 < n
a✝ : PosNum
e : pred' n = pos a✝
⊢ ↑(Num.casesOn (pos a✝) 1 id) = ↑(pos a✝)

Next tactic:
rfl
theorem sub'_one (a : PosNum) : sub' a 1 = (pred' a).toZNum := by 

Proof state:
a : PosNum
⊢ sub' a 1 = toZNum (pred' a)

Next tactic:
cases a
theorem sub'_one (a : PosNum) : sub' a 1 = (pred' a).toZNum := by cases a <;> 

Proof state:
case one
⊢ sub' one 1 = toZNum (pred' one)

Next tactic:
rfl
theorem sub'_one (a : PosNum) : sub' a 1 = (pred' a).toZNum := by cases a <;> 

Proof state:
case bit1
a✝ : PosNum
⊢ sub' (bit1 a✝) 1 = toZNum (pred' (bit1 a✝))

Next tactic:
rfl
theorem sub'_one (a : PosNum) : sub' a 1 = (pred' a).toZNum := by cases a <;> 

Proof state:
case bit0
a✝ : PosNum
⊢ sub' (bit0 a✝) 1 = toZNum (pred' (bit0 a✝))

Next tactic:
rfl
theorem one_sub' (a : PosNum) : sub' 1 a = (pred' a).toZNumNeg := by 

Proof state:
a : PosNum
⊢ sub' 1 a = toZNumNeg (pred' a)

Next tactic:
cases a
theorem one_sub' (a : PosNum) : sub' 1 a = (pred' a).toZNumNeg := by cases a <;> 

Proof state:
case one
⊢ sub' 1 one = toZNumNeg (pred' one)

Next tactic:
rfl
theorem one_sub' (a : PosNum) : sub' 1 a = (pred' a).toZNumNeg := by cases a <;> 

Proof state:
case bit1
a✝ : PosNum
⊢ sub' 1 (bit1 a✝) = toZNumNeg (pred' (bit1 a✝))

Next tactic:
rfl
theorem one_sub' (a : PosNum) : sub' 1 a = (pred' a).toZNumNeg := by cases a <;> 

Proof state:
case bit0
a✝ : PosNum
⊢ sub' 1 (bit0 a✝) = toZNumNeg (pred' (bit0 a✝))

Next tactic:
rfl
theorem le_iff_cmp {m n} : m ≤ n ↔ cmp m n ≠ Ordering.gt :=
  not_congr <| lt_iff_cmp.trans <| by 

Proof state:
m n : PosNum
⊢ cmp n m = Ordering.lt ↔ cmp m n = Ordering.gt

Next tactic:
rw [← cmp_swap]
theorem le_iff_cmp {m n} : m ≤ n ↔ cmp m n ≠ Ordering.gt :=
  not_congr <| lt_iff_cmp.trans <| by rw [← cmp_swap]; 

Proof state:
m n : PosNum
⊢ Ordering.swap (cmp m n) = Ordering.lt ↔ cmp m n = Ordering.gt

Next tactic:
cases cmp m n
theorem le_iff_cmp {m n} : m ≤ n ↔ cmp m n ≠ Ordering.gt :=
  not_congr <| lt_iff_cmp.trans <| by rw [← cmp_swap]; cases cmp m n <;> 

Proof state:
case lt
m n : PosNum
⊢ Ordering.swap Ordering.lt = Ordering.lt ↔ Ordering.lt = Ordering.gt

Next tactic:
exact by decide
theorem le_iff_cmp {m n} : m ≤ n ↔ cmp m n ≠ Ordering.gt :=
  not_congr <| lt_iff_cmp.trans <| by rw [← cmp_swap]; cases cmp m n <;> exact by 

Proof state:
m n : PosNum
⊢ Ordering.swap Ordering.lt = Ordering.lt ↔ Ordering.lt = Ordering.gt

Next tactic:
decide
theorem le_iff_cmp {m n} : m ≤ n ↔ cmp m n ≠ Ordering.gt :=
  not_congr <| lt_iff_cmp.trans <| by rw [← cmp_swap]; cases cmp m n <;> 

Proof state:
case eq
m n : PosNum
⊢ Ordering.swap Ordering.eq = Ordering.lt ↔ Ordering.eq = Ordering.gt

Next tactic:
exact by decide
theorem le_iff_cmp {m n} : m ≤ n ↔ cmp m n ≠ Ordering.gt :=
  not_congr <| lt_iff_cmp.trans <| by rw [← cmp_swap]; cases cmp m n <;> exact by 

Proof state:
m n : PosNum
⊢ Ordering.swap Ordering.eq = Ordering.lt ↔ Ordering.eq = Ordering.gt

Next tactic:
decide
theorem le_iff_cmp {m n} : m ≤ n ↔ cmp m n ≠ Ordering.gt :=
  not_congr <| lt_iff_cmp.trans <| by rw [← cmp_swap]; cases cmp m n <;> 

Proof state:
case gt
m n : PosNum
⊢ Ordering.swap Ordering.gt = Ordering.lt ↔ Ordering.gt = Ordering.gt

Next tactic:
exact by decide
theorem le_iff_cmp {m n} : m ≤ n ↔ cmp m n ≠ Ordering.gt :=
  not_congr <| lt_iff_cmp.trans <| by rw [← cmp_swap]; cases cmp m n <;> exact by 

Proof state:
m n : PosNum
⊢ Ordering.swap Ordering.gt = Ordering.lt ↔ Ordering.gt = Ordering.gt

Next tactic:
decide
theorem pred_to_nat : ∀ n : Num, (pred n : ℕ) = Nat.pred n
  | 0 => rfl
  | pos p => by 

Proof state:
α : Type u_1
p : PosNum
⊢ ↑(pred (pos p)) = Nat.pred ↑(pos p)

Next tactic:
rw [pred, PosNum.pred'_to_nat]
theorem pred_to_nat : ∀ n : Num, (pred n : ℕ) = Nat.pred n
  | 0 => rfl
  | pos p => by rw [pred, PosNum.pred'_to_nat]; 

Proof state:
α : Type u_1
p : PosNum
⊢ Nat.pred ↑p = Nat.pred ↑(pos p)

Next tactic:
rfl
theorem ppred_to_nat : ∀ n : Num, (↑) <$> ppred n = Nat.ppred n
  | 0 => rfl
  | pos p => by
    

Proof state:
α : Type u_1
p : PosNum
⊢ castNum <$> ppred (pos p) = Nat.ppred ↑(pos p)

Next tactic:
rw [ppred, Option.map_some, Nat.ppred_eq_some.2]
theorem ppred_to_nat : ∀ n : Num, (↑) <$> ppred n = Nat.ppred n
  | 0 => rfl
  | pos p => by
    rw [ppred, Option.map_some, Nat.ppred_eq_some.2]
    

Proof state:
α : Type u_1
p : PosNum
⊢ Nat.succ ↑(pred' p) = ↑(pos p)

Next tactic:
rw [PosNum.pred'_to_nat, Nat.succ_pred_eq_of_pos (PosNum.to_nat_pos _)]
theorem ppred_to_nat : ∀ n : Num, (↑) <$> ppred n = Nat.ppred n
  | 0 => rfl
  | pos p => by
    rw [ppred, Option.map_some, Nat.ppred_eq_some.2]
    rw [PosNum.pred'_to_nat, Nat.succ_pred_eq_of_pos (PosNum.to_nat_pos _)]
    

Proof state:
α : Type u_1
p : PosNum
⊢ ↑p = ↑(pos p)

Next tactic:
rfl
theorem cmp_swap (m n) : (cmp m n).swap = cmp n m := by
  

Proof state:
α : Type u_1
m n : Num
⊢ Ordering.swap (cmp m n) = cmp n m

Next tactic:
cases m
theorem cmp_swap (m n) : (cmp m n).swap = cmp n m := by
  cases m <;> 

Proof state:
case zero
α : Type u_1
n : Num
⊢ Ordering.swap (cmp zero n) = cmp n zero

Next tactic:
cases n