fact: Fixpoint ctr_split r1 r2 r3 r {struct r} : A := match r with | CtrNil => continue r1 r2 r3 | CtrCons bs (GtreeNode t0 t1 t2 t3) r' => let addr bs t r' := if t is GtreeEmpty then r' else CtrCons bs t r' in let dorec r2' r3' := if t0 is GtreeEmpty then ctr_split (addr bs t1 r1) r2' r3' r' else let r2'' := CtrCons (Bpush0 bs) t0 r2' in let r3'' := CtrCons (Bpush1 bs) t0 r3' in ctr_split (addr bs t1 r1) r2'' r3'' r' in match bs with | Bstack0 => dorec r2 r3 | Bpush0 bs' => dorec (addr bs' t2 r2) (addr bs' t3 r3) | Bpush1 bs' => dorec (addr bs' t3 r2) (addr bs' t2 r3) end | CtrCons _ _ r' => ctr_split r1 r2 r3 r' end.
imports: mathcomp(ssreflect ssrfun ssrbool eqtype ssrnat seq) fourcolor(color chromogram gtree ctree)