Mathlib.Combinatorics
Finite combinatorial and spectral infrastructure for uniform subset slices and their linear operators.
BooleanCubeMobius 3 core · 3 supporting This file proves a baseline-zero, real-valued specialization of the inclusion-exclusion expansion on a finite Boolean cube. ★ mobius_expansion
Normalized Boolean-Cube Möbius Expansion
This file proves a baseline-zero, real-valued specialization of the
inclusion-exclusion expansion on a finite Boolean cube. The definition
indicator builds Boolean vectors from finite subsets, delta gives the
coefficient for a subset, and mobius_expansion recovers a function normalized
to zero at the all-zero vector as a sum of its nonempty-subset terms. The full
Möbius expansion, without the normalization, additionally contains the
empty-set coefficient.
For a coordinate type with decidable equality and a finite subset of coordinates, the subset-indicator Boolean vector assigns one to coordinates in the subset and zero to all other coordinates.
For a coordinate type with decidable equality, a real-valued function on its Boolean cube, and a finite subset of coordinates, the subset Möbius coefficient is the alternating sum over the indicator vectors of all its subsets, with sign determined by the difference in subset sizes.
For a real-valued function τ on a finite Boolean cube that is normalized to zero at the all-zero vector, its value at a Boolean vector h is recovered from its nonempty-subset Möbius coefficients. A coefficient contributes only when every coordinate in its subset is one.
Formal statement
Proof (Lean source)
3 supporting declarations (lemmas, instances)
-
prod_indicator_eqlemma — Indicator product: ∏ k ∈ S, ((h k).val : ℝ) equals 1 if S ⊆ B and 0 otherwise, where B = {k : h k = 1}.hypothesesconclusionprod S (fun k => ((h k).val : ℝ)) = if S ⊆ B then 1 else 0Proof (Lean source)
lemma prod_indicator_eq (h : ι → Fin 2) (B : Finset ι) (hB : ∀ k, k ∈ B ↔ h k = 1) (S : Finset ι) : prod S (fun k => ((h k).val : ℝ)) = if S ⊆ B then 1 else 0 := by classical by_cases hSB : S ⊆ B · rw [if_pos hSB] apply Finset.prod_eq_one intro k hk have hk1 : h k = 1 := (hB k).mp (hSB hk) rw [hk1]; simp · rw [if_neg hSB] rw [Finset.not_subset] at hSB obtain ⟨k, hkS, hkB⟩ := hSB apply Finset.prod_eq_zero hkS have h0 : h k ≠ 1 := fun hh => hkB ((hB k).mpr hh) have h2 : h k = 0 := by apply Fin.ext have hval_ne : (h k).val ≠ 1 := by intro hv apply h0 apply Fin.ext simpa using hv omega rw [h2]; simp -
coeff_sumlemma — Coefficient sum: for A ⊆ B, ∑ S, A ⊆ S ⊆ B, (-1)^(|S|-|A|) = if A = B then 1 else 0.hypothesesconclusion(∑ S ∈ B.powerset.filter (A ⊆ ·), (-1 : ℝ) ^ (S.card - A.card)) = if A = B then 1 else 0Proof (Lean source)
lemma coeff_sum (A B : Finset ι) (hAB : A ⊆ B) : (∑ S ∈ B.powerset.filter (A ⊆ ·), (-1 : ℝ) ^ (S.card - A.card)) = if A = B then 1 else 0 := by classical set C := B \ A with hCdef have hAdisj : Disjoint A C := Finset.disjoint_sdiff -- Reindex S = A ∪ T with T ⊆ C. have hreindex : (∑ S ∈ B.powerset.filter (A ⊆ ·), (-1 : ℝ) ^ (S.card - A.card)) = ∑ T ∈ C.powerset, (-1 : ℝ) ^ T.card := by refine Finset.sum_nbij' (fun S => S \ A) (fun T => A ∪ T) ?_ ?_ ?_ ?_ ?_ · intro S hS simp only [mem_filter, Finset.mem_powerset] at hS obtain ⟨hSB, _⟩ := hS exact (Finset.mem_powerset.mpr <| by intro x hx simp only [hCdef, mem_sdiff] at hx ⊢ exact ⟨hSB hx.1, hx.2⟩) · intro T hT simp only [Finset.mem_powerset] at hT simp only [mem_filter, Finset.mem_powerset] have hTC : T ⊆ C := hT have hTB : T ⊆ B := hTC.trans sdiff_subset exact ⟨Finset.union_subset hAB hTB, Finset.subset_union_left⟩ · intro S hS simp only [mem_filter, Finset.mem_powerset] at hS obtain ⟨_, hAS⟩ := hS ext x simp only [mem_union, mem_sdiff] constructor · rintro (hxA | ⟨hxS, _⟩) · exact hAS hxA · exact hxS · intro hxS by_cases hxA : x ∈ A · exact inl hxA · exact inr ⟨hxS, hxA⟩ · intro T hT simp only [Finset.mem_powerset] at hT have hTC : T ⊆ C := hT have hTA : Disjoint A T := Finset.disjoint_of_subset_right hTC hAdisj ext x simp only [mem_sdiff, mem_union] constructor · rintro ⟨hxA | hxT, hxnA⟩ · exact (hxnA hxA).elim · exact hxT · intro hxT refine ⟨Or.inr hxT, ?_⟩ intro hxA exact (Finset.disjoint_left.mp hTA hxA) hxT · intro S hS simp only [mem_filter, Finset.mem_powerset] at hS obtain ⟨_, hAS⟩ := hS rw [Finset.card_sdiff_of_subset hAS] rw [hreindex] by_cases hAB' : A = B · subst hAB' have hC0 : C = ∅ := by simp [hCdef] simp [hC0] · have hCne : C ≠ ∅ := by intro hC0 apply hAB' refine le_antisymm hAB ?_ intro x hxB by_contra hxA have hxC : x ∈ C := by simp [hCdef, hxB, hxA] rw [hC0] at hxC exact Finset.notMem_empty _ hxC have hCne' : C.Nonempty := Finset.nonempty_iff_ne_empty.mpr hCne have hint : (∑ T ∈ C.powerset, (-1 : ℤ) ^ T.card) = 0 := Finset.sum_powerset_neg_one_pow_card_of_nonempty (x := C) hCne' have hreal : (∑ T ∈ C.powerset, (-1 : ℝ) ^ T.card) = 0 := by exact_mod_cast hint simpa [hAB'] using hreal