On this page ‘A∨B’ = span(A∪B).

Coordinate Free Logic

Module testInter is a stress test of the subspace intersection logic. We choose three random independent subspaces. By independent I mean that the dimensionality of the span of their union is the sum of their dimensioalities. This is a stronger requirement than that they be pairwise independent since the lattice of subspaces is not distributive; see below. To do this we choose the dimensionalities of the spaces, choose that many random vectors for each, and reject the choices unless the sum of their ranks attains the rank of their span.

We now invoke the intersect function (A∨B)⋂(A∨C) and compare that with A.

Within the code:

The dimensionality of the whole space S.
New random vector in S.
(vsg k)
Set of k random vectors as a k×n matrix.
a, b, c
The respective dimensionalities of the three subspaces.
A, B, C
The three subspaces, each as a list of spanning vectors.
(I a b)
Canonical version of the intersection of the spaces spanned respectively by vector sets a and b.
(rmg k)
k×k matrix.
(scr s)
Scrambled version of a vector set; value spans same space as argument.

Non Distributive

The subspaces of a vector space form a lattice but not a ‘distributive lattice’. In particular A⋂(B∨C) may not be the same as (A⋂B)∨(A⋂C). We denote subspaces by their RREF matrices. For example let A = ((1 1)), B = ((1 0)) and C = ((0 1)). (B∨C) is then ((1 0) (0 1)) and A⋂(B∨C) is ((1 1)); whereas (A⋂B) and (A⋂C) are both () and thus (A⋂B)∨(A⋂C) is ()!

The other distributive law, A∨(B⋂C) = (A∨B)⋂(A∨C), fails for the same counter example: (B⋂C) is (), A∨(B⋂C) is ((1 1)), whereas (A∨B) and (A∨C) are both ((1 0) (0 1)) and thus (A∨B)⋂(A∨C) is ((1 0) (0 1)).

In light of the above non theorems, I propose three independent spaces A, B and C meaning that A⋂(B∨C) = B⋂(C∨A) = C⋂(A∨B) = {0}. With those antecedents, both distributive laws follow but the test (A∨B)⋂(A∨C) = A suffices for testing our intersect code. Let a = dim(A), b=dim(B), c=dim(C) and d = a+b+c≤n. To choose A, B and C generate a random d×n matrix of rank d. Subdivide it into a×n, b×n and c×n matrices which respectively span A, B and C.