Definition 3: Classical Code #
A classical, linear, binary code ๐ is a subspace of ๐ฝโ^n. The number of encodable bits
is k = dim ๐. The distance d is the minimum Hamming weight of any non-zero element of ๐
(with the convention d = 0 if ๐ = {0}). We call such a code an [n, k, d]-code.
A code can be specified as ๐ = ker โ^C where โ^C : ๐ฝโ^n โ ๐ฝโ^m is the parity check
matrix (an ๐ฝโ-linear map), viewing the code as a two-term chain complex
C = (Cโ โ[โ^C] Cโ) with Cโ = ๐ฝโ^n and Cโ = ๐ฝโ^m, so ๐ = Zโ(C) = ker โ^C.
Main Definitions #
ClassicalCodeโ a classical linear binary code: a subspace of๐ฝโ^nClassicalCode.dimensionโ the number of encodable bitsk = dim ๐ClassicalCode.distanceโ the minimum Hamming weight of nonzero codewordsClassicalCode.IsNKDCodeโ the property of being an[n, k, d]-codeClassicalCode.ofParityCheckโ construct a code from a parity check linear mapClassicalCode.parityCheckComplexโ the two-term chain complexCโ โ[โ^C] CโClassicalCode.code_eq_kerโ๐ = ker โ^C(definitional)ClassicalCode.code_eq_cycles_mapโ๐ = Zโ(C)via the canonical iso
Classical code as a subspace of ๐ฝโ^n #
Code parameters #
The number of encodable bits k = dim ๐.
Equations
- ๐.dimension = Module.finrank ๐ฝโ โฅ๐.code
Instances For
The distance of a code ๐: the minimum Hamming weight of any non-zero codeword.
By convention, d = 0 when ๐ = {0} (the trivial code). We use sInf on โ,
where sInf โ
= 0 gives the correct convention for the trivial code.
Instances For
Code from parity check matrix #
Construct a classical code from a parity check linear map โ^C : ๐ฝโ^n โ ๐ฝโ^m.
The code is ker โ^C.
Equations
- ClassicalCode.ofParityCheck parityCheck = { code := parityCheck.ker }
Instances For
Two-term chain complex from parity check #
The two-term chain complex C = (Cโ โ[โ^C] Cโ) associated to a parity check
linear map โ^C : ๐ฝโ^n โ ๐ฝโ^m. This uses HomologicalComplex.double from Mathlib
with Cโ = ModuleCat.of ๐ฝโ (Fin n โ ๐ฝโ) in degree 1 and
Cโ = ModuleCat.of ๐ฝโ (Fin m โ ๐ฝโ) in degree 0, with the differential being โ^C.
Equations
- ClassicalCode.parityCheckComplex parityCheck = HomologicalComplex.double (ModuleCat.ofHom parityCheck) ClassicalCode.parityCheckComplex._proof_4
Instances For
Code equals cycles of the chain complex #
The isomorphism C.X 1 โ
ModuleCat.of ๐ฝโ (Fin n โ ๐ฝโ) for the parity check complex.
Equations
- ClassicalCode.parityCheckComplexXIsoโ parityCheck = HomologicalComplex.doubleXIsoโ (ClassicalCode.pcMorโ parityCheck) ClassicalCode.pcRelโ