Asymptotic enumeration of the linear and affine closed lambda terms - - PowerPoint PPT Presentation

asymptotic enumeration of the linear and affine closed
SMART_READER_LITE
LIVE PREVIEW

Asymptotic enumeration of the linear and affine closed lambda terms - - PowerPoint PPT Presentation

Asymptotic enumeration of the linear and affine closed lambda terms with natural size Zbigniew Gobiewski Wrocaw University of Science and Technology Faculty of Fundamental Problems of Technology Department of Computer Science Joint work


slide-1
SLIDE 1

Asymptotic enumeration of the linear and affine closed lambda terms with natural size

Zbigniew Gołębiewski

Wrocław University of Science and Technology Faculty of Fundamental Problems of Technology Department of Computer Science Joint work with Isabella Larcher

slide-2
SLIDE 2

Definition of lambda terms

T ::= x | λx.T | T T → T ::= n | λM | M M λx.T : abstraction, unary node (T T) : application, binary node λy.((λx.x)(λx.y)) ↔ λ(λ1λ2) ↔ λ((λ0)(λ(S0))) λ.y @ λ.x λ.x x y λ @ λ λ 1 2 λ @ λ λ S

Zbigniew Gołębiewski Asymptotics of BCI/BCK λ-terms in natural size CLA 2019

slide-3
SLIDE 3

Notion of size of a λ-term

  • variable size equals to 0,
  • variable size equals to 1,
  • variable size depends on its de Bruijn index.

Zbigniew Gołębiewski Asymptotics of BCI/BCK λ-terms in natural size CLA 2019

slide-4
SLIDE 4

Notion of size of a λ-term

|0| = a |Sn| = |n| + b |λM| = |M| + c |MN| = |M| + |N| + d.

  • a = b = c = d = 1 - natural size [Bendkowski, Grygiel, Lescanne,

Zaionc (2016)],

  • b = 1, a = c = d = 2 - binary lambda calculus [Tromp (2006)].

Zbigniew Gołębiewski Asymptotics of BCI/BCK λ-terms in natural size CLA 2019

slide-5
SLIDE 5

Asymptotic number of closed λ-terms in natural size

Theorem (Bodini, Gittenberger, G. (2018)) Let ln denote the number of closed λ-terms of natural size n. Then ln ∼ Cn− 3

2 ρ−n

as n → ∞, where ρ = RootOf{−1 + 3x + x2 + x3} ≈ 0.295598 . . ., ρ−1 ≈ 3.38298 . . . and 0.07790995266 ≤ C ≤ 0.07790998229.

Zbigniew Gołębiewski Asymptotics of BCI/BCK λ-terms in natural size CLA 2019

slide-6
SLIDE 6

Linear and affine λ-terms

  • A linear closed λ-term (BCI) is a λ-term in which each

variable occurs exactly once and there are no free variables.

  • An affine closed λ-term (BCK) is a λ-term in which each

variable occurs at most once and there are no free variables.

Zbigniew Gołębiewski Asymptotics of BCI/BCK λ-terms in natural size CLA 2019

slide-7
SLIDE 7

Linear and affine λ-terms

  • density of linear (BCI) among affine (BCK) λ-terms [Grygiel,

Idziak, Zaionc (2013)]

  • asymptotic number of the linear/affine closed λ-terms with

variable size 0, 1:

  • [Bodini, Gardy, Jacquot (2013)] - bijection with the

combinatorial maps

  • [Bodini, Gardy, Gittenberger, Jacquot (2013)] - a growth process
  • f a λ-term via a functional equation for BCI(k) terms
  • [Bodini, Gittenberger (2014)] - study of a functional equation for

BCK(2) terms

  • recursive equations for the number of linear and affine closed

λ-terms with variable size 0, 1 and natural size:

  • [Lescanne (2018)] - use of SwissCheese data structure

Zbigniew Gołębiewski Asymptotics of BCI/BCK λ-terms in natural size CLA 2019

slide-8
SLIDE 8

Linear and affine λ-terms with natural size

In [Lescanne (2018)] L(z, u) = u0 + zL(z, u)2 +

  • j=1

zj ∂L(z, tail(u)) ∂uj , where u = (u0, u1, u2, . . .) and tail(u) = (u1, u2, . . .).

Zbigniew Gołębiewski Asymptotics of BCI/BCK λ-terms in natural size CLA 2019

