!Q      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ Safe=?@AXkrings,Construct an interval from a pair of points.If a <~ b then a ... b = Empty.rings$Obtain the endpoints of an interval.rings0Construct an interval containing a single point. singleton 11 ... 1rings& X_\geq(x) = \{ y \in X | y \geq x \} &Construct the upper set of an element x.4This function is monotone wrt the containment order.rings& X_\leq(x) = \{ y \in X | y \leq x \} &Construct the lower set of an element x.4This function is antitone wrt the containment order.ringsThe empty interval.emptyEmpty3Safe=?@AXk[ ringsA   is a  plus a function,   , such that:  a << negate a == mempty negate a << a == mempty   6Safe=?@AXkSafe =>?@AXkrings)Residuated, partially ordered semigroups.MIn the interest of usability we abuse terminology slightly and use the term quantaleu to describe any residuated, partially ordered semigroup. This admits instances of hoops and triangular (co)-norms.There are several additional properties that apply when the poset structure is lattice-ordered (i.e. a residuated lattice) or when the semigroup is a monoid or semiring. See the associated  Properties module.  !"  !"Safe 47=?@AXkC $rings Monoid under (. Analogous to   , but uses the ' constraint, rather than .'rings@Right pre-semirings and (non-unital and unital) right semirings.HA right pre-semiring (sometimes referred to as a bisemigroup) is a type R endowed with two associative binary (i.e. semigroup) operations: (<>) and (><), along with a right-distributivity property connecting them:  (a <> b) > c= (a c)< (b >< c)]A non-unital right semiring (sometimes referred to as a bimonoid) is a pre-semiring with a J element that is neutral with respect to both addition and multiplication.NA unital right semiring is a pre-semiring with two distinct neutral elements,  and * , such that  is right-neutral wrt addition, *, is right-neutral wrt multiplication, and + is right-annihilative wrt multiplication.  Note that * needn't be distinct from .>Instances also need not be commutative nor left-distributive. CSee the properties module for a detailed specification of the laws.,ringsHFold over a collection using the multiplicative operation of a semiring. , f "a   ((><) . f) * D(foldMap . product) id [[1, 2], [3, (4 :: Int)]] -- 1 >< 2 <> 3 >< 414D(product . foldMap) id [[1, 2], [3, (4 :: Int)]] -- 1 <> 2 >< 3 <> 421KFor semirings without a distinct multiplicative unit this is equivalent to  const mempty:product Just [1..(5 :: Int)]Just 0.In this situation you most likely want to use -.-ringsRFold over a non-empty collection using the multiplicative operation of a semiring.TAs the collection is non-empty this does not require a distinct multiplicative unit:$product1 Just $ 1 :| [2..(5 :: Int)]Just 120.ringsCross-multiply two collections.cross [1,2,3 ::Int] [1,2,3]36cross [1,2,3 ::Int] []00rings-Fold with no additive or multiplicative unit.1rings!Fold with no multiplicative unit.2rings*Fold with additive & multiplicative units.?This function will zero out if there is no multiplicative unit.3ringsA generalization of  to an arbitrary .  Adapted from  Jhttp://augustss.blogspot.com/2008/07/lost-and-found-if-i-write-108-in.html.Trings1'First a' forms a pre-semiring for any semigroup a.=foldMap1 First $ 1 :| [2..(5 :: Int)] >< 1 :| [2..(5 :: Int)]First {getFirst = 1}%product1 First $ 1 :| [2..(5 :: Int)]First {getFirst = 15}?foldMap1 First $ Nothing :| [Just (5 :: Int), Just 6, Nothing]First {getFirst = Nothing}?product1 First $ Nothing :| [Just (5 :: Int), Just 6, Nothing]First {getFirst = Just 11}$%&')(*+,-./0123456')(*+,-./0123456$%&58Safe=?@AXkE_a`_a`Safe ,=?@ASXkJgringsgV is isomorphic to 'Maybe Ordering' and (Bool,Bool), but has a distinct poset ordering: k >= j >= h and  k >= i >= h  Note that j and i are not comparable. j* can be regarded as representing (0, +"], i as representing ["", 0), k% as representing ["", +"] v NaN, and h as representing the set {0}.bcdefgkjihlmnopgkjihldefmnbcopSafe ,=?@AXkK Safe =?@AXkNrings! \forall a \in R: (z + a) \sim a AA (pre-)semiring with a right-neutral additive unit must satisfy: neutral_addition  ~~ const True Or, equivalently:   r ~~ r This is a required property.rings! \forall a \in R: (o * a) \sim a GA (pre-)semiring with a right-neutral multiplicative unit must satisfy: neutral_multiplication * ~~ const True Or, equivalently: * ( r ~~ r This is a required property.rings5 \forall a, b, c \in R: (a + b) + c \sim a + (b + c) R must right-associate addition.*This should be verified by the underlying 2 instance, but is included here for completeness.This is a required property.rings5 \forall a, b, c \in R: (a * b) * c \sim a * (b * c) R% must right-associate multiplication.This is a required property.rings; \forall a, b, c \in R: (a + b) * c \sim (a * c) + (b * c) R& must right-distribute multiplication.When R9 is a functor and the semiring structure is derived from  Alternative, this translates to:  (a <|> b)  c = (a  c) <|> (b  c) See  ?https://en.wikibooks.org/wiki/Haskell/Alternative_and_MonadPlus.This is a required property.rings* \forall a, b \in R: a * b \sim a * b + b If R is non-unital (i.e. unit is not distinct from mempty>) then it will instead satisfy a right-absorbtion property. <This follows from right-neutrality and right-distributivity.Compare codistributive and  closed_stable.When R# is also left-distributive we get: + \forall a, b \in R: a * b = a + a * b + b  See also   and  ;https://blogs.ncl.ac.uk/andreymokhov/united-monoids/#whatif.rings! \forall a \in R: (z * a) \sim u A RE is unital then its addititive unit must be right-annihilative, i.e.:  ( a ~~  For  Alternative' instances this property translates to: empty  a ~~ empty gAll right semirings must have a right-absorbative addititive unit, however note that depending on the PrdF instance this does not preclude IEEE754-mandated behavior such as:   ( NaN ~~ NaN This is a required property.rings)& must be a semiring homomorphism into R.This is a required property.rings; \forall a, b, c \in R: b + a \sim c + a \Rightarrow b = c If R1 is right-cancellative wrt addition then for all a the section (a <>) is injective.rings; \forall a, b, c \in R: b * a \sim c * a \Rightarrow b = c If R7 is right-cancellative wrt multiplication then for all a the section (a ><) is injective.rings& \forall a, b \in R: a + b \sim b + a rings& \forall a, b \in R: a * b \sim b * a rings\ \forall M \geq 0; a_1 \dots a_M, b \in R: (\sum_{i=1}^M a_i) * b \sim \sum_{i=1}^M a_i * b R: must right-distribute multiplication between finite sums.2For types with exact arithmetic this follows from  distributive & neutral_multiplication.rings\ \forall M \geq 1; a_1 \dots a_M, b \in R: (\sum_{i=1}^M a_i) * b \sim \sum_{i=1}^M a_i * b RC must right-distribute multiplication over finite (non-empty) sums.2For types with exact arithmetic this follows from  distributive and the universality of .rings \forall M,N \geq 0; a_1 \dots a_M, b_1 \dots b_N \in R: (\sum_{i=1}^M a_i) * (\sum_{j=1}^N b_j) \sim \sum_{i=1 j=1}^{i=M j=N} a_i * b_j If RA is also left-distributive then it supports cross-multiplication.rings \forall M,N \geq 1; a_1 \dots a_M, b_1 \dots b_N \in R: (\sum_{i=1}^M a_i) * (\sum_{j=1}^N b_j) = \sum_{i=1 j=1}^{i=M j=N} a_i * b_j If RM is also left-distributive then it supports (non-empty) cross-multiplication. Safe =?@AXk]rings \forall a \in R: (z + a) = a AA (pre-)semiring with a right-neutral additive unit must satisfy:   ~~ const True Or, equivalently:   r ~~ r This is a required property.rings \forall a \in R: (o * a) = a GA (pre-)semiring with a right-neutral multiplicative unit must satisfy:  * ~~ const True Or, equivalently: * ( r ~~ r This is a required property.rings2 \forall a, b, c \in R: (a + b) + c = a + (b + c) R must right-associate addition.*This should be verified by the underlying 2 instance, but is included here for completeness.This is a required property.rings2 \forall a, b, c \in R: (a * b) * c = a * (b * c) R% must right-associate multiplication.This is a required property.rings8 \forall a, b, c \in R: (a + b) * c = (a * c) + (b * c) R& must right-distribute multiplication.When R9 is a functor and the semiring structure is derived from  Alternative, this translates to:  (a <|> b)  c = (a  c) <|> (b  c) See  ?https://en.wikibooks.org/wiki/Haskell/Alternative_and_MonadPlus.This is a required property.rings' \forall a, b \in R: a * b = a * b + b If R is non-unital (i.e. unit equals mempty>) then it will instead satisfy a right-absorbtion property. <This follows from right-neutrality and right-distributivity.Compare  and  closed_stable.When R# is also left-distributive we get: + \forall a, b \in R: a * b = a + a * b + b  See also   and  ;https://blogs.ncl.ac.uk/andreymokhov/united-monoids/#whatif.rings \forall a \in R: (z * a) = u A RE is unital then its addititive unit must be right-annihilative, i.e.:  ( a ~~  For  Alternative' instances this property translates to: empty  a ~~ empty gAll right semirings must have a right-absorbative addititive unit, however note that depending on the F instance this does not preclude IEEE754-mandated behavior such as:   ( NaN ~~ NaN This is a required property.rings8 \forall a, b, c \in R: b + a = c + a \Rightarrow b = c If R1 is right-cancellative wrt addition then for all a the section (a <>) is injective.rings8 \forall a, b, c \in R: b * a = c * a \Rightarrow b = c If R7 is right-cancellative wrt multiplication then for all a the section (a ><) is injective.rings# \forall a, b \in R: a + b = b + a rings# \forall a, b \in R: a * b = b * a rings# \forall a, b \in R: a * b + b = b BRight-additive absorbativity is a generalized form of idempotency:  * a ~~ a <> a ~~ a rings# \forall a, b \in R: b + b * a = b ALeft-additive absorbativity is a generalized form of idempotency:  * a ~~ a <> a ~~ a rings% \forall a, b \in R: (a + b) * b = b HRight-mulitplicative absorbativity is a generalized form of idempotency:   a ~~ a ( a ~~ a See  ,https://en.wikipedia.org/wiki/Absorption_law.rings% \forall a, b \in R: b * (b + a) = b GLeft-mulitplicative absorbativity is a generalized form of idempotency:   a ~~ a ( a ~~ a See  ,https://en.wikipedia.org/wiki/Absorption_law.rings \forall a \in R: o + a = o LA unital semiring with a right-annihilative muliplicative unit must satisfy: * <> a ~~ * "For a dioid this is equivalent to: (* ) ~~ (* ) For  Alternative/ instances this is known as the left-catch law:  a <|> _ ~~  a rings \forall a \in R: a + o = o KA unital semiring with a left-annihilative muliplicative unit must satisfy: a  * ~~ * Note that the left-annihilative property is too strong for many instances. This is because it requires that any effects that r generates be undunit.See  0https://winterkoninkje.dreamwidth.org/90905.html.rings= \forall a, b, c \in R: c + (a * b) \equiv (c + a) * (c + b) LA right-codistributive semiring has a right-annihilative muliplicative unit:   * a  ~~ * ~~ *  aidempotent mulitiplication:     a ~~ a ~~ a ( aand idempotent addition:   a  a ~~ a ~~ a  aFurthermore if R8 is commutative then it is a right-distributive lattice.rings& is a preordered relation relative to .This is a required property.rings" is a minimal or least element of r.This is a required property.rings4( forall a, b, c: b leq c Rightarrow b + a leq c + aDIn an ordered semiring this follows directly from the definition of .Compare .This is a required property.rings8 \forall a, b: a + b = 0 \Rightarrow a = 0 \wedge b = 0 This is a required property.rings4( forall a, b, c: b leq c Rightarrow b * a leq c * a2In an ordered semiring this follows directly from  and the definition of .Compare .This is a required property.rings# is consistent with annihilativity.NThis means that a dioid with an annihilative multiplicative unit must satisfy: (one <~) "a (one ==) rings+( forall a, b: a leq b Rightarrow a + b = brings6 \forall a, b: a * b = 0 \Rightarrow a = 0 \vee b = 0  !"#$%&'()*+,-./01234566789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrrsstuvwxyz{|}~ "rings-0.0.2-91gqTfkHd6eHi7XN2LZj9eData.Dioid.Interval Data.GroupData.Semigroup.OrphanData.Semigroup.Quantale Data.Semiring Data.RingData.Dioid.Signed Data.DioidData.Semiring.PropertyData.Dioid.Property Data.MonoidProductDatafoldr' Data.List replicateWarningInterval...endpts singletonupsetdnsetempty $fPrdInterval $fEqInterval$fShowIntervalGroupnegate<<$fMonoidNatural$fSemigroupNatural$fMonoidComplex$fSemigroupComplex $fMonoidFloat$fSemigroupFloat $fMonoidBool$fSemigroupBool $fMonoidInt$fSemigroupInt $fMonoidWord$fSemigroupWordQuantaleresidrresidl\\// residuatedlower'upper'incBydecBy$fQuantaleFloatProdgetProdSemiring>< fromBooleanunitfromBooleanDefproductproduct1crosscross1foldPresemiring foldNonunital foldUnital replicate'^powers$fSemiringIntMap $fSemiringMap $fSemiringSeq $fSemiringSet$fSemiringComparison$fSemiringEquivalence$fSemiringPredicate $fSemiringIO $fSemiringAll $fSemiringAny$fSemiringIdentity$fSemiringConst$fSemiringDual$fSemiringMaybe $fSemiring[] $fSemiring(,) $fSemiringOp $fSemiring->$fSemiringWord $fSemiringInt$fSemiringNatural$fSemiringBool$fSemiringOrdering $fSemiring()$fSemiringNonEmpty$fSemiringEither $fSemiringMin $fSemiringMax$fSemiringLast$fSemiringFirst $fMonoidProd$fSemigroupProd$fApplicativeProd$fEqProd $fOrdProd $fShowProd $fBoundedProd $fGenericProd$fGeneric1Prod $fFunctorProdRingabssignumUnsignedSignedunSignedSignZeroNegativePositive IndeterminatesignOff32sgnugnsgnunsignedltugn $fBoundedSign $fMaxSign $fMinSign $fPrdSign$fSemiringSign $fMonoidSign$fSemigroupSign $fPrdSigned $fEqSigned $fShowSigned$fQuantaleUnsigned$fSemiringUnsigned$fMonoidUnsigned$fSemigroupUnsigned$fLatticeUnsigned $fMaxUnsigned $fMinUnsigned $fPrdUnsigned $fEqUnsigned$fShowUnsigned $fShowSign$fEqSignDioidneutral_addition_onneutral_addition_on'neutral_multiplication_onneutral_multiplication_on'associative_addition_onassociative_multiplication_ondistributive_on nonunital_onannihilative_multiplication_onhomomorphism_booleancancellative_addition_oncancellative_multiplication_oncommutative_addition_oncommutative_multiplication_ondistributive_finite_ondistributive_finite1_ondistributive_cross_ondistributive_cross1_onneutral_additionneutral_addition'neutral_multiplicationneutral_multiplication'associative_additionassociative_multiplication distributive nonunitalannihilative_multiplicationcancellative_additioncancellative_multiplicationcommutative_additioncommutative_multiplicationabsorbative_additionidempotent_additionabsorbative_addition'absorbative_multiplicationabsorbative_multiplication'annihilative_additionannihilative_addition'codistributiveordered_preorderedordered_monotone_zeroordered_monotone_additionordered_positive_additionordered_monotone_multiplicationordered_annihilative_unitordered_idempotent_additionordered_positive_multiplicationbaseGHC.BaseMonoidGHC.NumNummempty<> Semigroup*>*semigroupoids-5.3.3-EESwn4HgBKpKioxEXkvG0jData.Semigroup.Foldable.Classfold1(connections-0.0.2-3bGTwkYWIphGQUrhB8xvK6Data.PrdPrd<~~~pure