h^         ! "#$ % & ' ( ) * + , - ./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefg h i j!k!l!m!n!o!p!q!r!s"t"u"v#w#x#y$z${$|$}$~$$$$$$$$$%%%%%%%%%%%%%%%%&&&&&'''''((()))****:+           (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 z + x < = z + y = x < = y = x + z <= y + z UpartitionWith f c returns a list containing f a b for each a b such that a + b = c, an additive abelian semigroup a + b = b + a , @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:   a(b + c) = ab + ac  (a + b)c = ac + bc 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  !The tensor algebra The tensor 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. ~ This is the dual, which relies in the fact that any constructive coalgebra can only inspect a finite number of coefficients. "#"#"##  !! $'A commutative multiplicative semigroup $$$ %An semigroup with involution ) adjoint a * adjoint b = adjoint (b * a) &'%&'%&'%&&' (`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. )()()()) *+,-*+,-,-*+*++,--.An additive monoid  zero + a = a = a + zero /012./012./012./01/01230An additive semigroup with idempotent addition.   a + a = a 7An (Idempotent r, Rig r) => r is also known as a dioid 45345345345-6IAn associative unital algebra over a semiring, built using a free module 789:;<6789:;<67789:;9:;<=>67=>67=>=>>?8A Hopf algebra on a semiring, where the module is free. If antipode . antipode = id then we are  Involutive @?@?@?@@. "#67=>?@89:;<89:;<A<An multiplicative semigroup with idempotent multiplication.  a * a = a BCABCABCABCD7a 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 EDEDEDEE/ABCDE0 !$%&'345ABCDE1# !$%&'./01234589:;<ABCDEFGHIJKFGHIJKFGHIJKFGHIGHIJKLMBb 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 NOLMNOLMNOLMMNOPQRSTPQRSTPQRSTPQRSTQRST2 !$%&'()89:;<PQRSTUVUVUVUVVWA Ring without (n)egation XYZWXYZWXYZWXXYZ[[[[3  [\(adjoint (x + y) = adjoint x + adjoint y \\\]]]]4\]^_`ab^_`ab^_`ab^_`ab_`ab5- !$%&'./01234589:;<ABCDEPQRST^_`abcA Ring without an i dentity. cccdefdefdefdeef6*+,-7./012345^_`ab ghighighighihi! jkl>Linear functionals from elements of a free module to a scalar mnopqrThe augmentation ring homomorphism from r^a -> r, generalizes the augmentation homomorphism from a monoid semiring to the underlying semiring jklmnopqr lmnjokpqr jklmnmnopqr"sBAntilinear functionals from elements of a free module to a scalar tustustustutu#vwxvwxvwxvwxwx$yIlinear 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. QNote well the change of direction, due to the contravariance of change of basis! ]This way enables we can employ arbitrary pure functions as linear maps by lifting them using , or build them l by using the monad instance for Map r b. As a consequence Map is an instance of, well, almost everything. z{|.extract a linear functional from a linear map }M(inefficiently) combine a linear combination of basis vectors to make a map. ~'Memoize the results of this linear map Econvolution given an associative algebra and coassociative coalgebra 1The augmentation ring homomorphism from r^a -> r yz{|}~yz{|~}yz{z{|}~%&\The endomorphism ring of an abelian group or the endomorphism semiring of an abelian monoid http:en.wikipedia.orgwikiEndomorphism_ring 'NB: we'4re using the boolean semiring, not the boolean ring 8 WXYZ[(9 \]^_`abc)http:en.wikipedia.orgwikiOpposite_ring *=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. :def;<=>>?@ABCDEFGHIJKLMNOPQR,S,T,U,V,W,X,Y,Z,[\] ^ _ ` a b c d e f ghijklmno-p-q-r-s-t-u-vwxyz{|}~~   !!!!!!!!!"""###$$$$$$$$$$$$$$%%%%%%%%%%%%%%%%&&&&&'''''((()))****,, '' algebra-0.4.0Numeric.Natural.InternalNumeric.Order.ClassNumeric.Semigroup.AdditiveNumeric.Order.AdditiveNumeric.Addition.PartitionableNumeric.Addition.AbelianNumeric.Algebra.Free.ClassNumeric.Semiring.Class Numeric.Semigroup.Multiplicative"Numeric.Multiplication.Commutative!Numeric.Multiplication.Involutive!Numeric.Multiplication.FactorableNumeric.Module.ClassNumeric.Monoid.AdditiveNumeric.Addition.IdempotentNumeric.Algebra.Free.UnitalNumeric.Monoid.MultiplicativeNumeric.Algebra.Free.HopfNumeric.Band.ClassNumeric.Band.RectangularNumeric.Decidable.UnitsNumeric.Decidable.AssociatesNumeric.Group.MultiplicativeNumeric.Decidable.ZeroNumeric.Rig.ClassNumeric.Rig.OrderedNumeric.Semiring.InvolutiveNumeric.Semiring.IntegralNumeric.Group.AdditiveNumeric.Rng.ClassNumeric.Ring.Class Numeric.ExpNumeric.Functional.LinearNumeric.Functional.Antilinear Numeric.LogNumeric.Map.LinearNumeric.Polynomial.Basis.PowerNumeric.Ring.EndomorphismNumeric.Rig.CharacteristicNumeric.Rng.ZeroNumeric.Ring.OppositeNumeric.Ring.RngNumeric.NaturalNumeric.Semiring.Internal&Numeric.Monoid.Multiplicative.InternalNumeric.Algebra.Free Numeric.BandNumeric.SemigroupNumeric.MonoidNumeric.Multiplication Numeric.OrderNumeric.Semiring Numeric.GroupNumeric.ModuleNumeric.Addition Numeric.Rig Numeric.Rng Numeric.RingWhole toNatural unsafePredNatural runNaturalOrder<~<>~>~~/~order comparableorderOrdAdditive+ replicate1psumWith1sum1 AdditiveOrder Partitionable partitionWithAbelian FreeAlgebrajoinSemiringMultiplicative*pow1p productWith1product1 pow1pIntegral FreeCoalgebracojoin CommutativeInvolutiveMultiplicationadjointadjointCommutative Factorable factorWith RightModule*. LeftModule.*AdditiveMonoidzero replicatesumWithsum Idempotentreplicate1pIdempotentreplicateIdempotentFreeUnitalAlgebraunitUnitalonepow productWithproductFreeCounitalCoalgebracounitHopfantipodeBand pow1pBandpowBandRectDecidableUnits recipUnitisUnit^?recipUnitIntegralrecipUnitWholeDecidableAssociates isAssociateisAssociateIntegralisAssociateWholeMultiplicativeGrouprecip/\\^ DecidableZeroisZeroRig fromNaturalfromNaturalNum fromWhole OrderedRig InvolutiveIntegralSemiring AdditiveGroup-negatesubtracttimesRngRing fromInteger fromIntegralExprunExpVectorCovectorLinear$* unitVectorcounitCovector embedCovectoraugmentCovector Antilinear appAntilinearLogrunLogMap$#$@arrMapmemoMapjoinMap cojoinMapunitMap counitMap convolveMap antipodeMapembedMap augmentMapZYXW:^PowerlogPower^:xatdeltacoefEndappEndtoEndfromEndCharacteristicchar frobeniuscharIntcharWordZeroRng runZeroRngOpposite runOppositeRngRing rngRingHom liftRngHomconcat$fFreeAlgebrarSeq$fFreeAlgebrar[]$fFreeCoalgebrar(->)base Control.ArrowarrofRing$fCharacteristicBool