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.ExtraModel : Nat -> CommutativeMonoidunit : (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 0pointwiseSum : (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 xsdiracPointMass : (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)) = xsFreeExtenderFunction : ExtenderFunctionFreeExtenderSetoidHomomorphism : ExtenderSetoidHomomorphismextenderPreservesZero : (other : ModelOver CommutativeMonoidTheory (cast (Fin n))) -> Preserves ((Model n) .Algebra) ((other .Model) .Algebra) (FreeExtenderFunction other) ZeroextenderPreservesPlus : (other : ModelOver CommutativeMonoidTheory (cast (Fin n))) -> Preserves ((Model n) .Algebra) ((other .Model) .Algebra) (FreeExtenderFunction other) PlusFreeExtenderHomomorphism : ExtenderAlgebraHomomorphismextenderIsMorphism : (other : ModelOver CommutativeMonoidTheory (cast (Fin n))) -> PreservesEnv (FreeCommutativeMonoidOver n) other (FreeExtenderSetoidHomomorphism other)Extender : ExtenderuniqueExtender : (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 : UniquenessFree : Free CommutativeMonoidTheory (cast (Fin n))