eyemind 0.3.1 → 0.3.2

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.
package/README.md CHANGED
@@ -16,7 +16,7 @@ library and develop eyemind; the playground runs programs in your browser;
16
16
  the specification defines the language, its canonical text, the proof format
17
17
  and the C1–C9 checks. The examples are 94 runnable programs, each with a card
18
18
  deck and saved conclusions, proofs and check reports. The conformance suite
19
- has 1283 cases that test any implementation of the specification through its
19
+ has 1290 cases that test any implementation of the specification through its
20
20
  command line; run it [in your browser](https://eyereasoner.github.io/eyemind/playground/conformance).
21
21
 
22
22
  ```js
package/SPEC.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  ```text
4
4
  Title: The eyemind Rule Language and Proof Format
5
- Version: eyemind 0.3.1
5
+ Version: eyemind 0.3.2
6
6
  ```
7
7
 
8
8
  This document specifies the syntax and meaning of eyemind programs and data
@@ -77,6 +77,7 @@ proof.
77
77
  - [11.10 C9 Search closure](#1110-c9-search-closure)
78
78
  - [11.11 Counts and validity](#1111-counts-and-validity)
79
79
  - [11.12 Scope of a valid proof](#1112-scope-of-a-valid-proof)
80
+ - [11.13 Operational query fidelity](#1113-operational-query-fidelity)
80
81
  - [12. Check Reports](#12-check-reports)
81
82
  - [12.1 JSON form](#121-json-form)
82
83
  - [13. Command-Line Interface](#13-command-line-interface)
@@ -1347,8 +1348,48 @@ bound to `skolem(N, Name, Args)`, where:
1347
1348
  - `Name` is the name of `V` as the program writes it (Section 8.2);
1348
1349
  - `Args` is the same for every such variable of the step, and is the list of
1349
1350
  the values of the heads' variables, in order of their first occurrence in
1350
- the heads, that are ground and contain no Skolem term `skolem(N, _, Args)`:
1351
- the values that do contain one hold a witness of this firing.
1351
+ the heads, omitting a value only when it holds a fresh parameter of this
1352
+ firing, as established below. The spelling of a Skolem term alone MUST
1353
+ NOT establish that it is fresh.
1354
+
1355
+ A value containing `skolem(N, _, Args)` is a **candidate** for omission.
1356
+ Values of variables occurring only in the head hold the witnesses checked
1357
+ above. If any other head variable's value is omitted, the checker MUST
1358
+ establish its **parametric provenance**:
1359
+
1360
+ 1. In the instantiated full head and premises, replace each distinct term
1361
+ `skolem(N, Name, Args)` by one fresh variable, using the same replacement
1362
+ throughout. Distinct such terms receive distinct variables, disjoint
1363
+ from all source and document variables. The abstracted head and premises
1364
+ together MUST still be an instance of the source clause, with all
1365
+ variable sharing preserved and without further instantiating their terms.
1366
+ A literal Skolem-shaped constant of the source is therefore fixed data,
1367
+ not a parameter the proof may abstract.
1368
+ 2. Each affected premise MUST have evidence under this same abstraction.
1369
+ Follow the recorded uses: backward clauses MUST still satisfy C1,
1370
+ inspection steps the source-instance check of C1, primitives C5, and
1371
+ controls the composition check of C5. An unrecorded source fact is
1372
+ available as in C4. A previously derived forward fact is fixed evidence:
1373
+ the abstracted premise MUST be an instance of that fact, allowing only
1374
+ its existing universal variables to be instantiated. Its ground terms
1375
+ MUST NOT be generalized. Each original step remains subject to its own
1376
+ checks, including C8 and C2; this traversal supplies no missing derivation.
1377
+ 3. Captured values and enclosing generator projections of a premise's
1378
+ derived backward rule instance are fixed before its use and MUST NOT
1379
+ change under abstraction. Likewise, this firing's captures MUST NOT
1380
+ change. A backward caller cannot make an earlier firing's data fresh.
1381
+ 4. An unchanged boundary may use its original evidence or obligation. A
1382
+ changed boundary MUST already be settled in its original form, and its
1383
+ abstracted form MUST also be settled by Section 11.10, consulting only
1384
+ tables and listings the original boundary rests on. A missing or
1385
+ incomplete certificate fails provenance; an obligation for a specific
1386
+ boundary MUST NOT silently become an obligation for a stronger one.
1387
+
1388
+ Failure of this provenance check is C8, not C1: the original step may be a
1389
+ valid clause instance while proposing the wrong witness context. Provenance
1390
+ rechecks do not add steps or change the C1, C5 or C9 counts. They establish
1391
+ that the displayed firing's evidence permits fresh parameters, not that the
1392
+ firing is the one an original open call would select (Section 11.13).
1352
1393
 
1353
1394
  When a forward clause has any such variables, its full head under the step's
1354
1395
  substitution MUST be ground; a step that leaves such a variable unbound, or
@@ -1369,8 +1410,10 @@ template's capture list and the substitution, not from the witness term.
1369
1410
 
1370
1411
  A variable of the head that also occurs in the body is not checked by C8,
1371
1412
  even when the body leaves it unbound; its value comes from the uses, which
1372
- other conditions check. A step with no witnesses in its own forward head or enclosing generators is
1373
- not covered by C8.
1413
+ other conditions check. Its effect on a head-only variable's witness context
1414
+ is nevertheless subject to the provenance check above. A step with no
1415
+ witnesses in its own forward head or enclosing generators is not covered
1416
+ by C8.
1374
1417
 
1375
1418
  ### 11.10 C9 Search closure
1376
1419
 
@@ -1462,6 +1505,42 @@ that the claims are all the conclusions of the program, that the program
1462
1505
  derives no `'false'`, or that the program is the one intended: a proof MAY
1463
1506
  leave conclusions out, and a run's own proof holds exactly its conclusions.
1464
1507
 
1508
+ ### 11.13 Operational query fidelity
1509
+
1510
+ **Operational query fidelity** means that a claimed answer can be reported
1511
+ for an original question under Section 8, retaining its original call-time
1512
+ bindings, control choices and applicable forward state. Each claimed answer
1513
+ must be reachable in that question's ordered search. This is distinct from
1514
+ completeness: a proof may omit other reachable answers without falsifying
1515
+ the answers it does give.
1516
+
1517
+ C1–C9 check the recorded instances and their evidence. They do not establish
1518
+ operational query fidelity for binding-sensitive or order-sensitive goals.
1519
+ In particular, a checker MUST NOT treat C7's instance test, or C5's
1520
+ composition of a `once` step, as proof that the original open call selected
1521
+ that instance. For example:
1522
+
1523
+ ```js
1524
+ fact(p('a'), p('b'))
1525
+ implied_by(q(X), once(p(X)))
1526
+ ```
1527
+
1528
+ The question `q(X)` answers only `q('a')`. Nevertheless, a C1–C9 proof may
1529
+ justify `q('b')` with `once(p('b'))` and `p('b')`, since the specialized
1530
+ call `q('b')` succeeds. A final substitution does not show that the original
1531
+ call was `once(p(X))` with `X` unbound, or that its first answer was `'a'`.
1532
+ Tests of current variable state have the same distinction (Section 7.5).
1533
+
1534
+ A checker claiming the additional property MUST validate evidence of the
1535
+ original call state, propagation of bindings between ordered premises,
1536
+ freshening and scope, and any first-solution choice or required search
1537
+ closure. A claimed call state or substitution is not authority: it must
1538
+ follow from the original question, source clauses and checked evidence.
1539
+ It MUST preserve generator captures independently of later caller bindings
1540
+ and MUST NOT invoke the reasoner to fill gaps. No additional condition or
1541
+ evidence format for that property is defined by this specification; a
1542
+ C1–C9 verdict alone MUST NOT be presented as establishing it.
1543
+
1465
1544
  ## 12. Check Reports
1466
1545
 
1467
1546
  A check report is a document (Section 9.1) beginning with the proof's claims,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eyemind",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "A dependency-free JavaScript rule language with forward and backward reasoning and checkable proofs.",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
package/src/closure.js CHANGED
@@ -390,19 +390,20 @@ export class Settler {
390
390
  exact(callKey) {
391
391
  const memo = this.exactness ??= new Map();
392
392
  if (memo.has(callKey)) return memo.get(callKey);
393
- const order = [];
394
- const pending = [callKey];
395
- const seen = new Set();
396
- while (pending.length) {
397
- const item = pending.pop();
398
- if (seen.has(item) || memo.has(item)) continue;
399
- seen.add(item);
400
- order.push(item);
401
- pending.push(...this.tables.get(item).reliance.tables);
402
- }
403
- for (let i = order.length - 1; i >= 0; i--) {
404
- const reliance = this.tables.get(order[i]).reliance;
405
- memo.set(order[i], !reliance.listings.size && [...reliance.tables].every((item) => memo.get(item) !== false));
393
+ // Finish each dependency before caching its parent. Reversing discovery
394
+ // order is insufficient when two branches share a dependency.
395
+ const frame = (item) => [item, [...this.tables.get(item).reliance.tables], 0];
396
+ const stack = [frame(callKey)];
397
+ while (stack.length) {
398
+ const top = stack[stack.length - 1];
399
+ if (top[2] < top[1].length) {
400
+ const next = top[1][top[2]++];
401
+ if (!memo.has(next)) stack.push(frame(next));
402
+ continue;
403
+ }
404
+ const reliance = this.tables.get(top[0]).reliance;
405
+ memo.set(top[0], !reliance.listings.size && top[1].every((item) => memo.get(item)));
406
+ stack.pop();
406
407
  }
407
408
  return memo.get(callKey);
408
409
  }
package/src/proof.js CHANGED
@@ -327,7 +327,8 @@ function check(program, claims, steps, certificate, goals, allowTrusted, fail, s
327
327
  fail.add('C4', `unjustified claim ${text(claim)}`, claim);
328
328
  }
329
329
  }
330
- const tally = checkSteps(program, steps, allowTrusted, fail, spellings, name, settlement.outcomes);
330
+ const provenance = new WitnessProvenance(program, steps, certificate, settlement.outcomes, spellings);
331
+ const tally = checkSteps(program, steps, allowTrusted, fail, spellings, name, settlement.outcomes, provenance);
331
332
  const [confronted, closed] = checkBoundaries(program, steps, tally.boundaries, fail, settlement.outcomes, spellings);
332
333
  checkRelevance(program, claims, steps, goals || [], fail, spellings, settlement, certificate);
333
334
  checkWellFounded(steps, fail, spellings);
@@ -460,7 +461,7 @@ const CONTROL_BY = 'control';
460
461
  // C4, C1, C3 and C5 for each step: every use is justified, and the step is an
461
462
  // instance of the clause it cites, a recomputed primitive, a control composed
462
463
  // of its uses, or a trusted boundary the later checks confront.
463
- function checkSteps(program, steps, allowTrusted, fail, spellings, name, outcomes) {
464
+ function checkSteps(program, steps, allowTrusted, fail, spellings, name, outcomes, provenance) {
464
465
  const tally = { verified: 0, redecided: 0, composed: 0, witnessed: 0, boundaries: [], trusted: [] };
465
466
 
466
467
  function covered(goal) {
@@ -478,7 +479,7 @@ function checkSteps(program, steps, allowTrusted, fail, spellings, name, outcome
478
479
  if (!covered(use)) fail.add('C4', `unjustified use ${text(use)}`, goal);
479
480
  }
480
481
  if (isTerm(by, 'clause', 1)) {
481
- if (checkResolution(program, step, fail, tally)) tally.verified++;
482
+ if (checkResolution(program, step, fail, tally, provenance)) tally.verified++;
482
483
  } else if (isTerm(by, 'source', 1)) {
483
484
  const clause = clauseNamed(program, by.args[0]);
484
485
  const inspected = clause === null ? null : program.inspectedById.get(clause.id);
@@ -491,19 +492,7 @@ function checkSteps(program, steps, allowTrusted, fail, spellings, name, outcome
491
492
  fail.add('C3', 'invalid builtin justification', goal);
492
493
  continue;
493
494
  }
494
- let agrees = false;
495
- try {
496
- for (const env of primitive(goal, new Env())) {
497
- if (resolvesTo(goal, env, goal)) {
498
- agrees = true;
499
- break;
500
- }
501
- }
502
- } catch (error) {
503
- // A primitive that cannot be recomputed does not pass C5.
504
- if (!(error instanceof EyemindError)) throw error;
505
- }
506
- if (!agrees) agrees = nearHostMath(goal);
495
+ const agrees = redecides(goal);
507
496
  if (!agrees) fail.add('C5', `primitive disagrees: ${text(goal)}`, goal);
508
497
  else tally.redecided++;
509
498
  } else if (by === CONTROL_BY) {
@@ -520,7 +509,10 @@ function checkSteps(program, steps, allowTrusted, fail, spellings, name, outcome
520
509
  tally.composed++;
521
510
  }
522
511
  } else if ((by === 'absent' && isTerm(goal, 'not', 1)) || (by === 'collected' && isTerm(goal, 'findall', 3))) {
523
- if (bindings.length || uses.length) fail.add('C3', 'trusted boundaries cannot have bindings or uses', goal);
512
+ if (bindings.length || uses.length) {
513
+ fail.add('C3', 'trusted boundaries cannot have bindings or uses', goal);
514
+ continue;
515
+ }
524
516
  tally.boundaries.push(goal);
525
517
  // A boundary its search certificate settles is checked, not trusted.
526
518
  if (outcomes.get(spellings.spell(goal))?.status === 'settled') continue;
@@ -533,6 +525,17 @@ function checkSteps(program, steps, allowTrusted, fail, spellings, name, outcome
533
525
  return tally;
534
526
  }
535
527
 
528
+ function redecides(goal) {
529
+ try {
530
+ for (const env of primitive(goal, new Env())) {
531
+ if (resolvesTo(goal, env, goal)) return true;
532
+ }
533
+ } catch (error) {
534
+ if (!(error instanceof EyemindError)) throw error;
535
+ }
536
+ return nearHostMath(goal);
537
+ }
538
+
536
539
  const isConstant = (term) => typeof term === 'string' || typeof term === 'bigint' || typeof term === 'number';
537
540
 
538
541
  // Shortcuts the checker may take; tests turn them off to compare with the
@@ -589,7 +592,7 @@ function flatResolution(clause, goal, bindings, uses) {
589
592
  // variables of that clause, and under them one of the clause's heads is the
590
593
  // step's goal and its body is exactly the step's uses. C8 is checked under
591
594
  // the same substitution.
592
- function checkResolution(program, step, fail, tally) {
595
+ function checkResolution(program, step, fail, tally, provenance = null) {
593
596
  const { goal, by, bindings, uses } = step;
594
597
  const clauseId = by.args[0];
595
598
  const clause = clauseNamed(program, clauseId);
@@ -631,11 +634,11 @@ function checkResolution(program, step, fail, tally) {
631
634
  if (matches && resolvesTo(candidate, env, goal) && body.every((item, i) => resolvesTo(item, env, uses[i]))) {
632
635
  resolution = true;
633
636
  // Any head the step can be an instance of decides; a verified witness wins.
634
- let found = clause.forward ? checkWitnesses(clause, head, names, env) : null;
635
- for (const parentId of clause.scopeIds) {
637
+ let found = clause.forward && provenance !== null ? checkWitnesses(clause, head, body, names, env, provenance) : null;
638
+ for (const parentId of provenance === null ? [] : clause.scopeIds) {
636
639
  const parent = program.byId.get(parentId);
637
640
  const scopeHead = freshTerm(parent.head, `check${clauseId}`, names);
638
- const checked = checkWitnesses(parent, scopeHead, names, env);
641
+ const checked = checkWitnesses(parent, scopeHead, body.slice(0, parent.body.length), names, env, provenance);
639
642
  if (checked === false) found = false;
640
643
  else if (checked === true && found === null) found = true;
641
644
  }
@@ -647,7 +650,7 @@ function checkResolution(program, step, fail, tally) {
647
650
  fail.add('C1', `not an instance of source clause ${clauseId}: ${text(goal)}`, goal);
648
651
  return false;
649
652
  }
650
- if (witnesses === false) fail.add('C8', `witnesses do not match the source scopes of clause ${clauseId}: ${text(goal)}`, goal);
653
+ if (witnesses === false) fail.add('C8', `witnesses or their premise provenance do not match the source scopes of clause ${clauseId}: ${text(goal)}`, goal);
651
654
  else if (witnesses === true) tally.witnessed++;
652
655
  return true;
653
656
  }
@@ -655,11 +658,11 @@ function checkResolution(program, step, fail, tally) {
655
658
  // C8: under a step's substitution, each witness of a forward rule is the
656
659
  // Skolem term of this firing, skolem(Rule, Variable, Arguments), where
657
660
  // Arguments are the ground values of the conclusions' other variables, in
658
- // order of first occurrence, leaving out those that hold a witness of this
659
- // firing: the term the reasoner makes (Section 8.2). Returns null when the
661
+ // order of first occurrence, leaving out fresh parameters only when their
662
+ // premise evidence establishes that provenance. Returns null when the
660
663
  // rule has no witnesses, else whether they all hold; head is the rule's
661
664
  // renamed conclusions and names maps its variables to their renamed ones.
662
- function checkWitnesses(clause, head, names, env) {
665
+ function checkWitnesses(clause, head, body, names, env, provenance) {
663
666
  const witnessed = clause.witnessNames;
664
667
  if (!witnessed.length) return null;
665
668
  // An existential firing needs bound inspection values. A generic rule
@@ -688,11 +691,161 @@ function checkWitnesses(clause, head, names, env) {
688
691
  const expected = clause.captures === null ? [] : [listFromItems(
689
692
  clause.captures.map((name) => copyResolved(names.get(name), env)),
690
693
  )];
694
+ const introduced = new Set(witnessed.map((name) => names.get(name).name));
695
+ let contextual = false;
691
696
  for (const variable of variables(head).values()) {
692
697
  const value = copyResolved(variable, env);
693
698
  if (isGround(value) && !ofThisFiring(value)) expected.push(value);
699
+ else if (!introduced.has(variable.name)) contextual = true;
700
+ }
701
+ return text(listFromItems(expected)) === text(firing) &&
702
+ (!contextual || provenance.check(clause, head, body, names, env, firing));
703
+ }
704
+
705
+ // A value may be omitted from a firing's context only when its apparent
706
+ // fresh symbols really are parameters of the premise derivation. Abstract
707
+ // those symbols together, then check the recorded evidence against the
708
+ // source again. In particular, abstracting a literal input Skolem constant
709
+ // must fail; its spelling does not make it a fresh value of this firing.
710
+ class WitnessProvenance {
711
+ constructor(program, steps, certificate, outcomes, spellings) {
712
+ this.program = program;
713
+ this.steps = steps;
714
+ this.certificate = certificate;
715
+ this.outcomes = outcomes;
716
+ this.spellings = spellings;
717
+ this.serial = 0;
718
+ this.usedNames = null;
719
+ }
720
+
721
+ fresh() {
722
+ if (this.usedNames === null) {
723
+ this.usedNames = new Map();
724
+ for (const step of this.steps.values()) {
725
+ for (const term of [step.goal, ...step.bindings, ...step.uses]) variables(term, this.usedNames);
726
+ }
727
+ for (const clause of this.program.clauses) {
728
+ for (const term of [clause.head, ...clause.body, ...clause.extraTerms]) variables(term, this.usedNames);
729
+ }
730
+ }
731
+ let name;
732
+ do { name = `\0witness${++this.serial}`; } while (this.usedNames.has(name));
733
+ return new Var(name);
734
+ }
735
+
736
+ check(clause, head, body, names, env, firing) {
737
+ const argumentsId = text(firing);
738
+ const symbols = new Map();
739
+ const copied = new Map();
740
+ const abstract = (term) => {
741
+ if (!(term instanceof Struct)) return term;
742
+ if (copied.has(term)) return copied.get(term);
743
+ let result;
744
+ if (isTerm(term, 'skolem', 3) && term.args[0] === BigInt(clause.id) && text(term.args[2]) === argumentsId) {
745
+ const id = text(term);
746
+ if (!symbols.has(id)) symbols.set(id, this.fresh());
747
+ result = symbols.get(id);
748
+ } else {
749
+ const args = term.args.map(abstract);
750
+ result = args.every((arg, i) => arg === term.args[i]) ? term : new Struct(term.name, args);
751
+ }
752
+ copied.set(term, result);
753
+ return result;
754
+ };
755
+ // Captures belong to an already-created instance, before this firing.
756
+ for (const name of clause.captures || []) {
757
+ const value = copyResolved(names.get(name), env);
758
+ if (abstract(value) !== value) return false;
759
+ }
760
+ const projected = abstract(copyResolved(new Struct('scope', [head, ...body]), env));
761
+ const source = new Struct('scope', [clause.head, ...clause.body]);
762
+ if (!isInstance(projected, source, 'provenance')) return false;
763
+ const pending = body.map((goal) => copyResolved(goal, env));
764
+ const seen = new Set();
765
+ const fail = new Failures();
766
+ while (pending.length) {
767
+ const original = pending.pop();
768
+ if (isTerm(original, 'and', 2)) {
769
+ pending.push(...flattenConjunction(original));
770
+ continue;
771
+ }
772
+ const goal = abstract(original);
773
+ if (goal === original) continue;
774
+ const id = this.spellings.spell(original);
775
+ if (seen.has(id)) continue;
776
+ seen.add(id);
777
+ const step = this.steps.get(id);
778
+ if (step === undefined) {
779
+ if (!isCallable(goal) || !(this.program.groups.get(key(goal)) || []).some((given) =>
780
+ !given.body.length && isInstance(goal, given.head, 'provenanceFact'))) return false;
781
+ continue;
782
+ }
783
+ if (isTerm(step.by, 'clause', 1)) {
784
+ const cited = clauseNamed(this.program, step.by.args[0]);
785
+ if (cited === null) return false;
786
+ if (cited.forward) {
787
+ // A premise's derived fact already exists. Its ground values are
788
+ // data, and only its universal variables may be instantiated.
789
+ if (!isInstance(goal, step.goal, 'provenanceDerived')) return false;
790
+ continue;
791
+ }
792
+ if (!this.fixedScopes(cited, step, abstract)) return false;
793
+ const generalized = { ...step, goal, bindings: step.bindings.map(abstract), uses: step.uses.map(abstract) };
794
+ // Original steps receive their own C8 checks. Here only source
795
+ // resolution is repeated, under the one shared abstraction.
796
+ if (!checkResolution(this.program, generalized, fail, { witnessed: 0 })) return false;
797
+ pending.push(...step.uses);
798
+ } else if (isTerm(step.by, 'source', 1)) {
799
+ const cited = clauseNamed(this.program, step.by.args[0]);
800
+ const inspected = cited === null ? null : this.program.inspectedById.get(cited.id);
801
+ if (!inspected || step.bindings.length || step.uses.length || !isInspection(goal) ||
802
+ !isInstance(goal, inspected.term, 'provenanceInspection')) return false;
803
+ } else if (step.by === BUILTIN_BY) {
804
+ if (step.bindings.length || step.uses.length || !isCallable(goal) ||
805
+ !PRIMITIVE_KEYS.has(key(goal)) || !redecides(goal)) return false;
806
+ } else if (step.by === CONTROL_BY) {
807
+ const candidates = isTerm(goal, 'call', 1) || isTerm(goal, 'once', 1) ? [goal.args[0]]
808
+ : isTerm(goal, 'or', 2) ? goal.args : [];
809
+ const uses = step.uses.map(abstract);
810
+ if (step.bindings.length || !candidates.some((candidate) => {
811
+ const parts = flattenConjunction(candidate);
812
+ return parts.length === uses.length && parts.every((part, i) => text(part) === text(uses[i]));
813
+ })) return false;
814
+ pending.push(...step.uses);
815
+ } else if (isBoundary(step)) {
816
+ // Generalizing a trusted assumption would silently strengthen it.
817
+ // Only the already-consulted certificate may discharge a stronger
818
+ // boundary; missing evidence fails provenance instead.
819
+ const outcome = this.outcomes.get(id);
820
+ if (outcome?.status !== 'settled') return false;
821
+ const tables = new Set(outcome.tables);
822
+ const listings = new Set(outcome.listings);
823
+ const settler = new Settler(this.program, {
824
+ answers: (call) => tables.has(variant(call)) ? this.certificate.tables.get(variant(call)) : null,
825
+ facts: (goalKey) => listings.has(goalKey) ? this.certificate.listings.get(goalKey) : null,
826
+ supported: (fact) => this.steps.has(this.spellings.spell(fact)),
827
+ });
828
+ if (settler.settle(goal).status !== 'settled') return false;
829
+ } else return false;
830
+ }
831
+ return true;
832
+ }
833
+
834
+ fixedScopes(clause, step, abstract) {
835
+ if (!clause.scopeIds.length) return true;
836
+ const [head, body, names] = freshClause(clause, 'provenanceScope');
837
+ const env = new Env();
838
+ for (const pair of step.bindings) {
839
+ if (!names.has(pair.args[0]) || !unify(names.get(pair.args[0]), pair.args[1], env)) return false;
840
+ }
841
+ if (!unify(head, step.goal, env) || body.length !== step.uses.length ||
842
+ !body.every((goal, i) => unify(goal, step.uses[i], env))) return false;
843
+ for (const term of clause.extraTerms) {
844
+ const value = copyResolved(freshTerm(term, 'provenanceScope', names), env);
845
+ if (abstract(value) !== value) return false;
846
+ }
847
+ return true;
694
848
  }
695
- return text(listFromItems(expected)) === text(firing);
696
849
  }
697
850
 
698
851
  // C9 and C6. A boundary its search certificate settles holds, and one whose
package/src/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // The release this checkout is; ./release keeps it in step with package.json.
2
- export const VERSION = '0.3.1';
2
+ export const VERSION = '0.3.2';