(** We also provide two tactics [pdestruct] and [pinversion].
    They are simply defined as follows:

    - [pdestruct H] := [punfold H; destruct H; pclearbot]
    - [pinversion H] := [punfold H; inversion H; pclearbot]

    Using this the proof of the above theorem [seq'_cons] can be
    simplified as [intros; pinversion SEQ; auto.]
*)(* *)



(** ** Example: infinite tree equality

    The second example involves infinite binary trees of natural
    numbers and an equality thereon.  We prove two particular
    equalities via [cofix] in an incremental fashion, and then show
    how these proofs can be done just as easily via [pcofix].
    We then show how, using [pcofix], the proofs can additionally
    be modularly decomposed.

*)


(** As before, we first define the coinductive type and the unfolding
    trick.
*)

CoInductive inftree :=
  | node : nat -> inftree -> inftree -> inftree.(** We also provide two tactics [pdestruct] and [pinversion].
    They are simply defined as follows:

    - [pdestruct H] := [punfold H; destruct H; pclearbot]
    - [pinversion H] := [punfold H; inversion H; pclearbot]

    Using this the proof of the above theorem [seq'_cons] can be
    simplified as [intros; pinversion SEQ; auto.]
*)(* *)



(** ** Example: infinite tree equality

    The second example involves infinite binary trees of natural
    numbers and an equality thereon.  We prove two particular
    equalities via [cofix] in an incremental fashion, and then show
    how these proofs can be done just as easily via [pcofix].
    We then show how, using [pcofix], the proofs can additionally
    be modularly decomposed.

*)


(** As before, we first define the coinductive type and the unfolding
    trick.
*)

CoInductive inftree :=
  | node : nat -> inftree -> inftree -> inftree.Definition tunf t : inftree :=
  match t with node n tl tr => node n tl tr end.

Lemma tunf_eq : forall t, t = tunf t.