(* begin genRBTree_height *)
(* end genRBTree_height *)
Next Obligation.
unfold wf_hc; simpl; left; omega.
Qed.
Next Obligation.
unfold wf_hc; simpl; left; omega.
Qed.
Next Obligation.
unfold wf_hc; simpl; destruct c'; [right; apply I | left; omega].
Qed.
Next Obligation.
unfold wf_hc; simpl; destruct c'; [right; apply I | left; omega].
Qed.
Next Obligation.
abstract (apply well_founded_hc).
Defined.

(* Specifications: *)
Lemma genRBTree_height_eq (hc : nat*color) :
genRBTree_height hc =
match hc with
| (0, Red) => returnGen Leaf
| (0, Black) => oneOf [returnGen Leaf;
(do! n <- arbitrary; returnGen (Node Red Leaf n Leaf))]
| (S h, Red) => liftGen4 Node (returnGen Black) (genRBTree_height (h, Black))
arbitrary (genRBTree_height (h, Black))
| (S h, Black) => do! c' <- genColor;
let h' := match c' with Red => S h | Black => h end in
liftGen4 Node (returnGen c') (genRBTree_height (h', c'))
arbitrary (genRBTree_height (h', c')) end.