SlideShare a Scribd company logo
1 of 6
Download to read offline
CHEAT-SHEET
Folding
#3
โˆถ
/ 
๐’‚๐ŸŽ โˆถ
/ 
๐’‚๐Ÿ โˆถ
/ 
๐’‚๐Ÿ โˆถ
/ 
๐’‚๐Ÿ‘
๐’‡
/ 
๐’‚๐ŸŽ ๐’‡
/ 
๐’‚๐Ÿ ๐’‡
/ 
๐’‚๐Ÿ ๐’‡
/ 
๐’‚๐Ÿ‘ ๐’†
@philip_schwarz
slides by https://fpilluminated.com/
The universal property of ๐’‡๐’๐’๐’…
...
For finite lists, the universal property of ๐’‡๐’๐’๐’… can be stated as the following equivalence between two definitions for a function ๐’ˆ that
processes lists:
๐’ˆ = ๐’— โŸบ ๐’ˆ = ๐’‡๐’๐’๐’… ๐’‡ ๐’—
๐’ˆ ๐‘ฅ โˆถ ๐‘ฅ๐‘  = ๐’‡ ๐‘ฅ ๐’ˆ ๐‘ฅ๐‘ 
In the right-to-left direction, substituting ๐’ˆ = ๐’‡๐’๐’๐’… ๐’‡ ๐’— into the two equations for ๐’ˆ gives the recursive definition for ๐’‡๐’๐’๐’….
Conversely, in the left-to-right direction the two equations for g are precisely the assumptions required to show that ๐’ˆ = ๐’‡๐’๐’๐’… ๐’‡ ๐’— using a
simple proof by induction on finite listsโ€ฆ
Taken as a whole, the universal property states that for finite lists the function ๐’‡๐’๐’๐’… ๐’‡ ๐’— is not just a solution to its defining equations, but
in fact the unique solutionโ€ฆ.
The universal property of ๐’‡๐’๐’๐’… can be generalised to handle partial and infinite listsโ€ฆ
Graham Hutton
@haskelhutt
๐‘“๐‘œ๐‘™๐‘‘ :: ๐›ผ โ†’ ๐›ฝ โ†’ ๐›ฝ โ†’ ๐›ฝ โ†’ ๐›ผ โ†’ ๐›ฝ
๐‘“๐‘œ๐‘™๐‘‘ ๐‘“ ๐‘ฃ = ๐‘ฃ
๐‘“๐‘œ๐‘™๐‘‘ ๐‘“ ๐‘ฃ ๐‘ฅ โˆถ ๐‘ฅ๐‘  = ๐‘“ ๐‘ฅ ๐‘“๐‘œ๐‘™๐‘‘ ๐‘“ ๐‘ฃ ๐‘ฅ๐‘ 
๐‘” = ๐‘ฃ
๐‘” ๐‘ฅ โˆถ ๐‘ฅ๐‘  = ๐‘“ ๐‘ฅ ๐‘” ๐‘ฅ๐‘ 
๐‘ ๐‘ข๐‘š โˆท ๐ผ๐‘›๐‘ก โ†’ ๐ผ๐‘›๐‘ก
๐‘ ๐‘ข๐‘š = 0
๐‘ ๐‘ข๐‘š ๐‘ฅ โˆถ ๐‘ฅ๐‘  = ๐‘ฅ + ๐‘ ๐‘ข๐‘š ๐‘ฅ๐‘ 
๐‘ ๐‘ข๐‘š = ๐‘“๐‘œ๐‘™๐‘‘ + 0
โŸบ
๐‘” = ๐‘“๐‘œ๐‘™๐‘‘ ๐‘“ ๐‘ฃ
โŸบ
๐‘๐‘Ÿ๐‘œ๐‘‘๐‘ข๐‘๐‘ก โˆท ๐ผ๐‘›๐‘ก โ†’ ๐ผ๐‘›๐‘ก
๐‘๐‘Ÿ๐‘œ๐‘‘๐‘ข๐‘๐‘ก = 1
๐‘๐‘Ÿ๐‘œ๐‘‘๐‘ข๐‘๐‘ก ๐‘ฅ โˆถ ๐‘ฅ๐‘  = ๐‘ฅ ร— ๐‘๐‘Ÿ๐‘œ๐‘‘๐‘ข๐‘๐‘ก ๐‘ฅ๐‘ 
๐‘๐‘Ÿ๐‘œ๐‘‘๐‘ข๐‘๐‘ก = ๐‘“๐‘œ๐‘™๐‘‘ (ร—) 1
โŸบ
๐‘™๐‘’๐‘›๐‘”๐‘กโ„Ž โˆท [ฮฑ] โ†’ ๐ผ๐‘›๐‘ก
๐‘™๐‘’๐‘›๐‘”๐‘กโ„Ž [ ] = 0
๐‘™๐‘’๐‘›๐‘”๐‘กโ„Ž ๐‘ฅ โˆถ ๐‘ฅ๐‘  = 1 + ๐‘™๐‘’๐‘›๐‘”๐‘กโ„Ž ๐‘ฅ๐‘ 
๐‘™๐‘’๐‘›๐‘”๐‘กโ„Ž = ๐‘“๐‘œ๐‘™๐‘‘ (๐œ†๐‘ฅ. ๐œ†๐‘›. 1 + ๐‘›) 0
โŸบ
(โงบ) โˆท [ฮฑ] โ†’ [ฮฑ] โ†’ [ฮฑ]
โงบ ๐‘ฆ๐‘  = ๐‘ฆ๐‘ 
๐‘ฅ โˆถ ๐‘ฅ๐‘  โงบ ๐‘ฆ๐‘  = ๐‘ฅ โˆถ (๐‘ฅ๐‘  โงบ ๐‘ฆ๐‘ )
(โงบ ๐‘ฆ๐‘ ) = ๐‘“๐‘œ๐‘™๐‘‘ โˆถ ๐‘ฆ๐‘ 
โŸบ
concat โˆท [ ฮฑ ] โ†’ [ฮฑ]
concat =
concat ๐‘ฅ๐‘  โˆถ ๐‘ฅ๐‘ ๐‘  = ๐‘ฅ๐‘  โงบ ๐‘๐‘œ๐‘›๐‘๐‘Ž๐‘ก ๐‘ฅ๐‘ ๐‘ 
โŸบ concat = ๐‘“๐‘œ๐‘™๐‘‘ (โงบ) [ ]
The Triad of
๐‘š๐‘Ž๐‘, ๐‘“๐‘–๐‘™๐‘ก๐‘’๐‘Ÿ and ๐‘“๐‘œ๐‘™๐‘‘
๐‘š๐‘Ž๐‘
ฮป
The ๐‘๐‘Ÿ๐‘’๐‘Ž๐‘‘, ๐‘๐‘ข๐‘ก๐‘ก๐‘’๐‘Ÿ, and ๐‘—๐‘Ž๐‘š of
Functional Programming
=
๐‘” = ๐‘ฃ
๐‘” ๐‘ฅ โˆถ ๐‘ฅ๐‘  = ๐‘“ ๐‘ฅ ๐‘” ๐‘ฅ๐‘ 
๐‘š๐‘Ž๐‘ โˆท ๐›ผ โ†’ ๐›ฝ โ†’ ๐›ผ โ†’ ๐›ฝ
๐‘š๐‘Ž๐‘ ๐‘“ =
๐‘š๐‘Ž๐‘ ๐‘“ ๐‘ฅ โˆถ ๐‘ฅ๐‘  = ๐‘“ ๐‘ฅ โˆถ ๐‘š๐‘Ž๐‘ ๐‘“ ๐‘ฅ๐‘ 
๐‘š๐‘Ž๐‘ ๐‘“ = ๐‘“๐‘œ๐‘™๐‘‘๐‘Ÿ ๐œ†๐‘ฅ. ๐œ†๐‘ฅ๐‘ . ๐‘“ ๐‘ฅ โˆถ ๐‘ฅ๐‘  [ ]
โŸบ
๐‘“๐‘–๐‘™๐‘ก๐‘’๐‘Ÿ โˆท (๐›ผ โ†’ ๐ต๐‘œ๐‘œ๐‘™) โ†’ ๐›ผ โ†’ ๐‘Ž
๐‘“๐‘–๐‘™๐‘ก๐‘’๐‘Ÿ p =
๐‘“๐‘–๐‘™๐‘ก๐‘’๐‘Ÿ p ๐‘ฅ โˆถ ๐‘ฅ๐‘  = ๐ข๐Ÿ ๐‘ ๐‘ฅ
๐ญ๐ก๐ž๐ง ๐‘ฅ โˆถ ๐‘“๐‘–๐‘™๐‘ก๐‘’๐‘Ÿ p ๐‘ฅ๐‘ 
๐ž๐ฅ๐ฌ๐ž ๐‘“๐‘–๐‘™๐‘ก๐‘’๐‘Ÿ p ๐‘ฅ๐‘ 
๐‘“๐‘–๐‘™๐‘ก๐‘’๐‘Ÿ p = ๐‘“๐‘œ๐‘™๐‘‘๐‘Ÿ (๐œ†๐‘ฅ. ๐œ†๐‘ฅ๐‘ . ๐ข๐Ÿ ๐‘ ๐‘ฅ ๐ญ๐ก๐ž๐ง ๐‘ฅ โˆถ ๐‘ฅ๐‘  ๐ž๐ฅ๐ฌ๐ž ๐‘ฅ๐‘ ) [ ]
โŸบ
๐‘” = ๐‘“๐‘œ๐‘™๐‘‘๐‘Ÿ ๐‘“ ๐‘ฃ
โŸบ
๐‘š๐‘Ž๐‘
ฮป
๐‘“๐‘œ๐‘™๐‘‘
=
https://fpilluminated.com/
inspired
by

