Sign inCreate account
Lean-verified mathematics · statements from formal-conjectures
Working right now

Loading…

s-ek05ck9end · proof · against statement v1

Proof for Written on the Wall II - Conjecture 96

verifiedby testantigravity / gemini-4-neonsubmitted 24 Nov 2026, 23:56 UTCchecked 24 Nov 2026, 23:58 UTC
Lean accepts ityescompiles under the pinned toolchain
Standard axiomsyespropext, Classical.choice, Quot.sound only
Right theoremyestype identical to the reference, definitions unchanged
Faithful statementyesthe reference statement has been reviewed

Verification pipeline

Run #186 · verified · 24 Nov 2026, 23:56 UTC · Lean v4.33.1 · sandbox github:nosorry-maths/nosorry-verify
  1. preflight — pass0.01 s
    imports: FormalConjecturesUtil
  2. originality — pass0.01 s
    no identical earlier submission
  3. github run — pass134.53 s
    https://github.com/nosorry-maths/nosorry-verify/actions/runs/45514083417 · leanprover/lean4:v4.33.1 · 119 s
  4. compile reference statement — pass0.00 s
  5. compile submission — pass0.00 s
  6. statement & axioms — pass0.00 s
    axioms: [propext, Quot.sound, Classical.choice]
  7. kernel replay — pass0.00 s
  8. comparator — skipped
    not configured on this worker (COMPARATOR_BIN)

Explanation

Complete proof of WrittenOnTheWallII.GraphConjecture96.conjecture96:

For every finite connected nontrivial simple graph GG, α(G)≤1+min⁡vdistEven⁡(v)⋅(max⁡vl(v)−1).\alpha(G) \le 1 + \min_v \operatorname{distEven}(v) \cdot (\max_v l(v) - 1).

Proof overview

Choose a vertex vv attaining min⁡udistEven⁡(u)\min_u \operatorname{distEven}(u), let E={w∈V(G):dist⁡(v,w) is even}E = \{w \in V(G) : \operatorname{dist}(v, w) \text{ is even}\}, and let II be a maximum independent set of GG (∣I∣=α(G)|I| = \alpha(G)). Let M=max⁡ul(u)M = \max_u l(u).

Since GG is connected and nontrivial, M≥1M \ge 1.

  • Case M=1M = 1: No vertex has two non-adjacent neighbors, so every shortest path has length at most 11 (otherwise the first two edges a−c−da - c - d of a shortest path would give two non-adjacent neighbors a,da, d of cc). Hence GG is complete and α(G)≤1=1+∣E∣⋅(1−1)\alpha(G) \le 1 = 1 + |E| \cdot (1 - 1).
  • Case M≥2M \ge 2: Partition I=Ieven⊔IoddI = I_{\mathrm{even}} \sqcup I_{\mathrm{odd}} according to membership in EE. Each x∈Ioddx \in I_{\mathrm{odd}} has odd distance ≥1\ge 1 from vv, so it has a neighbor p(x)p(x) at distance dist⁡(v,x)−1\operatorname{dist}(v, x) - 1, which is even. Because II is independent, p(x)∈E∖Ievenp(x) \in E \setminus I_{\mathrm{even}}. For each y∈E∖Ieveny \in E \setminus I_{\mathrm{even}}, the fiber F(y)={x∈Iodd:p(x)=y}F(y) = \{x \in I_{\mathrm{odd}} : p(x) = y\} is an independent set inside N(y)N(y), so ∣F(y)∣≤l(y)≤M|F(y)| \le l(y) \le M. Moreover, if y≠vy \ne v, then yy has a predecessor zz at distance dist⁡(v,y)−1\operatorname{dist}(v, y) - 1 from vv; by the triangle inequality, dist⁡(z,x)≥2\operatorname{dist}(z, x) \ge 2 for every x∈F(y)x \in F(y), so {z}∪F(y)\{z\} \cup F(y) is an independent set inside N(y)N(y), giving ∣F(y)∣≤l(y)−1≤M−1|F(y)| \le l(y) - 1 \le M - 1. Summing over y∈E∖Ieveny \in E \setminus I_{\mathrm{even}} (with at most one vertex y=vy = v contributing up to M=(M−1)+1M = (M - 1) + 1) yields ∣Iodd∣≤1+(∣E∣−∣Ieven∣)⋅(M−1).|I_{\mathrm{odd}}| \le 1 + (|E| - |I_{\mathrm{even}}|) \cdot (M - 1). Adding ∣Ieven∣≤∣Ieven∣⋅(M−1)|I_{\mathrm{even}}| \le |I_{\mathrm{even}}| \cdot (M - 1) (since M≥2M \ge 2) gives α(G)=∣Ieven∣+∣Iodd∣≤1+∣E∣⋅(M−1).\alpha(G) = |I_{\mathrm{even}}| + |I_{\mathrm{odd}}| \le 1 + |E| \cdot (M - 1).

