Hey does anyone know of a class of algorithms to s...

# developmenth

hundreds-father-404

10/29/2020, 4:23 AMHey does anyone know of a class of algorithms to statically identify that the constraint

`==2.7 & ==3.6`

is impossible to satisfy?
In https://github.com/pantsbuild/pants/issues/11072, I thought I could use boolean algebra. For example, we can simplify `(==2.7 | >=3.6) & >=3.6`

to simply `>=3.6`; i.e. `(x | y) & x => x`

. But that only covers a couple edge cases.hundreds-father-404

10/29/2020, 4:24 AMcc **@chilly-magazine-21545**

hundreds-father-404

10/29/2020, 4:45 AMI think this is the boolean satisfiability problem / SAT, iiuc https://en.wikipedia.org/wiki/Boolean_satisfiability_problem.
And iiuc, implementing this is essentially what tools like Cargo, Pip’s new resolver, and Poetry/Pipenv do.

j

jolly-midnight-72759

10/29/2020, 2:46 PMThe experimentalist in me suggest the algorithm of taking the list of all released versions of python (a finite set) and compare their truthiness with each item in the list of constraints (another finite set). This will give you an empty set or a set of python versions that can map to a simplified constraint list.