AFTD Auto-Formalizing Theoretical Domains

good_slopes_affine_coordinates_form

theoremverified

The original slope form equals the affine-basis constant plus the two basis-direction coefficients times the affine coordinates.

Statement

theorem good_slopes_affine_coordinates_form {K : Type*} [Field K]
    (u v w z : K × K) (a : K)
    (hd : (v.1-u.1)*(w.2-u.2)-(w.1-u.1)*(v.2-u.2) ≠ 0) :
    z.2+a*z.1 = u.2+a*u.1 +
      (v.2-u.2+a*(v.1-u.1))*(good_slopes_affine_coordinates u v w z).1 +
      (w.2-u.2+a*(w.1-u.1))*(good_slopes_affine_coordinates u v w z).2
Source
Affine normalization for the finite-field direction argument in OP-1027.
Verified
15 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 1

The proof, explained

The theorem expresses the linear form z.2 + a * z.1 in terms of the affine coordinates of z relative to the origin u and basis vectors v - u and w - u. The proof first clears denominators in the Cramer's rule formulas for the two coordinates by multiplying each by the non-zero determinant D = (v.1 - u.1) * (w.2 - u.2) - (w.1 - u.1) * (v.2 - u.2). Injectivity of multiplication by D reduces the goal to the identity scaled by D, which is then verified by polynomial algebra combining the two cleared coordinate equations.

  1. The first affine coordinate of z, multiplied by the determinant D = (v.1 - u.1) * (w.2 - u.2) - (w.1 - u.1) * (v.2 - u.2), equals (w.2 - u.2) * (z.1 - u.1) - (w.1 - u.1) * (z.2 - u.2).

    Unfolding the definition of good_slopes_affine_coordinates, the first coordinate is given by the fraction ((w.2 - u.2) * (z.1 - u.1) - (w.1 - u.1) * (z.2 - u.2)) / D. Since D ≠ 0 by hypothesis hd, multiplying by D cancels the division using div_mul_cancel₀.

    lines 10–13

    uses div_mul_cancel₀

      have hx : (good_slopes_affine_coordinates u v w z).1 * ((v.1-u.1)*(w.2-u.2)-(w.1-u.1)*(v.2-u.2)) =
          (w.2-u.2)*(z.1-u.1)-(w.1-u.1)*(z.2-u.2) := by
        dsimp [good_slopes_affine_coordinates]
        exact div_mul_cancel₀ _ hd
  2. The second affine coordinate of z, multiplied by the determinant D, equals (v.1 - u.1) * (z.2 - u.2) - (v.2 - u.2) * (z.1 - u.1).

    Similarly, unfolding good_slopes_affine_coordinates, the second coordinate is ((v.1 - u.1) * (z.2 - u.2) - (v.2 - u.2) * (z.1 - u.1)) / D. Multiplying by D cancels the division via div_mul_cancel₀ using the assumption hd that D ≠ 0.

    lines 14–17

    uses div_mul_cancel₀

      have hy : (good_slopes_affine_coordinates u v w z).2 * ((v.1-u.1)*(w.2-u.2)-(w.1-u.1)*(v.2-u.2)) =
          (v.1-u.1)*(z.2-u.2)-(v.2-u.2)*(z.1-u.1) := by
        dsimp [good_slopes_affine_coordinates]
        exact div_mul_cancel₀ _ hd
  3. It suffices to prove the equality after multiplying both sides by the determinant D.

    Because the determinant D is non-zero (hd), left multiplication by D is an injection on K by mul_right_inj'. Applying the forward direction of this equivalence reduces the goal from L = R to D * L = D * R.

    line 18

    uses mul_right_inj'

      apply (mul_right_inj' hd).mp
  4. The scaled equality holds.

    In the scaled equation, the affine coordinates of z appear only through their products with D. Substituting the cleared formulas from hx and hy, both sides expand to identical polynomials in the coordinates of u, v, w, z and the scalar a; linear_combination completes the verification using the specified combination of hx and hy.

    line 19

      linear_combination -(v.2-u.2+a*(v.1-u.1))*hx - (w.2-u.2+a*(w.1-u.1))*hy
div_mul_cancel₀
In a group with zero (such as a field), for any elements a and b with b ≠ 0, (a / b) * b = a.
mul_right_inj'
If a ≠ 0, then a * b = a * c if and only if b = c; that is, left multiplication by a non-zero element is injective.

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 5000000set_option maxRecDepth 10000theorem good_slopes_affine_coordinates_form {K : Type*} [Field K]    (u v w z : K × K) (a : K)    (hd : (v.1-u.1)*(w.2-u.2)-(w.1-u.1)*(v.2-u.2) ≠ 0) :    z.2+a*z.1 = u.2+a*u.1 +      (v.2-u.2+a*(v.1-u.1))*(good_slopes_affine_coordinates u v w z).1 +      (w.2-u.2+a*(w.1-u.1))*(good_slopes_affine_coordinates u v w z).2 := by  have hx : (good_slopes_affine_coordinates u v w z).1 * ((v.1-u.1)*(w.2-u.2)-(w.1-u.1)*(v.2-u.2)) =      (w.2-u.2)*(z.1-u.1)-(w.1-u.1)*(z.2-u.2) := by    dsimp [good_slopes_affine_coordinates]    exact div_mul_cancel₀ _ hd  have hy : (good_slopes_affine_coordinates u v w z).2 * ((v.1-u.1)*(w.2-u.2)-(w.1-u.1)*(v.2-u.2)) =      (v.1-u.1)*(z.2-u.2)-(v.2-u.2)*(z.1-u.1) := by    dsimp [good_slopes_affine_coordinates]    exact div_mul_cancel₀ _ hd  apply (mul_right_inj' hd).mp  linear_combination -(v.2-u.2+a*(v.1-u.1))*hx - (w.2-u.2+a*(w.1-u.1))*hy
See it in the graphDiscuss this resultChallenge it