slide-9
SLIDE 9

Linear λ-terms in natural size and de Bruijn indices equals 1

λ.y @ λ.x y x λ @ λ 1 1 λ.y @ λ.x λ.x x y λ @ λ λ 1 2

Zbigniew Gołębiewski Asymptotics of BCI/BCK λ-terms in natural size CLA 2019

slide-10
SLIDE 10

Linear λ-terms in natural size and de Bruijn indices equals 1

  • Lk,n denote a set of the linear λ-terms of natural size n and de

Bruijn indices less or equal to k

  • lk,n = |Lk,n| and Lk(z) =

n lk,nzn

Fact If t ∈ L1,n has p variables then |t| = n = 3p − 1.

Zbigniew Gołębiewski Asymptotics of BCI/BCK λ-terms in natural size CLA 2019

slide-11
SLIDE 11

Linear λ-terms in natural size and de Bruijn indices equals 1

L1 ≃ @ L1 L1 + λ1 R1 L1(z) = zL1(z)2 + zR1(z) R1 ≃ 1 + @ R1 L1 + @ L1 R1 R1(z) = z + 2zL1(z)R1(z) → R1(z) = z 1 − 2zL1(z)

Zbigniew Gołębiewski Asymptotics of BCI/BCK λ-terms in natural size CLA 2019

slide-12
SLIDE 12

Linear λ-terms in natural size and de Bruijn indices equals 1

Lemma Let L1(z) denote the OGF of closed linear λ-terms in natural size and de Bruijn indices equal to 1. Then L1(z) = zL1(z)2 + z2 1 − 2zL1(z),

L1(z) = 1 2

  • 1

3

√ 3

3

  • 18z6 +

√ 3 √ 108z12 − z6 +

3

  • 18z6 +

√ 3 √ 108z12 − z6 32/3z2 + 1 z

  • ,

L1(z) = z2+3z5+16z8+105z11+768z14+6006z17+49152z20+. . . The sequence 1, 3, 16, 105, 768, 6006, 49152, . . . appears in OEIS as A085614: The number of elementary arches of size n.

Zbigniew Gołębiewski Asymptotics of BCI/BCK λ-terms in natural size CLA 2019

slide-13
SLIDE 13

Linear λ-terms in natural size and de Bruijn indices equals 1

Lemma The number of closed linear λ-terms of natural size n and de Bruijn indices equal to 1 satisfies l1,n ∼

n→∞

     3 2

7 6 √

πn3

  • 2

1 3 √

3 n if (n + 1)|3

  • therwise.

Zbigniew Gołębiewski Asymptotics of BCI/BCK λ-terms in natural size CLA 2019

slide-14
SLIDE 14

Linear λ-terms in natural size and de Bruijn indices equals 1

Lemma The number of closed linear λ-terms of natural size n and de Bruijn indices equal to 1 satisfies l1,n ∼

n→∞

     3 2

7 6 √

πn3

  • 2

1 3 √

3 n if (n + 1)|3

  • therwise.

ρ−1

L1 = 21/3√

3 ≈ 2.18225 . . . and ρ−1 ≈ 3.38298 . . .

Zbigniew Gołębiewski Asymptotics of BCI/BCK λ-terms in natural size CLA 2019

slide-15
SLIDE 15

Affine λ-terms in natural size and de Bruijn indices equals 1

A1 ≃ @ A1 A1 + λ0 A1 + λ1 R1 A1(z) = zA1(z)2 + zA1(z) + zR1(z) R1 ≃ 1 + @ R1 A1 + @ A1 R1 R1(z) = z + 2zA1(z)R1(z) → R1(z) = z 1 − 2zA1(z)

Zbigniew Gołębiewski Asymptotics of BCI/BCK λ-terms in natural size CLA 2019

slide-16
SLIDE 16

Affine λ-terms in natural size and de Bruijn indices equals 1

Lemma Let A1(z) denote the OGF of closed affine λ-terms in natural size and de Bruijn indices equal to 1. Then A1(z) = zA1(z)2 + zA1(z) + z2 1 − 2zA1(z),

A1(z) = − 2z2 − 3z 6z2 +

3

  • 46z6 + 18z5 − 9z4 + 3

√ 3

  • 76z12 + 72z11 − 40z10 + 12z9 − 13z8 + 6z7 − z6

