MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / partBoundSubject

Function partBoundSubject

src/compute-engine/assume.ts:1021–1044  ·  view source on GitHub ↗

* Recognize a normalized-inequality lhs of the form `±Part(x) + k` where * `Part ∈ {Real, Imaginary, Abs, Argument}` and `k` is an optional numeric * constant. Returns the (non-self) subject, or `undefined`. * * Deliberately stricter than `boundsFromNormalizedInequality`: an lhs with * a non-nu

(lhs: Expression)

Source from the content-addressed store, hash-verified

1019
1020 if (isFunction(excluded, 'Set')) {
1021 // Finite exclusion set: store a disequality per element
1022 for (const e of excluded.ops) {
1023 if (storeNotEqual(ce, ce.symbol(symbol), e) === 'contradiction')
1024 return 'contradiction';
1025 }
1026 return 'ok';
1027 }
1028 // Non-finite exclusion: store a NotElement fact
1029 const r = storeNotElement(ce, ce.symbol(symbol), excluded);
1030 return r === 'tautology' ? 'ok' : r;
1031 }
1032
1033 // 5. Union of intervals/ranges: refine the type only; the membership
1034 // fact is stored verbatim (a union yields a disjunction of bounds,
1035 // which the fact layer does not represent)
1036 if (isFunction(setExpr, 'Union') && setExpr.ops.length > 0) {
1037 if (setExpr.ops.every((s) => isFunction(s, 'Range'))) {
1038 if (refineSymbolType(ce, symbol, 'integer', cause) === 'contradiction')
1039 return 'contradiction';
1040 } else if (
1041 setExpr.ops.every(
1042 (s) => isFunction(s, 'Interval') || isFunction(s, 'Range')
1043 )
1044 ) {
1045 if (refineSymbolType(ce, symbol, 'real', cause) === 'contradiction')
1046 return 'contradiction';
1047 }

Callers 1

assumeInequalityFunction · 0.85

Calls 3

isFunctionFunction · 0.90
isNumberFunction · 0.90
partOfFunction · 0.85

Tested by

no test coverage detected