# Linear algebra in Rel

I'm interested in generalising some of the basics of linear algebra. In a standard setup, we take an arbitrary semiring $$R$$, and from this can make vectors as elements of $$R^n$$ and matrices as elements of $$R^{m \times n}$$. The vector spaces (technically just semimodules in this setting) formed as such form a compact closed category, with the matrices being the internal homs. This category is the strictification of the category of finite-dimensional vector spaces, which is similarly well behaved.

Now I want to generalise this away from Set, into at least Rel, and hopefully a broad class of monoidal categories. A semiring in Set is a commutative monoid, a monoid, and some distributive laws between them. To produce the definition of a semiring in $$C$$, with $$C$$ a symmetric monoidal category, the first two parts are standard. For the distributive laws, we need some way to do deletion and duplication, so as to capture, respectively, $$0 × c = 0$$ and $$(a + b) × c = a × c + b × c$$. A way to do this is to additionally require a commutative comonoid which distributes over the addition and multiplication (forming a bialgebra with each).

Then what I want to know is: can we form (spaces of) vectors and matrices by iterating the tensor product of $$C$$, and do those vectors and matrices behave as we would expect? An ideal answer would be a reference to a paper that spells out something similar to what I have described. It may assume rings or fields rather than semirings, but should have a similar level of generality with respect to the structure on $$C$$. Such a paper is difficult to search for because some of the most used monoidal categories are those of vector spaces (in Set).