fact: Fixpoint gram_balanced d b0 (w : chromogram) {struct w} := match w, d with | [::], 0 => ~~ b0 | Gpush :: w', _ => gram_balanced d.+1 b0 w' | Gskip :: w', _ => gram_balanced d (~~ b0) w' | Gpop0 :: w', d'.+1 => gram_balanced d' b0 w' | Gpop1 :: w', d'.+1 => gram_balanced d' (~~ b0) w' | _, _ => false end.
imports: HB(structures) mathcomp(ssreflect ssrfun ssrbool eqtype ssrnat seq choice) mathcomp(fintype) fourcolor(color)