SlideShare una empresa de Scribd logo
1 de 48
Descargar para leer sin conexión
Seven trees in one
Mark Hopkins
@antiselfdual
Commonwealth Bank
LambdaJam 2015
Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
Unlabelled binary trees
data Tree = Leaf | Node Tree Tree
Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
Unlabelled binary trees
data Tree = Leaf | Node Tree Tree
T = 1 + T2
Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
T = 1 + T2
Suspend disbelief, and solve for T.
Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
T = 1 + T2
Suspend disbelief, and solve for T.
T2
− T + 1 = 0
Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
T = 1 + T2
Suspend disbelief, and solve for T.
T2
− T + 1 = 0
T =
−b ±
√
b2 − 4ac
2a
Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
T = 1 + T2
Suspend disbelief, and solve for T.
T2
− T + 1 = 0
T =
−b ±
√
b2 − 4ac
2a
= 1
2 ±
√
3
2 i
Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
T = 1 + T2
Suspend disbelief, and solve for T.
T2
− T + 1 = 0
T =
−b ±
√
b2 − 4ac
2a
= 1
2 ±
√
3
2 i
= e±πi/3
Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
Re
Im
1
−1
i
−i
T
−T
Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
So T6 = 1.
Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
So T6 = 1. No, obviously wrong.
Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
So T6 = 1. No, obviously wrong.
What about
T7
= T?
Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
So T6 = 1. No, obviously wrong.
What about
T7
= T?
Not obviously wrong. . .
Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
So T6 = 1. No, obviously wrong.
What about
T7
= T?
Not obviously wrong. . .
⇒ true!
Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
Theorem
There exists an O(1) bijective function from T to T7.
Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
Theorem
There exists an O(1) bijective function from T to T7.
i.e.
we can pattern match on any 7-tuple of trees and put them
together into one tree.
Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
Theorem
There exists an O(1) bijective function from T to T7.
i.e.
we can pattern match on any 7-tuple of trees and put them
together into one tree.
we can decompose any tree into the same seven trees it came
from.
Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
Theorem
There exists an O(1) bijective function from T to T7.
i.e.
we can pattern match on any 7-tuple of trees and put them
together into one tree.
we can decompose any tree into the same seven trees it came
from.
Actually holds for any k = 1 mod 6.
Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
Theorem
There exists an O(1) bijective function from T to T7.
i.e.
we can pattern match on any 7-tuple of trees and put them
together into one tree.
we can decompose any tree into the same seven trees it came
from.
Actually holds for any k = 1 mod 6.
Not true for other values.
Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
T2
→ T
f :: (Tree , Tree) → Tree
t t1 t2 = Node t1 t2
Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
T2
→ T
f :: (Tree , Tree) → Tree
t t1 t2 = Node t1 t2
Not surjective, since we can never reach Leaf.
Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
T → T2
f :: Tree → (Tree , Tree)
f t = Node t Leaf
Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
T → T2
f :: Tree → (Tree , Tree)
f t = Node t Leaf
Not surjective either.
Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
T2
→ T, but cleverer
f :: (Tree , Tree) → Tree
f (t1, t2) = go (Node t1 t2)
where
go t = if leftOnly t then left t else t
leftOnly t = t == Leaf
|| right t == Leaf && leftOnly (left t)
Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
T2
→ T, but cleverer
f :: (Tree , Tree) → Tree
f (t1, t2) = go (Node t1 t2)
where
go t = if leftOnly t then left t else t
leftOnly t = t == Leaf
|| right t == Leaf && leftOnly (left t)
Bijective!
Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
T2
→ T, but cleverer
f :: (Tree , Tree) → Tree
f (t1, t2) = go (Node t1 t2)
where
go t = if leftOnly t then left t else t
leftOnly t = t == Leaf
|| right t == Leaf && leftOnly (left t)
Bijective! but not O(1).
Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
A solution
f :: T → (T, T, T, T, T, T, T)
f L = (L,L,L,L,L,L,L)
f (N t1 L) = (t1,N L L,L,L,L,L,L)
f (N t1 (N t2 L)) = (N t1 t2,L,L,L,L,L,L)
f (N t1 (N t2 (N t3 L))) = (t1,N (N t2 t3) L,L,L,L,L,L)
f (N t1 (N t2 (N t3 (N t4 L)))) = (t1,N t2 (N t3 t4),L,L,L,L,L)
f (N t1 (N t2 (N t3 (N t4 (N L L))))) = (t1,t2,N t3 t4,L,L,L,L)
f (N t1 (N t2 (N t3 (N t4 (N (N t5 L) L))))) = (t1,t2,t3,N t4 t5,L,L,L)
f (N t1 (N t2 (N t3 (N t4 (N (N t5 (N t6 L)) L))))) = (t1,t2,t3,t4,N t5 t6,L,L)
f (N t1 (N t2 (N t3 (N t4 (N (N t5 (N t6 (N t7 t8))) L))))) = (t1,t2,t3,t4,t5,t6,N t7 t8)
f (N t1 (N t2 (N t3 (N t4 (N t5 (N t6 t7 )))))) = (t1,t2,t3,t4,t5,N t6 t7,L)
Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
Where did this come from
T = 1 + T2
Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
Where did this come from
T = 1 + T2
Tk
= Tk−1
+ Tk+1
Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
Penny game
T0 T1 T2 T3 T4 T5 T6 T7 T8
start with a penny in position 1.
aim is to move it to position 7 by splitting and combining
Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
Why did this work?
If we have a type isomorphism T ∼= p(T) then
Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
Why did this work?
If we have a type isomorphism T ∼= p(T) then
q1(T) ∼= q2(T) as types
⇐⇒ q1(x) ∼= q2(x) in the rig N[x]/(p(x) = x)
Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
Why did this work?
If we have a type isomorphism T ∼= p(T) then
q1(T) ∼= q2(T) as types
⇐⇒ q1(x) ∼= q2(x) in the rig N[x]/(p(x) = x)
⇒ q1(x) ∼= q2(x) in the ring Z[x]/(p(x) = x)
Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
Why did this work?
If we have a type isomorphism T ∼= p(T) then
q1(T) ∼= q2(T) as types
⇐⇒ q1(x) ∼= q2(x) in the rig N[x]/(p(x) = x)
⇒ q1(x) ∼= q2(x) in the ring Z[x]/(p(x) = x)
⇒ q1(z) ∼= q2(z) for all z ∈ C such that p(z) = z.
Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
Why did this work?
If we have a type isomorphism T ∼= p(T) then
q1(T) ∼= q2(T) as types
⇐⇒ q1(x) ∼= q2(x) in the rig N[x]/(p(x) = x)
⇒ q1(x) ∼= q2(x) in the ring Z[x]/(p(x) = x)
⇒ q1(z) ∼= q2(z) for all z ∈ C such that p(z) = z.
And, under some conditions, the reverse implications hold.
Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
Summary
Simple arithmetic helps us find non-obvious type isomorphisms
Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
Extensions
Are there extensions to datatypes of decorated trees?
(multivariate polynomials)
What applications are there?
Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
Extensions
Are there extensions to datatypes of decorated trees?
(multivariate polynomials)
What applications are there?
important when writing a compiler to know when two types
are isomomorphic
Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
Extensions
Are there extensions to datatypes of decorated trees?
(multivariate polynomials)
What applications are there?
important when writing a compiler to know when two types
are isomomorphic
It could interesting to split up a tree-shaped stream into seven
parts
Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
Rich theory behind isomorphisms of polynomial types
brings together a number of fields
distributive categories
theory of rigs (semirings)
combinatorial species
type theory
Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
Further reading
Seven Trees in one, Andreas Blass, Journal of Pure and
Applied Algebra
On the generic solution to P(X) = X in distributive
categories, Robbie Gates
Objects of Categories as Complex Numbers, Marcelo Fiore and
Tom Leinster
An Objective Representation of the Gaussian Integers, Marcelo
Fiore and Tom Leinster
http://rfcwalters.blogspot.com.au/2010/06/robbie-gates-on-
seven-trees-in-one.html
http://blog.sigfpe.com/2007/09/arboreal-isomorphisms-from-
nuclear.html
Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
Challenge
Consider this datatype (Motzkin trees):
data Tree = Zero | One Tree | Two Tree Tree
Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
Challenge
Consider this datatype (Motzkin trees):
data Tree = Zero | One Tree | Two Tree Tree
T = 1 + T + T2
Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
Challenge
Consider this datatype (Motzkin trees):
data Tree = Zero | One Tree | Two Tree Tree
T = 1 + T + T2
Show that T5 ∼= T
by a nonsense argument using complex numbers
by composing bijections (the penny game)
implement the function and its inverse in a language of your
choice
Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
Photo credits
The Druid’s Grove, Norbury Park: Ancient Yew Trees by
Thomas Allom 1804-1872
http://www.victorianweb.org/art/illustration/allom/1.html
Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
End
Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one

