An inductive construction of the free commutative monoid over a finite set.
import public Frexlet.Monoid.Commutative.NatSemiLinear
import public Frexlet.Monoid.Commutative.Nat
import public Decidable.Equality
import public Data.Vect.Extra
Model : Nat -> CommutativeMonoid
unit : (n : Nat) -> Fin n -> U (Model n)
Monadic unit
FreeCommutativeMonoidOver : (n : Nat) -> ModelOver CommutativeMonoidTheory (cast (Fin n))
FreeModelZeroRepresentation : (n : Nat) -> (Model n) .sem Neutral = replicate n 0
pointwiseSum : (n : Nat) -> (xss : Vect m (U (Model n))) -> (i : Fin n) -> index i ((Model n) .sum xss) = Additive .sum (map (index i) xss)
pointwiseMult : (n : Nat) -> (m : Nat) -> (xs : U (Model n)) -> (i : Fin n) -> index i (m *. xs) = m * index i xs
diracPointMass : (i : Fin n) -> (j : Fin n) -> Either (i = j, index j (unit n i) = 1) (index j (unit n i) = 0)
normalForm : (n : Nat) -> (xs : U (Model n)) -> (Model n) .sum (tabulate (\i => index i xs *. unit n i)) = xs
FreeExtenderFunction : ExtenderFunction
FreeExtenderSetoidHomomorphism : ExtenderSetoidHomomorphism
extenderPreservesZero : (other : ModelOver CommutativeMonoidTheory (cast (Fin n))) -> Preserves ((Model n) .Algebra) ((other .Model) .Algebra) (FreeExtenderFunction other) Zero
extenderPreservesPlus : (other : ModelOver CommutativeMonoidTheory (cast (Fin n))) -> Preserves ((Model n) .Algebra) ((other .Model) .Algebra) (FreeExtenderFunction other) Plus
FreeExtenderHomomorphism : ExtenderAlgebraHomomorphism
extenderIsMorphism : (other : ModelOver CommutativeMonoidTheory (cast (Fin n))) -> PreservesEnv (FreeCommutativeMonoidOver n) other (FreeExtenderSetoidHomomorphism other)
Extender : Extender
uniqueExtender : (other : ModelOver CommutativeMonoidTheory (cast (Fin n))) -> (extend : FreeCommutativeMonoidOver n ~> other) -> (xs : U (Model n)) -> (other .Model) .rel (((extend .H) .H) .H xs) (FreeExtenderFunction other xs)
Uniqueness : Uniqueness
Free : Free CommutativeMonoidTheory (cast (Fin n))