SlideShare une entreprise Scribd logo
1  sur  92
Télécharger pour lire hors ligne
λ-Calculus: A Brief History
Of Functional Programming
@yassine_meherzi
@yassine_meherzi#ScalaIO2019
@yassine_meherzi#ScalaIO2019
@yassine_meherzi#ScalaIO2019
David Hilbert
1862 – 1943
@yassine_meherzi#ScalaIO2019
Problème d’arrêt
David Hilbert
1862 – 1943
@yassine_meherzi#ScalaIO2019
Problème d’arrêt
David Hilbert
1862 – 1943
La réponse est NON
@yassine_meherzi#ScalaIO2019
Machine de Turing
(1936)
@yassine_meherzi#ScalaIO2019
Machine de Turing
(1936)
Lambda-Calcul
(1935-1936)
@yassine_meherzi#ScalaIO2019
Machine de Turing
Etat
Lambda-Calcul
Tout est fonction ≠
@yassine_meherzi#ScalaIO2019
Machine de Turing
Etat
Lambda-Calcul
Tout est fonction
Thèse
Church-Turing
@yassine_meherzi#ScalaIO2019
Machine de Turing
Etat
Lambda-Calcul
Tout est fonction
@yassine_meherzi#ScalaIO2019
@yassine_meherzi
Yassine Meherzi
Sr. Software Crafter
λ x.e
Syntaxe
λ-Abstraction
@yassine_meherzi#ScalaIO2019
λ x.eDébut de la fonction
Syntaxe
@yassine_meherzi#ScalaIO2019
λ x.e
Variable
Début de la fonction
Syntaxe
@yassine_meherzi#ScalaIO2019
λ x.e
Variable
Fin des arguments
Début de la fonction
Syntaxe
@yassine_meherzi#ScalaIO2019
λ x.e
Variable
Fin des arguments
ExpressionDébut de la fonction
Syntaxe
@yassine_meherzi#ScalaIO2019
e ::= variable (x, y, z…) Identifiant
Syntaxe
@yassine_meherzi#ScalaIO2019
e ::= variable (x, y, z…)
| λ variable . e’
Identifiant
Abstraction
Syntaxe
@yassine_meherzi#ScalaIO2019
e ::= variable (x, y, z…)
| λ variable . e’
| e1 e2
Syntaxe
Identifiant
Abstraction
Application
@yassine_meherzi#ScalaIO2019
e ::= variable (x, y, z…)
| λ variable . e’
| e1 e2
| ( e’ )
Syntaxe
Identifiant
Abstraction
Application
Groupement
@yassine_meherzi#ScalaIO2019
λ x.x
Identité
@yassine_meherzi#ScalaIO2019
Application (x = 5)
Application
(λ x.x) 5
@yassine_meherzi#ScalaIO2019
Application (x = 5)
Application
(λ x.x) 5
(λ x.x) 5
β-réduction
@yassine_meherzi#ScalaIO2019
Application (x = 5)
Application
(λ x.x) 5
(λ x.x) 5
5
β-réduction
@yassine_meherzi#ScalaIO2019
(λ x.x+1) 2
Application (x = 2)
Application
@yassine_meherzi#ScalaIO2019
(λ x.x+1) 2
Application (x = 2)
Application
@yassine_meherzi#ScalaIO2019
(λ x.x+1) 2
2+1
Application (x = 2)
Application
Redex
expression réductible
@yassine_meherzi#ScalaIO2019
(λ x.x+1) 2
2+1
3
Application (x = 2)
Application
Redex
expression réductible
@yassine_meherzi#ScalaIO2019
Ordre d’application
f a
Sens de réduction
@yassine_meherzi#ScalaIO2019
Ordre d’application
f g a
Sens de réduction
@yassine_meherzi#ScalaIO2019
Ordre d’application
(f g) a
Sens de réduction
@yassine_meherzi#ScalaIO2019
(λ x.x+2 λ y.y) 5
Ordre d’application
f g
@yassine_meherzi#ScalaIO2019
(λ x.x+2 λ y.y) 5
(λ y.y+2) 5
Ordre d’application
f g
@yassine_meherzi#ScalaIO2019
(λ x.x+2 λ y.y) 5
(λ y.y+2) 5
(λ y.y+2) 5
5+2
7
Ordre d’application
f g
@yassine_meherzi#ScalaIO2019
(λ x. x+x) (2 * 3)
Application (x = 2 * 3)
Stratégies d’évaluation
f a
@yassine_meherzi#ScalaIO2019
(λ x. x+x) (2 * 3)
(2 * 3) + (2 * 3)
6 + 6
12
Application (x = 2 * 3)
Stratégies d’évaluation
@yassine_meherzi#ScalaIO2019
(λ x. x+x) (2 * 3)
(2 * 3) + (2 * 3)
6 + 6
12
Application (x = 2 * 3)
(λ x. x+x) (2 * 3)
(λ x. x+x) 6
6 + 6
12
Stratégies d’évaluation
@yassine_meherzi#ScalaIO2019
(λ x. x+x) (2 * 3)
(2 * 3) + (2 * 3)
6 + 6
12
Application (x = 2 * 3)
(λ x. x+x) (2 * 3)
(λ x. x+x) 6
6 + 6
12
Ordre normal
Appel par nom
Ordre applicatif
Appel par valeur
Stratégies d’évaluation
@yassine_meherzi#ScalaIO2019
(λ x. a+1) (2 * 3)
Application (x = 2 * 3)
Stratégies d’évaluation
f a
@yassine_meherzi#ScalaIO2019
(λ x. a+1) (2 * 3)
a+1
Application (x = 2 * 3)
Stratégies d’évaluation
@yassine_meherzi#ScalaIO2019
(λ x. a+1) (2 * 3)
a+1
Application (x = 2 * 3)
(λ x. a+1) (2 * 3)
(λ x. a+1) 6
a+1
Stratégies d’évaluation
@yassine_meherzi#ScalaIO2019
(λ x. a+1) (2 * 3)
a+1
Application (x = 2 * 3)
(λ x. a+1) (2 * 3)
(λ x. a+1) 6
a+1
Stratégies d’évaluation
Evaluation retardée Evaluation immédiate
@yassine_meherzi#ScalaIO2019
Ordre normal
Appel par nom
Evaluation retardée
Ordre applicatif
Appel par valeur
Evaluation immédiate
Church-Rosser
Stratégies d’évaluation
@yassine_meherzi#ScalaIO2019
Ordre normal
Appel par nom
Evaluation retardée
Ordre applicatif
Appel par valeur
Evaluation immédiate
Church-Rosser
Stratégies d’évaluation
@yassine_meherzi#ScalaIO2019
Fonction anonyme
λ x.x+y
@yassine_meherzi#ScalaIO2019
λ x.x+y
Fonction anonyme
x: variable liée
y: variable libre
@yassine_meherzi#ScalaIO2019
Fonction anonyme
λ x.x+y
x: variable liée
y: variable libre
@yassine_meherzi#ScalaIO2019
Fonction pure
Fonction pure
x x + 1
Fonction pure
e ::= variable (x, y, z…)
| λ variable . e’
| e1 e2
| ( e’ )
Syntaxe
Identifiant
Abstraction
Application
Groupement
@yassine_meherzi#ScalaIO2019
λ x.x
Application (x = fonction)
Fonction d’ordre supérieur
@yassine_meherzi#ScalaIO2019
Fonction d’ordre supérieur
(λ x.x) λ y.y+1
Application (x = λ y.y+1 )
@yassine_meherzi#ScalaIO2019
Fonction d’ordre supérieur
(λ x.x) λ y.y+1
λ y.y+1
Application (x = λ y.y+1 )
Identité(f) = f
@yassine_meherzi#ScalaIO2019
Fonction d’ordre supérieur
@yassine_meherzi#ScalaIO2019
(x,y) => x+y ?
Fonction unaire
@yassine_meherzi#ScalaIO2019
(λxy. x+y) ?
Fonction unaire
@yassine_meherzi#ScalaIO2019
(λxy. x+y) => (λx. λy. x+y)
Fonction unaire
Curryfication
@yassine_meherzi#ScalaIO2019
Fonction unaire
(λ x. λ y. x+y) 1 2
Application (x = 1) (y = 2)
@yassine_meherzi#ScalaIO2019
Fonction unaire
(λ x. λ y. x+y) 1 2
(λ x. λ y. x+y) 1 2
Application (x = 1) (y = 2)
@yassine_meherzi#ScalaIO2019
Fonction unaire
(λ x. λ y. x+y) 1 2
(λ x. λ y. x+y) 1 2
(λ y. 1+y) 2
Application (x = 1) (y = 2)
Application partielle
@yassine_meherzi#ScalaIO2019
Fonction unaire
(λ x. λ y. x+y) 1 2
(λ x. λ y. x+y) 1 2
(λ y. 1+y) 2
1+2 = 3
Application (x = 1) (y = 2)
Application partielle
@yassine_meherzi#ScalaIO2019
Fonction unaire
@yassine_meherzi#ScalaIO2019
1936 λ-Calcul
1941 λ-Calcul simplement typé
1936 λ-Calcul
1941 λ-Calcul simplement typé
1958 Lisp 2007 Clojure1975 Scheme
1936 λ-Calcul
1941 λ-Calcul simplement typé
1958 Lisp 1975 Scheme 2007 Clojure
1972 λ-Calcul polymorphe
1936 λ-Calcul
1941 λ-Calcul simplement typé
1958 Lisp
1977 FP
2007 Clojure
1990 Haskell
1975 Scheme
1972 λ-Calcul polymorphe
1973 ML 1985 Miranda 1987 Caml1984 SML
1936 λ-Calcul
1941 λ-Calcul simplement typé
1958 Lisp 2007 Clojure
1990 Haskell
1975 Scheme
1972 λ-Calcul polymorphe
1973 ML
1986 Erlang
1977 FP
1985 Miranda 1987 Caml1984 SML
2011 Elixir
1936 λ-Calcul
1941 λ-Calcul simplement typé
1958 Lisp 2007 Clojure
1990 Haskell
1975 Scheme
1972 λ-Calcul polymorphe
1973 ML
2003 Scala
2002 F#
1996 OCaml
1986 Erlang 2011 Elixir
1977 FP
1985 Miranda 1987 Caml1984 SML
Conclusion
@yassine_meherzi#ScalaIO2019
Conclusion
@yassine_meherzi#ScalaIO2019
Conclusion
@yassine_meherzi#ScalaIO2019
Aller plus loin …
@yassine_meherzi
True = λ a. λb. a
False = λ a. λb. b
if = p ? e1 : e2
if = predicate x then-clause else-clause
If = λ p. λa. λb. p a b
Booléens
@yassine_meherzi#ScalaIO2019
True
False
And
Or
Not1
Not2
Xor
If
Booléens
λa. λb. a
λa. λb. b
λp. λq. p q p
λp. λq. p p q
λp. λa. λb. p b a
λp. p(λa. λb.b) (λa. λb.a)
λa. λb. a (not b) b
λp. λa. λb. p a b
@yassine_meherzi#ScalaIO2019
Y = λf. (λx. f(x x)) (λx. f(x x))
Récursivité
@yassine_meherzi#ScalaIO2019

Contenu connexe

En vedette

Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

En vedette (20)

PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 

Lambda Calculus: A Brief History Of Funtional Programming