AFTD Auto-Formalizing Theoretical Domains

rational_quadratic_coloring_from_integer_scales

theoremverified

If for every positive integer q there is an integer coloring avoiding false length-3 and true length-17 quadratics with leading coefficient q and arbitrary integer lower coefficients, then a rational coloring avoids those two types with leading coefficient one and arbitrary rational lower coefficients.

Statement

theorem rational_quadratic_coloring_from_integer_scales (h : ∀ q : ℕ, 0 < q → ∃ f : ℤ → Bool, (∀ a b : ℤ, ¬ ∀ k : Fin 3, f ((q : ℤ) * (k.val : ℤ) ^ 2 + a * k.val + b) = false) ∧ (∀ a b : ℤ, ¬ ∀ k : Fin 17, f ((q : ℤ) * (k.val : ℤ) ^ 2 + a * k.val + b) = true)) : ∃ f : ℚ → Bool, (∀ a b : ℚ, ¬ ∀ k : Fin 3, f ((k.val : ℚ) ^ 2 + a * k.val + b) = false) ∧ (∀ a b : ℚ, ¬ ∀ k : Fin 17, f ((k.val : ℚ) ^ 2 + a * k.val + b) = true)
Source
Compactness reduction for the rational quadratic approach to OP-1482.
Verified
13 Nov 2026
Axioms
Classical.choiceQuot.soundpropext

The proof, explained