Más contenido relacionado

La actualidad más candente

Set theory
Set theorySet theory
Set theoryAN_Rajin
 
Set theory-complete-1211828121770367-8
Set theory-complete-1211828121770367-8Set theory-complete-1211828121770367-8
Set theory-complete-1211828121770367-8Yusra Shaikh
 
Discrete Structures lecture 2
 Discrete Structures lecture 2 Discrete Structures lecture 2
Discrete Structures lecture 2Ali Usman
 
Discrete Structures. Lecture 1
 Discrete Structures. Lecture 1  Discrete Structures. Lecture 1
Discrete Structures. Lecture 1 Ali Usman
 
Discrete Mathematics Tree
Discrete Mathematics  TreeDiscrete Mathematics  Tree
Discrete Mathematics TreeMasud Parvaze
 
Discreet_Set Theory
Discreet_Set TheoryDiscreet_Set Theory
Discreet_Set Theoryguest68d714
 
BCA_Semester-I_Mathematics-I_Set theory and function
BCA_Semester-I_Mathematics-I_Set theory and functionBCA_Semester-I_Mathematics-I_Set theory and function
BCA_Semester-I_Mathematics-I_Set theory and functionRai University
 
CBSE Class X - Mathematics Set Theory Topic
CBSE Class X  - Mathematics Set Theory TopicCBSE Class X  - Mathematics Set Theory Topic
CBSE Class X - Mathematics Set Theory TopicEdvie
 
A STUDY ON L-FUZZY NORMAL SUBl -GROUP
A STUDY ON L-FUZZY NORMAL SUBl -GROUPA STUDY ON L-FUZZY NORMAL SUBl -GROUP
A STUDY ON L-FUZZY NORMAL SUBl -GROUPijejournal
 
Unit I discrete mathematics lecture notes
Unit I  discrete mathematics lecture notesUnit I  discrete mathematics lecture notes
Unit I discrete mathematics lecture notesGIRIM8
 

La actualidad más candente (15)

Group Theory
Group TheoryGroup Theory
Group Theory
 
