eyemind 0.5.0 → 0.5.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/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.5.0
5
+ Version: eyemind 0.5.2
6
6
  ```
7
7
 
8
8
  This document specifies the syntax and meaning of eyemind programs and data
@@ -66,20 +66,20 @@ proof.
66
66
  - [10.4 Search certificates](#104-search-certificates)
67
67
  - [10.5 Call-fidelity certificates](#105-call-fidelity-certificates)
68
68
  - [11. Proof Checking](#11-proof-checking)
69
- - [11.1 Reading the document](#111-reading-the-document)
70
- - [11.2 C1 Resolution](#112-c1-resolution)
71
- - [11.3 C2 Well-foundedness](#113-c2-well-foundedness)
72
- - [11.4 C3 Justification](#114-c3-justification)
73
- - [11.5 C4 Coverage](#115-c4-coverage)
74
- - [11.6 C5 Re-decision](#116-c5-re-decision)
75
- - [11.7 C6 Boundary consistency](#117-c6-boundary-consistency)
76
- - [11.8 C7 Relevance](#118-c7-relevance)
77
- - [11.9 C8 Witness integrity](#119-c8-witness-integrity)
78
- - [11.10 C9 Search closure](#1110-c9-search-closure)
79
- - [11.11 Counts and validity](#1111-counts-and-validity)
80
- - [11.12 Scope of a valid proof](#1112-scope-of-a-valid-proof)
81
- - [11.13 Operational query fidelity](#1113-operational-query-fidelity)
82
- - [11.14 C10 Call fidelity](#1114-c10-call-fidelity)
69
+ - [11.1 Scope of a valid proof](#111-scope-of-a-valid-proof)
70
+ - [11.2 Operational query fidelity](#112-operational-query-fidelity)
71
+ - [11.3 Reading the document](#113-reading-the-document)
72
+ - [11.4 C1 Resolution](#114-c1-resolution)
73
+ - [11.5 C2 Well-foundedness](#115-c2-well-foundedness)
74
+ - [11.6 C3 Justification](#116-c3-justification)
75
+ - [11.7 C4 Coverage](#117-c4-coverage)
76
+ - [11.8 C5 Re-decision](#118-c5-re-decision)
77
+ - [11.9 C6 Boundary consistency](#119-c6-boundary-consistency)
78
+ - [11.10 C7 Relevance](#1110-c7-relevance)
79
+ - [11.11 C8 Witness integrity](#1111-c8-witness-integrity)
80
+ - [11.12 C9 Search closure](#1112-c9-search-closure)
81
+ - [11.13 C10 Call fidelity](#1113-c10-call-fidelity)
82
+ - [11.14 Counts and validity](#1114-counts-and-validity)
83
83
  - [12. Check Reports](#12-check-reports)
84
84
  - [12.1 JSON form](#121-json-form)
85
85
  - [13. Command-Line Interface](#13-command-line-interface)
@@ -203,7 +203,7 @@ Proofs:
203
203
  by a clause, a primitive, a control, an absence or a collection; its
204
204
  **uses** are the goals that justify it ([Section 10.3](#103-steps)).
205
205
  - **Boundary**: a negation or collection that a proof justifies by an
206
- `'absent'` or `'collected'` step ([Section 11.7](#117-c6-boundary-consistency)).
206
+ `'absent'` or `'collected'` step ([Section 11.9](#119-c6-boundary-consistency)).
207
207
  - **Search certificate**: the tables and listings that record the searches
208
208
  behind a proof's boundaries ([Section 10.4](#104-search-certificates)).
209
209
  - **Table**: `searched(Call, Answers)`, every answer of one call, in order
@@ -215,17 +215,17 @@ Proofs:
215
215
  certificate and checked by C10 ([Section 10.5](#105-call-fidelity-certificates)).
216
216
  - **Original question**: each external goal; without external goals, the
217
217
  body of each query; without queries, each ordinary forward head. C10
218
- checks the claims answering them ([Section 11.14](#1114-c10-call-fidelity)).
218
+ checks the claims answering them ([Section 11.13](#1113-c10-call-fidelity)).
219
219
  - **Settled**: established by its search certificate, as a boundary is when
220
- C9 accepts that certificate ([Section 11.10](#1110-c9-search-closure)).
220
+ C9 accepts that certificate ([Section 11.12](#1112-c9-search-closure)).
221
221
  - **Trusted boundary**: a boundary that is not settled. A valid proof
222
222
  assumes it, and its check report lists it as an **obligation**, as it
223
- lists each claim whose call fidelity remains unproved (Sections [11.7](#117-c6-boundary-consistency),
224
- [11.14](#1114-c10-call-fidelity) and [12](#12-check-reports)).
223
+ lists each claim whose call fidelity remains unproved (Sections [11.9](#119-c6-boundary-consistency),
224
+ [11.13](#1113-c10-call-fidelity) and [12](#12-check-reports)).
225
225
  - **Check report**: what a checker writes: the claims, the outcome of each
226
226
  of C1–C10, failures, obligations, counts and a verdict ([Section 12](#12-check-reports)).
227
227
  - **Valid**: of a proof, failing no condition; a valid proof with
228
- obligations is valid conditional on them ([Section 11.11](#1111-counts-and-validity)).
228
+ obligations is valid conditional on them ([Section 11.14](#1114-counts-and-validity)).
229
229
 
230
230
  ## 2. Terms
231
231
 
@@ -820,7 +820,7 @@ at every use. Unrelated unbound variables keep [Section 8.2](#82-forward-evaluat
820
820
  When inspection variables remain free in a conclusion or its captured
821
821
  template context, that firing MUST NOT introduce head-only existential
822
822
  witnesses: it MUST fail with an error requiring the inspection variables to
823
- be bound first. [Section 11.9](#119-c8-witness-integrity) rejects certificates that bypass this boundary.
823
+ be bound first. [Section 11.11](#1111-c8-witness-integrity) rejects certificates that bypass this boundary.
824
824
 
825
825
  Inspection uses a fixed source catalogue, so its own results do not depend on
826
826
  forward rounds. Other goals using derived patterns still participate in
@@ -922,7 +922,7 @@ infinite closure. A finite model does not ensure search termination:
922
922
  recurs indefinitely. Exceeding a resource bound raises an error ([Section
923
923
  8.3](#83-resource-bounds)). Contradictions halt without completing the closure ([Section 8.5](#85-contradictions)).
924
924
  A valid proof establishes only its claims subject to its trusted boundaries
925
- ([Section 11.12](#1112-scope-of-a-valid-proof)), not completeness of the model or the answers. Its search
925
+ ([Section 11.1](#111-scope-of-a-valid-proof)), not completeness of the model or the answers. Its search
926
926
  certificate settles the negations and collections it can ([Section 10.4](#104-search-certificates)).
927
927
 
928
928
  ## 8. Evaluation and Conclusions
@@ -975,7 +975,7 @@ and `p(2)` publishes `a(1)`, `b(1)`, `a(2)`, `b(2)`. For each head:
975
975
  free, in order of first occurrence in the heads. A rule that keeps meeting new firings does
976
976
  not terminate ([Section 8.3](#83-resource-bounds)). Derived facts other than scoped inspection
977
977
  patterns ([Section 6.3](#63-source-rule-inspection)) are therefore ground. A
978
- checker verifies the Skolem terms of a proof (C8, [Section 11.9](#119-c8-witness-integrity));
978
+ checker verifies the Skolem terms of a proof (C8, [Section 11.11](#1111-c8-witness-integrity));
979
979
  - a head `'true'` reports the instance of the rule's body, as a conjunction,
980
980
  once per distinct instance (by identity of canonical text);
981
981
  - a head `'false'` records the conclusion `'false'` and stops all reasoning
@@ -1064,9 +1064,9 @@ When a proof is requested, each solution records how each of its goals was
1064
1064
  justified: by a fact or rule of the program, by a derived fact (whose own
1065
1065
  record is kept), by a primitive, by a control, by an absence (a negation) or
1066
1066
  by a collection (`findall`). For each conclusion the first derivation found is
1067
- recorded. Each original question gets call-fidelity evidence (Sections [10.5](#105-call-fidelity-certificates) and [11.14](#1114-c10-call-fidelity)),
1067
+ recorded. Each original question gets call-fidelity evidence (Sections [10.5](#105-call-fidelity-certificates) and [11.13](#1113-c10-call-fidelity)),
1068
1068
  when supported. Each negation and collection of a proof gets the search certificate
1069
- that settles it (Sections [10.4](#104-search-certificates) and [11.10](#1110-c9-search-closure)) whenever [Section 11.10](#1110-c9-search-closure) allows one. A
1069
+ that settles it (Sections [10.4](#104-search-certificates) and [11.12](#1112-c9-search-closure)) whenever [Section 11.12](#1112-c9-search-closure) allows one. A
1070
1070
  table holds every answer of its call, so it can search beyond where the run
1071
1071
  stopped, as under `once`; a boundary whose tables would meet an error, or
1072
1072
  exceed `max_inferences` calls and answers ([Section 8.3](#83-resource-bounds)), stays trusted. So does a
@@ -1324,7 +1324,7 @@ proof's negations and collections:
1324
1324
 
1325
1325
  A table exists for each call to a relation that a backward rule defines or
1326
1326
  forward rules conclude, made by those searches or by the closure checks of
1327
- [Section 11.10](#1110-c9-search-closure); a call to a relation defined by facts alone needs none. A
1327
+ [Section 11.12](#1112-c9-search-closure); a call to a relation defined by facts alone needs none. A
1328
1328
  listing exists for each relation forward rules conclude that a table or a
1329
1329
  closure check consults. A reasoner writes only the tables and listings of
1330
1330
  the boundaries it settles: listings first, in the order first consulted,
@@ -1339,7 +1339,7 @@ searched(nonpacifist('ada'), [])
1339
1339
 
1340
1340
  `called(Call, Answers)` is a **call table**. Its shape and answer ordering
1341
1341
  are those of `searched/2` ([Section 10.4](#104-search-certificates)), but it records a call made while
1342
- answering an original question, for C10 ([Section 11.14](#1114-c10-call-fidelity)). External goals
1342
+ answering an original question, for C10 ([Section 11.13](#1113-c10-call-fidelity)). External goals
1343
1343
  remain inputs to the checker: a call table cannot supply or specialize the
1344
1344
  question a claim must answer.
1345
1345
 
@@ -1366,41 +1366,178 @@ They share any applicable `derived/2` listings, whose facts require steps.
1366
1366
 
1367
1367
  ## 11. Proof Checking
1368
1368
 
1369
- A checker is given a program, a proof document and, when the proof answers
1370
- goals asked from outside the program, those goals. It MUST NOT call a
1371
- reasoner to supply a missing step; it MAY recompute primitives, and it MAY
1372
- expand a call one level against the program with every inner call answered
1373
- by the search certificate ([Section 11.10](#1110-c9-search-closure)). It
1374
- checks C1–C10 and records each failure with its condition, a
1375
- detail and, where there is one, the term concerned.
1376
-
1377
- ### 11.1 Reading the document
1378
-
1379
- The document MUST read ([Section 9.1](#91-accepted-document-syntax)); otherwise C3 fails and the document has
1380
- no claims and no steps. Each `clause(N, Display)` MUST name a clause of the
1381
- program whose display ([Section 10.2](#102-clause-displays)) is identical to `Display`, variable
1382
- names included, so a display that merely renames the clause's variables
1383
- differs; otherwise C1 fails. Each `step` MUST have bindings that read as a list of `'='/2` pairs,
1384
- as an object literal does, and a list of uses, and no two steps may have
1385
- identical goals; otherwise C3 fails and the step is set aside. A `searched`
1386
- statement MUST have a callable `Call` and an array of answers, and a
1387
- `derived` statement a callable `Pattern` and an array of facts; no two tables
1388
- may have calls identical up to renaming of their variables, and no two
1389
- listings may name the same relation; otherwise C3 fails and the statement is
1390
- set aside. Every other statement is a claim ([Section 10.1](#101-structure)).
1391
-
1392
- ### 11.2 C1 Resolution
1393
-
1394
- For a `clause(N)` step, `N` MUST be a clause of the program; an `N` that is
1395
- not such a clause number, such as `'x'` or `1.0`, fails C1. The clause,
1396
- renamed apart, MUST satisfy: each binding names a distinct variable of the
1397
- clause and unifies it with its value; and for one of the clause's heads
1398
- (each conjunct of a forward rule's head), the head unifies with `Goal` and
1399
- the body, of the same length as `Uses`, unifies with `Uses` pairwise, such
1400
- that afterwards the head is identical to `Goal` and each body goal to its
1401
- use. A step's own terms MUST NOT need further instantiation to match: a
1402
- source clause `same(X, X)` cannot justify `same('a', 'b')`. Identity keeps
1403
- the sign of zero, so a fact `z(0.0)` cannot justify the goal `z(-0.0)`.
1369
+ A checker establishes whether the proof's claimed answers follow from the
1370
+ source program, with any assumptions reported as obligations. Its inputs
1371
+ are the program, the proof document and, when the proof answers goals asked
1372
+ from outside the program, those original goals. The source program is the
1373
+ authority for clauses and questions; the proof supplies evidence to check.
1374
+
1375
+ There are three parts to that evidence:
1376
+
1377
+ | Evidence in the proof | What the checker establishes |
1378
+ | --- | --- |
1379
+ | `step(Goal, By, Bindings, Uses)` | Each recorded inference follows from its cited source clause, primitive or control, with justified premises and correct witnesses. |
1380
+ | `searched(Call, Answers)` and `derived(Pattern, Facts)` | A negation's search has no solution, or a collection contains all its search results (C9). |
1381
+ | `called(Call, Answers)`, sharing applicable `derived/2` listings | A claimed answer can result from the original question with its actual call-time bindings and control choices (C10). |
1382
+
1383
+ The tables and listings are statements **inside the proof document**, after
1384
+ its steps ([Section 10.1](#101-structure)). They are checked claims about
1385
+ search, not authority to invent answers. The `called/2` table used by C10
1386
+ is distinct from the `called(Called)` justification of a state-test step
1387
+ ([Section 10.3](#103-steps)).
1388
+
1389
+ The checker MUST NOT call a reasoner to supply missing evidence. It MAY
1390
+ recompute primitives and expand a call one level against the source
1391
+ program, answering inner relation calls from the certificate. Each
1392
+ consulted table is itself checked by this expansion; tables cannot justify
1393
+ themselves through a cycle. Sections [11.12](#1112-c9-search-closure) and
1394
+ [11.13](#1113-c10-call-fidelity) specify these checks.
1395
+
1396
+ The ten conditions answer different questions:
1397
+
1398
+ | Condition | Question |
1399
+ | --- | --- |
1400
+ | [C1 Resolution](#114-c1-resolution) | Is this step an instance of the source clause it cites? |
1401
+ | [C2 Well-foundedness](#115-c2-well-foundedness) | Are the steps free of circular justification through their uses? |
1402
+ | [C3 Justification](#116-c3-justification) | Is each statement and justification well formed? |
1403
+ | [C4 Coverage](#117-c4-coverage) | Does every claim and premise have evidence? |
1404
+ | [C5 Re-decision](#118-c5-re-decision) | Do primitives hold, and do control steps compose from their uses? |
1405
+ | [C6 Boundary consistency](#119-c6-boundary-consistency) | Does available evidence contradict an unsettled negation or collection? |
1406
+ | [C7 Relevance](#1110-c7-relevance) | Does the evidence serve the claimed answers to the program's questions? |
1407
+ | [C8 Witness integrity](#1111-c8-witness-integrity) | Does each existential witness identify the correct rule firing? |
1408
+ | [C9 Search closure](#1112-c9-search-closure) | Does the certificate establish the recorded negation or collection? |
1409
+ | [C10 Call fidelity](#1113-c10-call-fidelity) | Can the original question return this answer? |
1410
+
1411
+ C9 checks the search behind a recorded step; C10 checks the original call
1412
+ before the proof's final bindings. This distinction matters for negation,
1413
+ collection, `once` and tests of variable state. A specialized goal can
1414
+ succeed even when the original open question would not return it
1415
+ ([Section 11.2](#112-operational-query-fidelity)). Every proof check
1416
+ includes C10.
1417
+
1418
+ The checker records each failure with its condition, a detail and, where
1419
+ there is one, the term concerned. Missing or unsupported search evidence
1420
+ can instead leave an obligation. The verdict distinguishes these outcomes:
1421
+
1422
+ | Verdict | Meaning |
1423
+ | --- | --- |
1424
+ | `checked` | No condition failed and no obligation remains. |
1425
+ | `checked_with_obligations` | No condition failed, but the claims depend on the reported obligations. |
1426
+ | `failed(N)` | The checker recorded `N` failures. |
1427
+
1428
+ Strict checking forbids unresolved obligations. Even `checked` establishes
1429
+ only the claimed answers, not that the proof contains every answer or that
1430
+ the whole program terminates ([Section 11.1](#111-scope-of-a-valid-proof)).
1431
+
1432
+ ### 11.1 Scope of a valid proof
1433
+
1434
+ A valid proof establishes that each claim follows from the source program
1435
+ by the recorded steps, conditional on any reported obligations. A settled
1436
+ boundary is established by its search certificate. An unconditional
1437
+ `checked` verdict also establishes operational query fidelity
1438
+ ([Section 11.2](#112-operational-query-fidelity)).
1439
+
1440
+ It does not establish:
1441
+
1442
+ - that the proof contains all conclusions of the program;
1443
+ - that the program derives no `'false'`;
1444
+ - that execution of the whole program terminates or reaches every question;
1445
+ - that the supplied program expresses the author's intended model.
1446
+
1447
+ A proof MAY omit conclusions. A run's own proof contains exactly that
1448
+ run's conclusions. An empty proof establishes no answers, including no
1449
+ claim that a question has no answers.
1450
+
1451
+ ### 11.2 Operational query fidelity
1452
+
1453
+ **Operational query fidelity** means that the original question can return
1454
+ the claimed answer under [Section 8](#8-evaluation-and-conclusions), with
1455
+ the bindings, control choices and forward state applicable at its calls.
1456
+ C10 checks this property. It concerns each claimed answer's reachability
1457
+ in that question's ordered search, not whether the proof includes every
1458
+ answer or whether execution reaches the question at all.
1459
+
1460
+ Proof steps show goals after the whole solution's bindings have been
1461
+ applied ([Section 10.3](#103-steps)). Those final instances can hide a
1462
+ different result at the original call. For example:
1463
+
1464
+ ```js
1465
+ fact(value('a'), value('b'))
1466
+ implied_by(p(X), value(X))
1467
+ implied_by(q(X), once(p(X)))
1468
+ ```
1469
+
1470
+ For the external question `q(X)`, `once(p(X))` selects `'a'`, so the only
1471
+ answer is `q('a')`. But if the checker starts from the final instance
1472
+ `q('b')`, the specialized call `once(p('b'))` succeeds. A derivation of
1473
+ that specialized call can pass C1–C9 without showing that the original
1474
+ question could return it.
1475
+
1476
+ Negation has the same problem with call-time bindings. Consider a separate
1477
+ program:
1478
+
1479
+ ```js
1480
+ fact(p('a'))
1481
+ implied_by(q(X), [not(p(X)), unify(X, 'b')])
1482
+ ```
1483
+
1484
+ The external question `q(X)` raises an error: `X` is still a named unbound
1485
+ variable when `not(p(X))` runs. The specialized call `q('b')` succeeds,
1486
+ but the later `unify` cannot retroactively bind the original negation.
1487
+ Tests of variable state and collection likewise depend on their actual
1488
+ calls ([Section 7.5](#75-sets-and-operational-behavior)).
1489
+
1490
+ A checker MUST NOT treat C7's instance test or C5's composition of a
1491
+ `once` step as establishing the original call's result. To establish
1492
+ operational query fidelity, it MUST validate the original call state,
1493
+ propagation of bindings between ordered premises, freshening and scope,
1494
+ and any first-solution choice or required search closure. These must follow
1495
+ from the original question, source clauses and checked evidence. Generator
1496
+ captures MUST remain independent of later caller bindings. The checker
1497
+ MUST NOT invoke the reasoner to fill gaps.
1498
+
1499
+ C10 supplies this certificate check in [Section 11.13](#1113-c10-call-fidelity).
1500
+ A C1–C9 verdict alone MUST NOT be presented as establishing operational
1501
+ query fidelity. Fidelity does not establish completeness, avoidance of an
1502
+ earlier contradiction, or termination of preceding questions.
1503
+
1504
+ ### 11.3 Reading the document
1505
+
1506
+ The document MUST be read as data using [Section 9.1](#91-accepted-document-syntax),
1507
+ without executing it. If it cannot be read, C3 fails and the document has no
1508
+ claims and no steps. The reader classifies its statements as follows:
1509
+
1510
+ | Statement | Requirement | Failure |
1511
+ | --- | --- | --- |
1512
+ | `clause(N, Display)` | `N` names a source clause whose display is identical to `Display`, including variable names ([Section 10.2](#102-clause-displays)). | C1 |
1513
+ | `step(Goal, By, Bindings, Uses)` | Bindings read as a list of `'='/2` pairs, as an object literal does; uses form a list; no other step has an identical goal. | C3; set the step aside |
1514
+ | `searched(Call, Answers)` | `Call` is callable and `Answers` is an array; no other search table has the same call up to variable renaming. | C3; set the statement aside |
1515
+ | `derived(Pattern, Facts)` | `Pattern` is callable and `Facts` is an array; no other listing names the same relation. | C3; set the statement aside |
1516
+ | `called(Call, Answers)` | The call-table requirements of [Section 10.5](#105-call-fidelity-certificates) hold, including preservation of anonymous-variable status when detecting duplicates. | C3; set the statement aside |
1517
+
1518
+ Every other statement is a claim, wherever it occurs in the document
1519
+ ([Section 10.1](#101-structure)). Renaming variables in a clause display
1520
+ does not make it identical to the source display.
1521
+
1522
+ ### 11.4 C1 Resolution
1523
+
1524
+ C1 checks that the displayed inference is an instance of the source
1525
+ clause. For a `clause(N)` step:
1526
+
1527
+ 1. `N` MUST identify a clause of the program. A value such as `'x'` or
1528
+ `1.0` that is not a clause number fails C1.
1529
+ 2. Rename the source clause apart. Each binding MUST name a distinct
1530
+ variable of that clause and unify it with its displayed value.
1531
+ 3. One head of the clause MUST unify with `Goal`. For a forward rule,
1532
+ consider each conjunct of its head separately. The body MUST have the
1533
+ same length as `Uses` and unify with it pairwise, in order.
1534
+ 4. After these unifications, the head MUST be identical to `Goal`, and
1535
+ each body goal to its corresponding use. The step's own terms MUST NOT
1536
+ require further instantiation.
1537
+
1538
+ For example, a source clause `same(X, X)` cannot justify `same('a', 'b')`.
1539
+ Identity also keeps the sign of zero: a fact `z(0.0)` cannot justify
1540
+ `z(-0.0)`.
1404
1541
 
1405
1542
  For a derived clause step, each enclosing generator MUST belong to the
1406
1543
  program. Its bindings may name variables of those generators' scope
@@ -1415,45 +1552,69 @@ sharing as well as the rule's direction and structure. The source rule is
1415
1552
  read as data; its body is not derived by the checker. These steps count as
1416
1553
  verified C1 steps and cite the usual source clause display.
1417
1554
 
1418
- ### 11.3 C2 Well-foundedness
1419
-
1420
- No step MAY depend on itself through the uses of steps. A checker finds
1421
- the dependencies by a depth-first search that starts from each step not yet
1422
- visited, in document order, and follows each step's uses in order, each
1423
- conjunct of a conjunctive use separately, to the steps whose goals they are.
1424
- Each use that leads back to a step on the current search path is one C2
1425
- failure, whose conclusion is the goal of that step.
1426
-
1427
- ### 11.4 C3 Justification
1428
-
1429
- `By` MUST be one of the forms of [Section 10.3](#103-steps). A `'builtin'` step MUST have
1430
- no bindings and no uses and a goal that is a primitive; a `called` step MUST
1431
- have no bindings and no uses and a goal that is a state test; an `'absent'` or
1432
- `'collected'` step MUST have no bindings and no uses and a goal that is a
1433
- negation or a `findall`, respectively. A step that fails C3 is not a trusted
1434
- boundary: it counts in neither `trusted`, C6 nor C9.
1435
-
1436
- ### 11.5 C4 Coverage
1437
-
1438
- Each conjunct of each claim MUST have a step. Each use, and each conjunct of
1439
- a use, MUST have a step or be identical to an instance of a fact of the
1440
- program. The conclusion of a failure for a use without a step is the goal of
1441
- the step that uses it. A document without claims is valid and certifies
1442
- nothing.
1443
-
1444
- ### 11.6 C5 Re-decision
1445
-
1446
- A `'builtin'` step's goal, solved as a primitive with no prior bindings, MUST
1447
- succeed without binding anything. For a `called(Called)` step, `Called`
1448
- MUST have the goal's name and arity; `Called`, renamed apart and solved as a
1449
- primitive with no prior bindings, MUST succeed without binding anything; and
1450
- the goal MUST be an instance of `Called`, so only the variables `Called`
1451
- leaves unbound may differ. C5 does not establish that the test ran in that
1452
- state: like the choice of a `once` step, the call state is operational
1453
- ([Section 11.13](#1113-operational-query-fidelity)), and C10 checks the original questions. A `'control'` step MUST have no bindings,
1454
- and its uses MUST be identical, in order, to the conjuncts of the argument of
1455
- `call` or `once`, or of one side of a disjunction. When trusted boundaries are
1456
- forbidden ("strict"), each `'absent'` or `'collected'` step fails C5.
1555
+ ### 11.5 C2 Well-foundedness
1556
+
1557
+ No step MAY depend on itself through the uses of steps. Even individually
1558
+ valid clause instances cannot justify each other in a circle.
1559
+
1560
+ To find these dependencies, perform a depth-first walk starting from each
1561
+ step not yet visited, in document order. Follow its uses in order to the
1562
+ steps with those goals, following each conjunct of a conjunctive use
1563
+ separately. Each use that leads back to a step on the current path is one
1564
+ C2 failure, whose conclusion is the goal of that step. Circular search
1565
+ tables are checked separately by C9 and C10.
1566
+
1567
+ ### 11.6 C3 Justification
1568
+
1569
+ `By` MUST be one of the forms of [Section 10.3](#103-steps). The following
1570
+ forms MUST have no bindings and no uses:
1571
+
1572
+ | `By` | Required goal |
1573
+ | --- | --- |
1574
+ | `'builtin'` | A primitive |
1575
+ | `called(Called)` | A state test |
1576
+ | `'absent'` | A negation `not(G)` |
1577
+ | `'collected'` | A collection `findall(T, G, L)` |
1578
+
1579
+ A well-formed negation or collection step is called a **boundary**. A step
1580
+ that fails C3 is not a trusted boundary: it counts in neither `trusted`, C6
1581
+ nor C9. The checks for clause and source justifications are in C1; control
1582
+ composition is checked by C5.
1583
+
1584
+ ### 11.7 C4 Coverage
1585
+
1586
+ C4 checks that the proof has no missing premises:
1587
+
1588
+ - Each conjunct of each claim MUST have a step.
1589
+ - Each use, and each conjunct of a use, MUST have a step or be identical to
1590
+ an instance of a source fact. Source facts can therefore serve directly
1591
+ as premises, but claims still require steps.
1592
+
1593
+ For a missing use, the failure's conclusion is the goal of the step that
1594
+ uses it. A document without claims certifies nothing; it is valid if no
1595
+ condition fails.
1596
+
1597
+ ### 11.8 C5 Re-decision
1598
+
1599
+ C5 recomputes primitives and checks how control steps use their premises:
1600
+
1601
+ - **Primitive.** A `'builtin'` step's goal, solved as a primitive with no
1602
+ prior bindings, MUST succeed without binding anything.
1603
+ - **State test.** For `called(Called)`, `Called` MUST have the goal's name
1604
+ and arity. Rename `Called` apart and solve it as a primitive with no
1605
+ prior bindings; it MUST succeed without binding anything. The displayed
1606
+ goal MUST be an instance of `Called`, so only variables the test leaves
1607
+ unbound may differ.
1608
+ - **Control.** A `'control'` step MUST have no bindings. Its uses MUST be
1609
+ identical, in order, to the conjuncts of the argument of `call` or
1610
+ `once`, or of one side of a disjunction.
1611
+ - **Strict checking.** When trusted boundaries are forbidden, each
1612
+ `'absent'` or `'collected'` step that C9 did not settle fails C5.
1613
+
1614
+ C5 checks the displayed primitive or chosen control branch. Whether a
1615
+ state test actually ran with the claimed bindings, or `once` selected that
1616
+ answer from the original open call, is checked by C10
1617
+ ([Section 11.13](#1113-c10-call-fidelity)).
1457
1618
 
1458
1619
  Host math is the one exception to identical re-decision. A `'builtin'` step
1459
1620
  `is(V, E)`, where `V` is a float and `E` applies `exp`, `log`, `log2`,
@@ -1467,20 +1628,20 @@ implementation even when its primitive steps pass C5. Every other recomputed res
1467
1628
  that grows beyond this bound, for example through cancellation, MAY make a
1468
1629
  proof fail on an implementation other than the one that made it.
1469
1630
 
1470
- ### 11.7 C6 Boundary consistency
1631
+ ### 11.9 C6 Boundary consistency
1471
1632
 
1472
- A negation or collection is a **boundary**. A boundary that its search
1473
- certificate settles or refutes is checked by C9 ([Section 11.10](#1110-c9-search-closure)); C6
1474
- confronts every other well-formed boundary step with the evidence at hand.
1633
+ C6 can refute an unsettled boundary using evidence already at hand. It
1634
+ cannot establish that a search is complete. C9 checks boundaries whose
1635
+ certificates settle or refute them; C6 checks the other well-formed
1636
+ boundary steps ([Section 11.12](#1112-c9-search-closure)).
1475
1637
 
1476
- A boundary that is not settled cannot be proved, but the evidence at
1477
- hand can refute it. The evidence for a goal is: when the goal is a ground
1478
- primitive, the goal itself if it holds, and otherwise the recomputed fact
1479
- that it fails; when it is a control, none, and the boundary is left
1480
- undecided; otherwise the program's facts and the goals of the document's
1481
- steps with the same name and arity. A goal of the last kind **has evidence**
1482
- only when there is at least one such fact or step goal; with none, nothing
1483
- could refute the boundary, and it is left undecided.
1638
+ For a ground primitive, recompute whether it holds: the evidence is the
1639
+ goal itself when it holds, and otherwise the fact that it fails. Controls
1640
+ provide no evidence for this check and leave the boundary undecided. For
1641
+ other goals, use the source facts and the document's step goals with the
1642
+ same name and arity. Such a goal **has evidence** only if at least one
1643
+ such fact or step exists. No evidence leaves the boundary undecided;
1644
+ it does not establish absence.
1484
1645
 
1485
1646
  - An absence `not(G)` is decided when `G` is a single goal, or a ground
1486
1647
  conjunction, whose every goal has evidence. It fails C6 when every goal of
@@ -1490,27 +1651,46 @@ could refute the boundary, and it is left undecided.
1490
1651
  decided when `G` is a single goal with evidence. It fails C6 when an
1491
1652
  instance of `T` for some evidence of `G` unifies with no element of `L`.
1492
1653
 
1493
- A trusted boundary that is not refuted remains an obligation ([Section 12](#12-check-reports)).
1654
+ For example, evidence of `p('a')` refutes `not(p('a'))` and refutes
1655
+ `findall(X, p(X), [])`. Merely failing to find evidence of `p('b')` does
1656
+ not prove `not(p('b'))` by C6.
1657
+
1658
+ A trusted boundary that is not refuted remains an obligation. Even a
1659
+ boundary that C6 has decided without finding a contradiction remains
1660
+ conditional until C9 settles it ([Section 12](#12-check-reports)).
1494
1661
 
1495
- ### 11.8 C7 Relevance
1662
+ ### 11.10 C7 Relevance
1496
1663
 
1497
- When goals were given and no claim is `'false'`, the questions are the goals.
1498
- Otherwise the questions are, for each forward rule, each ordinary head other
1499
- than `'true'`, and the rule's body as a conjunction when one of its heads is
1500
- `'true'` and no claim is `'false'`. Each claim MUST be an instance of a
1501
- question. Each step MUST be reachable from a conjunct of a claim through the
1502
- conjuncts of uses and, from a settled boundary, through the facts of the
1503
- listings it rests on. Each table and listing MUST be consulted by the search
1504
- or closure check of some boundary.
1664
+ C7 checks that claims answer relevant questions and that evidence serves
1665
+ those claims. When external goals were given and no claim is `'false'`,
1666
+ the questions are those goals. Otherwise take, for each forward rule:
1505
1667
 
1506
- ### 11.9 C8 Witness integrity
1668
+ - each ordinary head other than `'true'`;
1669
+ - its body as a conjunction when one head is `'true'` and no claim is
1670
+ `'false'`.
1507
1671
 
1508
- A forward rule's head MAY contain variables its body does not contain; each
1509
- says that something exists, and a reasoner concludes it with a Skolem term
1510
- ([Section 8.2](#82-forward-evaluation-and-witnesses)). C1 alone would accept any value for such a variable, since any
1511
- value gives an instance of the rule, so for a `clause(N)` step citing a
1512
- forward rule, under the substitution of C1, each such variable `V` MUST be
1513
- bound to `skolem(N, Name, Args)`, where:
1672
+ Each claim MUST be an instance of a question. This instance test alone
1673
+ does not establish that an original question returns the claim; C10 checks
1674
+ that separately.
1675
+
1676
+ Each step MUST be reachable from a conjunct of a claim through the
1677
+ conjuncts of uses or, from a settled boundary, through facts in the listings
1678
+ it rests on. Each table and listing MUST be consulted by a boundary's
1679
+ search or closure check, or by the C10 check of a claim. Facts in listings
1680
+ consulted by C10 are reachable through that evidence
1681
+ ([Section 11.13](#1113-c10-call-fidelity)).
1682
+
1683
+ ### 11.11 C8 Witness integrity
1684
+
1685
+ A forward rule's head MAY contain variables its body does not contain.
1686
+ Each such variable asserts existence and receives a Skolem term identifying
1687
+ the firing ([Section 8.2](#82-forward-evaluation-and-witnesses)). C1 alone
1688
+ would accept an arbitrary value for it. C8 checks that the value is the
1689
+ specified witness and that its arguments come from the firing's evidence.
1690
+
1691
+ **Witness shape.** For a `clause(N)` step citing a forward rule, under the
1692
+ substitution of C1, each head-only variable `V` MUST be bound to
1693
+ `skolem(N, Name, Args)`, where:
1514
1694
 
1515
1695
  - `Name` is the name of `V` as the program writes it ([Section 8.2](#82-forward-evaluation-and-witnesses));
1516
1696
  - `Args` is the same for every such variable of the step, and is the list of
@@ -1519,7 +1699,8 @@ bound to `skolem(N, Name, Args)`, where:
1519
1699
  firing, as established below. The spelling of a Skolem term alone MUST
1520
1700
  NOT establish that it is fresh.
1521
1701
 
1522
- A value containing `skolem(N, _, Args)` is a **candidate** for omission.
1702
+ **Which values belong in `Args`.** A value containing
1703
+ `skolem(N, _, Args)` is a **candidate** for omission.
1523
1704
  Values of variables occurring only in the head hold the witnesses checked
1524
1705
  above. If any other head variable's value is omitted, the checker MUST
1525
1706
  establish its **parametric provenance**:
@@ -1547,7 +1728,7 @@ establish its **parametric provenance**:
1547
1728
  change. A backward caller cannot make an earlier firing's data fresh.
1548
1729
  4. An unchanged boundary may use its original evidence or obligation. A
1549
1730
  changed boundary MUST already be settled in its original form, and its
1550
- abstracted form MUST also be settled by [Section 11.10](#1110-c9-search-closure), consulting only
1731
+ abstracted form MUST also be settled by [Section 11.12](#1112-c9-search-closure), consulting only
1551
1732
  tables and listings the original boundary rests on. A missing or
1552
1733
  incomplete certificate fails provenance; an obligation for a specific
1553
1734
  boundary MUST NOT silently become an obligation for a stronger one.
@@ -1556,14 +1737,16 @@ Failure of this provenance check is C8, not C1: the original step may be a
1556
1737
  valid clause instance while proposing the wrong witness context. Provenance
1557
1738
  rechecks do not add steps or change the C1, C5 or C9 counts. They establish
1558
1739
  that the displayed firing's evidence permits fresh parameters, not that the
1559
- firing is the one an original open call would select ([Section 11.13](#1113-operational-query-fidelity)).
1740
+ firing is the one an original open call would select ([Section 11.2](#112-operational-query-fidelity)).
1560
1741
 
1561
- When a forward clause has any such variables, its full head under the step's
1562
- substitution MUST be ground; a step that leaves such a variable unbound, or
1563
- bound to anything but its Skolem term, fails C8 rather than C1. A generic inspection pattern cannot share one
1564
- existential witness across all its instances ([Section 6.3](#63-source-rule-inspection)).
1742
+ **Groundness.** When a forward clause has head-only variables, its full
1743
+ head under the step's substitution MUST be ground. A step that leaves such
1744
+ a variable unbound, or bound to anything but its Skolem term, fails C8
1745
+ rather than C1. A generic inspection pattern cannot share one existential
1746
+ witness across all its instances ([Section 6.3](#63-source-rule-inspection)).
1565
1747
 
1566
- For a generator, use its scope projection ([Section 6.2](#62-inline-rule-templates)) as the head for this
1748
+ **Generators and captures.** For a generator, use its scope projection
1749
+ ([Section 6.2](#62-inline-rule-templates)) as the head for this
1567
1750
  check. For every derived clause step, including a backward clause step, the
1568
1751
  checker MUST also perform C8 for each enclosing generator under the same
1569
1752
  substitution. A forged outer witness cannot be authorized by using it in a
@@ -1575,165 +1758,162 @@ instantiated under the step's substitution, as one element of `Args`, as
1575
1758
  required by [Section 8.2](#82-forward-evaluation-and-witnesses). The checker MUST compute this from the source
1576
1759
  template's capture list and the substitution, not from the witness term.
1577
1760
 
1578
- A variable of the head that also occurs in the body is not checked by C8,
1579
- even when the body leaves it unbound; its value comes from the uses, which
1580
- other conditions check. Its effect on a head-only variable's witness context
1581
- is nevertheless subject to the provenance check above. A step with no
1582
- witnesses in its own forward head or enclosing generators is not covered
1583
- by C8.
1584
-
1585
- ### 11.10 C9 Search closure
1586
-
1587
- A checker tries to **settle** each well-formed boundary step (Sections [11.4](#114-c3-justification)
1588
- and [11.7](#117-c6-boundary-consistency)) with the search certificate, by searching its goal `G` as [Section
1589
- 8.1](#81-goal-search) does, except that:
1590
-
1591
- - a call to a relation that a backward rule defines or forward rules
1592
- conclude is answered by the table whose call is identical to it up to
1593
- renaming, each answer renamed apart in turn, and a call to a relation
1594
- defined by facts alone by those facts, in clause order;
1595
- - a negation inside the search treats its unbound variables as anonymous.
1596
-
1597
- The **expansion** of a call is the search of [Section 8.1](#81-goal-search) taken one level:
1598
- the facts in the listing of its relation, in order, then the program's facts
1599
- and backward rules of that name and arity, in clause order, each rule's body
1600
- searched in its place, inner calls answered as above. The boundary's search
1601
- **rests on** each table and listing it consults, and on those its tables and
1602
- the closure checks of its listings consult, transitively. The boundary is
1603
- settled when:
1604
-
1605
- 1. each table it rests on equals its expansion: the same number of answers,
1606
- each identical up to renaming of variables to the answer in the same
1607
- position;
1608
- 2. each listing it rests on has a step for each fact, every fact of the
1609
- listed name and arity and ground, and is **closed**: for each forward
1610
- rule with a head of that relation, each solution of the rule's body under
1611
- the certificate, with the rule's witnesses bound to their Skolem terms
1612
- ([Section 8.2](#82-forward-evaluation-and-witnesses)), gives head instances of that relation that are listed or
1613
- are ground facts of the program;
1614
- 3. no table it rests on depends on itself through the tables its expansion
1615
- consults;
1616
- 4. its outcome agrees: for a negation, `G` has no solution; for a collection
1617
- `findall(T, G, L)`, `L` is an instance of the list of the instances of
1618
- `T`, one per solution of `G`, in order, each renamed apart;
1619
- 5. no collection or `once` within its search, a table it rests on or a
1620
- closure check uses a table whose answers rest on a listing, since the
1621
- order of derived facts cannot be checked this way; and its search reaches
1622
- no source inspection and no clause appended by a template, and it
1623
- consults no listing whose relation a forward rule with a template head
1624
- or captures concludes ([Section 6.2](#62-inline-rule-templates)).
1625
-
1626
- For example, the absence `not(nonpacifist('ada'))` rests on the table
1627
- `searched(nonpacifist('ada'), [])` and the listing `derived(nonpacifist(A),
1628
- [nonpacifist('nixon')])`. The table equals its expansion: the listed fact
1629
- does not match the call, and no backward rule defines `nonpacifist/1`. The
1630
- listing is closed: the only rule concluding `nonpacifist/1` derives
1631
- `nonpacifist('nixon')`, which is listed, and that fact has its own step.
1632
-
1633
- A boundary fails C9 when its certificate is wrong: a table differs from its
1634
- expansion, a listed fact has no step or another name or arity, a listing is
1635
- not closed, tables depend on themselves, a search leads to an error, or a
1636
- negation's goal has a solution. Each wrong table or listing is reported once,
1637
- for the first boundary resting on it. A boundary whose certificate is
1638
- missing, incomplete or not applicable under item 5, or a collection whose
1639
- list does not agree, is not settled. A listing's facts are examined in
1640
- order, and the first that is not ground, such as a pattern a source
1641
- inspection derived, leaves the boundary not settled rather than failing it. A boundary that is not settled is
1642
- trusted, including one that fails C9; C6 confronts each boundary C9 neither
1643
- settled nor refuted with the evidence ([Section 11.7](#117-c6-boundary-consistency)).
1644
-
1645
- ### 11.11 Counts and validity
1761
+ **Coverage.** A variable of the head that also occurs in the body is not
1762
+ checked by C8, even when the body leaves it unbound; its value comes from
1763
+ the uses, which other conditions check. Its effect on a head-only
1764
+ variable's witness context is nevertheless subject to the provenance check
1765
+ above. A step with no witnesses in its own forward head or enclosing
1766
+ generators is not covered by C8.
1646
1767
 
1647
- | Condition | Covered |
1768
+ ### 11.12 C9 Search closure
1769
+
1770
+ C9 establishes that a recorded negation or collection has the stated search
1771
+ result. A step's uses alone cannot show that nothing matches, or that no
1772
+ result was omitted. The **search certificate** supplies complete answer
1773
+ tables and forward-fact listings for the checker to validate
1774
+ ([Section 10.4](#104-search-certificates)):
1775
+
1776
+ | Statement in the proof | Claim to check |
1648
1777
  | --- | --- |
1649
- | C1 resolution | `clause` and `source` steps that passed C1 |
1650
- | C2 well_founded | steps |
1651
- | C3 justification | steps |
1652
- | C4 coverage | claims plus uses |
1653
- | C5 re_decision | `'builtin'` and `'control'` steps that passed C5 |
1654
- | C6 boundary_consistency | boundaries not settled that the evidence decided |
1655
- | C7 relevance | claims plus steps |
1656
- | C8 witness_integrity | `clause` steps with witnesses in their forward head or enclosing generators that passed C8 |
1657
- | C9 search_closure | boundaries their search certificate settled or refuted |
1658
- | C10 call_fidelity | claims whose call fidelity is established or refuted |
1778
+ | `searched(Call, Answers)` | These are all answers to this call, in search order, repetitions included. |
1779
+ | `derived(Pattern, Facts)` | These are the forward-derived facts for this relation; each has evidence, and none required by closure is omitted. |
1780
+
1781
+ A boundary is **settled** only when the certificate is supported, complete
1782
+ for its search, applicable under the restrictions below, and agrees with
1783
+ the boundary's result. C9 checks the goal as displayed in the step. C10
1784
+ separately checks the bindings with which the original question called it.
1785
+
1786
+ **Answering calls from the certificate.** Search the boundary's inner goal
1787
+ `G` according to [Section 8.1](#81-goal-search), with these changes:
1788
+
1789
+ - Answer a relation defined by backward rules or concluded by forward
1790
+ rules from the `searched/2` table whose call is identical up to variable
1791
+ renaming. Rename each answer apart before using it.
1792
+ - Answer a relation defined by source facts alone from those facts, in
1793
+ clause order; it needs no table.
1794
+ - Inside this search, negation treats unbound variables as anonymous.
1795
+ This does not establish that a named variable was bound at the original
1796
+ call; that is a C10 requirement.
1797
+
1798
+ **Expanding and checking tables.** The **expansion** of a call is one level
1799
+ of the search of [Section 8.1](#81-goal-search): try its relation's listed
1800
+ forward facts in listing order, then source facts and backward rules in
1801
+ clause order. Search each rule's body in its place, answering inner calls
1802
+ as above. Each table MUST equal its expansion: the same number of answers,
1803
+ each identical up to variable renaming to the answer in the same position.
1804
+
1805
+ The boundary **rests on** every table and listing its search consults,
1806
+ including those consulted transitively by table expansions and listing
1807
+ closure checks. No table it rests on may depend on itself through the
1808
+ tables consulted by its expansion.
1809
+
1810
+ **Supporting and closing listings.** Every listed fact MUST have a step,
1811
+ have the listing's name and arity, and be ground. Its step is subject to the
1812
+ other proof conditions. A listing is **closed** when, for every forward
1813
+ rule with a head of its relation, each solution of the body under the
1814
+ certificate gives head instances that are listed or are ground source
1815
+ facts. Bind the rule's witnesses to their specified Skolem terms when
1816
+ checking this closure ([Section 8.2](#82-forward-evaluation-and-witnesses)).
1817
+
1818
+ Support rules out invented facts; closure rules out omitted facts. For
1819
+ example, an empty answer table is insufficient if a forward rule could
1820
+ derive a matching fact left out of the listing.
1821
+
1822
+ **Comparing the result.** With all relied-on evidence checked, settlement
1823
+ requires:
1824
+
1825
+ - For `not(G)`, `G` has no solution.
1826
+ - For `findall(T, G, L)`, `L` is an instance of the list of instances of
1827
+ `T`, one per solution of `G`, in order, each renamed apart. Repeated
1828
+ solutions remain repeated list elements. The instance test allows later
1829
+ goals to have bound variables in the copied results.
1830
+
1831
+ **Certificate limits.** Settlement also requires all of the following:
1832
+
1833
+ - No collection or `once` in the boundary's search, a relied-on table or a
1834
+ closure check uses a table whose answers rest on a forward listing.
1835
+ This format checks support and closure of derived facts, but cannot
1836
+ establish their publication order for order-sensitive operations.
1837
+ - The search reaches neither source inspection nor a clause appended by
1838
+ a template.
1839
+ - No consulted listing's relation is concluded by a forward rule with a
1840
+ template head or captures ([Section 6.2](#62-inline-rule-templates)).
1841
+
1842
+ For example, the saved
1843
+ [Nixon diamond proof](https://eyereasoner.github.io/eyemind/examples/proof/nixon-diamond.js)
1844
+ contains this step and certificate:
1659
1845
 
1660
- A check also counts the **steps** it read, the **claims**, the `clause` steps
1661
- **verified** by C1, the `source` inspection steps also **verified** by C1,
1662
- the `'builtin'` and `called` steps **recomputed** by C5, the
1663
- `'control'` steps **composed** by C5, and the `'absent'` and `'collected'`
1664
- steps **trusted**, those C9 did not settle, plus each claim whose call
1665
- fidelity remains unproved by C10.
1666
-
1667
- A proof is **valid** when no condition failed. A valid proof with obligations is valid *conditional on* them.
1668
-
1669
- ### 11.12 Scope of a valid proof
1670
-
1671
- A valid proof establishes that each of its claims follows from the program
1672
- by the recorded steps, given its obligations; a settled boundary is
1673
- established by its search certificate, and an unconditional verdict also
1674
- establishes operational query fidelity ([Section 11.13](#1113-operational-query-fidelity)). It does not establish
1675
- that the claims are all the conclusions of the program, that the program
1676
- derives no `'false'`, or that the program is the one intended: a proof MAY
1677
- leave conclusions out, and a run's own proof holds exactly its conclusions.
1678
-
1679
- ### 11.13 Operational query fidelity
1680
-
1681
- **Operational query fidelity** means that a claimed answer can be reported
1682
- for an original question under [Section 8](#8-evaluation-and-conclusions), retaining its original call-time
1683
- bindings, control choices and applicable forward state. Each claimed answer
1684
- must be reachable in that question's ordered search. This is distinct from
1685
- completeness: a proof may omit other reachable answers without falsifying
1686
- the answers it does give. Fidelity concerns the question's search; it does
1687
- not certify that execution of the whole program reaches that question,
1688
- avoids a prior contradiction, or terminates preceding questions.
1689
-
1690
- C1–C9 check the recorded instances and their evidence. They do not establish
1691
- operational query fidelity for binding-sensitive or order-sensitive goals.
1692
- In particular, a checker MUST NOT treat C7's instance test, or C5's
1693
- composition of a `once` step, as proof that the original open call selected
1694
- that instance. For example:
1846
+ ```js
1847
+ step(not(nonpacifist('ada')), 'absent', {}, [])
1848
+
1849
+ derived(nonpacifist(A), [nonpacifist('nixon')])
1850
+ searched(nonpacifist('ada'), [])
1851
+ ```
1852
+
1853
+ The table expands to no answers: the listed fact does not match Ada and no
1854
+ backward rule defines `nonpacifist/1`. The only forward rule for that
1855
+ relation derives Nixon's fact, which is listed and has a step elsewhere in
1856
+ the proof. Thus the listing is supported and closed, and the negation is
1857
+ settled. Replacing the listing with `[]` would fail closure.
1858
+
1859
+ For a backward-defined relation `p/1` whose ordered answers are `p('a')`
1860
+ and `p('b')`, a collection can instead have these entries:
1695
1861
 
1696
1862
  ```js
