A visualiser for linear lambda-terms as rooted 3-valent maps George Kaye University of Birmingham CLA’2019, July 1
Background George Kaye Outline • Background • Motivation • Demo • Future work CLA’2019 A visualiser for linear lambda terms as rooted 3-valent maps 2
Background George Kaye The lambda calculus A model of computation where programs are expressed using three constructs: variable x λ x.t abstraction t u application CLA’2019 A visualiser for linear lambda terms as rooted 3-valent maps 3
Background George Kaye The lambda calculus Variables can be bound or free λ x. x y bound free CLA’2019 A visualiser for linear lambda terms as rooted 3-valent maps 4
Background George Kaye The lambda calculus Terms that differ only by labels of variables are α -equivalent We can rename terms using α -conversion λ x. λ y. x y λ a. λ b. a b → ∝ CLA’2019 A visualiser for linear lambda terms as rooted 3-valent maps 5
Background George Kaye The lambda calculus Alternatively, we can use de Bruijn indices to represent the number of lambdas between a variable and where it was initially abstracted λ x. λ y. x y λ λ 1 0 ≡ This eliminates the need for ∝ -conversion CLA’2019 A visualiser for linear lambda terms as rooted 3-valent maps 6
Background George Kaye The lambda calculus Function application is performed by β -reduction on β -redexes : ( λ x. x) a → β x [x ↦ a] ≡ a • Repeatedly performing β -reduction is called normalisation • A term with no β -redexes is in its normal form CLA’2019 A visualiser for linear lambda terms as rooted 3-valent maps 7
Background George Kaye The lambda calculus • Every term has a single normal form • But there can be many different ways of reaching it • These represent different reduction strategies • We can represent this with a normalisation graph CLA’2019 A visualiser for linear lambda terms as rooted 3-valent maps 8
Background George Kaye The lambda calculus ( λ x. x) ( λ y. ( λ z. z) y) ( λ y. ( λ z. z) y) ( λ x. x) ( λ y. y) λ y. y CLA’2019 A visualiser for linear lambda terms as rooted 3-valent maps 9
Background George Kaye The lambda calculus Some terms do not have a computable normal form ( λ x. x x)( λ x. x x) → β x x [x ↦ ( λ x. x x)] ≡ (λx. x x)(λx. x x) CLA’2019 A visualiser for linear lambda terms as rooted 3-valent maps 10
Background George Kaye The lambda calculus Some terms do not have a computable normal form But they may still have a finite normalisation graph! ( λ x.x x)( λ x. x x) CLA’2019 A visualiser for linear lambda terms as rooted 3-valent maps 11
Background George Kaye Fragments of the lambda calculus • The pure lambda calculus contains all terms • The linear lambda calculus contains terms in which each variable is used exactly once • The planar lambda calculus contains linear terms in which each variable is used in the order of abstraction CLA’2019 A visualiser for linear lambda terms as rooted 3-valent maps 12
Background George Kaye Fragments of the lambda calculus λ x. x λ x. ( λ y. y) x λ x. λ y. x y λ x. λ y. y x λ x. x x λ x. λ y. x Pure CLA’2019 A visualiser for linear lambda terms as rooted 3-valent maps 13
Background George Kaye Fragments of the lambda calculus λ x. x λ x. ( λ y. y) x λ x. λ y. x y λ x. λ y. y x λ x. x x Linear λ x. λ y. x Pure CLA’2019 A visualiser for linear lambda terms as rooted 3-valent maps 14
Background George Kaye Fragments of the lambda calculus λ x. x λ x. ( λ y. y) x λ x. λ y. x y λ x. λ y. y x Planar λ x. x x Linear λ x. λ y. x Pure CLA’2019 A visualiser for linear lambda terms as rooted 3-valent maps 15
Background George Kaye Fragments of the lambda calculus • Linear (and planar) terms have special properties • Linearity and planarity are preserved by normalisation • All linear terms have a computable normal form • Normalisation of linear terms is efficient • Computing the normal form of a linear term is PTIME-complete Linear lambda calculus and PTIME-completeness (Mairson, 2004) • All paths to the normal form of a linear term are the same length CLA’2019 A visualiser for linear lambda terms as rooted 3-valent maps 16
Background George Kaye Lambda-terms as rooted maps t t x λ @ λx.t u t u We can build up term maps by combining these nodes and a special node called the root , which represents the complete term CLA’2019 A visualiser for linear lambda terms as rooted 3-valent maps 17
Background George Kaye Lambda-terms as rooted maps @ y z @ λx . λy . λz . x (y z) z x (y z) λ λz . x (y z) y λ λy . λz . x (y z) x λ root λx . λy . λz . x (y z) CLA’2019 A visualiser for linear lambda terms as rooted 3-valent maps 18
Background George Kaye Lambda-terms as rooted maps λx . λy . λz . x (y z) Removing the labels and arrows turns this into a rooted map CLA’2019 A visualiser for linear lambda terms as rooted 3-valent maps 19
Background George Kaye Lambda-terms as rooted maps @ y z @ λx . λy . λz . x (y z) z x (y z) λ This term is λz . x (y z) y λ linear: the map is 3-valent planar: there are no crossings λy . λz . x (y z) x λ λx . λy . λz . x (y z) CLA’2019 A visualiser for linear lambda terms as rooted 3-valent maps 20
Background George Kaye Lambda-terms as rooted maps @ z y @ λx . λy . λz . x (z y) z x (z y) λ This term is λz . x (z y) y λ linear: the map is 3-valent non-planar: there is one crossing λy . λz . x (z y) x λ λx . λy . λz . x (z y) CLA’2019 A visualiser for linear lambda terms as rooted 3-valent maps 21
Background George Kaye Beta reduction t x λ (λx.t) u λx.t @ u (λx.t) u CLA’2019 A visualiser for linear lambda terms as rooted 3-valent maps 22
Background George Kaye Beta reduction t [x ↦ u] t [x ↦ u] u CLA’2019 A visualiser for linear lambda terms as rooted 3-valent maps 23
Motivation George Kaye Outline • Background • Motivation • Demo • Future work CLA’2019 A visualiser for linear lambda terms as rooted 3-valent maps 24
Motivation George Kaye Motivation • It can be interesting to examine the different topological properties shared between the maps of terms • We can perform experimental mathematics with these maps • We want to be able to test conjectures about these maps • But drawing them can be time-consuming... • So why not get something to do it for us! CLA’2019 A visualiser for linear lambda terms as rooted 3-valent maps 25
Demo George Kaye Outline • Background • Motivation • Demo • Future work CLA’2019 A visualiser for linear lambda terms as rooted 3-valent maps 26
Demo George Kaye Demo https://www.georgejkaye.com/pages/fyp/visualiser.html term context of free variables associate terms with labels CLA’2019 A visualiser for linear lambda terms as rooted 3-valent maps 27
Demo George Kaye Demo https://www.georgejkaye.com/pages/fyp/visualiser.html CLA’2019 A visualiser for linear lambda terms as rooted 3-valent maps 28
Demo George Kaye Demo https://www.georgejkaye.com/pages/fyp/visualiser.html The redexes in the term are listed alongside the map CLA’2019 A visualiser for linear lambda terms as rooted 3-valent maps 29
Demo George Kaye Demo https://www.georgejkaye.com/pages/fyp/visualiser.html Hovering over a redex in the list will highlight it in the term and the map CLA’2019 A visualiser for linear lambda terms as rooted 3-valent maps 30
Demo George Kaye Demo https://www.georgejkaye.com/pages/fyp/visualiser.html We can generate normalisation graphs CLA’2019 A visualiser for linear lambda terms as rooted 3-valent maps 31
Demo George Kaye Demo https://www.georgejkaye.com/pages/fyp/visualiser.html We can visualise pure terms too! CLA’2019 A visualiser for linear lambda terms as rooted 3-valent maps 32
Demo George Kaye Demo https://www.georgejkaye.com/pages/fyp/visualiser.html And their normalisation graphs if they’re finite (infinite graphs will give up after ~100 reductions) CLA’2019 A visualiser for linear lambda terms as rooted 3-valent maps 33
Demo George Kaye Demo https://www.georgejkaye.com/pages/fyp/visualiser.html Examples using Mairson’s Boolean circuit encodings CLA’2019 A visualiser for linear lambda terms as rooted 3-valent maps 34
Demo George Kaye Demo https://www.georgejkaye.com/pages/fyp/visualiser.html CLA’2019 A visualiser for linear lambda terms as rooted 3-valent maps 35
Demo George Kaye Demo https://www.georgejkaye.com/pages/fyp/visualiser.html normalises to CLA’2019 A visualiser for linear lambda terms as rooted 3-valent maps 36
Demo George Kaye Demo https://www.georgejkaye.com/pages/fyp/visualiser.html CLA’2019 A visualiser for linear lambda terms as rooted 3-valent maps 37
Demo George Kaye Demo https://www.georgejkaye.com/pages/fyp/visualiser.html normalises to CLA’2019 A visualiser for linear lambda terms as rooted 3-valent maps 38
Demo George Kaye Demo https://www.georgejkaye.com/pages/fyp/visualiser.html Normalisation graph of CLA’2019 A visualiser for linear lambda terms as rooted 3-valent maps 39
Recommend
More recommend