More Related Content

Similar to Folding Cheat Sheet #3 - third in a series

Module 7 the antiderivative
Module 7  the antiderivativeModule 7  the antiderivative
Module 7 the antiderivativeREYEMMANUELILUMBA
ย 
Module 7 the antiderivative
Module 7  the antiderivativeModule 7  the antiderivative
Module 7 the antiderivativeREYEMMANUELILUMBA
ย 
Application of Convolution Theorem
Application of Convolution TheoremApplication of Convolution Theorem
Application of Convolution Theoremijtsrd
ย 
PRODUCT RULES
PRODUCT RULESPRODUCT RULES
PRODUCT RULESNumanUsama
ย 
Laplace Transform and its applications
Laplace Transform and its applicationsLaplace Transform and its applications
Laplace Transform and its applicationsDeepRaval7
ย 
Domain-Range-Intercepts-Zeros-and-Asymptotes-of-Rational-Function.pptx
Domain-Range-Intercepts-Zeros-and-Asymptotes-of-Rational-Function.pptxDomain-Range-Intercepts-Zeros-and-Asymptotes-of-Rational-Function.pptx
Domain-Range-Intercepts-Zeros-and-Asymptotes-of-Rational-Function.pptxNeomyAngelaLeono1
ย 
Taller grupal parcial ii nrc 3246 sebastian fueltala_kevin sรกnchez
Taller grupal parcial ii nrc 3246  sebastian fueltala_kevin sรกnchezTaller grupal parcial ii nrc 3246  sebastian fueltala_kevin sรกnchez
Taller grupal parcial ii nrc 3246 sebastian fueltala_kevin sรกnchezkevinct2001
ย 
C222529
C222529C222529
C222529irjes
ย 
Dual Spaces of Generalized Cesaro Sequence Space and Related Matrix Mapping
Dual Spaces of Generalized Cesaro Sequence Space and Related Matrix MappingDual Spaces of Generalized Cesaro Sequence Space and Related Matrix Mapping
Dual Spaces of Generalized Cesaro Sequence Space and Related Matrix Mappinginventionjournals
ย 
Matrix Transformations on Some Difference Sequence Spaces
Matrix Transformations on Some Difference Sequence SpacesMatrix Transformations on Some Difference Sequence Spaces
Matrix Transformations on Some Difference Sequence SpacesIOSR Journals
ย 
Integrales definidas y mรฉtodo de integraciรณn por partes
Integrales definidas y mรฉtodo de integraciรณn por partesIntegrales definidas y mรฉtodo de integraciรณn por partes
Integrales definidas y mรฉtodo de integraciรณn por partescrysmari mujica
ย 
A Probabilistic Algorithm for Computation of Polynomial Greatest Common with ...
A Probabilistic Algorithm for Computation of Polynomial Greatest Common with ...A Probabilistic Algorithm for Computation of Polynomial Greatest Common with ...
A Probabilistic Algorithm for Computation of Polynomial Greatest Common with ...mathsjournal
ย 
Typesetting Mathematics with LaTeX - Day 2
Typesetting Mathematics with LaTeX - Day 2Typesetting Mathematics with LaTeX - Day 2
Typesetting Mathematics with LaTeX - Day 2Suddhasheel GHOSH, PhD
ย 
Differential Geometry for Machine Learning
Differential Geometry for Machine LearningDifferential Geometry for Machine Learning
Differential Geometry for Machine LearningSEMINARGROOT
ย 
SPLIT PLOT DESIGN new.pptx
SPLIT PLOT DESIGN new.pptxSPLIT PLOT DESIGN new.pptx
SPLIT PLOT DESIGN new.pptxValeDiode
ย 
Semana 24 funciones iv รกlgebra uni ccesa007
Semana 24 funciones iv รกlgebra uni ccesa007Semana 24 funciones iv รกlgebra uni ccesa007
Semana 24 funciones iv รกlgebra uni ccesa007Demetrio Ccesa Rayme
ย 
Integral dalam Bahasa Inggris
Integral dalam Bahasa InggrisIntegral dalam Bahasa Inggris
Integral dalam Bahasa Inggrisimmochacha
ย 
Inverse Function.pptx
Inverse Function.pptxInverse Function.pptx
Inverse Function.pptxSerGeo5
ย 

