Section Paradox.
Variable Lambda : Set.
Variable lambda : (Lambda -> False) ->Lambda.
Variable matchL  : Lambda -> forall Q:Prop, ((Lambda ->False) -> Q) -> Q.
(* understand matchL Q l (fun h : Lambda -> False => t)  as match l return Q with lambda h => t end *)
Definition application (f x: Lambda) :False :=
matchL f False (fun h => h x).
Definition Delta : Lambda := lambda (fun x : Lambda => application x x).
Definition loop : False := application Delta Delta.
End Paradox.
Inductive itree : Set :=
| ileaf : itree
| inode : Z-> (nat -> itree) -> itree.
Definition isingle l := inode l (fun i => ileaf).
Definition t1 := inode 0 (fun n => isingle (Z.of_nat (2*n))).
Definition t2 := inode 0
(fun n : nat =>
inode (Z.of_nat n)
(fun p => isingle (Z.of_nat (n*p)))).
Inductive itree_le : itree-> itree -> Prop :=
| le_leaf : forall t, itree_le  ileaf t
| le_node  : forall l l' s s',
Z.le l l' ->
(forall i, exists j:nat, itree_le (s i) (s' j)) ->
itree_le  (inode  l s) (inode  l' s').
induction t.
constructor 1.
intros t'; case t'.
inversion 1.
intros z0 i0 H0.
intro t'';case t''.
inversion 1.
intros.
inversion_clear H1.
constructor 2.
inversion_clear H0;eauto with zarith.
inversion_clear H0.
intro i2; case (H4 i2).
intros.
generalize (H i2 _ H0).
intros.
case (H3 x);intros.
generalize (H5 _ H6).
exists x0;auto.
Qed.
Inductive itree_le' : itree-> itree -> Prop :=
| le_leaf' : forall t, itree_le'  ileaf t
| le_node' : forall l l' s s' g,
Z.le l l' ->
(forall i, itree_le' (s i) (s' (g i))) ->
itree_le'  (inode  l s) (inode  l' s').
unfold t1, t2.
constructor.
auto with zarith.
intro i; exists (2 * i).
unfold isingle.
constructor.
auto with zarith.
exists i;constructor.
Qed.

Lemma t1_le'_t2 :  itree_le' t1 t2.