l3lab/ntp-mathlib huggingface dataset:
theorem of_to_int' : ∀ n : ZNum, ZNum.ofInt' n = n
  | 0 => by dsimp [ofInt', cast_zero]; erw [Num.ofNat'_zero, Num.toZNum]
  | pos a => by rw [cast_pos, ← PosNum.cast_to_nat, ← Num.ofInt'_toZNum, PosNum.of_to_nat]; rfl
  | neg a => by
    

Proof state:
α : Type u_1
a : PosNum
⊢ ofInt' ↑(neg a) = neg a

Next tactic:
rw [cast_neg, ofInt'_neg, ← PosNum.cast_to_nat, ← Num.ofInt'_toZNum, PosNum.of_to_nat]
theorem of_to_int' : ∀ n : ZNum, ZNum.ofInt' n = n
  | 0 => by dsimp [ofInt', cast_zero]; erw [Num.ofNat'_zero, Num.toZNum]
  | pos a => by rw [cast_pos, ← PosNum.cast_to_nat, ← Num.ofInt'_toZNum, PosNum.of_to_nat]; rfl
  | neg a => by
    rw [cast_neg, ofInt'_neg, ← PosNum.cast_to_nat, ← Num.ofInt'_toZNum, PosNum.of_to_nat]; 

Proof state:
α : Type u_1
a : PosNum
⊢ -Num.toZNum (Num.pos a) = neg a

Next tactic:
rfl
theorem cmp_to_int : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℤ) < n) (m = n) ((n : ℤ) < m) : Prop)
  | 0, 0 => rfl
  | pos a, pos b => by
    

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

Next tactic:
have := PosNum.cmp_to_nat a b
theorem cmp_to_int : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℤ) < n) (m = n) ((n : ℤ) < m) : Prop)
  | 0, 0 => rfl
  | pos a, pos b => by
    have := PosNum.cmp_to_nat a b; 

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

Next tactic:
revert this
theorem cmp_to_int : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℤ) < n) (m = n) ((n : ℤ) < m) : Prop)
  | 0, 0 => rfl
  | pos a, pos b => by
    have := PosNum.cmp_to_nat a b; revert this; 

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

Next tactic:
dsimp [cmp]
theorem cmp_to_int : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℤ) < n) (m = n) ((n : ℤ) < m) : Prop)
  | 0, 0 => rfl
  | pos a, pos b => by
    have := PosNum.cmp_to_nat a b; revert this; dsimp [cmp]
    

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

Next tactic:
cases PosNum.cmp a b <;> dsimp <;> [simp; exact congr_arg pos; simp [GT.gt]]
theorem cmp_to_int : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℤ) < n) (m = n) ((n : ℤ) < m) : Prop)
  | 0, 0 => rfl
  | pos a, pos b => by
    have := PosNum.cmp_to_nat a b; revert this; dsimp [cmp]
    

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

Next tactic:
cases PosNum.cmp a b
theorem cmp_to_int : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℤ) < n) (m = n) ((n : ℤ) < m) : Prop)
  | 0, 0 => rfl
  | pos a, pos b => by
    have := PosNum.cmp_to_nat a b; revert this; dsimp [cmp]
    cases PosNum.cmp a b <;> 

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

Next tactic:
dsimp
theorem cmp_to_int : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℤ) < n) (m = n) ((n : ℤ) < m) : Prop)
  | 0, 0 => rfl
  | pos a, pos b => by
    have := PosNum.cmp_to_nat a b; revert this; dsimp [cmp]
    cases PosNum.cmp a b <;> 

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

Next tactic:
dsimp
theorem cmp_to_int : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℤ) < n) (m = n) ((n : ℤ) < m) : Prop)
  | 0, 0 => rfl
  | pos a, pos b => by
    have := PosNum.cmp_to_nat a b; revert this; dsimp [cmp]
    cases PosNum.cmp a b <;> 

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