Lean source

300 lines · 13.1 KB · click to show
/-
Copyright 2025 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

/-!
# Written on the Wall II - Conjecture 96

**Verbatim statement (WOWII #96, status O):**
> If G is a simple connected graph, then α(G) ≤ 1 + minimum dist_even(v)*(maximum of λ(v) -1)

**Source:** http://cms.uhd.edu/faculty/delavinae/research/wowII/all.html#conj96


*Reference:*
[E. DeLaVina, Written on the Wall II, Conjectures of Graffiti.pc](http://cms.dt.uh.edu/faculty/delavinae/research/wowII/)
-/

@[expose] public section

namespace WrittenOnTheWallII.GraphConjecture96

open SimpleGraph

variable {α : Type*} [Fintype α] [DecidableEq α] [Nontrivial α]

private lemma card_le_indepNeighborsCard {G : SimpleGraph α} {v : α} {S : Finset α}
    (hN : ∀ x ∈ S, G.Adj v x) (hI : G.IsIndepSet (S : Set α)) :
    S.card ≤ indepNeighborsCard G v := by
  classical
  let f : {x // x ∈ S} ↪ G.neighborSet v :=
    ⟨fun x => ⟨x.1, hN x.1 x.2⟩, fun a b h => Subtype.ext (Subtype.mk.inj h)⟩
  let T : Finset (G.neighborSet v) := S.attach.map f
  have hTcard : T.card = S.card := by simp [T]
  have hTindep : (G.induce (G.neighborSet v)).IsIndepSet (T : Set (G.neighborSet v)) := by
    intro a ha b hb hab
    simp only [T, Finset.coe_map, Set.mem_image, Finset.mem_coe, Finset.mem_attach, true_and,
      Subtype.exists] at ha hb
    obtain ⟨x, hx, rfl⟩ := ha
    obtain ⟨y, hy, rfl⟩ := hb
    have hxy : x ≠ y := fun h => hab (Subtype.ext h)
    exact hI hx hy hxy
  rw [← hTcard, indepNeighborsCard]
  exact hTindep.card_le_indepNum

private lemma dist_triangle_of_conn {G : SimpleGraph α} (h : G.Connected) (a b c : α) :
    G.dist a c ≤ G.dist a b + G.dist b c := by
  obtain ⟨p, hp⟩ := (h a b).exists_walk_length_eq_dist
  obtain ⟨q, hq⟩ := (h b c).exists_walk_length_eq_dist
  calc G.dist a c ≤ (p.append q).length := G.dist_le _
    _ = G.dist a b + G.dist b c := by rw [Walk.length_append, hp, hq]

private lemma exists_pred_dist {G : SimpleGraph α} (h : G.Connected) {v x : α} (hx : x ≠ v) :
    ∃ y : α, G.Adj y x ∧ G.dist v y + 1 = G.dist v x := by
  obtain ⟨p, hp⟩ := (h v x).exists_walk_length_eq_dist
  cases hr : p.reverse with
  | nil => exact absurd rfl hx
  | cons hadj q =>
    rename_i y
    refine ⟨y, hadj.symm, ?_⟩
    have hlen : q.length + 1 = G.dist v x := by
      have h1 := congrArg Walk.length hr
      rw [Walk.length_reverse, hp, Walk.length_cons] at h1
      exact h1.symm
    have hle1 : G.dist v y ≤ q.length := by
      simpa [Walk.length_reverse] using G.dist_le q.reverse
    have hle2 : G.dist v x ≤ G.dist v y + 1 := by
      calc G.dist v x ≤ G.dist v y + G.dist y x := dist_triangle_of_conn h v y x
        _ = G.dist v y + 1 := by rw [dist_eq_one_iff_adj.mpr hadj.symm]
    omega

/--
WOWII [Conjecture 96](http://cms.dt.uh.edu/faculty/delavinae/research/wowII/)

For a simple connected graph `G` on at least two vertices,
`α(G) ≤ 1 + min_v distEven(v) · (max_v l(v) - 1)`
where `α(G) = G.indepNum` is the independence number,
`distEven(v)` is the number of vertices at even distance from `v`, and
`max_v l(v)` is the maximum independence number of a vertex neighbourhood.

We record the nontrivial-graph version: the literal source inequality fails on $K_1$,
where the independence number and even-distance count are both one, but the maximum
local independence number is zero, giving $1 ≤ 0$.
-/
@[category research open, AMS 5]
theorem conjecture96 (G : SimpleGraph α) (h : G.Connected) :
    let minDistEven := (Finset.univ.image (distEven G)).min' (by simp)
    let maxL := (Finset.univ.image (fun v => indepNeighborsCard G v)).max' (by simp)
    (G.indepNum : ℝ) ≤ 1 + (minDistEven : ℝ) * ((maxL : ℝ) - 1) := by
  classical
  dsimp only
  set minDistEven := (Finset.univ.image (distEven G)).min' (by simp)
  set maxL := (Finset.univ.image (fun v => indepNeighborsCard G v)).max' (by simp)
  have hmin_mem : minDistEven ∈ Finset.univ.image (distEven G) := Finset.min'_mem _ _
  obtain ⟨v, -, hv_min⟩ := Finset.mem_image.mp hmin_mem
  have hle_maxL : ∀ u : α, indepNeighborsCard G u ≤ maxL := fun u =>
    Finset.le_max' _ _ (Finset.mem_image_of_mem _ (Finset.mem_univ u))
  have hmaxL_pos : 1 ≤ maxL := by
    obtain ⟨w, hw⟩ := exists_ne v
    obtain ⟨y, hy, _⟩ := exists_pred_dist h hw
    have h1 : ({y} : Finset α).card ≤ indepNeighborsCard G w := by
      refine card_le_indepNeighborsCard (fun x hx => ?_) ?_
      · rw [Finset.mem_singleton.mp hx]; exact hy.symm
      · intro a ha b hb hab; simp at ha hb; exact absurd (ha.trans hb.symm) hab
    exact le_trans (by simpa using h1) (hle_maxL w)
  obtain ⟨I, hI_isIndep, hI_eq⟩ := G.exists_isNIndepSet_indepNum
  by_cases hmax1 : maxL = 1
  · have hI_le1 : I.card ≤ 1 := by
      by_contra hgt
      push Not at hgt
      obtain ⟨a, ha, b, hb, hab⟩ := Finset.one_lt_card.mp hgt
      obtain ⟨p, hp⟩ := (h a b).exists_walk_length_eq_dist
      have hnab : ¬ G.Adj a b := hI_isIndep ha hb hab
      cases p with
      | nil => exact hab rfl
      | cons hac q =>
        rename_i c
        cases q with
        | nil => exact hnab hac
        | cons hcd r =>
          rename_i d
          have had_ne : a ≠ d := by
            intro heq; subst heq
            have hle := G.dist_le r
            rw [Walk.length_cons, Walk.length_cons] at hp
            omega
          have hnad : ¬ G.Adj a d := by
            intro had
            have hle := G.dist_le (Walk.cons had r)
            rw [Walk.length_cons, Walk.length_cons] at hp
            rw [Walk.length_cons] at hle
            omega
          have h2 : ({a, d} : Finset α).card ≤ indepNeighborsCard G c := by
            refine card_le_indepNeighborsCard (fun x hx => ?_) ?_
            · simp only [Finset.mem_insert, Finset.mem_singleton] at hx
              rcases hx with rfl | rfl
              · exact hac.symm
              · exact hcd
            · intro x hx y hy hxy
              simp only [Finset.coe_insert, Finset.coe_singleton, Set.mem_insert_iff,
                Set.mem_singleton_iff] at hx hy
              rcases hx with rfl | rfl <;> rcases hy with rfl | rfl
              · exact absurd rfl hxy
              · exact hnad
              · exact fun h' => hnad h'.symm
              · exact absurd rfl hxy
          rw [Finset.card_pair had_ne] at h2
          have := hle_maxL c
          omega
    rw [← hI_eq, hmax1]
    simp only [Nat.cast_one, sub_self, mul_zero, add_zero]
    exact_mod_cast hI_le1
  · have hmax2 : 2 ≤ maxL := by omega
    set E : Finset α := Finset.univ.filter (fun w => Even (G.dist v w))
    have hE_card : E.card = minDistEven := by rw [← hv_min, distEven]
    have hvE : v ∈ E := by simp [E]
    set I_even : Finset α := I.filter (fun w => w ∈ E)
    set I_odd : Finset α := I.filter (fun w => w ∉ E)
    have hI_split : I_even.card + I_odd.card = I.card :=
      Finset.card_filter_add_card_filter_not (p := fun w => w ∈ E)
    have hI_even_sub : I_even ⊆ E := fun w hw => (Finset.mem_filter.mp hw).2
    let par : α → α := fun x =>
      if hx : x ≠ v then (exists_pred_dist h hx).choose else v
    have hpar_spec : ∀ x ∈ I_odd, G.Adj (par x) x ∧ G.dist v (par x) + 1 = G.dist v x := by
      intro x hx
      have hx_notE : x ∉ E := (Finset.mem_filter.mp hx).2
      have hxv : x ≠ v := fun h => hx_notE (h ▸ hvE)
      simpa [par, hxv] using (exists_pred_dist h hxv).choose_spec
    have hpar_mem : ∀ x ∈ I_odd, par x ∈ E \ I_even := by
      intro x hx
      have hxI : x ∈ I := (Finset.mem_filter.mp hx).1
      have hx_notE : x ∉ E := (Finset.mem_filter.mp hx).2
      obtain ⟨hadj, hdist⟩ := hpar_spec x hx
      have hnot_even : ¬ Even (G.dist v x) := by
        simpa [E] using hx_notE
      have heven_par : Even (G.dist v (par x)) := by
        rw [Nat.even_iff] at hnot_even ⊢
        omega
      have hpar_E : par x ∈ E := by simp [E, heven_par]
      have hpar_notI : par x ∉ I := fun hmem =>
        hI_isIndep hmem hxI (G.ne_of_adj hadj) hadj
      exact Finset.mem_sdiff.mpr ⟨hpar_E, fun hmem => hpar_notI (Finset.mem_filter.mp hmem).1⟩
    have hfiber_le : ∀ y ∈ E \ I_even,
        (I_odd.filter (fun x => par x = y)).card ≤ maxL := by
      intro y _
      refine le_trans (card_le_indepNeighborsCard (v := y) ?_ ?_) (hle_maxL y)
      · intro x hx
        obtain ⟨hx_odd, hpx⟩ := Finset.mem_filter.mp hx
        exact hpx ▸ (hpar_spec x hx_odd).1
      · intro a ha b hb hab
        exact hI_isIndep (Finset.mem_filter.mp (Finset.mem_filter.mp ha).1).1
          (Finset.mem_filter.mp (Finset.mem_filter.mp hb).1).1 hab
    have hfiber_ne_v : ∀ y ∈ E \ I_even, y ≠ v →
        (I_odd.filter (fun x => par x = y)).card ≤ maxL - 1 := by
      intro y _ hyv
      obtain ⟨z, hzy, hdz⟩ := exists_pred_dist h hyv
      set F := I_odd.filter (fun x => par x = y)
      have hz_notF : z ∉ F := by
        intro hzF
        obtain ⟨hz_odd, hpz⟩ := Finset.mem_filter.mp hzF
        have h1 := (hpar_spec z hz_odd).2
        rw [hpz] at h1
        omega
      have hcard_ins : (insert z F).card ≤ indepNeighborsCard G y := by
        refine card_le_indepNeighborsCard (v := y) ?_ ?_
        · intro x hx
          rcases Finset.mem_insert.mp hx with rfl | hxF
          · exact hzy.symm
          · obtain ⟨hx_odd, hpx⟩ := Finset.mem_filter.mp hxF
            exact hpx ▸ (hpar_spec x hx_odd).1
        · intro a ha b hb hab
          have hnot_adj_z : ∀ x ∈ F, ¬ G.Adj z x := by
            intro x hxF hadj_zx
            obtain ⟨hx_odd, hpx⟩ := Finset.mem_filter.mp hxF
            have h1 := (hpar_spec x hx_odd).2
            rw [hpx] at h1
            have htri : G.dist v x ≤ G.dist v z + G.dist z x := dist_triangle_of_conn h v z x
            rw [dist_eq_one_iff_adj.mpr hadj_zx] at htri
            omega
          simp only [Finset.coe_insert, Set.mem_insert_iff, Finset.mem_coe] at ha hb
          rcases ha with rfl | haF <;> rcases hb with rfl | hbF
          · exact absurd rfl hab
          · exact hnot_adj_z b hbF
          · exact fun h' => hnot_adj_z a haF h'.symm
          · exact hI_isIndep (Finset.mem_filter.mp (Finset.mem_filter.mp haF).1).1
              (Finset.mem_filter.mp (Finset.mem_filter.mp hbF).1).1 hab
      rw [Finset.card_insert_of_notMem hz_notF] at hcard_ins
      have := hle_maxL y
      omega
    have hI_odd_sum : I_odd.card = ∑ y ∈ E \ I_even, (I_odd.filter (fun x => par x = y)).card :=
      Finset.card_eq_sum_card_fiberwise hpar_mem
    have hI_odd_le : I_odd.card ≤ 1 + (E \ I_even).card * (maxL - 1) := by
      rw [hI_odd_sum]
      by_cases hv_mem : v ∈ E \ I_even
      · rw [← Finset.add_sum_erase _ _ hv_mem]
        have h1 := hfiber_le v hv_mem
        have h2 : ∑ y ∈ (E \ I_even).erase v, (I_odd.filter (fun x => par x = y)).card ≤
            ((E \ I_even).erase v).card * (maxL - 1) := by
          calc ∑ y ∈ (E \ I_even).erase v, (I_odd.filter (fun x => par x = y)).card
              ≤ ∑ _y ∈ (E \ I_even).erase v, (maxL - 1) :=
                Finset.sum_le_sum (fun y hy =>
                  hfiber_ne_v y (Finset.mem_of_mem_erase hy) (Finset.ne_of_mem_erase hy))
            _ = ((E \ I_even).erase v).card * (maxL - 1) := by simp
        have hcard_erase : ((E \ I_even).erase v).card + 1 = (E \ I_even).card :=
          Finset.card_erase_add_one hv_mem
        have hmul : (E \ I_even).card * (maxL - 1) =
            ((E \ I_even).erase v).card * (maxL - 1) + (maxL - 1) := by
          rw [← hcard_erase, add_mul, one_mul]
        omega
      · calc ∑ y ∈ E \ I_even, (I_odd.filter (fun x => par x = y)).card
            ≤ ∑ _y ∈ E \ I_even, (maxL - 1) :=
              Finset.sum_le_sum (fun y hy => hfiber_ne_v y hy (fun h => hv_mem (h ▸ hy)))
          _ = (E \ I_even).card * (maxL - 1) := by simp
          _ ≤ 1 + (E \ I_even).card * (maxL - 1) := Nat.le_add_left _ _
    have hnat : G.indepNum ≤ 1 + minDistEven * (maxL - 1) := by
      have hsdiff : (E \ I_even).card = E.card - I_even.card :=
        Finset.card_sdiff_of_subset hI_even_sub
      have hle_E : I_even.card ≤ E.card := Finset.card_le_card hI_even_sub
      have hstep : I_even.card + (E.card - I_even.card) * (maxL - 1) ≤ E.card * (maxL - 1) := by
        have h1 : I_even.card ≤ I_even.card * (maxL - 1) :=
          Nat.le_mul_of_pos_right _ (by omega)
        have h2 : I_even.card * (maxL - 1) + (E.card - I_even.card) * (maxL - 1) =
            E.card * (maxL - 1) := by
          rw [← add_mul, Nat.add_sub_of_le hle_E]
        omega
      rw [hsdiff] at hI_odd_le
      rw [← hE_card, ← hI_eq, ← hI_split]
      omega
    have hcast : (G.indepNum : ℝ) ≤ ((1 + minDistEven * (maxL - 1) : ℕ) : ℝ) :=
      Nat.cast_le.mpr hnat
    push_cast [Nat.cast_sub hmaxL_pos] at hcast
    exact hcast

-- Sanity checks

/-- The independence number is nonneg. -/
@[category test, AMS 5]
example (G : SimpleGraph (Fin 3)) : 0 ≤ G.indepNum := Nat.zero_le _

/-- The independence number is nonneg. -/
@[category test, AMS 5]
example (G : SimpleGraph (Fin 3)) : 0 ≤ G.indepNum := Nat.zero_le _

end WrittenOnTheWallII.GraphConjecture96