fact: Fixpoint ctree_restrict (h : nat) (t : ctree) r {struct h} := match r, h, t with | CtrNil, _, _ => CtreePair t CtreeEmpty | _, h'.+1, CtreeNode t1 t2 t3 => let rh' := ctree_restrict h' in let rk r1 r2 r3 := ctree_cons_pairs (rh' t1 r1) (rh' t2 r2) (rh' t3 r3) in ctr_split rk CtrNil CtrNil CtrNil r | _, 0, CtreeNode lf1 lf2 lf3 => ctr_decr (ctree_leaf_pair lf1 lf2 lf3) lf1 lf2 lf3 r | _, _, _ => ctree_empty_pair end.
imports: mathcomp(ssreflect ssrfun ssrbool eqtype ssrnat seq) fourcolor(color chromogram gtree ctree)