good_slopes_two_row_fiber_rigidity
Let 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 coordinates is injective. Fix two first-coordinate slopes. If the total number of unit slopes b modulo 35 for which x maps injectively to (y3(x)+a*x3(x), y35(x)+b*x35(x)), summed over the two fixed choices of a, exceeds 40, then every unit slope b gives an injective map for each choice of a.
Statement
theorem good_slopes_two_row_fiber_rigidity {X : Type*} [Fintype X] [DecidableEq X] [Nonempty X] (x3 y3 : X → ZMod 3) (x35 y35 : X → ZMod 35) (a a' : ZMod 3) (hcard : Fintype.card X = 3 * 35) (hx : Function.Injective (fun x => (x3 x, x35 x))) (hlarge : (univ.filter fun b : ZMod 35 => IsUnit b ∧ Function.Injective (fun x => (y3 x + a*x3 x, y35 x + b*x35 x))).card + (univ.filter fun b : ZMod 35 => IsUnit b ∧ Function.Injective (fun x => (y3 x + a'*x3 x, y35 x + b*x35 x))).card > 40) : (∀ b : ZMod 35, IsUnit b → Function.Injective (fun x => (y3 x + a*x3 x, y35 x + b*x35 x))) ∧ (∀ b : ZMod 35, IsUnit b → Function.Injective (fun x => (y3 x + a'*x3 x, y35 x + b*x35 x)))
- Source
- CRT fiber reduction for OP-1027; the fiber bounds are formalized from prior experiments and direction arguments.
- Verified
- 15 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 6
- good_slopes_product_fiber_transferFor a bijective anchor direction on a product, each projected fiber has the size of the second factor. Good directions with the same first…
- good_slopes_fiber35_colored_gapLet S be a set of 35 points over the residues modulo 35, colored with three colors. Suppose that within each color both the first…
- good_slopes_fiber35_unit_gapFor 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…
- good_slopes_product_fiber_setThe set of projected point pairs over Z obtained by fixing the Y-coordinate of y + a x.
- 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.
- FThe prime field $\mathrm{GF}(p)$, realized as $\mathbb{Z}/p\mathbb{Z}$ via
ZMod.
- Used by 1
- good_slopes_gap_mod_105Every non-extremal permutation f of ℤ/105ℤ satisfies |D_{105}(f)| ≤ 40: (good_slopes 105 f).card ≤ 40.
The proof, explained
The proof establishes rigidity of good unit slopes across two rows via a bootstrap argument by contradiction. Since there are 24 unit slopes modulo 35 and the sum of good slopes across the two rows exceeds 40, each row has more than 16 good slopes and therefore possesses an anchor bijection. If either row were missing any unit slope, an uncolored fiber gap theorem would cap its good slopes at 20, forcing the other row to have more than 20 good slopes and thus be completely good. Using the complete second row to color the fibers of the first row then triggers a sharper colored gap theorem, restricting the first row to at most 16 good slopes—contradicting the assumption that the total exceeds 40.
Construct a section sending each point p in the fiber projection S ⊆ (Z/35)^2 back to a representative in the fiber F ⊆ X.
We consider the fiber F of points in X where y3 + a*x3 = t, and project F to S under Q(x) = (x35(x), y35(x)). Using Classical.choose, we select for each point p in S a representative rep(p) in F such that Q(rep(p)) = p.
uses
mem_image,dif_pos,Classical.choose_specclassical let S := good_slopes_product_fiber_set x3 y3 x35 y35 a t let F : Finset X := univ.filter fun x => y3 x + a*x3 x = t let Q : X → ZMod 35 × ZMod 35 := fun x => (x35 x, y35 x) have hs : S = F.image Q := by rfl have hxrep (p : ZMod 35 × ZMod 35) (hp : p ∈ S) : ∃ x ∈ F, Q x = p := by rw [hs, mem_image] at hp exact hp let rep : (ZMod 35 × ZMod 35) → X := fun p => if h : ∃ x ∈ F, Q x = p then Classical.choose h else Classical.choice inferInstance have hrep (p : ZMod 35 × ZMod 35) (hp : p ∈ S) : rep p ∈ F ∧ Q (rep p) = p := by have hex := hxrep p hp simp only [rep, dif_pos hex] exact Classical.choose_spec hex
Color the fiber projection S with 3 colors using x3, and establish that S contains exactly 35 elements.
Each point p in S receives the color x3(rep(p)) in Z/3. Equal colors imply equal x3 values on the representatives. By good_slopes_product_fiber_transfer along the anchor bijection, the fiber set S has cardinality 35.
uses
ZMod.val_lt,ZMod.val_injective,congrArg,Fin.val,good_slopes_product_fiber_transferlet color : (ZMod 35 × ZMod 35) → Fin 3 := fun p => ⟨(x3 (rep p)).val, ZMod.val_lt _⟩ have hc (p q : ZMod 35 × ZMod 35) (hpq : color p = color q) : x3 (rep p) = x3 (rep q) := by apply ZMod.val_injective exact congrArg Fin.val hpq have hct : S.card = 35 := by have h := (good_slopes_product_fiber_transfer x3 y3 x35 y35 a b₀ (by simpa using hcard) hanchor).1 t simpa [S] using h
Points in S sharing the same color and first coordinate must be identical.
To verify the horizontal injectivity condition for the colored gap theorem, suppose p, q in S share color and first coordinate. Then rep(p) and rep(q) agree on both x3 and x35. Since the input pair (x3, x35) is injective on X, rep(p) = rep(q), and therefore p = q.
uses
good_slopes_fiber35_colored_gap,congrArg,Prod.fst,Prod.extapply good_slopes_fiber35_colored_gap S color hct · intro p hp q hq hpq hfst have ep := hrep p hp have eq := hrep q hq have hx3 := hc p q hpq have hx35 : x35 (rep p) = x35 (rep q) := by calc x35 (rep p) = p.1 := congrArg Prod.fst ep.2 _ = q.1 := hfst _ = x35 (rep q) := (congrArg Prod.fst eq.2).symm have he : rep p = rep q := hx (Prod.ext hx3 hx35) rw [← ep.2, ← eq.2, he]
For every unit slope b, the affine projection p ↦ p.2 + b*p.1 is injective on every color class in S.
If p, q in S have the same color, their representatives have the same x3 value, and since both belong to the fiber F where y3 + a*x3 = t, their y3 values also agree. If furthermore p.2 + b*p.1 = q.2 + b*q.1, their images under the affine map for the second slope a' and unit b match. Completeness of the second row a' then ensures rep(p) = rep(q), whence p = q.
uses
mem_filter,Prod.ext,congrArg,Prod.fst,Prod.snd· intro b hb p hp q hq hpq heq have ep := hrep p hp have eq := hrep q hq have hx3 := hc p q hpq have hp3 := (mem_filter.mp ep.1).2 have hq3 := (mem_filter.mp eq.1).2 have hy3 : y3 (rep p) = y3 (rep q) := by rw [hx3] at hp3; linear_combination hp3 - hq3 have he : rep p = rep q := hcomplete b hb (Prod.ext (by dsimp; rw [hx3,hy3]) (by dsimp have ep1 : x35 (rep p) = p.1 := congrArg Prod.fst ep.2 have ep2 : y35 (rep p) = p.2 := congrArg Prod.snd ep.2 have eq1 : x35 (rep q) = q.1 := congrArg Prod.fst eq.2 have eq2 : y35 (rep q) = q.2 := congrArg Prod.snd eq.2 rw [ep1, ep2, eq1, eq2] exact heq)) rw [← ep.2, ← eq.2, he]
A unit slope failing injectivity on S implies S has at most 16 good unit directions.
The assumed bad unit slope b is not in good_slopes_point_directions 35 S. Having verified the hypotheses of good_slopes_fiber35_colored_gap, we conclude that the number of good unit directions on S is at most 16.
uses
mem_filter· obtain ⟨b, hb, hn⟩ := hbad refine ⟨b, hb, ?_⟩ intro hm apply hn unfold good_slopes_point_directions at hm exact (mem_filter.mp hm).2.2
If row a fails injectivity at some unit slope, the failure must occur on at least one fiber t in Z/3.
By contradiction, if the affine map for unit slope b were injective on every fiber t, good_slopes_product_fiber_transfer would imply global injectivity on X, contradicting our assumption.
uses
good_slopes_product_fiber_transfer,not_exists,not_notclassical obtain ⟨b, hb, hbad⟩ := hbad have ht : ∃ t : ZMod 3, ¬ Set.InjOn (fun p : ZMod 35 × ZMod 35 => p.2 + b*p.1) (good_slopes_product_fiber_set x3 y3 x35 y35 a t) := by by_contra hn apply hbad apply (good_slopes_product_fiber_transfer x3 y3 x35 y35 a b₀ (by simpa using hcard) hanchor).2.2 b simpa only [not_exists, not_not] using hn obtain ⟨t, ht⟩ := ht
Row a has at most 16 good unit slopes when a complete second row exists.
Applying gap105_colored_fiber_transfer to the bad fiber t shows that fiber has at most 16 good directions. Since any unit slope that is globally injective for row a must be injective on this fiber, the set of good unit slopes for row a embeds into the good directions of the fiber, giving at most 16.
uses
gap105_colored_fiber_transfer,le_trans,Finset.card_le_card,mem_filter,mem_univ,true_and,good_slopes_product_fiber_transferhave hcount := gap105_colored_fiber_transfer x3 y3 x35 y35 a a' b₀ hcard hx hanchor hcomplete t ⟨b, hb, ht⟩ apply le_trans (Finset.card_le_card ?_) hcount intro b' hb' simp only [mem_filter, mem_univ, true_and] at hb' unfold good_slopes_point_directions simp only [mem_filter, mem_univ, true_and] exact ⟨hb'.1, (good_slopes_product_fiber_transfer x3 y3 x35 y35 a b₀ (by simpa using hcard) hanchor).2.1 t b' hb'.2⟩
A failure of injectivity on row a produces a fiber where injectivity fails.
Assuming row a is not injective for unit slope b, good_slopes_product_fiber_transfer ensures that injectivity fails on the fiber set for some t in Z/3.
uses
good_slopes_product_fiber_transfer,not_exists,not_notclassical obtain ⟨b, hb, hbad⟩ := hbad have ht : ∃ t : ZMod 3, ¬ Set.InjOn (fun p : ZMod 35 × ZMod 35 => p.2 + b*p.1) (good_slopes_product_fiber_set x3 y3 x35 y35 a t) := by by_contra hn apply hbad apply (good_slopes_product_fiber_transfer x3 y3 x35 y35 a b₀ (by simpa using hcard) hanchor).2.2 b simpa only [not_exists, not_not] using hn obtain ⟨t, ht⟩ := ht
Row a has at most 20 good unit slopes without assuming any completeness on other rows.
The fiber at t has size 35 and misses the unit slope b. By the uncolored gap theorem good_slopes_fiber35_unit_gap, it has at most 20 good unit directions. Since every good unit slope for row a restricts to a good direction on the fiber, row a has at most 20 good unit slopes.
uses
good_slopes_product_fiber_transfer,mem_filter,good_slopes_fiber35_unit_gap,le_trans,Finset.card_le_card,mem_univ,true_andhave hct : (good_slopes_product_fiber_set x3 y3 x35 y35 a t).card = 35 := by have h := (good_slopes_product_fiber_transfer x3 y3 x35 y35 a b₀ (by simpa using hcard) hanchor).1 t simpa using h have hlocal : b ∉ good_slopes_point_directions 35 (good_slopes_product_fiber_set x3 y3 x35 y35 a t) := by intro hm apply ht unfold good_slopes_point_directions at hm exact (mem_filter.mp hm).2.2 have hcount := good_slopes_fiber35_unit_gap _ hct ⟨b, hb, hlocal⟩ apply le_trans (Finset.card_le_card ?_) hcount intro b' hb' simp only [mem_filter, mem_univ, true_and] at hb' unfold good_slopes_point_directions simp only [mem_filter, mem_univ, true_and] exact ⟨hb'.1, (good_slopes_product_fiber_transfer x3 y3 x35 y35 a b₀ (by simpa using hcard) hanchor).2.1 t b' hb'.2⟩
Each row has at most 24 good unit slopes, and since their sum exceeds 40, each row has strictly positive (in fact > 16) good unit slopes.
Good slopes must be units in Z/35, and there are exactly 24 units in Z/35 (checked by decide). Since the sum of good slopes for rows a and a' exceeds 40, each row must have strictly more than 40 - 24 = 16 good slopes, which is strictly positive.
uses
mem_filter,mem_univ,true_and,Finset.card_le_cardclassical let R : ZMod 3 → Finset (ZMod 35) := fun q => univ.filter fun b => IsUnit b ∧ Function.Injective (fun x => (y3 x + q*x3 x, y35 x + b*x35 x)) have hlarge' : 40 < (R a).card + (R a').card := hlarge have hbound (q : ZMod 3) : (R q).card ≤ 24 := by have hsub : R q ⊆ univ.filter (fun b : ZMod 35 => IsUnit b) := by intro b hb simp only [R, mem_filter, mem_univ, true_and] at hb ⊢ exact hb.1 have h := Finset.card_le_card hsub have hc : (univ.filter (fun b : ZMod 35 => IsUnit b)).card = 24 := by decide omega have ha : 0 < (R a).card := by have := hbound a'; omega have ha' : 0 < (R a').card := by have := hbound a; omega
Both row a and row a' admit anchor bijections.
Since both rows have positive numbers of good unit slopes, each possesses at least one good unit slope. Because |X| = 3 * 35 = 105, an injective map from X to Z/3 x Z/35 is automatically bijective, yielding anchor bijections b0 for a and b1 for a'.
uses
Finset.card_pos.mp,mem_filter,mem_univ,true_and,Fintype.bijective_iff_injective_and_cardhave anchor (q : ZMod 3) (h : 0 < (R q).card) : ∃ b : ZMod 35, Function.Bijective (fun x => (y3 x + q*x3 x, y35 x + b*x35 x)) := by obtain ⟨b, hb⟩ := Finset.card_pos.mp h simp only [R, mem_filter, mem_univ, true_and] at hb refine ⟨b, (Fintype.bijective_iff_injective_and_card _).2 ⟨hb.2, ?_⟩⟩ simpa using hcard obtain ⟨b0, hb0⟩ := anchor a ha obtain ⟨b1, hb1⟩ := anchor a' ha'
Rigidity key lemma: any row satisfying the sum bound > 40 must have all 24 unit slopes injective.
Suppose row q has a bad unit slope. By gap105_uncolored_row_transfer, row q has at most 20 good slopes. Since the sum exceeds 40, row q' must have strictly more than 20 good slopes, which rules out any bad unit slope on row q' and makes row q' completely good. But then gap105_colored_row_transfer applies to row q, tightening its bound to at most 16 good slopes, so the sum of slopes is at most 16 + 24 = 40, contradicting the hypothesis > 40.
uses
gap105_uncolored_row_transfer,gap105_colored_row_transferhave key (q q' : ZMod 3) (c0 c1 : ZMod 35) (hc0 : Function.Bijective (fun x => (y3 x + q*x3 x, y35 x + c0*x35 x))) (hc1 : Function.Bijective (fun x => (y3 x + q'*x3 x, y35 x + c1*x35 x))) (hl : 40 < (R q).card + (R q').card) : ∀ b : ZMod 35, IsUnit b → Function.Injective (fun x => (y3 x + q*x3 x, y35 x + b*x35 x)) := by intro b hb by_contra hbad have h20 : (R q).card ≤ 20 := gap105_uncolored_row_transfer x3 y3 x35 y35 q c0 hcard hc0 ⟨b, hb, hbad⟩ have hfull : ∀ d : ZMod 35, IsUnit d → Function.Injective (fun x => (y3 x + q'*x3 x, y35 x + d*x35 x)) := by intro d hd by_contra hbad' have h20' : (R q').card ≤ 20 := gap105_uncolored_row_transfer x3 y3 x35 y35 q' c1 hcard hc1 ⟨d, hd, hbad'⟩ omega have h16 : (R q).card ≤ 16 := gap105_colored_row_transfer x3 y3 x35 y35 q q' c0 hcard hx hc0 hfull ⟨b, hb, hbad⟩ have := hbound q' omega
Every unit slope is injective for both row a and row a'.
Applying the rigidity key lemma to (a, a') proves that every unit slope is injective for row a, and applying it symmetrically to (a', a) proves completeness for row a'.
exact ⟨key a a' b0 b1 hb0 hb1 hlarge', key a' a b1 b0 hb1 hb0 (by omega)⟩
mem_image- An element belongs to the image of a set under a function if and only if it is the image of some element in that set.
dif_pos- A dependent if-then-else term evaluates to its positive branch when the condition is satisfied.
Classical.choose_spec- The witness chosen by Classical.choose satisfies the existential property.
ZMod.val_lt- The canonical representative of an element of Z/n as a natural number is strictly less than n.
ZMod.val_injective- The canonical integer evaluation map from Z/n into natural numbers is injective.
congrArg- Functions map equal inputs to equal outputs.
Fin.val- The canonical projection from Fin n to the underlying natural number.
good_slopes_product_fiber_transfer- For a product fibration with an anchor bijection, each fiber has size equal to the second factor, global injectivity implies fiber injectivity, and injectivity on every fiber implies global injectivity.
good_slopes_fiber35_colored_gap- A 35-point subset of (Z/35)^2 with a 3-coloring having injective vertical and unit-slope monochromatic lines and at least one bad unit slope has at most 16 good unit slopes.
Prod.fst- The first coordinate projection of an ordered pair.
Prod.snd- The second coordinate projection of an ordered pair.
Prod.ext- Two ordered pairs are equal if and only if their first and second components are respectively equal.
mem_filter- An element belongs to a filtered set if and only if it belongs to the set and satisfies the predicate.
not_exists- A negated existential statement is equivalent to a universal negation.
not_not- A double negation is equivalent to the affirmative proposition.
gap105_colored_fiber_transfer- If a complete second row exists and the anchor row has a bad unit slope on some fiber, that fiber has at most 16 good unit slopes.
le_trans- Transitivity of the inequality relation: if a <= b and b <= c, then a <= c.
Finset.card_le_card- If one finite set is a subset of another, its cardinality is less than or equal to that of the other.
mem_univ- Every element belongs to the universal set.
true_and- Conjunction of True with any proposition p is logically equivalent to p.
good_slopes_fiber35_unit_gap- Any 35-point subset of (Z/35)^2 missing at least one unit slope has at most 20 good unit slopes.
Finset.card_pos.mp- A finite set with strictly positive cardinality is nonempty.
Fintype.bijective_iff_injective_and_card- A map between finite types of the same cardinality is bijective if and only if it is injective.
gap105_uncolored_row_transfer- If a row has an anchor bijection and at least one bad unit slope, it has at most 20 good unit slopes.
gap105_colored_row_transfer- If a complete second row exists and a row with an anchor bijection has a bad unit slope, that row has at most 16 good unit slopes.
- The fact that there are 24 units in Z/35 is verified by computational enumeration (via decide) on line 146.
- Linear integer arithmetic inequalities (such as deducing that row cardinals must exceed 16 and that 16 + 24 <= 40 contradicts the sum exceeding 40) are closed automatically by omega.
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 4000000set_option maxRecDepth 10000open Finset-- A complete second slice colors every fiber of the first slice.private theorem gap105_colored_fiber_transfer {X : Type*} [Fintype X] [DecidableEq X] [Nonempty X] (x3 y3 : X → ZMod 3) (x35 y35 : X → ZMod 35) (a a' : ZMod 3) (b₀ : ZMod 35) (hcard : Fintype.card X = 3 * 35) (hx : Function.Injective (fun x => (x3 x, x35 x))) (hanchor : Function.Bijective (fun x => (y3 x + a*x3 x, y35 x + b₀*x35 x))) (hcomplete : ∀ b : ZMod 35, IsUnit b → Function.Injective (fun x => (y3 x + a'*x3 x, y35 x + b*x35 x))) (t : ZMod 3) (hbad : ∃ b : ZMod 35, IsUnit b ∧ ¬ Set.InjOn (fun p : ZMod 35 × ZMod 35 => p.2 + b*p.1) (good_slopes_product_fiber_set x3 y3 x35 y35 a t)) : (good_slopes_point_directions 35 (good_slopes_product_fiber_set x3 y3 x35 y35 a t)).card ≤ 16 := by classical let S := good_slopes_product_fiber_set x3 y3 x35 y35 a t let F : Finset X := univ.filter fun x => y3 x + a*x3 x = t let Q : X → ZMod 35 × ZMod 35 := fun x => (x35 x, y35 x) have hs : S = F.image Q := by rfl have hxrep (p : ZMod 35 × ZMod 35) (hp : p ∈ S) : ∃ x ∈ F, Q x = p := by rw [hs, mem_image] at hp exact hp let rep : (ZMod 35 × ZMod 35) → X := fun p => if h : ∃ x ∈ F, Q x = p then Classical.choose h else Classical.choice inferInstance have hrep (p : ZMod 35 × ZMod 35) (hp : p ∈ S) : rep p ∈ F ∧ Q (rep p) = p := by have hex := hxrep p hp simp only [rep, dif_pos hex] exact Classical.choose_spec hex let color : (ZMod 35 × ZMod 35) → Fin 3 := fun p => ⟨(x3 (rep p)).val, ZMod.val_lt _⟩ have hc (p q : ZMod 35 × ZMod 35) (hpq : color p = color q) : x3 (rep p) = x3 (rep q) := by apply ZMod.val_injective exact congrArg Fin.val hpq have hct : S.card = 35 := by have h := (good_slopes_product_fiber_transfer x3 y3 x35 y35 a b₀ (by simpa using hcard) hanchor).1 t simpa [S] using h apply good_slopes_fiber35_colored_gap S color hct · intro p hp q hq hpq hfst have ep := hrep p hp have eq := hrep q hq have hx3 := hc p q hpq have hx35 : x35 (rep p) = x35 (rep q) := by calc x35 (rep p) = p.1 := congrArg Prod.fst ep.2 _ = q.1 := hfst _ = x35 (rep q) := (congrArg Prod.fst eq.2).symm have he : rep p = rep q := hx (Prod.ext hx3 hx35) rw [← ep.2, ← eq.2, he] · intro b hb p hp q hq hpq heq have ep := hrep p hp have eq := hrep q hq have hx3 := hc p q hpq have hp3 := (mem_filter.mp ep.1).2 have hq3 := (mem_filter.mp eq.1).2 have hy3 : y3 (rep p) = y3 (rep q) := by rw [hx3] at hp3; linear_combination hp3 - hq3 have he : rep p = rep q := hcomplete b hb (Prod.ext (by dsimp; rw [hx3,hy3]) (by dsimp have ep1 : x35 (rep p) = p.1 := congrArg Prod.fst ep.2 have ep2 : y35 (rep p) = p.2 := congrArg Prod.snd ep.2 have eq1 : x35 (rep q) = q.1 := congrArg Prod.fst eq.2 have eq2 : y35 (rep q) = q.2 := congrArg Prod.snd eq.2 rw [ep1, ep2, eq1, eq2] exact heq)) rw [← ep.2, ← eq.2, he] · obtain ⟨b, hb, hn⟩ := hbad refine ⟨b, hb, ?_⟩ intro hm apply hn unfold good_slopes_point_directions at hm exact (mem_filter.mp hm).2.2private theorem gap105_colored_row_transfer {X : Type*} [Fintype X] [DecidableEq X] [Nonempty X] (x3 y3 : X → ZMod 3) (x35 y35 : X → ZMod 35) (a a' : ZMod 3) (b₀ : ZMod 35) (hcard : Fintype.card X = 3 * 35) (hx : Function.Injective (fun x => (x3 x, x35 x))) (hanchor : Function.Bijective (fun x => (y3 x + a*x3 x, y35 x + b₀*x35 x))) (hcomplete : ∀ b : ZMod 35, IsUnit b → Function.Injective (fun x => (y3 x + a'*x3 x, y35 x + b*x35 x))) (hbad : ∃ b : ZMod 35, IsUnit b ∧ ¬ Function.Injective (fun x => (y3 x + a*x3 x, y35 x + b*x35 x))) : (univ.filter fun b : ZMod 35 => IsUnit b ∧ Function.Injective (fun x => (y3 x + a*x3 x, y35 x + b*x35 x))).card ≤ 16 := by classical obtain ⟨b, hb, hbad⟩ := hbad have ht : ∃ t : ZMod 3, ¬ Set.InjOn (fun p : ZMod 35 × ZMod 35 => p.2 + b*p.1) (good_slopes_product_fiber_set x3 y3 x35 y35 a t) := by by_contra hn apply hbad apply (good_slopes_product_fiber_transfer x3 y3 x35 y35 a b₀ (by simpa using hcard) hanchor).2.2 b simpa only [not_exists, not_not] using hn obtain ⟨t, ht⟩ := ht have hcount := gap105_colored_fiber_transfer x3 y3 x35 y35 a a' b₀ hcard hx hanchor hcomplete t ⟨b, hb, ht⟩ apply le_trans (Finset.card_le_card ?_) hcount intro b' hb' simp only [mem_filter, mem_univ, true_and] at hb' unfold good_slopes_point_directions simp only [mem_filter, mem_univ, true_and] exact ⟨hb'.1, (good_slopes_product_fiber_transfer x3 y3 x35 y35 a b₀ (by simpa using hcard) hanchor).2.1 t b' hb'.2⟩private theorem gap105_uncolored_row_transfer {X : Type*} [Fintype X] [DecidableEq X] (x3 y3 : X → ZMod 3) (x35 y35 : X → ZMod 35) (a : ZMod 3) (b₀ : ZMod 35) (hcard : Fintype.card X = 3 * 35) (hanchor : Function.Bijective (fun x => (y3 x + a*x3 x, y35 x + b₀*x35 x))) (hbad : ∃ b : ZMod 35, IsUnit b ∧ ¬ Function.Injective (fun x => (y3 x + a*x3 x, y35 x + b*x35 x))) : (univ.filter fun b : ZMod 35 => IsUnit b ∧ Function.Injective (fun x => (y3 x + a*x3 x, y35 x + b*x35 x))).card ≤ 20 := by classical obtain ⟨b, hb, hbad⟩ := hbad have ht : ∃ t : ZMod 3, ¬ Set.InjOn (fun p : ZMod 35 × ZMod 35 => p.2 + b*p.1) (good_slopes_product_fiber_set x3 y3 x35 y35 a t) := by by_contra hn apply hbad apply (good_slopes_product_fiber_transfer x3 y3 x35 y35 a b₀ (by simpa using hcard) hanchor).2.2 b simpa only [not_exists, not_not] using hn obtain ⟨t, ht⟩ := ht have hct : (good_slopes_product_fiber_set x3 y3 x35 y35 a t).card = 35 := by have h := (good_slopes_product_fiber_transfer x3 y3 x35 y35 a b₀ (by simpa using hcard) hanchor).1 t simpa using h have hlocal : b ∉ good_slopes_point_directions 35 (good_slopes_product_fiber_set x3 y3 x35 y35 a t) := by intro hm apply ht unfold good_slopes_point_directions at hm exact (mem_filter.mp hm).2.2 have hcount := good_slopes_fiber35_unit_gap _ hct ⟨b, hb, hlocal⟩ apply le_trans (Finset.card_le_card ?_) hcount intro b' hb' simp only [mem_filter, mem_univ, true_and] at hb' unfold good_slopes_point_directions simp only [mem_filter, mem_univ, true_and] exact ⟨hb'.1, (good_slopes_product_fiber_transfer x3 y3 x35 y35 a b₀ (by simpa using hcard) hanchor).2.1 t b' hb'.2⟩theorem good_slopes_two_row_fiber_rigidity {X : Type*} [Fintype X] [DecidableEq X] [Nonempty X] (x3 y3 : X → ZMod 3) (x35 y35 : X → ZMod 35) (a a' : ZMod 3) (hcard : Fintype.card X = 3 * 35) (hx : Function.Injective (fun x => (x3 x, x35 x))) (hlarge : (univ.filter fun b : ZMod 35 => IsUnit b ∧ Function.Injective (fun x => (y3 x + a*x3 x, y35 x + b*x35 x))).card + (univ.filter fun b : ZMod 35 => IsUnit b ∧ Function.Injective (fun x => (y3 x + a'*x3 x, y35 x + b*x35 x))).card > 40) : (∀ b : ZMod 35, IsUnit b → Function.Injective (fun x => (y3 x + a*x3 x, y35 x + b*x35 x))) ∧ (∀ b : ZMod 35, IsUnit b → Function.Injective (fun x => (y3 x + a'*x3 x, y35 x + b*x35 x))) := by classical let R : ZMod 3 → Finset (ZMod 35) := fun q => univ.filter fun b => IsUnit b ∧ Function.Injective (fun x => (y3 x + q*x3 x, y35 x + b*x35 x)) have hlarge' : 40 < (R a).card + (R a').card := hlarge have hbound (q : ZMod 3) : (R q).card ≤ 24 := by have hsub : R q ⊆ univ.filter (fun b : ZMod 35 => IsUnit b) := by intro b hb simp only [R, mem_filter, mem_univ, true_and] at hb ⊢ exact hb.1 have h := Finset.card_le_card hsub have hc : (univ.filter (fun b : ZMod 35 => IsUnit b)).card = 24 := by decide omega have ha : 0 < (R a).card := by have := hbound a'; omega have ha' : 0 < (R a').card := by have := hbound a; omega have anchor (q : ZMod 3) (h : 0 < (R q).card) : ∃ b : ZMod 35, Function.Bijective (fun x => (y3 x + q*x3 x, y35 x + b*x35 x)) := by obtain ⟨b, hb⟩ := Finset.card_pos.mp h simp only [R, mem_filter, mem_univ, true_and] at hb refine ⟨b, (Fintype.bijective_iff_injective_and_card _).2 ⟨hb.2, ?_⟩⟩ simpa using hcard obtain ⟨b0, hb0⟩ := anchor a ha obtain ⟨b1, hb1⟩ := anchor a' ha' have key (q q' : ZMod 3) (c0 c1 : ZMod 35) (hc0 : Function.Bijective (fun x => (y3 x + q*x3 x, y35 x + c0*x35 x))) (hc1 : Function.Bijective (fun x => (y3 x + q'*x3 x, y35 x + c1*x35 x))) (hl : 40 < (R q).card + (R q').card) : ∀ b : ZMod 35, IsUnit b → Function.Injective (fun x => (y3 x + q*x3 x, y35 x + b*x35 x)) := by intro b hb by_contra hbad have h20 : (R q).card ≤ 20 := gap105_uncolored_row_transfer x3 y3 x35 y35 q c0 hcard hc0 ⟨b, hb, hbad⟩ have hfull : ∀ d : ZMod 35, IsUnit d → Function.Injective (fun x => (y3 x + q'*x3 x, y35 x + d*x35 x)) := by intro d hd by_contra hbad' have h20' : (R q').card ≤ 20 := gap105_uncolored_row_transfer x3 y3 x35 y35 q' c1 hcard hc1 ⟨d, hd, hbad'⟩ omega have h16 : (R q).card ≤ 16 := gap105_colored_row_transfer x3 y3 x35 y35 q q' c0 hcard hx hc0 hfull ⟨b, hb, hbad⟩ have := hbound q' omega exact ⟨key a a' b0 b1 hb0 hb1 hlarge', key a' a b1 b0 hb1 hb0 (by omega)⟩