Monday, April 10, 2006

Mongruences

Before saying anything I'd be interested in feedback on whether the mathematical symbols below are visible in your browser. Things like right arrow ⇒, infinity ∞ and union ∪.

Anyway, I've been trying to understand exactly what coindunction is all about. In particular I've been trying to figure out exactly what the duality is between induction and coinduction. The problem I was having was that induction and coinduction seemed not to be dual to each other at all, and weirder still, almost every discussion of coindunction that I looked at seemed to completely ignore the issue.

So here's my problem: in order to carry out an induction argument over the naturals, say, we find a predicate on the naturals, P, such that

P(0) and P(n) ⇒ P(s(n))

We can then conclude that P holds for all naturals.

In order to carry out a coindunction argument over the set of streams over A, say, we find a binary relation R (called a bisimulation) such that

R(a,b) ⇒ head(a)=head(b) and R(tail(a),tail(b)).

I can point out a certain amount of duality: The naturals form an initial F-algebra which is a fancy way of saying that they form a least fixed point to some equation, in this case N≅1+N. Here '1' means the type with one element called '*' and '+' is the disjoint union. We have a map s:1+N→N where s(*) = 0 and s(n) = n+1. s can
be thought of as a 'constructor'. Given something of type 1+N it shows how to construct an object of type N from it. Loosely speaking we can now see that induction is about forming a predicate that still holds after we apply a constructor.


Now consider the coinduction over all streams. A stream is a final F-coalgebra which is a fancy way of saying it's a greatest fixed point of the equation S≅A×S. We have a map (head,tail):S→A×S which maps a stream to its head (an element of A) and its tail (another stream). We can think of these as 'destructors' which reduce a stream back down to its component parts. And now we can see that coinduction is essentially about finding a binary predicate that still holds after applying a destructor.


But to my eyes, despite the duality there is a glaring difference: induction is about a unary predicate and coindunction is about a binary predicate. And through no amount of messing about with categories and their opposites was I able to find a way to see a unary predicate to be dual to a binary predicate.


So I gave in and tried to find something on the web about this subject and eventually was led to Bart Jacobs' paper Mongruences and Cofree Coalgebras. Inductive predicates aren't dual to bisimulations at all, rather inductive predicates are dual to what Jacobs calls mongruences. Unsurprisingly, this horrible neologism was dropped in favour of the term τ-invariant or just invariant in later papers. But I'm going to use the term out of sheer perversity.


But this paper still doesn't explicitly talk about coinduction over the naturals leaving me to work out the details. After chasing round the diagrams, including a nice demonstration of left and right adjoint functors (about which I seem to have managed to develop a crude intuition, who said you can't teach an old dog new tricks?) I managed to figure out what I think is the fairly simple definition of a congruence predicate for the naturals.


So instead of working over the naturals we actually work over N'=N∪{∞}, the set of 'conaturals'. The reason is that we are now looking at the final F-coalgebra that is the greatest fixed point to the equation X≅X+1, not the least fixed point. N' is equipped with a map p:N'→1+N' where p(0)=*, p(∞)=&infin and p(n)=n-1 otherwise. With this in mind a coinductive predicate for the conaturals (ie. a mongruence or invariant) turns out to be a P such that


P(n) ⇒ n=0 or n=∞ or P(n-1).

At least I think so. (This could be embarassing.) And now I can see why coinduction talks about bisimulations - mongruences aren't very interesting for the conaturals. Bit of a letdown really!


On the other hand there are some mongruences that are of mild interest in a more general setting. For example consider a finite state automaton with some terminal states. You can define a state to be safe if at no future point it's possible to reach the terminal state. So a state is safe if it isn't terminal and if all of its successor states are safe. If you think of a finite state automaton as a function f:X→(X×O)I, where X is the set of states, I is the set of inputs and O is the set of outputs, then f is a 'destructor' and you can see that this definition fits into the same general pattern for coinductive definitions. So safety is a mongruence.


The obvious next question is: what is the dual of a bisimulation? These are called congruences but I haven't yet worked through the details of what these are.


