good_slopes_prime5_three_unit_directions_line
Five points in the plane over the field of five elements have injective forms y+ax for every nonzero a other than b, where b is nonzero. If y+bx fails to be injective, it is constant on the five points.
Statement
theorem good_slopes_prime5_three_unit_directions_line (S : Finset (ZMod 5 × ZMod 5)) (b : ZMod 5) (hcard : S.card = 5) (hb : IsUnit b) (hgood : ∀ a : ZMod 5, IsUnit a → a ≠ b → Set.InjOn (fun p : ZMod 5 × ZMod 5 => p.2 + a*p.1) S) (hbad : ¬ Set.InjOn (fun p : ZMod 5 × ZMod 5 => p.2 + b*p.1) S) : ∃ t : ZMod 5, ∀ p ∈ S, p.2 + b*p.1 = t
- Source
- Five-point slice step for OP-1027.
- Verified
- 18 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 1
- good_slopes_prime5_anchored_lineA set of five points over the field with five elements that contains (0,0) and (1,4), and on which y+2x, y+3x and y+4x are injective, lies…
The proof, explained
The theorem establishes that if five points in the plane over $\mathbb{Z}/5\mathbb{Z}$ have injective linear projections along every unit direction except $b$, and the projection along $b$ fails to be injective, then all five points must lie on a line of direction $-b$. Finding two distinct points that collide under $y + bx$, the proof constructs an invertible affine coordinate transformation sending these points to $(0,0)$ and $(1,4)$. This transformation preserves the five-point set and transfers the injectivity of the other slopes to $y + 2x$, $y + 3x$, and $y + 4x$. An anchored rigidity lemma then forces all five transformed points to lie on $y + x = 0$, which inverts to show that the original points all share the same value of $y + bx$.
In $\mathbb{Z}/5\mathbb{Z}$, the elements 2, 3, and 4 are distinct from 0 and 1. automation
Direct finite calculation in the five-element field confirms that each of 2, 3, and 4 is neither 0 nor 1.
theorem good_slopes_prime5_three_unit_directions_line_two_ne_zero : (2 : ZMod 5) ≠ 0 := by decide theorem good_slopes_prime5_three_unit_directions_line_three_ne_zero : (3 : ZMod 5) ≠ 0 := by decide theorem good_slopes_prime5_three_unit_directions_line_four_ne_zero : (4 : ZMod 5) ≠ 0 := by decide theorem good_slopes_prime5_three_unit_directions_line_two_ne_one : (2 : ZMod 5) ≠ 1 := by decide theorem good_slopes_prime5_three_unit_directions_line_three_ne_one : (3 : ZMod 5) ≠ 1 := by decide theorem good_slopes_prime5_three_unit_directions_line_four_ne_one : (4 : ZMod 5) ≠ 1 := by decide
There exist two distinct points $p_0, p_1 \in S$ on which $y + bx$ takes the same value, and their $x$-coordinates differ ($u = p_1.1 - p_0.1 \neq 0$).
Since $\mathbb{Z}/5\mathbb{Z}$ is a field of prime characteristic and $b$ is a unit, $b \neq 0$. By non-injectivity of $y + bx$ on $S$, there exist distinct points $p_0, p_1 \in S$ with $p_0.2 + b p_0.1 = p_1.2 + b p_1.1$. If their $x$-coordinates were equal ($u = 0$), the equality of the linear form would force their $y$-coordinates to be equal as well, contradicting $p_0 \neq p_1$. Hence $u \neq 0$, which also implies $bu \neq 0$.
uses
Finset.mem_coe,sub_eq_zero.mp,add_right_cancel,mul_ne_zerohave : Fact (Nat.Prime 5) := ⟨by norm_num⟩ have hb0 : b ≠ 0 := hb.ne_zero dsimp [Set.InjOn] at hbad push Not at hbad rcases hbad with ⟨p0, hp0, p1, hp1, heq, hne⟩ rw [Finset.mem_coe] at hp0 hp1 set u := p1.1 - p0.1 with hu_def have hu : u ≠ 0 := by intro h have hx : p1.1 = p0.1 := sub_eq_zero.mp h have hy : p1.2 = p0.2 := by have := heq.symm rw [hx] at this exact add_right_cancel this apply hne ext · exact hx.symm · exact hy.symm have hbu : b * u ≠ 0 := mul_ne_zero hb0 hu
The affine coordinate transformation $f(p) = (u^{-1}(p.1 - p_0.1), (bu)^{-1}(p.2 - p_0.2))$ is injective.
Because $u \neq 0$ and $bu \neq 0$ in the field $\mathbb{Z}/5\mathbb{Z}$, their inverses are nonzero. Multiplying by a nonzero scalar and translating by a constant vector are both injective operations, so $f$ is injective.
uses
inv_ne_zero,mul_left_cancel₀,sub_left_inj.mpset f : ZMod 5 × ZMod 5 → ZMod 5 × ZMod 5 := fun p => (u⁻¹ * (p.1 - p0.1), (b * u)⁻¹ * (p.2 - p0.2)) with hf_def have hf_inj : Function.Injective f := by intro p q h dsimp [f] at h injection h with h1 h2 have hu' : u⁻¹ ≠ 0 := inv_ne_zero hu have hbu' : (b * u)⁻¹ ≠ 0 := inv_ne_zero hbu have h1' := mul_left_cancel₀ hu' h1 have h2' := mul_left_cancel₀ hbu' h2 ext · exact sub_left_inj.mp h1' · exact sub_left_inj.mp h2'
The image set $S' = f(S)$ has cardinality 5 and contains $(0, 0)$ and $(1, 4)$.
Evaluating $f$ shows $f(p_0) = (0, 0)$. For $p_1$, the first coordinate is $u^{-1} u = 1$, and since $p_1.2 - p_0.2 = -b(p_1.1 - p_0.1) = -(bu)$, the second coordinate is $(bu)^{-1}(-(bu)) = -1 \equiv 4 \pmod 5$, so $f(p_1) = (1, 4)$. Because $f$ is injective, the image $S' = f(S)$ has the same size 5 as $S$, and contains both $(0,0)$ and $(1,4)$.
uses
inv_mul_cancel₀,mul_neg,Finset.card_image_of_injective,Finset.mem_image_of_memhave hfp0 : f p0 = (0, 0) := by ext <;> dsimp [f] <;> simp have hfp1 : f p1 = (1, 4) := by ext · dsimp [f] rw [← hu_def, inv_mul_cancel₀ hu] · dsimp [f] have h : p1.2 - p0.2 = - (b * u) := by calc p1.2 - p0.2 = - (b * (p1.1 - p0.1)) := by linear_combination -heq _ = - (b * u) := by rw [hu_def] rw [h, mul_neg, inv_mul_cancel₀ hbu] rfl set S' := S.image f with hS'_def have hcard' : S'.card = 5 := by rw [hS'_def, Finset.card_image_of_injective S hf_inj, hcard] have h0 : (0, 0) ∈ S' := by rw [← hfp0] exact Finset.mem_image_of_mem f hp0 have h1 : (1, 4) ∈ S' := by rw [← hfp1] exact Finset.mem_image_of_mem f hp1
For every $c \in \{2, 3, 4\}$, the linear form $y + cx$ is injective on $S'$.
For any $c \in \{2, 3, 4\}$, $c \neq 0$ and $c \neq 1$, so $a = bc$ is a unit in $\mathbb{Z}/5\mathbb{Z}$ distinct from $b$. By hypothesis, $y + ax$ is injective on $S$. An algebraic calculation shows that $(bu)((f(r)).2 + c(f(r)).1) = (r.2 + ar.1) - (p_0.2 + ap_0.1)$. Thus two points in $S'$ with the same value under $y + cx$ come from preimages in $S$ with the same value under $y + ax$, which must be equal by injectivity on $S$.
uses
good_slopes_prime5_three_unit_directions_line_two_ne_zero,good_slopes_prime5_three_unit_directions_line_three_ne_zero,good_slopes_prime5_three_unit_directions_line_four_ne_zero,good_slopes_prime5_three_unit_directions_line_two_ne_one,good_slopes_prime5_three_unit_directions_line_three_ne_one,good_slopes_prime5_three_unit_directions_line_four_ne_one,isUnit_iff_ne_zero,mul_ne_zero,mul_one,mul_left_cancel₀,Finset.mem_coe,Finset.mem_image,mul_add,mul_assoc,mul_inv_cancel₀,one_mul,sub_left_inj.mphave h_form_inj (c : ZMod 5) (hc : c = 2 ∨ c = 3 ∨ c = 4) : Set.InjOn (fun (p : ZMod 5 × ZMod 5) => p.2 + c * p.1) S' := by have hc0 : c ≠ 0 := by rcases hc with rfl | rfl | rfl · exact good_slopes_prime5_three_unit_directions_line_two_ne_zero · exact good_slopes_prime5_three_unit_directions_line_three_ne_zero · exact good_slopes_prime5_three_unit_directions_line_four_ne_zero have hc1 : c ≠ 1 := by rcases hc with rfl | rfl | rfl · exact good_slopes_prime5_three_unit_directions_line_two_ne_one · exact good_slopes_prime5_three_unit_directions_line_three_ne_one · exact good_slopes_prime5_three_unit_directions_line_four_ne_one have ha_unit : IsUnit (b * c) := by rw [isUnit_iff_ne_zero] exact mul_ne_zero hb0 hc0 have ha_ne : b * c ≠ b := by intro h have hbc : b * c = b * 1 := by rw [h, mul_one] have := mul_left_cancel₀ hb0 hbc exact hc1 this have h_inj := hgood (b * c) ha_unit ha_ne intro P hP Q hQ h_eval rw [Finset.mem_coe, Finset.mem_image] at hP hQ rcases hP with ⟨p, hp, rfl⟩ rcases hQ with ⟨q, hq, rfl⟩ dsimp at h_eval have h_eq (r : ZMod 5 × ZMod 5) : (b * u) * ((f r).2 + c * (f r).1) = (r.2 + (b * c) * r.1) - (p0.2 + (b * c) * p0.1) := by dsimp [f] rw [mul_add, ← mul_assoc (b * u), mul_inv_cancel₀ hbu, one_mul] have : (b * u) * (c * (u⁻¹ * (r.1 - p0.1))) = (b * c) * (r.1 - p0.1) := by calc (b * u) * (c * (u⁻¹ * (r.1 - p0.1))) _ = (b * c) * (u * u⁻¹) * (r.1 - p0.1) := by ring _ = (b * c) * 1 * (r.1 - p0.1) := by rw [mul_inv_cancel₀ hu] _ = (b * c) * (r.1 - p0.1) := by ring rw [this] ring have h1 : (b * u) * ((f p).2 + c * (f p).1) = (b * u) * ((f q).2 + c * (f q).1) := by rw [h_eval] rw [h_eq p, h_eq q] at h1 have h2 : p.2 + (b * c) * p.1 = q.2 + (b * c) * q.1 := sub_left_inj.mp h1 have hpq : p = q := h_inj hp hq h2 rw [hpq]
The linear forms $y + 2x$, $y + 3x$, and $y + 4x$ are injective on $S'$.
Specialising the previous claim to $c = 2$, $c = 3$, and $c = 4$ proves each of the three forms is injective on $S'$.
uses
Or.inl,Or.inrhave h2 : Set.InjOn (fun (p : ZMod 5 × ZMod 5) => p.2 + 2 * p.1) S' := h_form_inj 2 (Or.inl rfl) have h3 : Set.InjOn (fun (p : ZMod 5 × ZMod 5) => p.2 + 3 * p.1) S' := h_form_inj 3 (Or.inr (Or.inl rfl)) have h4 : Set.InjOn (fun (p : ZMod 5 × ZMod 5) => p.2 + 4 * p.1) S' := h_form_inj 4 (Or.inr (Or.inr rfl))
The linear form $y + bx$ is constant on $S$, identically equal to $p_0.2 + b p_0.1$.
Applying the anchored line lemma `good_slopes_prime5_anchored_line` to $S'$ shows that every point in $S'$ satisfies $y + x = 0$. For any $p \in S$, its image $f(p) \in S'$ therefore satisfies $(f(p)).2 + (f(p)).1 = 0$. By the coordinate identity $(bu)((f(p)).2 + 1 \cdot (f(p)).1) = (p.2 + bp.1) - (p_0.2 + bp_0.1)$, the left side is zero, forcing $p.2 + bp.1 = p_0.2 + bp_0.1$. Hence $y + bx$ takes the single value $t = p_0.2 + bp_0.1$ across all of $S$.
uses
good_slopes_prime5_anchored_line,Finset.mem_image_of_mem,mul_add,mul_assoc,mul_inv_cancel₀,one_mul,mul_one,mul_zero,sub_eq_zero.mphave h_line := good_slopes_prime5_anchored_line S' hcard' h0 h1 h2 h3 h4 use p0.2 + b * p0.1 intro p hp have hfp_mem : f p ∈ S' := Finset.mem_image_of_mem f hp have h_zero := h_line (f p) hfp_mem have h_eq : (b * u) * ((f p).2 + 1 * (f p).1) = (p.2 + (b * 1) * p.1) - (p0.2 + (b * 1) * p0.1) := by dsimp [f] rw [mul_add, ← mul_assoc (b * u), mul_inv_cancel₀ hbu, one_mul] have : (b * u) * (1 * (u⁻¹ * (p.1 - p0.1))) = (b * 1) * (p.1 - p0.1) := by calc (b * u) * (1 * (u⁻¹ * (p.1 - p0.1))) _ = (b * 1) * (u * u⁻¹) * (p.1 - p0.1) := by ring _ = (b * 1) * 1 * (p.1 - p0.1) := by rw [mul_inv_cancel₀ hu] _ = (b * 1) * (p.1 - p0.1) := by ring rw [this] ring rw [mul_one] at h_eq have h_f_zero : ((f p).2 + 1 * (f p).1) = 0 := by calc ((f p).2 + 1 * (f p).1) _ = (f p).2 + (f p).1 := by rw [one_mul] _ = 0 := h_zero rw [h_f_zero, mul_zero] at h_eq exact sub_eq_zero.mp h_eq.symm
Finset.mem_coe- Membership in a finset is equivalent to membership in its coerced set.
sub_eq_zero.mp- If $a - b = 0$, then $a = b$.
add_right_cancel- In an additive group, if $a + c = b + c$, then $a = b$.
mul_ne_zero- In a structure without zero divisors, the product of two nonzero elements is nonzero.
inv_ne_zero- In a group with zero, the inverse of a nonzero element is nonzero.
mul_left_cancel₀- In a structure with zero and no zero divisors, if $a \neq 0$ and $a \cdot b = a \cdot c$, then $b = c$.
sub_left_inj.mp- If $a - c = b - c$, then $a = b$.
inv_mul_cancel₀- For any nonzero element $a$, $a^{-1} \cdot a = 1$.
mul_neg- Multiplication distributes over negation: $a \cdot (-b) = -(a \cdot b)$.
Finset.card_image_of_injective- An injective function preserves the cardinality of a finite set.
Finset.mem_image_of_mem- If $x \in S$, then $f(x) \in f(S)$.
good_slopes_prime5_three_unit_directions_line_two_ne_zero- In $\mathbb{Z}/5\mathbb{Z}$, the residue 2 is nonzero.
good_slopes_prime5_three_unit_directions_line_three_ne_zero- In $\mathbb{Z}/5\mathbb{Z}$, the residue 3 is nonzero.
good_slopes_prime5_three_unit_directions_line_four_ne_zero- In $\mathbb{Z}/5\mathbb{Z}$, the residue 4 is nonzero.
good_slopes_prime5_three_unit_directions_line_two_ne_one- In $\mathbb{Z}/5\mathbb{Z}$, $2 \neq 1$.
good_slopes_prime5_three_unit_directions_line_three_ne_one- In $\mathbb{Z}/5\mathbb{Z}$, $3 \neq 1$.
good_slopes_prime5_three_unit_directions_line_four_ne_one- In $\mathbb{Z}/5\mathbb{Z}$, $4 \neq 1$.
isUnit_iff_ne_zero- In a group with zero, an element is a unit if and only if it is nonzero.
mul_one- Multiplying an element by 1 leaves it unchanged: $a \cdot 1 = a$.
Finset.mem_image- An element $y$ is in the image $f(S)$ if and only if $y = f(x)$ for some $x \in S$.
mul_add- Multiplication distributes over addition: $a(b + c) = ab + ac$.
mul_assoc- Multiplication is associative: $(a \cdot b) \cdot c = a \cdot (b \cdot c)$.
mul_inv_cancel₀- For any nonzero element $a$, $a \cdot a^{-1} = 1$.
one_mul- Multiplying 1 by an element leaves it unchanged: $1 \cdot a = a$.
Or.inl- From a proof of $A$, infer $A \lor B$.
Or.inr- From a proof of $B$, infer $A \lor B$.
good_slopes_prime5_anchored_line- If a 5-element subset $S \subseteq (\mathbb{Z}/5\mathbb{Z})^2$ contains $(0,0)$ and $(1,4)$, and the forms $y+2x$, $y+3x$, and $y+4x$ are injective on $S$, then every point in $S$ satisfies $y+x=0$.
mul_zero- Multiplying any element by zero gives zero: $a \cdot 0 = 0$.
- The rigidity lemma `good_slopes_prime5_anchored_line`, proved separately in the knowledge base, supplies the key step that any 5-element configuration containing $(0,0)$ and $(1,4)$ with injective forms of slopes 2, 3, and 4 must lie on the line $y + x = 0$.
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.
theorem good_slopes_prime5_three_unit_directions_line_two_ne_zero : (2 : ZMod 5) ≠ 0 := by decidetheorem good_slopes_prime5_three_unit_directions_line_three_ne_zero : (3 : ZMod 5) ≠ 0 := by decidetheorem good_slopes_prime5_three_unit_directions_line_four_ne_zero : (4 : ZMod 5) ≠ 0 := by decidetheorem good_slopes_prime5_three_unit_directions_line_two_ne_one : (2 : ZMod 5) ≠ 1 := by decidetheorem good_slopes_prime5_three_unit_directions_line_three_ne_one : (3 : ZMod 5) ≠ 1 := by decidetheorem good_slopes_prime5_three_unit_directions_line_four_ne_one : (4 : ZMod 5) ≠ 1 := by decidetheorem good_slopes_prime5_three_unit_directions_line (S : Finset (ZMod 5 × ZMod 5)) (b : ZMod 5) (hcard : S.card = 5) (hb : IsUnit b) (hgood : ∀ a : ZMod 5, IsUnit a → a ≠ b → Set.InjOn (fun p : ZMod 5 × ZMod 5 => p.2 + a*p.1) S) (hbad : ¬ Set.InjOn (fun p : ZMod 5 × ZMod 5 => p.2 + b*p.1) S) : ∃ t : ZMod 5, ∀ p ∈ S, p.2 + b*p.1 = t := by have : Fact (Nat.Prime 5) := ⟨by norm_num⟩ have hb0 : b ≠ 0 := hb.ne_zero dsimp [Set.InjOn] at hbad push Not at hbad rcases hbad with ⟨p0, hp0, p1, hp1, heq, hne⟩ rw [Finset.mem_coe] at hp0 hp1 set u := p1.1 - p0.1 with hu_def have hu : u ≠ 0 := by intro h have hx : p1.1 = p0.1 := sub_eq_zero.mp h have hy : p1.2 = p0.2 := by have := heq.symm rw [hx] at this exact add_right_cancel this apply hne ext · exact hx.symm · exact hy.symm have hbu : b * u ≠ 0 := mul_ne_zero hb0 hu set f : ZMod 5 × ZMod 5 → ZMod 5 × ZMod 5 := fun p => (u⁻¹ * (p.1 - p0.1), (b * u)⁻¹ * (p.2 - p0.2)) with hf_def have hf_inj : Function.Injective f := by intro p q h dsimp [f] at h injection h with h1 h2 have hu' : u⁻¹ ≠ 0 := inv_ne_zero hu have hbu' : (b * u)⁻¹ ≠ 0 := inv_ne_zero hbu have h1' := mul_left_cancel₀ hu' h1 have h2' := mul_left_cancel₀ hbu' h2 ext · exact sub_left_inj.mp h1' · exact sub_left_inj.mp h2' have hfp0 : f p0 = (0, 0) := by ext <;> dsimp [f] <;> simp have hfp1 : f p1 = (1, 4) := by ext · dsimp [f] rw [← hu_def, inv_mul_cancel₀ hu] · dsimp [f] have h : p1.2 - p0.2 = - (b * u) := by calc p1.2 - p0.2 = - (b * (p1.1 - p0.1)) := by linear_combination -heq _ = - (b * u) := by rw [hu_def] rw [h, mul_neg, inv_mul_cancel₀ hbu] rfl set S' := S.image f with hS'_def have hcard' : S'.card = 5 := by rw [hS'_def, Finset.card_image_of_injective S hf_inj, hcard] have h0 : (0, 0) ∈ S' := by rw [← hfp0] exact Finset.mem_image_of_mem f hp0 have h1 : (1, 4) ∈ S' := by rw [← hfp1] exact Finset.mem_image_of_mem f hp1 have h_form_inj (c : ZMod 5) (hc : c = 2 ∨ c = 3 ∨ c = 4) : Set.InjOn (fun (p : ZMod 5 × ZMod 5) => p.2 + c * p.1) S' := by have hc0 : c ≠ 0 := by rcases hc with rfl | rfl | rfl · exact good_slopes_prime5_three_unit_directions_line_two_ne_zero · exact good_slopes_prime5_three_unit_directions_line_three_ne_zero · exact good_slopes_prime5_three_unit_directions_line_four_ne_zero have hc1 : c ≠ 1 := by rcases hc with rfl | rfl | rfl · exact good_slopes_prime5_three_unit_directions_line_two_ne_one · exact good_slopes_prime5_three_unit_directions_line_three_ne_one · exact good_slopes_prime5_three_unit_directions_line_four_ne_one have ha_unit : IsUnit (b * c) := by rw [isUnit_iff_ne_zero] exact mul_ne_zero hb0 hc0 have ha_ne : b * c ≠ b := by intro h have hbc : b * c = b * 1 := by rw [h, mul_one] have := mul_left_cancel₀ hb0 hbc exact hc1 this have h_inj := hgood (b * c) ha_unit ha_ne intro P hP Q hQ h_eval rw [Finset.mem_coe, Finset.mem_image] at hP hQ rcases hP with ⟨p, hp, rfl⟩ rcases hQ with ⟨q, hq, rfl⟩ dsimp at h_eval have h_eq (r : ZMod 5 × ZMod 5) : (b * u) * ((f r).2 + c * (f r).1) = (r.2 + (b * c) * r.1) - (p0.2 + (b * c) * p0.1) := by dsimp [f] rw [mul_add, ← mul_assoc (b * u), mul_inv_cancel₀ hbu, one_mul] have : (b * u) * (c * (u⁻¹ * (r.1 - p0.1))) = (b * c) * (r.1 - p0.1) := by calc (b * u) * (c * (u⁻¹ * (r.1 - p0.1))) _ = (b * c) * (u * u⁻¹) * (r.1 - p0.1) := by ring _ = (b * c) * 1 * (r.1 - p0.1) := by rw [mul_inv_cancel₀ hu] _ = (b * c) * (r.1 - p0.1) := by ring rw [this] ring have h1 : (b * u) * ((f p).2 + c * (f p).1) = (b * u) * ((f q).2 + c * (f q).1) := by rw [h_eval] rw [h_eq p, h_eq q] at h1 have h2 : p.2 + (b * c) * p.1 = q.2 + (b * c) * q.1 := sub_left_inj.mp h1 have hpq : p = q := h_inj hp hq h2 rw [hpq] have h2 : Set.InjOn (fun (p : ZMod 5 × ZMod 5) => p.2 + 2 * p.1) S' := h_form_inj 2 (Or.inl rfl) have h3 : Set.InjOn (fun (p : ZMod 5 × ZMod 5) => p.2 + 3 * p.1) S' := h_form_inj 3 (Or.inr (Or.inl rfl)) have h4 : Set.InjOn (fun (p : ZMod 5 × ZMod 5) => p.2 + 4 * p.1) S' := h_form_inj 4 (Or.inr (Or.inr rfl)) have h_line := good_slopes_prime5_anchored_line S' hcard' h0 h1 h2 h3 h4 use p0.2 + b * p0.1 intro p hp have hfp_mem : f p ∈ S' := Finset.mem_image_of_mem f hp have h_zero := h_line (f p) hfp_mem have h_eq : (b * u) * ((f p).2 + 1 * (f p).1) = (p.2 + (b * 1) * p.1) - (p0.2 + (b * 1) * p0.1) := by dsimp [f] rw [mul_add, ← mul_assoc (b * u), mul_inv_cancel₀ hbu, one_mul] have : (b * u) * (1 * (u⁻¹ * (p.1 - p0.1))) = (b * 1) * (p.1 - p0.1) := by calc (b * u) * (1 * (u⁻¹ * (p.1 - p0.1))) _ = (b * 1) * (u * u⁻¹) * (p.1 - p0.1) := by ring _ = (b * 1) * 1 * (p.1 - p0.1) := by rw [mul_inv_cancel₀ hu] _ = (b * 1) * (p.1 - p0.1) := by ring rw [this] ring rw [mul_one] at h_eq have h_f_zero : ((f p).2 + 1 * (f p).1) = 0 := by calc ((f p).2 + 1 * (f p).1) _ = (f p).2 + (f p).1 := by rw [one_mul] _ = 0 := h_zero rw [h_f_zero, mul_zero] at h_eq exact sub_eq_zero.mp h_eq.symm