Module docstring
{"# Lemmas about units in ℤ, which interact with the order structure.
"}
{"# Lemmas about units in ℤ, which interact with the order structure.
"}
Int.isUnit_iff_abs_eq
      theorem
     {x : ℤ} : IsUnit x ↔ abs x = 1
        theorem isUnit_iff_abs_eq {x : ℤ} : IsUnitIsUnit x ↔ abs x = 1 := by
  rw [isUnit_iff_natAbs_eq, abs_eq_natAbs, ← Int.ofNat_one, natCast_inj]
        Int.isUnit_sq
      theorem
     {a : ℤ} (ha : IsUnit a) : a ^ 2 = 1
        theorem isUnit_sq {a : ℤ} (ha : IsUnit a) : a ^ 2 = 1 := by rw [sq, isUnit_mul_self ha]
        Int.units_sq
      theorem
     (u : ℤˣ) : u ^ 2 = 1
        @[simp]
theorem units_sq (u : ℤℤˣ) : u ^ 2 = 1 := by
  rw [Units.ext_iff, Units.val_pow_eq_pow_val, Units.val_one, isUnit_sq u.isUnit]
        Int.units_mul_self
      theorem
     (u : ℤˣ) : u * u = 1
        @[simp]
theorem units_mul_self (u : ℤℤˣ) : u * u = 1 := by rw [← sq, units_sq]
        Int.units_inv_eq_self
      theorem
     (u : ℤˣ) : u⁻¹ = u
        @[simp]
theorem units_inv_eq_self (u : ℤℤˣ) : u⁻¹ = u := by rw [inv_eq_iff_mul_eq_one, units_mul_self]
        Int.units_div_eq_mul
      theorem
     (u₁ u₂ : ℤˣ) : u₁ / u₂ = u₁ * u₂
        theorem units_div_eq_mul (u₁ u₂ : ℤℤˣ) : u₁ / u₂ = u₁ * u₂ := by
  rw [div_eq_mul_inv, units_inv_eq_self]
        Int.units_coe_mul_self
      theorem
     (u : ℤˣ) : (u * u : ℤ) = 1
        @[simp]
theorem units_coe_mul_self (u : ℤℤˣ) : (u * u : ℤ) = 1 := by
  rw [← Units.val_mul, units_mul_self, Units.val_one]
        Int.neg_one_pow_ne_zero
      theorem
     {n : ℕ} : (-1 : ℤ) ^ n ≠ 0
        theorem neg_one_pow_ne_zero {n : ℕ} : (-1 : ℤ) ^ n ≠ 0 := by simp
        Int.sq_eq_one_of_sq_lt_four
      theorem
     {x : ℤ} (h1 : x ^ 2 < 4) (h2 : x ≠ 0) : x ^ 2 = 1
        theorem sq_eq_one_of_sq_lt_four {x : ℤ} (h1 : x ^ 2 < 4) (h2 : x ≠ 0) : x ^ 2 = 1 :=
  sq_eq_one_iff.mpr
    ((abs_eq (zero_le_one' ℤ)).mp
      (le_antisymm (lt_add_one_iff.mp (abs_lt_of_sq_lt_sq h1 zero_le_two))
        (sub_one_lt_iff.mp (abs_pos.mpr h2))))
        Int.sq_eq_one_of_sq_le_three
      theorem
     {x : ℤ} (h1 : x ^ 2 ≤ 3) (h2 : x ≠ 0) : x ^ 2 = 1
        theorem sq_eq_one_of_sq_le_three {x : ℤ} (h1 : x ^ 2 ≤ 3) (h2 : x ≠ 0) : x ^ 2 = 1 :=
  sq_eq_one_of_sq_lt_four (lt_of_le_of_lt h1 (lt_add_one (3 : ℤ))) h2
        Int.units_pow_eq_pow_mod_two
      theorem
     (u : ℤˣ) (n : ℕ) : u ^ n = u ^ (n % 2)
        theorem units_pow_eq_pow_mod_two (u : ℤℤˣ) (n : ℕ) : u ^ n = u ^ (n % 2) := by
  conv =>
    lhs
    rw [← Nat.mod_add_div n 2]
    rw [pow_add, pow_mul, units_sq, one_pow, mul_one]