A natural counting of lambda terms Maciej Bendkowski Theoretical - - PowerPoint PPT Presentation

a natural counting of lambda terms
SMART_READER_LITE
LIVE PREVIEW

A natural counting of lambda terms Maciej Bendkowski Theoretical - - PowerPoint PPT Presentation

A natural counting of lambda terms Maciej Bendkowski Theoretical Computer Science Jagiellonian University joint work with Katarzyna Grygiel, Pierre Lescanne and Marek Zaionc FIT 2016 Warsaw, February 2016 Bendkowski, Grygiel, Lescanne,


slide-1
SLIDE 1

A natural counting of lambda terms

Maciej Bendkowski

Theoretical Computer Science Jagiellonian University

joint work with Katarzyna Grygiel, Pierre Lescanne and Marek Zaionc FIT 2016 Warsaw, February 2016

Bendkowski, Grygiel, Lescanne, Zaionc A natural counting of lambda terms

slide-2
SLIDE 2

Motivations

1

Combinatorics – design new methods for counting structures with binders and local scopes,

2

Computer Science – develop tools for random λ-term generation used in software testing (see, e.g. Quickcheck),

3

Computational Logic – study quantitative aspects of semantic properties in λ-calculus and related systems,

4

. . .

Bendkowski, Grygiel, Lescanne, Zaionc A natural counting of lambda terms

slide-3
SLIDE 3

Natural size notion

λ @ @ λ λ @ λ 2 λx.((λy.y)x)(λz.z(λw.x)) λ((λ0)0)(λ0(λ2)) |t| = 13

Bendkowski, Grygiel, Lescanne, Zaionc A natural counting of lambda terms

slide-4
SLIDE 4

Natural counting of λ-terms

L∞ = L∞ L∞ λ L∞ D D = S D 0 ·  

  • L∞(z) = zL2

∞(z) + zL∞(z) +

z 1 − z L∞(z) = (1 − z)3/2 − √ 1 − 3z − z2 − z3 2z√1 − z

Bendkowski, Grygiel, Lescanne, Zaionc A natural counting of lambda terms

slide-5
SLIDE 5

Asymptotic approximation of ([zn]L∞)n∈N

Theorem (B, Grygiel, Lescanne, Zaionc) The asymptotic approximation of the number of λ-terms of size n is given by [zn]L∞ ∼ (3.38298 . . .)n C n

3/2,

where C . = 0.60676.

Bendkowski, Grygiel, Lescanne, Zaionc A natural counting of lambda terms

slide-6
SLIDE 6

Holonomic presentation of L∞

L∞(z) = (1 − z)3/2 − √ 1 − 3z − z2 − z3 2z√1 − z  

  • Maple: package gfun

z3+z2−2z+(z3+3z2−3z+1)L∞+(z5+2z3−4z2+z)L′

∞ = 0.

Bendkowski, Grygiel, Lescanne, Zaionc A natural counting of lambda terms

slide-7
SLIDE 7

Computing L∞,n

’Holonomic’ recursion for L∞,n L∞,0 = 0, L∞,1 = 1, L∞,2 = 2, L∞,3 = 4, (n + 1)L∞,n = (4n − 1)L∞,n−1 − (2n − 1)L∞,n−2 −L∞,n−3 − (n − 4)L∞,n−4.

Bendkowski, Grygiel, Lescanne, Zaionc A natural counting of lambda terms

slide-8
SLIDE 8

λ-terms with bounded number of free indices

Lm = Lm Lm λ Lm+1 Dm Dm = {0, 1, . . . , m-1}  

  • Lm(z) =

1 −

  • 1 − 4z2

Lm+1(z) + 1−zm

1−z

  • 2z

Bendkowski, Grygiel, Lescanne, Zaionc A natural counting of lambda terms

slide-9
SLIDE 9

λ-terms with bounded number of free indices

Lm = Lm Lm λ Lm+1 Dm Dm = {0, 1, . . . , m-1}  

  • Lm(z) =

1 −

  • 1 − 4z2

Lm+1(z) + 1−zm

1−z

  • 2z

Lm is expressed by means of infinitely nested radicals!