6z2 − −4z4 + 6z3 − 3z2 6z2 3

  • 46z6 + 18z5 − 9z4 + 3

√ 3

  • 76z12 + 72z11 − 40z10 + 12z9 − 13z8 + 6z7 − z6

,

A1(z) = z+z2+z3+z4+4z5+8z6+13z7+35z8+84z9+172z10+. . .

Zbigniew Gołębiewski Asymptotics of BCI/BCK λ-terms in natural size CLA 2019

slide-17
SLIDE 17

Affine λ-terms in natural size and de Bruijn indices equals 1

Lemma The number of closed affine λ-terms of natural size n and de Bruijn indices equal to 1 satisfies a1,n ∼

n→∞ CA1n− 3

2 ρ−n

A1 ,

where ρA1 = RootOf [−1 + 6x − 13x2 + 12x3 − 40x4 + 72x5 + 76x6] ≈ 0.372288 . . . and CA1 ≈ 0.31462 . . .

Zbigniew Gołębiewski Asymptotics of BCI/BCK λ-terms in natural size CLA 2019

slide-18
SLIDE 18

Linear λ-terms in natural size and de Bruijn indices ≤ 2

Let Pj denote a sub-term that is a path of left-right Lk terms that finishes with a string of nodes of length j. j Pj ≃ j + @ Pj Lk + @ Lk Pj Pj(z) = zj + 2zLk(z)Pj(z) → Pj(z) = zj 1 − 2zLk(z)

Zbigniew Gołębiewski Asymptotics of BCI/BCK λ-terms in natural size CLA 2019

slide-19
SLIDE 19

Linear λ-terms in natural size and de Bruijn indices ≤ 2

L2 ≃ @ L2 L2 + λ1 R1 + λ2 R2 L2(z) = zL2(z)2 + zR1(z) + zR2(z) R1 ≃ 1 + @

R1 L2

+ @

L2 R1

≃ P1 R1(z) = z + 2zR1(z)L2(z) → R1(z) = z 1 − 2zL2(z) = P1(z)

Zbigniew Gołębiewski Asymptotics of BCI/BCK λ-terms in natural size CLA 2019

slide-20
SLIDE 20

Linear λ-terms in natural size and de Bruijn indices ≤ 2

R2 ≃ 2× @ R2 L2 + 2× λ1 P1 @ P2 2 R1 + 2× λ2 P1 @ P2 2 R2

R2(z) = 2zP1(z)3(R1(z) + R2(z))

Zbigniew Gołębiewski Asymptotics of BCI/BCK λ-terms in natural size CLA 2019

slide-21
SLIDE 21

Linear λ-terms in natural size and de Bruijn indices ≤ 2

R2 ≃ 2× @ R2 L2 + 2× λ1 P1 @ P2 2 R1 + 2× λ2 P1 @ P2 2 R2

R2(z) = 2zP1(z)3(R1(z) + R2(z)) L2(z) = zL2(z)2 + R2(z) 2P1(z)3

Zbigniew Gołębiewski Asymptotics of BCI/BCK λ-terms in natural size CLA 2019

slide-22
SLIDE 22

Linear λ-terms in natural size and de Bruijn indices ≤ 2

Lemma Let L2(z) denote the OGF of closed linear λ-terms in natural size and de Bruijn indices less or equal to 2. Then L2(z) satisfies P(z, L2(z)) = 0 where

P(z, y) = 8y5z4 −20y4z3 +18y3z2 +y2 2z5 − 4z4 − 7z

  • +y
  • −2z4 + 4z3 + 1
  • −z2.

The coefficients of L2(z) are: 0, 0, 1, 0, 0, 3, 2, 0, 16, 24, 4, 105, 252, 108, 776, 2560, 1920, 6390, 25756, 28600, 59552, . . .

Zbigniew Gołębiewski Asymptotics of BCI/BCK λ-terms in natural size CLA 2019

slide-23
SLIDE 23

Linear λ-terms in natural size and de Bruijn indices ≤ 2

Lemma The number of closed linear λ-terms of natural size n and de Bruijn indices less or equal to 2 satisfies l2,n ∼

n→∞ CL2n− 3

2 ρ−n

L2 ,

where ρL2 = RootOf [27+128x5−3492x6−4104x7−216x8−13824x11+ 34560x12 − 34560x13 + 17280x14 − 4320x15 + 432x16] ≈ 0.418879 . . . and CL2 ≈ 0.213529 . . ..

