AFTD Auto-Formalizing Theoretical Domains

stein_param_maps_to

theoremverified

The map sending (d, u, v) to d^2 * (u^4 + 4 * v^4) maps each triple in stein_param_set to an integer satisfying is_stein_number.

Statement

theorem stein_param_maps_to :
    Set.MapsTo (fun (d, u, v) => d^2 * (u^4 + 4 * v^4)) stein_param_set {n | is_stein_number n}
Source
arXiv:2611.05898, Theorem 2.2
Verified
06 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 5
  • stein_param_setThe set of triples (d, u, v) of positive natural numbers such that u is odd, mu_star d holds, and d * (u^2 - 2 * v^2)^2 ≤ 4 * u * v…
  • is_stein_numberA positive integer n is an E. P. Stein number if, with m = Nat.sqrt n, both n - m^2 and n + m^2 are positive squares.
  • mu_starA natural number d satisfies mu_star if for every prime number p with p ≠ 2, p^2 does not divide d.
  • LinearOrder.toTotalPreorderEvery LinearOrder is a TotalPreorder.
  • TotalPreorderA total preorder: a preorder where ≤ is total (complete). This is weaker than LinearOrder — it does NOT require antisymmetry or…

Read back from the Lean

For every triple of natural numbers $(d, u, v) \in \mathbb{N} \times \mathbb{N} \times \mathbb{N}$ in stein_param_set—that is, satisfying: 1. $d > 0$, $u > 0$, and $v > 0$, 2. $u$ is odd, 3. $d$ is not divisible by the square of any odd prime (mu_star d), and 4. $d(u^2 - 2v^2)^2 \le 4uv$ (evaluated in the integers $\mathbb{Z}$)— the natural number $n = d^2(u^4 + 4v^4)$ is a Stein number (is_stein_number n), meaning: 1. $n > 0$, 2. $n - \lfloor\sqrt{n}\rfloor^2 > 0$ and $n - \lfloor\sqrt{n}\rfloor^2$ is a perfect square in $\mathbb{N}$, and 3. $n + \lfloor\sqrt{n}\rfloor^2 > 0$ and $n + \lfloor\sqrt{n}\rfloor^2$ is a perfect square in $\mathbb{N}$.

Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.

The proof, explained

