Documentation

CslibFrontier.Foundations.Data.BitString.ZModSpace

Linear algebra of bit-string spaces via ZMod 2 #

Mathlib equips Bool with a BooleanRing instance (addition is xor, multiplication is and), so ι → Bool and BitString n are Bool-modules, whereas field-level linear algebra (Basis, Submodule.exists_isCompl, Matrix.rank, rank-nullity, and orthogonal duality) requires a Field instance such as ZMod 2.

Building on the computable ring isomorphism Cslib.BitString.bitEquiv : ZMod 2 ≃+* Bool, this module constructs the coordinatewise semilinear isomorphism Cslib.BitString.toZModSpace, the induced submodule lattice isomorphism Cslib.BitString.submoduleZModIso, the linear-map equivalence Cslib.BitString.linearMapZModEquiv, and the standard dot-product orthogonal complement Cslib.BitString.orthogonal, transferring dimension, complements, rank-nullity, and dual-code dimension between Bool and ZMod 2.

Main definitions #

Main results #

Coordinatewise and submodule isomorphisms #

Coordinatewise semilinear isomorphism (ι → Bool) ≃ₛₗ[bitEquiv.symm] (ι → ZMod 2), reading false as 0 and true as 1.

@[simp]
theorem Cslib.BitString.toZModSpace_apply {ι : Type u_1} (v : ι → Bool) (i : ι) :
(toZModSpace ι) v i = bitEquiv.symm (v i)
@[simp]
theorem Cslib.BitString.toZModSpace_symm_apply {ι : Type u_1} (v : ι → ZMod 2) (i : ι) :
(toZModSpace ι).symm v i = bitEquiv (v i)
theorem Cslib.BitString.toZModSpace_dotProduct {ι : Type u_1} [Fintype ι] (u v : ι → Bool) :

toZModSpace intertwines standard dot products via bitEquiv.symm.

Order isomorphism between Bool-submodules of ι → Bool and (ZMod 2)-subspaces of ι → ZMod 2.

@[simp]
theorem Cslib.BitString.mem_submoduleZModIso {ι : Type u_1} {V : Submodule Bool (ι → Bool)} {z : ι → ZMod 2} :
@[simp]
theorem Cslib.BitString.mem_submoduleZModIso_symm {ι : Type u_1} {W : Submodule (ZMod 2) (ι → ZMod 2)} {x : ι → Bool} :

submoduleZModIso maps Bool-spans to (ZMod 2)-spans of the translated generators.

Linear map conjugation #

def Cslib.BitString.linearMapZModEquiv (ι₁ : Type u_1) (ι₂ : Type u_2) :
((ι₁ → Bool) →ₗ[Bool] ι₂ → Bool) ≃+ ((ι₁ → ZMod 2) →ₗ[ZMod 2] ι₂ → ZMod 2)

Additive equivalence between Bool-linear maps (ι₁ → Bool) →ₗ[Bool] (ι₂ → Bool) and (ZMod 2)-linear maps (ι₁ → ZMod 2) →ₗ[ZMod 2] (ι₂ → ZMod 2).

@[simp]
theorem Cslib.BitString.linearMapZModEquiv_apply {ι₁ : Type u_1} {ι₂ : Type u_2} (f : (ι₁ → Bool) →ₗ[Bool] ι₂ → Bool) (z : ι₁ → ZMod 2) :
((linearMapZModEquiv ι₁ ι₂) f) z = (toZModSpace ι₂) (f ((toZModSpace ι₁).symm z))
theorem Cslib.BitString.linearMapZModEquiv_toZModSpace {ι₁ : Type u_1} {ι₂ : Type u_2} (f : (ι₁ → Bool) →ₗ[Bool] ι₂ → Bool) (x : ι₁ → Bool) :
((linearMapZModEquiv ι₁ ι₂) f) ((toZModSpace ι₁) x) = (toZModSpace ι₂) (f x)
@[simp]
theorem Cslib.BitString.linearMapZModEquiv_symm_apply {ι₁ : Type u_1} {ι₂ : Type u_2} (g : (ι₁ → ZMod 2) →ₗ[ZMod 2] ι₂ → ZMod 2) (x : ι₁ → Bool) :
((linearMapZModEquiv ι₁ ι₂).symm g) x = (toZModSpace ι₂).symm (g ((toZModSpace ι₁) x))
theorem Cslib.BitString.submoduleZModIso_map {ι₁ : Type u_1} {ι₂ : Type u_2} (f : (ι₁ → Bool) →ₗ[Bool] ι₂ → Bool) (V : Submodule Bool (ι₁ → Bool)) :
theorem Cslib.BitString.submoduleZModIso_comap {ι₁ : Type u_1} {ι₂ : Type u_2} (f : (ι₁ → Bool) →ₗ[Bool] ι₂ → Bool) (W : Submodule Bool (ι₂ → Bool)) :
theorem Cslib.BitString.submoduleZModIso_ker {ι₁ : Type u_1} {ι₂ : Type u_2} (f : (ι₁ → Bool) →ₗ[Bool] ι₂ → Bool) :
(submoduleZModIso ι₁) f.ker = ((linearMapZModEquiv ι₁ ι₂) f).ker
theorem Cslib.BitString.submoduleZModIso_range {ι₁ : Type u_1} {ι₂ : Type u_2} (f : (ι₁ → Bool) →ₗ[Bool] ι₂ → Bool) :
(submoduleZModIso ι₂) f.range = ((linearMapZModEquiv ι₁ ι₂) f).range
theorem Cslib.BitString.linearMapZModEquiv_mulVecLin {ι₁ : Type u_1} {ι₂ : Type u_2} [Fintype ι₁] (H : Matrix ι₂ ι₁ Bool) :

