#]!Gs      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqr None .7=?HMVXk"/ laopConstrained category instancelaopPowerset data type.WThis data type is a newtype wrapper around '[]'. This exists in order to implement an s and t1 instance that cannot be harmful for the outside.laopWrapper around u@s that have a restrictive semantic associated. A value of type  n m$ can only be instanciated with some u i that's  n <= i <= m.laop<Natural constructor function. Throws a runtime error if the u* value is greater than the corresponding m or lower than n in the  n m type. laop(Auxiliary function that promotes binary u functions to  binary functions. laop2Auxiliary function that promotes ternary (binary) u functions to  functions. laop2Auxiliary function that promotes ternary (binary) u functions to  functions.laop Optimized s= instance for tuples that comply with the given constraints.laopIThrows a runtime error if any of the operations overflows or underflows.   (c) Armando Santos 2019-2020armandoifsantos@gmail.com experimentalNone#   (c) Armando Santos 2019-2020armandoifsantos@gmail.com experimentalNone&',./1=>?@AHUVXkmlV>laopType class for defining the fromList conversion function.Given that it is not possible to branch on types at the term level type classes are needed very much like an inductive definition but on types.laopiBuild a matrix out of a list of list of elements. Throws a runtime error if the dimensions do not match.&laopDConstraint type synonyms to keep the type signatures less convoluted'laopIType family that normalizes the representation of a given data structure(laopHType family that computes of a given type dimension from a given natural4Thanks to Li-Yao Xia this type family is super fast.)laopDType family that computes the cardinality of a given type dimension.FIt can also count the cardinality of custom types that implement the v instance.*laopALAoP (Linear Algebra of Programming) Inductive Matrix definition./laopEmpty matrix constructor0laopUnit matrix constructor1laopMatrix - constructor2laopMatrix - constructor3laopMatrix . constructor4laopMatrix . constructor5laopoMatrix builder function. Constructs a matrix provided with a construction function that operates with indices.6laopwMatrix builder function. Constructs a matrix provided with a construction function that operates with arbitrary types.7laop!Constructs a column vector matrix8laopConstructs a row vector matrix9laop6Lifts functions to matrices with arbitrary dimensions.ONOTE: Be careful to not ask for a matrix bigger than the cardinality of types a or b allows.:laop5Lifts functions to matrices with dimensions matching a and b cardinality's.;laop1Converts a matrix to a list of lists of elements.<laop(Converts a matrix to a list of elements.=laop3The zero matrix. A matrix wholly filled with zeros.>laop2The ones matrix. A matrix wholly filled with ones.Also known as T (Top) matrix.?laopLThe constant matrix constructor. A matrix wholly filled with a given value.@laopThe T (Top) row vector matrix.Alaop iden matrix.Blaop?Matrix composition. Equivalent to matrix-matrix multiplication.QThis definition takes advantage of divide-and-conquer and fusion laws from LAoP.Claop"Scalar multiplication of matrices.Dlaop"Scalar multiplication of matrices.Elaop$Biproduct first component projectionFlaop%Biproduct second component projectionGlaop#Biproduct first component injectionHlaop$Biproduct second component injectionIlaopObtain the number of rows. NOTE: The wI constaint is needed in order to obtain the dimensions in constant time.TODO: A I! function that does not need the w) constraint in exchange for performance.JlaopObtain the number of columns. NOTE: The wI constaint is needed in order to obtain the dimensions in constant time.TODO: A J! function that does not need the w) constraint in exchange for performance.Klaop9Matrix coproduct functor also known as matrix direct sum.Llaop5Khatri Rao product first component projection matrix.Mlaop6Khatri Rao product second component projection matrix.Nlaop7Khatri Rao Matrix product also known as matrix pairing.DNOTE: That this is not a true categorical product, see for instance: M | fstM . kr a b == a kr a b ==> | | sndM . kr a b == b Emphasis on the implication symbol.Olaop6Matrix product functor also known as kronecker productPlaopMatrix "abiding" following the --. exchange law.Law: - (. a c) (. b d) == . (- a b) (- c d) QlaopMatrix "abiding" followin the .-- abide law. . (- a b) (- c d) == - (. a c) (. b d) RlaopMatrix transposition.SlaopSelective functors SQ operator equivalent inspired by the ArrowMonad solution presented in the paper.Ulaop6McCarthy's Conditional expresses probabilistic choice.VlaopMatrix pretty printerWlaopMatrix pretty printerXlaop-Zip two matrices with a given binary functionYlaopHelper conversion functionZlaopHelper conversion function[laopRelational negation\laopRelational addition]laopRelational multiplication^laopRelational subtraction_laopMatrix relational composition.`laop Matrix relational right divisionalaopMatrix relational left divisionblaop$Matrix relational symmetric divisionclaop7Lifts functions to relations with arbitrary dimensions.QNOTE: Be careful to not ask for a relation bigger than the cardinality of types a or b allows.dlaop6Lifts functions to relations with dimensions matching a and b cardinality's.elaop-Lifts a relation function to a Boolean MatrixqlaopNIt is possible to implement a constrained version of the category type class.H !"#$%&'()*,+-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdeH*,+-.&$%#"! /013()';<6587=>@?JIRCDSTUPQX4EF2GHKOLMNAB9:VWYZ_`abdce[\]^2342C7D7K5O4(c) Armando Santos 2019-2020armandoifsantos@gmail.com experimentalNone&',.1;<>HVXksUzlaopDConstraint type synonyms to keep the type signatures less convoluted{laopRelation data type.}laop6Boolean type synonym for working with boolean matrices~laopEmpty matrix constructorlaopUnit matrix constructorlaopBoolean Matrix Join1 constructor, also known as relational coproduct.See .laopBoolean Matrix Join constructorSee .laopBoolean Matrix Fork/ constructor, also known as relational product.laopBoolean Matrix Fork constructorlaopiBuild a matrix out of a list of list of elements. Throws a runtime error if the dimensions do not match.laopsRelation builder function. Constructs a relation provided with a construction function that operates with indices.laop{Relation builder function. Constructs a relation provided with a construction function that operates with arbitrary types.laop6Lifts functions to matrices with arbitrary dimensions.ONOTE: Be careful to not ask for a matrix bigger than the cardinality of types a or b allows.laop5Lifts functions to matrices with dimensions matching a and b cardinality's.laopLifts relation functions to {xlaop Lowers a { to a functionlaop1Converts a matrix to a list of lists of elements.laop(Converts a matrix to a list of elements.laopConverts a well typed { to y.laopPower transpose.)Maps a relation to a set valued function.laopBelongs relationlaop7The zero relation. A relation where no element of type a relates with elements of type b.4Also known as " (Bottom) Relation or empty Relation.  r  " == "  r == " "  R && R  T == True laop:The ones relation. A relation where every element of type a% relates with every element of type b.5Also known as T (Top) Relation or universal Relation.  "  R && R  T == True laop The T (Top) row vector relation.laopPoint constant relationlaop iden matrix   r == r == r   laopRelational composition r  (s  p) = (r  s)  p laopRelational right division x y is the largest relation z which, pre-composed with y, approximates x.laopRelational left divisionThe dual division operator:  y x ==  ( ( x) ( y) laopRelational symmetric division c b ( s r) means that b and c. are related to exactly the same outputs by r and by s.laopRelational shrinking.r  s is the largest part of r1 such that, if it yields an output for an input x), it must be a maximum, with respect to s , among all possible outputs of x by r.laopRelational overriding.r  s2 yields the relation which contains the whole of s and that part of r where s is undefined.   s == s r   == r r  r == r laopRelational application.If a and b are related by { r then  a b r ==  ( 1)laopRelational application The same as  but converts } to ylaopRelational converse Given binary { r, writing  a b r (read: b is related to a by r ) means the same as  b a ( r), where  r! is said to be the converse of r. In terms of grammar,  r! corresponds to the passive voicelaop&Relational inclusion (subset or equal)laop$Relational implication (the same as )laopRelational bi-implicationlaopRelational intersectionLifts pointwise conjointion. (r  s)  t == r  (s  t) x  r  s == x  r && x  s laopRelational unionLifts pointwise disjointion. (r  s)  t == r ` (s  t) r  s  x == r  x && s  x r  (s  t) == (r  s)  (r  t) (s  t)  r == (s  r)  (t  r) laopRelation Kernel  r ==  r  r  r ==  ( r) laopRelation Image  r == r  conv r  r ==  ( r) laop#Function division. Special case of .NOTE: _This is only valid_ if f and g are s, i.e.  and .  f g ==  g  flaopA { r is    ( r)laopA { r is    ( r)laopA { r is    ( r)laopA { r is    ( r)laopA { r is a    r &&  rA  f( enjoys the following properties, where r and s are binary relations: f  r  s == r  f  s r  f  s == r  s  f laopA { r is a    r &&  rlaopA { r is an    r &&  rlaopA { r is a    r &&  rlaopA { r is a    r &&  rlaopA { r is an    r &&  rlaopA { r is     rlaopA { r is   r  laopA { r is   (r  r)  rlaopA { r is   r ==  rlaopA { r is anti-symmetric  (r   r)  laopA { r is   (r  ) == laopA { r is   (r   r) == laopA { r is a    r &&  rlaopA { r is a partial-order   r &&  rlaopA { r is a linear-order   r &&  rlaopA { r is an    r &&  rlaopA { r is a partial-equivalence   r &&  rlaopA { r is  or regular wherever r   r  r == rlaopRelational pairing.DNOTE: That this is not a true categorical product, see for instance:  |    a b  a  a b  = | |    a b  b Emphasis on the .  r s  f ==  (r  f) (s  f) (R  S)   p q ==  (r  p) (s  q)  ( r s)   x y == ( r  x)  ( s  y)  ( r s) ( t v) ==  ( r t) ( s v) laop-Relational pairing first component projection    r s  r laop.Relational pairing second component projection    r s  s laopRelational pairing functor r  s ==  (r  fstR) (s  sndR) (r  s)  (p  q) == (r  p)  (s  q) laopRelational coproduct.  |  a b   == a  a b  = | |  a b   == b   r s   ( t u) == (r   t)  (s   u)  ( r s) ( t v) ==  ( r t) ( s v) laop.Relational coproduct first component injection      ==     =  laop/Relational coproduct second component injection      ==     =  laopRelational coproduct functor. r  s ==  (  r) (  s) laop Relational DEvery n-ary relation can be expressed as a binary relation through /U; more-over, where each particular attribute is placed (input/output) is irrelevant.laop Relational DEvery n-ary relation can be expressed as a binary relation through /U; more-over, where each particular attribute is placed (input/output) is irrelevant.laopTransforms predicate p into a correflexive relation.  (z True) ==   (z False) ==   q   p ==  q   p laopEqualizes functions f and g . That is,  f g, is the largest coreflexive that restricts g so that f and g yield the same outputs.  r r ==   ( True) ( False) ==  laopRelational conditional guard.  p =      p laop"Relational McCarthy's conditional.laopRelational domain.For injective relations,  and nel coincide, since  r   in such situations.laopRelational range.For functions,  and  (image) coincide, since  f  id for any f.laopRelation pretty printinglaopRelation pretty printinglaopNIt is possible to implement a constrained version of the category type class._'()stuvwxyz{|}~a{|}zyxwvuts~()'3245(c) Armando Santos 2019-2020armandoifsantos@gmail.com experimentalNone^'()stuvwxyz{|}~`{|}zyxwvuts~()'(c) Armando Santos 2019-2020armandoifsantos@gmail.com experimentalNone&',.;<=>?@AHSUVXk$h6laopOne type aliaslaopZero type aliaslaopDConstraint type synonyms to keep the type signatures less convolutedlaopBifunctor equivalent functionlaopEmpty matrix constructorlaopUnit matrix constructorlaopMatrix Join constructorlaopMatrix Join constructorlaopMatrix Fork constructorlaopMatrix Fork constructorlaop$Functor instance equivalent functionlaop Applicative instance equivalent unit function,laop Applicative instance equivalent unit function,laopMonad instance equivalent { function,laopMonad instance equivalent | function,laopiBuild a matrix out of a list of list of elements. Throws a runtime error if the dimensions do not match.laopoMatrix builder function. Constructs a matrix provided with a construction function that operates with indices.laopwMatrix builder function. Constructs a matrix provided with a construction function that operates with arbitrary types.laop!Constructs a column vector matrixlaopConstructs a row vector matrixlaop6Lifts functions to matrices with arbitrary dimensions.ONOTE: Be careful to not ask for a matrix bigger than the cardinality of types a or b allows.laop5Lifts functions to matrices with dimensions matching a and b cardinality's.laop*Lifts relation functions to Boolean Matrixlaop1Converts a matrix to a list of lists of elements.laop(Converts a matrix to a list of elements.laop3The zero matrix. A matrix wholly filled with zeros.laop2The ones matrix. A matrix wholly filled with ones.Also known as T (Top) matrix.laopLThe constant matrix constructor. A matrix wholly filled with a given value.laopThe T (Top) row vector matrix.laopPoint constant relationlaop iden matrixlaop?Matrix composition. Equivalent to matrix-matrix multiplication.QThis definition takes advantage of divide-and-conquer and fusion laws from LAoP.laop"Scalar multiplication of matrices.laop"Scalar multiplication of matrices.laop$Biproduct first component projectionlaop%Biproduct second component projectionlaop#Biproduct first component injectionlaop$Biproduct second component injectionlaopObtain the number of rows. NOTE: The wI constaint is needed in order to obtain the dimensions in constant time.TODO: A ! function that does not need the w) constraint in exchange for performance.laopObtain the number of columns. NOTE: The wI constaint is needed in order to obtain the dimensions in constant time.TODO: A ! function that does not need the w) constraint in exchange for performance.laop9Matrix coproduct functor also known as matrix direct sum.laop5Khatri Rao product first component projection matrix.laop6Khatri Rao product second component projection matrix. laop7Khatri Rao Matrix product also known as matrix pairing.DNOTE: That this is not a true categorical product, see for instance: N | fstM . kr a b == a kr a b ==> | | sndM . kr a b == b Emphasis on the implication symbol. laop6Matrix product functor also known as Kronecker product laopMatrix "abiding" followin the Join-Fork abide law.Law: Join (Fork a c) (Fork b d) == Fork (Join a b) (Join c d)  laopMatrix "abiding" followin the Fork-Join abide law.Law: Fork (Join a b) (Join c d) == Join (Fork a c) (Fork b d)  laopMatrix transposition.laopSelective functors selectQ operator equivalent inspired by the ArrowMonad solution presented in the paper.laop6McCarthy's Conditional expresses probabilistic choice.laopMatrix pretty printerlaopMatrix pretty printerlaop-Zip two matrices with a given binary functionlaopNIt is possible to implement a constrained version of the category type class.B'()     B()'     32775 4(c) Armando Santos 2019-2020armandoifsantos@gmail.com experimentalNone&',.;<=>?@AHSUVXk2 "laopDConstraint type synonyms to keep the type signatures less convoluted,laopoMatrix builder function. Constructs a matrix provided with a construction function that operates with indices.9laop"Scalar multiplication of matrices.:laop"Scalar multiplication of matrices.Alaop Coproduct Bifunctor (Direct sum)Blaop#Khatri Rao Product first projectionClaop$Khatri Rao Product second projectionDlaopKhatri Rao ProductElaopProduct Bifunctor (Kronecker)FlaopMatrix abide Join ForkGlaopMatrix abide Fork JoinHlaopMatrix transpositionMlaop-Zip two matrices with a given binary function9'() !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLM9#$"! %&')()'+12,.-3465@?H9:IJFGM*;<(=>AEBCD78/0KL(3*297:7A5E4None&',.;<>HSXkDXlaopDConstraint type synonyms to keep the type signatures less convolutedYlaopUType synonym for column vector matrices. This represents a probability distribution.[laop"Type synonym for probability value\laopFunctor instance]laopApplicative/Monoidal instance unit function^laopApplicative/Monoidal instance mult function_laopSelective instance function`laopRChooses which of the two given effectful functions to apply to a given argument; alaop=Branch on a Boolean value, skipping unnecessary computations.blaopMonad instance { functionclaopMonad instance | functiondlaop%Extract probabilities given an Event.elaop#Constructs a Bernoulli distributionflaop-Creates a distribution given a shape functionglaop Constructs a Linear distributionhlaop"Constructs an Uniform distributionilaop/Constructs an Negative Exponential distributionjlaop!Constructs an Normal distributionklaop Transforms a Y into a list of pairs.llaopPretty a distributionmlaopPretty Print a distributionSTUVWXYZ[\]^_`abcdefghijklmYZ[XWVUTS\]^_`abcdefghijklm (c) Armando Santos 2019-2020armandoifsantos@gmail.com experimentalNoneFSTUVWXYZ[\]^_`abcefghijklmYZ[XWVUTS\]^_`abcefghijklm SafeG}~    !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~+,-.0/1:;<=>?*DEpFGdHIKLMklmZRSV`ab7~+,-.0/15:;<=>?*@ABCDEpFGHIJKLMNOPQRSTUVWXYZ[\]`abc|}rsqt~,-.0/15:;<=>?*@BCDEFGHIJKLMNOPQRSTUVWXYZ[\]^`abc}rsqt~,-.01 laop-0.1.0.7-inplaceLAoP.Utils.InternalLAoP.Matrix.InternalLAoP.Relation.InternalLAoP.Matrix.TypeLAoP.Matrix.NatLAoP.Dist.Internal LAoP.Utils LAoP.Relation LAoP.Dist Paths_laopCategoryObjectid.ListLNaturalNatnat coerceNat coerceNat2 coerceNat3 $fEnumEither$fBoundedEither $fEnum(,) $fEnumNatural$fBoundedNatural $fNumNatural $fEnumList $fBoundedList $fCategory-> $fShowNatural $fReadNatural $fEqNatural $fOrdNatural$fNFDataNatural$fGenericNatural$fEqList $fShowList $fReadList FromLists fromListsTrivialLiftable FromListsNCountableDimensionsNCountableDimensions CountableN Countable NormalizeFromNatCountMatrixEmptyOneJoinForkemptyonejoin|||fork===matrixBuilder' matrixBuildercolrowfromF'fromFtoListstoListzerosonesconstantbangidencomp.|./p1p2i1i2rowscolumns-|-fstMsndMkr><abideJFabideFJtrselectbranchcondpretty prettyPrintzipWithMtoBoolfromBoolnegateMorMandMsubMcompReldivRdivLdivS fromFRel'fromFReltoRel $fOrdMatrix $fNumMatrix $fEqMatrix$fNFDataMatrix$fFromListseEitherEither$fFromListse()Either$fFromListse()Either0$fFromListseEither()$fFromListseEither()0$fFromListse()()$fFromListseVoidVoid$fCategoryMatrix $fShowMatrixTrivialPRelationRBooleanrelationBuilder'relationBuilderptbelongspointshrunkBy overriddenBypointAp pointApBoolconvsseimpliesiff intersectionunionkerimg divisionFsimple injectiveentire surjectivefunctionrepresentation abstraction surjection injection bijection reflexive coreflexive transitive symmetric antiSymmetric irreflexive connectedpreorder partialOrder linearOrder equivalencepartialEquivalence difunctionalsplitRfstRsndReitherRtransuntranspredR equalizerguarddomainrange $fNumRelation$fCategoryRelation$fShowRelation $fEqRelation $fOrdRelation$fNFDataRelation$fReadRelationZeroMbimapMfmapMunitMmultMreturnMbindMselectMTrivialE FromListsNz CountableNzDistDProbfmapDunitDmultDselectDbranchDifDreturnDbindD??chooseshapelinearuniformnegExpnormaltoValues prettyDistprettyPrintDist $fShowDist $fNumDist$fEqDist $fOrdDist $fNFDataDistbaseGHC.EnumEnumBoundedghc-prim GHC.TypesInt GHC.GenericsGeneric GHC.TypeNatsKnownNatfromRelBoolGHC.Baseconstreturn>>=version getBinDir getLibDir getDynLibDir getDataDir getLibexecDir getSysconfDirgetDataFileName