Based binary chain complexes and homological distance
DefinitionZengPryadko2019This definition bundle formalizes the based binary chain-complex data used in Zeng--Pryadko's distance theorem.
A binary word with coordinate type is a function . A
BasedBinaryChainComplex contains finite based chain groups in every
nonnegative degree and paper-indexed boundary maps
. If the complex has length , the two endpoint
maps are exactly the implicit trivial operators of Eq. (1):
Both are zero maps. It also contains the equations and a finite length above which all chain groups have dimension zero.
Exactly as in Eq. (4) of Zeng--Pryadko, the homological distance is
In particular, the endpoint cases are
and
because and .
Distances take values in , with the minimum of the empty set equal to . Thus a trivial homology group has infinite distance, following the paper's convention.
For a binary matrix represented as a linear map , the associated one-complex has
and
For arbitrary finite-length based complexes and , the bundle defines every degree of , its boundary maps, proves that consecutive product boundaries compose to zero, defines its homological distance, and . It also constructs the one-complex as a specialization.
Formalization Note. Finite coordinate types are allowed to be empty, so endpoint chain groups require no separate exceptional definition. Hamming weight is computed in the displayed bases, as required by the theorem.
import Mathlib.InformationTheory.Hamming
import Mathlib.LinearAlgebra.Dimension.Finite
import Mathlib.LinearAlgebra.Matrix.ToLin
namespace ZengPryadko2019
/-- A binary word whose coordinates are indexed by `ι`. -/
abbrev BinaryWord (ι : Type*) := ι → ZMod 2
/--
Minimum Hamming weight of a nonzero homology class. The infimum of the empty
set is `⊤`, so the distance is infinite when the homology group is trivial,
as in Zeng--Pryadko.
-/
noncomputable def homologicalDistance
{ι κ μ : Type*} [Fintype ι] [DecidableEq ι]
(d : BinaryWord ι →ₗ[ZMod 2] BinaryWord κ)
(dNext : BinaryWord μ →ₗ[ZMod 2] BinaryWord ι) : WithTop ℕ :=
sInf {w : WithTop ℕ | ∃ x : BinaryWord ι,
d x = 0 ∧ x ∉ LinearMap.range dNext ∧ w = hammingNorm x}
/-- Coordinate expansion of a linear map between standard finite bases. -/
theorem linearMap_apply_eq_sum {m n : ℕ}
(f : BinaryWord (Fin n) →ₗ[ZMod 2] BinaryWord (Fin m))
(x : BinaryWord (Fin n)) (i : Fin m) :
f x i = ∑ k : Fin n, f (Pi.single k 1) i * x k := by
have h := congrFun (LinearMap.toMatrix'_mulVec f x) i
simpa [Matrix.mulVec, dotProduct, LinearMap.toMatrix'_apply] using h.symm
/-- Linear maps acting on separate finite coordinate directions commute. -/
theorem linearMap_apply_separateDirections
{m n p q : ℕ}
(f : BinaryWord (Fin n) →ₗ[ZMod 2] BinaryWord (Fin m))
(g : BinaryWord (Fin q) →ₗ[ZMod 2] BinaryWord (Fin p))
(e : Fin n → Fin q → ZMod 2) (a : Fin m) (b : Fin p) :
f (fun a' => g (fun b' => e a' b') b) a =
g (fun b' => f (fun a' => e a' b') a) b := by
calc
f (fun a' => g (fun b' => e a' b') b) a =
∑ a' : Fin n, f (Pi.single a' 1) a * g (fun b' => e a' b') b :=
linearMap_apply_eq_sum f _ a
_ = ∑ a' : Fin n, ∑ b' : Fin q,
f (Pi.single a' 1) a * (g (Pi.single b' 1) b * e a' b') := by
apply Finset.sum_congr rfl
intro a' _
rw [linearMap_apply_eq_sum g]
simp only [Finset.mul_sum]
_ = ∑ b' : Fin q, ∑ a' : Fin n,
g (Pi.single b' 1) b * (f (Pi.single a' 1) a * e a' b') := by
rw [Finset.sum_comm]
apply Finset.sum_congr rfl
intro b' _
apply Finset.sum_congr rfl
intro a' _
ring
_ = ∑ b' : Fin q,
g (Pi.single b' 1) b * f (fun a' => e a' b') a := by
apply Finset.sum_congr rfl
intro b' _
rw [linearMap_apply_eq_sum f]
simp only [Finset.mul_sum]
_ = g (fun b' => f (fun a' => e a' b') a) b :=
(linearMap_apply_eq_sum g _ b).symm
/-- A coordinatewise form of additivity for linear maps on binary words. -/
theorem linearMap_apply_pointwise_add {m n : ℕ}
(f : BinaryWord (Fin n) →ₗ[ZMod 2] BinaryWord (Fin m))
(x y : BinaryWord (Fin n)) (i : Fin m) :
f (fun k => x k + y k) i = f x i + f y i := by
change f (x + y) i = f x i + f y i
rw [map_add]
rfl
/-- Coordinate type below degree `j`, with the zero space below degree zero. -/
abbrev BoundaryTarget (dimension : ℕ → ℕ) : ℕ → Type
| 0 => Empty
| j + 1 => Fin (dimension j)
/--
A finite-length based binary chain complex in nonnegative degrees, indexed
exactly as in Zeng--Pryadko: `boundary j` is `∂_j : A_j → A_(j-1)`. At
degree zero its codomain is the zero-dimensional space indexed by `Empty`.
-/
structure BasedBinaryChainComplex where
dimension : ℕ → ℕ
boundary : ∀ j : ℕ,
BinaryWord (Fin (dimension j)) →ₗ[ZMod 2]
BinaryWord (BoundaryTarget dimension j)
boundary_boundary : ∀ j : ℕ, (boundary j).comp (boundary (j + 1)) = 0
length : ℕ
dimension_eq_zero_of_length_lt : ∀ i : ℕ, length < i → dimension i = 0
/--
Homological distance in degree `j`, exactly as Eq. (4) of Zeng--Pryadko:
the least weight in `ker ∂_j \ im ∂_(j+1)`.
-/
noncomputable def chainDistanceAt
(A : BasedBinaryChainComplex) (j : ℕ) : WithTop ℕ :=
homologicalDistance (A.boundary j) (A.boundary (j + 1))
/-- A decomposition of the total degree `j` into two nonnegative degrees. -/
def TensorDegreePair (j : ℕ) :=
{p : Fin (j + 1) × Fin (j + 1) // p.1.val + p.2.val = j}
noncomputable instance tensorDegreePairFintype (j : ℕ) :
Fintype (TensorDegreePair j) :=
Fintype.ofInjective (fun p : TensorDegreePair j => p.1) Subtype.val_injective
noncomputable instance tensorDegreePairDecidableEq (j : ℕ) :
DecidableEq (TensorDegreePair j) := Classical.decEq _
/--
The based coordinate type of the degree-`j` group of a tensor product. The
component indexed by `(i,k)` with `i+k=j` is `Aᵢ ⊗ Bₖ`.
-/
def TensorDegreeIndex (A B : BasedBinaryChainComplex) (j : ℕ) :=
Σ p : TensorDegreePair j,
Fin (A.dimension p.1.1.val) × Fin (B.dimension p.1.2.val)
noncomputable instance tensorDegreeIndexFintype
(A B : BasedBinaryChainComplex) (j : ℕ) :
Fintype (TensorDegreeIndex A B j) := by
classical
unfold TensorDegreeIndex
infer_instance
noncomputable instance tensorDegreeIndexDecidableEq
(A B : BasedBinaryChainComplex) (j : ℕ) :
DecidableEq (TensorDegreeIndex A B j) := Classical.decEq _
/-- Increase the left degree in a decomposition of a total degree. -/
def tensorDegreePairLeft {j : ℕ} (p : TensorDegreePair j) :
TensorDegreePair (j + 1) :=
⟨(⟨p.1.1.val + 1, by omega⟩, ⟨p.1.2.val, by omega⟩), by
change (p.1.1.val + 1) + p.1.2.val = j + 1
have hp : p.1.1.val + p.1.2.val = j := p.2
omega⟩
/-- Increase the right degree in a decomposition of a total degree. -/
def tensorDegreePairRight {j : ℕ} (p : TensorDegreePair j) :
TensorDegreePair (j + 1) :=
⟨(⟨p.1.1.val, by omega⟩, ⟨p.1.2.val + 1, by omega⟩), by
change p.1.1.val + (p.1.2.val + 1) = j + 1
have hp : p.1.1.val + p.1.2.val = j := p.2
omega⟩
/-- Index inclusion for the contribution of the boundary of `A`. -/
def tensorIndexLeft (A B : BasedBinaryChainComplex) {j : ℕ}
(p : TensorDegreePair j)
(a : Fin (A.dimension (p.1.1.val + 1)))
(b : Fin (B.dimension p.1.2.val)) : TensorDegreeIndex A B (j + 1) :=
⟨tensorDegreePairLeft p, a, b⟩
/-- Index inclusion for the contribution of the boundary of `B`. -/
def tensorIndexRight (A B : BasedBinaryChainComplex) {j : ℕ}
(p : TensorDegreePair j)
(a : Fin (A.dimension p.1.1.val))
(b : Fin (B.dimension (p.1.2.val + 1))) : TensorDegreeIndex A B (j + 1) :=
⟨tensorDegreePairRight p, a, b⟩
/--
The degree-`j+1` boundary of the tensor product of two arbitrary finite based
binary chain complexes.
-/
def tensorBoundary (A B : BasedBinaryChainComplex) (j : ℕ) :
BinaryWord (TensorDegreeIndex A B (j + 1)) →ₗ[ZMod 2]
BinaryWord (TensorDegreeIndex A B j) where
toFun e := fun z =>
A.boundary (z.1.1.1.val + 1)
(fun a => e (tensorIndexLeft A B z.1 a z.2.2)) z.2.1 +
B.boundary (z.1.1.2.val + 1)
(fun b => e (tensorIndexRight A B z.1 z.2.1 b)) z.2.2
map_add' x y := by
funext z
change
A.boundary (z.1.1.1.val + 1)
((fun a => x (tensorIndexLeft A B z.1 a z.2.2)) +
(fun a => y (tensorIndexLeft A B z.1 a z.2.2))) z.2.1 +
B.boundary (z.1.1.2.val + 1)
((fun b => x (tensorIndexRight A B z.1 z.2.1 b)) +
(fun b => y (tensorIndexRight A B z.1 z.2.1 b))) z.2.2 =
(A.boundary (z.1.1.1.val + 1)
(fun a => x (tensorIndexLeft A B z.1 a z.2.2)) z.2.1 +
B.boundary (z.1.1.2.val + 1)
(fun b => x (tensorIndexRight A B z.1 z.2.1 b)) z.2.2) +
(A.boundary (z.1.1.1.val + 1)
(fun a => y (tensorIndexLeft A B z.1 a z.2.2)) z.2.1 +
B.boundary (z.1.1.2.val + 1)
(fun b => y (tensorIndexRight A B z.1 z.2.1 b)) z.2.2)
rw [map_add, map_add]
simp only [Pi.add_apply]
abel
map_smul' q x := by
funext z
change
A.boundary (z.1.1.1.val + 1)
(q • fun a => x (tensorIndexLeft A B z.1 a z.2.2)) z.2.1 +
B.boundary (z.1.1.2.val + 1)
(q • fun b => x (tensorIndexRight A B z.1 z.2.1 b)) z.2.2 =
q •
(A.boundary (z.1.1.1.val + 1)
(fun a => x (tensorIndexLeft A B z.1 a z.2.2)) z.2.1 +
B.boundary (z.1.1.2.val + 1)
(fun b => x (tensorIndexRight A B z.1 z.2.1 b)) z.2.2)
rw [map_smul, map_smul]
exact (smul_add q _ _).symm
theorem tensorBoundary_apply (A B : BasedBinaryChainComplex) (j : ℕ)
(e : BinaryWord (TensorDegreeIndex A B (j + 1)))
(z : TensorDegreeIndex A B j) :
tensorBoundary A B j e z =
A.boundary (z.1.1.1.val + 1)
(fun a => e (tensorIndexLeft A B z.1 a z.2.2)) z.2.1 +
B.boundary (z.1.1.2.val + 1)
(fun b => e (tensorIndexRight A B z.1 z.2.1 b)) z.2.2 := rfl
theorem tensorDegreePair_mixed {j : ℕ} (p : TensorDegreePair j) :
tensorDegreePairRight (tensorDegreePairLeft p) =
tensorDegreePairLeft (tensorDegreePairRight p) := by
apply Subtype.ext
apply Prod.ext <;> apply Fin.ext <;> rfl
theorem tensorIndex_mixed (A B : BasedBinaryChainComplex) {j : ℕ}
(p : TensorDegreePair j)
(a : Fin (A.dimension (p.1.1.val + 1)))
(b : Fin (B.dimension (p.1.2.val + 1))) :
tensorIndexRight A B (tensorDegreePairLeft p) a b =
tensorIndexLeft A B (tensorDegreePairRight p) a b := by
apply Sigma.ext (tensorDegreePair_mixed p)
rfl
theorem tensorBoundary_tensorIndexLeft (A B : BasedBinaryChainComplex) {j : ℕ}
(e : BinaryWord (TensorDegreeIndex A B (j + 2)))
(p : TensorDegreePair j)
(a : Fin (A.dimension (p.1.1.val + 1)))
(b : Fin (B.dimension p.1.2.val)) :
tensorBoundary A B (j + 1) e (tensorIndexLeft A B p a b) =
A.boundary (p.1.1.val + 2)
(fun a' => e (tensorIndexLeft A B (tensorDegreePairLeft p) a' b)) a +
B.boundary (p.1.2.val + 1)
(fun b' => e (tensorIndexRight A B (tensorDegreePairLeft p) a b')) b := rfl
theorem tensorBoundary_tensorIndexRight (A B : BasedBinaryChainComplex) {j : ℕ}
(e : BinaryWord (TensorDegreeIndex A B (j + 2)))
(p : TensorDegreePair j)
(a : Fin (A.dimension p.1.1.val))
(b : Fin (B.dimension (p.1.2.val + 1))) :
tensorBoundary A B (j + 1) e (tensorIndexRight A B p a b) =
A.boundary (p.1.1.val + 1)
(fun a' => e (tensorIndexLeft A B (tensorDegreePairRight p) a' b)) a +
B.boundary (p.1.2.val + 2)
(fun b' => e (tensorIndexRight A B (tensorDegreePairRight p) a b')) b := rfl
/-- Consecutive tensor-product boundaries compose to zero. -/
theorem tensorBoundary_boundary (A B : BasedBinaryChainComplex) (j : ℕ) :
(tensorBoundary A B j).comp (tensorBoundary A B (j + 1)) = 0 := by
apply LinearMap.ext
intro e
funext z
rcases z with ⟨p, a, b⟩
change
A.boundary (p.1.1.val + 1)
(fun a' => tensorBoundary A B (j + 1) e (tensorIndexLeft A B p a' b)) a +
B.boundary (p.1.2.val + 1)
(fun b' => tensorBoundary A B (j + 1) e (tensorIndexRight A B p a b')) b = 0
simp_rw [tensorBoundary_tensorIndexLeft, tensorBoundary_tensorIndexRight]
rw [linearMap_apply_pointwise_add, linearMap_apply_pointwise_add]
have hA :
A.boundary (p.1.1.val + 1)
(A.boundary (p.1.1.val + 2)
(fun a'' => e (tensorIndexLeft A B (tensorDegreePairLeft p) a'' b))) a = 0 := by
have h := congrArg
(fun L => L (fun a'' => e (tensorIndexLeft A B (tensorDegreePairLeft p) a'' b)))
(A.boundary_boundary (p.1.1.val + 1))
exact congrFun (by simpa [LinearMap.comp_apply] using h) a
have hB :
B.boundary (p.1.2.val + 1)
(B.boundary (p.1.2.val + 2)
(fun b'' => e (tensorIndexRight A B (tensorDegreePairRight p) a b''))) b = 0 := by
have h := congrArg
(fun L => L (fun b'' => e (tensorIndexRight A B (tensorDegreePairRight p) a b'')))
(B.boundary_boundary (p.1.2.val + 1))
exact congrFun (by simpa [LinearMap.comp_apply] using h) b
have hMixed :
A.boundary (p.1.1.val + 1)
(fun a' =>
B.boundary (p.1.2.val + 1)
(fun b' => e (tensorIndexRight A B (tensorDegreePairLeft p) a' b')) b) a =
B.boundary (p.1.2.val + 1)
(fun b' =>
A.boundary (p.1.1.val + 1)
(fun a' => e (tensorIndexLeft A B (tensorDegreePairRight p) a' b')) a) b := by
calc
_ = B.boundary (p.1.2.val + 1)
(fun b' =>
A.boundary (p.1.1.val + 1)
(fun a' => e (tensorIndexRight A B (tensorDegreePairLeft p) a' b')) a) b :=
linearMap_apply_separateDirections
(A.boundary (p.1.1.val + 1)) (B.boundary (p.1.2.val + 1))
(fun a' b' => e (tensorIndexRight A B (tensorDegreePairLeft p) a' b')) a b
_ = _ := by
apply congrArg (fun x => B.boundary (p.1.2.val + 1) x b)
funext b'
apply congrArg (fun x => A.boundary (p.1.1.val + 1) x a)
funext a'
exact congrArg e (tensorIndex_mixed A B p a' b')
rw [hA, hB, hMixed]
ring_nf
have htwo : (2 : ZMod 2) = 0 := by decide
rw [htwo, mul_zero]
/-- Coordinate type below tensor-product degree `j`. -/
def TensorBoundaryTarget (A B : BasedBinaryChainComplex) : ℕ → Type
| 0 => Empty
| j + 1 => TensorDegreeIndex A B j
/--
The paper-indexed tensor-product boundary in degree `j`. Thus
`tensorBoundaryAt A B j` has domain `(A × B)_j`, not `(A × B)_(j+1)`.
-/
def tensorBoundaryAt (A B : BasedBinaryChainComplex) : ∀ j : ℕ,
BinaryWord (TensorDegreeIndex A B j) →ₗ[ZMod 2]
BinaryWord (TensorBoundaryTarget A B j)
| 0 => 0
| j + 1 => tensorBoundary A B j
/-- Consecutive paper-indexed tensor-product boundaries compose to zero. -/
theorem tensorBoundaryAt_boundaryAt
(A B : BasedBinaryChainComplex) (j : ℕ) :
(tensorBoundaryAt A B j).comp (tensorBoundaryAt A B (j + 1)) = 0 := by
cases j with
| zero => rfl
| succ j => exact tensorBoundary_boundary A B j
/--
Homological distance of the tensor product in degree `j`, in the exact
`ker ∂_j \ im ∂_(j+1)` form of Eq. (4).
-/
noncomputable def tensorProductDistanceAt
(A B : BasedBinaryChainComplex) (j : ℕ) : WithTop ℕ :=
homologicalDistance (tensorBoundaryAt A B j) (tensorBoundaryAt A B (j + 1))
/-- The right-hand side `minᵢ dᵢ(A) dⱼ₋ᵢ(B)` of Eq. (11). -/
noncomputable def componentDistanceMinimum
(A B : BasedBinaryChainComplex) (j : ℕ) : WithTop ℕ :=
sInf {w : WithTop ℕ | ∃ i : Fin (j + 1),
w = chainDistanceAt A i.val * chainDistanceAt B (j - i.val)}
/-- The length-one based chain complex induced by an `r × c` binary matrix. -/
def oneComplex {r c : ℕ}
(P : BinaryWord (Fin c) →ₗ[ZMod 2] BinaryWord (Fin r)) :
BasedBinaryChainComplex where
dimension
| 0 => r
| 1 => c
| _ + 2 => 0
boundary
| 0 => 0
| 1 => P
| _ + 2 => 0
boundary_boundary := by
intro i
cases i <;> simp
length := 1
dimension_eq_zero_of_length_lt := by
intro i hi
match i with
| 0 => omega
| 1 => omega
| _ + 2 => rfl
/-- Distance in the degree immediately below `j`, with `⊤` below degree zero. -/
noncomputable def chainDistanceBefore
(A : BasedBinaryChainComplex) : ℕ → WithTop ℕ
| 0 => ⊤
| j + 1 => chainDistanceAt A j
end ZengPryadko2019
Read-back
What the Lean code literally says, in plain math · gpt-5.6-sol
Blind read-back of Def_ZengPryadko2019.lean
1. BinaryWord
For every type , BinaryWord declares the type of all functions . No finiteness or decidable-equality assumption is part of this abbreviation; if is empty, this function type has exactly one element, the empty (and hence zero) word.
2. homologicalDistance
For arbitrary types , assuming only that is finite and has decidable equality, and for -linear maps and , homologicalDistance is the infimum in of the set of values for which there exists a word satisfying , , and , where the Hamming norm is the number of coordinates at which is nonzero. Thus it takes the least such Hamming weight when such an exists and is when no such exists. In particular, is always in the range of a linear map, so a witnessing cannot be the zero word; if is empty, the only word is zero, the defining set is empty, and the value is . There is no hypothesis that , and neither nor is required to be finite.
3. linearMap_apply_eq_sum
For all natural numbers , every -linear map , every word , and every output coordinate , the declaration asserts
where is the word equal to at and at every other coordinate, and all arithmetic is in . If , the sum is empty and equals ; if , there is no possible binder , so the assertion has no coordinate instance.
4. linearMap_apply_separateDirections
For all natural numbers , all -linear maps and , every function , and coordinates and , the declaration asserts
Thus the two linear maps, applied in the two separate coordinate directions and then evaluated at , give the same scalar. The quantifiers include and , in which case the corresponding input words are empty, and if or there is respectively no possible or , so the universally quantified assertion is vacuous.
5. linearMap_apply_pointwise_add
For all natural numbers , every -linear map , words , and coordinate , the declaration asserts . If , both inputs are the unique empty word; if , there is no coordinate and hence no instance of the assertion.
6. BoundaryTarget
For every dimension function , BoundaryTarget declares a degree-indexed coordinate type with and for every . Consequently, a word on the degree-zero boundary target is the unique function from the empty type to .
7. BasedBinaryChainComplex
BasedBinaryChainComplex declares a structure consisting of: a function ; for every , a -linear map
whose target is the empty-coordinate word space when and is the word space on when ; a proof that for every ; a natural number called length; and a proof that whenever . The declaration imposes no condition that be nonzero and no minimality condition on . At the lower end, has the one-element empty-coordinate codomain and is therefore the zero map. At the upper end, all groups in degrees strictly above have empty coordinate types, has an empty-coordinate domain and is the zero incoming map to degree , and every still higher boundary also has empty-coordinate domain; when , all positive-degree dimensions vanish while remains unrestricted.
8. chainDistanceAt
For every based binary chain complex and every , chainDistanceAt A j is the infimum in of the Hamming weights of all words such that and ; it is if there is no such word. At , has empty-coordinate codomain and is zero, so every degree-zero word satisfies the kernel condition, although the non-image condition remains. At , the incoming map has empty-coordinate domain and range , so witnesses are precisely nonzero words in . For every , the degree- coordinate type is empty, its sole word is zero and lies in the range of the next boundary, so the defining set is empty and the distance is ; these statements also cover .
9. TensorDegreePair
For every , TensorDegreePair j is the subtype of pairs whose underlying natural values satisfy . Thus both entries lie between and , both endpoint decompositions and are present, and for the sole element is .
10. tensorDegreePairFintype
For every , tensorDegreePairFintype j noncomputably supplies a finite-type structure on the set of pairs satisfying , using the injective inclusion of that subtype into the finite product. This declaration adds data enabling finite enumeration; it asserts no ordering or chosen enumeration formula.
11. tensorDegreePairDecidableEq
For every , tensorDegreePairDecidableEq j noncomputably supplies a classical decision procedure for equality between two degree pairs with .
12. TensorDegreeIndex
For every pair of based binary chain complexes and every , TensorDegreeIndex A B j is the dependent disjoint union
An element therefore consists of a degree pair with , an -coordinate , and a -coordinate . A component is empty if either dimension is zero; at only the component occurs. If and have recorded lengths , then this entire index type is empty for , because every decomposition then has or and hence a zero dimension.
13. tensorDegreeIndexFintype
For every based binary chain complexes and every , tensorDegreeIndexFintype A B j noncomputably supplies a finite-type structure on the dependent union of triples with , , and .
14. tensorDegreeIndexDecidableEq
For every based binary chain complexes and every , tensorDegreeIndexDecidableEq A B j noncomputably supplies a classical decision procedure for equality between two dependent triples in the degree- tensor index type.
15. tensorDegreePairLeft
For every implicit and every degree pair with , tensorDegreePairLeft p is the degree- pair . The finite-index bounds and the equality are included as proof data; this is defined also at , where it sends to .
16. tensorDegreePairRight
For every implicit and every degree pair with , tensorDegreePairRight p is the degree- pair . The finite-index bounds and the equality are included as proof data; this is defined also at , where it sends to .
17. tensorIndexLeft
For every based binary chain complexes , implicit , degree pair with , coordinate , and coordinate , tensorIndexLeft A B p a b is the degree- tensor index . If either indicated dimension is zero, the corresponding coordinate binder has no inhabitant, so there is no such indexed value.
18. tensorIndexRight
For every based binary chain complexes , implicit , degree pair with , coordinate , and coordinate , tensorIndexRight A B p a b is the degree- tensor index . If either indicated dimension is zero, the corresponding coordinate binder has no inhabitant, so there is no such indexed value.
19. tensorBoundary
For every based binary chain complexes and every , tensorBoundary A B j declares a -linear map from words on the degree- tensor index to words on the degree- tensor index. Explicitly, for an input word and an output index with , its value is
with addition in . The first slice ranges over and the second over ; the displayed output exists only when and . The definition includes proofs that this coordinate formula preserves addition and scalar multiplication. At , the only possible degree pair in the codomain is . If the codomain index type is empty, the output is the unique empty word; empty source components contribute only empty slices.
20. tensorBoundary_apply
For every based binary chain complexes , every , every word on the degree- tensor index, and every degree- tensor index with , the declaration asserts the definitional coordinate equality
All values and additions are in ; if the degree- tensor index is empty there is no possible , so the universally quantified coordinate statement has no instance.
21. tensorDegreePair_mixed
For every implicit and every degree pair with , the declaration asserts equality of the degree- dependent pairs obtained by first increasing the left entry and then the right entry or in the opposite order: both are . This includes equality of the subtype proof-bearing values, not merely equality of their displayed natural-number coordinates.
22. tensorIndex_mixed
For every based binary chain complexes , implicit , degree pair with , coordinate , and coordinate , the declaration asserts that inserting by a right-degree increase equals inserting by a left-degree increase; both sides are the same degree- tensor index . If either coordinate type is empty, the universal assertion is vacuous because no corresponding or exists.
23. tensorBoundary_tensorIndexLeft
For every based binary chain complexes , implicit , word on the degree- tensor index, pair with , coordinate , and coordinate , the declaration gives the value of the boundary from degree to degree at the left-inserted index as
Here ranges over and over , and all arithmetic is in ; if the type of or is empty, there is no instance of the coordinate assertion.
24. tensorBoundary_tensorIndexRight
For every based binary chain complexes , implicit , word on the degree- tensor index, pair with , coordinate , and coordinate , the declaration gives the value of the boundary from degree to degree at the right-inserted index as
Here ranges over and over , and all arithmetic is in ; if the type of or is empty, there is no instance of the coordinate assertion.
25. tensorBoundary_boundary
For every based binary chain complexes and every , the declaration asserts that the composite of the tensor boundary from degree to degree with the tensor boundary from degree to degree is the zero -linear map:
Equivalently, every degree- word is sent to the zero word on every degree- tensor coordinate. The quantifier includes ; if a relevant source or target tensor index type is empty, the corresponding equality reduces to equality of maps involving a one-element empty-coordinate word space.
26. TensorBoundaryTarget
For every based binary chain complexes , TensorBoundaryTarget A B declares a degree-indexed coordinate type with value at degree and value at degree , namely the dependent union of triples with , , and . Thus a word on the degree-zero target is the unique empty word, while the target in positive degree is exactly the tensor coordinate type one degree lower.
27. tensorBoundaryAt
For every based binary chain complexes , tensorBoundaryAt A B declares for each a -linear map from words on the degree- tensor index to words on TensorBoundaryTarget A B j: at it is the zero map from the degree-zero tensor word space to the empty-coordinate word space, and at it is tensorBoundary A B j, whose value at with is . If the recorded lengths are , the degree- source index is empty for ; in particular, the boundary in degree has empty domain and is the zero incoming map to the highest possibly nonempty degree, and all higher-degree domains are also empty. The lower endpoint is separately fixed by the zero-map clause, including when .
28. tensorBoundaryAt_boundaryAt
For every based binary chain complexes and every , the declaration asserts
Thus every degree- tensor word is sent to zero after the two consecutive paper-indexed boundary maps. At , the outer boundary is the explicitly defined zero map to the empty-coordinate word space; for the equality is the corresponding consecutive tensorBoundary equality. The assertion also includes degrees above the sum of the recorded lengths, where the source word spaces are empty-coordinate one-element spaces.
29. tensorProductDistanceAt
For every based binary chain complexes and every , tensorProductDistanceAt A B j is the infimum in of the Hamming weights of words on the degree- tensor index such that and is not in the range of ; it is when there is no such word. At , the first boundary is explicitly zero, so every degree-zero word satisfies the kernel condition. If the recorded lengths are , then at the next-degree tensor index is empty and the incoming boundary has range , so witnesses are precisely the nonzero words in the kernel at that degree; for every , the degree- tensor index itself is empty, its only word is zero and lies in the incoming range, and the distance is . These endpoint statements still apply when one or both lengths are zero.
30. componentDistanceMinimum
For every based binary chain complexes and every , componentDistanceMinimum A B j is the infimum in of the nonempty finite set
where each factor itself is the infimum of the Hamming weights of degree-appropriate kernel words outside the next-boundary image, or when no such word exists, and multiplication is multiplication in . Because , one always has , so the natural-number subtraction does not truncate below zero. Both endpoint choices are included: contributes and contributes . When , there is exactly one choice, , so the value is exactly ; for , the infimum is the minimum of the displayed values, allowing repeated values and values equal to .
31. oneComplex
For all natural numbers and every -linear map , oneComplex P declares a based binary chain complex with dimensions , , and for every ; boundaries into the empty-coordinate word space, , and for every ; and recorded length . It supplies proofs that every consecutive composite is zero and that whenever . Thus the lower boundary is zero and the incoming boundary at the upper end has empty-coordinate domain and is zero. The construction includes and : if either is zero its corresponding degree has only the empty word, and the recorded length remains even if the degree-one dimension, or both displayed dimensions, is zero.
32. chainDistanceBefore
For every based binary chain complex , chainDistanceBefore A declares a function with value at input and, at input , value equal to the infimum of the Hamming weights of all words satisfying and , again with value if no such word exists. Thus input returns the degree-zero distance, while input is fixed to without testing any boundary or word. If has recorded length , input returns the possibly finite distance in the highest possibly nonempty degree , whereas every input returns because degree has zero dimension and its sole zero word lies in the next-boundary range; when , input is the degree-zero distance and every input above is .
Confirmed by the mission captain (proposal self-audit).