To obtain a rational coloring avoiding false length-3 and true length-17 quadratic progressions with leading coefficient one, the problem is formulated as finding a point in the intersection of closed constraint sets in the compact product space ℚ → Bool. For any finite collection of rational constraints, clearing denominators by setting q to the product of all coefficient denominators allows us to scale a hypothesis integer coloring with leading coefficient q into a rational coloring that simultaneously satisfies every constraint in the collection. By compactness and the finite intersection property, the total intersection of all constraint sets is nonempty, yielding a global rational coloring.

  1. For q ∈ ℕ and a ∈ ℚ with a.den ∣ q, the integer product (q / a.den) * a.num equals q * a in ℚ.

    Since the denominator of a divides q, we have q = a.den * (q / a.den). Multiplying (q / a.den) by a.num, and rewriting a.num as a * a.den, ring arithmetic rearranges the expression to ((q / a.den) * a.den) * a = q * a.

    lines 1–13

    uses Nat.cast_mul, Nat.mul_div_cancel', Int.cast_natCast, Rat.mul_den_eq_num, mul_comm

    private lemma rational_quadratic_coloring_from_integer_scales_rat_num_mul_eq_of_den_dvd (q : ℕ) (a : ℚ) (h : a.den ∣ q) :
        (((q / a.den : ℕ) : ℤ) * a.num : ℚ) = (q : ℚ) * a := by
      have hq : (q : ℚ) = (a.den : ℚ) * ((q / a.den : ℕ) : ℚ) := by
        rw [← Nat.cast_mul, Nat.mul_div_cancel' h]
      calc
        (((q / a.den : ℕ) : ℤ) * a.num : ℚ)
            = ((q / a.den : ℕ) : ℚ) * (a.num : ℚ) := by
              simp only [Int.cast_natCast]
        _ = ((q / a.den : ℕ) : ℚ) * (a * (a.den : ℚ)) := by rw [← Rat.mul_den_eq_num a]
        _ = (((q / a.den : ℕ) : ℚ) * (a.den : ℚ)) * a := by ring
        _ = (q : ℚ) * a := by
              rw [mul_comm ((q / a.den : ℕ) : ℚ) (a.den : ℚ), ← hq]
    
  2. If integers A and B represent q * a and q * b in ℚ, then the numerator of q * (k² + a k + b) is the integer q k² + A k + B.

    Let J be the integer q k² + A k + B. Expanding q * (k² + a k + b) and substituting A = q * a and B = q * b shows that q * (k² + a k + b) equals J as rational numbers. Taking numerators on both sides and using the fact that the numerator of an integer cast is itself gives the identity.

    lines 14–28

    uses congrArg, Rat.num_intCast

    private lemma rational_quadratic_coloring_from_integer_scales_rat_num_mul_int_quadratic
        (q : ℕ) (a b : ℚ) (A B : ℤ)
        (hA : (A : ℚ) = (q : ℚ) * a) (hB : (B : ℚ) = (q : ℚ) * b)
        (n : ℕ) (k : Fin n) :
        ((q : ℚ) * ((k.val : ℚ) ^ 2 + a * (k.val : ℚ) + b)).num =
          (q : ℤ) * (k.val : ℤ) ^ 2 + A * (k.val : ℤ) + B := by
      let J : ℤ := (q : ℤ) * (k.val : ℤ) ^ 2 + A * (k.val : ℤ) + B
      have hq : (q : ℚ) * ((k.val : ℚ) ^ 2 + a * (k.val : ℚ) + b) = (J : ℚ) := by
        dsimp [J]
        push_cast
        rw [hA, hB]
        ring
      have hnum := congrArg Rat.num hq
      simpa [Rat.num_intCast] using hnum
    
  3. An integer coloring avoiding monochromatic quadratics with leading coefficient q scales to a rational coloring avoiding monochromatic quadratics whose coefficients have denominators dividing q.

    Define the integer coefficients A = (q / a.den) * a.num and B = (q / b.den) * b.num, which equal q * a and q * b respectively. If the scaled coloring F(x) = f((q * x).num) were constant on the rational quadratic progression k² + a k + b for k < n, then by the previous numerator identity, f would be constant on the integer progression q k² + A k + B for k < n, contradicting the hypothesis on f.

    lines 29–53

    uses Int.cast_mul, rational_quadratic_coloring_from_integer_scales_rat_num_mul_eq_of_den_dvd, rational_quadratic_coloring_from_integer_scales_rat_num_mul_int_quadratic

    private lemma rational_quadratic_coloring_from_integer_scales_quadratic_coloring_constraint
        (q : ℕ) (f : ℤ → Bool) {n : ℕ} (target : Bool)
        (hf : ∀ A B : ℤ, ¬ ∀ k : Fin n,
          f ((q : ℤ) * (k.val : ℤ) ^ 2 + A * (k.val : ℤ) + B) = target)
        (a b : ℚ) (ha : a.den ∣ q) (hb : b.den ∣ q)
        (F : ℚ → Bool) (hF : ∀ x, F x = f ((q : ℚ) * x).num) :
        ¬ ∀ k : Fin n, F ((k.val : ℚ) ^ 2 + a * (k.val : ℚ) + b) = target := by
      let A : ℤ := ((q / a.den : ℕ) : ℤ) * a.num
      let B : ℤ := ((q / b.den : ℕ) : ℤ) * b.num
      have hA : (A : ℚ) = (q : ℚ) * a := by
        dsimp [A]
        simp only [Int.cast_mul]
        exact rational_quadratic_coloring_from_integer_scales_rat_num_mul_eq_of_den_dvd q a ha
      have hB : (B : ℚ) = (q : ℚ) * b := by
        dsimp [B]
        simp only [Int.cast_mul]
        exact rational_quadratic_coloring_from_integer_scales_rat_num_mul_eq_of_den_dvd q b hb
      intro h
      apply hf A B
      intro k
      have hp := rational_quadratic_coloring_from_integer_scales_rat_num_mul_int_quadratic q a b A B hA hB n k
      have hk := h k
      rw [hF ((k.val : ℚ) ^ 2 + a * (k.val : ℚ) + b), hp] at hk
      exact hk
    
  4. Set up the index set for all quadratic constraints and define the corresponding sets of colorings.

    We define the index type Index as the disjoint sum (ℚ × ℚ) ⊕ (ℚ × ℚ), where the left summand indexes pairs (a, b) for avoiding false length-3 progressions, and the right summand indexes pairs (a, b) for avoiding true length-17 progressions. For each index, T(i) is defined as the set of rational colorings F : ℚ → Bool that avoid the forbidden monochromatic progression.

    lines 54–61

    theorem rational_quadratic_coloring_from_integer_scales (h : ∀ q : ℕ, 0 < q → ∃ f : ℤ → Bool, (∀ a b : ℤ, ¬ ∀ k : Fin 3, f ((q : ℤ) * (k.val : ℤ) ^ 2 + a * k.val + b) = false) ∧ (∀ a b : ℤ, ¬ ∀ k : Fin 17, f ((q : ℤ) * (k.val : ℤ) ^ 2 + a * k.val + b) = true)) : ∃ f : ℚ → Bool, (∀ a b : ℚ, ¬ ∀ k : Fin 3, f ((k.val : ℚ) ^ 2 + a * k.val + b) = false) ∧ (∀ a b : ℚ, ¬ ∀ k : Fin 17, f ((k.val : ℚ) ^ 2 + a * k.val + b) = true) := by
      let Index : Type := (ℚ × ℚ) ⊕ (ℚ × ℚ)
      let aa : Index → ℚ := fun i => match i with | Sum.inl p => p.1 | Sum.inr p => p.1
      let bb : Index → ℚ := fun i => match i with | Sum.inl p => p.2 | Sum.inr p => p.2
      let T : Index → Set (ℚ → Bool) := fun i =>
        match i with
        | Sum.inl p => {F : ℚ → Bool | ¬ ∀ k : Fin 3, F ((k.val : ℚ) ^ 2 + p.1 * (k.val : ℚ) + p.2) = false}
        | Sum.inr p => {F : ℚ → Bool | ¬ ∀ k : Fin 17, F ((k.val : ℚ) ^ 2 + p.1 * (k.val : ℚ) + p.2) = true}
  5. Each constraint set T(i) is closed in the product topology on ℚ → Bool.

    A coloring F belongs to T(i) when not all evaluations on the progression equal the target boolean value. This is equivalent to saying that at least one evaluation equals the opposite value, so T(i) is a finite union over k of cylinder sets {F | F(x(k)) = opposite}. In the product topology, each evaluation map is continuous and singletons in Bool are closed, so each cylinder set is closed; hence their finite union T(i) is closed.

    lines 62–100

    uses Set.mem_iUnion, Bool.eq_false_of_not_eq_true, isClosed_iUnion_of_finite, IsClosed.preimage, continuous_apply, isClosed_singleton, Bool.eq_true_of_not_eq_false

      have hTclosed : ∀ i : Index, IsClosed (T i) := by
        intro i
        rcases i with ⟨a, b⟩ | ⟨a, b⟩
        · dsimp [T]
          let x : Fin 3 → ℚ := fun k => (k.val : ℚ) ^ 2 + a * (k.val : ℚ) + b
          have hset : {F : ℚ → Bool | ¬ ∀ k : Fin 3, F (x k) = false} =
              ⋃ k : Fin 3, {F : ℚ → Bool | F (x k) = true} := by
            ext F
            simp only [Set.mem_iUnion]
            constructor
            · intro hh
              by_contra hne
              apply hh
              intro k
              exact Bool.eq_false_of_not_eq_true (fun hk => hne ⟨k, hk⟩)
            · rintro ⟨k, hk⟩ hall
              simp [hall] at hk
          rw [hset]
          apply isClosed_iUnion_of_finite
          intro k
          exact IsClosed.preimage (continuous_apply (x k)) isClosed_singleton
        · dsimp [T]
          let x : Fin 17 → ℚ := fun k => (k.val : ℚ) ^ 2 + a * (k.val : ℚ) + b
          have hset : {F : ℚ → Bool | ¬ ∀ k : Fin 17, F (x k) = true} =
              ⋃ k : Fin 17, {F : ℚ → Bool | F (x k) = false} := by
            ext F
            simp only [Set.mem_iUnion]
            constructor
            · intro hh
              by_contra hne
              apply hh
              intro k
              exact Bool.eq_true_of_not_eq_false (fun hk => hne ⟨k, hk⟩)
            · rintro ⟨k, hk⟩ hall
              simp [hall] at hk
          rw [hset]
          apply isClosed_iUnion_of_finite
          intro k
          exact IsClosed.preimage (continuous_apply (x k)) isClosed_singleton
  6. The family of constraint sets {T(i)} satisfies the finite intersection property.

    Given a finite set of indices s, let q be the product of all denominators a_i.den * b_i.den for i ∈ s. Since all denominators are positive, q is a positive integer. By hypothesis, there is an integer coloring f avoiding false length-3 and true length-17 quadratics with leading coefficient q. For every index i ∈ s, the denominators of a_i and b_i divide q, so the scaled coloring F(x) = f((q * x).num) satisfies the constraint T(i) by the reduction lemma. Thus F belongs to the intersection ⋂_{i ∈ s} T(i), proving it is nonempty.

    lines 101–127

    uses Finset.prod_pos, Nat.mul_pos, Rat.den_pos, Set.mem_iInter, Finset.dvd_prod_of_mem, dvd_trans, Nat.dvd_mul_right, Nat.dvd_mul_left, rational_quadratic_coloring_from_integer_scales_quadratic_coloring_constraint

      have hFIP : ∀ s : Finset Index, (⋂ i ∈ s, T i).Nonempty := by
        intro s
        let d : Index → ℕ := fun i => (aa i).den * (bb i).den
        let q : ℕ := ∏ i ∈ s, d i
        have hqpos : 0 < q := by
          dsimp [q]
          apply Finset.prod_pos
          intro i hi
          exact Nat.mul_pos (aa i).den_pos (bb i).den_pos
        rcases h q hqpos with ⟨f, hf3, hf17⟩
        let F : ℚ → Bool := fun x => f ((q : ℚ) * x).num
        have hFdef : ∀ x : ℚ, F x = f ((q : ℚ) * x).num := fun x => rfl
        refine ⟨F, ?_⟩
        rw [Set.mem_iInter]
        intro i
        rw [Set.mem_iInter]
        intro hi
        have hdvd : d i ∣ q := by
          dsimp [q]
          exact Finset.dvd_prod_of_mem d hi
        have hda : (aa i).den ∣ q := dvd_trans (Nat.dvd_mul_right (aa i).den (bb i).den) hdvd
        have hdb : (bb i).den ∣ q := dvd_trans (Nat.dvd_mul_left (bb i).den (aa i).den) hdvd
        rcases i with ⟨a, b⟩ | ⟨a, b⟩
        · dsimp [T]
          exact rational_quadratic_coloring_from_integer_scales_quadratic_coloring_constraint q f (n := 3) (target := false) hf3 (aa (Sum.inl (a, b))) (bb (Sum.inl (a, b))) hda hdb F hFdef
        · dsimp [T]
          exact rational_quadratic_coloring_from_integer_scales_quadratic_coloring_constraint q f (n := 17) (target := true) hf17 (aa (Sum.inr (a, b))) (bb (Sum.inr (a, b))) hda hdb F hFdef
  7. There exists a rational coloring avoiding all forbidden length-3 and length-17 quadratic progressions.

    By Tychonoff's theorem, the space ℚ → Bool is compact. Since the family of closed sets T(i) has the finite intersection property, their total intersection ⋂_{i : Index} T(i) is nonempty. Any coloring F in this intersection satisfies F ∈ T(inl(a, b)) and F ∈ T(inr(a, b)) for all a, b ∈ ℚ, which gives the required non-monochromatic conditions for all rational coefficients.

    lines 128–139

    uses CompactSpace.iInter_nonempty, Set.mem_iInter

      have hinter : (⋂ i : Index, T i).Nonempty :=
        CompactSpace.iInter_nonempty hTclosed hFIP
      rcases hinter with ⟨F, hF⟩
      have hFall : ∀ i : Index, F ∈ T i := by
        simpa only [Set.mem_iInter] using hF
      refine ⟨F, ?_, ?_⟩
      · intro a b
        have hh := hFall (Sum.inl (a, b))
        simpa [T] using hh
      · intro a b
        have hh := hFall (Sum.inr (a, b))
        simpa [T] using hh
Nat.cast_mul
The natural number cast preserves multiplication: ↑(m * n) = ↑m * ↑n.
Nat.mul_div_cancel'
If n divides m, then n * (m / n) = m.
Int.cast_natCast
The integer cast of a natural number cast into a ring equals the direct natural number cast: ↑(↑n : ℤ) = ↑n.
Rat.mul_den_eq_num
For any rational q, multiplying by its denominator yields its numerator: q * ↑q.den = ↑q.num.
mul_comm
Multiplication is commutative: a * b = b * a.
congrArg
Equal inputs to a function yield equal outputs: a₁ = a₂ implies f a₁ = f a₂.
Rat.num_intCast
The numerator of an integer cast to the rationals is the integer itself: (↑a : ℚ).num = a.
Int.cast_mul
The integer cast preserves multiplication: ↑(m * n) = ↑m * ↑n.
rational_quadratic_coloring_from_integer_scales_rat_num_mul_eq_of_den_dvd
If the denominator of a rational a divides q, then the integer (q / a.den) * a.num equals q * a as a rational number.
rational_quadratic_coloring_from_integer_scales_rat_num_mul_int_quadratic
If integers A and B represent q * a and q * b, then the numerator of q * (k² + a k + b) equals q k² + A k + B.
Set.mem_iUnion
An element belongs to a union of sets if and only if it belongs to at least one set in the family.
Bool.eq_false_of_not_eq_true
A boolean value that is not true must be false.
isClosed_iUnion_of_finite
A finite union of closed sets is closed.
IsClosed.preimage
The preimage of a closed set under a continuous function is closed.
continuous_apply
In a product space, the coordinate projection (evaluation at a point) is continuous.
isClosed_singleton
Singletons are closed in a T₁ topological space.
Bool.eq_true_of_not_eq_false
A boolean value that is not false must be true.
Finset.prod_pos
A finite product of strictly positive elements is strictly positive.
Nat.mul_pos
The product of two strictly positive natural numbers is strictly positive.
Rat.den_pos
The denominator of every rational number is strictly positive.
Set.mem_iInter
An element belongs to an intersection of sets if and only if it belongs to every set in the family.
Finset.dvd_prod_of_mem
An element of a finite set divides the product of all elements in the set.
dvd_trans
Divisibility is transitive: if a divides b and b divides c, then a divides c.
Nat.dvd_mul_right
A natural number a divides a * b.
Nat.dvd_mul_left
A natural number a divides b * a.
rational_quadratic_coloring_from_integer_scales_quadratic_coloring_constraint
If an integer coloring avoids monochromatic progressions with leading coefficient q, its numerator scaling gives a rational coloring avoiding monochromatic progressions whose coefficients have denominators dividing q.
CompactSpace.iInter_nonempty
In a compact space, any family of closed sets with the finite intersection property has a nonempty intersection.

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

private lemma rational_quadratic_coloring_from_integer_scales_rat_num_mul_eq_of_den_dvd (q : ℕ) (a : ℚ) (h : a.den ∣ q) :    (((q / a.den : ℕ) : ℤ) * a.num : ℚ) = (q : ℚ) * a := by  have hq : (q : ℚ) = (a.den : ℚ) * ((q / a.den : ℕ) : ℚ) := by    rw [← Nat.cast_mul, Nat.mul_div_cancel' h]  calc    (((q / a.den : ℕ) : ℤ) * a.num : ℚ)        = ((q / a.den : ℕ) : ℚ) * (a.num : ℚ) := by          simp only [Int.cast_natCast]    _ = ((q / a.den : ℕ) : ℚ) * (a * (a.den : ℚ)) := by rw [← Rat.mul_den_eq_num a]    _ = (((q / a.den : ℕ) : ℚ) * (a.den : ℚ)) * a := by ring    _ = (q : ℚ) * a := by          rw [mul_comm ((q / a.den : ℕ) : ℚ) (a.den : ℚ), ← hq]private lemma rational_quadratic_coloring_from_integer_scales_rat_num_mul_int_quadratic    (q : ℕ) (a b : ℚ) (A B : ℤ)    (hA : (A : ℚ) = (q : ℚ) * a) (hB : (B : ℚ) = (q : ℚ) * b)    (n : ℕ) (k : Fin n) :    ((q : ℚ) * ((k.val : ℚ) ^ 2 + a * (k.val : ℚ) + b)).num =      (q : ℤ) * (k.val : ℤ) ^ 2 + A * (k.val : ℤ) + B := by  let J : ℤ := (q : ℤ) * (k.val : ℤ) ^ 2 + A * (k.val : ℤ) + B  have hq : (q : ℚ) * ((k.val : ℚ) ^ 2 + a * (k.val : ℚ) + b) = (J : ℚ) := by    dsimp [J]    push_cast    rw [hA, hB]    ring  have hnum := congrArg Rat.num hq  simpa [Rat.num_intCast] using hnumprivate lemma rational_quadratic_coloring_from_integer_scales_quadratic_coloring_constraint    (q : ℕ) (f : ℤ → Bool) {n : ℕ} (target : Bool)    (hf : ∀ A B : ℤ, ¬ ∀ k : Fin n,      f ((q : ℤ) * (k.val : ℤ) ^ 2 + A * (k.val : ℤ) + B) = target)    (a b : ℚ) (ha : a.den ∣ q) (hb : b.den ∣ q)    (F : ℚ → Bool) (hF : ∀ x, F x = f ((q : ℚ) * x).num) :    ¬ ∀ k : Fin n, F ((k.val : ℚ) ^ 2 + a * (k.val : ℚ) + b) = target := by  let A : ℤ := ((q / a.den : ℕ) : ℤ) * a.num  let B : ℤ := ((q / b.den : ℕ) : ℤ) * b.num  have hA : (A : ℚ) = (q : ℚ) * a := by    dsimp [A]    simp only [Int.cast_mul]    exact rational_quadratic_coloring_from_integer_scales_rat_num_mul_eq_of_den_dvd q a ha  have hB : (B : ℚ) = (q : ℚ) * b := by    dsimp [B]    simp only [Int.cast_mul]    exact rational_quadratic_coloring_from_integer_scales_rat_num_mul_eq_of_den_dvd q b hb  intro h  apply hf A B  intro k  have hp := rational_quadratic_coloring_from_integer_scales_rat_num_mul_int_quadratic q a b A B hA hB n k  have hk := h k  rw [hF ((k.val : ℚ) ^ 2 + a * (k.val : ℚ) + b), hp] at hk  exact hktheorem rational_quadratic_coloring_from_integer_scales (h : ∀ q : ℕ, 0 < q → ∃ f : ℤ → Bool, (∀ a b : ℤ, ¬ ∀ k : Fin 3, f ((q : ℤ) * (k.val : ℤ) ^ 2 + a * k.val + b) = false) ∧ (∀ a b : ℤ, ¬ ∀ k : Fin 17, f ((q : ℤ) * (k.val : ℤ) ^ 2 + a * k.val + b) = true)) : ∃ f : ℚ → Bool, (∀ a b : ℚ, ¬ ∀ k : Fin 3, f ((k.val : ℚ) ^ 2 + a * k.val + b) = false) ∧ (∀ a b : ℚ, ¬ ∀ k : Fin 17, f ((k.val : ℚ) ^ 2 + a * k.val + b) = true) := by  let Index : Type := (ℚ × ℚ) ⊕ (ℚ × ℚ)  let aa : Index → ℚ := fun i => match i with | Sum.inl p => p.1 | Sum.inr p => p.1  let bb : Index → ℚ := fun i => match i with | Sum.inl p => p.2 | Sum.inr p => p.2  let T : Index → Set (ℚ → Bool) := fun i =>    match i with    | Sum.inl p => {F : ℚ → Bool | ¬ ∀ k : Fin 3, F ((k.val : ℚ) ^ 2 + p.1 * (k.val : ℚ) + p.2) = false}    | Sum.inr p => {F : ℚ → Bool | ¬ ∀ k : Fin 17, F ((k.val : ℚ) ^ 2 + p.1 * (k.val : ℚ) + p.2) = true}  have hTclosed : ∀ i : Index, IsClosed (T i) := by    intro i    rcases i with ⟨a, b⟩ | ⟨a, b⟩    · dsimp [T]      let x : Fin 3 → ℚ := fun k => (k.val : ℚ) ^ 2 + a * (k.val : ℚ) + b      have hset : {F : ℚ → Bool | ¬ ∀ k : Fin 3, F (x k) = false} =          ⋃ k : Fin 3, {F : ℚ → Bool | F (x k) = true} := by        ext F        simp only [Set.mem_iUnion]        constructor        · intro hh          by_contra hne          apply hh          intro k          exact Bool.eq_false_of_not_eq_true (fun hk => hne ⟨k, hk⟩)        · rintro ⟨k, hk⟩ hall          simp [hall] at hk      rw [hset]      apply isClosed_iUnion_of_finite      intro k      exact IsClosed.preimage (continuous_apply (x k)) isClosed_singleton    · dsimp [T]      let x : Fin 17 → ℚ := fun k => (k.val : ℚ) ^ 2 + a * (k.val : ℚ) + b      have hset : {F : ℚ → Bool | ¬ ∀ k : Fin 17, F (x k) = true} =          ⋃ k : Fin 17, {F : ℚ → Bool | F (x k) = false} := by        ext F        simp only [Set.mem_iUnion]        constructor        · intro hh          by_contra hne          apply hh          intro k          exact Bool.eq_true_of_not_eq_false (fun hk => hne ⟨k, hk⟩)        · rintro ⟨k, hk⟩ hall          simp [hall] at hk      rw [hset]      apply isClosed_iUnion_of_finite      intro k      exact IsClosed.preimage (continuous_apply (x k)) isClosed_singleton  have hFIP : ∀ s : Finset Index, (⋂ i ∈ s, T i).Nonempty := by    intro s    let d : Index → ℕ := fun i => (aa i).den * (bb i).den    let q : ℕ := ∏ i ∈ s, d i    have hqpos : 0 < q := by      dsimp [q]      apply Finset.prod_pos      intro i hi      exact Nat.mul_pos (aa i).den_pos (bb i).den_pos    rcases h q hqpos with ⟨f, hf3, hf17⟩    let F : ℚ → Bool := fun x => f ((q : ℚ) * x).num    have hFdef : ∀ x : ℚ, F x = f ((q : ℚ) * x).num := fun x => rfl    refine ⟨F, ?_⟩    rw [Set.mem_iInter]    intro i    rw [Set.mem_iInter]    intro hi    have hdvd : d i ∣ q := by      dsimp [q]      exact Finset.dvd_prod_of_mem d hi    have hda : (aa i).den ∣ q := dvd_trans (Nat.dvd_mul_right (aa i).den (bb i).den) hdvd    have hdb : (bb i).den ∣ q := dvd_trans (Nat.dvd_mul_left (bb i).den (aa i).den) hdvd    rcases i with ⟨a, b⟩ | ⟨a, b⟩    · dsimp [T]      exact rational_quadratic_coloring_from_integer_scales_quadratic_coloring_constraint q f (n := 3) (target := false) hf3 (aa (Sum.inl (a, b))) (bb (Sum.inl (a, b))) hda hdb F hFdef    · dsimp [T]      exact rational_quadratic_coloring_from_integer_scales_quadratic_coloring_constraint q f (n := 17) (target := true) hf17 (aa (Sum.inr (a, b))) (bb (Sum.inr (a, b))) hda hdb F hFdef  have hinter : (⋂ i : Index, T i).Nonempty :=    CompactSpace.iInter_nonempty hTclosed hFIP  rcases hinter with ⟨F, hF⟩  have hFall : ∀ i : Index, F ∈ T i := by    simpa only [Set.mem_iInter] using hF  refine ⟨F, ?_, ?_⟩  · intro a b    have hh := hFall (Sum.inl (a, b))    simpa [T] using hh  · intro a b    have hh := hFall (Sum.inr (a, b))    simpa [T] using hh
See it in the graphDiscuss this resultChallenge it