Higher connectivity in linear λ -terms as 3-valent graphs Noam Zeilberger an update on work-in-progress w/Jason Reed also showcasing some tools by George Kaye SYCO 5 @ bham! 4-sep-2019
[Background] A few views on linear & planar λ -calculus λ x. λ y. λ z.x(yz) λ x. λ y. λ z.x(yz) λ x. λ y. λ z.(xz)y λ x. λ y. λ z.(xz)y x,y ⊢ (xy)( λ z.z) x,y ⊢ (xy)( λ z.z) x,y ⊢ x(( λ z.z)y) x,y ⊢ x(( λ z.z)y)
Classical lambda calculus Raw syntax: t ::= x | t ₁ t ₂ | λ x.t ₁ variable application abstraction Rewriting rules: ( λ x.t ₁ ) t ₂ → β t ₁ [t ₂ /x] t → η λ x.(t x) α -equivalence: names are just placeholders λ x. λ y.x (y x) ≡ α λ y. λ x.y (x y) ≡ α λ a. λ b.a (b a)
Linear lambda calculus free An abstraction λ x.t is said to bind the occurrences of x in t λ y.x (y x) A variable which is not bound by any λ is said to be free bound A term is called linear if every free or bound variable occurs exactly once λ x. λ y. λ z.x (y z) λ x. λ y.x (y x) λ x. λ y. λ z.(x z) y λ x. λ y.x linear! non-linear! Fun fact: β -normalization of linear terms is PTIME-complete (Mairson 2004)
Planar lambda calculus (cf. Abramsky, "T emperley-Lieb Algebra: From Knot Theory to Logic & Computation via QM") A (closed) linear term is called ordered (or planar ) if every variable is used in the order it is bound... λ x. λ y. λ z.x (y z) λ x. λ y. λ z.(x z) y non-ordered! ordered! (The reason why ordered=planar will become clear later.) Open problem: how hard is β -normalization of ordered linear terms?
Linear lambda calculus, take #2 (cf. Hyland, "Classical lambda calculus in modern dress") Untyped linear terms may be naturally organized into a symmetric operad • Λ (n) = set of α -equivalence classes of linear terms in context x ₁ ,...,x ₙ ⊢ t Γ , x ⊢ t ₁ Γ ⊢ t ₁ Δ ⊢ t ₂ Γ , Δ ⊢ t ₁ t ₂ x ⊢ x Γ ⊢ λ x.t ₁ • ∘ᵢ : Λ (m+1) × Λ (n) → Λ (m+n) de fi ned by (linear) substitution Θ ⊢ t ₂ Γ ,x, Δ ⊢ t ₁ Γ , Θ , Δ ⊢ t ₁ [t ₂ /x] • symmetric action S ₙ × Λ (n) → Λ (n) de fi ned by permuting the context Γ ,y,x, Δ ⊢ t Γ ,x,y, Δ ⊢ t Untyped ordered terms form a plain operad: just drop the symmetric action
Linear lambda calculus, take #3 (cf. Lambek, "Deductive systems and categories") T yped linear terms modulo βη may also be seen as a presentation of the free closed symmetric multicategory over a set of atomic types Γ , x : A ⊢ t : B Γ ⊢ t : A ⊸ B Δ ⊢ u : A Γ , Δ ⊢ t u : B x : A ⊢ x : A Γ ⊢ λ x.t : A ⊸ B (A multicategory M is closed if for any pair of objects A,B there is a binary map eval A ⊸ B, A B together with a family of bijections on multi-hom-sets λ : M( Γ ,A ; B) ≅ M( Γ ; A ⊸ B) whose inverse is the operation of post-composition with eval.)
Linear lambda calculus, take #4 (cf. Scott, "Relating theories of the λ -calculus") Combining takes #2 and #3, untyped linear terms may be interpreted as endomorphisms of a re fl exive object in a closed symmetric (2-)multicategory. By "re fl exive object" we mean (with a bit of ambiguity) an object U equipped with an isomorphism/section/adjunction to its space of endomorphisms: app lam With the most liberal de fi nition, the 2-cells app ∘ lam ⇒ id and id ⇒ lam ∘ app model β -reduction and η -expansion.
From re fl exive objects to HOAS Representation of untyped terms using higher-order abstract syntax (in T welf): u : type. app : u -> (u -> u). lam : (u -> u) -> u. t1 : u = lam [x] lam [y] lam [z] app x (app y z). t2 : u = lam [x] lam [y] lam [z] app (app x z) y. t3 : u -> u -> u = [x] [y] app (app x y) (lam [z] z). t4 : u = lam [x] lam [y] app x (app y x). t5 : u -> u = [x] lam [y] x.
From re fl exive objects to string diagrams A compact closed category is a particular kind of closed category in which A ⊸ B ≈ B ⊗ A*. By interpreting re fl exive objects in the graphical language of compact closed (2-)categories, we derive a graphical representation for linear terms. λ @
From re fl exive objects to string diagrams Some examples: lam [x] lam [y] lam [z] app x (app y z) lam [x] lam [y] lam [z] app (app x z) y [x] [y] app (app x y) (lam [z] z) T o play more with these kinds of diagrams, try: https://www.georgejkaye.com/fyp/visualiser.html https://www.georgejkaye.com/fyp/gallery
An idea from the folklore Representing λ -terms this way is an old idea (just under di ff erent names)... Knuth (1970), "Examples of Formal Semantics" Statman (1974), "Structural complexity of proofs" corresponding HOAS: corresponding HOAS: [x] app (lam [y] lam [z] app y z) x lam [x] lam [y] lam [z] app x (app y z)
67. ( λ a.a) (( λ b.b) (( λ c.c) ( λ d.d))) 100. ( λ a.a) ( λ b. λ c.b ( λ d.d c)) 1. λ a.a 34. λ a.( λ b. λ c.c b) a [Background] [Background] 68. ( λ a.a) (( λ b.b) ( λ c.c ( λ d.d))) 101. ( λ a.a) ( λ b. λ c.(b ( λ d.d)) c) 2. ( λ a.a) ( λ b.b) 35. λ a. λ b.(a b) ( λ c.c) 69. ( λ a.a) (( λ b.b) ( λ c.( λ d.d) c)) 102. ( λ a.a) ( λ b. λ c.(( λ d.d) b) c) 3. λ a.a ( λ b.b) 36. λ a. λ b.(b a) ( λ c.c) 70. ( λ a.a) (( λ b.b) ( λ c. λ d.c d)) 103. ( λ a.a) ( λ b. λ c.( λ d.b d) c) 4. λ a.( λ b.b) a 37. λ a. λ b.a (b ( λ c.c)) 71. ( λ a.a) (( λ b.b) ( λ c. λ d.d c)) 104. ( λ a.a) ( λ b. λ c.( λ d.d b) c) 5. λ a. λ b.a b 38. λ a. λ b.a (( λ c.c) b) 72. ( λ a.a) ((( λ b.b) ( λ c.c)) ( λ d.d)) 105. ( λ a.a) ( λ b. λ c.c (b ( λ d.d))) 6. λ a. λ b.b a 39. λ a. λ b.a ( λ c.b c) 73. ( λ a.a) (( λ b.b ( λ c.c)) ( λ d.d)) 106. ( λ a.a) ( λ b. λ c.c (( λ d.d) b)) 7. ( λ a.a) (( λ b.b) ( λ c.c)) 40. λ a. λ b.a ( λ c.c b) 74. ( λ a.a) (( λ b.( λ c.c) b) ( λ d.d)) 107. ( λ a.a) ( λ b. λ c.c ( λ d.b d)) 8. ( λ a.a) ( λ b.b ( λ c.c)) 41. λ a. λ b.(a ( λ c.c)) b 75. ( λ a.a) (( λ b. λ c.b c) ( λ d.d)) 108. ( λ a.a) ( λ b. λ c.c ( λ d.d b)) 9. ( λ a.a) ( λ b.( λ c.c) b) 42. λ a. λ b.(( λ c.c) a) b 76. ( λ a.a) (( λ b. λ c.c b) ( λ d.d)) 109. ( λ a.a) ( λ b. λ c.(c ( λ d.d)) b) 10. ( λ a.a) ( λ b. λ c.b c) 43. λ a. λ b.( λ c.a c) b 77. ( λ a.a) ( λ b.b (( λ c.c) ( λ d.d))) 110. ( λ a.a) ( λ b. λ c.(( λ d.d) c) b) 11. ( λ a.a) ( λ b. λ c.c b) 44. λ a. λ b.( λ c.c a) b 78. ( λ a.a) ( λ b.b ( λ c.c ( λ d.d))) 111. ( λ a.a) ( λ b. λ c.( λ d.c d) b) 12. (( λ a.a) ( λ b.b)) ( λ c.c) 45. λ a. λ b.b (a ( λ c.c)) The surprising combinatorics 79. ( λ a.a) ( λ b.b ( λ c.( λ d.d) c)) 112. ( λ a.a) ( λ b. λ c.( λ d.d c) b) 13. ( λ a.a ( λ b.b)) ( λ c.c) 46. λ a. λ b.b (( λ c.c) a) 80. ( λ a.a) ( λ b.b ( λ c. λ d.c d)) 113. ( λ a.a) ( λ b. λ c.( λ d.d) (b c)) 14. ( λ a.( λ b.b) a) ( λ c.c) 47. λ a. λ b.b ( λ c.a c) 15. ( λ a. λ b.a b) ( λ c.c) 48. λ a. λ b.b ( λ c.c a) 81. ( λ a.a) ( λ b.b ( λ c. λ d.d c)) 114. ( λ a.a) ( λ b. λ c.( λ d.d) (c b)) 16. ( λ a. λ b.b a) ( λ c.c) 49. λ a. λ b.(b ( λ c.c)) a 82. ( λ a.a) ( λ b.(b ( λ c.c)) ( λ d.d)) 115. ( λ a.a) ( λ b. λ c. λ d.(b c) d) 17. λ a.a (( λ b.b) ( λ c.c)) 50. λ a. λ b.(( λ c.c) b) a 83. ( λ a.a) ( λ b.(( λ c.c) b) ( λ d.d)) 116. ( λ a.a) ( λ b. λ c. λ d.(c b) d) of linear λ -terms 18. λ a.a ( λ b.b ( λ c.c)) 51. λ a. λ b.( λ c.b c) a 84. ( λ a.a) ( λ b.( λ c.b c) ( λ d.d)) 117. ( λ a.a) ( λ b. λ c. λ d.(b d) c) 19. λ a.a ( λ b.( λ c.c) b) 52. λ a. λ b.( λ c.c b) a 85. ( λ a.a) ( λ b.( λ c.c b) ( λ d.d)) 118. ( λ a.a) ( λ b. λ c. λ d.(d b) c) 20. λ a.a ( λ b. λ c.b c) 53. λ a. λ b.( λ c.c) (a b) 86. ( λ a.a) ( λ b.( λ c.c) (b ( λ d.d))) 119. ( λ a.a) ( λ b. λ c. λ d.b (c d)) 21. λ a.a ( λ b. λ c.c b) 54. λ a. λ b.( λ c.c) (b a) 87. ( λ a.a) ( λ b.( λ c.c) (( λ d.d) b)) 120. ( λ a.a) ( λ b. λ c. λ d.b (d c)) 22. λ a.(a ( λ b.b)) ( λ c.c) 55. λ a. λ b. λ c.(a b) c 88. ( λ a.a) ( λ b.( λ c.c) ( λ d.b d)) 121. ( λ a.a) ( λ b. λ c. λ d.(c d) b) 23. λ a.(( λ b.b) a) ( λ c.c) 56. λ a. λ b. λ c.(b a) c 89. ( λ a.a) ( λ b.( λ c.c) ( λ d.d b)) 122. ( λ a.a) ( λ b. λ c. λ d.(d c) b) 24. λ a.( λ b.a b) ( λ c.c) 57. λ a. λ b. λ c.(a c) b 90. ( λ a.a) ( λ b.(( λ c.c) ( λ d.d)) b) 123. ( λ a.a) ( λ b. λ c. λ d.c (b d)) 25. λ a.( λ b.b a) ( λ c.c) 58. λ a. λ b. λ c.(c a) b 91. ( λ a.a) ( λ b.( λ c.c ( λ d.d)) b) 124. ( λ a.a) ( λ b. λ c. λ d.c (d b)) 26. λ a.( λ b.b) (a ( λ c.c)) 59. λ a. λ b. λ c.a (b c) 92. ( λ a.a) ( λ b.( λ c.( λ d.d) c) b) 125. ( λ a.a) ( λ b. λ c. λ d.d (b c)) 27. λ a.( λ b.b) (( λ c.c) a) 60. λ a. λ b. λ c.a (c b) 93. ( λ a.a) ( λ b.( λ c. λ d.c d) b) 126. ( λ a.a) ( λ b. λ c. λ d.d (c b)) 28. λ a.( λ b.b) ( λ c.a c) 61. λ a. λ b. λ c.(b c) a 94. ( λ a.a) ( λ b.( λ c. λ d.d c) b) 127. (( λ a.a) ( λ b.b)) (( λ c.c) ( λ d.d)) 29. λ a.( λ b.b) ( λ c.c a) 62. λ a. λ b. λ c.(c b) a 95. ( λ a.a) ( λ b. λ c.(b c) ( λ d.d)) 128. (( λ a.a) ( λ b.b)) ( λ c.c ( λ d.d)) 30. λ a.(( λ b.b) ( λ c.c)) a 63. λ a. λ b. λ c.b (a c) 96. ( λ a.a) ( λ b. λ c.(c b) ( λ d.d)) 129. (( λ a.a) ( λ b.b)) ( λ c.( λ d.d) c) 31. λ a.( λ b.b ( λ c.c)) a 64. λ a. λ b. λ c.b (c a) 97. ( λ a.a) ( λ b. λ c.b (c ( λ d.d))) 130. (( λ a.a) ( λ b.b)) ( λ c. λ d.c d) 32. λ a.( λ b.( λ c.c) b) a 65. λ a. λ b. λ c.c (a b) 98. ( λ a.a) ( λ b. λ c.b (( λ d.d) c)) 131. (( λ a.a) ( λ b.b)) ( λ c. λ d.d c) 33. λ a.( λ b. λ c.b c) a 66. λ a. λ b. λ c.c (b a) 99. ( λ a.a) ( λ b. λ c.b ( λ d.c d)) 132. ( λ a.a ( λ b.b)) (( λ c.c) ( λ d.d))
Recommend
More recommend