l3lab/ntp-mathlib huggingface dataset:
theorem abs_ediv_le_abs : ∀ a b : ℤ, |a / b| ≤ |a| :=
  suffices ∀ (a : ℤ) (n : ℕ), |a / n| ≤ |a| from fun a b =>
    match b, eq_nat_or_neg b with
    | _, ⟨n, Or.inl rfl⟩ => this _ _
    | _, ⟨n, Or.inr rfl⟩ => by rw [Int.ediv_neg, abs_neg]; 

Proof state:
a✝ b✝ : ℤ
n✝ : ℕ
this : ∀ (a : ℤ) (n : ℕ), |a / ↑n| ≤ |a|
a b : ℤ
n : ℕ
⊢ |a / ↑n| ≤ |a|

Next tactic:
apply this
theorem emod_two_eq_zero_or_one (n : ℤ) : n % 2 = 0 ∨ n % 2 = 1 :=
  have h : n % 2 < 2 := abs_of_nonneg (show 0 ≤ (2 : ℤ) by 

Proof state:
a b : ℤ
n✝ : ℕ
n : ℤ
⊢ 0 ≤ 2

Next tactic:
decide
theorem emod_two_eq_zero_or_one (n : ℤ) : n % 2 = 0 ∨ n % 2 = 1 :=
  have h : n % 2 < 2 := abs_of_nonneg (show 0 ≤ (2 : ℤ) by decide) ▸ Int.emod_lt _ (by 

Proof state:
a b : ℤ
n✝ : ℕ
n : ℤ
⊢ |2| ≠ 0

Next tactic:
decide
theorem emod_two_eq_zero_or_one (n : ℤ) : n % 2 = 0 ∨ n % 2 = 1 :=
  have h : n % 2 < 2 := abs_of_nonneg (show 0 ≤ (2 : ℤ) by decide) ▸ Int.emod_lt _ (by decide)
  have h₁ : 0 ≤ n % 2 := Int.emod_nonneg _ (by 

Proof state:
a b : ℤ
n✝ : ℕ
n : ℤ
h : n % 2 < 2
⊢ 2 ≠ 0

Next tactic:
decide
theorem emod_two_eq_zero_or_one (n : ℤ) : n % 2 = 0 ∨ n % 2 = 1 :=
  have h : n % 2 < 2 := abs_of_nonneg (show 0 ≤ (2 : ℤ) by decide) ▸ Int.emod_lt _ (by decide)
  have h₁ : 0 ≤ n % 2 := Int.emod_nonneg _ (by decide)
  match n % 2, h, h₁ with
  | (0 : ℕ), _ ,_ => Or.inl rfl
  | (1 : ℕ), _ ,_ => Or.inr rfl
  -- Porting note: this used to be `=> absurd h (by decide)`
  -- see https://github.com/leanprover-community/mathlib4/issues/994
  | (k + 2 : ℕ), h₁, _ => False.elim (h₁.not_le (by
    

Proof state:
a b : ℤ
n✝ : ℕ
n : ℤ
h : n % 2 < 2
h₁✝ : 0 ≤ n % 2
k : ℕ
h₁ : ↑(k + 2) < 2
x✝ : 0 ≤ ↑(k + 2)
⊢ 2 ≤ ↑(k + 2)

Next tactic:
rw [Nat.cast_add]
theorem emod_two_eq_zero_or_one (n : ℤ) : n % 2 = 0 ∨ n % 2 = 1 :=
  have h : n % 2 < 2 := abs_of_nonneg (show 0 ≤ (2 : ℤ) by decide) ▸ Int.emod_lt _ (by decide)
  have h₁ : 0 ≤ n % 2 := Int.emod_nonneg _ (by decide)
  match n % 2, h, h₁ with
  | (0 : ℕ), _ ,_ => Or.inl rfl
  | (1 : ℕ), _ ,_ => Or.inr rfl
  -- Porting note: this used to be `=> absurd h (by decide)`
  -- see https://github.com/leanprover-community/mathlib4/issues/994
  | (k + 2 : ℕ), h₁, _ => False.elim (h₁.not_le (by
    rw [Nat.cast_add]
    

Proof state:
a b : ℤ
n✝ : ℕ
n : ℤ
h : n % 2 < 2
h₁✝ : 0 ≤ n % 2
k : ℕ
h₁ : ↑(k + 2) < 2
x✝ : 0 ≤ ↑(k + 2)
⊢ 2 ≤ ↑k + ↑2

Next tactic:
exact (le_add_iff_nonneg_left 2).2 (NonNeg.mk k)
theorem emod_two_eq_zero_or_one (n : ℤ) : n % 2 = 0 ∨ n % 2 = 1 :=
  have h : n % 2 < 2 := abs_of_nonneg (show 0 ≤ (2 : ℤ) by decide) ▸ Int.emod_lt _ (by decide)
  have h₁ : 0 ≤ n % 2 := Int.emod_nonneg _ (by decide)
  match n % 2, h, h₁ with
  | (0 : ℕ), _ ,_ => Or.inl rfl
  | (1 : ℕ), _ ,_ => Or.inr rfl
  -- Porting note: this used to be `=> absurd h (by decide)`
  -- see https://github.com/leanprover-community/mathlib4/issues/994
  | (k + 2 : ℕ), h₁, _ => False.elim (h₁.not_le (by
    rw [Nat.cast_add]
    exact (le_add_iff_nonneg_left 2).2 (NonNeg.mk k)))
  -- Porting note: this used to be `=> absurd h₁ (by decide)`
  | -[a+1], _, h₁ => by 

Proof state:
a✝ b : ℤ
n✝ : ℕ
n : ℤ
h : n % 2 < 2
h₁✝ : 0 ≤ n % 2
a : ℕ
x✝ : -[a+1] < 2
h₁ : 0 ≤ -[a+1]
⊢ -[a+1] = 0 ∨ -[a+1] = 1

Next tactic:
cases h₁
theorem ediv_dvd_ediv : ∀ {a b c : ℤ} (_ : a ∣ b) (_ : b ∣ c), b / a ∣ c / a
  | a, _, _, ⟨b, rfl⟩, ⟨c, rfl⟩ =>
    if az : a = 0 then by 

Proof state:
a✝ b✝ : ℤ
n : ℕ
a b c : ℤ
az : a = 0
⊢ a * b / a ∣ a * b * c / a

Next tactic:
simp [az]
theorem ediv_dvd_ediv : ∀ {a b c : ℤ} (_ : a ∣ b) (_ : b ∣ c), b / a ∣ c / a
  | a, _, _, ⟨b, rfl⟩, ⟨c, rfl⟩ =>
    if az : a = 0 then by simp [az]
    else by
      

Proof state:
a✝ b✝ : ℤ
n : ℕ
a b c : ℤ
az : ¬a = 0
⊢ a * b / a ∣ a * b * c / a

Next tactic:
rw [Int.mul_ediv_cancel_left _ az, mul_assoc, Int.mul_ediv_cancel_left _ az]
theorem ediv_dvd_ediv : ∀ {a b c : ℤ} (_ : a ∣ b) (_ : b ∣ c), b / a ∣ c / a
  | a, _, _, ⟨b, rfl⟩, ⟨c, rfl⟩ =>
    if az : a = 0 then by simp [az]
    else by
      rw [Int.mul_ediv_cancel_left _ az, mul_assoc, Int.mul_ediv_cancel_left _ az];
        

Proof state:
a✝ b✝ : ℤ
n : ℕ
a b c : ℤ
az : ¬a = 0
⊢ b ∣ b * c

Next tactic:
apply dvd_mul_right
theorem abs_sign_of_nonzero {z : ℤ} (hz : z ≠ 0) : |z.sign| = 1 := by
  

Proof state:
a b : ℤ
n : ℕ
z : ℤ
hz : z ≠ 0
⊢ |sign z| = 1

Next tactic:
rw [abs_eq_natAbs, natAbs_sign_of_nonzero hz, Int.ofNat_one]
/-- If `n > 0` then `m` is not divisible by `n` iff it is between `n * k` and `n * (k + 1)`
  for some `k`. -/
theorem exists_lt_and_lt_iff_not_dvd (m : ℤ) {n : ℤ} (hn : 0 < n) :
    (∃ k, n * k < m ∧ m < n * (k + 1)) ↔ ¬n ∣ m := by
  

Proof state:
a b : ℤ
n✝ : ℕ
m n : ℤ
hn : 0 < n
⊢ (∃ k, n * k < m ∧ m < n * (k + 1)) ↔ ¬n ∣ m

Next tactic:
constructor
/-- If `n > 0` then `m` is not divisible by `n` iff it is between `n * k` and `n * (k + 1)`
  for some `k`. -/
theorem exists_lt_and_lt_iff_not_dvd (m : ℤ) {n : ℤ} (hn : 0 < n) :
    (∃ k, n * k < m ∧ m < n * (k + 1)) ↔ ¬n ∣ m := by
  constructor
  · 

Proof state:
case mp
a b : ℤ
n✝ : ℕ
m n : ℤ
hn : 0 < n
⊢ (∃ k, n * k < m ∧ m < n * (k + 1)) → ¬n ∣ m

Next tactic:
rintro ⟨k, h1k, h2k⟩ ⟨l, rfl⟩
/-- If `n > 0` then `m` is not divisible by `n` iff it is between `n * k` and `n * (k + 1)`
  for some `k`. -/
theorem exists_lt_and_lt_iff_not_dvd (m : ℤ) {n : ℤ} (hn : 0 < n) :
    (∃ k, n * k < m ∧ m < n * (k + 1)) ↔ ¬n ∣ m := by
  constructor
  · rintro ⟨k, h1k, h2k⟩ ⟨l, rfl⟩
    

Proof state:
case mp.intro.intro.intro
a b : ℤ
n✝ : ℕ
n : ℤ
hn : 0 < n
k l : ℤ
h1k : n * k < n * l
h2k : n * l < n * (k + 1)
⊢ False

Next tactic:
rw [mul_lt_mul_left hn] at h1k h2k
/-- If `n > 0` then `m` is not divisible by `n` iff it is between `n * k` and `n * (k + 1)`
  for some `k`. -/
theorem exists_lt_and_lt_iff_not_dvd (m : ℤ) {n : ℤ} (hn : 0 < n) :
    (∃ k, n * k < m ∧ m < n * (k + 1)) ↔ ¬n ∣ m := by
  constructor
  · rintro ⟨k, h1k, h2k⟩ ⟨l, rfl⟩
    rw [mul_lt_mul_left hn] at h1k h2k
    

Proof state:
case mp.intro.intro.intro
a b : ℤ
n✝ : ℕ
n : ℤ
hn : 0 < n
k l : ℤ
h1k : k < l
h2k : l < k + 1
⊢ False

Next tactic:
rw [lt_add_one_iff, ← not_lt] at h2k
/-- If `n > 0` then `m` is not divisible by `n` iff it is between `n * k` and `n * (k + 1)`
  for some `k`. -/
theorem exists_lt_and_lt_iff_not_dvd (m : ℤ) {n : ℤ} (hn : 0 < n) :
    (∃ k, n * k < m ∧ m < n * (k + 1)) ↔ ¬n ∣ m := by
  constructor
  · rintro ⟨k, h1k, h2k⟩ ⟨l, rfl⟩
    rw [mul_lt_mul_left hn] at h1k h2k
    rw [lt_add_one_iff, ← not_lt] at h2k
    

Proof state:
case mp.intro.intro.intro
a b : ℤ
n✝ : ℕ
n : ℤ
hn : 0 < n
k l : ℤ
h1k : k < l
h2k : ¬k < l
⊢ False

Next tactic:
exact h2k h1k
/-- If `n > 0` then `m` is not divisible by `n` iff it is between `n * k` and `n * (k + 1)`
  for some `k`. -/
theorem exists_lt_and_lt_iff_not_dvd (m : ℤ) {n : ℤ} (hn : 0 < n) :
    (∃ k, n * k < m ∧ m < n * (k + 1)) ↔ ¬n ∣ m := by
  constructor
  · rintro ⟨k, h1k, h2k⟩ ⟨l, rfl⟩
    rw [mul_lt_mul_left hn] at h1k h2k
    rw [lt_add_one_iff, ← not_lt] at h2k
    exact h2k h1k
  · 

Proof state:
case mpr
a b : ℤ
n✝ : ℕ
m n : ℤ
hn : 0 < n
⊢ ¬n ∣ m → ∃ k, n * k < m ∧ m < n * (k + 1)

Next tactic:
intro h
/-- If `n > 0` then `m` is not divisible by `n` iff it is between `n * k` and `n * (k + 1)`
  for some `k`. -/
theorem exists_lt_and_lt_iff_not_dvd (m : ℤ) {n : ℤ} (hn : 0 < n) :
    (∃ k, n * k < m ∧ m < n * (k + 1)) ↔ ¬n ∣ m := by
  constructor
  · rintro ⟨k, h1k, h2k⟩ ⟨l, rfl⟩
    rw [mul_lt_mul_left hn] at h1k h2k
    rw [lt_add_one_iff, ← not_lt] at h2k
    exact h2k h1k
  · intro h
    

Proof state:
case mpr
a b : ℤ
n✝ : ℕ
m n : ℤ
hn : 0 < n
h : ¬n ∣ m
⊢ ∃ k, n * k < m ∧ m < n * (k + 1)

Next tactic:
rw [dvd_iff_emod_eq_zero, ← Ne.def] at h
/-- If `n > 0` then `m` is not divisible by `n` iff it is between `n * k` and `n * (k + 1)`
  for some `k`. -/
theorem exists_lt_and_lt_iff_not_dvd (m : ℤ) {n : ℤ} (hn : 0 < n) :
    (∃ k, n * k < m ∧ m < n * (k + 1)) ↔ ¬n ∣ m := by
  constructor
  · rintro ⟨k, h1k, h2k⟩ ⟨l, rfl⟩
    rw [mul_lt_mul_left hn] at h1k h2k
    rw [lt_add_one_iff, ← not_lt] at h2k
    exact h2k h1k
  · intro h
    rw [dvd_iff_emod_eq_zero, ← Ne.def] at h
    

Proof state:
case mpr
a b : ℤ
n✝ : ℕ
m n : ℤ
hn : 0 < n
h : m % n ≠ 0
⊢ ∃ k, n * k < m ∧ m < n * (k + 1)

Next tactic:
have := (emod_nonneg m hn.ne.symm).lt_of_ne h.symm
/-- If `n > 0` then `m` is not divisible by `n` iff it is between `n * k` and `n * (k + 1)`
  for some `k`. -/
theorem exists_lt_and_lt_iff_not_dvd (m : ℤ) {n : ℤ} (hn : 0 < n) :
    (∃ k, n * k < m ∧ m < n * (k + 1)) ↔ ¬n ∣ m := by
  constructor
  · rintro ⟨k, h1k, h2k⟩ ⟨l, rfl⟩
    rw [mul_lt_mul_left hn] at h1k h2k
    rw [lt_add_one_iff, ← not_lt] at h2k
    exact h2k h1k
  · intro h
    rw [dvd_iff_emod_eq_zero, ← Ne.def] at h
    have := (emod_nonneg m hn.ne.symm).lt_of_ne h.symm
    

Proof state:
case mpr
a b : ℤ
n✝ : ℕ
m n : ℤ
hn : 0 < n
h : m % n ≠ 0
this : 0 < m % n
⊢ ∃ k, n * k < m ∧ m < n * (k + 1)

Next tactic:
simp (config := { singlePass := true }) only [← emod_add_ediv m n]
/-- If `n > 0` then `m` is not divisible by `n` iff it is between `n * k` and `n * (k + 1)`
  for some `k`. -/
theorem exists_lt_and_lt_iff_not_dvd (m : ℤ) {n : ℤ} (hn : 0 < n) :
    (∃ k, n * k < m ∧ m < n * (k + 1)) ↔ ¬n ∣ m := by
  constructor
  · rintro ⟨k, h1k, h2k⟩ ⟨l, rfl⟩
    rw [mul_lt_mul_left hn] at h1k h2k
    rw [lt_add_one_iff, ← not_lt] at h2k
    exact h2k h1k
  · intro h
    rw [dvd_iff_emod_eq_zero, ← Ne.def] at h
    have := (emod_nonneg m hn.ne.symm).lt_of_ne h.symm
    simp (config := { singlePass := true }) only [← emod_add_ediv m n]
    

Proof state:
case mpr
a b : ℤ
n✝ : ℕ
m n : ℤ
hn : 0 < n
h : m % n ≠ 0
this : 0 < m % n
⊢ ∃ k, n * k < m % n + n * (m / n) ∧ m % n + n * (m / n) < n * (k + 1)

Next tactic:
refine' ⟨m / n, lt_add_of_pos_left _ this, _⟩
/-- If `n > 0` then `m` is not divisible by `n` iff it is between `n * k` and `n * (k + 1)`
  for some `k`. -/
theorem exists_lt_and_lt_iff_not_dvd (m : ℤ) {n : ℤ} (hn : 0 < n) :
    (∃ k, n * k < m ∧ m < n * (k + 1)) ↔ ¬n ∣ m := by
  constructor
  · rintro ⟨k, h1k, h2k⟩ ⟨l, rfl⟩
    rw [mul_lt_mul_left hn] at h1k h2k
    rw [lt_add_one_iff, ← not_lt] at h2k
    exact h2k h1k
  · intro h
    rw [dvd_iff_emod_eq_zero, ← Ne.def] at h
    have := (emod_nonneg m hn.ne.symm).lt_of_ne h.symm
    simp (config := { singlePass := true }) only [← emod_add_ediv m n]
    refine' ⟨m / n, lt_add_of_pos_left _ this, _⟩
    

Proof state:
case mpr
a b : ℤ
n✝ : ℕ
m n : ℤ
hn : 0 < n
h : m % n ≠ 0
this : 0 < m % n
⊢ m % n + n * (m / n) < n * (m / n + 1)

Next tactic:
rw [add_comm _ (1 : ℤ), left_distrib, mul_one]
/-- If `n > 0` then `m` is not divisible by `n` iff it is between `n * k` and `n * (k + 1)`
  for some `k`. -/
theorem exists_lt_and_lt_iff_not_dvd (m : ℤ) {n : ℤ} (hn : 0 < n) :
    (∃ k, n * k < m ∧ m < n * (k + 1)) ↔ ¬n ∣ m := by
  constructor
  · rintro ⟨k, h1k, h2k⟩ ⟨l, rfl⟩
    rw [mul_lt_mul_left hn] at h1k h2k
    rw [lt_add_one_iff, ← not_lt] at h2k
    exact h2k h1k
  · intro h
    rw [dvd_iff_emod_eq_zero, ← Ne.def] at h
    have := (emod_nonneg m hn.ne.symm).lt_of_ne h.symm
    simp (config := { singlePass := true }) only [← emod_add_ediv m n]
    refine' ⟨m / n, lt_add_of_pos_left _ this, _⟩
    rw [add_comm _ (1 : ℤ), left_distrib, mul_one]
    

Proof state:
case mpr
a b : ℤ
n✝ : ℕ
m n : ℤ
hn : 0 < n
h : m % n ≠ 0
this : 0 < m % n
⊢ m % n + n * (m / n) < n + n * (m / n)

Next tactic:
exact add_lt_add_right (emod_lt_of_pos _ hn) _
protected theorem sign_eq_ediv_abs (a : ℤ) : sign a = a / |a| :=
  if az : a = 0 then by 

Proof state:
a✝ b : ℤ
n : ℕ
a : ℤ
az : a = 0
⊢ sign a = a / |a|

Next tactic:
simp [az]
protected theorem ediv_mul_le (a : ℤ) {b : ℤ} (H : b ≠ 0) : a / b * b ≤ a :=
  le_of_sub_nonneg <| by 

Proof state:
a✝ b✝ : ℤ
n : ℕ
a b : ℤ
H : b ≠ 0
⊢ 0 ≤ a - a / b * b

Next tactic:
rw [mul_comm, ← emod_def]
protected theorem ediv_mul_le (a : ℤ) {b : ℤ} (H : b ≠ 0) : a / b * b ≤ a :=
  le_of_sub_nonneg <| by rw [mul_comm, ← emod_def]; 

Proof state:
a✝ b✝ : ℤ
n : ℕ
a b : ℤ
H : b ≠ 0
⊢ 0 ≤ a % b

Next tactic:
apply emod_nonneg _ H
protected theorem le_mul_of_ediv_le {a b c : ℤ} (H1 : 0 ≤ b) (H2 : b ∣ a) (H3 : a / b ≤ c) :
    a ≤ c * b := by 

Proof state:
a✝ b✝ : ℤ
n : ℕ
a b c : ℤ
H1 : 0 ≤ b
H2 : b ∣ a
H3 : a / b ≤ c
⊢ a ≤ c * b

Next tactic:
rw [← Int.ediv_mul_cancel H2]
protected theorem le_mul_of_ediv_le {a b c : ℤ} (H1 : 0 ≤ b) (H2 : b ∣ a) (H3 : a / b ≤ c) :
    a ≤ c * b := by rw [← Int.ediv_mul_cancel H2]; 

Proof state:
a✝ b✝ : ℤ
n : ℕ
a b c : ℤ
H1 : 0 ≤ b
H2 : b ∣ a
H3 : a / b ≤ c
⊢ a / b * b ≤ c * b

Next tactic:
exact mul_le_mul_of_nonneg_right H3 H1
theorem ediv_pos_of_pos_of_dvd {a b : ℤ} (H1 : 0 < a) (H2 : 0 ≤ b) (H3 : b ∣ a) : 0 < a / b :=
  Int.lt_ediv_of_mul_lt H2 H3 (by 

Proof state:
a✝ b✝ : ℤ
n : ℕ
a b : ℤ
H1 : 0 < a
H2 : 0 ≤ b
H3 : b ∣ a
⊢ 0 * b < a

Next tactic:
rwa [zero_mul]
theorem ediv_eq_ediv_of_mul_eq_mul {a b c d : ℤ} (H2 : d ∣ c) (H3 : b ≠ 0) (H4 : d ≠ 0)
    (H5 : a * d = b * c) : a / b = c / d :=
  Int.ediv_eq_of_eq_mul_right H3 <| by
    

Proof state:
a✝ b✝ : ℤ
n : ℕ
a b c d : ℤ
H2 : d ∣ c
H3 : b ≠ 0
H4 : d ≠ 0
H5 : a * d = b * c
⊢ a = b * (c / d)

Next tactic:
rw [← Int.mul_ediv_assoc _ H2]
theorem ediv_eq_ediv_of_mul_eq_mul {a b c d : ℤ} (H2 : d ∣ c) (H3 : b ≠ 0) (H4 : d ≠ 0)
    (H5 : a * d = b * c) : a / b = c / d :=
  Int.ediv_eq_of_eq_mul_right H3 <| by
    rw [← Int.mul_ediv_assoc _ H2]; 

Proof state:
a✝ b✝ : ℤ
n : ℕ
a b c d : ℤ
H2 : d ∣ c
H3 : b ≠ 0
H4 : d ≠ 0
H5 : a * d = b * c
⊢ a = b * c / d

Next tactic:
exact (Int.ediv_eq_of_eq_mul_left H4 H5.symm).symm
theorem ediv_dvd_of_dvd {s t : ℤ} (hst : s ∣ t) : t / s ∣ t := by
  

Proof state:
a b : ℤ
n : ℕ
s t : ℤ
hst : s ∣ t
⊢ t / s ∣ t

Next tactic:
rcases eq_or_ne s 0 with (rfl | hs)
theorem ediv_dvd_of_dvd {s t : ℤ} (hst : s ∣ t) : t / s ∣ t := by
  rcases eq_or_ne s 0 with (rfl | hs)
  · 

Proof state:
case inl
a b : ℤ
n : ℕ
t : ℤ
hst : 0 ∣ t
⊢ t / 0 ∣ t

Next tactic:
simpa using hst
theorem ediv_dvd_of_dvd {s t : ℤ} (hst : s ∣ t) : t / s ∣ t := by
  rcases eq_or_ne s 0 with (rfl | hs)
  · simpa using hst
  

Proof state:
case inr
a b : ℤ
n : ℕ
s t : ℤ
hst : s ∣ t
hs : s ≠ 0
⊢ t / s ∣ t

Next tactic:
rcases hst with ⟨c, hc⟩
theorem ediv_dvd_of_dvd {s t : ℤ} (hst : s ∣ t) : t / s ∣ t := by
  rcases eq_or_ne s 0 with (rfl | hs)
  · simpa using hst
  rcases hst with ⟨c, hc⟩
  

Proof state:
case inr.intro
a b : ℤ
n : ℕ
s t : ℤ
hs : s ≠ 0
c : ℤ
hc : t = s * c
⊢ t / s ∣ t

Next tactic:
simp [hc, Int.mul_ediv_cancel_left _ hs]
@[simp]
theorem toNat_le {a : ℤ} {n : ℕ} : toNat a ≤ n ↔ a ≤ n := by
  

Proof state:
a✝ b : ℤ
n✝ : ℕ
a : ℤ
n : ℕ
⊢ toNat a ≤ n ↔ a ≤ ↑n

Next tactic:
rw [ofNat_le.symm, toNat_eq_max, max_le_iff]
@[simp]
theorem toNat_le {a : ℤ} {n : ℕ} : toNat a ≤ n ↔ a ≤ n := by
  rw [ofNat_le.symm, toNat_eq_max, max_le_iff]; 

Proof state:
a✝ b : ℤ
n✝ : ℕ
a : ℤ
n : ℕ
⊢ a ≤ ↑n ∧ 0 ≤ ↑n ↔ a ≤ ↑n

Next tactic:
exact and_iff_left (ofNat_zero_le _)
theorem toNat_le_toNat {a b : ℤ} (h : a ≤ b) : toNat a ≤ toNat b := by
  

Proof state:
a✝ b✝ : ℤ
n : ℕ
a b : ℤ
h : a ≤ b
⊢ toNat a ≤ toNat b

Next tactic:
rw [toNat_le]
theorem toNat_le_toNat {a b : ℤ} (h : a ≤ b) : toNat a ≤ toNat b := by
  rw [toNat_le]; 

Proof state:
a✝ b✝ : ℤ
n : ℕ
a b : ℤ
h : a ≤ b
⊢ a ≤ ↑(toNat b)

Next tactic:
exact le_trans h (self_le_toNat b)
theorem toNat_lt_toNat {a b : ℤ} (hb : 0 < b) : toNat a < toNat b ↔ a < b :=
  ⟨fun h => by 

Proof state:
a✝ b✝ : ℤ
n : ℕ
a b : ℤ
hb : 0 < b
h : toNat a < toNat b
⊢ a < b

Next tactic:
cases a
theorem toNat_lt_toNat {a b : ℤ} (hb : 0 < b) : toNat a < toNat b ↔ a < b :=
  ⟨fun h => by cases a; 

Proof state:
case ofNat
a b✝ : ℤ
n : ℕ
b : ℤ
hb : 0 < b
a✝ : ℕ
h : toNat (ofNat a✝) < toNat b
⊢ ofNat a✝ < b
case negSucc a b✝ : ℤ n : ℕ b : ℤ hb : 0 < b a✝ : ℕ h : toNat -[a✝+1] < toNat b ⊢ -[a✝+1] < b

Next tactic:
exact lt_toNat.1 h
theorem toNat_lt_toNat {a b : ℤ} (hb : 0 < b) : toNat a < toNat b ↔ a < b :=
  ⟨fun h => by cases a; exact lt_toNat.1 h; 

Proof state:
case negSucc
a b✝ : ℤ
n : ℕ
b : ℤ
hb : 0 < b
a✝ : ℕ
h : toNat -[a✝+1] < toNat b
⊢ -[a✝+1] < b

Next tactic:
exact lt_trans (neg_of_sign_eq_neg_one rfl) hb
theorem toNat_lt_toNat {a b : ℤ} (hb : 0 < b) : toNat a < toNat b ↔ a < b :=
  ⟨fun h => by cases a; exact lt_toNat.1 h; exact lt_trans (neg_of_sign_eq_neg_one rfl) hb,
   fun h => by 

Proof state:
a✝ b✝ : ℤ
n : ℕ
a b : ℤ
hb : 0 < b
h : a < b
⊢ toNat a < toNat b

Next tactic:
rw [lt_toNat]
theorem toNat_lt_toNat {a b : ℤ} (hb : 0 < b) : toNat a < toNat b ↔ a < b :=
  ⟨fun h => by cases a; exact lt_toNat.1 h; exact lt_trans (neg_of_sign_eq_neg_one rfl) hb,
   fun h => by rw [lt_toNat]; 

Proof state:
a✝ b✝ : ℤ
n : ℕ
a b : ℤ
hb : 0 < b
h : a < b
⊢ ↑(toNat a) < b

Next tactic:
cases a
theorem toNat_lt_toNat {a b : ℤ} (hb : 0 < b) : toNat a < toNat b ↔ a < b :=
  ⟨fun h => by cases a; exact lt_toNat.1 h; exact lt_trans (neg_of_sign_eq_neg_one rfl) hb,
   fun h => by rw [lt_toNat]; cases a; 

Proof state:
case ofNat
a b✝ : ℤ
n : ℕ
b : ℤ
hb : 0 < b
a✝ : ℕ
h : ofNat a✝ < b
⊢ ↑(toNat (ofNat a✝)) < b
case negSucc a b✝ : ℤ n : ℕ b : ℤ hb : 0 < b a✝ : ℕ h : -[a✝+1] < b ⊢ ↑(toNat -[a✝+1]) < b

Next tactic:
exact h
theorem toNat_lt_toNat {a b : ℤ} (hb : 0 < b) : toNat a < toNat b ↔ a < b :=
  ⟨fun h => by cases a; exact lt_toNat.1 h; exact lt_trans (neg_of_sign_eq_neg_one rfl) hb,
   fun h => by rw [lt_toNat]; cases a; exact h; 

Proof state:
case negSucc
a b✝ : ℤ
n : ℕ
b : ℤ
hb : 0 < b
a✝ : ℕ
h : -[a✝+1] < b
⊢ ↑(toNat -[a✝+1]) < b

Next tactic:
exact hb
@[simp]
theorem toNat_pred_coe_of_pos {i : ℤ} (h : 0 < i) : ((i.toNat - 1 : ℕ) : ℤ) = i - 1 := by
  

Proof state:
a b : ℤ
n : ℕ
i : ℤ
h : 0 < i
⊢ ↑(toNat i - 1) = i - 1

Next tactic:
simp [h, le_of_lt h, push_cast]
@[simp]
theorem col_add [Add α] (v w : m → α) : col (v + w) = col v + col w := by
  

Proof state:
l : Type u_1
m : Type u_2
n : Type u_3
o : Type u_4
R : Type u_5
α : Type v
β : Type w
inst✝ : Add α
v w : m → α
⊢ col (v + w) = col v + col w

Next tactic:
ext
@[simp]
theorem col_add [Add α] (v w : m → α) : col (v + w) = col v + col w := by
  ext
  

Proof state:
case a.h
l : Type u_1
m : Type u_2
n : Type u_3
o : Type u_4
R : Type u_5
α : Type v
β : Type w
inst✝ : Add α
v w : m → α
i✝ : m
x✝ : Unit
⊢ col (v + w) i✝ x✝ = (col v + col w) i✝ x✝

Next tactic:
rfl
@[simp]
theorem col_smul [SMul R α] (x : R) (v : m → α) : col (x • v) = x • col v := by
  

Proof state:
l : Type u_1
m : Type u_2
n : Type u_3
o : Type u_4
R : Type u_5
α : Type v
β : Type w
inst✝ : SMul R α
x : R
v : m → α
⊢ col (x • v) = x • col v

Next tactic:
ext
@[simp]
theorem col_smul [SMul R α] (x : R) (v : m → α) : col (x • v) = x • col v := by
  ext
  

Proof state:
case a.h
l : Type u_1
m : Type u_2
n : Type u_3
o : Type u_4
R : Type u_5
α : Type v
β : Type w
inst✝ : SMul R α
x : R
v : m → α
i✝ : m
x✝ : Unit
⊢ col (x • v) i✝ x✝ = (x • col v) i✝ x✝

Next tactic:
rfl
@[simp]
theorem row_add [Add α] (v w : m → α) : row (v + w) = row v + row w := by
  

Proof state:
l : Type u_1
m : Type u_2
n : Type u_3
o : Type u_4
R : Type u_5
α : Type v
β : Type w
inst✝ : Add α
v w : m → α
⊢ row (v + w) = row v + row w

Next tactic:
ext
@[simp]
theorem row_add [Add α] (v w : m → α) : row (v + w) = row v + row w := by
  ext
  

Proof state:
case a.h
l : Type u_1
m : Type u_2
n : Type u_3
o : Type u_4
R : Type u_5
α : Type v
β : Type w
inst✝ : Add α
v w : m → α
i✝ : Unit
x✝ : m
⊢ row (v + w) i✝ x✝ = (row v + row w) i✝ x✝

Next tactic:
rfl
@[simp]
theorem row_smul [SMul R α] (x : R) (v : m → α) : row (x • v) = x • row v := by
  

Proof state:
l : Type u_1
m : Type u_2
n : Type u_3
o : Type u_4
R : Type u_5
α : Type v
β : Type w
inst✝ : SMul R α
x : R
v : m → α
⊢ row (x • v) = x • row v

Next tactic:
ext
@[simp]
theorem row_smul [SMul R α] (x : R) (v : m → α) : row (x • v) = x • row v := by
  ext
  

Proof state:
case a.h
l : Type u_1
m : Type u_2
n : Type u_3
o : Type u_4
R : Type u_5
α : Type v
β : Type w
inst✝ : SMul R α
x : R
v : m → α
i✝ : Unit
x✝ : m
⊢ row (x • v) i✝ x✝ = (x • row v) i✝ x✝

Next tactic:
rfl
@[simp]
theorem transpose_col (v : m → α) : (Matrix.col v)ᵀ = Matrix.row v := by
  

Proof state:
l : Type u_1
m : Type u_2
n : Type u_3
o : Type u_4
R : Type u_5
α : Type v
β : Type w
v : m → α
⊢ (col v)ᵀ = row v

Next tactic:
ext
@[simp]
theorem transpose_col (v : m → α) : (Matrix.col v)ᵀ = Matrix.row v := by
  ext
  

Proof state:
case a.h
l : Type u_1
m : Type u_2
n : Type u_3
o : Type u_4
R : Type u_5
α : Type v
β : Type w
v : m → α
i✝ : Unit
x✝ : m
⊢ (col v)ᵀ i✝ x✝ = row v i✝ x✝

Next tactic:
rfl
@[simp]
theorem transpose_row (v : m → α) : (Matrix.row v)ᵀ = Matrix.col v := by
  

Proof state:
l : Type u_1
m : Type u_2
n : Type u_3
o : Type u_4
R : Type u_5
α : Type v
β : Type w
v : m → α
⊢ (row v)ᵀ = col v

Next tactic:
ext
@[simp]
theorem transpose_row (v : m → α) : (Matrix.row v)ᵀ = Matrix.col v := by
  ext
  

Proof state:
case a.h
l : Type u_1
m : Type u_2
n : Type u_3
o : Type u_4
R : Type u_5
α : Type v
β : Type w
v : m → α
i✝ : m
x✝ : Unit
⊢ (row v)ᵀ i✝ x✝ = col v i✝ x✝

Next tactic:
rfl
@[simp]
theorem conjTranspose_col [Star α] (v : m → α) : (col v)ᴴ = row (star v) := by
  

Proof state:
l : Type u_1
m : Type u_2
n : Type u_3
o : Type u_4
R : Type u_5
α : Type v
β : Type w
inst✝ : Star α
v : m → α
⊢ (col v)ᴴ = row (star v)

Next tactic:
ext
@[simp]
theorem conjTranspose_col [Star α] (v : m → α) : (col v)ᴴ = row (star v) := by
  ext
  

Proof state:
case a.h
l : Type u_1
m : Type u_2
n : Type u_3
o : Type u_4
R : Type u_5
α : Type v
β : Type w
inst✝ : Star α
v : m → α
i✝ : Unit
x✝ : m
⊢ (col v)ᴴ i✝ x✝ = row (star v) i✝ x✝

Next tactic:
rfl
@[simp]
theorem conjTranspose_row [Star α] (v : m → α) : (row v)ᴴ = col (star v) := by
  

Proof state:
l : Type u_1
m : Type u_2
n : Type u_3
o : Type u_4
R : Type u_5
α : Type v
β : Type w
inst✝ : Star α
v : m → α
⊢ (row v)ᴴ = col (star v)

Next tactic:
ext
@[simp]
theorem conjTranspose_row [Star α] (v : m → α) : (row v)ᴴ = col (star v) := by
  ext
  

Proof state:
case a.h
l : Type u_1
m : Type u_2
n : Type u_3
o : Type u_4
R : Type u_5
α : Type v
β : Type w
inst✝ : Star α
v : m → α
i✝ : m
x✝ : Unit
⊢ (row v)ᴴ i✝ x✝ = col (star v) i✝ x✝

Next tactic:
rfl
theorem row_vecMul [Fintype m] [NonUnitalNonAssocSemiring α] (M : Matrix m n α) (v : m → α) :
    Matrix.row (Matrix.vecMul v M) = Matrix.row v * M := by
  

Proof state:
l : Type u_1
m : Type u_2
n : Type u_3
o : Type u_4
R : Type u_5
α : Type v
β : Type w
inst✝¹ : Fintype m
inst✝ : NonUnitalNonAssocSemiring α
M : Matrix m n α
v : m → α
⊢ row (vecMul v M) = row v * M

Next tactic:
ext
theorem row_vecMul [Fintype m] [NonUnitalNonAssocSemiring α] (M : Matrix m n α) (v : m → α) :
    Matrix.row (Matrix.vecMul v M) = Matrix.row v * M := by
  ext
  

Proof state:
case a.h
l : Type u_1
m : Type u_2
n : Type u_3
o : Type u_4
R : Type u_5
α : Type v
β : Type w
inst✝¹ : Fintype m
inst✝ : NonUnitalNonAssocSemiring α
M : Matrix m n α
v : m → α
i✝ : Unit
x✝ : n
⊢ row (vecMul v M) i✝ x✝ = (row v * M) i✝ x✝

Next tactic:
rfl
theorem col_vecMul [Fintype m] [NonUnitalNonAssocSemiring α] (M : Matrix m n α) (v : m → α) :
    Matrix.col (Matrix.vecMul v M) = (Matrix.row v * M)ᵀ := by
  

Proof state:
l : Type u_1
m : Type u_2
n : Type u_3
o : Type u_4
R : Type u_5
α : Type v
β : Type w
inst✝¹ : Fintype m
inst✝ : NonUnitalNonAssocSemiring α
M : Matrix m n α
v : m → α
⊢ col (vecMul v M) = (row v * M)ᵀ

Next tactic:
ext
theorem col_vecMul [Fintype m] [NonUnitalNonAssocSemiring α] (M : Matrix m n α) (v : m → α) :
    Matrix.col (Matrix.vecMul v M) = (Matrix.row v * M)ᵀ := by
  ext
  

Proof state:
case a.h
l : Type u_1
m : Type u_2
n : Type u_3
o : Type u_4
R : Type u_5
α : Type v
β : Type w
inst✝¹ : Fintype m
inst✝ : NonUnitalNonAssocSemiring α
M : Matrix m n α
v : m → α
i✝ : n
x✝ : Unit
⊢ col (vecMul v M) i✝ x✝ = (row v * M)ᵀ i✝ x✝

Next tactic:
rfl
theorem col_mulVec [Fintype n] [NonUnitalNonAssocSemiring α] (M : Matrix m n α) (v : n → α) :
    Matrix.col (Matrix.mulVec M v) = M * Matrix.col v := by
  

Proof state:
l : Type u_1
m : Type u_2
n : Type u_3
o : Type u_4
R : Type u_5
α : Type v
β : Type w
inst✝¹ : Fintype n
inst✝ : NonUnitalNonAssocSemiring α
M : Matrix m n α
v : n → α
⊢ col (mulVec M v) = M * col v

Next tactic:
ext