lambda-sampler-1.0: Boltzmann sampler utilities for lambda calculus.

Copyright(c) Maciej Bendkowski 2016
LicenseBSD3
Maintainermaciej.bendkowski@tcs.uj.edu.pl
Stabilityexperimental
Safe HaskellSafe
LanguageHaskell2010

Data.Lambda.Random

Contents

Description

Boltzmann samplers for plain and closed h-shallow lambda terms (closed lambda terms in which each de Bruijn index is bounded by h).

The exact outcome size of a Boltzmann sampler is a random variable. Its moments, in particular expectation, can be calibrated by adjusting the formal evaluation parameter (see Data.Lambda.Random.System or Data.Lambda.Random.PlainSystem). Boltzmann samplers guarantee that terms of equal size have equal probability of being chosen.

Synopsis

Closed h-shallow lambda terms

closedLambda Source #

Arguments

:: (Random a, Num a, Ord a, Integral b, RandomGen g) 
=> Sampler a b

Boltzmann sampler to use.

-> b

Outcome size lower bound.

-> b

Outcome size upper bound.

-> Rand g Lambda

The monadic result.

Samples a random closed h-shallow lambda term in the given size range.

closedLambdaIO Source #

Arguments

:: (Random a, Num a, Ord a, Integral b) 
=> Sampler a b

Boltzmann sampler to use.

-> b

Outcome size lower bound.

-> b

Outcome size upper bound.

-> IO Lambda

The monadic result.

Samples a random closed h-shallow lambda term in the given size range using the IO monad. See closedLambda for more details.

Filter samplers for closed h-shallow lambda terms

filterClosed Source #

Arguments

:: (Random a, Num a, Ord a, Integral b, RandomGen g) 
=> (Lambda -> Bool)

Filter function to use.

-> Sampler a b

Boltzmann sampler to use.

-> b

Outcome size lower bound.

-> b

Outcome size upper bound.

-> Rand g Lambda

The monadic result.

Samples a random closed h-shallow lambda term in the given size range. In addition, the term has to satisfy the given predicate. See also closedLambda.

filterClosedIO Source #

Arguments

:: (Random a, Num a, Ord a, Integral b) 
=> (Lambda -> Bool)

Filter function to use.

-> Sampler a b

Boltzmann sampler to use.

-> b

Outcome size lower bound.

-> b

Outcome size upper bound.

-> IO Lambda

The monadic result.

Samples a random closed h-shallow lambda term in the given size range. In addition, the term has to satisfy the given predicate. The IO monad is used as the source of random numbers. See also filterClosed.

Plain lambda terms

plainLambda Source #

Arguments

:: (Random a, Num a, Ord a, Integral b, RandomGen g) 
=> PlainSampler a b

Boltzmann sampler to use.

-> b

Outcome size lower bound.

-> b

Outcome size upper bound.

-> Rand g Lambda

The monadic result.

Samples a random plain lambda term in the given size range.

plainLambdaIO Source #

Arguments

:: (Random a, Num a, Ord a, Integral b) 
=> PlainSampler a b

Boltzmann sampler to use.

-> b

Outcome size lower bound.

-> b

Outcome size upper bound.

-> IO Lambda

The monadic result.

Samples a random plain lambda term in the given size range using the IO monad. See plainLambda for more details.

Filter samplers for plain lambda terms

filterPlain Source #

Arguments

:: (Random a, Num a, Ord a, Integral b, RandomGen g) 
=> (Lambda -> Bool)

Filter function to use.

-> PlainSampler a b

Boltzmann sampler to use.

-> b

Outcome size lower bound.

-> b

Outcome size upper bound.

-> Rand g Lambda

The monadic result.

Samples a random plain lambda term in the given size range. In addition, the term has to satisfy the given predicate. See also plainLambda.

filterPlainIO Source #

Arguments

:: (Random a, Num a, Ord a, Integral b) 
=> (Lambda -> Bool)

Filter function to use.

-> PlainSampler a b

Boltzmann sampler to use.

-> b

Outcome size lower bound.

-> b

Outcome size upper bound.

-> IO Lambda

The monadic result.

Samples a random plain lambda term in the given size range. In addition, the term has to satisfy the given predicate. The IO monad is used as the source of random numbers. See also filterPlain.