In the last IΞ post, I introduced the calculus and sketched the construction of some standard mathematical objects. In this post, I will dive a little deeper and construct of all the positive recursive types. The proof will be in an informal style (in particular, omitting the H constraints), but I have little doubt that the proof will go through.

Only a superficial familiarity with IΞ is needed to understand this proof; I adopt a set-theoretic style notation, so the proof should be approachable. Here’s a quick refresher of the primitives of IΞ.

Membership is application, so when I write , this is translated into IΞ as . Thus sets, unary predicates, and types are all the same thing.

, this is translated into IΞ as . Thus sets, unary predicates, and types are all the same thing. Because membership and application are identified, universal quantification and the subset relation are also. means “A is a subset of B”, or “x in A implies x in B”. In particular, the pattern can be interpreted as “for every a in A, P a”.

means “A is a subset of B”, or “x in A implies x in B”. In particular, the pattern can be interpreted as “for every a in A, P a”. L is the set of all sets (whose existence does not lead to a contradiction in this system!). I will give its definition at the end of the article.

lead to a contradiction in this system!). I will give its definition at the end of the article. Other symbols have their usual interpretation, and I’ll include an appendix which gives them all precise definitions at the end.

Definition: A function is called monotone if .

Intuitively, the monotone functions correspond roughly to the functors in Haskell; they use their parameter in a positive way (appear to the left of an even number of arrows).

Definition: The type recursion combinator μ is defined as: .

We are allowed to define things simply by giving a condition for membership like this. Formally, this definition starts out:

This definition intuitively says, x is in μ F if x is in every type closed under F. We will see that this definition corresponds to a type recursion combinator.

Lemma 1: If F is monotone, then .

Proof. Given ; show . Expanding the definition of μ above: Given ; show . Observe : Suppose , show . Since , we have by definition of μ. Letting , we have from above, so . Therefore, (by the monotonicity of F and ). QED.

Now for the easy direction:

Lemma 2: If F is monotone, then .

Proof. Given ; show . By the definition of μ, we have . Let . We have by monotonicity of F and Lemma 1, therefore . QED.

Which leads us to the recursion equation.

Theorem: If F is monotone, . (Proof trivial by the two lemmas)

I’m using set equality here, i.e. mutual containment, which is probably a bit weaker than Leibniz equality. It is obvious from the definition that this fixed point is minimal.

Monotonicity is easy to prove for any of the standard positive types (products, coproducts, functions). So we can model a good variety of Haskell data types already; however these are standard inductive (least fixed point) types, no infinite structures allowed. I’m still working on the encoding and analogous proofs for ν (greatest fixed point), which is closer to Haskell.

Hopefully I’ll be able to port many libraries (maybe after a few totality annotations) without having to worry about partiality. But there are more pressing matters, such as finishing my interactive proof assistant for IΞ.

Definitions

, the True proposition.

, the True proposition. , the constant function.

, the constant function. , the set of all objects.

, the set of all objects. , function composition.

, function composition. , the set of functions from a to b.

, the set of functions from a to b. , the set of all sets.

, the set of all sets. , implication.

, implication. , universal quantification of types (like forall in Haskell)

, universal quantification of types (like in Haskell) , product type.

, product type. , coproduct type.