Section sec_exteq.
Variable T: Type.
CoInductive exteq : infseq T -> infseq T -> Prop :=
exteq_intro :
forall x s1 s2, exteq s1 s2 -> exteq (Cons x s1) (Cons x s2).
Proof using.
intros x1 s1 x2 s2 e.
change (hd (Cons x1 s1) = hd (Cons x2 s2) /\
exteq (tl (Cons x1 s1)) (tl (Cons x2 s2))).
case e; clear e x1 s1 x2 s2. simpl. intros; split; trivial.
Qed.
Proof using.
cofix cf. intros (x, s). constructor. apply cf.
Qed.
Proof using.
cofix cf. destruct 1. constructor. apply cf. assumption.
Qed.

Lemma exteq_trans :
forall s1 s2 s3, exteq s1 s2 -> exteq s2 s3 -> exteq s1 s3.