Show full file and definitions
/-
Copyright 2026 The Formal Conjectures Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-/
module
public import FormalConjecturesUtil
/-!
# Erdős Problem 703
*References:*
- [erdosproblems.com/703](https://www.erdosproblems.com/703)
- [Er75f] Erdős, Paul, _On some problems of elementary and combinatorial geometry_. Ann. Mat.
Pura Appl. (4) (1975), 99-108.
- [Er76b] Erdős, P., _Problems and results in graph theory and combinatorial analysis_.
Proceedings of the Fifth British Combinatorial Conference (Univ. Aberdeen, Aberdeen, 1975)
(1976), 169-192.
- [Er81] Erdős, P., _On the combinatorial problems which I would most like to see solved_.
Combinatorica (1981), 25-42.
- [Er82e] Erdős, Paul, _Some of my favourite problems which recently have been solved_. (1982),
59--79.
- [FrFu84b] Frankl, P. and Füredi, Z., _On hypergraphs without two edges intersecting in a given
number of vertices_. J. Combin. Theory Ser. A (1984), 230-236.
- [Fr77b] Frankl, P., _An intersection problem for finite sets_. Acta Math. Acad. Sci. Hungar.
(1977), 371-373.
- [FrRo87] Frankl, Peter and Rödl, Vojtech, _Forbidden intersections_. Trans. Amer. Math. Soc.
(1987), 259-286.
-/
@[expose] public section
open Finset
namespace Erdos703
/-- `T n r` is maximal such that there exists a family $\mathcal{F}$ of subsets of
$\{1,\ldots,n\}$ of size `T n r` such that $\lvert A\cap B\rvert\neq r$ for all
$A,B\in \mathcal{F}$ (including $A=B$). -/
noncomputable def T (n r : ℕ) : ℕ :=
sSup {k | ∃ 𝓕 : Finset (Finset (Fin n)),
(∀ A ∈ 𝓕, ∀ B ∈ 𝓕, (A ∩ B).card ≠ r) ∧ 𝓕.card = k}
set_option linter.style.formal_proof_palomar false in
/--
Let $r\geq 1$ and define $T(n,r)$ to be maximal such that there exists a family $\mathcal{F}$ of
subsets of $\{1,\ldots,n\}$ of size $T(n,r)$ such that $\lvert A\cap B\rvert\neq r$ for all
$A,B\in \mathcal{F}$.
Estimate $T(n,r)$ for $r\geq 2$. In particular, is it true that for every $\epsilon>0$ there
exists $\delta>0$ such that for all $\epsilon n<r<(1/2-\epsilon) n$ we have
$$T(n,r)<(2-\delta)^n?$$
The answer is yes, proved by Frankl and Rödl [FrRo87].
-/
@[category research solved, question, AMS 5, formal_proof using lean4 at
"https://github.com/plby/lean-proofs/blob/8822f7ddef30fadbd92e1c6ab4ed897af356af5e/src/latest/ErdosProblems/Erdos703.lean#L331"]
theorem erdos_703 :
∀ ε : ℝ, 0 < ε → ∃ δ : ℝ, 0 < δ ∧
∀ (n r : ℕ), ε * n < r → r < (1 / 2 - ε) * n → (T n r : ℝ) < (2 - δ) ^ n := by
sorry
/-- It is trivial that $T(n,0)=2^{n-1}$. -/
@[category textbook, AMS 5]
theorem erdos_703.variants.zero (n : ℕ) (hn : 1 ≤ n) : T n 0 = 2 ^ (n - 1) := by
have : Nonempty (Fin n) := ⟨⟨0, hn⟩⟩
have hcard : Fintype.card (Finset (Fin n)) = 2 * 2 ^ (n - 1) := by
rw [Fintype.card_finset, Fintype.card_fin, ← pow_succ']
congr 1
omega
have hiff : ∀ A B : Finset (Fin n), (A ∩ B).card ≠ 0 ↔ ¬ Disjoint A B := by
intro A B
rw [Ne, Finset.card_eq_zero, Finset.disjoint_iff_inter_eq_empty]
unfold T
apply le_antisymm
· refine csSup_le' ?_
rintro _ ⟨𝓕, h𝓕, rfl⟩
have h : (𝓕 : Set (Finset (Fin n))).Intersecting := by
intro A hA B hB
exact (hiff A B).1 (h𝓕 A (Finset.mem_coe.1 hA) B (Finset.mem_coe.1 hB))
have := h.card_le
omega
· have h0 : ((∅ : Finset (Finset (Fin n))) : Set (Finset (Fin n))).Intersecting := by
simp [Set.intersecting_empty]
obtain ⟨t, -, ht, hti⟩ := h0.exists_card_eq
refine le_csSup ⟨2 ^ n, ?_⟩ ⟨t, fun A hA B hB ↦ (hiff A B).2
(hti (Finset.mem_coe.2 hA) (Finset.mem_coe.2 hB)), by omega⟩
rintro _ ⟨𝓕, -, rfl⟩
exact (Finset.card_le_univ 𝓕).trans (by rw [Fintype.card_finset, Fintype.card_fin])
/--
Frankl and Füredi [FrFu84b] proved that, for fixed $r$ and $n$ sufficiently large in terms of
$r$, the maximal $T(n,r)$ is achieved by taking
$$\mathcal{F} = \left\{ A\subseteq \{1,\ldots,n\} : \lvert A\rvert> \frac{n+r}{2}\textrm{ or }
\lvert A\rvert < r\right\}$$
when $n+r$ is odd, and
$$\mathcal{F} = \left\{ A\subseteq \{1,\ldots,n\} : \lvert A\backslash \{1\}\rvert\geq
\frac{n+r}{2}\textrm{ or }\lvert A\rvert < r\right\}$$
when $n+r$ is even.
-/
@[category research solved, AMS 5]
theorem erdos_703.variants.frankl_furedi (r : ℕ) : ∀ᶠ n : ℕ in Filter.atTop,
T n r = if (n + r) % 2 = 1 then
((univ : Finset (Finset (Fin n))).filter fun A ↦
(n + r : ℝ) / 2 < A.card ∨ A.card < r).card
else
((univ : Finset (Finset (Fin n))).filter fun A ↦
(n + r : ℝ) / 2 ≤ (A.filter fun i : Fin n ↦ (i : ℕ) ≠ 0).card ∨
A.card < r).card := by
sorry
end Erdos703