2021 James B. Wilson, Colorado State University
Cause: Ordering what doesn't want to be ordered.
Γi1⋯iaj1⋯jb
Kd1×⋯×dℓ
xi1⊗…⊗xiℓ
Kd1⊗⋯⊗Kdℓ
In Code: we want a command like
def MakeSpace( K, d_1, ...., d_ell )
...
Above "ell" is a variable also,
but the program doesn't know this,
this cannot be programmed without very special features (dependent types, variadic inputs, etc.).
Solution 1: assign a new variable.
Kd1×⋯×dℓ
becomes
Kd,whered=d1×⋯×dℓ
Solution 2: use a set
Kd1⊗⋯⊗Kdℓ
becomes
d∈D⨂Kd,D={d1,…,dℓ}
One step further let the set index itself:
Let V be a set of spaces and consider V∈V⨂V=⊗V
// Original
def MakeSpace( K, d_1, ...., d_ell )
...
// Create index set
ds = [1,2, 19,...] // "..." means user filled in constants
def MakeSpace( K, ds)
...
Solution 2 in code
x1+⋯+xℓ
ΣX=x∈X∑x,X={x1,…,xℓ}
xs = [ 3, -9, 541 ]
sum(xs)
// Alternatives
xs.fold(+) // head+tail.fold(+), recursive
+&xs // "&"="forall" + = sum
Solution 3−ε: if sub-sub-scripted, e.g.
Γi1…ia
replace i∗=(i1,…,ia)
Γi∗
Asside: what is (i1,…,ia)?
(i1,…,ia)∈[d1]×⋯×[dℓ]
where [n]={1,…,n}
Generally
(x1,…,xa)∈X1×⋯×Xa
That is...
x∈ΠX=X∈X∏X
Solution 3: use functions
Γi1…ia
Step I, replace ik with tuple ι∈ΠD
Step II, Γ is now a function on tuples
Γ:ΠD→K
and we access it like any function,
Γι∈K
Γi1…iaj1…jb
Γιτ where ι∈ΠLτ∈ΠU
is = x -> ... // A lambda, a little function
js = y -> ... // that given index, calcs the coordinate.
gamma(is, js)
A subscript in the end is just turning symbol into a function, ai means a function varying with i, so a:I→T.
All functions are defined on sets and so order of the domain never matters.
Let that reality sink in and soon your subscripts will become tidy and programable.
But above all be flexible with others, and yourself!