Zbigniew Gołębiewski Asymptotics of BCI/BCK λ-terms in natural size CLA 2019

slide-24
SLIDE 24

Affine λ-terms in natural size and de Bruijn indices ≤ 2

Lemma The number of closed affine λ-terms of natural size n and de Bruijn indices less or equal to 2 satisfies a2,n ∼

n→∞ CA2n− 3

2 ρ−n

A2 ,

where ρA2 = RootOf [27 − 378x + 2295x2 − 7884x3 + 18288x4 − 38140x5 + 80660x6 − 133304x7 + 176904x8 − 322880x9 + 532896x10 − 502144x11 + 621696x12 − 638576x13 + 197696x14 − 697376x15 − 12688x16 − 338272x17 + 1728x18] ≈ 0.346216 . . . and CA2 ≈ 0.29841 . . .

Zbigniew Gołębiewski Asymptotics of BCI/BCK λ-terms in natural size CLA 2019

slide-25
SLIDE 25

Linear λ-terms in natural size and de Bruijn indices ≤ k

Lk ≃ @ Lk Lk +

k

  • i=1

λi Ri Lk(z) = zLk(z)2 + z

k

  • i=1

Ri(z)

Zbigniew Gołębiewski Asymptotics of BCI/BCK λ-terms in natural size CLA 2019

slide-26
SLIDE 26

Linear λ-terms in natural size and de Bruijn indices ≤ k

Ri ≃ i = 1 1 + i > 1

k

  • j=1

λj

Z × Ri−1,j

Ri(z) = i = 1P1(z) + i > 1zP1(z)

k

  • j=1

Ri−1,j(z)

Zbigniew Gołębiewski Asymptotics of BCI/BCK λ-terms in natural size CLA 2019

slide-27
SLIDE 27

Linear λ-terms in natural size and de Bruijn indices ≤ k

Ri1,i2 ≃ 2× @ Ri1 Ri2 + i1, i2 > 1

k

  • i3=1

λi3 Z2 × Ri1−1,i2−1,i3 Ri1,i2(z) = 2P1(z)Ri1(z)Ri2(z)+i1, i2 > 1z2P1(z)

k

  • i3=1

Ri1−1,i2−1,i3(z)

Zbigniew Gołębiewski Asymptotics of BCI/BCK λ-terms in natural size CLA 2019

slide-28
SLIDE 28

Linear λ-terms in natural size and de Bruijn indices ≤ k

Ri1,...,im ≃2

m

  • p=1

@ Ri1,...,ip−1,ip+1,...,im Rip + i1, . . . , im > 1

k

  • im+1=1

λim+1 Zm × Ri1−1,...,im−1,im+1 Ri1,...,im(z) =2P1(z)

m

  • p=1

Ri1,...,ip−1,ip+1,...,im(z)Rip(z)+ i1, . . . , im > 1zmP1(z)

k

  • im+1=1

Ri1−1,...,im−1,im+1(z)

Zbigniew Gołębiewski Asymptotics of BCI/BCK λ-terms in natural size CLA 2019

slide-29
SLIDE 29

Linear λ-terms in natural size and de Bruijn indices ≤ 3

Lemma The number of closed linear λ-terms of natural size n and de Bruijn indices less or equal to 3 satisfies l3,n ∼

n→∞ CL3n− 3

2 ρ−n

L3 ,

where ρL3 = RootOf [polynomial of degree 287] ≈ 0.404569 . . . and CL3 is some constant.

Zbigniew Gołębiewski Asymptotics of BCI/BCK λ-terms in natural size CLA 2019

slide-30
SLIDE 30

Comparison of the exponential terms

k ρLk ρ−1

Lk

ρAk ρ−1

Ak

1 0.458243 2.18225 0.372288 2.68609 2 0.418879 2.38733 0.346216 2.88837 3 0.404569 2.47176 ?? ?? ρ ≈ 0.295598 . . . and ρ−1 ≈ 3.38298 . . .

Zbigniew Gołębiewski Asymptotics of BCI/BCK λ-terms in natural size CLA 2019

slide-31
SLIDE 31

Thank you!

Zbigniew Gołębiewski Asymptotics of BCI/BCK λ-terms in natural size CLA 2019