14 research outputs found

    On the number of lambda terms with prescribed size of their De Bruijn representation

    Get PDF
    John Tromp introduced the so-called 'binary lambda calculus' as a way to encode lambda terms in terms of binary words. Later, Grygiel and Lescanne conjectured that the number of binary lambda terms with mm free indices and of size nn (encoded as binary words of length nn) is o(n3/2τn)o(n^{-3/2} \tau^{-n}) for τ1.963448\tau \approx 1.963448\ldots. We generalize the proposed notion of size and show that for several classes of lambda terms, including binary lambda terms with mm free indices, the number of terms of size nn is Θ(n3/2ρn)\Theta(n^{-3/2} \rho^{-n}) with some class dependent constant ρ\rho, which in particular disproves the above mentioned conjecture. A way to obtain lower and upper bounds for the constant near the leading term is presented and numerical results for a few previously introduced classes of lambda terms are given

    On the enumeration of closures and environments with an application to random generation

    Get PDF
    Environments and closures are two of the main ingredients of evaluation in lambda-calculus. A closure is a pair consisting of a lambda-term and an environment, whereas an environment is a list of lambda-terms assigned to free variables. In this paper we investigate some dynamic aspects of evaluation in lambda-calculus considering the quantitative, combinatorial properties of environments and closures. Focusing on two classes of environments and closures, namely the so-called plain and closed ones, we consider the problem of their asymptotic counting and effective random generation. We provide an asymptotic approximation of the number of both plain environments and closures of size nn. Using the associated generating functions, we construct effective samplers for both classes of combinatorial structures. Finally, we discuss the related problem of asymptotic counting and random generation of closed environemnts and closures

    Normal-order reduction grammars

    Full text link
    We present an algorithm which, for given nn, generates an unambiguous regular tree grammar defining the set of combinatory logic terms, over the set {S,K}\{S,K\} of primitive combinators, requiring exactly nn normal-order reduction steps to normalize. As a consequence of Curry and Feys's standardization theorem, our reduction grammars form a complete syntactic characterization of normalizing combinatory logic terms. Using them, we provide a recursive method of constructing ordinary generating functions counting the number of SKS K-combinators reducing in nn normal-order reduction steps. Finally, we investigate the size of generated grammars, giving a primitive recursive upper bound

    Unary profile of lambda terms with restricted De Bruijn indices

    Get PDF
    In this paper we present an average-case analysis of closed lambda terms with restricted values of De Bruijn indices in the model where each occurrence of a variable contributes one to the size. Given a fixed integer k, a lambda term in which all De Bruijn indices are bounded by k has the following shape: It starts with k De Bruijn levels, forming the so-called hat of the term, to which some number of k-colored Motzkin trees are attached. By means of analytic combinatorics, we show that the size of this hat is constant on average and that the average number of De Bruijn levels of k-colored Motzkin trees of size n is asymptotically Θ(√ n). Combining these two facts, we conclude that the maximal non-empty De Bruijn level in a lambda term with restrictions on De Bruijn indices and of size n is, on average, also of order √ n. On this basis, we provide the average unary profile of such lambda terms

    Combinatorics of explicit substitutions

    Full text link
    λυ\lambda\upsilon is an extension of the λ\lambda-calculus which internalises the calculus of substitutions. In the current paper, we investigate the combinatorial properties of λυ\lambda\upsilon focusing on the quantitative aspects of substitution resolution. We exhibit an unexpected correspondence between the counting sequence for λυ\lambda\upsilon-terms and famous Catalan numbers. As a by-product, we establish effective sampling schemes for random λυ\lambda\upsilon-terms. We show that typical λυ\lambda\upsilon-terms represent, in a strong sense, non-strict computations in the classic λ\lambda-calculus. Moreover, typically almost all substitutions are in fact suspended, i.e. unevaluated, under closures. Consequently, we argue that λυ\lambda\upsilon is an intrinsically non-strict calculus of explicit substitutions. Finally, we investigate the distribution of various redexes governing the substitution resolution in λυ\lambda\upsilon and investigate the quantitative contribution of various substitution primitives

    Almost Every Simply Typed Lambda-Term Has a Long Beta-Reduction Sequence

    Full text link
    It is well known that the length of a beta-reduction sequence of a simply typed lambda-term of order k can be huge; it is as large as k-fold exponential in the size of the lambda-term in the worst case. We consider the following relevant question about quantitative properties, instead of the worst case: how many simply typed lambda-terms have very long reduction sequences? We provide a partial answer to this question, by showing that asymptotically almost every simply typed lambda-term of order k has a reduction sequence as long as (k-1)-fold exponential in the term size, under the assumption that the arity of functions and the number of variables that may occur in every subterm are bounded above by a constant. To prove it, we have extended the infinite monkey theorem for strings to a parametrized one for regular tree languages, which may be of independent interest. The work has been motivated by quantitative analysis of the complexity of higher-order model checking

    Statistical properties of lambda terms

    Get PDF
    We present a quantitative, statistical analysis of random lambda terms in the de Bruijn notation. Following an analytic approach using multivariate generating functions, we investigate the distribution of various combinatorial parameters of random open and closed lambda terms, including the number of redexes, head abstractions, free variables or the de Bruijn index value profile. Moreover, we conduct an average-case complexity analysis of finding the leftmost-outermost redex in random lambda terms showing that it is on average constant. The main technical ingredient of our analysis is a novel method of dealing with combinatorial parameters inside certain infinite, algebraic systems of multivariate generating functions. Finally, we briefly discuss the random generation of lambda terms following a given skewed parameter distribution and provide empirical results regarding a series of more involved combinatorial parameters such as the number of open subterms and binding abstractions in closed lambda terms.Comment: Major revision of section 5. In particular, proofs of Lemma 5.7 and Theorem 5.

    Statistical properties of lambda terms

    Get PDF
    We present a quantitative, statistical analysis of random lambda terms in the De Bruijn notation. Following an analytic approach using multivariate generat-ing functions, we investigate the distribution of various combinatorial parameters of random open and closed lambda terms, including the number of redexes, head abstractions, free variables or the De Bruijn index value profile. Moreover, we con-duct an average-case complexity analysis of finding the leftmost-outermost redex in random lambda terms showing that it is on average constant. The main technical ingredient of our analysis is a novel method of dealing with combinatorial paramet-ers inside certain infinite, algebraic systems of multivariate generating functions. Finally, we briefly discuss the random generation of lambda terms following a given skewed parameter distribution and provide empirical results regarding a series of more involved combinatorial parameters such as the number of open subterms and binding abstractions in closed lambda terms
    corecore