approach is inefficient, but correct Equational reasoning to improve performance Define a function prune that eliminates early invalid solutions filter valid . expand = filter valid . expand . prune It is not hard to define a function to prune a row (exercise): pruneRow [[4],[1,2],[1],[1,3]] = [[4],[2],[1],[3]] Equational reasoning to define prune in terms of pruneRow The function pruneRow satisfies the equation filter nodups . cp = filter nodups . cp . pruneRow Expand the expression filter valid . expand Use the above equation and compress back the formula 19 / 21