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
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 )( λ ( S 0 ))) λ .y λ λ @ @ @ λ .x λ .x λ λ λ λ 1 2 0 S x y 0 Zbigniew Gołębiewski Asymptotics of BCI/BCK λ -terms in natural size CLA 2019
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
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
Asymptotic number of closed λ -terms in natural size Theorem (Bodini, Gittenberger, G. (2018)) Let l n denote the number of closed λ -terms of natural size n . Then l n ∼ Cn − 3 2 ρ − n as n → ∞ , where ρ = RootOf {− 1 + 3 x + x 2 + x 3 } ≈ 0 . 295598 . . . , ρ − 1 ≈ 3 . 38298 . . . and 0 . 07790995266 ≤ C ≤ 0 . 07790998229 . Zbigniew Gołębiewski Asymptotics of BCI/BCK λ -terms in natural size CLA 2019
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
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 of 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
Linear and affine λ -terms with natural size In [Lescanne (2018)] ∞ z j ∂ L ( z , tail ( u )) L ( z , u ) = u 0 + zL ( z , u ) 2 + � , ∂ u j j = 1 where u = ( u 0 , u 1 , u 2 , . . . ) and tail ( u ) = ( u 1 , u 2 , . . . ) . Zbigniew Gołębiewski Asymptotics of BCI/BCK λ -terms in natural size CLA 2019
Linear λ -terms in natural size and de Bruijn indices equals 1 λ .y λ @ @ λ .x λ y 1 1 x λ .y λ @ @ λ .x λ .x λ λ 1 2 x y Zbigniew Gołębiewski Asymptotics of BCI/BCK λ -terms in natural size CLA 2019
Linear λ -terms in natural size and de Bruijn indices equals 1 • L k , n denote a set of the linear λ -terms of natural size n and de Bruijn indices less or equal to k n l k , n z n • l k , n = |L k , n | and L k ( z ) = � Fact If t ∈ L 1 , n has p variables then | t | = n = 3 p − 1 . Zbigniew Gołębiewski Asymptotics of BCI/BCK λ -terms in natural size CLA 2019
Linear λ -terms in natural size and de Bruijn indices equals 1 @ λ 1 ≃ + L 1 L 1 L 1 R 1 L 1 ( z ) = zL 1 ( z ) 2 + zR 1 ( z ) @ @ ≃ + + R 1 1 R 1 L 1 L 1 R 1 z R 1 ( z ) = z + 2 zL 1 ( z ) R 1 ( z ) → R 1 ( z ) = 1 − 2 zL 1 ( z ) Zbigniew Gołębiewski Asymptotics of BCI/BCK λ -terms in natural size CLA 2019
Linear λ -terms in natural size and de Bruijn indices equals 1 Lemma Let L 1 ( z ) denote the OGF of closed linear λ -terms in natural size and de Bruijn indices equal to 1 . Then z 2 L 1 ( z ) = zL 1 ( z ) 2 + 1 − 2 zL 1 ( z ) , √ √ � � 18 z 6 + � 3 108 z 12 − z 6 L 1 ( z ) = 1 1 3 + 1 108 z 12 − z 6 + , √ √ √ 3 2 / 3 z 2 2 � 3 18 z 6 + 3 z 3 3 L 1 ( z ) = z 2 + 3 z 5 + 16 z 8 + 105 z 11 + 768 z 14 + 6006 z 17 + 49152 z 20 + . . . 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
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 3 √ 3 � n � 1 6 √ 2 3 if ( n + 1 ) | 3 7 π n 3 2 l 1 , n ∼ n →∞ 0 otherwise . Zbigniew Gołębiewski Asymptotics of BCI/BCK λ -terms in natural size CLA 2019
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 3 √ 3 � n � 1 6 √ 2 3 if ( n + 1 ) | 3 7 π n 3 2 l 1 , n ∼ n →∞ 0 otherwise . L 1 = 2 1 / 3 √ ρ − 1 ≈ 3 . 38298 . . . ρ − 1 3 ≈ 2 . 18225 . . . and Zbigniew Gołębiewski Asymptotics of BCI/BCK λ -terms in natural size CLA 2019
Affine λ -terms in natural size and de Bruijn indices equals 1 @ λ 0 λ 1 ≃ + + A 1 A 1 A 1 A 1 R 1 A 1 ( z ) = zA 1 ( z ) 2 + zA 1 ( z ) + zR 1 ( z ) @ @ ≃ + + R 1 1 R 1 A 1 A 1 R 1 z R 1 ( z ) = z + 2 zA 1 ( z ) R 1 ( z ) → R 1 ( z ) = 1 − 2 zA 1 ( z ) Zbigniew Gołębiewski Asymptotics of BCI/BCK λ -terms in natural size CLA 2019
Affine λ -terms in natural size and de Bruijn indices equals 1 Lemma Let A 1 ( z ) denote the OGF of closed affine λ -terms in natural size and de Bruijn indices equal to 1 . Then z 2 A 1 ( z ) = zA 1 ( z ) 2 + zA 1 ( z ) + 1 − 2 zA 1 ( z ) , 2 z 2 − 3 z A 1 ( z ) = − 6 z 2 � 3 46 z 6 + 18 z 5 − 9 z 4 + 3 √ 76 z 12 + 72 z 11 − 40 z 10 + 12 z 9 − 13 z 8 + 6 z 7 − z 6 � 3 + 6 z 2 − 4 z 4 + 6 z 3 − 3 z 2 , − � 6 z 2 3 46 z 6 + 18 z 5 − 9 z 4 + 3 √ � 76 z 12 + 72 z 11 − 40 z 10 + 12 z 9 − 13 z 8 + 6 z 7 − z 6 3 A 1 ( z ) = z + z 2 + z 3 + z 4 + 4 z 5 + 8 z 6 + 13 z 7 + 35 z 8 + 84 z 9 + 172 z 10 + . . . Zbigniew Gołębiewski Asymptotics of BCI/BCK λ -terms in natural size CLA 2019
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 n →∞ C A 1 n − 3 2 ρ − n a 1 , n ∼ A 1 , where ρ A 1 = RootOf [ − 1 + 6 x − 13 x 2 + 12 x 3 − 40 x 4 + 72 x 5 + 76 x 6 ] ≈ 0 . 372288 . . . and C A 1 ≈ 0 . 31462 . . . Zbigniew Gołębiewski Asymptotics of BCI/BCK λ -terms in natural size CLA 2019
Linear λ -terms in natural size and de Bruijn indices ≤ 2 Let P j denote a sub-term that is a path of left-right L k terms that finishes with a string of nodes of length j . @ @ P j ≃ + + j P j P j L k L k j z j P j ( z ) = z j + 2 zL k ( z ) P j ( z ) → P j ( z ) = 1 − 2 zL k ( z ) Zbigniew Gołębiewski Asymptotics of BCI/BCK λ -terms in natural size CLA 2019
Linear λ -terms in natural size and de Bruijn indices ≤ 2 λ 1 λ 2 @ ≃ + + L 2 L 2 L 2 R 1 R 2 L 2 ( z ) = zL 2 ( z ) 2 + zR 1 ( z ) + zR 2 ( z ) @ @ P 1 ≃ + + ≃ R 1 1 R 1 L 2 L 2 R 1 z R 1 ( z ) = z + 2 zR 1 ( z ) L 2 ( z ) → R 1 ( z ) = 1 − 2 zL 2 ( z ) = P 1 ( z ) Zbigniew Gołębiewski Asymptotics of BCI/BCK λ -terms in natural size CLA 2019
Linear λ -terms in natural size and de Bruijn indices ≤ 2 @ λ 1 λ 2 P 1 P 1 ≃ 2 × + 2 × + 2 × @ @ R 2 R 2 L 2 P 2 P 2 R 1 R 2 2 2 R 2 ( z ) = 2 zP 1 ( z ) 3 ( R 1 ( z ) + R 2 ( z )) Zbigniew Gołębiewski Asymptotics of BCI/BCK λ -terms in natural size CLA 2019
Linear λ -terms in natural size and de Bruijn indices ≤ 2 @ λ 1 λ 2 P 1 P 1 ≃ 2 × + 2 × + 2 × @ @ R 2 R 2 L 2 P 2 P 2 R 1 R 2 2 2 R 2 ( z ) = 2 zP 1 ( z ) 3 ( R 1 ( z ) + R 2 ( z )) L 2 ( z ) = zL 2 ( z ) 2 + R 2 ( z ) 2 P 1 ( z ) 3 Zbigniew Gołębiewski Asymptotics of BCI/BCK λ -terms in natural size CLA 2019
Linear λ -terms in natural size and de Bruijn indices ≤ 2 Lemma Let L 2 ( z ) denote the OGF of closed linear λ -terms in natural size and de Bruijn indices less or equal to 2 . Then L 2 ( z ) satisfies P ( z , L 2 ( z )) = 0 where P ( z , y ) = 8 y 5 z 4 − 20 y 4 z 3 + 18 y 3 z 2 + y 2 � 2 z 5 − 4 z 4 − 7 z − 2 z 4 + 4 z 3 + 1 − z 2 . � � � + y The coefficients of L 2 ( 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
Recommend
More recommend