Documentation

MerLeanBpqc.Definitions.Def_3_ClassicalCode

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 #

Classical code as a subspace of ๐”ฝโ‚‚^n #

structure ClassicalCode (n : โ„•) :

A classical, linear, binary code is a subspace ๐’ž โІ ๐”ฝโ‚‚^n.

Instances For

    Code parameters #

    noncomputable def ClassicalCode.dimension {n : โ„•} (๐’ž : ClassicalCode n) :

    The number of encodable bits k = dim ๐’ž.

    Equations
    Instances For
      noncomputable def ClassicalCode.distance {n : โ„•} (๐’ž : ClassicalCode n) :

      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.

      Equations
      Instances For
        def ClassicalCode.IsNKDCode {n : โ„•} (๐’ž : ClassicalCode n) (k d : โ„•) :

        A code is an [n, k, d]-code if it has dimension k and distance d.

        Equations
        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
          Instances For
            theorem ClassicalCode.code_eq_ker {n m : โ„•} (parityCheck : (Fin n โ†’ ๐”ฝโ‚‚) โ†’โ‚—[๐”ฝโ‚‚] Fin m โ†’ ๐”ฝโ‚‚) :
            (ofParityCheck parityCheck).code = parityCheck.ker

            The code ker parityCheck is definitionally the kernel of the parity check map.

            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
            Instances For

              Code equals cycles of the chain complex #

              The isomorphism C.X 1 โ‰… ModuleCat.of ๐”ฝโ‚‚ (Fin n โ†’ ๐”ฝโ‚‚) for the parity check complex.

              Equations
              Instances For