Ask Your Question

Revision history [back]

Vector as function from a finite set

Hi, I want to represent a vector as a function from a finite set (where its size is the dimension) instead of a list(the application is semantics of linear logic). So for example, a one dimensional vector over a a finite field of size 3 would be implemented as this:
One = Set(['ball'])
Ex1 = GF(3) ^ One
instead of
Ex 2 = GF(3) ^ 1.
Unfortunately. Sagemath considers Ex2 as a vectorspace( Vector space of dimension 1 over Finite Field of size 3), but Ex1 is just a free module (Free module generated by {'ball'} over Finite Field of size 3). So for example the Hom function does not return vector space of linear transformations. But from a mathematical point of view, of course both Ex1 an Ex2 are vector spaces.

How to get around this? I need to retain the structure of the finite set that indexes the vector. My intuition (that comes from programming) is that I need to implement some kind of datatype which when used in operations that requires a vector returns a representation as a list and uses the size of the index set when creating the vector space. But perhaps there is already support for this. Please suggest a Sagemath native way to implement this. Pointers to already implemented code that does something similar would be great!