Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Complexity/Foundations/BooleanAnalysis/BucketWeight.lean
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ with `U ∩ J = S`, written `W^{S | J̄} [F]` by O'Donnell, where `J̄` is the c
noncomputable def bucketWeight (F : (ι → Bool) → ℝ) (J S : Finset ι) : ℝ :=
∑ U with U ∩ J = S, fourierCoeff F U ^ 2

/-- Every bucket weight is nonnegative. -/
theorem bucketWeight_nonneg (F : (ι → Bool) → ℝ) (J S : Finset ι) : 0 ≤ bucketWeight F J S :=
sum_nonneg fun _ _ => sq_nonneg _

Expand Down
4 changes: 3 additions & 1 deletion Complexity/Foundations/BooleanAnalysis/Fibers.lean
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ light-patterns lemma.
* `Cslib.BitString.expect_uniformDeficit_coordinateFiber`: Korten's entropy lemma.
* `Cslib.BitString.coordinateFiber_good_probability`: most fibers have small deficit.
* `Cslib.BitString.exists_uniformDeficit_fiber_le`: pigeonhole for deficits.
* `Cslib.BitString.uniformMass_le_rpow`, `Cslib.BitString.uniformDensity_le_rpow`: a deficit
bound bounds the uniform probability mass and density pointwise.
* `Cslib.BitString.coordinateDensity_eq_expect`: the density of a fiber is the probability
that resampling the coordinates in `s` lands in the set.
* `Cslib.BitString.projectionAverage_eq_coordinateMarginal`,
Expand Down Expand Up @@ -159,7 +161,7 @@ theorem uniformDeficit_le_iff {ι : Type*} [Fintype ι] {X : Finset (ι → Bool

/-- A uniform deficit bound implies the light-patterns lemma's pointwise
probability-mass hypothesis. -/
private theorem uniformMass_le_rpow {ι : Type*} [Fintype ι]
theorem uniformMass_le_rpow {ι : Type*} [Fintype ι]
{X : Finset (ι → Bool)} (hX : X.Nonempty) {k : ℝ} (hdef : uniformDeficit X ≤ k)
(x : ι → Bool) : uniformMass X x ≤ (2 : ℝ) ^ (k - Fintype.card ι) := by
calc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ theorem card_slotLabel : Fintype.card SlotLabel = 3 :=
rfl

/-- The slots of a vertex are reachable from each other along the cycles of `σ`. -/
theorem reachable_slotGraph_zpow (v w : V) (i : ℤ) :
private theorem reachable_slotGraph_zpow (v w : V) (i : ℤ) :
(slotGraph G σ).toSimpleGraph.Reachable (v, w) (v, (σ ^ i) w) := by
induction i using Int.induction_on with
| zero => rfl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ section Fintype

variable {α : Type u} [Fintype α] (f : α → α)

/-- The cycle length from any state is at most the cardinality of the state space. -/
theorem cycleLength_le_card (x : α) : cycleLength f x ≤ Fintype.card α :=
(Nat.le_add_left _ _).trans (transientDepth_add_cycleLength_le_card f x)

Expand Down
3 changes: 3 additions & 0 deletions Complexity/Foundations/Data/BitString/List.lean
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ namespace Cslib.BitString
/-- View a list as `n` bits, padding missing bits with `false`. -/
def ofList (n : ℕ) (word : List Bool) : BitString n := fun i => word.getD i.val false

/-- Viewing `List.ofFn bits` as an `n`-bit string recovers `bits`. -/
@[simp] theorem ofList_ofFn {n : ℕ} (bits : BitString n) :
ofList n (List.ofFn bits) = bits := by
funext i
Expand Down Expand Up @@ -142,6 +143,7 @@ theorem block_ofList_prefix {count rows width : ℕ} (h : rows ≤ count) (word
def listRow (width row : ℕ) (word : List Bool) : List Bool :=
(word.drop (row * width) ++ List.replicate width false).take width

/-- Every extracted row has length `width`. -/
@[simp] theorem length_listRow (width row : ℕ) (word : List Bool) :
(listRow width row word).length = width := by
simp [listRow]
Expand Down Expand Up @@ -210,6 +212,7 @@ theorem listRow_eq_ofFn {count : ℕ} (width : ℕ) (row : Fin count) (word : Li
def listRows (count width : ℕ) (word : List Bool) : List (List Bool) :=
(List.range count).map (fun row => listRow width row word)

/-- Extracting `count` rows produces a list of length `count`. -/
@[simp] theorem length_listRows (count width : ℕ) (word : List Bool) :
(listRows count width word).length = count := by
simp [listRows]
Expand Down
3 changes: 3 additions & 0 deletions Complexity/Foundations/Data/Code/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ theorem natCast_lt_minDist_iff {r : ℕ} :
rw [← ENat.natCast_add_one_le_iff, le_minDist_iff]
simp only [ENat.natCast_add_one_le_iff, Nat.cast_lt]

/-- Distinct codewords are separated by at least the minimum distance of the code. -/
theorem minDist_le_hammingDist (hx : x ∈ C) (hy : y ∈ C) (hxy : x ≠ y) :
minDist C ≤ hammingDist x y :=
le_minDist_iff.1 le_rfl x hx y hy hxy
Expand All @@ -85,10 +86,12 @@ theorem minDist_eq_top_iff : minDist C = ⊤ ↔ C.Subsingleton := by
by_contra hxy
exact ENat.natCast_ne_top _ (top_le_iff.1 (h x hx y hy hxy))

/-- The empty code has minimum distance `⊤`. -/
@[simp]
theorem minDist_empty : minDist (∅ : Set (∀ i, β i)) = ⊤ :=
minDist_eq_top_iff.2 Set.subsingleton_empty

/-- A singleton code has minimum distance `⊤`. -/
@[simp]
theorem minDist_singleton (x : ∀ i, β i) : minDist {x} = ⊤ :=
minDist_eq_top_iff.2 Set.subsingleton_singleton
Expand Down
Loading