K/      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-. None %&IOQRT mn defines basic components to build generators, allowing the implementation to remain abstract over both the / type and 0 instances.For the latter, the wrapper - is provided to avoid overlapping instances.DCalled for every constructor. Counter for ceiled rejection sampling.doubleR upperBound: generates values in [0, upperBound].integerR upperBound: generates values in [0, upperBound-1].Default Int generator.Default Double generator.Default Char generator. ,Internal transformer for rejection sampling. 'ReaderT Size (StateT Size (MaybeT m)) a #Size as the number of constructors.Main constructor for .Main constructor for . 0coerceAlias :: Alias m -> Alias (AMonadRandom m) 6coerceAliases :: [Alias m] -> [Alias (AMonadRandom m)] composeCast f g = f . g!Set lower bound*Dummy instance for debugging.+Dummy instance for debugging.,  !"#$%&'()*+"  !,+* )('&! %$#"    !"#$%&'()*+None !":DORT6 Assuming p . f9 is satisfied only for positive values in some interval (0, r], find f r./0123456/0123456/0123456/0123456None*,29:;<=BDIQRT :For convenience.;A ListBaseCases n (1 a); constraint basically provides the list of values of type a with depth at most n.A SuccessorCZeroMGeneric ArbitraryX6A binary constructor for building up trees of weights.ZrType of a single weight, tagged with the name of the associated constructor for additional compile-time checking. e ((9 :: Z "Leaf") X (8 :: Z "Node") X ()) \2Trees of weights assigned to constructors of type a1, rescaled to obtain a probability distribution.Two ways of constructing them. e (x1 X x2 X ... X xn X ()) :: \ a f :: \ a Using weightsC, there must be exactly as many weights as there are constructors.f is equivalent to e (1 X ... X 1 X ())3 (automatically fills out the right number of 1s).cOPick a constructor with a given distribution, and fill its fields recursively.dLike d?, with bounded size to ensure termination for recursive types.e5A smart constructor to specify a custom distribution.fUniform distribution.I:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcd%List of weights for every constructorefghijklmnopqrstuvwxyz{|}~0:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghiIcdb`a^_\]Z[efYVWXTUQRSPOgMN~}|{zhiKLyxIJwvutHEFGCDAB?@sr=>qp;<:onmlkj6:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~X1Safepartitions k n+: lists of non-negative integers of length n! with sum less than or equal to k.Binomial coefficient. Abinomial n k == factorial n `div` (factorial k * factorial (n-k))Multinomial coefficient. Emultinomial n ps == factorial n `div` product [factorial p | p <- ps]None !"%&05:OTMaps a key representing a type a+ (or one of its pointings) to a generator m a.?An oracle gives the values of the generating functions at some x.Type of ."The type of the first argument of 2.A pair C i k represents the k$-th "pointing" of the type at index i, with generating function  C_i[k](x)._We build a dictionary which reifies type information in order to create a Boltzmann generator. We denote by n (or () the number of types in the dictionary.Every type has an index  0 <= i < n; the variable X i% represents its generating function C_i(x), and  X (i + k*n) the GF of its k-th "pointing"  C_i[k](x) ; we have 4 C_i[0](x) = C_i(x) C_i[k+1](x) = x * C_i[k]'(x) where C_i[k]' is the derivative of C_i[k] . See also .The order (or  valuationP) of a power series is the index of the first non-zero coefficient, called the leading coefficient.Number of registered types-Number of iterations of the pointing operatorMap from types to indices!Inverse map from indices to typesInverse map to aliases.Structure of types and their pointings (up to , initially 0)iPrimitive types and empty types are mapped to an empty constructor list, and can be distinguished using 3 on the  associated to it by .=The integer is a multiplicity which can be > 1 for pointings. Leading term  a * x ^ u of the generating functions  C_i[k](x) in the form (u, a). Order u)Smallest size of objects of a given type.Leading coefficient a#number of objects of smallest size.`Degrees of the generating functions, when applicable: greatest size of objects of a given type.@Find all types that may be types of subterms of a value of type a.7This will loop if there are infinitely many such types.Primitive datatypes have C(x) = x2: they are considered as having a single object (lCoef ) of size 1 (order)).*Traversal of the definition of a datatype.If (u, a)+ represents a power series of leading term  a * x ^ u, and similarly for (u', a')+, this finds the leading term of their sum.The comparison of ' is unrolled here for maximum laziness.Sum of a list of series.$Leading term of a product of series.Pointing operator. Populates a % with one more level of pointings. (# produces a dictionary at level 0.)The "pointing" of a type t@ is a derived type whose values are essentially values of type t, with one of their constructors being "pointed". Alternatively, we may turn every constructor into variants that indicate the position of points.  -- Original type data Tree = Node Tree Tree | Leaf -- Pointing of Tree data Tree' = Tree' Tree -- Point at the root | Node'0 Tree' Tree -- Point to the left | Node'1 Tree Tree' -- Point to the right -- Pointing of the pointing -- Notice that the "points" introduced by both applications of pointing -- are considered different: exchanging their positions (when different) -- produces a different tree. data Tree'' = Tree'' Tree' -- Point 2 at the root, the inner Tree' places point 1 | Node'0'B Tree' Tree -- Point 1 at the root, point 2 to the left | Node'1'C Tree Tree' -- Point 1 at the root, point 2 to the right | Node'0'60 Tree'' Tree -- Points 1 and 2 to the left | Node'0'E1 Tree' Tree' -- Point 1 to the left, point 2 to the right | Node'1'E0 Tree' Tree' -- Point 1 to the right, point 2 to the left | Node'0'-1 Tree Tree'' -- Points 1 and 2 to the right If we ignore points, some constructors are equivalent. Thus we may simply calculate their multiplicity instead of duplicating them.Given a constructor with c arguments  C x_1 ... x_c, and a sequence p_0 + p_1 + ... + p_c = k$ corresponding to a distribution of k points (p_0! are assigned to the constructor C itself, and for i > 0, p_i! points are assigned within the iq-th subterm), the multiplicity of the constructor paired with that distribution is the multinomial coefficient multinomial k [p_1, ..., p_c].Find the value of x6 such that the average size of the generator for the k-1-th pointing is equal to size5, and produce the associated oracle. If the size is Nothing!, find the radius of convergence.AThe search evaluates the generating functions for some values of x in order to run a binary search. The evaluator is implemented using Newton's method, the convergence of which has been shown for relevant systems in *Boltzmann Oracle for Combinatorial Systems#, C. Pivoteau, B. Salvy, M. Soria./Generating function definition. This defines a Phi_i[k] function associated with the k"-th pointing of the type at index i , such that: iC_i[k](x) = Phi_i[k](x, C_0[0](x), ..., C_(n-1)[0](x), ..., C_0[k](x), ..., C_(n-1)[k](x))Primitive datatypes have C(x) = x2: they are considered as having a single object (lCoef ) of size 1 (order)).&Build all involved generators at once.&Generators of values of minimal sizes. dd ? (listCs dd !! i) = i dd ? (dd ?! i) = i<8<. None!"22The size of a value is its number of constructors.Here, however, the d type is interpreted differently to make better use of QuickCheck's size parameter provided by the  S combinator, so that we generate non-trivial data even at very small size values.4For infinite types, with objects of unbounded sizes  > minSize, given a parameter  delta :: 5, the produced values have an average size close to minSize + delta.For example, values of type Either () [Bool]$ have at least two constructors, so   generator delta :: Gen (Either () [Bool]) will target sizes close to  2 + delta); the offset becomes less noticeable as delta grows to infinity.For finite types with sizes in [minSize, maxSize]6, the target expected size is obtained by clamping a  to [0, 99]! and applying an affine mapping.Number of pointing iterations.Sized generator.For documentation. 'epsilon' = 0.1Default approximation ratio. ,(size * (1 - epsilon), size * (1 + epsilon)) None:;=ABCDXZ\cdefcd\ZeXfCDAB:=;None    :: Int -> Gen a   .  ::  MonadRandom m => Int -> m a "Singular ceiled rejection sampler.   :: Int -> Gen a   .  ::  MonadRandom m => Int -> m a Generator of pointed values.!Pointed generator with rejection.2Generator with rejection and dynamic average size.Pointed generator.!Pointed generator with rejection.1Ceiled rejection sampler with given average size.-Basic boltzmann sampler with no optimization.$Boltzmann sampler without rejection.!Boltzmann sampler with rejection.' ' None!"%&0259:;<=DORT4 defines a product, 5B defines an addition, with scalar multiplication we get a module.QThis typeclass allows to directly tweak weights in the oracle by chosen factors.Scalar embedding.Scalar multiplication.!A natural transformation between f and m?,      Index of typePoints#Expected size (or singular sampler) Index of typePoints#Expected size (or singular sampler) !"#$%&'()*+,-     ,     -,+*)('&%$#"!       !"#$%&'()*+,-36   !"#$%&'()*+,-./01234567789:;<=>?@ABCDEFFGGHHIIJKLMNOPQRSTTUVWXYZ[\\]]^^_`abcdefghijklmnopqrstuvwxyz{|}~FF     qr !"#$%&'%()%(*%+,%+-.-generic-random-0.4.0.0-EwQsnUrYW7vHKObHIMu82SGeneric.Random.Internal.TypesGeneric.Random.Internal.SolverGeneric.Random.Internal.GenericGeneric.Random.Internal.CommonGeneric.Random.Internal.OracleGeneric.Random.Internal.DataGeneric.Random.DataGeneric.Random.BoltzmannTest.QuickChecksizedGeneric.Random.GenericMonadRandomLikeincrdoubleRintegerRintdoublechar AMonadRandom asMonadRandomRejectT unRejectTSizeAliasRAlias SomeData'SomeDataaliasaliasR coerceAlias coerceAliases composeCastMcastM unSomeData applyCast castError withProxyreproxy proxyType someData' runRejectT$fMonadRandomLikeAMonadRandom$fMonadRandomLikeRejectT$fMonadRandomLikeGen$fMonadTransAMonadRandom$fMonadTransRejectT$fMonadRejectT$fApplicativeRejectT$fFunctorRejectT $fShowAlias$fShowSomeData$fFunctorAMonadRandom$fApplicativeAMonadRandom$fMonadAMonadRandom SolveArgsaccuracy numIterations defSolveArgsfindZero fixedPointsearch $fEqSolveArgs$fOrdSolveArgs$fShowSolveArgs BaseCases' ListBaseCases listBaseCases BaseCases baseCasesWeightedSZTaggedunTaggedArity GAProduct gaProductGASumgaSumGAgaUnsizedSizedGen'unGen' UniformWeight uniformWeight WeightBuilderPrec%FirstWWeightsL:|NWeights_genericArbitrarygenericArbitrary'weightsuniformsized'gArbitrarySinglegaSum'$fListBaseCasesn:*:$fListBaseCasesn:+:$fListBaseCasesSK1$fListBaseCasesZK1$fListBaseCasesnM1$fListBaseCasesnU1$fBaseCasesnM1$fBaseCasesn:+:$fAlternativeWeighted$fApplicativeWeighted$fGAProduct:*: $fGAProductM1 $fGAProductK1 $fGAProductU1$fGASumsizedM1$fGASumsized:+:$fGAUnsized:+: $fGASized:+: $fGASizedM1 $fGAUnsizedM1 $fGAsizedM1$fUniformWeightL$fUniformWeight:|$fWeightBuilderL$fWeightBuilder:|$fNumW $fFunctorGen'$fApplicativeGen' $fMonadGen'$fFunctorTagged$fFunctorWeighted frequencyWith partitionsbinomial multinomialSmallGenerators GeneratorsOracleAMapGUnfoldNatZeroSuccIxAliasedC'ACCDataDefcountpointsindexxednixedni'typeslTermdegreenatToIntinfinitydataDef collectTypes primOrder primOrder' primlCoef collectTypesM chaseType traverseType traverseType'lPluslSumlMullProd maxDegreepoint makeOraclephimakeGeneratorssmallGeneratorsgeneratedefGen?listCsix?! getGeneratorgetSmallGenerator#! $fMonoidNat$fHashableAliased $fHashableAC $fHashableC $fEqAliased $fOrdAliased $fShowAliased$fGenericAliased$fEqAC$fOrdAC$fShowAC $fGenericAC$fEqC$fOrdC$fShowC $fGenericC$fEqNat$fOrdNat $fShowNat $fShowDataDefSize'PointsSGminSizemaxSizeMrunSG runSmallGrangeSGapplySGmakemakeRrescaleapplyapplyRrescaleIntervalepsilon tolerancememo sparseSized $fFunctorSG generatorSR generatorP generatorPR generatorR generatorP' generatorPR' generatorR' generator'generatorSRWithgeneratorPRWithgeneratorPWithgeneratorRWithgeneratorPWith'generatorPRWith'generatorRWith'generatorWith' generatorM generatorMR generator_ generatorR_ Pointiful ConstModule unConstModuleSystemdimsys'EndoModuleScalarscalar<.>EmbedemapembedsyssolvesizedGenerator solveSizedweighted runWeightedsfix unPointiful$fModulePointiful$fAlternativePointiful$fApplicativePointiful$fEmbedPointifulm$fFunctorPointiful$fModuleWeighted$fEmbedWeightedm$fModuleConstModule$fAlternativeConstModule$fApplicativeConstModule$fEmbedConstModulem$fFunctorConstModule$fFunctorSystem'QuickCheck-2.9.2-3a8nWdLsV8cEn9LdMoftRmTest.QuickCheck.GenGen&MonadRandom-0.5-InYiOZYIbHv2TCJHvMGquiControl.Monad.Random.Class MonadRandombase GHC.GenericsRep Data.Datagunfold dataTypeRepGHC.Base Applicative Alternative