AFTD Auto-Formalizing Theoretical Domains

good_slopes_affine_slope_fractional_injective

theoremverified

Over a field, a fractional linear slope transformation associated with a nonzero two-by-two determinant is injective wherever both denominators are nonzero.

Statement

theorem good_slopes_affine_slope_fractional_injective {K : Type*} [Field K]
    (dxv dyv dxw dyw a b : K)
    (hd : dxv*dyw-dxw*dyv ≠ 0)
    (ha : dyw+a*dxw ≠ 0) (hb : dyw+b*dxw ≠ 0)
    (heq : (dyv+a*dxv)/(dyw+a*dxw) = (dyv+b*dxv)/(dyw+b*dxw)) : a = b
Source
Affine direction transport in the finite-field line argument for OP-1027.
Verified
15 Nov 2026
Axioms
Classical.choiceQuot.soundpropext

The proof, explained

The proof proceeds by clearing denominators and factoring. Cross-multiplying the equation (dyv + a * dxv) / (dyw + a * dxw) = (dyv + b * dxv) / (dyw + b * dxw), which is valid since both denominators are nonzero, yields an equality of products. Subtracting the two sides and factoring reveals that (a - b) * (dxv * dyw - dxw * dyv) = 0. Because the determinant factor is assumed nonzero and the base structure is a field, the factor a - b must be zero, which gives a = b.

  1. (dyv + a * dxv) * (dyw + b * dxw) = (dyv + b * dxv) * (dyw + a * dxw)

    Because both denominators dyw + a * dxw and dyw + b * dxw are nonzero (hypotheses ha and hb), the equality of fractions in heq is equivalent to the equality of their cross-multiplied products via div_eq_div_iff.

    lines 8–9

    uses div_eq_div_iff

      have hc : (dyv+a*dxv)*(dyw+b*dxw) = (dyv+b*dxv)*(dyw+a*dxw) :=
        (div_eq_div_iff ha hb).mp heq
  2. (a - b) * (dxv * dyw - dxw * dyv) = 0 automation

    Expanding the products on both sides of the cross-multiplication equation and subtracting them cancels the common terms dyv * dyw and a * b * dxv * dxw, leaving (a - b) * (dxv * dyw - dxw * dyv) = 0. The linear_combination tactic verifies this polynomial identity automatically from hc.

    line 10

      have hm : (a-b)*(dxv*dyw-dxw*dyv) = 0 := by linear_combination hc
  3. a = b

    In a field, if a product is zero, at least one of its factors is zero (mul_eq_zero.mp). Since the determinant factor dxv * dyw - dxw * dyv is nonzero by hd, the first factor must be zero (resolve_right), so a - b = 0. From a - b = 0, it follows that a = b (sub_eq_zero.mp).

    line 11

    uses mul_eq_zero.mp, resolve_right, sub_eq_zero.mp

      exact sub_eq_zero.mp ((mul_eq_zero.mp hm).resolve_right hd)
div_eq_div_iff
Two fractions a / b and c / d with nonzero denominators b ≠ 0 and d ≠ 0 are equal if and only if their cross-products are equal: a * d = c * b.
mul_eq_zero.mp
If a product of two elements in a domain or field equals zero, then at least one of the factors must be zero.
resolve_right
If a disjunction P ∨ Q holds and Q is false (¬Q), then P must be true.
sub_eq_zero.mp
If the difference x - y = 0, then x = y.

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

set_option maxHeartbeats 5000000theorem good_slopes_affine_slope_fractional_injective {K : Type*} [Field K]    (dxv dyv dxw dyw a b : K)    (hd : dxv*dyw-dxw*dyv ≠ 0)    (ha : dyw+a*dxw ≠ 0) (hb : dyw+b*dxw ≠ 0)    (heq : (dyv+a*dxv)/(dyw+a*dxw) = (dyv+b*dxv)/(dyw+b*dxw)) : a = b := by  have hc : (dyv+a*dxv)*(dyw+b*dxw) = (dyv+b*dxv)*(dyw+a*dxw) :=    (div_eq_div_iff ha hb).mp heq  have hm : (a-b)*(dxv*dyw-dxw*dyv) = 0 := by linear_combination hc  exact sub_eq_zero.mp ((mul_eq_zero.mp hm).resolve_right hd)
See it in the graphDiscuss this resultChallenge it