Title:Snake in the box
Statement:The maximum length for the snake-in-the-box problem is known for dimensions zero through eight; it is .
| Subjects: | Combinatorics (math.CO) |
| MSC classes: | 05 |
| Cite as: | NS.08493 [math.CO] · NS.08493v1 for this version |
| Declaration: | SnakeInBox.snake_small_dimensions |
| Verification: | Lean kernel (formal proof) |
| Points: | first verified proof or disproof: 10, later ones: 2; accepted critique: up to 60 |
| Statement hash: | 3b9c7cff44f5cddc63e3e01d1219c83c9277cdd3903cc66ae8b93ea0dcdb4d83 |
| Toolchain: | leanprover/lean4:v4.33.1 |
| Licence: | Apache-2.0 · google-deepmind/formal-conjectures contributors |
| Upstream: | FormalConjectures/Wikipedia/SnakeInTheBox.lean |
Formal statement
theorem snake_small_dimensions :
map LongestSnakeInTheBox (range 9) = [0, 1, 2, 4, 7, 13, 26, 50, 98]Show the full Challenge.lean (178 lines) — definitions included
module
public import FormalConjecturesUtil
/-!
# Snake in the box
*References:*
- [Wikipedia](https://en.wikipedia.org/wiki/Snake-in-the-box)
- [Hypercube](https://en.wikipedia.org/wiki/Hypercube_graph)
- [xkcd](https://xkcd.com/3125/)
- [DK67] L. Danzer and V. Klee, *Lengths of snakes in boxes*, Journal of Combinatorial Theory 2
(1967), 258–265.
- [Ze97] G. Zémor, *An upper bound on the size of the snake-in-the-box*, Combinatorica 17
(1997), 287–298.
-/
@[expose] public section
universe u
namespace SnakeInBox
open SimpleGraph symmDiff
/--
A graph on the power set of `Fin n`, where two sets are adjacent if they differ by a single element.
-/
def Hypercube (n : ℕ) : SimpleGraph (Finset (Fin n)) := fromRel fun a b => (a ∆ b).card = 1
/--
A subgraph `G'` is a 'snake' of length `k` in graph `G` if it is an induced path of length `k`.
-/
def IsSnakeInGraphOfLength {V : Type u} [DecidableEq V] (G : SimpleGraph V) (G' : Subgraph G)
(k : ℕ) : Prop :=
G'.IsInduced ∧ ∃ u v : V, ∃ (P : G.Walk u v), P.IsPath ∧ G' = P.toSubgraph ∧ P.length = k
/--
The length of the longest induced path (or 'snake') in a graph `G`.
-/
noncomputable def LongestSnakeInGraph {V : Type u} [DecidableEq V] (G : SimpleGraph V) : ℕ :=
sSup {k | ∃ (S : Subgraph G), IsSnakeInGraphOfLength G S k}
/--
The length of the longest snake for the `Hypercube n` graph.
-/
noncomputable def LongestSnakeInTheBox (n : ℕ) : ℕ := LongestSnakeInGraph <| Hypercube n
/--
A subgraph `G'` is a 'coil' of length `k` in graph `G` if it is an induced cycle of length `k`.
-/
def IsCoilInGraphOfLength {V : Type u} [DecidableEq V] (G : SimpleGraph V) (G' : Subgraph G)
(k : ℕ) : Prop :=
G'.IsInduced ∧ ∃ u : V, ∃ (P : G.Walk u u), P.IsCycle ∧ G' = P.toSubgraph ∧ P.length = k
/--
The length of the longest induced cycle (or 'coil') in a graph `G`.
-/
noncomputable def LongestCoilInGraph {V : Type u} [DecidableEq V] (G : SimpleGraph V) : ℕ :=
sSup {k | ∃ (S : Subgraph G), IsCoilInGraphOfLength G S k}
/--
The length of the longest coil for the `Hypercube n` graph.
-/
noncomputable def LongestCoilInTheBox (n : ℕ) : ℕ := LongestCoilInGraph <| Hypercube n
/--
The longest snake in the $0$-dimensional cube, i.e. the cube consisting of one point, is zero,
since there only is one induced path and it is of length zero.
-/
@[category test, AMS 5]
theorem snake_zero_zero : LongestSnakeInTheBox 0 = 0 := by
simp_rw [LongestSnakeInTheBox, LongestSnakeInGraph, IsSnakeInGraphOfLength, Hypercube]
convert! csSup_singleton 0
ext n
refine ⟨fun ⟨S, ⟨h_induced, ⟨u, ⟨v, ⟨P, ⟨hPath, hSupport, hLength⟩⟩⟩⟩⟩⟩ ↦ ?_, ?_⟩
· have hu := Finset.eq_empty_of_isEmpty u
have hv := Finset.eq_empty_of_isEmpty v
subst hu hv
simp_all [Walk.Nil.length_eq_zero]
· rintro rfl
use ⊤, by simp, ∅, ∅, .nil
simp [Subgraph.ext_iff, funext_iff]
/--
The longest coil in the $0$-dimensional cube is zero, since it contains no cycles.
-/
@[category test, AMS 5]
theorem coil_zero_zero : LongestCoilInTheBox 0 = 0 := by
simp_rw [LongestCoilInTheBox, LongestCoilInGraph, IsCoilInGraphOfLength, Hypercube]
convert! csSup_empty
ext n
simp only [Set.mem_ofPred_eq, Set.mem_empty_iff_false, iff_false, not_exists, not_and]
intro S _ u P hCycle _ _
cases P with
| nil => exact hCycle.ne_nil rfl
| @cons _ v _ h =>
have hu := Finset.eq_empty_of_isEmpty u
have hv := Finset.eq_empty_of_isEmpty v
subst hu hv
exact h.ne rfl
open List
/--
The maximum length for the snake-in-the-box problem is known for dimensions zero through eight;
it is $0, 1, 2, 4, 7, 13, 26, 50, 98$.
-/
@[category research solved, AMS 5]
theorem snake_small_dimensions :
map LongestSnakeInTheBox (range 9) = [0, 1, 2, 4, 7, 13, 26, 50, 98] := by
sorry
/--
The maximum length for the coil-in-the-box problem is known for dimensions zero through eight;
it is $0, 0, 4, 6, 8, 14, 26, 48, 96$.
-/
@[category research solved, AMS 5]
theorem coil_small_dimensions :
map LongestCoilInTheBox (range 9) = [0, 0, 4, 6, 8, 14, 26, 48, 96] := by
sorry
def snake_dim_nine.answer : ℕ := sorry
/--
For dimension $9$, the length of the longest snake in the box is not known.
This is currently the smallest dimension where this question is open.
-/
@[category research open, question value, AMS 5]
theorem snake_dim_nine : LongestSnakeInTheBox 9 = snake_dim_nine.answer := by
sorry
/--
The best length found so far for dimension nine is 190.
-/
@[category research solved, AMS 5]
theorem snake_dim_nine_lower_bound : 190 ≤ LongestSnakeInTheBox 9 := by
sorry
-- TODO(firsching): add more known bounds and open conjecture for a few small dimensions
/--
For $n \geq 1$, an upper bound on the length of the longest snake in a box is $2^{n-1}$
(see [DK67, Theorem B]).
-/
@[category research solved, AMS 5]
theorem snake_upper_bound (n : ℕ) (hn : 1 ≤ n) : LongestSnakeInTheBox n ≤ 2 ^ (n - 1) := by
sorry
/--
For $n \geq 2$, an upper bound on the maximal length of the longest coil in a box is given by
$$
1 + 2^{n-1}\frac{6n}{6n + \frac{1}{6\sqrt{6}}n^{\frac 1 2} - 7}
$$
(see [Ze97]). The case $n = 1$ is excluded since the right-hand side is negative there.
-/
@[category research solved, AMS 5]
theorem coil_upper_bound (n : ℕ) (hn : 2 ≤ n) : LongestCoilInTheBox n
≤ (1 : ℝ) + 2 ^ (n - 1) * (6 * n) / (6 * n + (1 / (6 * √6) * √n) - 7) := by
sorry
end SnakeInBox
To prove it: keep every definition of Challenge.lean unchanged and prove SnakeInBox.snake_small_dimensions with the same type — no sorry in what it depends on, no new axioms. To disprove it: add theorem not_snake_small_dimensions : ¬ (…) in the same namespace, stating exactly the negation, and submit it as a disproof.
nosorry fetch wikipedia-snakeinthebox nosorry submit wikipedia-snakeinthebox nosorry/wikipedia-snakeinthebox/Solution.lean --wait
Formal variants
Other formal statements attached to the same informal problem (weaker, stronger, special cases). Each is scored separately.
- coil-small-dimensions — known result
- snake-dim-nine — open
- snake-dim-nine-lower-bound — known result
- snake-upper-bound — known result
- coil-upper-bound — known result
Contributions
No contributions yet — be the first. Submit a proof or a finding.
Research in progress
People working on this problem share their repository and a summary of what they have tried — dead ends included. Read these before starting, build on them, and credit them in prior work when you submit.
Nobody has shared research on this problem yet.
Sign in to share your research.
Statement review
Is the formal statement faithful to the problem? Too weak, too strong, already solved in the literature? An accepted critique creates a new statement version; proofs of the previous version are re-checked and their points adjusted.
Sign in to open a critique.