To show that n = d^2(u^4 + 4v^4) is a Stein number, the proof decomposes n as m^2 + k where m = 2duv and k = (d |u^2 - 2v^2|)^2. Parity considerations show that u^2 - 2v^2 ≠ 0, ensuring k > 0, while the condition on admissible triples ensures k ≤ 2m, forcing the integer square root ⌊√n⌋ to be exactly m. Consequently, n - ⌊√n⌋^2 = k is a positive square, and the algebraic identity n + ⌊√n⌋^2 = (d(u^2 + 2v^2))^2 shows that the sum is also a positive square.

  1. Let (d, u, v) be an admissible triple in stein_param_set, and define m = 2duv, diff = u^2 - 2v^2, k = (d * |diff|)^2, and n = d^2 * (u^4 + 4v^4).

    We unpack the triple (d, u, v) and its admissibility conditions (d > 0, u > 0, v > 0, u odd, mu_star d, and d(u^2 - 2v^2)^2 ≤ 4uv). Unfolding the definition of is_stein_number, we introduce auxiliary definitions for the candidate integer square root m, the signed difference diff in ℤ, the remainder k, and the number n.

    lines 4–9

      rintro ⟨d, u, v⟩ ⟨hd, hu, hv, hodd, hmu, hle⟩
      dsimp [is_stein_number]
      let m := 2 * d * u * v
      let diff := (u : ℤ)^2 - 2 * (v : ℤ)^2
      let k := (d * diff.natAbs)^2
      let n := d^2 * (u^4 + 4 * v^4)
  2. n = m^2 + k

    We verify the algebraic identity in ℤ by injecting the naturals into the integers via Nat.cast_inj, rewriting (d * |diff|)^2 to d^2 * diff^2 using mul_pow and sq_abs, and using polynomial ring equivalence to see that d^2(u^4 + 4v^4) = (2duv)^2 + d^2(u^2 - 2v^2)^2.

    lines 10–16

    uses Nat.cast_inj, mul_pow, sq_abs

      have hn_eq : n = m^2 + k := by
        apply (@Nat.cast_inj ℤ).mp
        dsimp [m, k, n]
        push_cast
        simp only [mul_pow, sq_abs]
        dsimp [diff]
        ring
  3. diff ≠ 0

    Suppose diff = 0; then u^2 = 2v^2 in ℤ. Since u is odd, Int.odd_coe_nat and Odd.pow imply that u^2 is odd. However, 2v^2 is even by even_two_mul. Since an integer cannot be both even and odd by Int.not_even_iff_odd, this is a contradiction.

    lines 17–24

    uses Odd.pow, Int.odd_coe_nat, even_two_mul, Int.not_even_iff_odd

      have hdiff : diff ≠ 0 := by
        intro h
        have h_eq : (u : ℤ)^2 = 2 * (v : ℤ)^2 := by linear_combination h
        have h_odd : Odd ((u : ℤ)^2) := Odd.pow ((Int.odd_coe_nat u).mpr hodd)
        have h_even : Even (2 * (v : ℤ)^2) := even_two_mul _
        rw [h_eq] at h_odd
        rw [← Int.not_even_iff_odd] at h_odd
        exact h_odd h_even
  4. k > 0

    Since diff ≠ 0, its absolute value |diff| is strictly positive by Int.natAbs_pos.mpr. Because d > 0, the product d * |diff| is positive by Nat.mul_pos, and therefore its square k is strictly positive by Nat.pow_pos.

    lines 25–29

    uses Int.natAbs_pos.mpr, Nat.mul_pos, Nat.pow_pos

      have hk_pos : 0 < k := by
        have h_abs_pos : 0 < diff.natAbs := Int.natAbs_pos.mpr hdiff
        have h_mul_pos : 0 < d * diff.natAbs := Nat.mul_pos hd h_abs_pos
        dsimp [k]
        exact Nat.pow_pos h_mul_pos
  5. k ≤ 2 * m

    Multiplying the parameter inequality d * diff^2 ≤ 4uv by d ≥ 0 preserves the inequality by mul_le_mul_of_nonneg_left. In the integers, this states k ≤ 2m, which translates back to ℕ using Nat.cast_le.

    lines 30–44

    uses mul_le_mul_of_nonneg_left, Nat.cast_le, mul_pow, sq_abs

      have hk_le : k ≤ 2 * m := by
        have hd_pos : 0 ≤ (d : ℤ) := by positivity
        have h_mul := mul_le_mul_of_nonneg_left hle hd_pos
        apply (@Nat.cast_le ℤ).mp
        push_cast
        have hk_cast : (k : ℤ) = (d : ℤ) * ((d : ℤ) * diff^2) := by
          dsimp [k]
          push_cast
          simp only [mul_pow, sq_abs]
          ring
        have hm_cast : 2 * (m : ℤ) = (d : ℤ) * (4 * (u : ℤ) * (v : ℤ)) := by
          dsimp [m]
          ring
        rw [hk_cast, hm_cast]
        exact h_mul
  6. n.sqrt = m

    Since n = m^2 + k and k ≤ 2m = m + m, the integer square root of m^2 + k is equal to m by Nat.sqrt_add_eq'.

    lines 45–48

    uses Nat.sqrt_add_eq'

      have h_sqrt : n.sqrt = m := by
        rw [hn_eq]
        have h2m : k ≤ m + m := by linarith
        exact Nat.sqrt_add_eq' m h2m
  7. n > 0

    Since n = m^2 + k and k ≤ m^2 + k by Nat.le_add_left, combining this with k > 0 via lt_of_lt_of_le shows that n > 0.

    lines 49–51

    uses lt_of_lt_of_le, Nat.le_add_left

      have hn_pos : 0 < n := by
        rw [hn_eq]
        exact lt_of_lt_of_le hk_pos (Nat.le_add_left k (m^2))
  8. n - n.sqrt^2 = k

    Substituting n.sqrt = m and n = m^2 + k, the expression simplifies to (m^2 + k) - m^2 = k by Nat.add_sub_cancel_left.

    lines 52–53

    uses Nat.add_sub_cancel_left

      have hn_sub : n - n.sqrt^2 = k := by
        rw [h_sqrt, hn_eq, Nat.add_sub_cancel_left]
  9. n + n.sqrt^2 = (d * (u^2 + 2 * v^2))^2

    Substituting n.sqrt = m, the expression becomes d^2(u^4 + 4v^4) + (2duv)^2, which factors as (d(u^2 + 2v^2))^2 by polynomial ring arithmetic.

    lines 54–57

      have hn_add : n + n.sqrt^2 = (d * (u^2 + 2 * v^2))^2 := by
        rw [h_sqrt]
        dsimp [n, m]
        ring
  10. n is an E. P. Stein number

    We confirm each clause of is_stein_number: n > 0 was already shown; n - n.sqrt^2 = k is strictly positive and is the square of d * |diff| by IsSquare.sq; and n + n.sqrt^2 = (d(u^2 + 2v^2))^2 is strictly positive by Nat.pow_pos and is a square by IsSquare.sq.

    lines 58–68

    uses IsSquare.sq, Nat.pow_pos

      refine ⟨hn_pos, ?_, ?_, ?_, ?_⟩
      · rw [hn_sub]
        exact hk_pos
      · rw [hn_sub]
        dsimp [k]
        exact IsSquare.sq (d * diff.natAbs)
      · rw [hn_add]
        have h_pos' : 0 < d * (u^2 + 2 * v^2) := by positivity
        exact Nat.pow_pos h_pos'
      · rw [hn_add]
        exact IsSquare.sq (d * (u^2 + 2 * v^2))