MarkDrachMeinelThesisFinal
MarkDrachMeinelThesisFinalMarkDrachMeinelThesisFinal
MarkDrachMeinelThesisFinal
 
Set theory
Set theorySet theory
Set theory
 
Set theory-complete-1211828121770367-8
Set theory-complete-1211828121770367-8Set theory-complete-1211828121770367-8
Set theory-complete-1211828121770367-8
 
Discrete Structures lecture 2
 Discrete Structures lecture 2 Discrete Structures lecture 2
Discrete Structures lecture 2
 
Discrete Structures. Lecture 1
 Discrete Structures. Lecture 1  Discrete Structures. Lecture 1
Discrete Structures. Lecture 1
 
Discrete Mathematics Tree
Discrete Mathematics  TreeDiscrete Mathematics  Tree
Discrete Mathematics Tree
 
Discreet_Set Theory
Discreet_Set TheoryDiscreet_Set Theory
Discreet_Set Theory
 
BCA_Semester-I_Mathematics-I_Set theory and function
BCA_Semester-I_Mathematics-I_Set theory and functionBCA_Semester-I_Mathematics-I_Set theory and function
BCA_Semester-I_Mathematics-I_Set theory and function
 
Set Theory
Set TheorySet Theory
Set Theory
 
Set Theory Presentation
Set Theory PresentationSet Theory Presentation
Set Theory Presentation
 
Class XI CH 1 (sets)
Class XI CH 1 (sets)Class XI CH 1 (sets)
Class XI CH 1 (sets)
 
CBSE Class X - Mathematics Set Theory Topic
CBSE Class X  - Mathematics Set Theory TopicCBSE Class X  - Mathematics Set Theory Topic
CBSE Class X - Mathematics Set Theory Topic
 
A STUDY ON L-FUZZY NORMAL SUBl -GROUP
A STUDY ON L-FUZZY NORMAL SUBl -GROUPA STUDY ON L-FUZZY NORMAL SUBl -GROUP
A STUDY ON L-FUZZY NORMAL SUBl -GROUP
 
Unit I discrete mathematics lecture notes
Unit I  discrete mathematics lecture notesUnit I  discrete mathematics lecture notes
Unit I discrete mathematics lecture notes
 

Destacado

Pokemon go の技術的注目点
Pokemon go の技術的注目点Pokemon go の技術的注目点
Pokemon go の技術的注目点Satoshi Makita
 
はじめようlocalization
はじめようlocalizationはじめようlocalization
はじめようlocalizationJoão Orui
 
Shake up the Culture with Automation!
Shake up the Culture with Automation!Shake up the Culture with Automation!
Shake up the Culture with Automation!Hiroyuki Ito
 
Final san diego venture group keynote 2016
Final san diego venture group keynote   2016Final san diego venture group keynote   2016
Final san diego venture group keynote 2016Mark Suster
 
Tsushima2015 talk event - ロボット・情報技術は生活の役に立つのか?? ~科学・技術を探求することの意味~
Tsushima2015 talk event - ロボット・情報技術は生活の役に立つのか??~科学・技術を探求することの意味~Tsushima2015 talk event - ロボット・情報技術は生活の役に立つのか??~科学・技術を探求することの意味~
Tsushima2015 talk event - ロボット・情報技術は生活の役に立つのか?? ~科学・技術を探求することの意味~Satoshi Makita
 
Power bi for office365 技術ひろばnet
Power bi for office365  技術ひろばnetPower bi for office365  技術ひろばnet
Power bi for office365 技術ひろばnetmokudai masayuki
 
A Powerful Partnership: GIS and Sampling
A Powerful Partnership: GIS and SamplingA Powerful Partnership: GIS and Sampling
A Powerful Partnership: GIS and SamplingMEASURE Evaluation
 
Tic ii idea_de_negocio_abi
Tic ii idea_de_negocio_abiTic ii idea_de_negocio_abi
Tic ii idea_de_negocio_abiAbi_Sar_Vi
 
Calzado "Solsol"
Calzado "Solsol"Calzado "Solsol"
Calzado "Solsol"47860287
 
Terapeutica tb
Terapeutica tbTerapeutica tb
Terapeutica tbKuru Mi
 
gestion de la carga de trabajo de la evaluación continua para el profesor
gestion de la carga de trabajo de la evaluación continua para el profesorgestion de la carga de trabajo de la evaluación continua para el profesor
gestion de la carga de trabajo de la evaluación continua para el profesorAlfredo Prieto Martín
 
Idea de negocio empresarial
Idea de negocio empresarialIdea de negocio empresarial
Idea de negocio empresarialjuan199006
 