Next tactic:
dsimp
theorem cmp_to_int : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℤ) < n) (m = n) ((n : ℤ) < m) : Prop)
  | 0, 0 => rfl
  | pos a, pos b => by
    have := PosNum.cmp_to_nat a b; revert this; dsimp [cmp]
    cases PosNum.cmp a b <;> dsimp <;> [

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

Next tactic:
simp
theorem cmp_to_int : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℤ) < n) (m = n) ((n : ℤ) < m) : Prop)
  | 0, 0 => rfl
  | pos a, pos b => by
    have := PosNum.cmp_to_nat a b; revert this; dsimp [cmp]
    cases PosNum.cmp a b <;> dsimp <;> [simp; 

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

Next tactic:
exact congr_arg pos
theorem cmp_to_int : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℤ) < n) (m = n) ((n : ℤ) < m) : Prop)
  | 0, 0 => rfl
  | pos a, pos b => by
    have := PosNum.cmp_to_nat a b; revert this; dsimp [cmp]
    cases PosNum.cmp a b <;> dsimp <;> [simp; exact congr_arg pos; 

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

Next tactic:
simp [GT.gt]
theorem cmp_to_int : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℤ) < n) (m = n) ((n : ℤ) < m) : Prop)
  | 0, 0 => rfl
  | pos a, pos b => by
    have := PosNum.cmp_to_nat a b; revert this; dsimp [cmp]
    cases PosNum.cmp a b <;> dsimp <;> [simp; exact congr_arg pos; simp [GT.gt]]
  | neg a, neg b => by
    

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

Next tactic:
have := PosNum.cmp_to_nat b a
theorem cmp_to_int : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℤ) < n) (m = n) ((n : ℤ) < m) : Prop)
  | 0, 0 => rfl
  | pos a, pos b => by
    have := PosNum.cmp_to_nat a b; revert this; dsimp [cmp]
    cases PosNum.cmp a b <;> dsimp <;> [simp; exact congr_arg pos; simp [GT.gt]]
  | neg a, neg b => by
    have := PosNum.cmp_to_nat b a; 

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

Next tactic:
revert this
theorem cmp_to_int : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℤ) < n) (m = n) ((n : ℤ) < m) : Prop)
  | 0, 0 => rfl
  | pos a, pos b => by
    have := PosNum.cmp_to_nat a b; revert this; dsimp [cmp]
    cases PosNum.cmp a b <;> dsimp <;> [simp; exact congr_arg pos; simp [GT.gt]]
  | neg a, neg b => by
    have := PosNum.cmp_to_nat b a; revert this; 

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

Next tactic:
dsimp [cmp]
theorem cmp_to_int : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℤ) < n) (m = n) ((n : ℤ) < m) : Prop)
  | 0, 0 => rfl
  | pos a, pos b => by
    have := PosNum.cmp_to_nat a b; revert this; dsimp [cmp]
    cases PosNum.cmp a b <;> dsimp <;> [simp; exact congr_arg pos; simp [GT.gt]]
  | neg a, neg b => by
    have := PosNum.cmp_to_nat b a; revert this; dsimp [cmp]
    

Proof state:
α : Type u_1
a b : PosNum
⊢ Ordering.rec (↑b < ↑a) (b = a) (↑a < ↑b) (PosNum.cmp b a) →
    Ordering.rec (-↑a < -↑b) (neg a = neg b) (-↑b < -↑a) (PosNum.cmp b a)

Next tactic:
cases PosNum.cmp b a <;> dsimp <;> [simp; simp (config := { contextual := true }); simp [GT.gt]]
theorem cmp_to_int : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℤ) < n) (m = n) ((n : ℤ) < m) : Prop)
  | 0, 0 => rfl
  | pos a, pos b => by
    have := PosNum.cmp_to_nat a b; revert this; dsimp [cmp]
    cases PosNum.cmp a b <;> dsimp <;> [simp; exact congr_arg pos; simp [GT.gt]]
  | neg a, neg b => by
    have := PosNum.cmp_to_nat b a; revert this; dsimp [cmp]
    