1697
- fact(p('a'), p('b'))
1698
- implied_by(q(X), once(p(X)))
1863
+ step(findall(A, p(A), ['a', 'b']), 'collected', {}, [])
1864
+
1865
+ searched(p(B), [p('a'), p('b')])
1699
1866
  ```
1700
1867
 
1701
- The question `q(X)` answers only `q('a')`. Nevertheless, a C1–C9 proof may
1702
- justify `q('b')` with `once(p('b'))` and `p('b')`, since the specialized
1703
- call `q('b')` succeeds. A final substitution does not show that the original
1704
- call was `once(p(X))` with `X` unbound, or that its first answer was `'a'`.
1705
- Tests of current variable state have the same distinction ([Section 7.5](#75-sets-and-operational-behavior)).
1706
-
1707
- A checker claiming the additional property MUST validate evidence of the
1708
- original call state, propagation of bindings between ordered premises,
1709
- freshening and scope, and any first-solution choice or required search
1710
- closure. A claimed call state or substitution is not authority: it must
1711
- follow from the original question, source clauses and checked evidence.
1712
- It MUST preserve generator captures independently of later caller bindings
1713
- and MUST NOT invoke the reasoner to fill gaps. C10 provides the certificate
1714
- check of [Section 11.14](#1114-c10-call-fidelity). A C1–C9 verdict alone MUST NOT be presented as
1715
- establishing it.
1716
-
1717
- ### 11.14 C10 Call fidelity
1718
-
1719
- Every proof check includes C10. A false original-call certificate or an
1720
- answer excluded by a complete certificate fails C10. Missing, incomplete or
1721
- unsupported evidence leaves an explicit
1722
- `obligation('call_fidelity', 'original_call', Claim)`. Such a claim MUST NOT
1723
- receive an unconditional `checked` verdict. When trusted obligations are
1724
- forbidden, each such obligation also fails C10.
1725
-
1726
- The **original questions** are the external goals, if any. Otherwise, when
1727
- the program has a forward head `'true'`, they are those rules' bodies as
1728
- conjunctions; otherwise they are its ordinary forward heads, excluding
1729
- `'false'`. The questions are not instantiated with a proof's final bindings.
1730
- Only questions of which a claim is an instance need a certificate. Empty
1731
- proofs certify no answers and do not establish that a question has none.
1732
- When the claims contain `'false'`, C10 is inapplicable: it covers no answers
1733
- and adds no call-fidelity obligations for that halted proof.
1734
-
1735
- For each such question a checker searches its answers by [Section 11.10](#1110-c9-search-closure)'s
1736
- one-level expansion and closure checks, with the following differences:
1868
+ The checker expands `p(B)` against its source definition to validate the
1869
+ table, then copies the template once per answer and compares the resulting
1870
+ `['a', 'b']` with the step's list.
1871
+
1872
+ **Failures and obligations.** The checker distinguishes a false certificate
1873
+ from evidence that cannot settle the boundary:
1874
+
1875
+ | Finding | Result |
1876
+ | --- | --- |
1877
+ | A table differs from its expansion; a listed fact lacks a step or has the wrong name or arity; a listing is not closed; tables are circular; the certificate's search raises an error; or the checked search finds a solution to a negated goal. | C9 fails. |
1878
+ | A needed table or listing is missing, evidence is incomplete, or a certificate limit above applies. | The boundary is not settled. |
1879
+ | A collection's list disagrees with the certificate's search results. | The boundary is not settled; C6 may refute it from available evidence. |
1880
+ | A listing contains a nonground fact. | At the first such fact in listing order, leave the boundary unsettled rather than fail it. |
1881
+
1882
+ An incorrect table or listing is reported once, for the first boundary
1883
+ resting on it. Any boundary C9 did not settle counts as trusted, including
1884
+ one that failed C9; this count does not cancel the failure. C6 confronts
1885
+ boundaries C9 neither settled nor refuted. An unresolved boundary remains
1886
+ an obligation, and strict checking rejects it.
1887
+
1888
+ A collection mismatch alone is left unsettled because a step shows the
1889
+ goal after the whole solution's substitution; later bindings may have
1890
+ specialized the goal that was actually searched. C10 checks collection
1891
+ against the original call and cannot use that final substitution to
1892
+ specialize the question.
1893
+
1894
+ ### 11.13 C10 Call fidelity
1895
+
1896
+ C10 checks that the original question can return each claimed answer. It
1897
+ uses `called(Call, Answers)` tables in the proof, distinct from C9's
1898
+ `searched/2` tables. Both checks share applicable `derived/2` listings.
1899
+ Every proof check includes C10; unresolved evidence leaves a call-fidelity
1900
+ obligation rather than an unconditional `checked` verdict.
1901
+
1902
+ **Selecting the original questions.** Use the external goals, if any.
1903
+ Otherwise, if any forward rule has a head `'true'`, use those rules' bodies
1904
+ as conjunctions. Otherwise use the ordinary forward heads, excluding
1905
+ `'false'`. Do not instantiate these questions with the proof's final
1906
+ bindings. Only questions of which a claim is an instance need a
1907
+ certificate.
1908
+
1909
+ When the claims contain `'false'`, C10 is inapplicable: it covers no
1910
+ answers and adds no call-fidelity obligations for that halted proof.
1911
+ Empty proofs certify no answers and do not establish that a question has
1912
+ none.
1913
+
1914
+ **Checking calls.** For each relevant original question, use the one-level
1915
+ expansion and closure checks of [Section 11.12](#1112-c9-search-closure),
1916
+ with these differences:
1737
1917
 
1738
1918
  1. Inner relation calls use `called/2` rather than `searched/2`. Call and
1739
1919
  answer comparison preserves anonymous-variable status ([Section 10.5](#105-call-fidelity-certificates)).
@@ -1744,7 +1924,7 @@ one-level expansion and closure checks, with the following differences:
1744
1924
  call. C9's treatment of an unbound named variable as anonymous MUST NOT
1745
1925
  be used. A source search that raises an error fails its certificate.
1746
1926
  3. `once` and `findall` keep their [Section 4.2](#42-controls) meanings, so the first answer
1747
- or collected answers come from the actual inner call. [Section 11.10](#1110-c9-search-closure)'s
1927
+ or collected answers come from the actual inner call. [Section 11.12](#1112-c9-search-closure)'s
1748
1928
  restriction on order-sensitive uses of derived listings still applies.
1749
1929
  The order of unrelated answers of an ordinary question need not be
1750
1930
  established to check membership of a claim.
@@ -1755,55 +1935,120 @@ one-level expansion and closure checks, with the following differences:
1755
1935
  positive fragment described below. A final listing alone MUST NOT certify
1756
1936
  binding-sensitive or order-sensitive forward firings outside that fragment.
1757
1937
 
1758
- For this check, a forward listing's **ground positive dependency closure**
1759
- contains its relation and each ordinary body relation of every source fact,
1760
- backward rule or forward rule defining any relation in that closure. All
1761
- source facts in the closure MUST be ground. Rule bodies MUST contain only
1762
- ordinary calls, `'true'`, conjunction and disjunction; templates, captures
1763
- and source inspection are excluded. A body call to an ordinary relation
1764
- grounds its variables. Conjunction accumulates the grounded variables of its
1765
- parts; disjunction grounds only those grounded by both alternatives. Every
1766
- backward head variable MUST be grounded by its body. Every forward head
1767
- variable MUST either be grounded by its body or be a head-only witness
1768
- checked by C8. Supported facts plus a closed listing then establish the
1769
- least ground positive closure. More general forward execution requires
1770
- publication evidence not supplied by this format, and leaves call fidelity
1771
- unproved.
1772
-
1773
- Every relevant call certificate MUST be valid. Each claim MUST be identical,
1774
- up to renaming, to an answer of at least one corresponding original question;
1775
- merely being an instance of a more general answer does not suffice. For
1776
- example, `q('b')` fails C10 for the question in [Section 11.13](#1113-operational-query-fidelity) even though
1777
- its ground logical derivation passes C1–C9. A proof of `p('a')` likewise
1778
- cannot replace an original call's actual universal answer `p(A)`.
1779
-
1780
- A claim fails C10 once when a corresponding question has a false
1781
- certificate or complete certificates for every matching question exclude its
1782
- answer. An unresolved alternative question leaves an obligation unless
1783
- another question certifies the answer. With no applicable complete
1784
- certificate, its call fidelity likewise remains an obligation. C10 does not discharge earlier C6/C9 obligations.
1785
-
1786
- The current format requires complete tables, including for a relation
1787
- called under `once`. A later error or recursion may prevent that table
1788
- from closing even when `once` itself terminates. C10 then cannot be
1789
- established; a search-prefix certificate is not defined here. A reasoner
1790
- MUST attempt call-fidelity certification for every proof it generates
1791
- ([Section 8.7](#87-proof-generation)); unresolved evidence remains an obligation. A reasoner MAY bound this auxiliary production; exceeding its
1792
- bound leaves call fidelity unproved, and it MUST NOT change the run's
1793
- answers. The bounds are not part of conformance, so two conforming reasoners
1794
- may differ in which claims of a generated proof carry call-fidelity
1795
- obligations. (eyemind bounds it per question by the smaller of
1938
+ For the `once` example in [Section 11.2](#112-operational-query-fidelity),
1939
+ the call certificate contains:
1940
+
1941
+ ```js
1942
+ called(q(A), [q('a')])
1943
+ called(p(B), [p('a'), p('b')])
1944
+ ```
1945
+
1946
+ The checker validates the first table by expanding the original question
1947
+ `q(X)` using the source rule. Its inner call is `p(X)` with `X` unbound.
1948
+ The second table, checked against `p`'s source definition, supplies `'a'`
1949
+ first, and `once` selects it. Thus `q('a')` is an answer and `q('b')` is
1950
+ excluded. Substituting `called(p('b'), [p('b')])` cannot establish the
1951
+ different call `p(X)`.
1952
+
1953
+ **Supported forward listings.** A forward listing's **ground positive
1954
+ dependency closure** contains its relation and each ordinary body relation
1955
+ of every source fact, backward rule or forward rule defining any relation
1956
+ in that closure. To use a listing for C10:
1957
+
1958
+ - All source facts in the closure MUST be ground.
1959
+ - Rule bodies MUST contain only ordinary calls, `'true'`, conjunction and
1960
+ disjunction. Templates, captures and source inspection are excluded.
1961
+ - A body call to an ordinary relation grounds its variables. Conjunction
1962
+ accumulates the grounded variables of its parts; disjunction grounds only
1963
+ those grounded by both alternatives.
1964
+ - Every backward head variable MUST be grounded by its body.
1965
+ - Every forward head variable MUST either be grounded by its body or be a
1966
+ head-only witness checked by C8.
1967
+
1968
+ Supported facts and closed listings then establish the least ground
1969
+ positive closure. More general forward execution requires publication
1970
+ evidence this format does not supply, leaving call fidelity unproved.
1971
+
1972
+ **Deciding claims.** Every relevant call certificate MUST be valid. Each
1973
+ claim MUST be identical, up to variable renaming, to an answer of at least
1974
+ one corresponding original question. Being an instance of a more general
1975
+ answer is insufficient: a claim `p('a')` cannot replace an original call's
1976
+ actual universal answer `p(A)`.
1977
+
1978
+ For each claim, apply these outcomes:
1979
+
1980
+ | Evidence for matching original questions | C10 result |
1981
+ | --- | --- |
1982
+ | Any corresponding question has a false certificate. | Fail the claim once. |
1983
+ | No corresponding certificate is false, and at least one complete certificate returns the claim up to renaming. | Establish call fidelity for the claim. |
1984
+ | Every matching question has a complete certificate, and all exclude the claim. | Fail the claim once. |
1985
+ | No certificate establishes the claim, and an applicable certificate is missing, incomplete or unsupported. | Leave `obligation('call_fidelity', 'original_call', Claim)`. |
1986
+
1987
+ An unresolved alternative question leaves an obligation unless another
1988
+ question certifies the answer. With no applicable complete certificate,
1989
+ call fidelity also remains an obligation. When trusted obligations are
1990
+ forbidden, each such obligation fails C10. C10 does not discharge C6/C9
1991
+ obligations: both the recorded boundary and the original call need their
1992
+ respective evidence.
1993
+
1994
+ **Limits and production of certificates.** The current format requires
1995
+ complete tables, even for a relation called under `once`. Later recursion
1996
+ or an error may prevent a table from closing although `once` itself
1997
+ terminates. A certificate for just the searched prefix is not defined, so
1998
+ call fidelity then remains unproved.
1999
+
2000
+ A reasoner MUST attempt call-fidelity certification for every proof it
2001
+ generates ([Section 8.7](#87-proof-generation)). It MAY bound this auxiliary
2002
+ production. Exceeding that bound leaves an obligation and MUST NOT change
2003
+ the run's answers. The bounds are outside conformance, so conforming
2004
+ reasoners may differ in which generated claims carry call-fidelity
2005
+ obligations. eyemind bounds this work per question by the smaller of
1796
2006
  `max_inferences` and 50,000 calls plus answers, and by 8,388,608 UTF-16 code
1797
- units of answer text.)
2007
+ units of answer text.
2008
+
2009
+ **Relevance and counts.** Call tables and their supporting listings serve
2010
+ the claims for C7; their listed facts are reachable through that evidence.
2011
+ C10 does not change C1–C9 covered counts. Its own covered count includes
2012
+ claims whose call fidelity is established or refuted, excluding unresolved
2013
+ claims. Report failures in claim order, after checking boundaries and
2014
+ before C7 and C2 ([Section 12](#12-check-reports)).
1798
2015
 
1799
- Call tables and their supporting listings consulted for C10 serve the claims
1800
- for C7, and their listed facts are reachable through that evidence. C10's
1801
- auxiliary search does not change C1–C9 covered counts. Its own covered count
1802
- counts claims whose call fidelity is established or refuted, excluding
1803
- unresolved claims. Failures are reported in
1804
- claim order after checking boundaries and before C7 and C2 ([Section 12](#12-check-reports)).
1805
- The answer checks are per original question; they do not establish that all
1806
- answers were claimed or that preceding distinct questions terminated.
2016
+ These checks establish membership of claimed answers in an original
2017
+ question's results. They do not establish that all answers were claimed
2018
+ or that preceding distinct questions terminated.
2019
+
2020
+ ### 11.14 Counts and validity
2021
+
2022
+ The report distinguishes how many items a condition covered from how many
2023
+ failures it found. A zero failure count does not by itself establish a
2024
+ negation, collection or original call that remains an obligation.
2025
+
2026
+ | Condition | Covered |
2027
+ | --- | --- |
2028
+ | C1 resolution | `clause` and `source` steps that passed C1 |
2029
+ | C2 well_founded | steps |
2030
+ | C3 justification | steps |
2031
+ | C4 coverage | claims plus uses |
2032
+ | C5 re_decision | `'builtin'`, `called(Called)` and `'control'` steps that passed C5 |
2033
+ | C6 boundary_consistency | boundaries not settled that the evidence decided |
2034
+ | C7 relevance | claims plus steps |
2035
+ | C8 witness_integrity | `clause` steps with witnesses in their forward head or enclosing generators that passed C8 |
2036
+ | C9 search_closure | boundaries their search certificate settled or refuted |
2037
+ | C10 call_fidelity | claims whose call fidelity is established or refuted |
2038
+
2039
+ A check also records these totals:
2040
+
2041
+ - **steps**: the steps it read;
2042
+ - **claims**: the claims it read;
2043
+ - **verified**: the `clause` and `source` inspection steps verified by C1;
2044
+ - **recomputed**: the `'builtin'` and `called(Called)` steps that passed C5;
2045
+ - **composed**: the `'control'` steps that passed C5;
2046
+ - **trusted**: the `'absent'` and `'collected'` steps C9 did not settle,
2047
+ plus each claim whose call fidelity remains unproved by C10.
2048
+
2049
+ A proof is **valid** when no condition failed. It is valid *conditional on*
2050
+ any obligations that remain. Section [12](#12-check-reports) specifies the
2051
+ report format and verdict; strict checking forbids those obligations.
1807
2052
 
1808
2053
  ## 12. Check Reports
1809
2054
 
@@ -1820,7 +2065,7 @@ the following report facts, one per line:
1820
2065
  `obligation('call_fidelity', 'original_call', Claim)` per unresolved claim,
1821
2066
  in claim order;
1822
2067
  4. `steps(N)`, `verified(N)`, `recomputed(N)`, `composed(N)`, `trusted(N)`,
1823
- `claims(N)`, the counts of [Section 11.11](#1111-counts-and-validity);
2068
+ `claims(N)`, the counts of [Section 11.14](#1114-counts-and-validity);
1824
2069
  5. `verdict(V)`, where `V` is `failed(N)` when `N` failures were recorded,
1825
2070
  otherwise `'checked_with_obligations'` when there are obligations,
1826
2071
  otherwise `'checked'`.
@@ -1835,7 +2080,7 @@ and that the verdict does not establish completeness. Comments are informative
1835
2080
  and MAY be worded differently. They are ignored when the document is read.
1836
2081
 
1837
2082
  Failures are listed in the order they are found: those of reading the
1838
- document ([Section 11.1](#111-reading-the-document)), in document order; C4 for each claim, in claim
2083
+ document ([Section 11.3](#113-reading-the-document)), in document order; C4 for each claim, in claim
1839
2084
  order; then for each step, in document order, C4 for its uses and the C1, C3,
1840
2085
  C5 or C8 failure of its justification; for each boundary, in step order, the
1841
2086
  C9 failures of its search certificate in the order found, or else its C6
@@ -1894,6 +2139,16 @@ an invalid check returns 2, otherwise the run's halt code is retained
1894
2139
  text that has a line starting with `step(` or `called(` is a proof document; given one as
1895
2140
  a program, the command line MUST say how to check it instead.
1896
2141
 
2142
+ Files are programs ([Section 3](#3-program-syntax)) unless an
2143
+ implementation reads other formats. eyemind reads files by their extension:
2144
+ `.ttl`, `.trig`, `.nt` and `.nq` as RDF 1.2 data, joining a program as
2145
+ `rdf(S, P, O, G)` facts, `.n3` as Notation3 and `.srl` as a SPARQL 1.2 RL rule
2146
+ set, both compiled to a program, with the options `--to FORMAT` (the output
2147
+ format of the conclusions), `--all`, `--program` and `--base IRI`; its README
2148
+ describes the mappings. Such formats are outside conformance: a conforming
2149
+ implementation need not read them, and the suite does not test them. The
2150
+ proofs and checks of a compiled program are those of any program.
2151
+
1897
2152
  | Exit code | Meaning |
1898
2153
  | --- | --- |
1899
2154
  | 0 | Success, including a check that found the proof valid. |
@@ -1942,7 +2197,7 @@ are required as specified. Comment wording and failure `Detail` text are
1942
2197
  informative. Fresh variable names are unspecified where [Section 2.4](#24-standard-order) says
1943
2198
  so. Float results of `exp`, logarithms, trigonometric and hyperbolic
1944
2199
  functions, and `pow` with floats MAY differ by one unit in the last place,
1945
- and C5 accepts a result of such a function within 4 units ([Section 11.6](#116-c5-re-decision)).
2200
+ and C5 accepts a result of such a function within 4 units ([Section 11.8](#118-c5-re-decision)).
1946
2201
 
1947
2202
  The conformance cases and saved example documents exercise these
1948
2203
  requirements. They do not replace the definitions in this specification.
@@ -2016,7 +2271,7 @@ bound their size, nesting depth, processing time and memory, in addition to
2016
2271
  the reasoning bounds of [Section 8.3](#83-resource-bounds). A regular expression can take time exponential in
2017
2272
  the length of the text it searches ([Section 4.3](#43-primitives)), and no reasoning bound counts
2018
2273
  that time, so a deployment running untrusted programs SHOULD also bound it. A valid proof establishes only the
2019
- claims and assumptions described in [Section 11.12](#1112-scope-of-a-valid-proof).
2274
+ claims and assumptions described in [Section 11.1](#111-scope-of-a-valid-proof).
2020
2275
 
2021
2276
  ## Appendix A. Document Grammar
2022
2277