good_slopes_affine_coordinates_form
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
- good_slopes_affine_coordinatesCoordinates in the affine basis determined by three points, using the inverse of their two-by-two difference matrix.
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.
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₀.
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
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.
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
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.
uses
mul_right_inj'apply (mul_right_inj' hd).mpThe 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.
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.
- The linear_combination tactic automatically verifies the ring equality by expanding both sides and confirming that the difference simplifies to zero using the prescribed combination of hx and hy.
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
Choose a tactic — a marked line — to see the goals Lean had before and after it, as in Lean’s infoview. Step with ← → or j k.
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