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

Function storeNotElement

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

* Store a `NotElement(x, setExpr)` exclusion fact in the assumptions DB. * If `x` has a value, the exclusion is decided by evaluation instead.

(
  ce: ComputeEngine,
  x: Expression,
  setExpr: Expression
)

Source from the content-addressed store, hash-verified

261]);
262
263/**
264 * Assume a conjunction: each conjunct is assumed independently
265 * (design §3.2, "shallow saturation").
266 *
267 * Result: `'contradiction'` if any conjunct contradicts,
268 * `'not-a-predicate'` if any conjunct is unsupported, `'tautology'` if
269 * every conjunct was already known, `'ok'` otherwise.
270 */
271function assumeConjunction(proposition: Expression): AssumeResult {
272 console.assert(proposition.operator === 'And');
273 if (!isFunction(proposition)) return 'not-a-predicate';
274
275 const ce = proposition.engine;
276
277 // Atomicity (SYM P2-9): a conjunction must apply all-or-nothing when it
278 // contradicts. The historical loop applied each conjunct in turn, so a
279 // later contradictory conjunct left the earlier ones installed (e.g.
280 // `And(p > 0, p < −5)` reported `'contradiction'` yet left `p > 0`).
281 //
282 // Validate the whole conjunction in an isolated child scope first: the
283 // child inherits the caller's assumptions (copied) and symbol bindings (via

Callers 3

assumeNotElementFunction · 0.85
assumeInequalityFunction · 0.85
assumeElementOfSetFunction · 0.85

Calls 5

isSymbolFunction · 0.90
hasValueFunction · 0.85
functionMethod · 0.65
evaluateMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected