@nudojs/core 1.12.0 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13729,6 +13729,16 @@ function $assumeAnchor(v2, name) {
13729
13729
  if (!mentions) return v2;
13730
13730
  const a = v2;
13731
13731
  if (typeof a !== "object" || a === null || a.term === void 0 || a.term.op === "lit" || a.term.op === "var" && a.term.id === name) {
13732
+ if (a && typeof a === "object" && a.shape?.k === "sum") {
13733
+ const members = a.shape.members.map((m) => {
13734
+ if (m.term === void 0 || m.term.op === "lit" || m.term.op === "var" && m.term.id === name) {
13735
+ return m;
13736
+ }
13737
+ const nt2 = { op: "var", id: name };
13738
+ return { ...m, term: nt2, pred: rewritePred(m.pred, m.term, nt2) };
13739
+ });
13740
+ return { ...a, shape: { ...a.shape, members } };
13741
+ }
13732
13742
  return v2;
13733
13743
  }
13734
13744
  const nt = { op: "var", id: name };
@@ -13808,11 +13818,13 @@ function $not(a) {
13808
13818
  }
13809
13819
  function $eq(a, b) {
13810
13820
  const r = strictEqAbs(a, b);
13811
- return r === void 0 ? bool() : boolLit(r);
13821
+ if (r !== void 0) return boolLit(r);
13822
+ return cmp("eq", a, b, currentExecPhi());
13812
13823
  }
13813
13824
  function $ne(a, b) {
13814
13825
  const r = strictEqAbs(a, b);
13815
- return r === void 0 ? bool() : boolLit(!r);
13826
+ if (r !== void 0) return boolLit(!r);
13827
+ return cmp("ne", a, b, currentExecPhi());
13816
13828
  }
13817
13829
  function $eqLoose(a, b) {
13818
13830
  const r = looseEqAbs(a, b);
@@ -27909,6 +27921,12 @@ function numericBounds(a, phi2 = pTrue) {
27909
27921
  if (a.term?.op === "var") {
27910
27922
  collectBoundsFromPhi(phi2, a.term.id, result);
27911
27923
  }
27924
+ if (a.pred && a.term) {
27925
+ collectExclusionsFromPred(a.pred, a.term, result);
27926
+ }
27927
+ if (a.term?.op === "var") {
27928
+ collectExclusionsFromPhi(phi2, a.term.id, result);
27929
+ }
27912
27930
  if (a.term?.op === "lit" && typeof a.term.value === "number" && !Number.isNaN(a.term.value)) {
27913
27931
  result.lo = { value: a.term.value, strict: false };
27914
27932
  result.hi = { value: a.term.value, strict: false };
@@ -27962,6 +27980,44 @@ function collectBoundsFromPhi(phi2, id, acc) {
27962
27980
  noteBoundFromRel(p, isTarget, acc);
27963
27981
  }
27964
27982
  }
27983
+ function noteStrictExclusion(p, isTarget, acc) {
27984
+ if (p.op !== "ne") return;
27985
+ const num2 = exclusionLitOf(p, isTarget);
27986
+ if (num2 === void 0) return;
27987
+ if (acc.lo !== void 0 && acc.lo.value === num2 && !acc.lo.strict) {
27988
+ acc.lo = { value: num2, strict: true };
27989
+ }
27990
+ if (acc.hi !== void 0 && acc.hi.value === num2 && !acc.hi.strict) {
27991
+ acc.hi = { value: num2, strict: true };
27992
+ }
27993
+ }
27994
+ function exclusionLitOf(p, isTarget) {
27995
+ if (isTarget(p.a) && p.b.op === "lit" && typeof p.b.value === "number" && !Number.isNaN(p.b.value)) {
27996
+ return p.b.value;
27997
+ }
27998
+ if (isTarget(p.b) && p.a.op === "lit" && typeof p.a.value === "number" && !Number.isNaN(p.a.value)) {
27999
+ return p.a.value;
28000
+ }
28001
+ return void 0;
28002
+ }
28003
+ function collectExclusionsFromPred(pred, term, acc) {
28004
+ const isTarget = (t) => termToString(t) === termToString(term);
28005
+ const apply = (p) => {
28006
+ if (p.op === "and") {
28007
+ p.args.forEach(apply);
28008
+ return;
28009
+ }
28010
+ noteStrictExclusion(p, isTarget, acc);
28011
+ };
28012
+ apply(pred);
28013
+ }
28014
+ function collectExclusionsFromPhi(phi2, id, acc) {
28015
+ const isTarget = (t) => t.op === "var" && t.id === id;
28016
+ const conjs = phi2.op === "and" ? phi2.args : [phi2];
28017
+ for (const p of conjs) {
28018
+ noteStrictExclusion(p, isTarget, acc);
28019
+ }
28020
+ }
27965
28021
  function sub(a, b, phi2 = pTrue) {
27966
28022
  {
27967
28023
  const fa = builtinBrandToPrimitive(a, "number");
@@ -28170,6 +28226,11 @@ function div(a, b, phi2 = pTrue, assume) {
28170
28226
  }
28171
28227
  return numLit(va / vb);
28172
28228
  }
28229
+ if (va === 0 && !Object.is(va, -0)) {
28230
+ const bb = numericBounds(b, phi2);
28231
+ const excludesZero = bb !== void 0 && (bb.lo !== void 0 && (bb.lo.value > 0 || bb.lo.value === 0 && bb.lo.strict) || bb.hi !== void 0 && (bb.hi.value < 0 || bb.hi.value === 0 && bb.hi.strict));
28232
+ if (excludesZero) return numLit(0);
28233
+ }
28173
28234
  if (ra.ok && rb.ok && coercibleLit(ra.value) && coercibleLit(rb.value)) {
28174
28235
  return numLit(Number(va) / Number(vb));
28175
28236
  }
@@ -28285,7 +28346,7 @@ function mod(a, b, phi2 = pTrue) {
28285
28346
  return abs({ k: "unknown" }, void 0, void 0, "partial");
28286
28347
  }
28287
28348
  function cmp(op, a, b, phi2 = pTrue) {
28288
- {
28349
+ if (op !== "eq" && op !== "ne") {
28289
28350
  const fa = builtinBrandToPrimitive(a, "number");
28290
28351
  const fb = builtinBrandToPrimitive(b, "number");
28291
28352
  if (fa || fb) return cmp(op, fa ?? a, fb ?? b, phi2);
@@ -47,7 +47,7 @@ import {
47
47
  withEvalBudgetOverride,
48
48
  withExecPhi,
49
49
  withFnBudgetOverride
50
- } from "./chunk-56GO5HYS.js";
50
+ } from "./chunk-A2PLG2QV.js";
51
51
 
52
52
  // src/algebra/directive-scan.ts
53
53
  function cleanDirectiveLine(raw, kind) {
package/dist/exec.js CHANGED
@@ -206,7 +206,7 @@ import {
206
206
  withAssumePremises,
207
207
  withEvalBudgetOverride,
208
208
  withExecPhi
209
- } from "./chunk-56GO5HYS.js";
209
+ } from "./chunk-A2PLG2QV.js";
210
210
  export {
211
211
  $absVal,
212
212
  $add,
package/dist/index.js CHANGED
@@ -66,7 +66,7 @@ import {
66
66
  takeInterfaceDiagsSince,
67
67
  takeRefineDiags,
68
68
  takeRefineDiagsSince
69
- } from "./chunk-JI2XDARI.js";
69
+ } from "./chunk-V2XC3V72.js";
70
70
  import {
71
71
  $add,
72
72
  $arguments,
@@ -526,7 +526,7 @@ import {
526
526
  withAssumePremises,
527
527
  withExecPhi,
528
528
  withVar
529
- } from "./chunk-56GO5HYS.js";
529
+ } from "./chunk-A2PLG2QV.js";
530
530
 
531
531
  // src/environment.ts
532
532
  function createEnvironment(parent, bindings = /* @__PURE__ */ new Map()) {
package/dist/internal.js CHANGED
@@ -21,7 +21,7 @@ import {
21
21
  stableAnalyzeKeySource,
22
22
  stablePathKey,
23
23
  stablePathKeyGraph
24
- } from "./chunk-JI2XDARI.js";
24
+ } from "./chunk-V2XC3V72.js";
25
25
  import {
26
26
  $tryDigestSoft,
27
27
  $tryMarkSoft,
@@ -169,7 +169,7 @@ import {
169
169
  withEvalBudgetOverride,
170
170
  withFnBudgetOverride,
171
171
  wrapPromise
172
- } from "./chunk-56GO5HYS.js";
172
+ } from "./chunk-A2PLG2QV.js";
173
173
 
174
174
  // src/algebra/inlay.ts
175
175
  function listFunctions(source) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nudojs/core",
3
- "version": "1.12.0",
3
+ "version": "1.13.0",
4
4
  "engines": {
5
5
  "node": ">=20"
6
6
  },