Proof state:
α : Type u_1
a b : PosNum
⊢ Ordering.rec (↑b < ↑a) (b = a) (↑a < ↑b) (PosNum.cmp b a) →
    Ordering.rec (-↑a < -↑b) (neg a = neg b) (-↑b < -↑a) (PosNum.cmp b a)

Next tactic:
cases PosNum.cmp b a
theorem cmp_to_int : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℤ) < n) (m = n) ((n : ℤ) < m) : Prop)
  | 0, 0 => rfl
  | pos a, pos b => by
    have := PosNum.cmp_to_nat a b; revert this; dsimp [cmp]
    cases PosNum.cmp a b <;> dsimp <;> [simp; exact congr_arg pos; simp [GT.gt]]
  | neg a, neg b => by
    have := PosNum.cmp_to_nat b a; revert this; dsimp [cmp]
    cases PosNum.cmp b a <;> 

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

Next tactic:
dsimp
theorem cmp_to_int : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℤ) < n) (m = n) ((n : ℤ) < m) : Prop)
  | 0, 0 => rfl
  | pos a, pos b => by
    have := PosNum.cmp_to_nat a b; revert this; dsimp [cmp]
    cases PosNum.cmp a b <;> dsimp <;> [simp; exact congr_arg pos; simp [GT.gt]]
  | neg a, neg b => by
    have := PosNum.cmp_to_nat b a; revert this; dsimp [cmp]
    cases PosNum.cmp b a <;> 

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

Next tactic:
dsimp
theorem cmp_to_int : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℤ) < n) (m = n) ((n : ℤ) < m) : Prop)
  | 0, 0 => rfl
  | pos a, pos b => by
    have := PosNum.cmp_to_nat a b; revert this; dsimp [cmp]
    cases PosNum.cmp a b <;> dsimp <;> [simp; exact congr_arg pos; simp [GT.gt]]
  | neg a, neg b => by
    have := PosNum.cmp_to_nat b a; revert this; dsimp [cmp]
    cases PosNum.cmp b a <;> 

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

