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

Data.Lambda.Random

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

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.

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 closedShallowLambda for more details.

# Filter samplers for closed h-shallow lambda terms

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 closedShallowLambda.

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 filterClosedShallow.

# Closed lambda terms

Arguments

 :: (Random a, Num a, Ord a, Integral b, RandomGen g) => MixedSampler 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 lambda term in the given size range.

Arguments

 :: (Random a, Num a, Ord a, Integral b) => MixedSampler 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 lambda term in the given size range using the IO monad. See closedLambda for more details.

# Filter samplers for plain lambda terms

Arguments

 :: (Random a, Num a, Ord a, Integral b, RandomGen g) => (Lambda -> Bool) Filter function to use. -> MixedSampler 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 lambda term in the given size range In addition, the term has to satisfy the given predicate. See also closedLambda.

Arguments

 :: (Random a, Num a, Ord a, Integral b) => (Lambda -> Bool) Filter function to use. -> MixedSampler 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 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

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.

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

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.

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.