Slide 2
Slide 2 text
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
ππππ :: πΌ β π½ β π½ β π½ β πΌ β π½
ππππ π π£ = π£
ππππ π π£ π₯ βΆ π₯π = π π₯ ππππ π π£ π₯π