module Algebra.Monoid.Instances.Transformation.Fin where

Finite full transformation monoidsπŸ”—

The finite full transformation monoid represents the endomaps of the standard finite set

  End[n] : Monoid lzero
  End[n] = (Fin n β†’ Fin n) , End (el! (Fin n))

However, the definition of the full transformation monoid End[n] on has a few disadvantages. Firstly, elements of End[n], being functions, are awkward to write down. On a blackboard one often writes an element of in the form

Here, is the transformation sending each element in the top row to the corresponding element in the bottom row. We would like to achieve something similar in Mikan. Secondly, the product of two elements of End[n] will typically not compute until it is actually applied to an element of We would like equal elements of to be definitionally equal whenever possible.

We can solve both these problems using the equivalence between the underlying set of End[n] and vectors of length with coordinates in

  End≃𝒯 : ⌞ End[n] ⌟ ≃ Vec (Fin n) n
  End≃𝒯 = Equiv.inverse Vec≃Fun

  𝒯 : Monoid lzero
  𝒯 = Vec (Fin n) n , monoid-transport End≃𝒯 (End[n] .snd)

Since the monoid structure on was constructed directly from the monoid structure on End[n], it is clear that these give isomorphic monoids:

  End≅𝒯 : (el! (End[n] .fst) , End[n] .snd) Monoids.β‰… (el! (𝒯 .fst) , 𝒯 .snd)
  End≅𝒯 = total-iso End≃𝒯 (monoid-transport-hom End≃𝒯 (End[n] .snd))

Using list syntax for vectors, the element above can be written as

  a : ⌞ 𝒯 5 ⌟
  a = [ 4 , 1 , 4 , 2 , 1 ]

Moreover, multiplication in genuinely computes, so we can write equations such as

  _ : a ≑ [ 1 , 2 , 3 , 4 , 0 ] ⋆ [ 3 , 0 , 3 , 1 , 0 ]
  _ = refl