!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  8        0An additive semigroup with idempotent addition.  a + a = a an additive abelian semigroup a + b = b + a UpartitionWith f c returns a list containing f a b for each a b such that a + b = c,   (a + b) + c = a + (b + c)  replicate 1 a = a 5 replicate (2 * n) a = replicate n a + replicate n a = replicate (2 * n + 1) a = replicate n a + replicate n a + a &replicate1p n r = replicate (1 + n) r   An additive monoid  zero + a = a = a + zero  !"#$@An associative algebra built with a free module over a semiring %&eA pair of an additive abelian semigroup, and a multiplicative semigroup, with the distributive laws:  E a(b + c) = ab + ac -- left distribution (we are a LeftNearSemiring) I (a + b)c = ac + bc -- right distribution (we are a [Right]NearSemiring) XCommon notation includes the laws for additive and multiplicative identity in semiring. If you want that, look at Rig instead.  Ideally we'd use the cyclic definition:  ` class (LeftModule r r, RightModule r r, Additive r, Abelian r, Multiplicative r) => Semiring r Nto enforce that every semiring r is an r-module over itself, but Haskell doesn' t like that. 'A multiplicative semigroup ()*+,- 2the free commutative coalgebra over a set and Int  @the free commutative coalgebra over a set and a given semigroup  -the free commutative band coalgebra over Int  $the free commutative band coalgebra  The tensor Hopf algebra The tensor Hopf algebra NEvery coalgebra gives rise to an algebra by vector space duality classically. N Sadly, it requires vector space duality, which we cannot use constructively. ~ The dual argument only relies in the fact that any constructive coalgebra can only inspect a finite number of coefficients,  which we CAN exploit. The tensor algebra The tensor algebra  !"#$%&'()*+,- !!"##$%%&'()*()*+,-./012./012./012/012 3`factorWith f c`% returns a non-empty list containing `f a b` for all `a, b` such that ` a * b = c`. _Results of factorWith f 0 are undefined and may result in either an error or an infinite list. 434344! 5=A bialgebra is both a unital algebra and counital coalgebra  where the % and 9$ are compatible in some sense with  the # and 7. That is to say that  % and 97 are a coalgebra homomorphisms or (equivalently) that  # and 7 are an algebra homomorphisms. 678IAn associative unital algebra over a semiring, built using a free module 9:;<=> 56789:;<=> 5677899:;<=;<=>"?@A<An multiplicative semigroup with idempotent multiplication.  a * a = a BC?@ABC?@ABC#ABC$DEFGHIJDEFGHIJDEEFGHIJGHIJ%K?A HopfAlgebra algebra on a semiring, where the module is free. When antipode . antipode = idM and antipode is an antihomomorphism then we are an InvolutiveBialgebra with inv = antipode as well LKLKLL&MBb is an associate of a if there exists a unit u such that b = a*u UThis relationship is symmetric because if u is a unit, u^-1 exists and is a unit, so  b*u^-1 = a*u*u^-1 = a MM'NNN(OOO)PA Ring without (n)egation QPQPQQ*RS T!U"NB: we'4re using the boolean semiring, not the boolean ring RSTURSSTU+VA Ring without an i dentity. VV,WX#WX#WXX#-YYY. !Z7a rectangular band is a nowhere commutative semigroup. = That is to say, if ab = ba then a = b. From this it follows = classically that aa = a and that such a band is isomorphic  to the following structure [Z[Z[Z[[/$*An integral semiring has no zero divisors $ a * b = 0 implies a == 0 || b == 0 $$0\]^_'A commutative multiplicative semigroup \]^_\]^_1 `abcdefgh  adjoint = id i(adjoint (x + y) = adjoint x + adjoint y jAn semigroup with involution ) adjoint a * adjoint b = adjoint (b * a) k `abcdefghijk `abcddefgghijkk2i3lll mJLinear functionals from elements of an (infinite) free module to a scalar n%opqrstuvTconvolveM antipodeM return = convolveM return antipodeM = comultM >=> uncurry joinM w mnopqrstuvw mnrpqotuvsw mnnopqrstuvwxyxyxyxyyz{z{z{z{{|}~|}~|}~|}~}~  45 ` Additive.(+)` default definition Additive.replicate1p default definition  Monoidal.zero default definition Monoidal.replicate default definition  Group.negate default definition ` Group.(-)` default definition Group.subtract default definition  Group.times default definition `Multiplicative.(*)` default definition  Unital.one default definition Rig.fromNatural default definition Ring.fromInteger default definition  6z + x < = z + y = x < = y = x + z <= y + z 78&  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXY\]^_`abcdefghijklmnopqrstuvw-,./012'()*+_:;<=>ABCFGHIJ34jkh&iVPQWXYl !$%"#89675fgcdaeb`@?^\]DEKLRSTU ONMmnrpqotuvsw 3half of the Cayley-Dickson quaternion isomorphism xyz{ xyz{ 0Cayley-Dickson quaternion isomorphism (one way) 'the trivial diagonal coalgebra (the quaternion algebra xyz{|}~xyz{|}~  dual number basis, D^2 = 0. D /= 0. xy xy)'the hyperbolic trigonometric coalgebra *the trivial diagonal algebra dual number basis, D^2 = 0. D /= 0. xy xy+,-./ 0Cayley-Dickson quaternion isomorphism (one way) 0!dual quaternion comultiplication 1the trivial diagonal algebra xyz{|}~xyz{|}~  Ilinear maps from elements of a free module to another free module over r  " f $# x + y = (f $# x) + (f $# y)  f $# (r .* x) = r .* (f $# x)  Map r b a; represents a linear mapping from a free module with basis a over r to a free module with basis b over r. ]Note well the reversed direction of the arrow, due to the contravariance of change of basis! ]This way enables we can employ arbitrary pure functions as linear maps by lifting them using 2, or build them l by using the monad instance for Map r b. As a consequence Map is an instance of, well, almost everything. 3.extract a linear functional from a linear map M(inefficiently) combine a linear combination of basis vectors to make a map. 4 arrMap :: (Monoidal r, Semiring r) => (b -> [(r, a)]) -> Map r b a  arrMap f = Map $ k b -> sum [ r * k a | (r, a) <- f b ] 'Memoize the results of this linear map Econvolution given an associative algebra and coassociative coalgebra =The free Ring given a Rng obtained by adjoining Z, such that   RngRing r = n*1 + r "This ring is commonly denoted r^. )The rng homomorphism from r to RngRing r igiven a rng homomorphism from a rng r into a ring s, liftRngHom yields a ring homomorphism from the ring `r^` into s. http:en.wikipedia.orgwikiOpposite_ring \The endomorphism ring of an abelian group or the endomorphism semiring of an abelian monoid http:en.wikipedia.orgwikiEndomorphism_ring 459:;<<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghij k l!m!n!o!p!q!r!s!t!u!v"w"x"y"z"{$|$}$~$$$$%%&'())****+,,-00001111111111113   45555555555556788                         !!"#$%&'()*+,-./01 '"2&3&4&5'6'7'8'9':(;)<)=*>*>*?*@,A/BC8D E FGHIIJKLMNOPQRST algebra-0.7.0Numeric.Natural.InternalNumeric.AlgebraNumeric.Band.RectangularNumeric.Covector#Numeric.Algebra.Distinguished.ClassNumeric.Algebra.Complex.Class Numeric.Algebra.Quaternion.ClassNumeric.Algebra.Dual.Class"Numeric.Coalgebra.Hyperbolic.Class%Numeric.Coalgebra.Trigonometric.ClassNumeric.Algebra.ComplexNumeric.Algebra.QuaternionNumeric.Algebra.DualNumeric.Algebra.HyperbolicNumeric.Coalgebra.HyperbolicNumeric.Coalgebra.DualNumeric.Coalgebra.TrigonometricNumeric.Coalgebra.GeometricNumeric.Coalgebra.Quaternion Numeric.Exp Numeric.Log Numeric.MapNumeric.Rng.ZeroNumeric.Ring.RngNumeric.Ring.OppositeNumeric.Ring.EndomorphismNumeric.Order.ClassNumeric.NaturalNumeric.Additive.ClassNumeric.Algebra.ClassNumeric.Additive.GroupNumeric.Algebra.FactorableNumeric.Algebra.UnitalNumeric.Algebra.IdempotentNumeric.Band.ClassNumeric.Algebra.DivisionNumeric.Algebra.HopfNumeric.Decidable.AssociatesNumeric.Decidable.UnitsNumeric.Decidable.ZeroNumeric.Rig.ClassNumeric.Rig.CharacteristicNumeric.Rng.ClassNumeric.Ring.ClassNumeric.Ring.DivisionNumeric.Module.ClassNumeric.Semiring.IntegralNumeric.Algebra.CommutativeNumeric.Algebra.InvolutiveNumeric.Semiring.InvolutiveNumeric.Field.ClassNumeric.Dioid.ClassNumeric.Module.RepresentableNumeric.Order.AdditiveNumeric.Rig.OrderedNumeric.Quadrance.ClassWhole toNatural unsafePredNatural runNaturalOrder<~<>~>~~/~order comparable IdempotentAbelian Partitionable partitionWithAdditive+ replicate1psumWith1sum1replicate1pIdempotentMonoidalzero replicatesumWithModule RightModule*. LeftModule.* CoalgebracomultAlgebramultSemiringMultiplicative*pow1p productWith1product1sumreplicateIdempotentGroup-negatesubtracttimes Factorable factorWith BialgebraCounitalCoalgebracounit UnitalAlgebraunitUnitalonepow productWithproductIdempotentBialgebraIdempotentAlgebraBand pow1pBandpowBandDivisionAlgebra recipriocalDivisionrecip/\\^ HopfAlgebraantipodeDecidableAssociatesDecidableUnits DecidableZeroRig fromNaturalCharacteristiccharcharIntcharWordRngRing fromInteger DivisionRingRectCommutativeBialgebraCocommutativeCoalgebraCommutativeAlgebra CommutativeTriviallyInvolutiveBialgebraInvolutiveBialgebraTriviallyInvolutiveCoalgebraInvolutiveCoalgebracoinvTriviallyInvolutiveAlgebraInvolutiveAlgebrainvTriviallyInvolutiveInvolutiveSemiringInvolutiveMultiplicationadjointFieldCovectormultMunitMcomultMcounitM convolveMinvMcoinvM antipodeMmemoM Distinguishede Complicatedi Hamiltonianjk Infinitesimald Hyperboliccoshsinh TrigonometriccossinDioidaddRepreplicate1pRepzeroRep replicateRep negateRepminusRep subtractReptimesRepmulReponeRepfromNaturalRepfromIntegerRep AdditiveOrder OrderedRig Quadrance quadranceComplex ComplexBasisIErealPartimagPart uncomplicate QuaternionQuaternionBasisKJ complicate scalarPart vectorPartDual DualBasisDHyper' HyperBasis'Sinh'Cosh'Hyper HyperBasisSinhCoshDual' DualBasis'Trig TrigBasisSinCos Comultivector Eigenmetricmetric Eigenbasis euclidean antiEuclideanv BasisCobladerunBasisCobladegrade filterGradereversecliffordConjugategradeInversion geometricouter contractL contractRdothestenes liftProduct Quaternion'QuaternionBasis'K'J'I'E' complicate' scalarPart' vectorPart'ExprunExpLogrunLogMap$@memoMap comultMapmultMap counitMapunitMap convolveMap antipodeMapcoinvMapinvMapZeroRng runZeroRngRngRing rngRingHom liftRngHomOpposite runOppositeEndappEndtoEndfromEnd frobeniusorderOrdconcat pow1pIntegral$fCoalgebrarIntMap$fCoalgebrarMap$fCoalgebrarIntSet$fCoalgebrarSet$fCoalgebrarSeq$fCoalgebrar[]$fCoalgebrar(->) $fAlgebrarSeq $fAlgebrar[]IdempotentCoalgebra isAssociateisAssociateIntegralisAssociateWhole recipUnitisUnit^?recipUnitIntegralrecipUnitWholeisZerofromNaturalNum fromWholeProxy asProxyTypeOf$fCharacteristicBool fromIntegralIntegralSemiring$*sq$fCoalgebrarQuaternionBasis$fAlgebrarQuaternionBasis$fCoalgebrakHyperBasis$fAlgebrakHyperBasis Euclideanlsb m1powTimesreorder$fCoalgebrarQuaternionBasis'$fAlgebrarQuaternionBasis'base Control.Arrowarr$#ofRing