Proof by Coinduction
Posted by David Corfield
The sophisticated take on mathematical induction is that the natural numbers form the inital algebra of the endofunctor on , . As such we have a map , picking out the zero and the successor function. As an initial object in the category of -algebras we know that any monomorphism into it must be an isomorphism. So if I have a property, , of the natural numbers which holds for , and for which implies for all , then the set, , of natural numbers satisfying forms an -algebra, , with an obvious monomorphism into . Hence is isomorphic to and holds for all natural numbers.
Now in the case of coalgebras, coinduction is going to rely on the fact that epimorphisms from terminal coalgebras are isomorphisms, i.e., there’s no quotient coalgebra of a terminal coalgebra. So if I want to establish that two elements of a terminal coalgebra are equal all I need do is find an equivalence relation which relates the elements and which is compatible with the coalgebra structure. Equivalence classes cannot contain more than one element, so I know these two elements are the same.
A typical place to use coinduction is with streams. Let be the set of streams, or infinite sequences, of elements of the set . There is a map which takes a stream to the pair of its head (first element) and its tail (the rest). So is a coalgebra for the functor , and indeed is the terminal -coalgebra. A relation on compatible with the coalgebra structure is one for which implies that and . To establish the identity of two streams, we define a relation with this property such that the streams relate to each other. We can happily use coinduction then to prove things such as the merger of the list of even positioned elements of a list with the list of odd positioned elements of the same list yields the original list.
But do we ever use coinduction for the terminal coalgebra of ? This is the extended natural numbers with the predecessor function, which we discussed earlier. To establish whether two extended natural numbers are the same all we need do is find a relation such that either the predecessor is undefined for both numbers or the relation holds of the predecessors of both.
Now Jan Rutten puts coinduction to use to prove commutativity of addition on the conaturals on page 36 of Universal coalgebra: a theory of systems. This relies on the idea that postulating a relation is compatible with the coalgebra structure, so they must be equal.
But we might wonder if there isn’t an example like the high school proof of induction of
where you show it true for , and if true for then true for .
This was the best I could come up with. Let me define a binary relation which includes pairs , for all natural numbers and such that . We also throw in . To do this properly I would define subtraction coinductively, but we can take it that it works as it should.
Then I claim that this relation is compatible with the destructors. If , then applying the predecessor to each member of a pair yields another pair specified to be in the relation. If , we check that
On the other hand,
This pair is specified as being related. I probably need to say something about what happens for , but how does this strike people as a proof by coinduction? I guess it’s a tad too similar to induction to merit much attention.
Elsewhere in the blogosphere, Sigfpe has struggled with such matters.
Re: Proof by Coinduction
Did you mean union?