(** In order to state our example equalities, we define the following
    four trees.
*)

CoFixpoint one : inftree := node 1 one two
with       two : inftree := node 2 one two.CoFixpoint eins : inftree := node 1 eins (node 2 eins zwei)
with       zwei : inftree := node 2 eins zwei.(** *** Incremental proofs using [cofix]

    As before, we define the tree equality as the greatest fixed point
    of its generating function.
*)

Inductive teq_gen teq : inftree -> inftree -> Prop :=
  | _teq_gen : forall n t1l t1r t2l t2r (Rl : teq t1l t2l : Prop) (Rr : teq t1r t2r),
                 teq_gen teq (node n t1l t1r) (node n t2l t2r).(** *** Incremental proofs using [cofix]

    As before, we define the tree equality as the greatest fixed point
    of its generating function.
*)

Inductive teq_gen teq : inftree -> inftree -> Prop :=
  | _teq_gen : forall n t1l t1r t2l t2r (Rl : teq t1l t2l : Prop) (Rr : teq t1r t2r),
                 teq_gen teq (node n t1l t1r) (node n t2l t2r).CoInductive teq t1 t2 : Prop :=
  | teq_fold (IN : teq_gen teq t1 t2).CoInductive teq t1 t2 : Prop :=
  | teq_fold (IN : teq_gen teq t1 t2).

Theorem teq_one : teq one eins.