h%?:      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~                                                          Safe-Inferred /0Dprob-fxThe integer index of x in xsprob-fx Proof that x& is an element of the type-level list xsNone()/0 prob-fx%Check whether an observable variable x is unique in model environment env prob-fxFor each observable variable x in xs, construct the constraint Observable env x a prob-fxSpecifies that an environment Env env has an observable variable x# whose observed values are of type a prob-fx,Retrieve the type of an observable variable x from an environment envprob-fxAssign or associate a variable x with a value of type aprob-fxA model environment assigning traces (lists) of observed values to observable variables i.e. the type Env ((x := a) : env) indicates x" is assigned a value of type [a].prob-fx#Containers for observable variablesprob-fxConvert an observable variable from a type-level string to a value-level stringprob-fxEmpty model environmentprob-fx4Prepend a variable assignment to a model environmentprob-fxAllows the syntax #x( to be automatically lifted to the type  ObsVar "x".   5None()0 ~prob-fx2Safely inject and project a value into an open sum!prob-fxOpen sum of value types !"!" None'()0 M)prob-fxMembership of an effect e in es*prob-fxInject an operation of type e x into an effect sum+prob-fx(Attempt to project an operation of type e x out from an effect sum,prob-fx$An open sum for an effect signature es, containing an operation e x where e is in es-prob-fx'A program that returns a value of type a9 and can call operations that belong to some effect e in signature es; this represents a syntax tree whose nodes are operations and leaves are pure values.0prob-fxRun a pure computation1prob-fxCall an operation of type e x in a computation2prob-fxDischarges an effect e' from the front of an effect signature es.prob-fx pure value/prob-fx&operation belonging to some effect in esprob-fx-continuation from the result of the operation )+*,-/.012 -/.,)+*012None ()08prob-fxThe state effect9prob-fxGet the current state:prob-fxSet the current state;prob-fxWrapper function for Get<prob-fxWrapper function for Put=prob-fx2Wrapper function for apply a function to the state>prob-fx Handle the State s effect>prob-fx initial stateprob-fx(output, final state)89:;<=>89:;<=>None()0?prob-fxLift a monadic computation m a into the effect Lift mAprob-fxWrapper function for calling LiftBprob-fxHandle Lift m as the last effect?@AB?@ABNoneCprob-fxSampler type, for running IO computations alongside a random number generatorDprob-fxLift an IO computation into SamplerEprob-fxTakes a Sampler>, provides it a random generator, and runs the sampler in the IO contextFprob-fxTakes a Sampler=, provides it a fixed generator, and runs the sampler in the IO contextGprob-fx=Takes a distribution which awaits a generator, and returns a Sampler Iprob-fxlocationprob-fxscaleJprob-fxmeanprob-fxstandard deviationKprob-fx lower-boundprob-fx upper-boundLprob-fx lower-boundprob-fx upper-boundMprob-fxshape kprob-fxscale Nprob-fxshape prob-fxshape Oprob-fxprobability of TruePprob-fxnumber of trialsprob-fxprobability of successful trialQprob-fx probabilitiesRprob-fx probabilitiesSprob-fxrate Tprob-fxconcentrationsCDEFGHIJKLMNOPQRSTCDEFGHIJKLMNOPQRST Safe-InferredHXprob-fxReturn True for 1 and otherwise FalseYprob-fx+Safely attempt to return the head of a listZprob-fxReturn the tail of a list, behaving as the identity function upon an empty list[prob-fx:Return all the positions that a value occurs within a listXYZ[XYZ[ None '()0r\prob-fx0For erasing the types of primitive distributions^prob-fx Proof that x is a primitive value`prob-fxAn ad-hoc specification of primitive value types, for constraining the outputs of distributionsaprob-fxPrimitive distributionqprob-fx%For pattern-matching on an arbitrary PrimDist/ with proof that it generates a primitive valuerprob-fx2Draw a value from a primitive distribution in the Sampler monadsprob-fxCompute the density of a primitive distribution generating an observed valuetprob-fxCompute the log density of a primitive distribution generating an observed valuebprob-fxprobability of Truecprob-fxshape prob-fxshape dprob-fxnumber of trialsprob-fxprobability of successful trialeprob-fx#values and associated probabilitiesfprob-fxlocationprob-fxscalegprob-fxscalehprob-fxvalue of probability 1iprob-fxconcentrationsjprob-fxlist of n probabilitiesprob-fxan index from 0 to n - 1kprob-fx lower-bound aprob-fx upper-bound blprob-fxshape kprob-fxscale mprob-fxmeanprob-fxstandard deviationnprob-fxstandard deviationoprob-fxrate pprob-fx lower-bound aprob-fx upper-bound bsprob-fx distributionprob-fxobserved valueprob-fxdensitytprob-fx distributionprob-fxobserved valueprob-fx log density\]^_`apkbcdefghijlmnoqrstapkbcdefghijlmno`^_q\]rst None '()0 xprob-fx The effect Observe) for conditioning against observed valueszprob-fx The effect Sample for sampling from distirbutions|prob-fx The effect Dist for primitive distributions~prob-fxprimitive distributionprob-fxoptional observed valueprob-fx!optional observable variable nameprob-fxAn observable variable name and the index of its run-time occurrence, representing a run-time identifierprob-fxAn observable variable name assigned to a primitive distribution, representing a compile-time identifierprob-fx>For projecting and then successfully pattern matching against Observeprob-fx>For projecting and then successfully pattern matching against Sampleprob-fx Handle the Dist effect to a Sample or Observe effect and assign an addressyprob-fxdistribution to condition withprob-fxobserved valueprob-fx address of Observe operation{prob-fxdistribution to sample fromprob-fx address of Sample operationxyz{|}~|}~z{xy None ()0#prob-fxThe type of log-probability traces, mapping addresses of sample/observe operations to their log probabilitiesprob-fx2For converting sample traces to model environmentsprob-fx-Convert a sample trace to a model environmentprob-fxThe type of sample traces, mapping addresses of sample/observe operations to their primitive distributions and sampled values.prob-fx#Update a sample trace at an addressprob-fx8Compute and update a log-probability trace at an addressprob-fxaddress of sample siteprob-fx!primitive distribution at addressprob-fx sampled valueprob-fxprevious sample traceprob-fxupdated sample traceprob-fxaddress of sample/observe siteprob-fx!primitive distribution at addressprob-fxsampled or observed valueprob-fxprevious log-prob traceprob-fxupdated log-prob trace None ()0&prob-fxThe effect for reading observed values from a model environment envprob-fxGiven the observable variable x is assigned a list of type [a] in env%, attempt to retrieve its head value.prob-fxWrapper function for calling Askprob-fx Handle the Ask! requests of observable variablesprob-fx variable x to read fromprob-fxthe head value from x's listprob-fxinitial model environment None 07+prob-fxModels are parameterised by:1) a model environment env containing random variables that can be provided observed values2) an effect signature es+ of the possible effects a model can invoke3) an output type a$ of values that the model generates.6A model initially consists of (at least) two effects: Dist- for calling primitive distributions and  ObsReader env for reading from env.prob-fxThe initial handler for models, specialising a model under a certain environment to produce a probabilistic program consisting of Sample and Observe operations. prob-fx'value to be deterministically generatedprob-fxconcentration parametersprob-fxlist of n probabilitiesprob-fxinteger index from 0 to n - 1prob-fx(primitive values and their probabilitiesprob-fxmeanprob-fxstandard deviationprob-fxstandard deviationprob-fxlocationprob-fxscaleprob-fxscaleprob-fxprobability of Trueprob-fx shape 1 ()prob-fx shape 2 ()prob-fxnumber of trialsprob-fxprobability of successful trialprob-fxnumber of successful trialsprob-fx shape (k)prob-fx scale ()prob-fx lower-boundprob-fx upper-boundprob-fxrate ()prob-fxnumber of events  None ()0.7prob-fx&Writer effect for writing to a strean wprob-fxWrite to a stream wprob-fx Wrapper for Tellprob-fx Wrapper for Tell inside Modelprob-fx Handle the Writer effect for a stream wprob-fx Handle the Writer effect inside a Modelprob-fxvalue to writeprob-fx(output, final stream)prob-fx(output, final stream)None ()01"prob-fx-Top-level wrapper for simulating from a modelprob-fx8Handler for simulating once from a probabilistic programprob-fxTrace sampled values for each Sample operationprob-fxHandler Observe operations by simply passing forward their observed value, performing no side-effectsprob-fxHandle Sample operations by using the Sampler+ monad to draw from primitive distributionsprob-fxmodel awaiting an inputprob-fxmodel environmentprob-fx model inputprob-fx"(model output, output environment)prob-fxmodel environmentprob-fxmodelprob-fx(model output, sample trace)None'()08prob-fx8Top-level wrapper for Metropolis-Hastings (MH) inferenceprob-fxPerform one step of MHprob-fxHandler for one iteration of MHprob-fx/Handler for tracing log-probabilities for each Sample and Observe operationprob-fx Handler for Sample6 that selectively reuses old samples or draws new onesprob-fxFor a given address, look up a sampled value from a sample trace, returning it only if the primitive distribution it was sampled from matches the current one.prob-fxCompute acceptance probabilityprob-fxnumber of MH iterationsprob-fxmodel awaiting an inputprob-fx&(model input, input model environment)prob-fxoptional list of observable variable names (strings) to specify sample sites of interestprob-fx output model environmentprob-fxmodel environmentprob-fxmodelprob-fx(tags indicating sample sites of interestprob-fxtrace of previous MH outputsprob-fxupdated trace of MH outputsprob-fxmodel environmentprob-fx%sample trace of previous MH iterationprob-fxsample address of interestprob-fxmodelprob-fx3(model output, sample trace, log-probability trace)prob-fx sample traceprob-fxaddress of the proposal sample site for the current MH iterationprob-fx sample traceprob-fxdistribution to sample fromprob-fxaddress of current sample siteprob-fxaddress of proposal sample siteprob-fxaddress of new sampled valueprob-fxprevious MH sample traceprob-fxnew MH sample traceprob-fx!previous MH log-probability traceprob-fx current MH log-probability traceNone()0:prob-fx9Top-level wrapper for Likelihood-Weighting (LW) inferenceprob-fxHandler for one iteration of LWprob-fx Handle each Observe: operation by computing and accumulating a log probabilityprob-fxnumber of LW iterationsprob-fxmodel awaiting an inputprob-fx&(model input, input model environment)prob-fx 0(output model environment, likelihood-weighting)prob-fxmodel environmentprob-fxmodelprob-fx4((model output, sample trace), likelihood-weighting)prob-fxaccumulated log-probabilityprob-fx%(model output, final log-probability) !""#$%&'()*+,-./01234+,-56789:;<=>?@ABCDEFFGHIJKLMNOPQRSTUVWXYZ[\]^_` a a b b c  d e f g h i j k l m n o p q r s t u v w x y z z { { | | } ~                                                       prob-fx-0.1.0.2-inplaceFindElemEnvOpenSumProg Effects.State Effects.LiftSamplerUtilPrimDist Effects.DistTraceEffects.ObsReaderModelEffects.Writer Inference.SIM Inference.MH Inference.LWIdxunIdxfindElem$fFindElemk[]x[]$fFindElemk[]x:$fFindElema[]x: UniqueKey Observables Observablegetset LookupTypeAssign:=ENilEConsObsVarvarToStrnil<:>$fIsLabelxObsVar$fFindElemx[]x: $fShowEnv $fShowEnv0$fObservableenvxaMemberinjprj UnsafeOpenSum $fShowOpenSum$fShowOpenSum0 $fEqOpenSum $fEqOpenSum0 $fMemberaas $fMembera: EffectSumValOpruncall discharge $fMonadProg$fApplicativeProg $fFunctorProg $fMemberees $fMembere:StateGetPutputmodify handleStateLiftlift handleLiftliftSsampleIO sampleIOFixed createSampler sampleRandom sampleCauchy sampleNormal sampleUniformsampleDiscreteUniform sampleGamma sampleBetasampleBernoullisampleBinomialsampleCategoricalsampleDiscrete samplePoissonsampleDirichlet$fFunctorSampler$fApplicativeSampler$fMonadSampler boolToIntsafeHeadsafeTail findIndexesErasedPrimDist IsPrimValPrimVal BernoulliDistBetaDist BinomialDistCategoricalDist CauchyDistHalfCauchyDistDeterministicDist DirichletDist DiscreteDistDiscrUniformDist GammaDist NormalDistHalfNormalDist PoissonDist UniformDist PrimDistPrfsampleproblogProb$fShowPrimDist $fEqPrimDist$fShowErasedPrimDistObserveSampleDist getPrimDistgetObsgetTagAddrTagObsSamp handleDist$fEqDist $fShowDistLPTrace FromSTrace fromSTraceSTrace updateSTrace updateLPTrace $fFromSTrace:$fFromSTrace[] ObsReaderAskask handleReadrunModel handleCore deterministicdeterministic' dirichlet dirichlet'discrete discrete' categorical categorical'normalnormal' halfNormal halfNormal'cauchycauchy' halfCauchy halfCauchy' bernoulli bernoulli'betabeta'binomial binomial'gammagamma'uniformuniform'poissonpoisson' $fMonadModel$fApplicativeModel$fFunctorModelWriterTelltelltellM handleWriter handleWriterMsimulate runSimulate traceSamples handleObs handleSampmhmhSteprunMHtraceLPs lookupSampleacceptlwrunLW