good_slopes_fiber35_unit_gap
For any 35 points over the residues modulo 35, if at least one unit direction fails to be injective, then at most 20 of the 24 unit directions are injective.
Statement
theorem good_slopes_fiber35_unit_gap (S : Finset (ZMod 35 × ZMod 35)) (hcard : S.card = 35) (hbad : ∃ a : ZMod 35, IsUnit a ∧ a ∉ good_slopes_point_directions 35 S) : (good_slopes_point_directions 35 S).card ≤ 20- Source
- A point-fiber strengthening of the two-prime gap used for OP-1027; related work arXiv:2611.01465, Theorem 8.3. Exhaustive constraint model recorded as experiment 21999.
- Verified
- 11 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 7
- good_slopes_point_directionsThe unit directions a for which the linear form y + a x is injective on a finite set of points over the residues modulo n.
- 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…
- good_slopes_prime7_anchored_lineLet e be one of 2, 3, 4, 5, 6. A set of seven points over the field with seven elements that contains (0,0) and (1,6), and on which y+ax…
- good_slopes_prime7_five_on_lineLet S be a finite set of points over the field with seven elements. If it contains a point off y+x=0 and three distinct directions chosen…
- good_slopes_injective_product_fiber_cardIf an injective map on a finite set of size |Y| times |Z| takes values in Y times Z, then each fiber of its first coordinate has |Z|…
- good_slopes_fiber35_anchored_neighborsA point set over residues modulo 35 containing (0,0) and (1,34) cannot have six or more injective and surjective directions among 6, 8,…
- good_slopes_fiber35_bad_neighborsFor any 35 points modulo 35 and any bad unit direction, at least three of its eight unit directions sharing a residue modulo 5 or modulo 7…
- Used by 1
- good_slopes_two_row_fiber_rigidityLet X be a finite set of 105 elements with input and output coordinate functions over Z/3 and Z/35, and assume the pair of input…
The proof, explained
The theorem shows that for any 35-point set S in (ZMod 35)^2, if at least one unit direction fails to be injective, then at most 20 of the 24 unit directions are injective. Assuming for contradiction that more than 20 are injective limits the number of bad unit directions to at most 3. Given a bad unit direction a0, there exist distinct points p, q in S that collide along a0, giving difference vector d = q - p with d2 = -(a0 * d1). If d1 is not a unit, a finite-ring calculation (Gs35Gap.nonunit_four) forces at least 4 bad unit directions, an immediate contradiction. If d1 is a unit, an affine coordinate change normalizes the points to (0, 0) and (1, 34), where a structural result (good_slopes_fiber35_anchored_neighbors) rules out having at most 3 bad unit directions.
An element x of ZMod 35 is a unit if and only if it belongs to the explicit finset U35 of the 24 residues coprime to 35.
Rewriting with isUnit_iff_exists_inv rephrases invertibility as the existence of an inverse, which is then verified for all residues by exhaustive evaluation (decide).
uses
isUnit_iff_exists_invnamespace Gs35Gap def U35 : Finset (ZMod 35) := {1,2,3,4,6,8,9,11,12,13,16,17,18,19,22,23,24,26,27,29,31,32,33,34} theorem isUnit_iff_U (x : ZMod 35) : IsUnit x ↔ x ∈ U35 := by rw [isUnit_iff_exists_inv]; revert x; decide
For any unit a0 and any nonzero nonunit d1 in ZMod 35, there are at least 4 units b in U35 satisfying -(a0 * d1) + b * d1 = 0.
This lower bound on the number of solutions is verified by exhaustive computation (decide) over all elements of the finite ring ZMod 35.
theorem nonunit_four : ∀ a0 ∈ U35, ∀ d1 : ZMod 35, d1 ∉ U35 → d1 ≠ 0 → 4 ≤ (U35.filter (fun b => -(a0 * d1) + b * d1 = 0)).card := by decide
We verify by computation the basic auxiliary facts on ZMod 35: the 8-element candidate set is contained in U35, 1 is not in that set, and -1 = 34.
The subset relation eight_sub, the non-membership one_not_eight, and the arithmetic identity neg_one_eq are each proved by finite decidable computation (decide).
theorem eight_sub : ({6,8,11,16,22,26,29,31} : Finset (ZMod 35)) ⊆ U35 := by decide theorem one_not_eight : (1 : ZMod 35) ∉ ({6,8,11,16,22,26,29,31} : Finset (ZMod 35)) := by decide theorem neg_one_eq : (-1 : ZMod 35) = 34 := by decide end Gs35Gap
We assume for contradiction that strictly more than 20 unit directions are good, and obtain a witness bad unit direction a0.
We proceed by contradiction (hlt), assuming that the number of good directions is strictly greater than 20. The hypothesis hbad supplies a unit direction a0 that fails to be a good direction for S.
theorem good_slopes_fiber35_unit_gap (S : Finset (ZMod 35 × ZMod 35)) (hcard : S.card = 35) (hbad : ∃ a : ZMod 35, IsUnit a ∧ a ∉ good_slopes_point_directions 35 S) : (good_slopes_point_directions 35 S).card ≤ 20 := by classical by_contra hlt push Not at hlt obtain ⟨a0, ha0u, ha0⟩ := hbad
A direction a is good for S if and only if a is a unit and the projection p ↦ p.2 + a * p.1 is injective on S.
Unfolding the definition of good_slopes_point_directions shows that membership requires a to be a unit and the linear combination map to be injective on S.
have hmem : ∀ a, a ∈ good_slopes_point_directions 35 S ↔ IsUnit a ∧ Set.InjOn (fun p : ZMod 35 × ZMod 35 => p.2 + a * p.1) S := by intro a; unfold good_slopes_point_directions; simp
Any set B of bad unit directions for S has cardinality at most 3.
Every element of B is a unit, so B ⊆ U35 by Gs35Gap.isUnit_iff_U. By hmem, every good direction is a unit in U35 \ B (Finset.mem_sdiff). Therefore, the number of good directions is at most |U35 \ B| = 24 - |B| by Finset.card_le_card and Finset.card_sdiff_of_subset. Since there are strictly more than 20 good directions, linear arithmetic (omega) forces |B| ≤ 3.
uses
Gs35Gap.isUnit_iff_U,Finset.mem_sdiff,Finset.card_le_card,Finset.card_sdiff_of_subset-- four bad unit directions are impossible have key : ∀ B : Finset (ZMod 35), (∀ b ∈ B, IsUnit b ∧ ¬ Set.InjOn (fun p : ZMod 35 × ZMod 35 => p.2 + b * p.1) S) → B.card ≤ 3 := by intro B hB have hBU : B ⊆ Gs35Gap.U35 := fun b hb => (Gs35Gap.isUnit_iff_U b).1 (hB b hb).1 have hsub : good_slopes_point_directions 35 S ⊆ Gs35Gap.U35 \ B := by intro a ha rw [hmem] at ha rw [Finset.mem_sdiff] exact ⟨(Gs35Gap.isUnit_iff_U a).1 ha.1, fun hb => (hB a hb).2 ha.2⟩ have h1 := Finset.card_le_card hsub rw [Finset.card_sdiff_of_subset hBU] at h1 have : Gs35Gap.U35.card = 24 := by decide omega
There exist two distinct points p, q ∈ S that collide along direction a0.
Because a0 is a unit that is not in the set of good directions, the map (x, y) ↦ y + a0 * x cannot be injective on S. Negating injectivity yields distinct points p, q ∈ S with p.2 + a0 * p.1 = q.2 + a0 * q.1.
have hni : ¬ Set.InjOn (fun p : ZMod 35 × ZMod 35 => p.2 + a0 * p.1) S := by intro h; exact ha0 ((hmem a0).2 ⟨ha0u, h⟩) obtain ⟨p, hp, q, hq, hpq, hne⟩ : ∃ p ∈ S, ∃ q ∈ S, p.2 + a0 * p.1 = q.2 + a0 * q.1 ∧ p ≠ q := by simp only [Set.InjOn, not_forall] at hni obtain ⟨p, hp, q, hq, h, hne⟩ := hni exact ⟨p, hp, q, hq, h, hne⟩
The difference vector d = q - p satisfies d2 = -(a0 * d1), and any direction b with d2 + b * d1 = 0 is non-injective on S.
Rearranging the equality p.2 + a0 * p.1 = q.2 + a0 * q.1 gives d2 = -(a0 * d1). If a direction b satisfies d2 + b * d1 = 0, then evaluating the projection map on p and q gives the same value, proving that the map along direction b collapses the distinct points p and q.
set d1 := q.1 - p.1 with hd1 set d2 := q.2 - p.2 with hd2 have hd : d2 = -(a0 * d1) := by rw [hd1, hd2]; linear_combination -hpq have bad_of : ∀ b, d2 + b * d1 = 0 → ¬ Set.InjOn (fun p : ZMod 35 × ZMod 35 => p.2 + b * p.1) S := by intro b hb hinj exact hne (hinj hp hq (by simp only; rw [hd1, hd2] at hb; linear_combination -hb))
We split into cases based on whether the first coordinate difference d1 is a unit in ZMod 35.
We perform a case analysis on IsUnit d1: either d1 is invertible modulo 35, or it is a nonunit.
by_cases hu1 : IsUnit d1When d1 is a unit, d2 is also a unit, and s = d1⁻¹ and r = -d2⁻¹ are units satisfying s * d1 = 1 and r * d2 = -1.
Because a0 and d1 are units, their product and its negation d2 = -(a0 * d1) are units. The scaled inverses s = d1⁻¹ and r = -d2⁻¹ satisfy s * d1 = 1 and r * d2 = -1 via ZMod.mul_inv_of_unit and ring arithmetic (mul_comm, neg_mul). Since they possess inverses, s and r are units by isUnit_iff_exists_inv.
uses
ZMod.mul_inv_of_unit,mul_comm,neg_mul,isUnit_iff_exists_inv,mul_neg,neg_neg· -- normalise the collision to (0,0), (1,34) have hd2u : IsUnit d2 := by rw [hd]; exact (ha0u.mul hu1).neg set s := d1⁻¹ with hs set r := -d2⁻¹ with hr have hsd : s * d1 = 1 := by rw [hs, mul_comm]; exact ZMod.mul_inv_of_unit d1 hu1 have hrd : r * d2 = -1 := by rw [hr, neg_mul, mul_comm, ZMod.mul_inv_of_unit d2 hd2u] have hsu : IsUnit s := isUnit_iff_exists_inv.2 ⟨d1, hsd⟩ have hru : IsUnit r := isUnit_iff_exists_inv.2 ⟨-d2, by rw [mul_neg, hrd, neg_neg]⟩
An affine transformation φ maps S injectively to a set S' of 35 points containing (0, 0) and (1, 34).
We define φ(u) = (s * (u.1 - p.1), r * (u.2 - p.2)). Because s and r are units, multiplication by them is cancellable, making φ an injective function (Prod.ext). The transformed set S' = φ(S) has size 35 (Finset.card_image_of_injective). Moreover, φ(p) = (0, 0) and φ(q) = (s * d1, r * d2) = (1, -1) = (1, 34) by Gs35Gap.neg_one_eq.
uses
Prod.ext,Finset.card_image_of_injective,Gs35Gap.neg_one_eqlet φ : ZMod 35 × ZMod 35 → ZMod 35 × ZMod 35 := fun u => (s * (u.1 - p.1), r * (u.2 - p.2)) have hφ : Function.Injective φ := by intro u v h simp only [φ, Prod.mk.injEq] at h have e1 := hsu.mul_left_cancel h.1 have e2 := hru.mul_left_cancel h.2 exact Prod.ext (by linear_combination e1) (by linear_combination e2) set S' := S.image φ with hS' have hcard' : S'.card = 35 := by rw [hS', Finset.card_image_of_injective _ hφ, hcard] have h0 : ((0 : ZMod 35), (0 : ZMod 35)) ∈ S' := Finset.mem_image.2 ⟨p, hp, by simp [φ]⟩ have h1 : ((1 : ZMod 35), (34 : ZMod 35)) ∈ S' := Finset.mem_image.2 ⟨q, hq, by simp only [φ, Prod.mk.injEq] refine ⟨?_, ?_⟩ · rw [← hd1]; exact hsd · rw [← hd2, hrd, Gs35Gap.neg_one_eq]⟩
If a direction b is non-injective on S', then the direction a0 * b is non-injective on S.
For any point w, expanding φ(w).2 + b * φ(w).1 gives r * (w.2 + (a0 * b) * w.1) minus a constant offset, using the identity r * a0 = s (which follows from mul_assoc and canceling the unit d1). Since r is invertible, any collision between points in S' under direction b pulls back to a collision between the original points in S under direction a0 * b.
uses
mul_assoc,neg_neg-- a direction b bad on S' gives the direction a0 * b bad on S have transfer : ∀ b, ¬ Set.InjOn (fun p : ZMod 35 × ZMod 35 => p.2 + b * p.1) S' → ¬ Set.InjOn (fun p : ZMod 35 × ZMod 35 => p.2 + (a0 * b) * p.1) S := by intro b hb hinj apply hb intro u' hu' v' hv' huv obtain ⟨u, hu, rfl⟩ := Finset.mem_image.1 hu' obtain ⟨v, hv, rfl⟩ := Finset.mem_image.1 hv' have hrel : ∀ w : ZMod 35 × ZMod 35, (φ w).2 + b * (φ w).1 = r * (w.2 + (a0 * b) * w.1) - (r * p.2 + b * s * p.1) := by intro w simp only [φ] have hrs : r * a0 = s := by have : r * a0 * d1 = s * d1 := by rw [hsd, mul_assoc, ← neg_neg (a0 * d1), ← hd, mul_neg, hrd, neg_neg] exact hu1.mul_right_cancel this linear_combination (-(b * w.1)) * hrs have e : r * (u.2 + (a0 * b) * u.1) = r * (v.2 + (a0 * b) * v.1) := by have := huv; simp only at this; rw [hrel u, hrel v] at this; linear_combination this rw [hinj hu hv (hru.mul_left_cancel e)]
The anchored configuration S' leads to a contradiction via good_slopes_fiber35_anchored_neighbors.
We apply good_slopes_fiber35_anchored_neighbors to S' with the predicate g(a) being injectivity on S'. Injective maps on S' are surjective by counting, since |S'| = 35 = |ZMod 35| (Finset.eq_univ_of_card, Finset.card_image_of_injOn, ZMod.card, Finset.mem_univ). Furthermore, among any three distinct directions a, b, c in {6, 8, 11, 16, 22, 26, 29, 31}, not all three can fail injectivity: if they did, together with direction 1 (which collapses (0, 0) and (1, 34)), they would give 4 bad directions on S' (Finset.card_insert_of_notMem, Finset.card_eq_three, Gs35Gap.one_not_eight). Transferring them gives 4 distinct bad unit directions a0 * {1, a, b, c} on S (Gs35Gap.eight_sub, isUnit_one, Finset.card_image_of_injective), contradicting the key lemma that any set of bad unit directions has size at most 3.
uses
good_slopes_fiber35_anchored_neighbors,Finset.eq_univ_of_card,Finset.card_image_of_injOn,ZMod.card,Finset.mem_univ,Finset.card_insert_of_notMem,Finset.card_eq_three,Gs35Gap.one_not_eight,isUnit_one,Gs35Gap.eight_sub,Gs35Gap.isUnit_iff_U,Finset.card_image_of_injectiveapply good_slopes_fiber35_anchored_neighbors S' (fun a => Set.InjOn (fun p : ZMod 35 × ZMod 35 => p.2 + a * p.1) S') h0 h1 · intro a _ ha; exact ha · intro a _ ha t have himg : S'.image (fun p : ZMod 35 × ZMod 35 => p.2 + a * p.1) = Finset.univ := by apply Finset.eq_univ_of_card rw [Finset.card_image_of_injOn ha, hcard', ZMod.card] have ht : t ∈ S'.image (fun p : ZMod 35 × ZMod 35 => p.2 + a * p.1) := by rw [himg]; exact Finset.mem_univ t obtain ⟨x, hx, hxt⟩ := Finset.mem_image.1 ht exact ⟨x, hx, hxt⟩ · intro a b c ha hb hc hab hac hbc by_contra hall push Not at hall obtain ⟨hga, hgb, hgc⟩ := hall have hT : (insert (1 : ZMod 35) ({a, b, c} : Finset (ZMod 35))).card = 4 := by rw [Finset.card_insert_of_notMem, Finset.card_eq_three.2 ⟨a, b, c, hab, hac, hbc, rfl⟩] intro h1m simp only [Finset.mem_insert, Finset.mem_singleton] at h1m rcases h1m with h | h | h <;> [exact Gs35Gap.one_not_eight (h ▸ ha); exact Gs35Gap.one_not_eight (h ▸ hb); exact Gs35Gap.one_not_eight (h ▸ hc)] have hB := key ((insert (1 : ZMod 35) ({a, b, c} : Finset (ZMod 35))).image (a0 * ·)) (by intro x hx obtain ⟨y, hy, rfl⟩ := Finset.mem_image.1 hx simp only [Finset.mem_insert, Finset.mem_singleton] at hy have hyu : IsUnit y := by rcases hy with rfl | rfl | rfl | rfl · exact isUnit_one · exact (Gs35Gap.isUnit_iff_U _).2 (Gs35Gap.eight_sub ha) · exact (Gs35Gap.isUnit_iff_U _).2 (Gs35Gap.eight_sub hb) · exact (Gs35Gap.isUnit_iff_U _).2 (Gs35Gap.eight_sub hc) refine ⟨ha0u.mul hyu, ?_⟩ rcases hy with rfl | rfl | rfl | rfl · simpa using hni · exact transfer _ hga · exact transfer _ hgb · exact transfer _ hgc) rw [Finset.card_image_of_injective _ ha0u.mul_right_injective, hT] at hB omega
When d1 is a nonunit, at least 4 bad unit directions exist on S, contradicting the key lemma.
If d1 were 0, then d2 = -(a0 * 0) = 0 (mul_zero, neg_zero), forcing p = q (Prod.ext), a contradiction; so d1 ≠ 0. By Gs35Gap.nonunit_four, for unit a0 and nonzero nonunit d1, there are at least 4 units b ∈ U35 satisfying -(a0 * d1) + b * d1 = 0 (Finset.mem_filter). Since d2 = -(a0 * d1), each such b satisfies d2 + b * d1 = 0 and is therefore a bad direction on S. This yields a set of at least 4 bad unit directions, contradicting the key lemma's upper bound of 3.
uses
mul_zero,neg_zero,Prod.ext,Gs35Gap.nonunit_four,Gs35Gap.isUnit_iff_U,Finset.mem_filter· -- a nonunit difference: four bad directions at once have hd10 : d1 ≠ 0 := by intro h0 apply hne have h2 : d2 = 0 := by rw [hd, h0, mul_zero, neg_zero] exact Prod.ext (by linear_combination -h0) (by linear_combination -h2) have h4 := Gs35Gap.nonunit_four a0 ((Gs35Gap.isUnit_iff_U a0).1 ha0u) d1 (fun h => hu1 ((Gs35Gap.isUnit_iff_U d1).2 h)) hd10 have := key (Gs35Gap.U35.filter (fun b => -(a0 * d1) + b * d1 = 0)) (by intro b hb rw [Finset.mem_filter] at hb exact ⟨(Gs35Gap.isUnit_iff_U b).2 hb.1, bad_of b (by rw [hd]; exact hb.2)⟩) omega
isUnit_iff_exists_inv- An element a is a unit if and only if there exists b such that a * b = 1.
Gs35Gap.isUnit_iff_U- An element of ZMod 35 is a unit if and only if it belongs to the set U35 of the 24 residues coprime to 35.
Gs35Gap.nonunit_four- For any unit a0 and any nonzero nonunit d1 in ZMod 35, there are at least 4 units b in U35 satisfying -(a0 * d1) + b * d1 = 0.
Gs35Gap.eight_sub- The set {6, 8, 11, 16, 22, 26, 29, 31} is a subset of the units U35.
Gs35Gap.one_not_eight- The residue 1 is not an element of the set {6, 8, 11, 16, 22, 26, 29, 31}.
Gs35Gap.neg_one_eq- In ZMod 35, the residue -1 equals 34.
Finset.mem_sdiff- An element belongs to the set difference s \ t if and only if it belongs to s and does not belong to t.
Finset.card_le_card- If a finite set s is a subset of t, then |s| ≤ |t|.
Finset.card_sdiff_of_subset- If s ⊆ t, then |t \ s| = |t| - |s|.
ZMod.mul_inv_of_unit- In ZMod n, multiplying a unit a by its inverse yields 1.
mul_comm- Multiplication is commutative: a * b = b * a.
neg_mul- The product (-a) * b equals -(a * b).
mul_neg- The product a * (-b) equals -(a * b).
neg_neg- The double negation -(-a) equals a.
Prod.ext- Two pairs are equal if their corresponding coordinates are equal.
Finset.card_image_of_injective- The image of a finite set under an injective function has the same cardinality as the domain set.
mul_assoc- Multiplication is associative: (a * b) * c = a * (b * c).
good_slopes_fiber35_anchored_neighbors- For any 35-point set S in (ZMod 35)^2 containing (0, 0) and (1, 34), there cannot exist a direction property g such that every direction satisfying g is injective (and thus surjective) on S while among every three distinct directions in {6, 8, 11, 16, 22, 26, 29, 31}, at least one satisfies g.
Finset.eq_univ_of_card- A subset of a finite type whose cardinality equals the cardinality of the full type is the universal set.
Finset.card_image_of_injOn- If a function is injective on a finite set s, the cardinality of its image is |s|.
ZMod.card- The cardinality of ZMod n is n.
Finset.mem_univ- Every element of a finite type belongs to its universal finset Finset.univ.
Finset.card_insert_of_notMem- Inserting an element not in a finite set increases its cardinality by 1.
Finset.card_eq_three- A finite set has cardinality 3 if and only if it consists of three pairwise distinct elements.
isUnit_one- The identity element 1 is a unit.
mul_zero- Multiplying any ring element by 0 yields 0.
neg_zero- The negation of 0 is 0.
Finset.mem_filter- An element belongs to a filtered set if and only if it belongs to the set and satisfies the predicate.
- The lemma Gs35Gap.nonunit_four is verified by an exhaustive finite computation (decide) over the finite ring ZMod 35.
- The theorem good_slopes_fiber35_anchored_neighbors is a previously established structural result ruling out certain 35-point configurations in (ZMod 35)^2 containing (0, 0) and (1, 34).
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.
namespace Gs35Gapdef U35 : Finset (ZMod 35) := {1,2,3,4,6,8,9,11,12,13,16,17,18,19,22,23,24,26,27,29,31,32,33,34}theorem isUnit_iff_U (x : ZMod 35) : IsUnit x ↔ x ∈ U35 := by rw [isUnit_iff_exists_inv]; revert x; decidetheorem nonunit_four : ∀ a0 ∈ U35, ∀ d1 : ZMod 35, d1 ∉ U35 → d1 ≠ 0 → 4 ≤ (U35.filter (fun b => -(a0 * d1) + b * d1 = 0)).card := by decidetheorem eight_sub : ({6,8,11,16,22,26,29,31} : Finset (ZMod 35)) ⊆ U35 := by decidetheorem one_not_eight : (1 : ZMod 35) ∉ ({6,8,11,16,22,26,29,31} : Finset (ZMod 35)) := by decidetheorem neg_one_eq : (-1 : ZMod 35) = 34 := by decideend Gs35Gaptheorem good_slopes_fiber35_unit_gap (S : Finset (ZMod 35 × ZMod 35)) (hcard : S.card = 35) (hbad : ∃ a : ZMod 35, IsUnit a ∧ a ∉ good_slopes_point_directions 35 S) : (good_slopes_point_directions 35 S).card ≤ 20 := by classical by_contra hlt push Not at hlt obtain ⟨a0, ha0u, ha0⟩ := hbad have hmem : ∀ a, a ∈ good_slopes_point_directions 35 S ↔ IsUnit a ∧ Set.InjOn (fun p : ZMod 35 × ZMod 35 => p.2 + a * p.1) S := by intro a; unfold good_slopes_point_directions; simp -- four bad unit directions are impossible have key : ∀ B : Finset (ZMod 35), (∀ b ∈ B, IsUnit b ∧ ¬ Set.InjOn (fun p : ZMod 35 × ZMod 35 => p.2 + b * p.1) S) → B.card ≤ 3 := by intro B hB have hBU : B ⊆ Gs35Gap.U35 := fun b hb => (Gs35Gap.isUnit_iff_U b).1 (hB b hb).1 have hsub : good_slopes_point_directions 35 S ⊆ Gs35Gap.U35 \ B := by intro a ha rw [hmem] at ha rw [Finset.mem_sdiff] exact ⟨(Gs35Gap.isUnit_iff_U a).1 ha.1, fun hb => (hB a hb).2 ha.2⟩ have h1 := Finset.card_le_card hsub rw [Finset.card_sdiff_of_subset hBU] at h1 have : Gs35Gap.U35.card = 24 := by decide omega have hni : ¬ Set.InjOn (fun p : ZMod 35 × ZMod 35 => p.2 + a0 * p.1) S := by intro h; exact ha0 ((hmem a0).2 ⟨ha0u, h⟩) obtain ⟨p, hp, q, hq, hpq, hne⟩ : ∃ p ∈ S, ∃ q ∈ S, p.2 + a0 * p.1 = q.2 + a0 * q.1 ∧ p ≠ q := by simp only [Set.InjOn, not_forall] at hni obtain ⟨p, hp, q, hq, h, hne⟩ := hni exact ⟨p, hp, q, hq, h, hne⟩ set d1 := q.1 - p.1 with hd1 set d2 := q.2 - p.2 with hd2 have hd : d2 = -(a0 * d1) := by rw [hd1, hd2]; linear_combination -hpq have bad_of : ∀ b, d2 + b * d1 = 0 → ¬ Set.InjOn (fun p : ZMod 35 × ZMod 35 => p.2 + b * p.1) S := by intro b hb hinj exact hne (hinj hp hq (by simp only; rw [hd1, hd2] at hb; linear_combination -hb)) by_cases hu1 : IsUnit d1 · -- normalise the collision to (0,0), (1,34) have hd2u : IsUnit d2 := by rw [hd]; exact (ha0u.mul hu1).neg set s := d1⁻¹ with hs set r := -d2⁻¹ with hr have hsd : s * d1 = 1 := by rw [hs, mul_comm]; exact ZMod.mul_inv_of_unit d1 hu1 have hrd : r * d2 = -1 := by rw [hr, neg_mul, mul_comm, ZMod.mul_inv_of_unit d2 hd2u] have hsu : IsUnit s := isUnit_iff_exists_inv.2 ⟨d1, hsd⟩ have hru : IsUnit r := isUnit_iff_exists_inv.2 ⟨-d2, by rw [mul_neg, hrd, neg_neg]⟩ let φ : ZMod 35 × ZMod 35 → ZMod 35 × ZMod 35 := fun u => (s * (u.1 - p.1), r * (u.2 - p.2)) have hφ : Function.Injective φ := by intro u v h simp only [φ, Prod.mk.injEq] at h have e1 := hsu.mul_left_cancel h.1 have e2 := hru.mul_left_cancel h.2 exact Prod.ext (by linear_combination e1) (by linear_combination e2) set S' := S.image φ with hS' have hcard' : S'.card = 35 := by rw [hS', Finset.card_image_of_injective _ hφ, hcard] have h0 : ((0 : ZMod 35), (0 : ZMod 35)) ∈ S' := Finset.mem_image.2 ⟨p, hp, by simp [φ]⟩ have h1 : ((1 : ZMod 35), (34 : ZMod 35)) ∈ S' := Finset.mem_image.2 ⟨q, hq, by simp only [φ, Prod.mk.injEq] refine ⟨?_, ?_⟩ · rw [← hd1]; exact hsd · rw [← hd2, hrd, Gs35Gap.neg_one_eq]⟩ -- a direction b bad on S' gives the direction a0 * b bad on S have transfer : ∀ b, ¬ Set.InjOn (fun p : ZMod 35 × ZMod 35 => p.2 + b * p.1) S' → ¬ Set.InjOn (fun p : ZMod 35 × ZMod 35 => p.2 + (a0 * b) * p.1) S := by intro b hb hinj apply hb intro u' hu' v' hv' huv obtain ⟨u, hu, rfl⟩ := Finset.mem_image.1 hu' obtain ⟨v, hv, rfl⟩ := Finset.mem_image.1 hv' have hrel : ∀ w : ZMod 35 × ZMod 35, (φ w).2 + b * (φ w).1 = r * (w.2 + (a0 * b) * w.1) - (r * p.2 + b * s * p.1) := by intro w simp only [φ] have hrs : r * a0 = s := by have : r * a0 * d1 = s * d1 := by rw [hsd, mul_assoc, ← neg_neg (a0 * d1), ← hd, mul_neg, hrd, neg_neg] exact hu1.mul_right_cancel this linear_combination (-(b * w.1)) * hrs have e : r * (u.2 + (a0 * b) * u.1) = r * (v.2 + (a0 * b) * v.1) := by have := huv; simp only at this; rw [hrel u, hrel v] at this; linear_combination this rw [hinj hu hv (hru.mul_left_cancel e)] apply good_slopes_fiber35_anchored_neighbors S' (fun a => Set.InjOn (fun p : ZMod 35 × ZMod 35 => p.2 + a * p.1) S') h0 h1 · intro a _ ha; exact ha · intro a _ ha t have himg : S'.image (fun p : ZMod 35 × ZMod 35 => p.2 + a * p.1) = Finset.univ := by apply Finset.eq_univ_of_card rw [Finset.card_image_of_injOn ha, hcard', ZMod.card] have ht : t ∈ S'.image (fun p : ZMod 35 × ZMod 35 => p.2 + a * p.1) := by rw [himg]; exact Finset.mem_univ t obtain ⟨x, hx, hxt⟩ := Finset.mem_image.1 ht exact ⟨x, hx, hxt⟩ · intro a b c ha hb hc hab hac hbc by_contra hall push Not at hall obtain ⟨hga, hgb, hgc⟩ := hall have hT : (insert (1 : ZMod 35) ({a, b, c} : Finset (ZMod 35))).card = 4 := by rw [Finset.card_insert_of_notMem, Finset.card_eq_three.2 ⟨a, b, c, hab, hac, hbc, rfl⟩] intro h1m simp only [Finset.mem_insert, Finset.mem_singleton] at h1m rcases h1m with h | h | h <;> [exact Gs35Gap.one_not_eight (h ▸ ha); exact Gs35Gap.one_not_eight (h ▸ hb); exact Gs35Gap.one_not_eight (h ▸ hc)] have hB := key ((insert (1 : ZMod 35) ({a, b, c} : Finset (ZMod 35))).image (a0 * ·)) (by intro x hx obtain ⟨y, hy, rfl⟩ := Finset.mem_image.1 hx simp only [Finset.mem_insert, Finset.mem_singleton] at hy have hyu : IsUnit y := by rcases hy with rfl | rfl | rfl | rfl · exact isUnit_one · exact (Gs35Gap.isUnit_iff_U _).2 (Gs35Gap.eight_sub ha) · exact (Gs35Gap.isUnit_iff_U _).2 (Gs35Gap.eight_sub hb) · exact (Gs35Gap.isUnit_iff_U _).2 (Gs35Gap.eight_sub hc) refine ⟨ha0u.mul hyu, ?_⟩ rcases hy with rfl | rfl | rfl | rfl · simpa using hni · exact transfer _ hga · exact transfer _ hgb · exact transfer _ hgc) rw [Finset.card_image_of_injective _ ha0u.mul_right_injective, hT] at hB omega · -- a nonunit difference: four bad directions at once have hd10 : d1 ≠ 0 := by intro h0 apply hne have h2 : d2 = 0 := by rw [hd, h0, mul_zero, neg_zero] exact Prod.ext (by linear_combination -h0) (by linear_combination -h2) have h4 := Gs35Gap.nonunit_four a0 ((Gs35Gap.isUnit_iff_U a0).1 ha0u) d1 (fun h => hu1 ((Gs35Gap.isUnit_iff_U d1).2 h)) hd10 have := key (Gs35Gap.U35.filter (fun b => -(a0 * d1) + b * d1 = 0)) (by intro b hb rw [Finset.mem_filter] at hb exact ⟨(Gs35Gap.isUnit_iff_U b).2 hb.1, bad_of b (by rw [hd]; exact hb.2)⟩) omega