Nat.cast_inj
Two natural numbers are equal if and only if their cast images into a characteristic zero semiring (such as the integers) are equal.
mul_pow
The power of a product is the product of the powers: (a * b)^n = a^n * b^n.
sq_abs
The square of the absolute value of a real or integer number equals the square of that number: |a|^2 = a^2.
Odd.pow
Any natural power of an odd number is odd.
Int.odd_coe_nat
A natural number is odd if and only if its integer coercion is odd.
even_two_mul
Twice any element is even.
Int.not_even_iff_odd
An integer is not even if and only if it is odd.
Int.natAbs_pos.mpr
A non-zero integer has a strictly positive absolute value.
Nat.mul_pos
The product of two strictly positive natural numbers is strictly positive.
Nat.pow_pos
Any power of a strictly positive natural number is strictly positive.
mul_le_mul_of_nonneg_left
Multiplying an inequality on the left by a non-negative element preserves the inequality.
Nat.cast_le
An inequality m ≤ n between natural numbers holds if and only if it holds between their integer coercions.
Nat.sqrt_add_eq'
If a natural number a satisfies a ≤ 2n, then the integer square root of n^2 + a is n.
lt_of_lt_of_le
Strict inequality is transitive with non-strict inequality: if a < b and b ≤ c, then a < c.
Nat.le_add_left
Any natural number n is less than or equal to m + n.
Nat.add_sub_cancel_left
For natural numbers n and m, subtracting n from n + m leaves m.
IsSquare.sq
The square of any element is a square.

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

/-- The parameterization map sends each admissible triple in stein_param_set to an E. P. Stein number. -/theorem stein_param_maps_to :    Set.MapsTo (fun (d, u, v) => d^2 * (u^4 + 4 * v^4)) stein_param_set {n | is_stein_number n} := by  rintro ⟨d, u, v⟩ ⟨hd, hu, hv, hodd, hmu, hle⟩  dsimp [is_stein_number]  let m := 2 * d * u * v  let diff := (u : ℤ)^2 - 2 * (v : ℤ)^2  let k := (d * diff.natAbs)^2  let n := d^2 * (u^4 + 4 * v^4)  have hn_eq : n = m^2 + k := by    apply (@Nat.cast_inj ℤ).mp    dsimp [m, k, n]    push_cast    simp only [mul_pow, sq_abs]    dsimp [diff]    ring  have hdiff : diff ≠ 0 := by    intro h    have h_eq : (u : ℤ)^2 = 2 * (v : ℤ)^2 := by linear_combination h    have h_odd : Odd ((u : ℤ)^2) := Odd.pow ((Int.odd_coe_nat u).mpr hodd)    have h_even : Even (2 * (v : ℤ)^2) := even_two_mul _    rw [h_eq] at h_odd    rw [← Int.not_even_iff_odd] at h_odd    exact h_odd h_even  have hk_pos : 0 < k := by    have h_abs_pos : 0 < diff.natAbs := Int.natAbs_pos.mpr hdiff    have h_mul_pos : 0 < d * diff.natAbs := Nat.mul_pos hd h_abs_pos    dsimp [k]    exact Nat.pow_pos h_mul_pos  have hk_le : k ≤ 2 * m := by    have hd_pos : 0 ≤ (d : ℤ) := by positivity    have h_mul := mul_le_mul_of_nonneg_left hle hd_pos    apply (@Nat.cast_le ℤ).mp    push_cast    have hk_cast : (k : ℤ) = (d : ℤ) * ((d : ℤ) * diff^2) := by      dsimp [k]      push_cast      simp only [mul_pow, sq_abs]      ring    have hm_cast : 2 * (m : ℤ) = (d : ℤ) * (4 * (u : ℤ) * (v : ℤ)) := by      dsimp [m]      ring    rw [hk_cast, hm_cast]    exact h_mul  have h_sqrt : n.sqrt = m := by    rw [hn_eq]    have h2m : k ≤ m + m := by linarith    exact Nat.sqrt_add_eq' m h2m  have hn_pos : 0 < n := by    rw [hn_eq]    exact lt_of_lt_of_le hk_pos (Nat.le_add_left k (m^2))  have hn_sub : n - n.sqrt^2 = k := by    rw [h_sqrt, hn_eq, Nat.add_sub_cancel_left]  have hn_add : n + n.sqrt^2 = (d * (u^2 + 2 * v^2))^2 := by    rw [h_sqrt]    dsimp [n, m]    ring  refine ⟨hn_pos, ?_, ?_, ?_, ?_⟩  · rw [hn_sub]    exact hk_pos  · rw [hn_sub]    dsimp [k]    exact IsSquare.sq (d * diff.natAbs)  · rw [hn_add]    have h_pos' : 0 < d * (u^2 + 2 * v^2) := by positivity    exact Nat.pow_pos h_pos'  · rw [hn_add]    exact IsSquare.sq (d * (u^2 + 2 * v^2))
See it in the graphDiscuss this resultChallenge it