My next question is this: given an inductive predicate you get to apply "proof by induction". What is the corresponding "proof by coinduction" for the conaturals? I'm not sure there is one. I have a vague sense of what proof by coinduction might look like for a more general mongruence but haven't figured out a non-trivial example yet.


But despite having learned about a concept that was uninteresting, and a proof method that I can't figure out how to apply, I have picked up something useful. The standard notions of proof by induction and proof by coinduction aren't straightforwardly dual to each other. So now I can stop worrying about it and get on with reading Vicious Circles.

7 Comments:

Blogger Jonathan said...

Ditto everything from ansobel, except I'm using Windows XP instead of Mac, and Google Reader instead of Bloglines.

Monday, 10 April, 2006  
Blogger Unknown said...

The symbols are also working fine for me (Firefox 1.5.0.1). Thanks for all your good work.

P.S. How did you get the symbols working? They are nice

Tuesday, 11 April, 2006  
Blogger sigfpe said...

The symbols can be found here. For example the tensor product x⊗y is written as x⊗y.

This stuff has been around for many years but only in a tiny proportion of browsers. I was astonished to find that it actually works in the majority of browsers now.

(And blogger.com appears to have a bug in the handling of these symbols. When I tried to edit the comment it replaced ⊗ with ⊗ in the source.

Tuesday, 11 April, 2006  
Blogger sigfpe said...

He he! Looks like I can't tell you how to include those symbols because blogger.com erroneously turns my instructions into the actual symbols.

Tuesday, 11 April, 2006  
Blogger sigfpe said...

It seems ironic that soon after writing this on the subject of 'quoting' code within code I'm facing it as a problem.

In order to make a symbol appear in a post you need to type in the 'quoted' form of it which is turned into the actual symbol.

In order to explain this in detail I need to enter the quoted form of the quoted form. But for some reason the doubly quoted form is being unquoted twice. This is pretty weird behaviour - it makes me wonder of blogger.com iterates your source until it reaches a fixed point. Anyway let me explain how to enter A⇒x⊗y using a quoted form it has no chance of unquoting. You type 'A' followed by ampersand followed by "rArr;x" followed by another ampersand followed by "otimes;y".

Tuesday, 11 April, 2006  
Blogger Unknown said...

Dear sigfpe,

Thanks for the comments, as well as the meta-comments. Whenever one witnesses a play within a play, one should always sit back and enjoy. And I did.

Best wishes,
Paul

Wednesday, 12 April, 2006  
Blogger David Corfield said...

I've just stumbled across your post having been struggling with the same issues as you describe in your post. Yes, the conaturals do seem a little disappointing.

Proof by induction relies on the initiality of N as an algebra of F(X) = 1 + X. Any monomorphism into an initial object is an isomorphism. So a predicate carving out a subset of N, and defining a subalgebra is going to have to be the whole of N.

So coinduction ought to rely on the finality of the conaturals, and that any epimorphism out of them will be an isomorphism. Hence the effort to find a binary relation compatible with the destructors. If one exists, it can only relate pairs of the same element. Rutten puts it to use to prove commutativity of addition on the conaturals on page 36 of Universal coalgebra: a theory of systems.

But, as you note, the duality isn't so apparent. There can't be an equivalence relation on the conaturals with more than one element in the same class. So if I have two expressions for conaturals and I suppose they are related, then either I will be led to contradiction by deducing that predecessors of each are related, or else the original conaturals were identical.

Tricky to imagine using it. What if I say that ((sum of i from 1 to n) - s) relates to (1/2 n(n+1) - s), for all n, all 0 less than or equal to s less than n. Then given any such pair, the predecessors of each are obviously related, the only cases to check being when s = n-1.

In that case we check that (sum of i from 1 to n) - n) = (sum of i from 1 to n-1). And (1/2 n(n+1) - n) = (1/2 (n-1)n), and we know that this pair is related.

So equivalence classes must be individuals, hence (sum i from 1 to n) = 1/2 n(n+1).

Friday, 18 September, 2009  

Post a Comment

<< Home