A program's type describes its behavior. Dependent types are a first-class part of a language, and are much more powerful than other kinds of types; using just one language for types and programs allows program descriptions to be as powerful as the programs they describe. The Little Typer explains dependent types, beginning with a very small language that looks very much like Scheme and extending it to cover both programming with dependent types and using dependent types for mathematical reasoning. Readers should be familiar with the basics of a Lisp-like programming language, as presented in the first four chapters of The Little Schemer.
The first five chapters of The Little Typer provide the needed tools to understand dependent types; the remaining chapters use these tools to build a bridge between mathematics and programming. Readers will learn that tools they know from programming—pairs, lists, functions, and recursion—can also capture patterns of reasoning. The Little Typer does not attempt to teach either practical programming skills or a fully rigorous approach to types. Instead, it demonstrates the most beautiful aspects as simply as possible, one step at a time.
About the Author
David Thrane Christiansen is a member of the technical staff at Galois, Inc., in Portland, Oregon.
Robert Harper is a Professor of Computer Science at Carnegie Mellon University.
Table of Contents
1 The More Things Change, the More They Stay the Same 2
2 Doin' What Comes Naturally 32
Recess: A Forkful of Pie 62
3 Eliminate All Natural Numbers! 68
4 Easy as Pie 92
5 Lists, Lists, and More Lists 108
6 Precisely How Many? 128
7 It All Depends On the Motive 142
Recess: One Piece at a Time 164
8 Pick a Number, Any Number 170
9 Double Your Money, Get Twice as Much 196
10 It Also Depends On the List 218
11 All Lists Are Created Equal 244
12 Even Numbers Can Be Odd 264
13 Even Haf a Baker's Dozen 278
14 There's Safety in Numbers 294
15 Imagine That … 316
16 If It's All the Same to You 342
A The Way Forward 356
B Rules Are Made to Be Spoken 362