Who can explain the main idea of RangeSet::Negate? And how does RangeSet work?
As I understand RangeSet may hold several constraint ranges (e.g. [MIN,10] U [20,30] U [40,MAX]) or may be empty (no constraints, in other words, holds everything [MIN, MAX]),
when MIN and MAX are kinda numeric**_limits<typewhich corresponds to particular SymExpr>::min/max()**.
Who can explain the main idea of RangeSet::Negate? And how does RangeSet work?
As I understand RangeSet may hold several constraint ranges (e.g. [MIN,10] U [20,30] U [40,MAX]) or may be empty (no constraints, in other words, holds everything [MIN, MAX]),
when MIN and MAX are kinda numeric**_limits<typewhich corresponds to particular SymExpr>::min/max()**.
Yup, and Negate() flips this sequence of segments around zero, i.e. [/a/, /b]/ U [/c/, /d/] => [-/d/, -/c/] U [-/b/, -/a/]. In other words, if R is the range for $x, then R.Negate() is the range for -x.
Negate() also handles MIN differently because -MIN is unrepresentable for most integer types.
Mmm, dunno what you mean. Like, it's the range for the negated symbol. It should be applied by the constraint manager (our wannabe SAT solver) when it wants to obtain the range for the negated symbol when it already has the range for the original symbol.
Would it help you if you see how it's used on tests? Eg., you can inject a crash in this function and see which tests fail; this will help you gather some examples of how the function is used. Then you can look under the debugger to see how exactly does it get used.