intuition.
unfold dat_correct_bind in *.
edestruct (dat_exists).
eauto.
econstructor.
intuition.
eauto.
eapply dat_correct_bind_same_h.
eauto.
eauto.
trivial.
intuition.
eapply evalDet_nil; eauto.
eauto.
Qed.
Fixpoint datDepth (A : Set)(t : DistApproxTree A) : nat :=
match t with
| dat_leaf o => O
| dat_internal t1 t2 =>
S (max (datDepth t1) (datDepth t2))
end.

Lemma datMap_depth_better' : forall (B : Set)(tb1 tb2 : DistApproxTree B),
dat_better tb1 tb2 ->
forall (A : Set)(rel : nat -> B -> DistApproxTree A -> Prop) n n' t1 t2,
datMap_depth rel n tb1 t1 ->
datMap (rel n') tb2 t2 ->
n >= n' + (datDepth tb2) ->
(forall b n1 n2 t1 t2, rel n1 b t1 -> rel n2 b t2 -> n1 >= n2 -> dat_better t1 t2) ->
dat_better t1 t2.