AFTD Auto-Formalizing Theoretical Domains

unit_first_offset_two_not_zero

theoremverified

In ZMod n with n > 2, doubling any unit u yields a nonzero element u + u ≠ 0.

Statement

theorem unit_first_offset_two_not_zero (n : ℕ) [NeZero n] (hn : 2 < n)
    (u : ZMod n) (hu : IsUnit u) : u + u ≠ 0
Source
step towards unit_first_fixed_offset_mean_probe_maximum
Verified
01 Nov 2026
Axioms
Quot.soundpropext

The proof, explained

We proceed by contradiction: assume u + u = 0 for a unit u in ZMod n. Rewriting this as 2 * u = 0 allows us to cancel the unit u, yielding 2 = 0 in ZMod n. Since ZMod n has characteristic n, this implies that n divides 2, so n ≤ 2. This directly contradicts the assumption that n > 2.

  1. Assuming for contradiction that u + u = 0, we obtain 2 * u = 0 in ZMod n.

    We assume the negation u + u = 0 (h). Rewriting the multiplication by 2 using ring arithmetic gives 2 * u = u + u, which equals 0 by our assumption.

    lines 4–7

      intro h
      have h2 : (2 : ZMod n) * u = 0 := by
        calc (2 : ZMod n) * u = u + u := by ring
        _ = 0 := h
  2. 2 = 0 in ZMod n.

    Because u is assumed to be a unit (hu), multiplication by u on the right reflects zero via IsUnit.mul_left_eq_zero: 2 * u = 0 implies 2 = 0.

    line 8

    uses IsUnit.mul_left_eq_zero

      have h3 : (2 : ZMod n) = 0 := (IsUnit.mul_left_eq_zero hu).mp h2
  3. n divides 2 in the natural numbers.

    The ring ZMod n has characteristic n. By CharP.cast_eq_zero_iff, the integer 2 maps to 0 in ZMod n if and only if n divides 2.

    line 9

    uses CharP.cast_eq_zero_iff

      have hdvd : n ∣ 2 := (CharP.cast_eq_zero_iff (ZMod n) n 2).mp h3
  4. n ≤ 2.

    Since 2 > 0 (checked by decide) and n ∣ 2, Nat.le_of_dvd implies that n ≤ 2.

    line 10

    uses Nat.le_of_dvd

      have hle : n ≤ 2 := Nat.le_of_dvd (by decide) hdvd
  5. A contradiction is reached, proving u + u ≠ 0.

    Linear arithmetic (omega) finishes the proof by observing that n ≤ 2 directly contradicts the hypothesis 2 < n.

    line 11

      omega
IsUnit.mul_left_eq_zero
In a monoid with zero, if b is a unit, then a * b = 0 if and only if a = 0.
CharP.cast_eq_zero_iff
In an additive monoid with one of characteristic p, the natural cast of x is 0 if and only if p divides x.
Nat.le_of_dvd
If n is a positive natural number and m divides n, then m ≤ n.

Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.

Lean source view module on GitHub

/-- In ZMod n with n > 2, doubling any unit yields a nonzero element. -/theorem unit_first_offset_two_not_zero (n : ℕ) [NeZero n] (hn : 2 < n)    (u : ZMod n) (hu : IsUnit u) : u + u ≠ 0 := by  intro h  have h2 : (2 : ZMod n) * u = 0 := by    calc (2 : ZMod n) * u = u + u := by ring    _ = 0 := h  have h3 : (2 : ZMod n) = 0 := (IsUnit.mul_left_eq_zero hu).mp h2  have hdvd : n ∣ 2 := (CharP.cast_eq_zero_iff (ZMod n) n 2).mp h3  have hle : n ≤ 2 := Nat.le_of_dvd (by decide) hdvd  omega
See it in the graphDiscuss this resultChallenge it