See this about using functions in constraints: Regarding function in constraints
Use an iterative foreach
constraint instead of a for
loop.
constraint c1 { $countones(value) == 10;
foreach(value[i]) i>0 -> !(value[i] && value[i + 1]);
}