Basic properties of holors #
Holors are indexed collections of tensor coefficients. Confusingly, they are often called tensors in physics and in the neural network community.
A holor is simply a multidimensional array of values. The size of a
holor is specified by a List ℕ
, whose length is called the dimension
of the holor.
The tensor product of x₁ : Holor α ds₁
and x₂ : Holor α ds₂
is the
holor given by (x₁ ⊗ x₂) (i₁ ++ i₂) = x₁ i₁ * x₂ i₂
. A holor is "of
rank at most 1" if it is a tensor product of one-dimensional holors.
The CP rank of a holor x
is the smallest N such that x
is the sum
of N holors of rank at most 1.
Based on the tensor library found in
References #
HolorIndex ds
is the type of valid index tuples used to identify an entry of a holor
of dimensions ds
.
Equations
- HolorIndex ds = { is : List ℕ // List.Forall₂ (fun (x x_1 : ℕ) => x < x_1) is ds }
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- HolorIndex.assocRight = cast (_ : HolorIndex (ds₁ ++ ds₂ ++ ds₃) = HolorIndex (ds₁ ++ (ds₂ ++ ds₃)))
Instances For
Equations
- HolorIndex.assocLeft = cast (_ : HolorIndex (ds₁ ++ (ds₂ ++ ds₃)) = HolorIndex (ds₁ ++ ds₂ ++ ds₃))
Instances For
Equations
- Holor.instInhabitedHolor = { default := fun (x : HolorIndex ds) => default }
Equations
- Holor.instZeroHolor = { zero := fun (x : HolorIndex ds) => 0 }
Equations
- Holor.instAddSemigroupHolor = Pi.addSemigroup
Equations
- Holor.instAddCommSemigroupHolor = Pi.addCommSemigroup
Equations
- Holor.instAddCommMonoidHolor = Pi.addCommMonoid
Equations
- Holor.instAddCommGroupHolor = Pi.addCommGroup
Equations
- Holor.instModuleHolorInstAddCommMonoidHolorToAddCommMonoidToNonUnitalNonAssocSemiringToNonAssocSemiring = Pi.module (HolorIndex ds) (fun (a : HolorIndex ds) => α) α
A slice is a subholor consisting of all entries with initial index i.
Equations
- Holor.slice x i h is = x { val := i :: ↑is, property := (_ : List.Forall₂ (fun (x x_1 : ℕ) => x < x_1) (i :: ↑is) (d :: ds)) }
Instances For
Two holors are equal if all their slices are equal.
The original holor can be recovered from its slices by multiplying with unit vectors and summing up.
CPRankMax1 x
means x
has CP rank at most 1, that is,
it is the tensor product of 1-dimensional holors.
- nil: ∀ {α : Type} [inst : Mul α] (x : Holor α []), Holor.CPRankMax1 x
- cons: ∀ {α : Type} [inst : Mul α] {d : ℕ} {ds : List ℕ} (x : Holor α [d]) (y : Holor α ds), Holor.CPRankMax1 y → Holor.CPRankMax1 (Holor.mul x y)
Instances For
CPRankMax N x
means x
has CP rank at most N
, that is,
it can be written as the sum of N holors of rank at most 1.
- zero: ∀ {α : Type} [inst : Mul α] [inst_1 : AddMonoid α] {ds : List ℕ}, Holor.CPRankMax 0 0
- succ: ∀ {α : Type} [inst : Mul α] [inst_1 : AddMonoid α] (n : ℕ) {ds : List ℕ} (x y : Holor α ds), Holor.CPRankMax1 x → Holor.CPRankMax n y → Holor.CPRankMax (n + 1) (x + y)
Instances For
The CP rank of a holor x
: the smallest N such that
x
can be written as the sum of N holors of rank at most 1.
Equations
- Holor.cprank x = Nat.find (_ : ∃ (n : ℕ), (fun (n : ℕ) => Holor.CPRankMax n x) n)