almost every simply typed lambda term has a long beta
play

ALMOST EVERY SIMPLY TYPED LAMBDA TERM HAS A LONG BETA-REDUCTION - PowerPoint PPT Presentation

ALMOST EVERY SIMPLY TYPED LAMBDA TERM HAS A LONG BETA-REDUCTION SEQUENCE KAZUYUKI ASADA RYOMA SINYA TAKESHI TSUKADA NAOKI KOBAYASHI (THE UNIVERSITY OF TOKYO) MOTIVATION A simply-typed term can have a very long -reduction


  1. λ ALMOST EVERY SIMPLY TYPED LAMBDA TERM HAS A LONG BETA-REDUCTION SEQUENCE KAZUYUKI ASADA RYOMA SIN’YA TAKESHI TSUKADA NAOKI KOBAYASHI (THE UNIVERSITY OF TOKYO)

  2. MOTIVATION • A simply-typed term can have a very long β -reduction sequence. • k -EXP in the size of terms of order k [Beckmann 2001] . 0-EXP( n ) = n ( m + 1)-EXP( n ) = 2 m -EXP(n) • How many terms have such long β -reduction sequences?

  3. MOTIVATION • A simply-typed term can have a very long β -reduction sequence. • k -EXP in the size of terms of order k [Beckmann 2001] . ( Twice ) n Twice · · · Twice e.g. ( λ x.bxx )(( λ x.x ) c ) | {z } k − 2 times where Twice = λ f. λ x.f ( f x ) • How many terms have such long β -reduction sequences?

  4. SIDE REMARK • The work has been motivated by quantitative analysis of the complexity of higher-order model checking (HOMC). HIGHER-ORDER MODEL CHECKING [Ong 2006] • Input : tree automaton and λ Y-term t . 
 A Output : YES if accepts the infinite tree 
 A represented by t, NO otherwise. 
 Complexity: k -EXPTIME-complete for order- k λ Y-terms. • We want to ( dis )prove: HOMC can be efficiently solved for almost every input .

  5. RELATED WORK • Quantitative analysis of untyped terms: • Almost every λ -term is strongly normalizing ( SN ), but almost every SK-combinatory term is not SN 
 [David et al. 2009]. • Almost every de Bruijn λ -term is not SN [Bendkowski et al. 2015]. • Empirical results: almost every λ -term is not β -normal, untypable [Grygiel-Lescanne 2013].

  6. RELATED WORK • Quantitative analysis of untyped terms: • Almost every λ -term is strongly normalizing ( SN ), but almost every SK-combinatory term is not SN 
 [David et al. 2009]. • Almost every de Bruijn λ -term is not SN [Bendkowski et al. 2015]. • Empirical results: almost every λ -term is not β -normal, untypable [Grygiel-Lescanne 2013]. • Quantitative analysis of typed terms: little is known.

  7. OUTLINE λ •Introduction •Our result •Proof of our result •Conclusion

  8. OUR RESULT For and , k, ι , ξ ≥ 2 k ≤ ι # { [ t ] α ∈ Λ α n ( k, ι , ξ ) } | β ( t ) ≥ ( k − 2)-EXP( n ) } lim = 1 . # Λ α n ( k, ι , ξ ) n →∞ : the set of α -equivalence classes of size- n 
 n ( k, ι , ξ ) Λ α terms such that: (1) the o rder is at most . k (2) the number of arguments ( internal arity ) is at most . ι (3) the number of distinct variables is at most . ξ

  9. OUR RESULT the maximum length of 
 β -reduction sequences of t. For and , k, ι , ξ ≥ 2 k ≤ ι # { [ t ] α ∈ Λ α n ( k, ι , ξ ) } | β ( t ) ≥ ( k − 2)-EXP( n ) } lim = 1 . # Λ α n ( k, ι , ξ ) n →∞ : the set of α -equivalence classes of size- n 
 n ( k, ι , ξ ) Λ α terms such that: (1) the o rder is at most . k (2) the number of arguments ( internal arity ) is at most . ι (3) the number of distinct variables is at most . ξ

  10. OUR RESULT the maximum length of 
 β -reduction sequences of t. For and , k, ι , ξ ≥ 2 k ≤ ι # { [ t ] α ∈ Λ α n ( k, ι , ξ ) } | β ( t ) ≥ ( k − 2)-EXP( n ) } lim = 1 . # Λ α n ( k, ι , ξ ) n →∞ : the set of α -equivalence classes of size- n 
 n ( k, ι , ξ ) Λ α terms such that: (1) the o rder is at most . k (2) the number of arguments ( internal arity ) is at most . ι (3) the number of distinct variables is at most . ξ

  11. OUR RESULT the maximum length of 
 β -reduction sequences of t. For and , k, ι , ξ ≥ 2 k ≤ ι # { [ t ] α ∈ Λ α n ( k, ι , ξ ) } | β ( t ) ≥ ( k − 2)-EXP( n ) } lim = 1 . # Λ α n ( k, ι , ξ ) n →∞ Almost every term of size n and order at most k has a β -reduction sequence of length ( k-2 ) - EXP( n ). : the set of α -equivalence classes of size- n 
 n ( k, ι , ξ ) Λ α terms such that: (1) the o rder is at most . k (2) the number of arguments ( internal arity ) is at most . ι (3) the number of distinct variables is at most . ξ

  12. OUR RESULT For and , k, ι , ξ ≥ 2 k ≤ ι # { [ t ] α ∈ Λ α n ( k, ι , ξ ) } | β ( t ) ≥ ( k − 2)-EXP( n ) } lim = 1 . # Λ α n ( k, ι , ξ ) n →∞ : the set of α -equivalence classes of size- n 
 n ( k, ι , ξ ) Λ α terms such that: (1) the o rder is at most . k (2) the number of arguments ( internal arity ) is at most . ι (3) the number of distinct variables is at most . ξ

  13. NUMBER OF DISTINCT VARIABLES • : the # of variables in t excluding unused # V ( t ) variables . • For an α -equivalence class , [ t ] α # V α ([ t ] α ) , min { # V ( t 0 ) | t 0 ∈ [ t ] α }

  14. NUMBER OF DISTINCT VARIABLES • : the # of variables in t excluding unused # V ( t ) variables . • For an α -equivalence class , [ t ] α # V α ([ t ] α ) , min { # V ( t 0 ) | t 0 ∈ [ t ] α } Example # V α ([( λ z.z ) λ y.x ] α ) = ?

  15. NUMBER OF DISTINCT VARIABLES • : the # of variables in t excluding unused # V ( t ) variables . • For an α -equivalence class , [ t ] α # V α ([ t ] α ) , min { # V ( t 0 ) | t 0 ∈ [ t ] α } Example # V α ([( λ z.z ) λ y.x ] α ) = ? # V (( λ z.z ) λ y.x ) = # { x, z } = 2

  16. NUMBER OF DISTINCT VARIABLES • : the # of variables in t excluding unused # V ( t ) variables . • For an α -equivalence class , [ t ] α # V α ([ t ] α ) , min { # V ( t 0 ) | t 0 ∈ [ t ] α } Example # V α ([( λ z.z ) λ y.x ] α ) = ? # V (( λ z.z ) λ y.x ) = # { x, z } = 2

  17. NUMBER OF DISTINCT VARIABLES • : the # of variables in t excluding unused # V ( t ) variables . • For an α -equivalence class , [ t ] α # V α ([ t ] α ) , min { # V ( t 0 ) | t 0 ∈ [ t ] α } Example # V α ([( λ z.z ) λ y.x ] α ) = ? # V (( λ z.z ) λ y.x ) = # { x, z } = 2 # V (( λ x.x ) λ y.x ) = # { x } = 1

  18. NUMBER OF DISTINCT VARIABLES • : the # of variables in t excluding unused # V ( t ) variables . • For an α -equivalence class , [ t ] α # V α ([ t ] α ) , min { # V ( t 0 ) | t 0 ∈ [ t ] α } Example # V α ([( λ z.z ) λ y.x ] α ) = 1 # V (( λ z.z ) λ y.x ) = # { x, z } = 2 # V (( λ x.x ) λ y.x ) = # { x } = 1

  19. OUR RESULT For and , k, ι , ξ ≥ 2 k ≤ ι # { [ t ] α ∈ Λ α n ( k, ι , ξ ) } | β ( t ) ≥ ( k − 2)-EXP( n ) } lim = 1 . # Λ α n ( k, ι , ξ ) n →∞ : the set of α -equivalence classes of size- n 
 n ( k, ι , ξ ) Λ α terms such that: (1) the o rder is at most . k (2) the number of arguments ( internal arity ) is at most . ι (3) the number of distinct variables is at most . ξ # V α ([ t ] α ) ≤ ξ for every [ t ] α ∈ Λ α n ( k, ι , ξ )

  20. OUTLINE λ •Introduction •Our result •Proof of our result •Conclusion

  21. OVERVIEW OF OUR PROOF • Almost every term contains a certain “context” that has a very long β -reduction sequence.

  22. OVERVIEW OF OUR PROOF • Almost every term contains a certain “context” that has a very long β -reduction sequence.

  23. OVERVIEW OF OUR PROOF • Almost every term contains a certain “context” that has a very long β -reduction sequence. • Inspired by Infinite Monkey Theorem : for any word x, almost every word contains x as a subword.

  24. 
 OUTLINE λ •Introduction •Our result •Proof of our result 
 • Idea • Infinite Monkey Theorem • Decomposition of terms • Sketch of the proof •Conclusion

  25. PROOF IDEA 1. Parameterizing Infinite Monkey Theorem. 2. Extending (1) to λ -terms. 3. Constructing “explosive context” that generates a long β -reduction sequence.

  26. INFINITE MONKEY THEOREM For any word over an alphabet A, x # { w 2 A n | x v w } = 1 . lim # A n n →∞ for some words u, v ∈ A ∗ . x v w , w = uxv

  27. INFINITE MONKEY THEOREM For any word over an alphabet A, x # { w 2 A n | x v w } = 1 . lim # A n n →∞ for some words u, v ∈ A ∗ . x v w , w = uxv

  28. IDEA1: PARAMETERIZING INFINITE MONKEY THEOREM For any family of words over A such that ( x n ) n | x n | = d log (2) ( n ) e , # { w 2 A n | x n v w } = 1 . lim # A n n →∞ log (2) ( n ) = log(log( n ))

  29. IDEA2: EXTENDING IDEA1 TO TERMS For any family of contexts such that ( C n ) n | C n | = d log (2) ( n ) e , # { [ t ] α 2 Λ α n ( k, ι , ξ ) } | C n � t } lim = 1 . # Λ α n ( k, ι , ξ ) n →∞ if . k, ι , ξ ≥ 2 for some context and term . t = C 0 [ C [ t 0 ]] t 0 C � t ⇔ C 0

  30. IDEA3: CONSTRUCTING “EXPLOSIVE” CONTEXT • For parameters n and k, we define the explosive k context of order- k as: n � � ( Twice ) n Twice · · · Twice Dup ( Id [ ]) λ x. | {z } k − 2 times where Twice = λ f. λ x.f ( f x ) Dup = λ x. ( λ y. λ z.y ) xx and Id = λ x.x

  31. IDEA3: CONSTRUCTING “EXPLOSIVE” CONTEXT • For parameters n and k, we define the explosive k context of order- k as: n � � ( Twice ) n Twice · · · Twice Dup ( Id [ ]) λ x. | {z } k − 2 times where Twice = λ f. λ x.f ( f x ) Dup = λ x. ( λ y. λ z.y ) xx and Id = λ x.x • It has the following “explosive property”: ⇣ ⌘ k ≥ k -EXP(n) β n

Recommend


More recommend