fact: Fixpoint gtr_split r0 r1 r2 r3 r := match r with | GtrNil => continue r0 r1 r2 r3 | GtrCons bs (CtreeNode t1 t2 t3) r' => let r02 := GtrCons (Bpush0 bs) t2 r0 in let r03 := GtrCons (Bpush1 bs) t3 r0 in let r023 := GtrCons (Bpush0 bs) t2 r03 in let r1' := if t1 is CtreeEmpty then r1 else GtrCons bs t1 r1 in let r2' bs' t':= GtrCons bs' t' r2 in let r3' bs' t' := GtrCons bs' t' r3 in match t2, t3, bs with | CtreeEmpty, CtreeEmpty, _ => gtr_split r0 r1' r2 r3 r' | CtreeEmpty, _, Bstack0 => gtr_split r03 r1' r2 r3 r' | CtreeEmpty, _, Bpush0 bs' => gtr_split r03 r1' r2 (r3' bs' t3) r' | CtreeEmpty, _, Bpush1 bs' => gtr_split r03 r1' (r2' bs' t3) r3 r' | _, CtreeEmpty, Bstack0 => gtr_split r02 r1' r2 r3 r' | _, CtreeEmpty, Bpush0 bs' => gtr_split r02 r1' (r2' bs' t2) r3 r' | _, CtreeEmpty, Bpush1 bs' => gtr_split r02 r1' r2 (r3' bs' t2) r' | _, _, Bstack0 => gtr_split r023 r1' r2 r3 r' | _, _, Bpush0 bs' => gtr_split r023 r1' (r2' bs' t2) (r3' bs' t3) r' | _, _, Bpush1 bs' => gtr_split r023 r1' (r2' bs' t3) (r3' bs' t2) r' end | GtrCons _ _ r' => gtr_split r0 r1 r2 r3 r' end.
imports: mathcomp(ssreflect ssrfun ssrbool eqtype ssrnat seq) fourcolor(color ctree chromogram gtree)