y      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ ,        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/0123`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?@ABCABCDEFGHIJDEFGHIJDEEFGHIJGHIJK?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 LKLKLLMBb 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 MMNNNOOOPA Ring without (n)egation QPQPQQ RSTUNB: we'4re using the boolean semiring, not the boolean ring RSTURSSTU!VA Ring without an i dentity. VV"WXWXWXXY7a 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 ZYZYZYZZ# !$*An integral semiring has no zero divisors $ a * b = 0 implies a == 0 || b == 0 %[\]^'A commutative multiplicative semigroup [\]^[\]^& _`abcdefg  adjoint = id h(adjoint (x + y) = adjoint x + adjoint y iAn semigroup with involution ) adjoint a * adjoint b = adjoint (b * a) j _`abcdefghij _`abccdeffghijj'h kJLinear functionals from elements of an (infinite) free module to a scalar lmnopqrstTconvolveM antipodeM return = convolveM return antipodeM = comultM >=> uncurry joinM u klmnopqrstu klpnomrstqu kllmnopqrstu(vvv) w` Additive.(+)` default definition xAdditive.replicate1p default definition y Monoidal.zero default definition zMonoidal.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 wxyz{|}~ wxyz{|}~*z + x < = z + y = x < = y = x + z <= y + z +,  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWX[\]^_`abcdefghijklmnopqrstuvwxyz{|}~-,./012'()*+^:;<=>ABCFGHIJ34ijg&hvVPQWX !$%"#89675efbc`da_@?][\DEKLRSTU ONMwxyz{|}~klpnomrstqu 0Cayley-Dickson quaternion isomorphism (one way) 7Cayley-Dickson quaternion isomorphism (the other half)        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  , or build them l by using the monad instance for Map r b. As a consequence Map is an instance of, well, almost everything.  .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  -./00123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|} ~  !""%%%%&&&&&&&&&&&&())))))))))))*+,,                        "$,      ! "#$ algebra-0.6.0Numeric.Natural.InternalNumeric.AlgebraNumeric.Band.RectangularNumeric.CovectorNumeric.Algebra.ComplexNumeric.Algebra.QuaternionNumeric.Algebra.TrigonometricNumeric.Algebra.HyperbolicNumeric.Algebra.Geometric 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.Module.ClassNumeric.Semiring.IntegralNumeric.Algebra.CommutativeNumeric.Algebra.InvolutiveNumeric.Semiring.InvolutiveNumeric.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 fromIntegerRectCommutativeBialgebraCocommutativeCoalgebraCommutativeAlgebra CommutativeTriviallyInvolutiveBialgebraInvolutiveBialgebraTriviallyInvolutiveCoalgebraInvolutiveCoalgebracoinvTriviallyInvolutiveAlgebraInvolutiveAlgebrainvTriviallyInvolutiveInvolutiveSemiringInvolutiveMultiplicationadjointCovectormultMunitMcomultMcounitM convolveMinvMcoinvM antipodeMmemoMDioidaddRepreplicate1pRepzeroRep replicateRep negateRepminusRep subtractReptimesRepmulReponeRepfromNaturalRepfromIntegerRep AdditiveOrder OrderedRig Quadrance quadrance ComplicatedeiComplex ComplexBasisIE QuaternionQuaternionBasisKJ Hamiltonianjk complicate uncomplicate TrigonometricscTrig TrigBasisCS HyperbolicHyper HyperBasis Multivector Comultivector Eigenmetricmetric Eigenbasis euclidean antiEuclideanvBladerunBladegrade filterGradereversecliffordConjugategradeInversion geometricouter contractL contractRdothestenes liftProductExprunExpLogrunLogMap$@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 Euclideanlsb m1powTimesreorderbase Control.Arrowarr$#ofRing