15-150: Principles of Functional Programming

Lecture 5: Trees

This lecture, we introduced the type of binary trees in SML, which make use of SML's powerful datatypes language feature.

We explored the different kind of traversals on trees, and found that trees admitted a new principle of structural induction due to having a different form than that of lists. We then did a structural induction proof on trees, where we discovered the necessity of totality citations due to stepping through theorem values.

To finish off the lecture, we discussed the power of having custom-built datatypes that fit a problem exactly. We talked about the importance of making illegal states unrepresentable and defining one's problem domain specifically.

Slides