O'Reilly logo

Practical Foundations for Programming Languages by Robert Harper

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

47 Equational Reasoning for T

The beauty of functional programming is that equality of expressions in a functional language corresponds very closely to familiar patterns of mathematical reasoning. For example, in the language image{nat →} of Chapter 9, in which we can express addition as the function plus, the expressions

λ (x :nat) λ (y :nat) plus(x)(y)

and

λ (x :nat) λ (y :nat) plus(y)(x)

are equal. In other words, the addition function asprogrammed in image{nat →} is commutative.

This may seem to be obviously true, but why, precisely, is it so? More ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required