Now, we’re getting to the heart of type theory: judgements. Judgements are the basic logical statements that we want to be able to prove about computations in type theory. There’s a basic set of judgements that we want to be able to make.
I keep harping on this, but it’s the heart of type theory: type theory is all about understanding logical statements as specifications of computations. Or, more precisely, in computer science terms, they’re about understanding true logical statements as halting computations.
In this post, we’ll see the ultimate definition of truth in type theory: every logical proposition is a set, and the proposition is true if the set has any members. A non-halting computation is a false statement – because you can never get it to resolve an expression to a canonical value.
So remember as we go through this: judgements are based on the idea of logical statements as specifications of computations. So when we talk about a predicate P, we’re using its interpretation as a specification of a computation. When we look at an expression 3+5, we understand it not as a piece of notation that describes the number 8, but as a description of a computation that adds 3 to 5. “3+5” not the same computation as “2*4” or “2+2+2+2”, but as we’ll see, they’re equal because they evaluate to the same thing – that is, they each perform a computation that results in the same canonical value – the number 8.
In this post, we’re going to focus on a collection of canonical atomic judgement types:
- This judgement says that A is a set.
- A and Bare equal sets.
- a is an element of the set A
- and are equal members of the set .
- is a proposition.
- The proposition is true.
The definition of the meanings of judgements is, necessarily, mutually recursive, so we’ll have to go through all of them before any of them is complete.
- An object is a Set
When I say that is a set in type theory, that means that:
- I know the rules for how to form the canonical expressions for the set;
- I’ve got an equivalence relation that says when two canonical members of the set are equal.
- Two Sets are Equal
When I say that and are equal sets, that means:
- and are both sets.
- If is a canonical member of , then is also a canonical member of , and vice versa.
- If and are canonical members of , and they’re also equal in , then and are also equal canonical members of (and vice versa).
The only tricky thing about the definition of this judgement is the fact that it defines equality is a property of a set, not of the elements of the set. By this definition, tt’s possible for two expressions to be members of two different sets, and to be equal in one, but not equal in the other. (We’ll see in a bit that this possibility gets eliminated, but this stage of the definition leaves it open!)
- An object is a member of a set
- When I say , that means that if I evaluate , the result will be a canonical member of .
- Two members of a set are equal
- If and and , that means when if you evaluate , you’ll get a canonical expression ; and when you evaluate , you’ll get a canonical expression . For to be true, then , that is, the canonical expressions resulting from their evaluation must also be equal.
This nails down the problem back in set equivalence: since membership equivalence is defined in terms of evaluation as canonical values, and every expression evaluates to exactly one canonical expression (that’s the definition of canonical!), then if two objects are equal in a set, they’re equal in all sets that they’re members of.
- An object is a proposition
- Here’s where type theory really starts to depart from the kind of math that we’re used to. In type theory, a proposition is a set. That’s it: to be a proposition, has to be a set.
- The proposition is true
- And the real meat of everything so far: if we have a proposition , and is true, what that means is that has at least one element. If a proposition is a non-empty set, then it’s true. If it’s empty, it’s false.
Truth in type theory really comes down to membership in a set. This is, subtly, different from the predicate logic that we’re familiar with. In predicate logic, a quantified proposition can, ultimately, be reduced to a set of values, but it’s entirely reasonable for that set to be empty. I can, for example, write a logical statement that “All dogs with IQs greater that 180 will turn themselves into cats.” A set-based intepretation of that is the collection of objects for which it’s true. There aren’t any, because there aren’t any dogs with IQs greater than 180. It’s empty. But logically, in terms of predicate logic, I can still say that it’s “true”. In type theory, I can’t: to be true, the set has to have at least one value, and it doesn’t.
In the next post, we’ll take these atomic judgements, and start to expand them into the idea of hypothetical judgements. In the type-theory sense, that means statements require some other set of prior judgements before they can be judged. In perhaps more familiar terms, we’ll be looking at type theory’s equivalent of the contexts in classical sequent calculus – those funny little s that show up in all of the sequent rules.