intuition.
edestruct (dat_exists); eauto.
econstructor.
intuition.
eauto.
destruct H0.
eapply dat_correct_repeat_same_h; eauto.
intuition.
rewrite firstn_nil in H3.
eapply evalDet_nil.
eauto.
Qed.

Lemma datRepeat_depth_better: forall (n2 : nat) (A : Set) (t2 t1 t1' : DistApproxTree A)(rel : nat -> DistApproxTree A -> Prop) reps depth (P : A -> bool),
datRepeat_depth rel P reps depth t1 t1' ->
forall n1 (t2' : DistApproxTree A),
reps >= n2 ->
datRepeat (rel n1) P n2 t2 t2' ->
dat_better t1 t2 ->
depth >= n1 * n2 + datDepth t2 ->
(forall (n1 n2: nat) (t3 t4 : DistApproxTree A),
rel n1 t3 -> rel n2 t4 -> n1 >= n2 -> dat_better t3 t4) ->
(forall a, rel 0%nat (dat_leaf (Some a)) -> P a = true) ->
(forall n t, rel n t -> datDepth t <= n)%nat ->
dat_better t1' t2'.