Nº 33 año 2008, gaceta municipal extraordinaria (ordenanzas contraloría socia...
Nº 33 año 2008, gaceta municipal extraordinaria (ordenanzas contraloría socia...Nº 33 año 2008, gaceta municipal extraordinaria (ordenanzas contraloría socia...
Nº 33 año 2008, gaceta municipal extraordinaria (ordenanzas contraloría socia...María Linares
 
Proyecto de historia clínica electrónica en cundinamarca
Proyecto de historia clínica electrónica en cundinamarcaProyecto de historia clínica electrónica en cundinamarca
Proyecto de historia clínica electrónica en cundinamarcaAlex Rodriguez
 
Digital II Final Project
Digital II Final ProjectDigital II Final Project
Digital II Final Projectstephenjbilharz
 
Engaging staff in Health and Safety, do rules work? - Golden rules thoughts 2...
Engaging staff in Health and Safety, do rules work? - Golden rules thoughts 2...Engaging staff in Health and Safety, do rules work? - Golden rules thoughts 2...
Engaging staff in Health and Safety, do rules work? - Golden rules thoughts 2...Gideon Bernto
 
Idea de negocio querubin sac
Idea de negocio   querubin sacIdea de negocio   querubin sac
Idea de negocio querubin sacHELEN1110
 
乱択データ構造の最新事情 -MinHash と HyperLogLog の最近の進歩-
乱択データ構造の最新事情 -MinHash と HyperLogLog の最近の進歩-乱択データ構造の最新事情 -MinHash と HyperLogLog の最近の進歩-
乱択データ構造の最新事情 -MinHash と HyperLogLog の最近の進歩-Takuya Akiba
 
Conquer CI Server! - Re-establishment of Order and Nurture of the Solid Organ...
Conquer CI Server! - Re-establishment of Order and Nurture of the Solid Organ...Conquer CI Server! - Re-establishment of Order and Nurture of the Solid Organ...
Conquer CI Server! - Re-establishment of Order and Nurture of the Solid Organ...Rakuten Group, Inc.
 

Destacado (20)

Pokemon go の技術的注目点
Pokemon go の技術的注目点Pokemon go の技術的注目点
Pokemon go の技術的注目点
 
はじめようlocalization
はじめようlocalizationはじめようlocalization
はじめようlocalization
 
Shake up the Culture with Automation!
Shake up the Culture with Automation!Shake up the Culture with Automation!
Shake up the Culture with Automation!
 
Final san diego venture group keynote 2016
Final san diego venture group keynote   2016Final san diego venture group keynote   2016
Final san diego venture group keynote 2016
 
Tsushima2015 talk event - ロボット・情報技術は生活の役に立つのか?? ~科学・技術を探求することの意味~
Tsushima2015 talk event - ロボット・情報技術は生活の役に立つのか??~科学・技術を探求することの意味~Tsushima2015 talk event - ロボット・情報技術は生活の役に立つのか??~科学・技術を探求することの意味~
Tsushima2015 talk event - ロボット・情報技術は生活の役に立つのか?? ~科学・技術を探求することの意味~
 
Power bi for office365 技術ひろばnet
Power bi for office365  技術ひろばnetPower bi for office365  技術ひろばnet
Power bi for office365 技術ひろばnet
 
EL MEDIO AMBIENTE
EL MEDIO AMBIENTEEL MEDIO AMBIENTE
EL MEDIO AMBIENTE
 
A Powerful Partnership: GIS and Sampling
A Powerful Partnership: GIS and SamplingA Powerful Partnership: GIS and Sampling
A Powerful Partnership: GIS and Sampling
 
Tic ii idea_de_negocio_abi
Tic ii idea_de_negocio_abiTic ii idea_de_negocio_abi
Tic ii idea_de_negocio_abi
 
Calzado "Solsol"
Calzado "Solsol"Calzado "Solsol"
Calzado "Solsol"
 
Terapeutica tb
Terapeutica tbTerapeutica tb
Terapeutica tb
 
gestion de la carga de trabajo de la evaluación continua para el profesor
gestion de la carga de trabajo de la evaluación continua para el profesorgestion de la carga de trabajo de la evaluación continua para el profesor
gestion de la carga de trabajo de la evaluación continua para el profesor
 
Idea de negocio empresarial
Idea de negocio empresarialIdea de negocio empresarial
Idea de negocio empresarial
 
Nº 33 año 2008, gaceta municipal extraordinaria (ordenanzas contraloría socia...
Nº 33 año 2008, gaceta municipal extraordinaria (ordenanzas contraloría socia...Nº 33 año 2008, gaceta municipal extraordinaria (ordenanzas contraloría socia...
Nº 33 año 2008, gaceta municipal extraordinaria (ordenanzas contraloría socia...
 
Proyecto de historia clínica electrónica en cundinamarca
Proyecto de historia clínica electrónica en cundinamarcaProyecto de historia clínica electrónica en cundinamarca
Proyecto de historia clínica electrónica en cundinamarca
 
Digital II Final Project
Digital II Final ProjectDigital II Final Project
Digital II Final Project
 
Engaging staff in Health and Safety, do rules work? - Golden rules thoughts 2...
Engaging staff in Health and Safety, do rules work? - Golden rules thoughts 2...Engaging staff in Health and Safety, do rules work? - Golden rules thoughts 2...
Engaging staff in Health and Safety, do rules work? - Golden rules thoughts 2...
 
Idea de negocio querubin sac
Idea de negocio   querubin sacIdea de negocio   querubin sac
Idea de negocio querubin sac
 
乱択データ構造の最新事情 -MinHash と HyperLogLog の最近の進歩-
乱択データ構造の最新事情 -MinHash と HyperLogLog の最近の進歩-乱択データ構造の最新事情 -MinHash と HyperLogLog の最近の進歩-
乱択データ構造の最新事情 -MinHash と HyperLogLog の最近の進歩-
 
Conquer CI Server! - Re-establishment of Order and Nurture of the Solid Organ...
Conquer CI Server! - Re-establishment of Order and Nurture of the Solid Organ...Conquer CI Server! - Re-establishment of Order and Nurture of the Solid Organ...
Conquer CI Server! - Re-establishment of Order and Nurture of the Solid Organ...
 

Similar a Seven trees in one

Understanding variable importances in forests of randomized trees
Understanding variable importances in forests of randomized treesUnderstanding variable importances in forests of randomized trees
Understanding variable importances in forests of randomized treesGilles Louppe
 
Pattern_avoidance_in_ternary_trees
Pattern_avoidance_in_ternary_treesPattern_avoidance_in_ternary_trees
Pattern_avoidance_in_ternary_treesNathan Gabriel
 
Skiena algorithm 2007 lecture09 linear sorting
Skiena algorithm 2007 lecture09 linear sortingSkiena algorithm 2007 lecture09 linear sorting
Skiena algorithm 2007 lecture09 linear sortingzukun
 
Dependent Types and Dynamics of Natural Language
Dependent Types and Dynamics of Natural LanguageDependent Types and Dynamics of Natural Language
Dependent Types and Dynamics of Natural LanguageDaisuke BEKKI
 
Skiena algorithm 2007 lecture05 dictionary data structure trees
Skiena algorithm 2007 lecture05 dictionary data structure treesSkiena algorithm 2007 lecture05 dictionary data structure trees
Skiena algorithm 2007 lecture05 dictionary data structure treeszukun
 
8 chapter4 trees_bst
8 chapter4 trees_bst8 chapter4 trees_bst
8 chapter4 trees_bstSSE_AndyLi
 
Review session2
Review session2Review session2
Review session2NEEDY12345
 
On Generalized Classical Fréchet Derivatives in the Real Banach Space
On Generalized Classical Fréchet Derivatives in the Real Banach SpaceOn Generalized Classical Fréchet Derivatives in the Real Banach Space
On Generalized Classical Fréchet Derivatives in the Real Banach SpaceBRNSS Publication Hub
 
Divide and conquer
Divide and conquerDivide and conquer
Divide and conquerVikas Sharma
 
Jurnal informatika
Jurnal informatika Jurnal informatika
Jurnal informatika MamaMa28
 

Similar a Seven trees in one (20)

Understanding variable importances in forests of randomized trees
Understanding variable importances in forests of randomized treesUnderstanding variable importances in forests of randomized trees
Understanding variable importances in forests of randomized trees
 
Pattern_avoidance_in_ternary_trees
Pattern_avoidance_in_ternary_treesPattern_avoidance_in_ternary_trees
Pattern_avoidance_in_ternary_trees
 
09 binary trees
09 binary trees09 binary trees
09 binary trees
 
Fol
FolFol
Fol
 
01_AJMS_277_20_20210128_V1.pdf
01_AJMS_277_20_20210128_V1.pdf01_AJMS_277_20_20210128_V1.pdf
01_AJMS_277_20_20210128_V1.pdf
 
16 rbtrees
16 rbtrees16 rbtrees
16 rbtrees
 
Skiena algorithm 2007 lecture09 linear sorting
Skiena algorithm 2007 lecture09 linear sortingSkiena algorithm 2007 lecture09 linear sorting
Skiena algorithm 2007 lecture09 linear sorting
 
Dependent Types and Dynamics of Natural Language
Dependent Types and Dynamics of Natural LanguageDependent Types and Dynamics of Natural Language
Dependent Types and Dynamics of Natural Language
 
Skiena algorithm 2007 lecture05 dictionary data structure trees
Skiena algorithm 2007 lecture05 dictionary data structure treesSkiena algorithm 2007 lecture05 dictionary data structure trees
Skiena algorithm 2007 lecture05 dictionary data structure trees
 
8 chapter4 trees_bst
8 chapter4 trees_bst8 chapter4 trees_bst
8 chapter4 trees_bst
 
Review session2
Review session2Review session2
Review session2
 
On Generalized Classical Fréchet Derivatives in the Real Banach Space
On Generalized Classical Fréchet Derivatives in the Real Banach SpaceOn Generalized Classical Fréchet Derivatives in the Real Banach Space
On Generalized Classical Fréchet Derivatives in the Real Banach Space
 
lecture4.ppt
lecture4.pptlecture4.ppt
lecture4.ppt
 
smtlecture.7
smtlecture.7smtlecture.7
smtlecture.7
 
Divide and conquer
Divide and conquerDivide and conquer
Divide and conquer
 
Trees ayaz
Trees ayazTrees ayaz
Trees ayaz
 
FUZZY LOGIC
FUZZY LOGICFUZZY LOGIC
FUZZY LOGIC
 
Trees
TreesTrees
Trees
 
Lecture 4 f17
Lecture 4 f17Lecture 4 f17
Lecture 4 f17
 
Jurnal informatika
Jurnal informatika Jurnal informatika
Jurnal informatika
 

Último

Formation of low mass protostars and their circumstellar disks
Formation of low mass protostars and their circumstellar disksFormation of low mass protostars and their circumstellar disks
Formation of low mass protostars and their circumstellar disksSérgio Sacani
 
All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...
All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...
All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...Sérgio Sacani
 
Hire 💕 9907093804 Hooghly Call Girls Service Call Girls Agency
Hire 💕 9907093804 Hooghly Call Girls Service Call Girls AgencyHire 💕 9907093804 Hooghly Call Girls Service Call Girls Agency
Hire 💕 9907093804 Hooghly Call Girls Service Call Girls AgencySheetal Arora
 
GFP in rDNA Technology (Biotechnology).pptx
GFP in rDNA Technology (Biotechnology).pptxGFP in rDNA Technology (Biotechnology).pptx
GFP in rDNA Technology (Biotechnology).pptxAleenaTreesaSaji
 
Traditional Agroforestry System in India- Shifting Cultivation, Taungya, Home...
Traditional Agroforestry System in India- Shifting Cultivation, Taungya, Home...Traditional Agroforestry System in India- Shifting Cultivation, Taungya, Home...
Traditional Agroforestry System in India- Shifting Cultivation, Taungya, Home...jana861314
 
Broad bean, Lima Bean, Jack bean, Ullucus.pptx
Broad bean, Lima Bean, Jack bean, Ullucus.pptxBroad bean, Lima Bean, Jack bean, Ullucus.pptx
Broad bean, Lima Bean, Jack bean, Ullucus.pptxjana861314
 
Biological Classification BioHack (3).pdf
Biological Classification BioHack (3).pdfBiological Classification BioHack (3).pdf
Biological Classification BioHack (3).pdfmuntazimhurra
 
Botany krishna series 2nd semester Only Mcq type questions
Botany krishna series 2nd semester Only Mcq type questionsBotany krishna series 2nd semester Only Mcq type questions
Botany krishna series 2nd semester Only Mcq type questionsSumit Kumar yadav
 
Chromatin Structure | EUCHROMATIN | HETEROCHROMATIN
Chromatin Structure | EUCHROMATIN | HETEROCHROMATINChromatin Structure | EUCHROMATIN | HETEROCHROMATIN
Chromatin Structure | EUCHROMATIN | HETEROCHROMATINsankalpkumarsahoo174
 
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCRStunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCRDelhi Call girls
 
Spermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatidSpermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatidSarthak Sekhar Mondal
 
Orientation, design and principles of polyhouse
Orientation, design and principles of polyhouseOrientation, design and principles of polyhouse
Orientation, design and principles of polyhousejana861314
 
Disentangling the origin of chemical differences using GHOST
Disentangling the origin of chemical differences using GHOSTDisentangling the origin of chemical differences using GHOST
Disentangling the origin of chemical differences using GHOSTSérgio Sacani
 
Natural Polymer Based Nanomaterials
Natural Polymer Based NanomaterialsNatural Polymer Based Nanomaterials
Natural Polymer Based NanomaterialsAArockiyaNisha
 
Animal Communication- Auditory and Visual.pptx
Animal Communication- Auditory and Visual.pptxAnimal Communication- Auditory and Visual.pptx
Animal Communication- Auditory and Visual.pptxUmerFayaz5
 
Botany 4th semester file By Sumit Kumar yadav.pdf
Botany 4th semester file By Sumit Kumar yadav.pdfBotany 4th semester file By Sumit Kumar yadav.pdf
Botany 4th semester file By Sumit Kumar yadav.pdfSumit Kumar yadav
 
Nanoparticles synthesis and characterization​ ​
Nanoparticles synthesis and characterization​  ​Nanoparticles synthesis and characterization​  ​
Nanoparticles synthesis and characterization​ ​kaibalyasahoo82800
 
Unlocking the Potential: Deep dive into ocean of Ceramic Magnets.pptx
Unlocking  the Potential: Deep dive into ocean of Ceramic Magnets.pptxUnlocking  the Potential: Deep dive into ocean of Ceramic Magnets.pptx
Unlocking the Potential: Deep dive into ocean of Ceramic Magnets.pptxanandsmhk
 

Último (20)

Formation of low mass protostars and their circumstellar disks
Formation of low mass protostars and their circumstellar disksFormation of low mass protostars and their circumstellar disks
Formation of low mass protostars and their circumstellar disks
 
All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...
All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...
All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...
 
Hire 💕 9907093804 Hooghly Call Girls Service Call Girls Agency
Hire 💕 9907093804 Hooghly Call Girls Service Call Girls AgencyHire 💕 9907093804 Hooghly Call Girls Service Call Girls Agency
Hire 💕 9907093804 Hooghly Call Girls Service Call Girls Agency
 
GFP in rDNA Technology (Biotechnology).pptx
GFP in rDNA Technology (Biotechnology).pptxGFP in rDNA Technology (Biotechnology).pptx
GFP in rDNA Technology (Biotechnology).pptx
 
Traditional Agroforestry System in India- Shifting Cultivation, Taungya, Home...
Traditional Agroforestry System in India- Shifting Cultivation, Taungya, Home...Traditional Agroforestry System in India- Shifting Cultivation, Taungya, Home...
Traditional Agroforestry System in India- Shifting Cultivation, Taungya, Home...
 
Broad bean, Lima Bean, Jack bean, Ullucus.pptx
Broad bean, Lima Bean, Jack bean, Ullucus.pptxBroad bean, Lima Bean, Jack bean, Ullucus.pptx
Broad bean, Lima Bean, Jack bean, Ullucus.pptx
 
Biological Classification BioHack (3).pdf
Biological Classification BioHack (3).pdfBiological Classification BioHack (3).pdf
Biological Classification BioHack (3).pdf
 
Botany krishna series 2nd semester Only Mcq type questions
Botany krishna series 2nd semester Only Mcq type questionsBotany krishna series 2nd semester Only Mcq type questions
Botany krishna series 2nd semester Only Mcq type questions
 
Chromatin Structure | EUCHROMATIN | HETEROCHROMATIN
Chromatin Structure | EUCHROMATIN | HETEROCHROMATINChromatin Structure | EUCHROMATIN | HETEROCHROMATIN
Chromatin Structure | EUCHROMATIN | HETEROCHROMATIN
 
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCRStunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
 
Spermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatidSpermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatid
 
Orientation, design and principles of polyhouse
Orientation, design and principles of polyhouseOrientation, design and principles of polyhouse
Orientation, design and principles of polyhouse
 
Engler and Prantl system of classification in plant taxonomy
Engler and Prantl system of classification in plant taxonomyEngler and Prantl system of classification in plant taxonomy
Engler and Prantl system of classification in plant taxonomy
 
Disentangling the origin of chemical differences using GHOST
Disentangling the origin of chemical differences using GHOSTDisentangling the origin of chemical differences using GHOST
Disentangling the origin of chemical differences using GHOST
 
Natural Polymer Based Nanomaterials
Natural Polymer Based NanomaterialsNatural Polymer Based Nanomaterials
Natural Polymer Based Nanomaterials
 
Animal Communication- Auditory and Visual.pptx
Animal Communication- Auditory and Visual.pptxAnimal Communication- Auditory and Visual.pptx
Animal Communication- Auditory and Visual.pptx
 
9953056974 Young Call Girls In Mahavir enclave Indian Quality Escort service
9953056974 Young Call Girls In Mahavir enclave Indian Quality Escort service9953056974 Young Call Girls In Mahavir enclave Indian Quality Escort service
9953056974 Young Call Girls In Mahavir enclave Indian Quality Escort service
 
Botany 4th semester file By Sumit Kumar yadav.pdf
Botany 4th semester file By Sumit Kumar yadav.pdfBotany 4th semester file By Sumit Kumar yadav.pdf
Botany 4th semester file By Sumit Kumar yadav.pdf
 
Nanoparticles synthesis and characterization​ ​
Nanoparticles synthesis and characterization​  ​Nanoparticles synthesis and characterization​  ​
Nanoparticles synthesis and characterization​ ​
 
Unlocking the Potential: Deep dive into ocean of Ceramic Magnets.pptx
Unlocking  the Potential: Deep dive into ocean of Ceramic Magnets.pptxUnlocking  the Potential: Deep dive into ocean of Ceramic Magnets.pptx
Unlocking the Potential: Deep dive into ocean of Ceramic Magnets.pptx
 

Seven trees in one

  • 1. Seven trees in one Mark Hopkins @antiselfdual Commonwealth Bank LambdaJam 2015 Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
  • 2. Unlabelled binary trees data Tree = Leaf | Node Tree Tree Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
  • 3. Unlabelled binary trees data Tree = Leaf | Node Tree Tree T = 1 + T2 Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
  • 4. T = 1 + T2 Suspend disbelief, and solve for T. Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
  • 5. T = 1 + T2 Suspend disbelief, and solve for T. T2 − T + 1 = 0 Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
  • 6. T = 1 + T2 Suspend disbelief, and solve for T. T2 − T + 1 = 0 T = −b ± √ b2 − 4ac 2a Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
  • 7. T = 1 + T2 Suspend disbelief, and solve for T. T2 − T + 1 = 0 T = −b ± √ b2 − 4ac 2a = 1 2 ± √ 3 2 i Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
  • 8. T = 1 + T2 Suspend disbelief, and solve for T. T2 − T + 1 = 0 T = −b ± √ b2 − 4ac 2a = 1 2 ± √ 3 2 i = e±πi/3 Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
  • 9. Re Im 1 −1 i −i T −T Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
  • 10. So T6 = 1. Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
  • 11. So T6 = 1. No, obviously wrong. Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
  • 12. So T6 = 1. No, obviously wrong. What about T7 = T? Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
  • 13. So T6 = 1. No, obviously wrong. What about T7 = T? Not obviously wrong. . . Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
  • 14. So T6 = 1. No, obviously wrong. What about T7 = T? Not obviously wrong. . . ⇒ true! Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
  • 15. Theorem There exists an O(1) bijective function from T to T7. Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
  • 16. Theorem There exists an O(1) bijective function from T to T7. i.e. we can pattern match on any 7-tuple of trees and put them together into one tree. Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
  • 17. Theorem There exists an O(1) bijective function from T to T7. i.e. we can pattern match on any 7-tuple of trees and put them together into one tree. we can decompose any tree into the same seven trees it came from. Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
  • 18. Theorem There exists an O(1) bijective function from T to T7. i.e. we can pattern match on any 7-tuple of trees and put them together into one tree. we can decompose any tree into the same seven trees it came from. Actually holds for any k = 1 mod 6. Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
  • 19. Theorem There exists an O(1) bijective function from T to T7. i.e. we can pattern match on any 7-tuple of trees and put them together into one tree. we can decompose any tree into the same seven trees it came from. Actually holds for any k = 1 mod 6. Not true for other values. Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
  • 20. T2 → T f :: (Tree , Tree) → Tree t t1 t2 = Node t1 t2 Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
  • 21. T2 → T f :: (Tree , Tree) → Tree t t1 t2 = Node t1 t2 Not surjective, since we can never reach Leaf. Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
  • 22. T → T2 f :: Tree → (Tree , Tree) f t = Node t Leaf Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
  • 23. T → T2 f :: Tree → (Tree , Tree) f t = Node t Leaf Not surjective either. Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
  • 24. T2 → T, but cleverer f :: (Tree , Tree) → Tree f (t1, t2) = go (Node t1 t2) where go t = if leftOnly t then left t else t leftOnly t = t == Leaf || right t == Leaf && leftOnly (left t) Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
  • 25. T2 → T, but cleverer f :: (Tree , Tree) → Tree f (t1, t2) = go (Node t1 t2) where go t = if leftOnly t then left t else t leftOnly t = t == Leaf || right t == Leaf && leftOnly (left t) Bijective! Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
  • 26. T2 → T, but cleverer f :: (Tree , Tree) → Tree f (t1, t2) = go (Node t1 t2) where go t = if leftOnly t then left t else t leftOnly t = t == Leaf || right t == Leaf && leftOnly (left t) Bijective! but not O(1). Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
  • 27. A solution f :: T → (T, T, T, T, T, T, T) f L = (L,L,L,L,L,L,L) f (N t1 L) = (t1,N L L,L,L,L,L,L) f (N t1 (N t2 L)) = (N t1 t2,L,L,L,L,L,L) f (N t1 (N t2 (N t3 L))) = (t1,N (N t2 t3) L,L,L,L,L,L) f (N t1 (N t2 (N t3 (N t4 L)))) = (t1,N t2 (N t3 t4),L,L,L,L,L) f (N t1 (N t2 (N t3 (N t4 (N L L))))) = (t1,t2,N t3 t4,L,L,L,L) f (N t1 (N t2 (N t3 (N t4 (N (N t5 L) L))))) = (t1,t2,t3,N t4 t5,L,L,L) f (N t1 (N t2 (N t3 (N t4 (N (N t5 (N t6 L)) L))))) = (t1,t2,t3,t4,N t5 t6,L,L) f (N t1 (N t2 (N t3 (N t4 (N (N t5 (N t6 (N t7 t8))) L))))) = (t1,t2,t3,t4,t5,t6,N t7 t8) f (N t1 (N t2 (N t3 (N t4 (N t5 (N t6 t7 )))))) = (t1,t2,t3,t4,t5,N t6 t7,L) Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
  • 28. Where did this come from T = 1 + T2 Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
  • 29. Where did this come from T = 1 + T2 Tk = Tk−1 + Tk+1 Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
  • 30. Penny game T0 T1 T2 T3 T4 T5 T6 T7 T8 start with a penny in position 1. aim is to move it to position 7 by splitting and combining Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
  • 31. Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
  • 32. Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
  • 33. Why did this work? If we have a type isomorphism T ∼= p(T) then Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
  • 34. Why did this work? If we have a type isomorphism T ∼= p(T) then q1(T) ∼= q2(T) as types ⇐⇒ q1(x) ∼= q2(x) in the rig N[x]/(p(x) = x) Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
  • 35. Why did this work? If we have a type isomorphism T ∼= p(T) then q1(T) ∼= q2(T) as types ⇐⇒ q1(x) ∼= q2(x) in the rig N[x]/(p(x) = x) ⇒ q1(x) ∼= q2(x) in the ring Z[x]/(p(x) = x) Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
  • 36. Why did this work? If we have a type isomorphism T ∼= p(T) then q1(T) ∼= q2(T) as types ⇐⇒ q1(x) ∼= q2(x) in the rig N[x]/(p(x) = x) ⇒ q1(x) ∼= q2(x) in the ring Z[x]/(p(x) = x) ⇒ q1(z) ∼= q2(z) for all z ∈ C such that p(z) = z. Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
  • 37. Why did this work? If we have a type isomorphism T ∼= p(T) then q1(T) ∼= q2(T) as types ⇐⇒ q1(x) ∼= q2(x) in the rig N[x]/(p(x) = x) ⇒ q1(x) ∼= q2(x) in the ring Z[x]/(p(x) = x) ⇒ q1(z) ∼= q2(z) for all z ∈ C such that p(z) = z. And, under some conditions, the reverse implications hold. Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
  • 38. Summary Simple arithmetic helps us find non-obvious type isomorphisms Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
  • 39. Extensions Are there extensions to datatypes of decorated trees? (multivariate polynomials) What applications are there? Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
  • 40. Extensions Are there extensions to datatypes of decorated trees? (multivariate polynomials) What applications are there? important when writing a compiler to know when two types are isomomorphic Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
  • 41. Extensions Are there extensions to datatypes of decorated trees? (multivariate polynomials) What applications are there? important when writing a compiler to know when two types are isomomorphic It could interesting to split up a tree-shaped stream into seven parts Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
  • 42. Rich theory behind isomorphisms of polynomial types brings together a number of fields distributive categories theory of rigs (semirings) combinatorial species type theory Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
  • 43. Further reading Seven Trees in one, Andreas Blass, Journal of Pure and Applied Algebra On the generic solution to P(X) = X in distributive categories, Robbie Gates Objects of Categories as Complex Numbers, Marcelo Fiore and Tom Leinster An Objective Representation of the Gaussian Integers, Marcelo Fiore and Tom Leinster http://rfcwalters.blogspot.com.au/2010/06/robbie-gates-on- seven-trees-in-one.html http://blog.sigfpe.com/2007/09/arboreal-isomorphisms-from- nuclear.html Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
  • 44. Challenge Consider this datatype (Motzkin trees): data Tree = Zero | One Tree | Two Tree Tree Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
  • 45. Challenge Consider this datatype (Motzkin trees): data Tree = Zero | One Tree | Two Tree Tree T = 1 + T + T2 Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
  • 46. Challenge Consider this datatype (Motzkin trees): data Tree = Zero | One Tree | Two Tree Tree T = 1 + T + T2 Show that T5 ∼= T by a nonsense argument using complex numbers by composing bijections (the penny game) implement the function and its inverse in a language of your choice Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
  • 47. Photo credits The Druid’s Grove, Norbury Park: Ancient Yew Trees by Thomas Allom 1804-1872 http://www.victorianweb.org/art/illustration/allom/1.html Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one
  • 48. End Mark Hopkins @antiselfdual Commonwealth Bank Seven trees in one