Binary encodings of residues, residue vectors and residue matrices #
A residue a : ZMod q is stored as its canonical integer representative ZMod.cast a in binary
sign-magnitude form (encIntBin). For q > 0 the representative lies in [0, q); for q = 0,
ZMod 0 = ℤ and the representative is the integer itself, so the encoding is injective for every
q : ℕ. Vectors Fin n → ZMod q are framed lists of these representatives in index order, and
matrices Matrix (Fin n) (Fin m) (ZMod q) are framed lists of framed rows. The dimensions and
the modulus are not stored: they are fixed by the type.
Main definitions #
Turing.MultiTapeTM.encZMod: a residue as its binary canonical representative.Turing.MultiTapeTM.encZModVec: a residue vector as a framed list of representatives.Turing.MultiTapeTM.encZModMatrix: a residue matrix as a framed list of framed rows.