A visualiser for linear lambda-terms as rooted 3-valent maps - - PowerPoint PPT Presentation

a visualiser for
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

George Kaye University of Birmingham CLA’2019, July 1

A visualiser for linear lambda-terms as rooted 3-valent maps

slide-2
SLIDE 2

CLA’2019 George Kaye

Outline

  • Background
  • Motivation
  • Demo
  • Future work

A visualiser for linear lambda terms as rooted 3-valent maps 2 Background

slide-3
SLIDE 3

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

slide-4
SLIDE 4

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

slide-5
SLIDE 5

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 →∝

slide-6
SLIDE 6

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

slide-7
SLIDE 7

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
slide-8
SLIDE 8

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
slide-9
SLIDE 9

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)

slide-10
SLIDE 10

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)

slide-11
SLIDE 11

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)

slide-12
SLIDE 12

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

slide-13
SLIDE 13

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

slide-14
SLIDE 14

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

slide-15
SLIDE 15

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

slide-16
SLIDE 16

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

slide-17
SLIDE 17

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

slide-18
SLIDE 18

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

slide-19
SLIDE 19

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

slide-20
SLIDE 20

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

slide-21
SLIDE 21

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

slide-22
SLIDE 22

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

slide-23
SLIDE 23

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

slide-24
SLIDE 24

CLA’2019 George Kaye

Outline

  • Background
  • Motivation
  • Demo
  • Future work

A visualiser for linear lambda terms as rooted 3-valent maps 24 Motivation

slide-25
SLIDE 25

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

slide-26
SLIDE 26

CLA’2019 George Kaye

Outline

  • Background
  • Motivation
  • Demo
  • Future work

A visualiser for linear lambda terms as rooted 3-valent maps 26 Demo

slide-27
SLIDE 27

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

slide-28
SLIDE 28

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

slide-29
SLIDE 29

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

slide-30
SLIDE 30

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

slide-31
SLIDE 31

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

slide-32
SLIDE 32

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!

slide-33
SLIDE 33

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)

slide-34
SLIDE 34

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

slide-35
SLIDE 35

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

slide-36
SLIDE 36

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

slide-37
SLIDE 37

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

slide-38
SLIDE 38

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

slide-39
SLIDE 39

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

slide-40
SLIDE 40

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

slide-41
SLIDE 41

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)

slide-42
SLIDE 42

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)

slide-43
SLIDE 43

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

slide-44
SLIDE 44

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?

slide-45
SLIDE 45

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

slide-46
SLIDE 46

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

slide-47
SLIDE 47

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

slide-48
SLIDE 48

CLA’2019 George Kaye

Outline

  • Background
  • Motivation
  • Demo
  • Future work

A visualiser for linear lambda terms as rooted 3-valent maps 48 Future work

slide-49
SLIDE 49

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

slide-50
SLIDE 50

CLA’2019 George Kaye

georgejkaye.com/fyp

A visualiser for linear lambda terms as rooted 3-valent maps 50