Bendkowski, Grygiel, Lescanne, Zaionc A natural counting of lambda terms

slide-10
SLIDE 10

Counting λ-terms containing fixed subterms

Theorem (B, Grygiel, Lescanne, Zaionc) For an arbitrary fixed term M, asymptotically almost all λ-terms contain M as a subterm.

Bendkowski, Grygiel, Lescanne, Zaionc A natural counting of lambda terms

slide-11
SLIDE 11

Counting λ-terms containing fixed subterms

Theorem (B, Grygiel, Lescanne, Zaionc) For an arbitrary fixed term M, asymptotically almost all λ-terms contain M as a subterm. Proof sketch

1

TM = M λ TM TM L∞ L∞ TM TM TM.

2

Consider L∞(z) − TM(z). Show that it has density 0.

Bendkowski, Grygiel, Lescanne, Zaionc A natural counting of lambda terms

slide-12
SLIDE 12

Counting λ-terms containing fixed subterms - cnd.

Theorem (B, Grygiel, Lescanne, Zaionc) Asymptotically almost no λ-term is strongly normalizing.

Bendkowski, Grygiel, Lescanne, Zaionc A natural counting of lambda terms

slide-13
SLIDE 13

The sequence ([zn]L∞)n∈N

The sequence ([zn]L∞)n∈N is known as A105633 in Online Encyclopedia of Integer Sequences (http://oeis.org)!

0, 1, 2, 4, 9, 22, 57, 154, 429, 1223, 3550, 10455, 31160, 93802, 284789, 871008, 2681019, 8298933, 25817396,. . .

Bendkowski, Grygiel, Lescanne, Zaionc A natural counting of lambda terms

slide-14
SLIDE 14

E-free black-white binary trees

Black-white binary trees (A105633)

1

A1 = {

  • ,
  • ,
  • ,
  • },

2

Roots are black.  

  • BW•(z) = z + zBW•(z) + zBW◦(z)

BW◦(z) = z + zBW◦(z) + zBW•(z) + zBW◦(z)BW•(z)

Bendkowski, Grygiel, Lescanne, Zaionc A natural counting of lambda terms

slide-15
SLIDE 15

Bijection between λ-terms and black-white trees

·

LtoBw

− − − → •

  • BwtoL

− − − → 0 · S n

LtoBw

− − − →

LtoBw(n)

  • T
  • BwtoL

− − − → S BwtoL(T) λ M

LtoBw

− − − →

LtoBw(M)

  • T
  • BwtoL

− − − → λ BwtoL(T) M1 M2

LtoBw

− − − →

LtoBw(M2)

  • LtoBw(M1)

T2

  • T1

BwtoL

− − − → BwtoL(T1) BwtoL(T2)

Bendkowski, Grygiel, Lescanne, Zaionc A natural counting of lambda terms

slide-16
SLIDE 16

Example

λ @ @ λ λ @ λ 2 ⇔

  • Bendkowski, Grygiel, Lescanne, Zaionc

A natural counting of lambda terms

slide-17
SLIDE 17

Binary trees without zigzags

Zigzag-free binary trees (A105633)

× × ×

 

  • BZ1 = ×

BZ1 BZ2 BZ2 = ×

  • ×

BZ2

  • ×

BZ2 BZ1

Bendkowski, Grygiel, Lescanne, Zaionc A natural counting of lambda terms

slide-18
SLIDE 18

Binary trees without zigzags - continued

Theorem (B, Grygiel, Lescanne, Zaionc) There exists a computable (linear) bijection between black-white and zigzag-free trees and thus between λ-terms and zigzag-free trees.

Bendkowski, Grygiel, Lescanne, Zaionc A natural counting of lambda terms

slide-19
SLIDE 19

References

1

(2016) A natural counting of lambda terms. Bendkowski, Grygiel, Lescanne and Zaionc. In proceedings of SOFSEM 2016, LNCS vol. 9587 pp 183-194.

Bendkowski, Grygiel, Lescanne, Zaionc A natural counting of lambda terms

slide-20
SLIDE 20

Thank you!

Questions & Answers

Bendkowski, Grygiel, Lescanne, Zaionc A natural counting of lambda terms