Generating Random Lambda Calculus Terms
暂无分享,去创建一个
We explore the problem of generating lambda calculus terms of a given size uniformly at random. This work has several motivations. First, through performing statistical sampling experiments with randomly generated terms, we can study interesting properties of lambda calculus terms. Second, random lambda calculus terms can serve as inputs to program analysis algorithms such as type inference algorithms to evaluate both their performance and correctness. In this report, we present an algorithm (implemented in OCaml) that generates a random lambda calculus term of a given size, assuming a uniform distribution over all terms of a given size. To improve the efficiency of generating a term, the current algorithm makes use of memoization techniques and also employs a system of number representation that represents numbers approximately. In addition, we also present some of the possible applications for such a tool along with some preliminary results.
[1] O. H. Lowry. Academic press. , 1972, Analytical chemistry.
[2] Harry G. Mairson. Generating Words in a Context-Free Language Uniformly at Random , 1994, Inf. Process. Lett..
[3] Henk Barendregt,et al. The Lambda Calculus: Its Syntax and Semantics , 1985 .
[4] K. Claessen,et al. QuickCheck: a lightweight tool for random testing of Haskell programs , 2000, ICFP '00.