more generic inclusion/exclusion solving