Conjugating H.mulVecLin along toZModSpace yields (H.map bitEquiv.symm).mulVecLin.

Dimension, cardinality, complements, and rank-nullity over Bool #

theorem Cslib.BitString.natCard_submodule_bool {ι : Type u_1} [Finite ι] (V : Submodule Bool (ι → Bool)) :

A Bool-submodule V of a finite coordinate space ι → Bool has 2 ^ finrank Bool V elements.

theorem Cslib.BitString.exists_isCompl_bool {ι : Type u_1} (U : Submodule Bool (ι → Bool)) :
∃ (W : Submodule Bool (ι → Bool)), IsCompl U W

Every Bool-submodule of ι → Bool has a direct-sum complement.

theorem Cslib.BitString.exists_isCompl_submodule_bool {ι : Type u_1} {K V : Submodule Bool (ι → Bool)} (hKV : K ≤ V) :
∃ U ≤ V, U ⊓ K = ⊥ ∧ U ⊔ K = V

Relative complement existence inside a Bool-submodule V of ι → Bool.

Modular dimension identity for the sum and intersection of two Bool-submodules of ι → Bool.

theorem Cslib.BitString.finrank_map_add_finrank_inf_ker_bool {ι₁ : Type u_1} {ι₂ : Type u_2} [Finite ι₁] (f : (ι₁ → Bool) →ₗ[Bool] ι₂ → Bool) (V : Submodule Bool (ι₁ → Bool)) :

Rank-nullity for a Bool-linear map restricted to a submodule V of ι₁ → Bool.

theorem Cslib.BitString.finrank_range_add_finrank_ker_bool {ι₁ : Type u_1} {ι₂ : Type u_2} [Fintype ι₁] (f : (ι₁ → Bool) →ₗ[Bool] ι₂ → Bool) :

Rank-nullity on the full coordinate space ι₁ → Bool.

theorem Cslib.BitString.finrank_comap_codim_le_bool {ι₁ : Type u_1} {ι₂ : Type u_2} [Fintype ι₁] [Fintype ι₂] (f : (ι₁ → Bool) →ₗ[Bool] ι₂ → Bool) (V : Submodule Bool (ι₂ → Bool)) :

Preimage codimension bound: pulling back a Bool-submodule V of ι₂ → Bool along any Bool-linear map f : (ι₁ → Bool) →ₗ[Bool] (ι₂ → Bool) increases codimension by at most 0, i.e. codim (V.comap f) ≤ codim V.

theorem Cslib.BitString.exists_submodule_finrank_eq_bool {ι : Type u_1} [Finite ι] (V : Submodule Bool (ι → Bool)) (k : ℕ) (hk : k ≤ Module.finrank Bool ↥V) :
∃ U ≤ V, Module.finrank Bool ↥U = k

Every Bool-submodule V of ι → Bool of dimension at least k contains a k-dimensional Bool-submodule.

Orthogonal complement (dual code) over fields and Bool #

def Cslib.BitString.orthogonal {R : Type u_1} {ι : Type u_2} [CommRing R] [Fintype ι] (V : Submodule R (ι → R)) :
Submodule R (ι → R)

The standard dot-product orthogonal complement (dual code) {y | ∀ x ∈ V, x ⬝ᵥ y = 0} of a submodule V of ι → R.

@[simp]
theorem Cslib.BitString.mem_orthogonal {R : Type u_1} {ι : Type u_2} [CommRing R] [Fintype ι] {V : Submodule R (ι → R)} {y : ι → R} :
y ∈ orthogonal V ↔ ∀ x ∈ V, x ⬝ᵥ y = 0
theorem Cslib.BitString.le_orthogonal_orthogonal {R : Type u_1} {ι : Type u_2} [CommRing R] [Fintype ι] (V : Submodule R (ι → R)) :

Over any commutative ring, the orthogonal complement of the row space range Hᵀ.mulVecLin is the kernel ker H.mulVecLin.

theorem Cslib.BitString.finrank_orthogonal_add_finrank {K : Type u_1} {ι : Type u_2} [Field K] [Fintype ι] (W : Submodule K (ι → K)) :

Over a field K, dim K (orthogonal W) + dim K W = |ι|.

@[simp]
theorem Cslib.BitString.orthogonal_orthogonal {K : Type u_1} {ι : Type u_2} [Field K] [Fintype ι] (W : Submodule K (ι → K)) :

Over a field K, the double orthogonal complement of a subspace W of ι → K is W.

theorem Cslib.BitString.orthogonal_ker_mulVecLin {K : Type u_1} {κ : Type u_2} {ι : Type u_3} [Field K] [Fintype κ] [Fintype ι] (H : Matrix κ ι K) :

Over a field K, the orthogonal complement of ker H.mulVecLin is the row space range Hᵀ.mulVecLin.

Dual-code dimension identity over Bool: dim Bool (orthogonal V) + dim Bool V = |ι|.

@[simp]

Double-orthogonal involution over Bool: orthogonal (orthogonal V) = V.

Over Bool, the orthogonal complement of ker H.mulVecLin is the row space range Hᵀ.mulVecLin.