Skip to content

Commit

Permalink
Avoid trivial square differences
Browse files Browse the repository at this point in the history
  • Loading branch information
gdahia committed Oct 6, 2024
1 parent caf2479 commit f3538ee
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions FurstenbergSarkozy/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ noncomputable def generalizedCountOfSquares (n : ℕ) (f₁ f₂ : ℕ → ℝ)
noncomputable def countOfSquares (n : ℕ) (f : ℕ → ℝ) : ℝ :=
generalizedCountOfSquares n f f

def Finset.containsSquareDifference (S : Finset ℕ) : Prop := ∃ d : ℕ, ∃ a ∈ S, a + d ^ 2 ∈ S
def Finset.containsSquareDifference (S : Finset ℕ) : Prop :=
∃ d : {d : ℕ // d > 0}, ∃ a ∈ S, a + d ^ 2 ∈ S

noncomputable def Finset.indicator {α : Type} [DecidableEq α] (S : Finset α) : α → ℝ :=
S.toSet.indicator (const α 1)
Expand All @@ -33,21 +34,24 @@ lemma non_zero_countOfSquares_implies_squareDifference (n : ℕ) (S : Finset ℕ
apply sum_eq_zero
intros x _
apply sum_eq_zero
intros r _
intros y hy
apply sum_eq_zero
intros h _
intros z hz

by_cases (x ∈ S)
case neg xNotInS =>
unfold indicator
simp
left
exact if_neg xNotInS
exact xNotInS
case pos xInS =>
unfold indicator
simp
right
exact if_neg (squareDifferenceFree (r + h) x xInS)
simp at hy
simp at hz
have ypz_pos : 0 < y + z := by omega
exact (squareDifferenceFree ⟨ y + z, ypz_pos ⟩ x xInS)

noncomputable def maxOfGeneralizedCountOfSquares (n₁ n₂ n₃ : ℕ) :=
n₁ * (upperBoundOny n₂) * (upperBoundOnz n₃)
Expand Down

0 comments on commit f3538ee

Please sign in to comment.