Next tactic:
dsimp
theorem cmp_to_int : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℤ) < n) (m = n) ((n : ℤ) < m) : Prop)
  | 0, 0 => rfl
  | pos a, pos b => by
    have := PosNum.cmp_to_nat a b; revert this; dsimp [cmp]
    cases PosNum.cmp a b <;> dsimp <;> [simp; exact congr_arg pos; simp [GT.gt]]
  | neg a, neg b => by
    have := PosNum.cmp_to_nat b a; revert this; dsimp [cmp]
    cases PosNum.cmp b a <;> dsimp <;> [

Proof state:
case lt
α : Type u_1
a b : PosNum
⊢ ↑b < ↑a → -↑a < -↑b

Next tactic:
simp
theorem cmp_to_int : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℤ) < n) (m = n) ((n : ℤ) < m) : Prop)
  | 0, 0 => rfl
  | pos a, pos b => by
    have := PosNum.cmp_to_nat a b; revert this; dsimp [cmp]
    cases PosNum.cmp a b <;> dsimp <;> [simp; exact congr_arg pos; simp [GT.gt]]
  | neg a, neg b => by
    have := PosNum.cmp_to_nat b a; revert this; dsimp [cmp]
    cases PosNum.cmp b a <;> dsimp <;> [simp; 

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

Next tactic:
simp (config := { contextual := true })
theorem cmp_to_int : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℤ) < n) (m = n) ((n : ℤ) < m) : Prop)
  | 0, 0 => rfl
  | pos a, pos b => by
    have := PosNum.cmp_to_nat a b; revert this; dsimp [cmp]
    cases PosNum.cmp a b <;> dsimp <;> [simp; exact congr_arg pos; simp [GT.gt]]
  | neg a, neg b => by
    have := PosNum.cmp_to_nat b a; revert this; dsimp [cmp]
    cases PosNum.cmp b a <;> dsimp <;> [simp; simp (config := { contextual := true }); 

Proof state:
case gt
α : Type u_1
a b : PosNum
⊢ ↑a < ↑b → -↑b < -↑a

Next tactic:
simp [GT.gt]
@[norm_cast]
theorem lt_to_int {m n : ZNum} : (m : ℤ) < n ↔ m < n :=
  show (m : ℤ) < n ↔ cmp m n = Ordering.lt from
    match cmp m n, cmp_to_int m n with
    | Ordering.lt, h => by 

Proof state:
α : Type u_1
m n : ZNum
h : Ordering.casesOn Ordering.lt (↑m < ↑n) (m = n) (↑n < ↑m)
⊢ ↑m < ↑n ↔ Ordering.lt = Ordering.lt

Next tactic:
simp at h
@[norm_cast]
theorem lt_to_int {m n : ZNum} : (m : ℤ) < n ↔ m < n :=
  show (m : ℤ) < n ↔ cmp m n = Ordering.lt from
    match cmp m n, cmp_to_int m n with
    | Ordering.lt, h => by simp at h; 

Proof state:
α : Type u_1
m n : ZNum
h : ↑m < ↑n
⊢ ↑m < ↑n ↔ Ordering.lt = Ordering.lt

Next tactic:
simp [h]
@[norm_cast]
theorem lt_to_int {m n : ZNum} : (m : ℤ) < n ↔ m < n :=
  show (m : ℤ) < n ↔ cmp m n = Ordering.lt from
    match cmp m n, cmp_to_int m n with
    | Ordering.lt, h => by simp at h; simp [h]
    | Ordering.eq, h => by 

Proof state:
α : Type u_1
m n : ZNum
h : Ordering.casesOn Ordering.eq (↑m < ↑n) (m = n) (↑n < ↑m)
⊢ ↑m < ↑n ↔ Ordering.eq = Ordering.lt

Next tactic:
simp at h
@[norm_cast]
theorem lt_to_int {m n : ZNum} : (m : ℤ) < n ↔ m < n :=
  show (m : ℤ) < n ↔ cmp m n = Ordering.lt from
    match cmp m n, cmp_to_int m n with
    | Ordering.lt, h => by simp at h; simp [h]
    | Ordering.eq, h => by simp at h; 

Proof state:
α : Type u_1
m n : ZNum
h : m = n
⊢ ↑m < ↑n ↔ Ordering.eq = Ordering.lt

Next tactic:
simp [h, lt_irrefl]
@[norm_cast]
theorem lt_to_int {m n : ZNum} : (m : ℤ) < n ↔ m < n :=
  show (m : ℤ) < n ↔ cmp m n = Ordering.lt from
    match cmp m n, cmp_to_int m n with
    | Ordering.lt, h => by simp at h; simp [h]
    | Ordering.eq, h => by simp at h; simp [h, lt_irrefl]
    | Ordering.gt, h => by 

Proof state:
α : Type u_1
m n : ZNum
h : Ordering.casesOn Ordering.gt (↑m < ↑n) (m = n) (↑n < ↑m)
⊢ ↑m < ↑n ↔ Ordering.gt = Ordering.lt

Next tactic:
simp [not_lt_of_gt h]
theorem le_to_int {m n : ZNum} : (m : ℤ) ≤ n ↔ m ≤ n := by
  

Proof state:
α : Type u_1
m n : ZNum
⊢ ↑m ≤ ↑n ↔ m ≤ n

Next tactic:
rw [← not_lt]
theorem le_to_int {m n : ZNum} : (m : ℤ) ≤ n ↔ m ≤ n := by
  rw [← not_lt]; 

Proof state:
α : Type u_1
m n : ZNum
⊢ ¬↑n < ↑m ↔ m ≤ n

Next tactic:
exact not_congr lt_to_int
@[simp, norm_cast]
theorem cast_lt [LinearOrderedRing α] {m n : ZNum} : (m : α) < n ↔ m < n := by
  

Proof state:
α : Type u_1
inst✝ : LinearOrderedRing α
m n : ZNum
⊢ ↑m < ↑n ↔ m < n

Next tactic:
rw [← cast_to_int m, ← cast_to_int n, Int.cast_lt, lt_to_int]
@[simp, norm_cast]
theorem cast_le [LinearOrderedRing α] {m n : ZNum} : (m : α) ≤ n ↔ m ≤ n := by
  

Proof state:
α : Type u_1
inst✝ : LinearOrderedRing α
m n : ZNum
⊢ ↑m ≤ ↑n ↔ m ≤ n

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

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

Next tactic:
exact not_congr cast_lt
@[simp, norm_cast]
theorem cast_inj [LinearOrderedRing α] {m n : ZNum} : (m : α) = n ↔ m = n := by
  

Proof state:
α : Type u_1
inst✝ : LinearOrderedRing α
m n : ZNum
⊢ ↑m = ↑n ↔ m = n

Next tactic:
rw [← cast_to_int m, ← cast_to_int n, Int.cast_inj (α := α), to_int_inj]
instance linearOrder : LinearOrder ZNum where
  lt := (· < ·)
  lt_iff_le_not_le := by
    intro a b
    transfer_rw
    apply lt_iff_le_not_le
  le := (· ≤ ·)
  le_refl := by 

Proof state:
α : Type u_1
⊢ ∀ (a : ZNum), a ≤ a

Next tactic:
transfer
instance linearOrder : LinearOrder ZNum where
  lt := (· < ·)
  lt_iff_le_not_le := by
    intro a b
    transfer_rw
    apply lt_iff_le_not_le
  le := (· ≤ ·)
  le_refl := by transfer
  le_trans := by
    

Proof state:
α : Type u_1
⊢ ∀ (a b c : ZNum), a ≤ b → b ≤ c → a ≤ c

Next tactic:
intro a b c
instance linearOrder : LinearOrder ZNum where
  lt := (· < ·)
  lt_iff_le_not_le := by
    intro a b
    transfer_rw
    apply lt_iff_le_not_le
  le := (· ≤ ·)
  le_refl := by transfer
  le_trans := by
    intro a b c
    

Proof state:
α : Type u_1
a b c : ZNum
⊢ a ≤ b → b ≤ c → a ≤ c

Next tactic:
transfer_rw
instance linearOrder : LinearOrder ZNum where
  lt := (· < ·)
  lt_iff_le_not_le := by
    intro a b
    transfer_rw
    apply lt_iff_le_not_le
  le := (· ≤ ·)
  le_refl := by transfer
  le_trans := by
    intro a b c
    transfer_rw
    

Proof state:
α : Type u_1
a b c : ZNum
⊢ ↑a ≤ ↑b → ↑b ≤ ↑c → ↑a ≤ ↑c

Next tactic:
apply le_trans
instance linearOrder : LinearOrder ZNum where
  lt := (· < ·)
  lt_iff_le_not_le := by
    

Proof state:
α : Type u_1
⊢ ∀ (a b : ZNum), a < b ↔ a ≤ b ∧ ¬b ≤ a

Next tactic:
intro a b
instance linearOrder : LinearOrder ZNum where
  lt := (· < ·)
  lt_iff_le_not_le := by
    intro a b
    

Proof state:
α : Type u_1
a b : ZNum
⊢ a < b ↔ a ≤ b ∧ ¬b ≤ a

Next tactic:
transfer_rw
instance linearOrder : LinearOrder ZNum where
  lt := (· < ·)
  lt_iff_le_not_le := by
    intro a b
    transfer_rw
    

Proof state:
α : Type u_1
a b : ZNum
⊢ ↑a < ↑b ↔ ↑a ≤ ↑b ∧ ¬↑b ≤ ↑a

Next tactic:
apply lt_iff_le_not_le
instance linearOrder : LinearOrder ZNum where
  lt := (· < ·)
  lt_iff_le_not_le := by
    intro a b
    transfer_rw
    apply lt_iff_le_not_le
  le := (· ≤ ·)
  le_refl := by transfer
  le_trans := by
    intro a b c
    transfer_rw
    apply le_trans
  le_antisymm := by
    

Proof state:
α : Type u_1
⊢ ∀ (a b : ZNum), a ≤ b → b ≤ a → a = b

Next tactic:
intro a b
instance linearOrder : LinearOrder ZNum where
  lt := (· < ·)
  lt_iff_le_not_le := by
    intro a b
    transfer_rw
    apply lt_iff_le_not_le
  le := (· ≤ ·)
  le_refl := by transfer
  le_trans := by
    intro a b c
    transfer_rw
    apply le_trans
  le_antisymm := by
    intro a b
    

Proof state:
α : Type u_1
a b : ZNum
⊢ a ≤ b → b ≤ a → a = b

Next tactic:
transfer_rw
instance linearOrder : LinearOrder ZNum where
  lt := (· < ·)
  lt_iff_le_not_le := by
    intro a b
    transfer_rw
    apply lt_iff_le_not_le
  le := (· ≤ ·)
  le_refl := by transfer
  le_trans := by
    intro a b c
    transfer_rw
    apply le_trans
  le_antisymm := by
    intro a b
    transfer_rw
    

Proof state:
α : Type u_1
a b : ZNum
⊢ ↑a ≤ ↑b → ↑b ≤ ↑a → ↑a = ↑b

Next tactic:
apply le_antisymm
instance linearOrder : LinearOrder ZNum where
  lt := (· < ·)
  lt_iff_le_not_le := by
    intro a b
    transfer_rw
    apply lt_iff_le_not_le
  le := (· ≤ ·)
  le_refl := by transfer
  le_trans := by
    intro a b c
    transfer_rw
    apply le_trans
  le_antisymm := by
    intro a b
    transfer_rw
    apply le_antisymm
  le_total := by
    

Proof state:
α : Type u_1
⊢ ∀ (a b : ZNum), a ≤ b ∨ b ≤ a

Next tactic:
intro a b
instance linearOrder : LinearOrder ZNum where
  lt := (· < ·)
  lt_iff_le_not_le := by
    intro a b
    transfer_rw
    apply lt_iff_le_not_le
  le := (· ≤ ·)
  le_refl := by transfer
  le_trans := by
    intro a b c
    transfer_rw
    apply le_trans
  le_antisymm := by
    intro a b
    transfer_rw
    apply le_antisymm
  le_total := by
    intro a b
    

Proof state:
α : Type u_1
a b : ZNum
⊢ a ≤ b ∨ b ≤ a

Next tactic:
transfer_rw
instance linearOrder : LinearOrder ZNum where
  lt := (· < ·)
  lt_iff_le_not_le := by
    intro a b
    transfer_rw
    apply lt_iff_le_not_le
  le := (· ≤ ·)
  le_refl := by transfer
  le_trans := by
    intro a b c
    transfer_rw
    apply le_trans
  le_antisymm := by
    intro a b
    transfer_rw
    apply le_antisymm
  le_total := by
    intro a b
    transfer_rw
    

Proof state:
α : Type u_1
a b : ZNum
⊢ ↑a ≤ ↑b ∨ ↑b ≤ ↑a

Next tactic:
apply le_total
instance addMonoid : AddMonoid ZNum where
  add := (· + ·)
  add_assoc := by 

Proof state:
α : Type u_1
⊢ ∀ (a b c : ZNum), a + b + c = a + (b + c)

Next tactic:
transfer
instance addCommGroup : AddCommGroup ZNum :=
  { ZNum.addMonoid with
    add_comm := by transfer
    neg := Neg.neg
    add_left_neg := by 

Proof state:
α : Type u_1
src✝ : AddMonoid ZNum := addMonoid
⊢ ∀ (a : ZNum), -a + a = 0

Next tactic:
transfer
instance addCommGroup : AddCommGroup ZNum :=
  { ZNum.addMonoid with
    add_comm := by 

Proof state:
α : Type u_1
src✝ : AddMonoid ZNum := addMonoid
⊢ ∀ (a b : ZNum), a + b = b + a

Next tactic:
transfer
instance addMonoidWithOne : AddMonoidWithOne ZNum :=
  { ZNum.addMonoid with
    one := 1
    natCast := fun n => ZNum.ofInt' n
    natCast_zero := show (Num.ofNat' 0).toZNum = 0 by 

Proof state:
α : Type u_1
src✝ : AddMonoid ZNum := addMonoid
⊢ Num.toZNum (Num.ofNat' 0) = 0

Next tactic:
rw [Num.ofNat'_zero]
instance addMonoidWithOne : AddMonoidWithOne ZNum :=
  { ZNum.addMonoid with
    one := 1
    natCast := fun n => ZNum.ofInt' n
    natCast_zero := show (Num.ofNat' 0).toZNum = 0 by rw [Num.ofNat'_zero]; 

Proof state:
α : Type u_1
src✝ : AddMonoid ZNum := addMonoid
⊢ Num.toZNum 0 = 0

Next tactic:
rfl
instance addMonoidWithOne : AddMonoidWithOne ZNum :=
  { ZNum.addMonoid with
    one := 1
    natCast := fun n => ZNum.ofInt' n
    natCast_zero := show (Num.ofNat' 0).toZNum = 0 by rw [Num.ofNat'_zero]; rfl
    natCast_succ := fun n =>
      show (Num.ofNat' (n + 1)).toZNum = (Num.ofNat' n).toZNum + 1 by
        

Proof state:
α : Type u_1
src✝ : AddMonoid ZNum := addMonoid
n : ℕ
⊢ Num.toZNum (Num.ofNat' (n + 1)) = Num.toZNum (Num.ofNat' n) + 1

Next tactic:
rw [Num.ofNat'_succ, Num.add_one, Num.toZNum_succ, ZNum.add_one]
private theorem mul_comm : ∀ (a b : ZNum), a * b = b * a := by 

Proof state:
α : Type u_1
⊢ ∀ (a b : ZNum), a * b = b * a

Next tactic:
transfer
private theorem add_le_add_left : ∀ (a b : ZNum), a ≤ b → ∀ (c : ZNum), c + a ≤ c + b := by
  

Proof state:
α : Type u_1
⊢ ∀ (a b : ZNum), a ≤ b → ∀ (c : ZNum), c + a ≤ c + b

Next tactic:
intro a b h c
private theorem add_le_add_left : ∀ (a b : ZNum), a ≤ b → ∀ (c : ZNum), c + a ≤ c + b := by
  intro a b h c
  

Proof state:
α : Type u_1
a b : ZNum
h : a ≤ b
c : ZNum
⊢ c + a ≤ c + b

Next tactic:
revert h
private theorem add_le_add_left : ∀ (a b : ZNum), a ≤ b → ∀ (c : ZNum), c + a ≤ c + b := by
  intro a b h c
  revert h
  

Proof state:
α : Type u_1
a b c : ZNum
⊢ a ≤ b → c + a ≤ c + b

Next tactic:
transfer_rw
private theorem add_le_add_left : ∀ (a b : ZNum), a ≤ b → ∀ (c : ZNum), c + a ≤ c + b := by
  intro a b h c
  revert h
  transfer_rw
  

Proof state:
α : Type u_1
a b c : ZNum
⊢ ↑a ≤ ↑b → ↑c + ↑a ≤ ↑c + ↑b

Next tactic:
exact fun h => _root_.add_le_add_left h c
instance linearOrderedCommRing : LinearOrderedCommRing ZNum :=
  { ZNum.linearOrder, ZNum.addCommGroup, ZNum.addMonoidWithOne with
    mul := (· * ·)
    mul_assoc := by transfer
    zero_mul := by transfer
    mul_zero := by transfer
    one_mul := by transfer
    mul_one := by transfer
    left_distrib := by
      

Proof state:
α : Type u_1
src✝² : LinearOrder ZNum := linearOrder
src✝¹ : AddCommGroup ZNum := addCommGroup
src✝ : AddMonoidWithOne ZNum := addMonoidWithOne
⊢ ∀ (a b c : ZNum), a * (b + c) = a * b + a * c

Next tactic:
transfer
instance linearOrderedCommRing : LinearOrderedCommRing ZNum :=
  { ZNum.linearOrder, ZNum.addCommGroup, ZNum.addMonoidWithOne with
    mul := (· * ·)
    mul_assoc := by transfer
    zero_mul := by transfer
    mul_zero := by transfer
    one_mul := by transfer
    mul_one := by transfer
    left_distrib := by
      transfer
      

Proof state:
α : Type u_1
src✝² : LinearOrder ZNum := linearOrder
src✝¹ : AddCommGroup ZNum := addCommGroup
src✝ : AddMonoidWithOne ZNum := addMonoidWithOne
a✝ b✝ c✝ : ZNum
⊢ ↑a✝ * (↑b✝ + ↑c✝) = ↑a✝ * ↑b✝ + ↑a✝ * ↑c✝

Next tactic:
simp [mul_add]
instance linearOrderedCommRing : LinearOrderedCommRing ZNum :=
  { ZNum.linearOrder, ZNum.addCommGroup, ZNum.addMonoidWithOne with
    mul := (· * ·)
    mul_assoc := by transfer
    zero_mul := by transfer
    mul_zero := by transfer
    one_mul := by transfer
    mul_one := by transfer
    left_distrib := by
      transfer
      simp [mul_add]
    right_distrib := by
      

Proof state:
α : Type u_1
src✝² : LinearOrder ZNum := linearOrder
src✝¹ : AddCommGroup ZNum := addCommGroup
src✝ : AddMonoidWithOne ZNum := addMonoidWithOne
⊢ ∀ (a b c : ZNum), (a + b) * c = a * c + b * c

Next tactic:
transfer
instance linearOrderedCommRing : LinearOrderedCommRing ZNum :=
  { ZNum.linearOrder, ZNum.addCommGroup, ZNum.addMonoidWithOne with
    mul := (· * ·)
    mul_assoc := by transfer
    zero_mul := by transfer
    mul_zero := by transfer
    one_mul := by transfer
    mul_one := by transfer
    left_distrib := by
      transfer
      simp [mul_add]
    right_distrib := by
      transfer
      

Proof state:
α : Type u_1
src✝² : LinearOrder ZNum := linearOrder
src✝¹ : AddCommGroup ZNum := addCommGroup
src✝ : AddMonoidWithOne ZNum := addMonoidWithOne
a✝ b✝ c✝ : ZNum
⊢ ↑c✝ * (↑a✝ + ↑b✝) = ↑a✝ * ↑c✝ + ↑b✝ * ↑c✝

Next tactic:
simp [mul_add, _root_.mul_comm]
instance linearOrderedCommRing : LinearOrderedCommRing ZNum :=
  { ZNum.linearOrder, ZNum.addCommGroup, ZNum.addMonoidWithOne with
    mul := (· * ·)
    mul_assoc := by transfer
    zero_mul := by 

Proof state:
α : Type u_1
src✝² : LinearOrder ZNum := linearOrder
src✝¹ : AddCommGroup ZNum := addCommGroup
src✝ : AddMonoidWithOne ZNum := addMonoidWithOne
⊢ ∀ (a : ZNum), 0 * a = 0

Next tactic:
transfer