AFTD Auto-Formalizing Theoretical Domains

affine_func_at_most_one_root

theoremverified

A nonzero affine function t ↦ a + b * t with b ≠ 0 has at most one real root.

Statement

theorem affine_func_at_most_one_root (a b : ℝ) (hb : b ≠ 0) (s : Finset ℝ)
    (hs : ∀ t ∈ s, a + b * t = 0) : s.card ≤ 1
Source
folklore
Verified
08 Nov 2026
Axioms
Classical.choiceQuot.soundpropext

Read back from the Lean

For all real numbers $a$ and $b$ such that $b \neq 0$, and for any finite set $s$ of real numbers, if $a + b \cdot t = 0$ for every $t \in s$, then the cardinality of $s$ is at most 1.

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

A finite set has at most one element if and only if any two of its elements are equal. To prove this for the set of roots s, we take two arbitrary roots t₁, t₂ ∈ s, both satisfying a + b * t = 0. Equating these expressions yields b * t₁ = b * t₂, and canceling the nonzero factor b gives t₁ = t₂.

  1. It suffices to show that any two roots t₁, t₂ ∈ s are equal.

    By Finset.card_le_one_iff, a finite set has cardinality at most 1 if and only if any two of its elements are equal. We introduce two arbitrary elements t₁, t₂ ∈ s and their membership proofs ht₁, ht₂.

    lines 4–5

    uses Finset.card_le_one_iff

      rw [Finset.card_le_one_iff]
      intro t₁ t₂ ht₁ ht₂
  2. It suffices to show that b * t₁ = b * t₂.

    Since b ≠ 0 by assumption hb, the cancellation rule mul_left_cancel₀ allows us to cancel b on the left, reducing the goal t₁ = t₂ to b * t₁ = b * t₂.

    line 6

    uses mul_left_cancel₀

      apply mul_left_cancel₀ hb
  3. b * t₁ = b * t₂, which completes the proof. automation

    Evaluating the root condition hs at t₁ and t₂ yields a + b * t₁ = 0 and a + b * t₂ = 0. Linear arithmetic (linarith) over ℝ immediately deduces b * t₁ = b * t₂ from these two equations.

    line 7

      linarith [hs t₁ ht₁, hs t₂ ht₂]
Finset.card_le_one_iff
A finite set has cardinality at most 1 if and only if any two of its elements are equal.
mul_left_cancel₀
Multiplication on the left by a nonzero element is injective: if a ≠ 0 and a * b = a * c, then b = c.

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

/-- A nonzero affine function has at most one real root. -/theorem affine_func_at_most_one_root (a b : ℝ) (hb : b ≠ 0) (s : Finset ℝ)    (hs : ∀ t ∈ s, a + b * t = 0) : s.card ≤ 1 := by  rw [Finset.card_le_one_iff]  intro t₁ t₂ ht₁ ht₂  apply mul_left_cancel₀ hb  linarith [hs t₁ ht₁, hs t₂ ht₂]
See it in the graphDiscuss this resultChallenge it