Assumption
Describes the admissible real values of a symbolic variable as one numeric interval.
An
`Assumption`is an interval constraint, not a symbolic theorem. It can prove relations when the interval bounds force an answer, disprove them when the bounds force the opposite answer, and otherwise reports an unknown result as
`undefined`. Two variables having the same admissible interval therefore does not prove that the variables are equal. Instances are immutable. Repeated assumptions for a variable are intersected by the global assumption registry rather than modifying an existing interval. Finite bounds preserve an exact rational value internally. Decimal inputs therefore retain the exact value represented by their decimal text, while Rational inputs such as
`1/3`are not rounded through Decimal precision before comparisons are made. The 2.0 assumption vocabulary is intentionally conservative: a single real interval with numeric bounds. Integer, parity, complex-domain, relational (
`x > y`), union, and general predicate assumptions are not represented by this class.
Members
atLeast(x: AssumptionValue, inclusive: boolean): AssumptionMethodCreates an interval extending upward from
`x`.
Parameters
| Name | Type | Description |
|---|---|---|
x | AssumptionValue | Lower endpoint. |
inclusive | boolean | Whether a finite lower endpoint belongs to the interval. |
Returns
Assumption — The interval `[x, +∞)` when inclusive, otherwise `(x, +∞)`.
atMost(x: AssumptionValue, inclusive: boolean): AssumptionMethodCreates an interval extending downward from
`x`.
Parameters
| Name | Type | Description |
|---|---|---|
x | AssumptionValue | Upper endpoint. |
inclusive | boolean | Whether a finite upper endpoint belongs to the interval. |
Returns
Assumption — The interval `(-∞, x]` when inclusive, otherwise `(-∞, x)`.
Assumption(start: AssumptionValue, end: AssumptionValue, startInclusive: boolean, endInclusive: boolean): AssumptionConstructorCreates a non-empty real interval.
Infinite endpoints are normalized to open bounds. A zero-width interval is valid only when both endpoints are inclusive, in which case it represents one exact value. Rational inputs retain their exact value even when their Decimal projection is necessarily finite precision.
Error Thrown when a bound is
`NaN`, the bounds are reversed, or the interval is empty.
Parameters
| Name | Type | Description |
|---|---|---|
start | AssumptionValue | Lower numeric endpoint. |
end | AssumptionValue | Upper numeric endpoint. |
startInclusive | boolean | Include the lower endpoint when it is finite. |
endInclusive | boolean | Include the upper endpoint when it is finite. |
Returns
contains(x: AssumptionValue): booleanMethodTests whether a numeric value belongs to this interval.
Parameters
| Name | Type | Description |
|---|---|---|
x | AssumptionValue | Numeric value to test. |
Returns
boolean — `true` when `x` satisfies both interval bounds.
dataType: "ASSUMPTION"PropertyRuntime tag used by Nerdamer's assumption type guard.
end: BoundPropertyUpper endpoint of the admissible interval.
eq(x: Expression | Assumption): AssumptionComparisonMethodDetermines whether values constrained by this interval are equal to
`x`.
Equality is proved only when both sides identify the same single value. It is disproved when the admissible values are disjoint. Overlapping ranges, including identical non-singleton ranges, return
`undefined`because equality depends on the actual values chosen from those ranges.
Parameters
| Name | Type | Description |
|---|---|---|
x | Expression | Assumption | Another interval-constrained value or a numeric expression. |
Returns
AssumptionComparison — `true` when equality is forced, `false` when inequality is forced, or `undefined` when the available information permits either outcome.
exactly(x: AssumptionValue): AssumptionMethodCreates the singleton interval containing exactly
`x`.
Parameters
| Name | Type | Description |
|---|---|---|
x | AssumptionValue | The one admissible value. |
Returns
Assumption — The closed singleton interval `[x, x]`.
getSingletonValue(): Expression | undefinedMethodReturns the exact value represented by a singleton interval.
Returns
Expression | undefined — A numeric Expression when this interval is a singleton, otherwise `undefined`.
gt(x: Expression | Assumption): AssumptionComparisonMethodDetermines whether every value in this interval is strictly greater than
`x`.
Parameters
| Name | Type | Description |
|---|---|---|
x | Expression | Assumption | Another interval-constrained value or a numeric expression. |
Returns
AssumptionComparison — `true` when `>` is forced, `false` when `<=` is forced, or `undefined` when the interval information permits both outcomes.
gte(x: Expression | Assumption): AssumptionComparisonMethodDetermines whether every value in this interval is greater than or equal to
`x`.
Parameters
| Name | Type | Description |
|---|---|---|
x | Expression | Assumption | Another interval-constrained value or a numeric expression. |
Returns
AssumptionComparison — `true` when `>=` is forced, `false` when `<` is forced, or `undefined` when the interval information permits both outcomes.
intersect(x: Assumption): Assumption | undefinedMethodIntersects this interval with another interval. Endpoint selection uses the exact finite representation retained by each interval, so repeated constraints do not lose rational precision while narrowing the range.
Parameters
| Name | Type | Description |
|---|---|---|
x | Assumption | Interval to intersect with this one. |
Returns
Assumption | undefined — The non-empty intersection, or `undefined` when the intervals are disjoint.
isAssumption(obj: unknown): objMethodNo description is available yet.
Parameters
| Name | Type | Description |
|---|---|---|
obj | unknown | — |
Returns
obj
isSingleton: booleanPropertyWhether the interval contains exactly one finite value.
lt(x: Expression | Assumption): AssumptionComparisonMethodDetermines whether every value in this interval is strictly less than
`x`.
Parameters
| Name | Type | Description |
|---|---|---|
x | Expression | Assumption | Another interval-constrained value or a numeric expression. |
Returns
AssumptionComparison — `true` when `<` is forced, `false` when `>=` is forced, or `undefined` when the interval information permits both outcomes.
lte(x: Expression | Assumption): AssumptionComparisonMethodDetermines whether every value in this interval is less than or equal to
`x`.
Parameters
| Name | Type | Description |
|---|---|---|
x | Expression | Assumption | Another interval-constrained value or a numeric expression. |
Returns
AssumptionComparison — `true` when `<=` is forced, `false` when `>` is forced, or `undefined` when the interval information permits both outcomes.
overlaps(x: Assumption): booleanMethodTests whether this interval and
`x`share at least one admissible value.
Parameters
| Name | Type | Description |
|---|---|---|
x | Assumption | Interval to test for overlap. |
Returns
boolean — `true` when the intersection is non-empty.
parse(expr: string): ParsedAssumptionMethodParses one numeric interval constraint such as
`x >= 0`or
`n < 10`.
Whitespace is ignored. Variable names use the ASCII identifier form
`[A-Za-z_][A-Za-z0-9_]*`. Supported operators are
`=`,
`==`,
`>`,
`>=`,
`<`, and
`<=`. Bounds are Decimal-compatible numeric literals;
`inf`,
`infinity`,
`+inf`,
`+infinity`,
`-inf`, and
`-infinity`are also accepted. Expressions such as
`x > y`,
`x = 1/2`, and property predicates such as
`integer(x)`are outside the string assumption grammar. Parser assertive calls may still provide already-evaluated Rational bounds directly.
Error Thrown when the constraint has an invalid identifier, operator, or numeric bound.
Parameters
| Name | Type | Description |
|---|---|---|
expr | string | Constraint to parse. |
Returns
ParsedAssumption — The parsed symbol and its interval assumption.
sameInterval(x: Assumption): booleanMethodTests whether two objects describe the same interval constraint.
This is structural interval equality. It is deliberately separate from eq: two different variables may have identical intervals without being known to have the same value.
Parameters
| Name | Type | Description |
|---|---|---|
x | Assumption | Interval constraint to compare with this one. |
Returns
boolean — `true` when both endpoints and their inclusivity are identical.
start: BoundPropertyLower endpoint of the admissible interval.
toString(): stringMethodFormats the interval using mathematical bracket notation.
Returns
string — A representation such as `[0, 10)` or `(-Infinity, Infinity)`.
