/-
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.
-/
import FormalConjecturesUtilBarker sequences
A Barker sequence is a finite sequence of $\pm 1$ values whose nontrivial aperiodic autocorrelations all have magnitude at most one. The Barker conjecture says that no such sequence has length greater than $13$.
References:
namespace Arxiv.«2104.00502»The aperiodic autocorrelation $C_k(a)=\sum_i a_i a_{i+k}$.
def aperiodicAutocorrelation (a : List ℤ) (k : ℕ) : ℤ :=
(List.zipWith (· * ·) a (a.drop k)).sumA Barker sequence has $\pm 1$ entries and nontrivial autocorrelations of magnitude at most one.
def IsBarkerSequence (a : List ℤ) : Prop :=
(∀ x ∈ a, x = 1 ∨ x = -1) ∧
∀ k : ℕ, 0 < k → k < a.length → |aperiodicAutocorrelation a k| ≤ 1Every Barker sequence has length at most $13$.
@[category research open, AMS 5 11 94]
theorem barker_conjecture (a : List ℤ) (ha : IsBarkerSequence a) : a.length ≤ 13 := a:List ℤha:IsBarkerSequence a⊢ a.length ≤ 13
All goals completed! 🐙The known sequence $(1,1,1,1,1,-1,-1,1,1,-1,1,-1,1)$ of length $13$ is a Barker sequence.
@[category test, AMS 5 11 94]
theorem isBarkerSequence_length_thirteen :
IsBarkerSequence [1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1] := ⊢ IsBarkerSequence [1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1]
⊢ ∀ x ∈ [1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1], x = 1 ∨ x = -1⊢ ∀ (k : ℕ),
0 < k →
k < [1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1].length →
|aperiodicAutocorrelation [1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1] k| ≤ 1
⊢ ∀ x ∈ [1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1], x = 1 ∨ x = -1 All goals completed! 🐙
⊢ ∀ (k : ℕ),
0 < k →
k < [1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1].length →
|aperiodicAutocorrelation [1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1] k| ≤ 1 k:ℕhkpos:0 < khklen:k < [1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1].length⊢ |aperiodicAutocorrelation [1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1] k| ≤ 1
k:ℕhkpos:0 < khklen:k < 13⊢ |aperiodicAutocorrelation [1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1] k| ≤ 1
k:ℕhkpos:0 < 1hklen:1 < 13⊢ |aperiodicAutocorrelation [1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1] 1| ≤ 1k:ℕhkpos:0 < 2hklen:2 < 13⊢ |aperiodicAutocorrelation [1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1] 2| ≤ 1k:ℕhkpos:0 < 3hklen:3 < 13⊢ |aperiodicAutocorrelation [1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1] 3| ≤ 1k:ℕhkpos:0 < 4hklen:4 < 13⊢ |aperiodicAutocorrelation [1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1] 4| ≤ 1k:ℕhkpos:0 < 5hklen:5 < 13⊢ |aperiodicAutocorrelation [1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1] 5| ≤ 1k:ℕhkpos:0 < 6hklen:6 < 13⊢ |aperiodicAutocorrelation [1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1] 6| ≤ 1k:ℕhkpos:0 < 7hklen:7 < 13⊢ |aperiodicAutocorrelation [1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1] 7| ≤ 1k:ℕhkpos:0 < 8hklen:8 < 13⊢ |aperiodicAutocorrelation [1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1] 8| ≤ 1k:ℕhkpos:0 < 9hklen:9 < 13⊢ |aperiodicAutocorrelation [1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1] 9| ≤ 1k:ℕhkpos:0 < 10hklen:10 < 13⊢ |aperiodicAutocorrelation [1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1] 10| ≤ 1k:ℕhkpos:0 < 11hklen:11 < 13⊢ |aperiodicAutocorrelation [1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1] 11| ≤ 1k:ℕhkpos:0 < 12hklen:12 < 13⊢ |aperiodicAutocorrelation [1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1] 12| ≤ 1 k:ℕhkpos:0 < 1hklen:1 < 13⊢ |aperiodicAutocorrelation [1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1] 1| ≤ 1k:ℕhkpos:0 < 2hklen:2 < 13⊢ |aperiodicAutocorrelation [1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1] 2| ≤ 1k:ℕhkpos:0 < 3hklen:3 < 13⊢ |aperiodicAutocorrelation [1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1] 3| ≤ 1k:ℕhkpos:0 < 4hklen:4 < 13⊢ |aperiodicAutocorrelation [1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1] 4| ≤ 1k:ℕhkpos:0 < 5hklen:5 < 13⊢ |aperiodicAutocorrelation [1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1] 5| ≤ 1k:ℕhkpos:0 < 6hklen:6 < 13⊢ |aperiodicAutocorrelation [1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1] 6| ≤ 1k:ℕhkpos:0 < 7hklen:7 < 13⊢ |aperiodicAutocorrelation [1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1] 7| ≤ 1k:ℕhkpos:0 < 8hklen:8 < 13⊢ |aperiodicAutocorrelation [1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1] 8| ≤ 1k:ℕhkpos:0 < 9hklen:9 < 13⊢ |aperiodicAutocorrelation [1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1] 9| ≤ 1k:ℕhkpos:0 < 10hklen:10 < 13⊢ |aperiodicAutocorrelation [1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1] 10| ≤ 1k:ℕhkpos:0 < 11hklen:11 < 13⊢ |aperiodicAutocorrelation [1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1] 11| ≤ 1k:ℕhkpos:0 < 12hklen:12 < 13⊢ |aperiodicAutocorrelation [1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1] 12| ≤ 1
All goals completed! 🐙The sequence $(1,1,1,-1)$ is a Barker sequence.
@[category test, AMS 5 11 94]
theorem isBarkerSequence_length_four : IsBarkerSequence [1, 1, 1, -1] := ⊢ IsBarkerSequence [1, 1, 1, -1]
⊢ ∀ x ∈ [1, 1, 1, -1], x = 1 ∨ x = -1⊢ ∀ (k : ℕ), 0 < k → k < [1, 1, 1, -1].length → |aperiodicAutocorrelation [1, 1, 1, -1] k| ≤ 1
⊢ ∀ x ∈ [1, 1, 1, -1], x = 1 ∨ x = -1 All goals completed! 🐙
⊢ ∀ (k : ℕ), 0 < k → k < [1, 1, 1, -1].length → |aperiodicAutocorrelation [1, 1, 1, -1] k| ≤ 1 k:ℕhkpos:0 < khklen:k < [1, 1, 1, -1].length⊢ |aperiodicAutocorrelation [1, 1, 1, -1] k| ≤ 1
k:ℕhkpos:0 < khklen:k < 4⊢ |aperiodicAutocorrelation [1, 1, 1, -1] k| ≤ 1
k:ℕhkpos:0 < 1hklen:1 < 4⊢ |aperiodicAutocorrelation [1, 1, 1, -1] 1| ≤ 1k:ℕhkpos:0 < 2hklen:2 < 4⊢ |aperiodicAutocorrelation [1, 1, 1, -1] 2| ≤ 1k:ℕhkpos:0 < 3hklen:3 < 4⊢ |aperiodicAutocorrelation [1, 1, 1, -1] 3| ≤ 1 k:ℕhkpos:0 < 1hklen:1 < 4⊢ |aperiodicAutocorrelation [1, 1, 1, -1] 1| ≤ 1k:ℕhkpos:0 < 2hklen:2 < 4⊢ |aperiodicAutocorrelation [1, 1, 1, -1] 2| ≤ 1k:ℕhkpos:0 < 3hklen:3 < 4⊢ |aperiodicAutocorrelation [1, 1, 1, -1] 3| ≤ 1
All goals completed! 🐙The constant sequence $(1,1,1,1)$ is not a Barker sequence.
ha:IsBarkerSequence [1, 1, 1, 1]h:|aperiodicAutocorrelation [1, 1, 1, 1] 1| ≤ 1⊢ False
norm_num [aperiodicAutocorrelation] at h All goals completed! 🐙end Arxiv.«2104.00502»