A visualiser for linear lambda-terms as rooted 3-valent maps - - PowerPoint PPT Presentation
A visualiser for linear lambda-terms as rooted 3-valent maps - - PowerPoint PPT Presentation
A visualiser for linear lambda-terms as rooted 3-valent maps George Kaye University of Birmingham CLA2019, July 1 Background George Kaye Outline Background Motivation Demo Future work CLA2019 A visualiser for
CLA’2019 George Kaye
Outline
- Background
- Motivation
- Demo
- Future work
A visualiser for linear lambda terms as rooted 3-valent maps 2 Background
CLA’2019 George Kaye
The lambda calculus x λx.t t u
A visualiser for linear lambda terms as rooted 3-valent maps 3 Background
variable
A model of computation where programs are expressed using three constructs:
abstraction application
CLA’2019 George Kaye
The lambda calculus λx. x y
A visualiser for linear lambda terms as rooted 3-valent maps 4 Background
Variables can be bound or free bound free
CLA’2019 George Kaye
The lambda calculus λx.λy. x y
A visualiser for linear lambda terms as rooted 3-valent maps 5 Background
Terms that differ only by labels of variables are α-equivalent We can rename terms using α-conversion
λa.λb. a b →∝
CLA’2019 George Kaye
The lambda calculus
A visualiser for linear lambda terms as rooted 3-valent maps 6 Background
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 George Kaye
The lambda calculus (λx. x) a
A visualiser for linear lambda terms as rooted 3-valent maps 7 Background
Function application is performed by β-reduction on β-redexes:
→β x [x ↦ a] ≡ a
- Repeatedly performing β-reduction is called normalisation
- A term with no β-redexes is in its normal form
CLA’2019 George Kaye
The lambda calculus
A visualiser for linear lambda terms as rooted 3-valent maps 8 Background
- 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 George Kaye
The lambda calculus
A visualiser for linear lambda terms as rooted 3-valent maps 9 Background
(λy. (λz. z) y) (λx. x) (λy. y) λy. y (λx. x) (λy. (λz. z) y)
CLA’2019 George Kaye
The lambda calculus
A visualiser for linear lambda terms as rooted 3-valent maps 10 Background
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 George Kaye
The lambda calculus
A visualiser for linear lambda terms as rooted 3-valent maps 11 Background
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 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
A visualiser for linear lambda terms as rooted 3-valent maps 12 Background
CLA’2019 George Kaye A visualiser for linear lambda terms as rooted 3-valent maps 13
Pure
λx. x λx. (λy. y) x λx.λy. x y λx.λy. y x λx. x x λx.λy. x
Background
Fragments of the lambda calculus
CLA’2019 George Kaye A visualiser for linear lambda terms as rooted 3-valent maps 14
Pure
λx. x λx. (λy. y) x λx.λy. x y λx.λy. y x λx. x x λx.λy. x
Background
Fragments of the lambda calculus
Linear
CLA’2019 George Kaye A visualiser for linear lambda terms as rooted 3-valent maps 15
Pure
λx. x λx. (λy. y) x λx.λy. x y λx.λy. y x λx. x x λx.λy. x
Background
Fragments of the lambda calculus
Linear Planar
CLA’2019 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
A visualiser for linear lambda terms as rooted 3-valent maps 16 Background
CLA’2019 George Kaye
@
A visualiser for linear lambda terms as rooted 3-valent maps 17
λ
t λx.t x t t u u
Background
Lambda-terms as rooted maps
We can build up term maps by combining these nodes and a special node called the root, which represents the complete term
CLA’2019 George Kaye A visualiser for linear lambda terms as rooted 3-valent maps 18
λx. λy. λz. x (y z)
Background
λ λ λ
λx. λy. λz. x (y z) λy. λz. x (y z) λz. x (y z) x (y z) y z x y z
@ @
Lambda-terms as rooted maps
root
CLA’2019 George Kaye A visualiser for linear lambda terms as rooted 3-valent maps 19
λx. λy. λz. x (y z)
Background
Lambda-terms as rooted maps
Removing the labels and arrows turns this into a rooted map
CLA’2019 George Kaye A visualiser for linear lambda terms as rooted 3-valent maps 20
λx. λy. λz. x (y z)
Background
λ λ λ
λx. λy. λz. x (y z) λy. λz. x (y z) λz. x (y z) x (y z) y z x y z
@ @
Lambda-terms as rooted maps
This term is linear: the map is 3-valent planar: there are no crossings
CLA’2019 George Kaye A visualiser for linear lambda terms as rooted 3-valent maps 21
λx. λy. λz. x (z y)
Background
λ λ λ
λx. λy. λz. x (z y) λy. λz. x (z y) λz. x (z y) x (z y) z y x y z
@ @
Lambda-terms as rooted maps
This term is linear: the map is 3-valent non-planar: there is one crossing
CLA’2019 George Kaye
Beta reduction
A visualiser for linear lambda terms as rooted 3-valent maps 22
λ
t λx.t x
@
(λx.t) u u
(λx.t) u
Background
CLA’2019 George Kaye
Beta reduction
A visualiser for linear lambda terms as rooted 3-valent maps 23
t [x ↦ u]
t [x ↦ u] u
Background
CLA’2019 George Kaye
Outline
- Background
- Motivation
- Demo
- Future work
A visualiser for linear lambda terms as rooted 3-valent maps 24 Motivation
CLA’2019 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!
A visualiser for linear lambda terms as rooted 3-valent maps 25 Motivation
CLA’2019 George Kaye
Outline
- Background
- Motivation
- Demo
- Future work
A visualiser for linear lambda terms as rooted 3-valent maps 26 Demo
CLA’2019 George Kaye
Demo
A visualiser for linear lambda terms as rooted 3-valent maps 27 Demo
https://www.georgejkaye.com/pages/fyp/visualiser.html term context of free variables associate terms with labels
CLA’2019 George Kaye
Demo
A visualiser for linear lambda terms as rooted 3-valent maps 28 Demo
https://www.georgejkaye.com/pages/fyp/visualiser.html
CLA’2019 George Kaye
Demo
A visualiser for linear lambda terms as rooted 3-valent maps 29 Demo
https://www.georgejkaye.com/pages/fyp/visualiser.html
The redexes in the term are listed alongside the map
CLA’2019 George Kaye
Demo
A visualiser for linear lambda terms as rooted 3-valent maps 30 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 George Kaye
Demo
A visualiser for linear lambda terms as rooted 3-valent maps 31 Demo
https://www.georgejkaye.com/pages/fyp/visualiser.html
We can generate normalisation graphs
CLA’2019 George Kaye
Demo
A visualiser for linear lambda terms as rooted 3-valent maps 32 Demo
https://www.georgejkaye.com/pages/fyp/visualiser.html
We can visualise pure terms too!
CLA’2019 George Kaye
Demo
A visualiser for linear lambda terms as rooted 3-valent maps 33 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 George Kaye
Demo
A visualiser for linear lambda terms as rooted 3-valent maps 34 Demo
https://www.georgejkaye.com/pages/fyp/visualiser.html
Examples using Mairson’s Boolean circuit encodings
CLA’2019 George Kaye
Demo
A visualiser for linear lambda terms as rooted 3-valent maps 35 Demo
https://www.georgejkaye.com/pages/fyp/visualiser.html
CLA’2019 George Kaye
Demo
A visualiser for linear lambda terms as rooted 3-valent maps 36 Demo
https://www.georgejkaye.com/pages/fyp/visualiser.html
normalises to
CLA’2019 George Kaye
Demo
A visualiser for linear lambda terms as rooted 3-valent maps 37 Demo
https://www.georgejkaye.com/pages/fyp/visualiser.html
CLA’2019 George Kaye
Demo
A visualiser for linear lambda terms as rooted 3-valent maps 38 Demo
https://www.georgejkaye.com/pages/fyp/visualiser.html
normalises to
CLA’2019 George Kaye
Demo
A visualiser for linear lambda terms as rooted 3-valent maps 39 Demo
https://www.georgejkaye.com/pages/fyp/visualiser.html
Normalisation graph of
CLA’2019 George Kaye
https://www.georgejkaye.com/pages/fyp/gallery.html
Demo
A visualiser for linear lambda terms as rooted 3-valent maps 40 Demo
Number of subterms Number of free variables
CLA’2019 George Kaye
https://www.georgejkaye.com/pages/fyp/gallery.html
Demo
A visualiser for linear lambda terms as rooted 3-valent maps 41 Demo (this is only the first twelve)
CLA’2019 George Kaye
https://www.georgejkaye.com/pages/fyp/gallery.html
Demo
A visualiser for linear lambda terms as rooted 3-valent maps 42 Demo (this is only the first twelve)
CLA’2019 George Kaye
https://www.georgejkaye.com/pages/fyp/gallery.html
Demo
A visualiser for linear lambda terms as rooted 3-valent maps 43 Demo
CLA’2019 George Kaye
https://www.georgejkaye.com/pages/fyp/gallery.html
Demo
A visualiser for linear lambda terms as rooted 3-valent maps 44 Demo
These are all planar… can we make a conjecture here?
CLA’2019 George Kaye
https://www.georgejkaye.com/pages/fyp/gallery.html
Demo
A visualiser for linear lambda terms as rooted 3-valent maps 45 Demo
n = 5, k = 0, β = 1 n = 2, k = 0, β = 0
CLA’2019 George Kaye
https://www.georgejkaye.com/pages/fyp/gallery.html
Demo
A visualiser for linear lambda terms as rooted 3-valent maps 46 Demo
So far so good…
n = 11, k = 0, β = 3
CLA’2019 George Kaye
https://www.georgejkaye.com/pages/fyp/gallery.html
Demo
Conjecture: All closed linear lambda terms of size 𝑜 with
𝑜−2 3 redexes are planar
A visualiser for linear lambda terms as rooted 3-valent maps 47 Demo
CLA’2019 George Kaye
Outline
- Background
- Motivation
- Demo
- Future work
A visualiser for linear lambda terms as rooted 3-valent maps 48 Future work
CLA’2019 George Kaye
Future work
- Efficient generation of subsets
- Alternative ways of visualising terms
A visualiser for linear lambda terms as rooted 3-valent maps 49 Future work
CLA’2019 George Kaye
georgejkaye.com/fyp
A visualiser for linear lambda terms as rooted 3-valent maps 50