Mitigate DNF explosion for depends field with disjoint disjunctions #6831
+47
−17
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I had a
dependsfield enforcing an invariant for an little-known experimental branch of OCaml:opam switch create oxcaml ocaml-variants.5.2.0+oxcompletely falls over with this. The problem is the conversion to DNF which takes place inOpamFormula.packages.While it's possible to re-encode this formula across more packages (which is the workaround I'm using), the conversion to DNF followed by filtering is sub-optimal.
The observation here is that in
(X1 | X2) & (Y1 | Y2), there's no need to considerY1 | Y2if the atoms ofY1 | Y2are distinct from the atoms ofX1 | X2combined (hopefully correctly) with the observation that if the entire sub-formulaY1 | Y2doesn't refer to the specific package being filtered, then we don't need consider it when converting to DNF.In example above, that means, say, that when considering which versions of the
ocamlpackage to consider, all the disjunctions are eliminated, because the conversion to DNF cannot introduce formula of interest.