Similar to Folding Cheat Sheet #3 - third in a series (20)

Module 7 the antiderivative
Module 7  the antiderivativeModule 7  the antiderivative
Module 7 the antiderivative
ย 
Module 7 the antiderivative
Module 7  the antiderivativeModule 7  the antiderivative
Module 7 the antiderivative
ย 
Application of Convolution Theorem
Application of Convolution TheoremApplication of Convolution Theorem
Application of Convolution Theorem
ย 
PRODUCT RULES
PRODUCT RULESPRODUCT RULES
PRODUCT RULES
ย 
Laplace Transform and its applications
Laplace Transform and its applicationsLaplace Transform and its applications
Laplace Transform and its applications
ย 
Domain-Range-Intercepts-Zeros-and-Asymptotes-of-Rational-Function.pptx
Domain-Range-Intercepts-Zeros-and-Asymptotes-of-Rational-Function.pptxDomain-Range-Intercepts-Zeros-and-Asymptotes-of-Rational-Function.pptx
Domain-Range-Intercepts-Zeros-and-Asymptotes-of-Rational-Function.pptx
ย 
Taller grupal parcial ii nrc 3246 sebastian fueltala_kevin sรกnchez
Taller grupal parcial ii nrc 3246  sebastian fueltala_kevin sรกnchezTaller grupal parcial ii nrc 3246  sebastian fueltala_kevin sรกnchez
Taller grupal parcial ii nrc 3246 sebastian fueltala_kevin sรกnchez
ย 
C222529
C222529C222529
C222529
ย 
Dual Spaces of Generalized Cesaro Sequence Space and Related Matrix Mapping
Dual Spaces of Generalized Cesaro Sequence Space and Related Matrix MappingDual Spaces of Generalized Cesaro Sequence Space and Related Matrix Mapping
Dual Spaces of Generalized Cesaro Sequence Space and Related Matrix Mapping
ย 
Matrix Transformations on Some Difference Sequence Spaces
Matrix Transformations on Some Difference Sequence SpacesMatrix Transformations on Some Difference Sequence Spaces
Matrix Transformations on Some Difference Sequence Spaces
ย 
Integrales definidas y mรฉtodo de integraciรณn por partes
Integrales definidas y mรฉtodo de integraciรณn por partesIntegrales definidas y mรฉtodo de integraciรณn por partes
Integrales definidas y mรฉtodo de integraciรณn por partes
ย 
A Probabilistic Algorithm for Computation of Polynomial Greatest Common with ...
A Probabilistic Algorithm for Computation of Polynomial Greatest Common with ...A Probabilistic Algorithm for Computation of Polynomial Greatest Common with ...
A Probabilistic Algorithm for Computation of Polynomial Greatest Common with ...
ย 
Typesetting Mathematics with LaTeX - Day 2
Typesetting Mathematics with LaTeX - Day 2Typesetting Mathematics with LaTeX - Day 2
Typesetting Mathematics with LaTeX - Day 2
ย 
Differential Geometry for Machine Learning
Differential Geometry for Machine LearningDifferential Geometry for Machine Learning
Differential Geometry for Machine Learning
ย 
SPLIT PLOT DESIGN new.pptx
SPLIT PLOT DESIGN new.pptxSPLIT PLOT DESIGN new.pptx
SPLIT PLOT DESIGN new.pptx
ย 
Semana 24 funciones iv รกlgebra uni ccesa007
Semana 24 funciones iv รกlgebra uni ccesa007Semana 24 funciones iv รกlgebra uni ccesa007
Semana 24 funciones iv รกlgebra uni ccesa007
ย 
Integral dalam Bahasa Inggris
Integral dalam Bahasa InggrisIntegral dalam Bahasa Inggris
Integral dalam Bahasa Inggris
ย 
E0561719
E0561719E0561719
E0561719
ย 
Integral calculus
Integral calculusIntegral calculus
Integral calculus
ย 
Inverse Function.pptx
Inverse Function.pptxInverse Function.pptx
Inverse Function.pptx
ย 

