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

Function assume

src/compute-engine/assume.ts:88–107  ·  view source on GitHub ↗
(proposition: Expression)

Source from the content-addressed store, hash-verified

86 symbol: string,
87 cause?: Expression
88): void {
89 const def = ce.lookupDefinition(symbol);
90 if (isValueDef(def)) recordAssumedType(ce, def.value, cause);
91}
92
93/**
94 * Infer a promoted type from a value expression.
95 * This promotes specific types to more general ones suitable for symbols:
96 * - finite_integer -> integer
97 * - rational -> real
98 * - finite_real_number -> real
99 * - complex/imaginary -> number
100 */
101function inferTypeFromValue(ce: ComputeEngine, value: Expression): BoxedType {
102 // finite_integer, integer, etc. -> integer
103 if (value.type.matches('integer')) return ce.type('integer');
104
105 // rational -> real
106 if (value.type.matches('rational')) return ce.type('real');
107
108 // finite_real_number, real -> real
109 if (value.type.matches('real')) return ce.type('real');
110

Callers 1

assumeConjunctionInnerFunction · 0.85

Calls 8

isInequalityOperatorFunction · 0.90
assumeElementFunction · 0.85
assumeNotElementFunction · 0.85
assumeEqualityFunction · 0.85
assumeNotEqualFunction · 0.85
assumeConjunctionFunction · 0.85
assumeInequalityFunction · 0.85
hasMethod · 0.65

Tested by

no test coverage detected