On 04/06/14 12:57, Vladimir Voevodsky wrote:
> does anyone have an idea on how the following proof can be completed:
>
> ****
>
> CoInductive stream ( T : UU ) := streamconstr : forall ( t : T ) ( s : stream T ) , stream T .
>
> Definition streamfunct { T1 T2 : UU } ( f : T1 -> T2 ) ( s1 : stream T1 ) : stream T2 .
> Proof. intros . cofix. destruct s1 as [ s1f s1r ] . exact ( streamconstr T2 ( f s1f ) streamfunct ) . Defined .
>
> Lemma streamfunctid { T : UU } ( s : stream T ) : paths ( streamfunct ( idfun T ) s ) s .
> Proof. intros . ???
With someone on Monday over lunch we thought we had solved a more
general version of the question you ask today, using function
extensionality. As I was writing it down below, I realized it is not a
solution (or doesn't seem to be one). However, let me explain what the
problem is.
You can show that your two streams are bisimilar. This can be
explained with a function
r : stream T -> (N -> T)
defined by recursion on N in the obvious way. Call the elements of the
function type (N -> T) "sequences". Then the streams x and y are
bisimilar iff the sequence r x is pointwise equal to the sequence r y,
and hence r x = r y by funext. We can prove that your two streams of
the lemma are mapped to the same sequence (of course).
Next define another obvious function
s : (N -> T) -> stream T
by corecursion on the stream T. I claim that the composite
r o s : (N -> T) -> (N -> T)
is the identity (use induction on N and funext).
So the type of sequences is a retract of the type of streams.
Moreover, you can show (using induction on N and funext), that the
type of sequences is the final coalgebra of the functor T x (-). So,
morally, it is sequences that should arise (isomorphically) as the
solution of the coinductive definition. If this were the case, you
would also get that the composite
s o r : stream T -> stream T
is the identity. But, as far as I can see, it is only pointwise
bisimilar to the identity, which of course follows from the fact that
r o s = id and so doesn't add anything new. (And this was the mistake
in the lunch time discussion with one of our colleagues here at the
IHP: we thought we had argued that the composite s o r is also the
identity, using funext.)
I had similar problems when trying to define "the one-point
compactification of N" as the final coalgebra of 1+(-) using
coinduction in Agda. In the end, I constructed it explicitly as the
type of decreasing binary sequences as is usual in constructive
mathematics, and I proved that bisimilarity is equivalent to equality
using funext.
Martin