More from Philip Schwarz

Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
ย 
Folding Cheat Sheet #2 - second in a series
Folding Cheat Sheet #2 - second in a seriesFolding Cheat Sheet #2 - second in a series
Folding Cheat Sheet #2 - second in a seriesPhilip Schwarz
ย 
Scala Left Fold Parallelisation - Three Approaches
Scala Left Fold Parallelisation- Three ApproachesScala Left Fold Parallelisation- Three Approaches
Scala Left Fold Parallelisation - Three ApproachesPhilip Schwarz
ย 
Tagless Final Encoding - Algebras and Interpreters and also Programs
Tagless Final Encoding - Algebras and Interpreters and also ProgramsTagless Final Encoding - Algebras and Interpreters and also Programs
Tagless Final Encoding - Algebras and Interpreters and also ProgramsPhilip Schwarz
ย 
Fusing Transformations of Strict Scala Collections with Views
Fusing Transformations of Strict Scala Collections with ViewsFusing Transformations of Strict Scala Collections with Views
Fusing Transformations of Strict Scala Collections with ViewsPhilip Schwarz
ย 
A sighting of traverse_ function in Practical FP in Scala
A sighting of traverse_ function in Practical FP in ScalaA sighting of traverse_ function in Practical FP in Scala
A sighting of traverse_ function in Practical FP in ScalaPhilip Schwarz
ย 
A sighting of traverseFilter and foldMap in Practical FP in Scala
A sighting of traverseFilter and foldMap in Practical FP in ScalaA sighting of traverseFilter and foldMap in Practical FP in Scala
A sighting of traverseFilter and foldMap in Practical FP in ScalaPhilip Schwarz
ย 
A sighting of sequence function in Practical FP in Scala
A sighting of sequence function in Practical FP in ScalaA sighting of sequence function in Practical FP in Scala
A sighting of sequence function in Practical FP in ScalaPhilip Schwarz
ย 
N-Queens Combinatorial Puzzle meets Cats
N-Queens Combinatorial Puzzle meets CatsN-Queens Combinatorial Puzzle meets Cats
N-Queens Combinatorial Puzzle meets CatsPhilip Schwarz
ย 
Kleisli composition, flatMap, join, map, unit - implementation and interrelat...
Kleisli composition, flatMap, join, map, unit - implementation and interrelat...Kleisli composition, flatMap, join, map, unit - implementation and interrelat...
Kleisli composition, flatMap, join, map, unit - implementation and interrelat...Philip Schwarz
ย 
The aggregate function - from sequential and parallel folds to parallel aggre...
The aggregate function - from sequential and parallel folds to parallel aggre...The aggregate function - from sequential and parallel folds to parallel aggre...
The aggregate function - from sequential and parallel folds to parallel aggre...Philip Schwarz
ย 
Nat, List and Option Monoids - from scratch - Combining and Folding - an example
Nat, List and Option Monoids -from scratch -Combining and Folding -an exampleNat, List and Option Monoids -from scratch -Combining and Folding -an example
Nat, List and Option Monoids - from scratch - Combining and Folding - an examplePhilip Schwarz
ย 
Nat, List and Option Monoids - from scratch - Combining and Folding - an example
Nat, List and Option Monoids -from scratch -Combining and Folding -an exampleNat, List and Option Monoids -from scratch -Combining and Folding -an example
Nat, List and Option Monoids - from scratch - Combining and Folding - an examplePhilip Schwarz
ย 
The Sieve of Eratosthenes - Part II - Genuine versus Unfaithful Sieve - Haske...
The Sieve of Eratosthenes - Part II - Genuine versus Unfaithful Sieve - Haske...The Sieve of Eratosthenes - Part II - Genuine versus Unfaithful Sieve - Haske...
The Sieve of Eratosthenes - Part II - Genuine versus Unfaithful Sieve - Haske...Philip Schwarz
ย 
Sum and Product Types - The Fruit Salad & Fruit Snack Example - From F# to Ha...
Sum and Product Types -The Fruit Salad & Fruit Snack Example - From F# to Ha...Sum and Product Types -The Fruit Salad & Fruit Snack Example - From F# to Ha...
Sum and Product Types - The Fruit Salad & Fruit Snack Example - From F# to Ha...Philip Schwarz
ย 
Algebraic Data Types for Data Oriented Programming - From Haskell and Scala t...
Algebraic Data Types forData Oriented Programming - From Haskell and Scala t...Algebraic Data Types forData Oriented Programming - From Haskell and Scala t...
Algebraic Data Types for Data Oriented Programming - From Haskell and Scala t...Philip Schwarz
ย 
Jordan Peterson - The pursuit of meaning and related ethical axioms
Jordan Peterson - The pursuit of meaning and related ethical axiomsJordan Peterson - The pursuit of meaning and related ethical axioms
Jordan Peterson - The pursuit of meaning and related ethical axiomsPhilip Schwarz
ย 
Defining filter using (a) recursion (b) folding (c) folding with S, B and I c...
Defining filter using (a) recursion (b) folding (c) folding with S, B and I c...Defining filter using (a) recursion (b) folding (c) folding with S, B and I c...
Defining filter using (a) recursion (b) folding (c) folding with S, B and I c...Philip Schwarz
ย 
Defining filter using (a) recursion (b) folding with S, B and I combinators (...
Defining filter using (a) recursion (b) folding with S, B and I combinators (...Defining filter using (a) recursion (b) folding with S, B and I combinators (...
Defining filter using (a) recursion (b) folding with S, B and I combinators (...Philip Schwarz
ย 
The Sieve of Eratosthenes - Part 1 - with minor corrections
The Sieve of Eratosthenes - Part 1 - with minor correctionsThe Sieve of Eratosthenes - Part 1 - with minor corrections
The Sieve of Eratosthenes - Part 1 - with minor correctionsPhilip Schwarz
ย 

More from Philip Schwarz (20)

Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
ย 
Folding Cheat Sheet #2 - second in a series
Folding Cheat Sheet #2 - second in a seriesFolding Cheat Sheet #2 - second in a series
Folding Cheat Sheet #2 - second in a series
ย 
Scala Left Fold Parallelisation - Three Approaches
Scala Left Fold Parallelisation- Three ApproachesScala Left Fold Parallelisation- Three Approaches
Scala Left Fold Parallelisation - Three Approaches
ย 
Tagless Final Encoding - Algebras and Interpreters and also Programs
Tagless Final Encoding - Algebras and Interpreters and also ProgramsTagless Final Encoding - Algebras and Interpreters and also Programs
Tagless Final Encoding - Algebras and Interpreters and also Programs
ย 
Fusing Transformations of Strict Scala Collections with Views
Fusing Transformations of Strict Scala Collections with ViewsFusing Transformations of Strict Scala Collections with Views
Fusing Transformations of Strict Scala Collections with Views
ย 
A sighting of traverse_ function in Practical FP in Scala
A sighting of traverse_ function in Practical FP in ScalaA sighting of traverse_ function in Practical FP in Scala
A sighting of traverse_ function in Practical FP in Scala
ย 
A sighting of traverseFilter and foldMap in Practical FP in Scala
A sighting of traverseFilter and foldMap in Practical FP in ScalaA sighting of traverseFilter and foldMap in Practical FP in Scala
A sighting of traverseFilter and foldMap in Practical FP in Scala
ย 
A sighting of sequence function in Practical FP in Scala
A sighting of sequence function in Practical FP in ScalaA sighting of sequence function in Practical FP in Scala
A sighting of sequence function in Practical FP in Scala
ย 
N-Queens Combinatorial Puzzle meets Cats
N-Queens Combinatorial Puzzle meets CatsN-Queens Combinatorial Puzzle meets Cats
N-Queens Combinatorial Puzzle meets Cats
ย 
Kleisli composition, flatMap, join, map, unit - implementation and interrelat...
Kleisli composition, flatMap, join, map, unit - implementation and interrelat...Kleisli composition, flatMap, join, map, unit - implementation and interrelat...
Kleisli composition, flatMap, join, map, unit - implementation and interrelat...
ย 
The aggregate function - from sequential and parallel folds to parallel aggre...
The aggregate function - from sequential and parallel folds to parallel aggre...The aggregate function - from sequential and parallel folds to parallel aggre...
The aggregate function - from sequential and parallel folds to parallel aggre...
ย 
Nat, List and Option Monoids - from scratch - Combining and Folding - an example
Nat, List and Option Monoids -from scratch -Combining and Folding -an exampleNat, List and Option Monoids -from scratch -Combining and Folding -an example
Nat, List and Option Monoids - from scratch - Combining and Folding - an example
ย 
Nat, List and Option Monoids - from scratch - Combining and Folding - an example
Nat, List and Option Monoids -from scratch -Combining and Folding -an exampleNat, List and Option Monoids -from scratch -Combining and Folding -an example
Nat, List and Option Monoids - from scratch - Combining and Folding - an example
ย 
The Sieve of Eratosthenes - Part II - Genuine versus Unfaithful Sieve - Haske...
The Sieve of Eratosthenes - Part II - Genuine versus Unfaithful Sieve - Haske...The Sieve of Eratosthenes - Part II - Genuine versus Unfaithful Sieve - Haske...
The Sieve of Eratosthenes - Part II - Genuine versus Unfaithful Sieve - Haske...
ย 
Sum and Product Types - The Fruit Salad & Fruit Snack Example - From F# to Ha...
Sum and Product Types -The Fruit Salad & Fruit Snack Example - From F# to Ha...Sum and Product Types -The Fruit Salad & Fruit Snack Example - From F# to Ha...
Sum and Product Types - The Fruit Salad & Fruit Snack Example - From F# to Ha...
ย 
Algebraic Data Types for Data Oriented Programming - From Haskell and Scala t...
Algebraic Data Types forData Oriented Programming - From Haskell and Scala t...Algebraic Data Types forData Oriented Programming - From Haskell and Scala t...
Algebraic Data Types for Data Oriented Programming - From Haskell and Scala t...
ย 
Jordan Peterson - The pursuit of meaning and related ethical axioms
Jordan Peterson - The pursuit of meaning and related ethical axiomsJordan Peterson - The pursuit of meaning and related ethical axioms
Jordan Peterson - The pursuit of meaning and related ethical axioms
ย 
Defining filter using (a) recursion (b) folding (c) folding with S, B and I c...
Defining filter using (a) recursion (b) folding (c) folding with S, B and I c...Defining filter using (a) recursion (b) folding (c) folding with S, B and I c...
Defining filter using (a) recursion (b) folding (c) folding with S, B and I c...
ย 
Defining filter using (a) recursion (b) folding with S, B and I combinators (...
Defining filter using (a) recursion (b) folding with S, B and I combinators (...Defining filter using (a) recursion (b) folding with S, B and I combinators (...
Defining filter using (a) recursion (b) folding with S, B and I combinators (...
ย 
The Sieve of Eratosthenes - Part 1 - with minor corrections
The Sieve of Eratosthenes - Part 1 - with minor correctionsThe Sieve of Eratosthenes - Part 1 - with minor corrections
The Sieve of Eratosthenes - Part 1 - with minor corrections
ย 

Recently uploaded

Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
ย 
Call Us๐Ÿ”>เผ’+91-9711147426โ‡›Call In girls karol bagh (Delhi)
Call Us๐Ÿ”>เผ’+91-9711147426โ‡›Call In girls karol bagh (Delhi)Call Us๐Ÿ”>เผ’+91-9711147426โ‡›Call In girls karol bagh (Delhi)
Call Us๐Ÿ”>เผ’+91-9711147426โ‡›Call In girls karol bagh (Delhi)jennyeacort
ย 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Rob Geurden
ย 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
ย 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
ย 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
ย 
่‹ฑๅ›ฝUNๅญฆไฝ่ฏ,ๅŒ—ๅฎ‰ๆ™ฎ้กฟๅคงๅญฆๆฏ•ไธš่ฏไนฆ1:1ๅˆถไฝœ
่‹ฑๅ›ฝUNๅญฆไฝ่ฏ,ๅŒ—ๅฎ‰ๆ™ฎ้กฟๅคงๅญฆๆฏ•ไธš่ฏไนฆ1:1ๅˆถไฝœ่‹ฑๅ›ฝUNๅญฆไฝ่ฏ,ๅŒ—ๅฎ‰ๆ™ฎ้กฟๅคงๅญฆๆฏ•ไธš่ฏไนฆ1:1ๅˆถไฝœ
่‹ฑๅ›ฝUNๅญฆไฝ่ฏ,ๅŒ—ๅฎ‰ๆ™ฎ้กฟๅคงๅญฆๆฏ•ไธš่ฏไนฆ1:1ๅˆถไฝœqr0udbr0
ย 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
ย 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxAndreas Kunz
ย 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
ย 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
ย 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
ย 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
ย 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
ย 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
ย 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLionel Briand
ย 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsChristian Birchler
ย 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfDrew Moseley
ย 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecturerahul_net
ย 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
ย 

Recently uploaded (20)

Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
ย 
Call Us๐Ÿ”>เผ’+91-9711147426โ‡›Call In girls karol bagh (Delhi)
Call Us๐Ÿ”>เผ’+91-9711147426โ‡›Call In girls karol bagh (Delhi)Call Us๐Ÿ”>เผ’+91-9711147426โ‡›Call In girls karol bagh (Delhi)
Call Us๐Ÿ”>เผ’+91-9711147426โ‡›Call In girls karol bagh (Delhi)
ย 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...
ย 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
ย 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
ย 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
ย 
่‹ฑๅ›ฝUNๅญฆไฝ่ฏ,ๅŒ—ๅฎ‰ๆ™ฎ้กฟๅคงๅญฆๆฏ•ไธš่ฏไนฆ1:1ๅˆถไฝœ
่‹ฑๅ›ฝUNๅญฆไฝ่ฏ,ๅŒ—ๅฎ‰ๆ™ฎ้กฟๅคงๅญฆๆฏ•ไธš่ฏไนฆ1:1ๅˆถไฝœ่‹ฑๅ›ฝUNๅญฆไฝ่ฏ,ๅŒ—ๅฎ‰ๆ™ฎ้กฟๅคงๅญฆๆฏ•ไธš่ฏไนฆ1:1ๅˆถไฝœ
่‹ฑๅ›ฝUNๅญฆไฝ่ฏ,ๅŒ—ๅฎ‰ๆ™ฎ้กฟๅคงๅญฆๆฏ•ไธš่ฏไนฆ1:1ๅˆถไฝœ
ย 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
ย 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
ย 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
ย 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
ย 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
ย 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
ย 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
ย 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
ย 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and Repair
ย 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
ย 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdf
ย 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecture
ย 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
ย 

Folding Cheat Sheet #3 - third in a series

  • 1. CHEAT-SHEET Folding #3 โˆถ / ๐’‚๐ŸŽ โˆถ / ๐’‚๐Ÿ โˆถ / ๐’‚๐Ÿ โˆถ / ๐’‚๐Ÿ‘ ๐’‡ / ๐’‚๐ŸŽ ๐’‡ / ๐’‚๐Ÿ ๐’‡ / ๐’‚๐Ÿ ๐’‡ / ๐’‚๐Ÿ‘ ๐’† @philip_schwarz slides by https://fpilluminated.com/
  • 2. The universal property of ๐’‡๐’๐’๐’… ... For finite lists, the universal property of ๐’‡๐’๐’๐’… can be stated as the following equivalence between two definitions for a function ๐’ˆ that processes lists: ๐’ˆ = ๐’— โŸบ ๐’ˆ = ๐’‡๐’๐’๐’… ๐’‡ ๐’— ๐’ˆ ๐‘ฅ โˆถ ๐‘ฅ๐‘  = ๐’‡ ๐‘ฅ ๐’ˆ ๐‘ฅ๐‘  In the right-to-left direction, substituting ๐’ˆ = ๐’‡๐’๐’๐’… ๐’‡ ๐’— into the two equations for ๐’ˆ gives the recursive definition for ๐’‡๐’๐’๐’…. Conversely, in the left-to-right direction the two equations for g are precisely the assumptions required to show that ๐’ˆ = ๐’‡๐’๐’๐’… ๐’‡ ๐’— using a simple proof by induction on finite listsโ€ฆ Taken as a whole, the universal property states that for finite lists the function ๐’‡๐’๐’๐’… ๐’‡ ๐’— is not just a solution to its defining equations, but in fact the unique solutionโ€ฆ. The universal property of ๐’‡๐’๐’๐’… can be generalised to handle partial and infinite listsโ€ฆ Graham Hutton @haskelhutt ๐‘“๐‘œ๐‘™๐‘‘ :: ๐›ผ โ†’ ๐›ฝ โ†’ ๐›ฝ โ†’ ๐›ฝ โ†’ ๐›ผ โ†’ ๐›ฝ ๐‘“๐‘œ๐‘™๐‘‘ ๐‘“ ๐‘ฃ = ๐‘ฃ ๐‘“๐‘œ๐‘™๐‘‘ ๐‘“ ๐‘ฃ ๐‘ฅ โˆถ ๐‘ฅ๐‘  = ๐‘“ ๐‘ฅ ๐‘“๐‘œ๐‘™๐‘‘ ๐‘“ ๐‘ฃ ๐‘ฅ๐‘ 
  • 3. ๐‘” = ๐‘ฃ ๐‘” ๐‘ฅ โˆถ ๐‘ฅ๐‘  = ๐‘“ ๐‘ฅ ๐‘” ๐‘ฅ๐‘  ๐‘ ๐‘ข๐‘š โˆท ๐ผ๐‘›๐‘ก โ†’ ๐ผ๐‘›๐‘ก ๐‘ ๐‘ข๐‘š = 0 ๐‘ ๐‘ข๐‘š ๐‘ฅ โˆถ ๐‘ฅ๐‘  = ๐‘ฅ + ๐‘ ๐‘ข๐‘š ๐‘ฅ๐‘  ๐‘ ๐‘ข๐‘š = ๐‘“๐‘œ๐‘™๐‘‘ + 0 โŸบ ๐‘” = ๐‘“๐‘œ๐‘™๐‘‘ ๐‘“ ๐‘ฃ โŸบ ๐‘๐‘Ÿ๐‘œ๐‘‘๐‘ข๐‘๐‘ก โˆท ๐ผ๐‘›๐‘ก โ†’ ๐ผ๐‘›๐‘ก ๐‘๐‘Ÿ๐‘œ๐‘‘๐‘ข๐‘๐‘ก = 1 ๐‘๐‘Ÿ๐‘œ๐‘‘๐‘ข๐‘๐‘ก ๐‘ฅ โˆถ ๐‘ฅ๐‘  = ๐‘ฅ ร— ๐‘๐‘Ÿ๐‘œ๐‘‘๐‘ข๐‘๐‘ก ๐‘ฅ๐‘  ๐‘๐‘Ÿ๐‘œ๐‘‘๐‘ข๐‘๐‘ก = ๐‘“๐‘œ๐‘™๐‘‘ (ร—) 1 โŸบ ๐‘™๐‘’๐‘›๐‘”๐‘กโ„Ž โˆท [ฮฑ] โ†’ ๐ผ๐‘›๐‘ก ๐‘™๐‘’๐‘›๐‘”๐‘กโ„Ž [ ] = 0 ๐‘™๐‘’๐‘›๐‘”๐‘กโ„Ž ๐‘ฅ โˆถ ๐‘ฅ๐‘  = 1 + ๐‘™๐‘’๐‘›๐‘”๐‘กโ„Ž ๐‘ฅ๐‘  ๐‘™๐‘’๐‘›๐‘”๐‘กโ„Ž = ๐‘“๐‘œ๐‘™๐‘‘ (๐œ†๐‘ฅ. ๐œ†๐‘›. 1 + ๐‘›) 0 โŸบ (โงบ) โˆท [ฮฑ] โ†’ [ฮฑ] โ†’ [ฮฑ] โงบ ๐‘ฆ๐‘  = ๐‘ฆ๐‘  ๐‘ฅ โˆถ ๐‘ฅ๐‘  โงบ ๐‘ฆ๐‘  = ๐‘ฅ โˆถ (๐‘ฅ๐‘  โงบ ๐‘ฆ๐‘ ) (โงบ ๐‘ฆ๐‘ ) = ๐‘“๐‘œ๐‘™๐‘‘ โˆถ ๐‘ฆ๐‘  โŸบ concat โˆท [ ฮฑ ] โ†’ [ฮฑ] concat = concat ๐‘ฅ๐‘  โˆถ ๐‘ฅ๐‘ ๐‘  = ๐‘ฅ๐‘  โงบ ๐‘๐‘œ๐‘›๐‘๐‘Ž๐‘ก ๐‘ฅ๐‘ ๐‘  โŸบ concat = ๐‘“๐‘œ๐‘™๐‘‘ (โงบ) [ ]
  • 4. The Triad of ๐‘š๐‘Ž๐‘, ๐‘“๐‘–๐‘™๐‘ก๐‘’๐‘Ÿ and ๐‘“๐‘œ๐‘™๐‘‘ ๐‘š๐‘Ž๐‘ ฮป The ๐‘๐‘Ÿ๐‘’๐‘Ž๐‘‘, ๐‘๐‘ข๐‘ก๐‘ก๐‘’๐‘Ÿ, and ๐‘—๐‘Ž๐‘š of Functional Programming =
  • 5. ๐‘” = ๐‘ฃ ๐‘” ๐‘ฅ โˆถ ๐‘ฅ๐‘  = ๐‘“ ๐‘ฅ ๐‘” ๐‘ฅ๐‘  ๐‘š๐‘Ž๐‘ โˆท ๐›ผ โ†’ ๐›ฝ โ†’ ๐›ผ โ†’ ๐›ฝ ๐‘š๐‘Ž๐‘ ๐‘“ = ๐‘š๐‘Ž๐‘ ๐‘“ ๐‘ฅ โˆถ ๐‘ฅ๐‘  = ๐‘“ ๐‘ฅ โˆถ ๐‘š๐‘Ž๐‘ ๐‘“ ๐‘ฅ๐‘  ๐‘š๐‘Ž๐‘ ๐‘“ = ๐‘“๐‘œ๐‘™๐‘‘๐‘Ÿ ๐œ†๐‘ฅ. ๐œ†๐‘ฅ๐‘ . ๐‘“ ๐‘ฅ โˆถ ๐‘ฅ๐‘  [ ] โŸบ ๐‘“๐‘–๐‘™๐‘ก๐‘’๐‘Ÿ โˆท (๐›ผ โ†’ ๐ต๐‘œ๐‘œ๐‘™) โ†’ ๐›ผ โ†’ ๐‘Ž ๐‘“๐‘–๐‘™๐‘ก๐‘’๐‘Ÿ p = ๐‘“๐‘–๐‘™๐‘ก๐‘’๐‘Ÿ p ๐‘ฅ โˆถ ๐‘ฅ๐‘  = ๐ข๐Ÿ ๐‘ ๐‘ฅ ๐ญ๐ก๐ž๐ง ๐‘ฅ โˆถ ๐‘“๐‘–๐‘™๐‘ก๐‘’๐‘Ÿ p ๐‘ฅ๐‘  ๐ž๐ฅ๐ฌ๐ž ๐‘“๐‘–๐‘™๐‘ก๐‘’๐‘Ÿ p ๐‘ฅ๐‘  ๐‘“๐‘–๐‘™๐‘ก๐‘’๐‘Ÿ p = ๐‘“๐‘œ๐‘™๐‘‘๐‘Ÿ (๐œ†๐‘ฅ. ๐œ†๐‘ฅ๐‘ . ๐ข๐Ÿ ๐‘ ๐‘ฅ ๐ญ๐ก๐ž๐ง ๐‘ฅ โˆถ ๐‘ฅ๐‘  ๐ž๐ฅ๐ฌ๐ž ๐‘ฅ๐‘ ) [ ] โŸบ ๐‘” = ๐‘“๐‘œ๐‘™๐‘‘๐‘Ÿ ๐‘“ ๐‘ฃ โŸบ ๐‘š๐‘Ž๐‘ ฮป ๐‘“๐‘œ๐‘™๐‘‘ =