Class CriticalValues
value != 0 test inline.
It is the pivot of the type-domain discharge principle: a constrained type is an admissible
value-set; each obligation is a dangerous value-set; if they are disjoint the obligation is
discharged for every value of that type — by construction, everywhere, proven once off the type
(no caller analysis; see SymbolicEngine.classifyDivision(EK9Parser.ExpressionContext, Set, FunctionSummary)). This class defines the dangerous
set ONCE and derives from it both directions the engine needs:
safe(String)— the safety predicate theWitnessEnumeratordrives to find a refuting witness (the first value that IS dangerous), andwindowExcludesAll(long[], String)— the disjointness test proving a constrained type's inclusive[lo,hi]window contains none of the dangerous values (→ proved-safe).
Extend by adding a row: an obligation kind maps to its critical values in the shared numeric
(Integer/Float) domain. DIV_BY_ZERO -> {0} is the seed; sqrt/log domain,
index lower-bound, overflow near the extremes, … are the same shape (a dangerous set), each one row
here — the engine's discharge/refute logic then applies unchanged.
-
Method Summary
Modifier and TypeMethodDescriptionstatic long[]dangerousValues(String obligation) The base-domain values that would violateobligation, or empty when none are modelled.static LongPredicateThe safety predicate forobligation: true for a value that does NOT violate it.static booleanwindowExcludesAll(long[] window, String obligation) Whether the inclusive window[lo,hi]a constrained type narrows to contains NONE ofobligation's dangerous values — i.e.
-
Method Details
-
dangerousValues
The base-domain values that would violateobligation, or empty when none are modelled. -
safe
The safety predicate forobligation: true for a value that does NOT violate it. TheWitnessEnumeratorreturns the first pool/window value for which this is false — the refuting witness (e.g.0for a division). -
windowExcludesAll
Whether the inclusive window[lo,hi]a constrained type narrows to contains NONE ofobligation's dangerous values — i.e. the type forbids every value that would break it, so the obligation is discharged for every value of the type. An obligation with no modelled dangerous values is vacuously excluded (returns true), so callers should gate on a decidable window first.
-