Definition prod_of_sigT {A B : Type} (p : {_ : A & B}) : A * B :=
let (a, b) := p in (a, b).
Definition wf_hc (c1 c2 : (nat * color)) : Prop :=
lexprod nat (fun _ => color) lt (fun _ => ltColor) (sigT_of_prod c1) (sigT_of_prod c2).

(* Specifications: *)
Lemma well_founded_hc : well_founded wf_hc.
Program Fixpoint genRBTree_height (hc : nat*color) {wf wf_hc hc} : G tree :=
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.