eyemind 0.5.32 → 0.6.1

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,12 +2,12 @@
2
2
 
3
3
  ```text
4
4
  Title: The eyemind Rule Language and Proof Format
5
- Version: eyemind 0.5.32
5
+ Version: eyemind 0.6.1
6
6
  ```
7
7
 
8
8
  This document specifies the syntax and meaning of eyemind programs and data
9
- documents, their observable evaluation, and the conditions for checking a
10
- proof.
9
+ documents, their observable evaluation, their proofs, and how a proof is
10
+ checked.
11
11
 
12
12
  ## Table of Contents
13
13
 
@@ -62,25 +62,15 @@ proof.
62
62
  - [9.4 Variable scope in output](#94-variable-scope-in-output)
63
63
  - [10. Proof Documents](#10-proof-documents)
64
64
  - [10.1 Structure](#101-structure)
65
- - [10.2 Clause displays](#102-clause-displays)
66
- - [10.3 Steps](#103-steps)
67
- - [10.4 Search certificates](#104-search-certificates)
68
- - [10.5 Call-fidelity certificates](#105-call-fidelity-certificates)
65
+ - [10.2 Steps](#102-steps)
66
+ - [10.3 Certificate](#103-certificate)
69
67
  - [11. Proof Checking](#11-proof-checking)
70
- - [11.1 Scope of a valid proof](#111-scope-of-a-valid-proof)
71
- - [11.2 Operational query fidelity](#112-operational-query-fidelity)
72
- - [11.3 Reading the document](#113-reading-the-document)
73
- - [11.4 C1 Resolution](#114-c1-resolution)
74
- - [11.5 C2 Well-foundedness](#115-c2-well-foundedness)
75
- - [11.6 C3 Justification](#116-c3-justification)
76
- - [11.7 C4 Coverage](#117-c4-coverage)
77
- - [11.8 C5 Re-decision](#118-c5-re-decision)
78
- - [11.9 C6 Boundary consistency](#119-c6-boundary-consistency)
79
- - [11.10 C7 Relevance](#1110-c7-relevance)
80
- - [11.11 C8 Witness integrity](#1111-c8-witness-integrity)
81
- - [11.12 C9 Search closure](#1112-c9-search-closure)
82
- - [11.13 C10 Call fidelity](#1113-c10-call-fidelity)
83
- - [11.14 Counts and validity](#1114-counts-and-validity)
68
+ - [11.1 What a checked proof establishes](#111-what-a-checked-proof-establishes)
69
+ - [11.2 Original questions](#112-original-questions)
70
+ - [11.3 Answering calls](#113-answering-calls)
71
+ - [11.4 Replaying derived facts](#114-replaying-derived-facts)
72
+ - [11.5 Deciding the claims](#115-deciding-the-claims)
73
+ - [11.6 Nothing unused](#116-nothing-unused)
84
74
  - [12. Check Reports](#12-check-reports)
85
75
  - [13. Conformance](#13-conformance)
86
76
  - [14. Security](#14-security)
@@ -104,7 +94,7 @@ structures or execution architecture. Observable behavior is specified
104
94
  independently of those choices.
105
95
 
106
96
  Command-line options, exit codes, library APIs, browser interfaces,
107
- additional input formats and proof encodings, installation and release
97
+ additional input formats, installation and release
108
98
  procedures are outside this specification. [Section 1.3](#13-terminology)
109
99
  defines the terms used throughout.
110
100
 
@@ -198,41 +188,25 @@ Proofs:
198
188
 
199
189
  - **Proof document**: a document recording how a run's conclusions follow
200
190
  from the program ([Section 10](#10-proof-documents)). Its **claims** are its statements other
201
- than `clause/2`, `step/4`, `searched/2`, `derived/2` and `called/2`
202
- ([Section 10.1](#101-structure)).
203
- - **Clause display**: `clause(N, Display)`, clause `N` in normalized form
204
- ([Section 10.2](#102-clause-displays)).
205
- - **Step**: `step(Goal, By, Bindings, Uses)`, the justification of one goal
206
- by a clause, a primitive, a control, an absence or a collection; its
207
- **uses** are the goals that justify it ([Section 10.3](#103-steps)).
208
- - **Boundary**: a negation or collection that a proof justifies by an
209
- `'absent'` or `'collected'` step ([Section 11.9](#119-c6-boundary-consistency)).
210
- - **Search certificate**: the tables and listings that record the searches
211
- behind a proof's boundaries ([Section 10.4](#104-search-certificates)).
212
- - **Table**: `searched(Call, Answers)`, every answer of one call, in order
213
- ([Section 10.4](#104-search-certificates)).
191
+ than `step/4`, `derived/2` and `called/2` ([Section 10.1](#101-structure)).
192
+ - **Step**: `step(Goal, By, Bindings, Uses)`, the firing of a rule, or the
193
+ solution of a control, that justifies one goal; its **uses** are the goals
194
+ that justify it ([Section 10.2](#102-steps)).
195
+ - **Call table**: `called(Call, Answers)`, every answer of one call, in order
196
+ ([Section 10.3](#103-certificate)).
214
197
  - **Listing**: `derived(Pattern, Facts)`, every fact a run derived for one
215
- relation, in order ([Section 10.4](#104-search-certificates)).
216
- - **Call table**: `called(Call, Answers)`, a table of a call made while
217
- answering an original question, kept apart from the tables of the search
218
- certificate and checked by C10 ([Section 10.5](#105-call-fidelity-certificates)).
198
+ relation, in order ([Section 10.3](#103-certificate)).
199
+ - **Certificate**: the call tables and listings of a proof ([Section 10.3](#103-certificate)).
219
200
  - **Original question**: each external goal; without external goals, the
220
- body of each query; without queries, each ordinary forward head. C10
221
- checks that the claims are exactly their answers ([Section 11.13](#1113-c10-call-fidelity)).
222
- - **Answer completeness**: of a proof, that its claims include every answer
223
- of every original question; an unconditional `checked` verdict
224
- establishes it ([Section 11.1](#111-scope-of-a-valid-proof)).
225
- - **Settled**: established by its search certificate, as a boundary is when
226
- C9 accepts that certificate ([Section 11.12](#1112-c9-search-closure)).
227
- - **Trusted boundary**: a boundary that is not settled. A valid proof
228
- assumes it, and its check report lists it as an **obligation**, as it
229
- lists each claim whose call fidelity and each question whose answer
230
- completeness remains unproved (Sections [11.9](#119-c6-boundary-consistency),
231
- [11.13](#1113-c10-call-fidelity) and [12](#12-check-reports)).
232
- - **Check report**: what a checker writes: the claims, the outcome of each
233
- of C1–C10, failures, obligations, counts and a verdict ([Section 12](#12-check-reports)).
234
- - **Valid**: of a proof, failing no condition; a valid proof with
235
- obligations is valid conditional on them ([Section 11.14](#1114-counts-and-validity)).
201
+ body of each query; without queries, each ordinary forward head
202
+ ([Section 11.2](#112-original-questions)).
203
+ - **Replay**: re-executing the firing a step records, from its source rule,
204
+ with the bindings of each point of the search ([Section 11.4](#114-replaying-derived-facts)).
205
+ - **Checks**: of a proof, that the checker finds no failure; its claims are
206
+ then exactly the answers of the original questions, or for a halted run
207
+ follow from the program ([Section 11.1](#111-what-a-checked-proof-establishes)).
208
+ - **Check report**: what a checker writes: the claims, any failures and a
209
+ verdict ([Section 12](#12-check-reports)).
236
210
 
237
211
  ## 2. Terms
238
212
 
@@ -351,8 +325,8 @@ itself rather than an array.
351
325
  `preds` and `vars` take a string of names separated by spaces or commas.
352
326
  Each name MUST be an ASCII identifier and MUST NOT be a reserved JavaScript
353
327
  word. `preds` MUST also reject control and primitive names and the reserved
354
- names `step`, `clause`, `activated`, `forward`, `backward`, `struct`,
355
- `implies` and `implied_by`.
328
+ names `step`, `derived`, `called`, `activated`, `forward`, `backward`,
329
+ `struct`, `implies` and `implied_by`.
356
330
 
357
331
  A top-level expression statement that calls a predicate supplied by rule 4,
358
332
  such as a misspelled `fcat(p(1))`, states nothing; a loader MUST report it as
@@ -397,8 +371,7 @@ tail term without executing a JavaScript spread.
397
371
 
398
372
  Each occurrence of `_` in a clause is a distinct anonymous variable.
399
373
  Anonymous occurrences are named `_0`, `_1`, ... in textual order, skipping
400
- names already used in the clause. Clause displays and proof bindings use
401
- these names. Programs SHOULD NOT give their own variables names consisting
374
+ names already used in the clause. Proof bindings use these names. Programs SHOULD NOT give their own variables names consisting
402
375
  of `_` followed by digits, which negation treats as anonymous.
403
376
 
404
377
  Operators do not construct logical terms. An operator applied to a variable,
@@ -470,8 +443,8 @@ A clause MUST be rejected when:
470
443
  - a head is not an atom or compound, or is a list, the atom `'[]'` or a
471
444
  `'.'/2` compound, which as a goal would be a conjunction ([Section 4.1](#41-goal-syntax)) and
472
445
  could never call the clause;
473
- - a head uses `step/4`, `clause/2`, `searched/2`, `derived/2`, `called/2`, reserved
474
- for proof documents, or explicitly states the reserved predicate
446
+ - a head uses `step/4`, `derived/2` or `called/2`, reserved for proof
447
+ documents, or explicitly states the reserved predicate
475
448
  `activated/2`;
476
449
  - a head is a primitive or control, except the head `'true'` of a query or
477
450
  `'false'` of a contradiction; `implies` MUST NOT conclude either atom;
@@ -612,8 +585,8 @@ optionally signed decimal with an optional exponent, `'INF'`, `'+INF'`,
612
585
  `'-INF'` or `'NaN'`, optionally surrounded by XML whitespace. Parsing rounds
613
586
  once to binary64 and allows overflow and underflow. An invalid lexical
614
587
  form or operand fails; another `Op` raises an error. Finite numeric results
615
- are floats; exceptional results are the atoms above. C5 re-decides these
616
- operations, including signed zeros and exceptional results.
588
+ are floats; exceptional results are the atoms above. A checker recomputes
589
+ these operations, including signed zeros and exceptional results.
617
590
 
618
591
  A regular expression `P` is an atom read as an ECMAScript pattern
619
592
  (ECMA-262, the `RegExp` pattern grammar and matching semantics) with only the
@@ -785,19 +758,19 @@ template's body; its head and direction are those of the template. A forward
785
758
  template keeps its head conjunction; a backward template appends one clause
786
759
  per head. Continue processing appended clauses in order, compiling nested
787
760
  forward templates in the same way. Original clause numbers are kept;
788
- appended clauses are numbered consecutively. `forward` and `backward` are
789
- displayed as `implies` and `implied_by`. The original generating clause
790
- retains its template heads.
761
+ appended clauses are numbered consecutively. `forward` and `backward` stand
762
+ for `implies` and `implied_by`. The original generating clause retains its
763
+ template heads.
791
764
 
792
765
  For example, `implies(cat(X), implies(dog(Y), test('yes')))` as the only
793
- stated clause has these displays:
766
+ stated clause has these clauses:
794
767
 
795
768
  ```js
796
- clause(1, implies(cat(X), implies(dog(Y), test('yes'))))
797
- clause(2, implies([cat(X), dog(Y)], test('yes')))
769
+ implies(cat(X), implies(dog(Y), test('yes'))) // clause 1
770
+ implies([cat(X), dog(Y)], test('yes')) // clause 2, appended
798
771
  ```
799
772
 
800
- The appended body describes the premises a certificate must justify. It is
773
+ The appended body describes the premises a step of the rule uses. It is
801
774
  not a prescription to reevaluate the generator when the appended rule is
802
775
  called. During forward evaluation, each solution of the generator creates a
803
776
  rule instance with its captures bound to that solution and its generator's
@@ -805,7 +778,7 @@ evidence retained. Identical captures of the same template create one
805
778
  instance. The rule instance searches only the template's own body; a
806
779
  backward caller cannot change how the generator's body was evaluated.
807
780
  Template-local variables remain universal and are renamed apart on each use.
808
- The run derives no synthetic enabling facts, and certificates have no
781
+ The run derives no synthetic enabling facts, and proofs have no
809
782
  intermediate enabling steps: the generator's premises are direct uses of
810
783
  the derived rule's step. A nested instance retains all enclosing premises.
811
784
 
@@ -855,11 +828,11 @@ at every use. Unrelated unbound variables keep [Section 8.2](#82-forward-evaluat
855
828
  When inspection variables remain free in a conclusion or its captured
856
829
  template context, that firing MUST NOT introduce head-only existential
857
830
  witnesses: it MUST fail with an error requiring the inspection variables to
858
- be bound first. [Section 11.11](#1111-c8-witness-integrity) rejects certificates that bypass this boundary.
831
+ be bound first. Such a firing does not replay ([Section 11.4](#114-replaying-derived-facts)).
859
832
 
860
833
  Inspection uses a fixed source catalogue, so its own results do not depend on
861
834
  forward rounds. Other goals using derived patterns still participate in
862
- stratification. Negation and collection keep their own justifications ([Section 10.3](#103-steps)).
835
+ stratification.
863
836
 
864
837
  ### 6.4 Chain stratification
865
838
 
@@ -999,9 +972,9 @@ the heads' other variables in order of first occurrence. The guard holds when
999
972
  nothing but the firing's own witnesses satisfies its heads. Before a
1000
973
  firing, that is when no known values satisfy them, so a satisfied rule does
1001
974
  not invent new values, as the restricted chase does; after it, that is when
1002
- the firing's witnesses are needed, which the search certificate shows like
1003
- any negation. A restricted rule without head-only variables has no guard and
1004
- behaves as `implies`. For example:
975
+ the firing's witnesses are needed. A proof cannot establish a firing of a
976
+ restricted rule with a guard ([Section 11.1](#111-what-a-checked-proof-establishes)). A restricted rule without
977
+ head-only variables has no guard and behaves as `implies`. For example:
1005
978
 
1006
979
  ```js
1007
980
  fact(human('jo'), father('jo', 'bob'))
@@ -1010,8 +983,7 @@ implies(father(X, Y), man(Y))
1010
983
  ```
1011
984
 
1012
985
  concludes `man('bob')` and invents no father for `'jo'`, since `'bob'`
1013
- already satisfies the heads once the third rule has run. A restricted
1014
- rule's display omits its guard ([Section 10.2](#102-clause-displays)).
986
+ already satisfies the heads once the third rule has run.
1015
987
 
1016
988
  A `restricted` call states a clause and is no rule value: a `restricted`
1017
989
  call nested in another statement MUST be rejected. Its premise MUST bind
@@ -1101,11 +1073,9 @@ infinite closure. A finite model does not ensure search termination:
1101
1073
  `implied_by(p(X), p(X))` has an empty least model, but searching `p('a')`
1102
1074
  recurs indefinitely. Exceeding a resource bound raises an error ([Section
1103
1075
  8.3](#83-resource-bounds)). Contradictions halt without completing the closure ([Section 8.5](#85-contradictions)).
1104
- A valid proof establishes its claims subject to its obligations and, when
1105
- it checks without obligations, that they are every answer of the original
1106
- questions ([Section 11.1](#111-scope-of-a-valid-proof)); it does not
1107
- establish termination of the whole program. Its search
1108
- certificate settles the negations and collections it can ([Section 10.4](#104-search-certificates)).
1076
+ A proof that checks establishes that its claims are every answer of the
1077
+ original questions ([Section 11.1](#111-what-a-checked-proof-establishes)); it does not establish termination of the
1078
+ whole program.
1109
1079
 
1110
1080
  ## 8. Evaluation and Conclusions
1111
1081
 
@@ -1157,7 +1127,7 @@ and `p(2)` publishes `a(1)`, `b(1)`, `a(2)`, `b(2)`. For each head:
1157
1127
  free, in order of first occurrence in the heads. A rule that keeps meeting new firings does
1158
1128
  not terminate ([Section 8.3](#83-resource-bounds)). Derived facts other than scoped inspection
1159
1129
  patterns ([Section 6.3](#63-source-rule-inspection)) are therefore ground. A
1160
- checker verifies the Skolem terms of a proof (C8, [Section 11.11](#1111-c8-witness-integrity));
1130
+ checker recomputes the Skolem terms of a proof ([Section 11.4](#114-replaying-derived-facts));
1161
1131
  - a head `'true'` reports the instance of the rule's body, as a conjunction,
1162
1132
  once per distinct instance (by identity of canonical text);
1163
1133
  - a head `'false'` records the conclusion `'false'` and stops all reasoning;
@@ -1285,25 +1255,18 @@ When a proof is requested, each solution records how each of its goals was
1285
1255
  justified: by a fact or rule of the program, by a derived fact (whose own
1286
1256
  record is kept), by a primitive, by a control, by an absence (a negation) or
1287
1257
  by a collection. For each conclusion the first derivation found is
1288
- recorded. Each original question gets call-fidelity evidence (Sections [10.5](#105-call-fidelity-certificates) and [11.13](#1113-c10-call-fidelity)),
1289
- when supported. Each negation and collection of a proof gets the search certificate
1290
- 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
1291
- table holds every answer of its call, so it can search beyond where the run
1292
- stopped, as under `once`; a boundary whose tables would meet an error, or
1293
- exceed the inference bound while recording calls and answers
1294
- ([Section 8.3](#83-resource-bounds)), stays trusted. So does a
1295
- boundary of a halted run ([Section 8.5](#85-contradictions)) whose listings a rule of a later stratum
1296
- would extend: the run stopped before its fixpoint, so its derived facts need
1297
- not be closed under the rules. A
1298
- reasoner MUST check every proof it generates ([Section 11](#11-proof-checking)) before returning it,
1299
- and MUST fail with an error rather than return a proof that does not pass. A
1300
- run without conclusions has a proof without claims; its call tables, when
1301
- they settle, certify that the original questions have no answers.
1302
-
1303
- A **state test** is `is_var/1`, `not_identical/2` or `compare/3`: a test a
1304
- later binding can make false. A goal such as `is_var(X)` followed by
1305
- `unify(X, 'a')` holds when it runs, but its final instance `is_var('a')` does
1306
- not, so the proof records it as it was called ([Section 10.3](#103-steps)).
1258
+ recorded. The proof ([Section 10](#10-proof-documents)) holds a call table for every call its
1259
+ original questions make, with every answer of the call, so a table can
1260
+ search beyond where the run stopped, as under `once`; the listings those
1261
+ searches consult; and the steps that replay the listed facts. A halted run's
1262
+ proof replays its claims instead. A reasoner MUST check every proof it
1263
+ generates ([Section 11](#11-proof-checking)) before returning it, and MUST fail with an error
1264
+ rather than return a proof that does not check, as for results the format
1265
+ cannot establish ([Section 11.1](#111-what-a-checked-proof-establishes)) or a table that would meet an error. It
1266
+ MAY bound the work of making tables; exceeding the bound is such an error
1267
+ and MUST NOT change the run's answers. A run without conclusions has a proof
1268
+ without claims, whose call tables show that the original questions have no
1269
+ answers.
1307
1270
 
1308
1271
  ## 9. Document Syntax and Canonical Text
1309
1272
 
@@ -1424,10 +1387,9 @@ The conclusions a run writes, its proof documents ([Section 10](#10-proof-docume
1424
1387
  reports ([Section 12](#12-check-reports)) use the following variable names. In
1425
1388
  the conclusions of a run and in a proof document, the variables are named
1426
1389
  `A`, `B`, ..., `Z`, `A1`, ..., `Z1`, `A2`, ... in the order the document
1427
- first shows them, across the whole document, the conclusions written first;
1428
- the clause displays of a proof keep the program's names. A check report
1429
- names the variables of each fact anew ([Section 12](#12-check-reports)).
1430
- The call tables of a proof (`called/2`, [Section 10.5](#105-call-fidelity-certificates)) name their variables
1390
+ first shows them, across the whole document, the conclusions written first.
1391
+ A check report keeps the names of the proof ([Section 12](#12-check-reports)). The call tables
1392
+ of a proof (`called/2`, [Section 10.3](#103-certificate)) name their variables
1431
1393
  in a scope of their own, keeping anonymous variables distinct from named
1432
1394
  ones.
1433
1395
 
@@ -1439,266 +1401,105 @@ A proof document is a document ([Section 9.1](#91-accepted-document-syntax)) hol
1439
1401
 
1440
1402
  1. the output of the run ([Section 8.6](#86-reported-conclusions)): its comment line, then its
1441
1403
  conclusions, one per line;
1442
- 2. an empty line;
1443
- 3. when the proof cites any clause, a comment line introducing the clauses,
1444
- then one `clause(N, Display)` per program clause the proof cites, by
1445
- increasing `N`;
1446
- 4. an empty line;
1447
- 5. when there are steps, comment lines saying what a step records, then one
1448
- `step(Goal, By, Bindings, Uses)` per justified goal;
1449
- 6. when it has a search certificate ([Section 10.4](#104-search-certificates)), an empty line, comment
1450
- lines introducing it, then one `derived(Pattern, Facts)` per listed
1451
- relation, then one `searched(Call, Answers)` per table;
1452
- 7. then any `called(Call, Answers)` tables ([Section 10.5](#105-call-fidelity-certificates)), in first-consulted
1453
- order and with their own variable naming scope.
1404
+ 2. when there are steps ([Section 10.2](#102-steps)), an empty line, comment
1405
+ lines saying what a step records, then one `step(Goal, By, Bindings, Uses)`
1406
+ per recorded inference;
1407
+ 3. when there is a certificate ([Section 10.3](#103-certificate)), an empty
1408
+ line, a comment line introducing it, then one `derived(Pattern, Facts)` per
1409
+ listing, in the order first consulted, then one `called(Call, Answers)`
1410
+ per call table, in the order their calls are first met.
1454
1411
 
1455
1412
  Comments are informative and MAY be worded differently; they are ignored when
1456
- the document is read.
1457
-
1458
- A checker MUST treat every statement that is neither `clause/2`, `step/4`,
1459
- `searched/2`, `derived/2` nor `called/2` as a claim, whatever its position.
1460
-
1461
- ### 10.2 Clause displays
1462
-
1463
- `Display` shows clause `N` in normalized statement form: `fact(Head)`,
1464
- `implies(Body, Head)`, `restricted(Body, Head)`, `implied_by(Head, Body)`,
1465
- `query(G1, ...)` or `contradiction(G1, ...)`, where `Body` is the clause's
1466
- one body goal without a restricted rule's guard, or the
1467
- array of its body goals when it has several, `Head` likewise the head or the
1468
- array of heads, and `G1, ...` are the body goals themselves. Displays are not
1469
- authority: a checker MUST compare each with the program it checks against.
1470
-
1471
- Each argument of a multi-argument `fact` has its own `fact(Head)` display.
1472
- A body is displayed with its conjunctions flattened ([Section 3.5](#35-clause-constraints-and-numbering)), whether
1473
- the program wrote them as arrays or with `and`: `implied_by(r, and(a, b))`
1474
- has display `implied_by('r', ['a', 'b'])`.
1475
- Conjunctive query and contradiction bodies are displayed as separate goal
1476
- arguments: `query([p(X), q(X)])` has display `query(p(X), q(X))`.
1477
-
1478
- For a program with templates, displays show the original generators and the
1479
- potential appended clauses of [Section 6.2](#62-inline-rule-templates). A derived rule's body includes all
1480
- enclosing generator premises. The source program is the authority for its
1481
- origin, captures and scope projections; a display cannot introduce a new
1482
- rule. A reasoner displays the enclosing generators as well as the clauses its
1483
- steps cite. Each derived rule step lists its generator's premise evidence
1484
- before its own body evidence, with no intermediate enabling step.
1485
-
1486
- ### 10.3 Steps
1487
-
1488
- `Goal` is the justified goal as it stands once the whole solution is found:
1489
- the goal with every variable the solution bound replaced by its value. The
1490
- program's goal `unify(Y, 6)`, solved with `Y` unbound, thus has the step
1491
- `step(unify(6, 6), 'builtin', {}, [])`; the value `Y` received is recorded in
1492
- the bindings of the step that cites the clause, as `{Y: 6}`. Steps appear
1493
- in the order a depth-first walk
1494
- from the claims first meets each goal, and each distinct goal (by canonical
1495
- text) has one step. `Uses` is the list of the goals that justify `Goal`, in
1496
- order. `By` is one of:
1413
+ the document is read. Every statement that is neither `step/4`, `derived/2`
1414
+ nor `called/2` is a **claim**, whatever its position.
1415
+
1416
+ A proof answers the run's original questions ([Section 11.2](#112-original-questions))
1417
+ by its certificate: the call tables show every answer of every call those
1418
+ questions make, and the steps show how each derived fact the answers rest on
1419
+ was derived.
1420
+
1421
+ ### 10.2 Steps
1422
+
1423
+ A step records the firing behind a derived fact, and how its uses were
1424
+ solved where the call tables cannot show it. `Goal` is the derived goal as it
1425
+ stands once the whole solution is found: the goal with every variable the
1426
+ solution bound replaced by its value. `Uses` is the list of the goals that
1427
+ justify `Goal`, in order. `By` is one of:
1497
1428
 
1498
1429
  | `By` | Meaning | `Bindings` | `Uses` |
1499
1430
  | --- | --- | --- | --- |
1500
- | `clause(N)` | `Goal` is an instance of a head of clause `N`, a fact or a rule, whose body instance is `Uses`. | the clause's variables | the body instance, empty for a fact |
1501
- | `source(N)` | `Goal` is an instance of the inspectable source rule `N` as `implies(Body, Head)` or `implied_by(Head, Body)`. | empty | empty |
1502
- | `'builtin'` | `Goal` is a primitive that holds. | empty | empty |
1503
- | `called(Called)` | `Goal` is a state test ([Section 8.7](#87-proof-generation)) that held as `Called`, the goal when it ran, its then unbound variables written as variables. | empty | empty |
1504
- | `'control'` | `Goal` is `call`, `once` or a disjunction, solved by `Uses`. | empty | the solved goals; for a disjunction, the side that was solved, so `or(or(A, B), C)` solved by `A` uses `or(A, B)`, which has a step of its own |
1505
- | `'absent'` | `Goal` is a negation, settled by the search certificate or taken on trust. | empty | empty |
1506
- | `'collected'` | `Goal` is a collection, settled by the search certificate or taken on trust. | empty | empty |
1507
-
1508
- `Bindings` is an object from each variable name of the cited clause, as
1509
- the program wrote it, to its value in this step: `{X: 'socrates'}`. A key
1510
- that is a plain name of [Section 9.2](#92-canonical-atoms-numbers-variables-and-lists) is written bare, and any other name as a
1511
- string, such as `{'A-B': 1}`. A
1512
- reasoner writes every variable of the clause, in the order the clause display
1513
- first shows them (for `implies`, the premise first);
1514
- a checker MUST accept partial bindings when the goal and uses determine the
1515
- omitted values needed by C1 and C8. Values needed only by an enclosing
1516
- witness scope must be supplied when those terms do not determine them.
1517
- A primitive has no variables of its own, so `'builtin'` and `called`
1518
- steps have empty bindings. A reasoner writes `called(Called)` exactly for a
1519
- state test whose goal, when it held, had a variable the solution later
1520
- bound; `Called` is that goal after the test, so `compare(O, X, 'b')` run
1521
- with `X` unbound is written `called(compare('<', A, 'b'))`. Every other
1522
- primitive step, and a state test no later binding changed, is `'builtin'`:
1523
-
1524
- ```js
1525
- implied_by(p(X), [is_var(X), unify(X, 'a')])
1526
- // step(is_var('a'), called(is_var(A)), {}, [])
1527
- ``` A derived clause's bindings also include variables of its
1528
- enclosing generators' scope projections, so their witnesses can be checked.
1529
- These variables are renamed together with the clause's head and full body.
1530
-
1531
- ### 10.4 Search certificates
1532
-
1533
- No step can show that a goal has no solution, or that a list holds every
1534
- solution. A search certificate shows it by recording the searches behind a
1535
- proof's negations and collections:
1536
-
1537
- - `searched(Call, Answers)` is a **table**: `Call` is a goal as one of those
1538
- searches called it, and `Answers` the array of its answers, each the
1539
- instance of `Call` that one solution gave, in the order of [Section 8.1](#81-goal-search),
1540
- repetitions included. Each answer's variables are its own: they are shared
1541
- neither with `Call` nor with another answer.
1431
+ | `clause(N)` | `Goal` is an instance of a head of rule `N`, whose body instance is `Uses`. For a rule appended by a template, the body is its full body, the generators' premises first ([Section 6.2](#62-inline-rule-templates)). | the rule's variables | the body instance |
1432
+ | `'control'` | `Goal` is `call(G)` or a disjunction, solved by `Uses`. | empty | the conjuncts of `G` or of the side that was solved, so `or(or(A, B), C)` solved by `A` uses `or(A, B)` |
1433
+
1434
+ `Bindings` is an object from variable names of the cited rule, as the
1435
+ program wrote them, to their values in this step: `{X: 'socrates'}`. A key
1436
+ that is an ASCII identifier (letters, digits and `_`, not starting with a
1437
+ digit) is written bare, and any other name as a string, such as `{'A-B': 1}`. A reasoner writes every variable of the rule,
1438
+ in order of first occurrence in the rule, a forward rule's body first.
1439
+ Bindings explain a step; a checker requires only that they agree with it
1440
+ ([Section 11.4](#114-replaying-derived-facts)).
1441
+
1442
+ A proof holds exactly the steps its check follows ([Section 11.4](#114-replaying-derived-facts)): the
1443
+ step of each listed fact and, for a halted run, of each claim; and, within
1444
+ the firings they record, the step of each use whose call the tables answer
1445
+ only through derived facts, recursively. Each distinct goal (by canonical
1446
+ text) has at most one step; a derived pattern ([Section 6.3](#63-source-rule-inspection)) has one up to
1447
+ the renaming of its variables. Steps appear in the order of a depth-first
1448
+ walk from the listed facts, in listing order, and then from a halted run's
1449
+ claims.
1450
+
1451
+ ### 10.3 Certificate
1452
+
1453
+ - `called(Call, Answers)` is a **call table**: `Call` is a goal as a search
1454
+ called it, before any later binding, and `Answers` the array of its
1455
+ answers, each the instance of `Call` that one solution gave, in the order
1456
+ of [Section 8.1](#81-goal-search), repetitions included. Each answer's variables are its own:
1457
+ they are shared neither with `Call` nor with another answer.
1542
1458
  - `derived(Pattern, Facts)` is a **listing**: `Pattern` is the name of a
1543
1459
  relation that forward rules conclude, applied to distinct variables, or the
1544
- name alone for arity 0, and `Facts` the array of every fact the run derived
1545
- for that relation, in the order derived ([Section 8.2](#82-forward-evaluation-and-witnesses)). Each listed fact has
1546
- steps of its own.
1547
-
1548
- A table exists for each call to a relation that a backward rule defines or
1549
- forward rules conclude, made by those searches or by the closure checks of
1550
- [Section 11.12](#1112-c9-search-closure); a call to a relation defined by facts alone needs none. A
1551
- listing exists for each relation forward rules conclude that a table or a
1552
- closure check consults. A reasoner writes only the tables and listings of
1553
- the boundaries it settles: listings first, in the order first consulted,
1554
- then tables, in the order their calls are first met. For example:
1555
-
1556
- ```js
1557
- derived(nonpacifist(A), [nonpacifist('nixon')])
1558
- searched(nonpacifist('ada'), [])
1559
- ```
1460
+ name alone for arity 0; the `i`-th argument of every listing's pattern is
1461
+ one and the same variable, named with the rest of the document
1462
+ ([Section 9.4](#94-variable-scope-in-output)), and `Facts` the array of every fact the run derived
1463
+ for that relation, in the order derived ([Section 8.2](#82-forward-evaluation-and-witnesses)).
1560
1464
 
1561
- ### 10.5 Call-fidelity certificates
1562
-
1563
- `called(Call, Answers)` is a **call table**. Its shape and answer ordering
1564
- are those of `searched/2` ([Section 10.4](#104-search-certificates)), but it records a call made while
1565
- answering an original question, for C10 ([Section 11.13](#1113-c10-call-fidelity)). External goals
1566
- remain inputs to the checker: a call table cannot supply or specialize the
1567
- question a claim must answer.
1465
+ A call table exists for each call to a relation that a backward rule defines
1466
+ or forward rules conclude, made by the searches and replays of Sections
1467
+ [11.3](#113-answering-calls) and [11.4](#114-replaying-derived-facts); a call to a relation defined by facts alone needs
1468
+ none. A listing exists for each
1469
+ relation forward rules conclude that those searches consult.
1568
1470
 
1569
1471
  Two calls identify the same call table only when they are identical up to
1570
1472
  renaming **that preserves anonymous-variable status** ([Section 4.2](#42-controls)), including
1571
- inside nested compounds. There MUST NOT be two such tables. An anonymous
1572
- variable cannot be renamed to a named one, or vice versa, when comparing
1573
- call-table answers either. These restrictions matter because a named unbound
1574
- variable makes a negation an error. A malformed or duplicate call table
1575
- fails C3 as a malformed or duplicate search table does.
1576
-
1577
- Call-table variables have their own naming scope. Writers name named
1578
- variables `A`, `B`, ..., counting variables in first-occurrence order, and
1579
- anonymous ones `_0`, `_1`, ... using their position in the same order.
1580
- For example, a named call returning an anonymous parameter may be:
1473
+ inside nested compounds; there MUST NOT be two such tables. Answers are
1474
+ compared the same way. These restrictions matter because a named unbound
1475
+ variable makes a negation an error. The call tables of a proof share a
1476
+ variable naming scope of their own: writers name named variables `A`, `B`,
1477
+ ..., counting variables in first-occurrence order across the tables, and
1478
+ anonymous ones `_0`, `_1`, ... using their position in the same order. For example, a named call returning an anonymous
1479
+ parameter may be:
1581
1480
 
1582
1481
  ```js
1583
1482
  called(p(A), [p(_1)])
1584
1483
  ```
1585
1484
 
1586
- Each answer is freshened separately when used, as in [Section 10.4](#104-search-certificates). C10 call
1587
- tables and C9 search tables are distinct, even for textually identical calls.
1588
- They share any applicable `derived/2` listings, whose facts require steps.
1589
-
1590
1485
  ## 11. Proof Checking
1591
1486
 
1592
- A checker establishes whether the proof's claimed answers follow from the
1593
- source program, with any assumptions reported as obligations. Its inputs
1594
- are the program, the proof document and, when the proof answers goals asked
1595
- from outside the program, those original goals. The source program is the
1596
- authority for clauses and questions; the proof supplies evidence to check.
1487
+ A checker establishes whether the claims of a proof are exactly the answers
1488
+ of the original questions of the source program. Its inputs are the program,
1489
+ the proof document and, when the proof answers goals asked from outside the
1490
+ program, those goals. The source program is the authority for clauses and
1491
+ questions; the proof supplies evidence to check. The outcome is `checked`
1492
+ or a list of failures.
1597
1493
 
1598
- There are three parts to that evidence:
1494
+ The checker MUST NOT call a reasoner to supply missing evidence. It runs
1495
+ primitives, expands a call one level against the source program, answering
1496
+ inner calls from the call tables, and replays recorded firings. Each
1497
+ consulted table is itself checked by this expansion, and tables cannot
1498
+ justify themselves through a cycle.
1599
1499
 
1600
- | Evidence in the proof | What the checker establishes |
1601
- | --- | --- |
1602
- | `step(Goal, By, Bindings, Uses)` | Each recorded inference follows from its cited source clause, primitive or control, with justified premises and correct witnesses. |
1603
- | `searched(Call, Answers)` and `derived(Pattern, Facts)` | A negation's search has no solution, or a collection contains all its search results (C9). |
1604
- | `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). |
1605
-
1606
- The tables and listings are statements **inside the proof document**, after
1607
- its steps ([Section 10.1](#101-structure)). They are checked claims about
1608
- search, not authority to invent answers. The `called/2` table used by C10
1609
- is distinct from the `called(Called)` justification of a state-test step
1610
- ([Section 10.3](#103-steps)).
1611
-
1612
- The checker MUST NOT call a reasoner to supply missing evidence. It MAY
1613
- recompute primitives and expand a call one level against the source
1614
- program, answering inner relation calls from the certificate. Each
1615
- consulted table is itself checked by this expansion; tables cannot justify
1616
- themselves through a cycle. Sections [11.12](#1112-c9-search-closure) and
1617
- [11.13](#1113-c10-call-fidelity) specify these checks.
1618
-
1619
- The ten conditions answer different questions:
1620
-
1621
- | Condition | Question |
1622
- | --- | --- |
1623
- | [C1 Resolution](#114-c1-resolution) | Is this step an instance of the source clause it cites? |
1624
- | [C2 Well-foundedness](#115-c2-well-foundedness) | Are the steps free of circular justification through their uses? |
1625
- | [C3 Justification](#116-c3-justification) | Is each statement and justification well formed? |
1626
- | [C4 Coverage](#117-c4-coverage) | Does every claim and premise have evidence? |
1627
- | [C5 Re-decision](#118-c5-re-decision) | Do primitives hold, and do control steps compose from their uses? |
1628
- | [C6 Boundary consistency](#119-c6-boundary-consistency) | Does available evidence contradict an unsettled negation or collection? |
1629
- | [C7 Relevance](#1110-c7-relevance) | Does the evidence serve the claimed answers to the program's questions? |
1630
- | [C8 Witness integrity](#1111-c8-witness-integrity) | Does each existential witness identify the correct rule firing? |
1631
- | [C9 Search closure](#1112-c9-search-closure) | Does the certificate establish the recorded negation or collection? |
1632
- | [C10 Call fidelity](#1113-c10-call-fidelity) | Can the original question return this answer, and is each of its answers claimed? |
1633
-
1634
- C9 checks the search behind a recorded step; C10 checks the original call
1635
- before the proof's final bindings. This distinction matters for negation,
1636
- collection, `once` and tests of variable state. A specialized goal can
1637
- succeed even when the original open question would not return it
1638
- ([Section 11.2](#112-operational-query-fidelity)). Every proof check
1639
- includes C10.
1640
-
1641
- The checker records each failure with its condition, a detail and, where
1642
- there is one, the term concerned. Missing or unsupported search evidence
1643
- can instead leave an obligation. The verdict distinguishes these outcomes:
1644
-
1645
- | Verdict | Meaning |
1646
- | --- | --- |
1647
- | `checked` | No condition failed and no obligation remains. |
1648
- | `checked_with_obligations` | No condition failed, but the claims depend on the reported obligations. |
1649
- | `failed(N)` | The checker recorded `N` failures. |
1650
-
1651
- Strict checking forbids unresolved obligations. A `checked` verdict
1652
- establishes the claimed answers and that they are every answer of the
1653
- original questions, but not that the whole program terminates
1654
- ([Section 11.1](#111-scope-of-a-valid-proof)).
1655
-
1656
- ### 11.1 Scope of a valid proof
1657
-
1658
- A valid proof establishes that each claim follows from the source program
1659
- by the recorded steps, conditional on any reported obligations. A settled
1660
- boundary is established by its search certificate. An unconditional
1661
- `checked` verdict also establishes operational query fidelity
1662
- ([Section 11.2](#112-operational-query-fidelity)) and **answer
1663
- completeness**: the claims include every answer of every original question
1664
- ([Section 11.13](#1113-c10-call-fidelity)). Every question asked has a
1665
- certified answer set, and every answer in it is claimed.
1666
-
1667
- For a program with negation, "follows" is relative to the facts the
1668
- certificate lists: C9 establishes that they are supported by steps, closed
1669
- under the forward rules and consistent with every settled negation. Under
1670
- the call-fidelity requirements of [Section 11.13](#1113-c10-call-fidelity),
1671
- a stratified or chain-stratified program has only one such result ([Section 7.4](#74-negation-and-collection)). With restricted
1672
- witnesses, different lean results can have these properties. A claim whose
1673
- forward dependency closure includes a restricted rule with head-only
1674
- variables therefore retains a call-fidelity obligation, and a strict check
1675
- rejects it. Independent claims may still check strictly.
1676
-
1677
- It does not establish:
1678
-
1679
- - answer completeness for a halted proof, whose claims contain `'false'`;
1680
- - that the program derives no `'false'`;
1681
- - that execution of the whole program terminates or reaches every question;
1682
- - that the supplied program expresses the author's intended model.
1683
-
1684
- A run's own proof contains exactly that run's conclusions. A proof that
1685
- omits an answer its certificate establishes fails C10. One without the
1686
- certificate to show its answers complete is valid only conditionally: an
1687
- empty proof establishes no answers and leaves each original question whose
1688
- answers need a call table as an obligation.
1689
-
1690
- ### 11.2 Operational query fidelity
1691
-
1692
- **Operational query fidelity** means that the original question can return
1693
- the claimed answer under [Section 8](#8-evaluation-and-conclusions), with
1694
- the bindings, control choices and forward state applicable at its calls.
1695
- C10 checks this property. It concerns each claimed answer's reachability
1696
- in that question's ordered search, not whether the proof includes every
1697
- answer or whether execution reaches the question at all.
1698
-
1699
- Proof steps show goals after the whole solution's bindings have been
1700
- applied ([Section 10.3](#103-steps)). Those final instances can hide a
1701
- different result at the original call. For example:
1500
+ The searches of a check start from the original questions, with the
1501
+ bindings each call has when it runs, not from the final instances that steps
1502
+ show. Those final instances can hide a different result. For example:
1702
1503
 
1703
1504
  ```js
1704
1505
  fact(value('a'), value('b'))
@@ -1707,738 +1508,249 @@ implied_by(q(X), once(p(X)))
1707
1508
  ```
1708
1509
 
1709
1510
  For the external question `q(X)`, `once(p(X))` selects `'a'`, so the only
1710
- answer is `q('a')`. But if the checker starts from the final instance
1711
- `q('b')`, the specialized call `once(p('b'))` succeeds. A derivation of
1712
- that specialized call can pass C1–C9 without showing that the original
1713
- question could return it.
1714
-
1715
- Negation has the same problem with call-time bindings. Consider a separate
1716
- program:
1717
-
1718
- ```js
1719
- fact(p('a'))
1720
- implied_by(q(X), [not(p(X)), unify(X, 'b')])
1721
- ```
1511
+ answer is `q('a')`, although the specialized call `once(p('b'))` succeeds.
1512
+ Likewise, with `fact(p('a'))` and `implied_by(q(X), [not(p(X)), unify(X, 'b')])`,
1513
+ the question `q(X)` raises an error, because `X` is unbound when the
1514
+ negation runs, though `q('b')` succeeds. Tests of variable state and
1515
+ collections depend on their actual calls in the same way ([Section 7.5](#75-sets-and-operational-behavior)).
1516
+
1517
+ The document MUST be read as data using [Section 9.1](#91-accepted-document-syntax), without executing it.
1518
+ The check fails when it cannot be read, when a step's bindings are not an
1519
+ object or its uses not an array, when two steps have identical goals, when a
1520
+ call table's answers or a listing's facts are not an array, when a listing's
1521
+ pattern is not a name applied to distinct variables, when two call tables or
1522
+ two listings coincide ([Section 10.3](#103-certificate)), and when a variable's name contains
1523
+ `#`, which no writer gives a variable ([Section 9.4](#94-variable-scope-in-output)).
1524
+
1525
+ ### 11.1 What a checked proof establishes
1526
+
1527
+ A proof **checks** when the checker finds no failure. Then its claims follow
1528
+ from the source program, and, unless the run halted, they are exactly the
1529
+ answers of its original questions, up to the renaming of their variables:
1530
+ every claim is an answer and every answer is claimed. A proof without claims
1531
+ then establishes that the original questions have none.
1722
1532
 
1723
- The external question `q(X)` raises an error: `X` is still a named unbound
1724
- variable when `not(p(X))` runs. The specialized call `q('b')` succeeds,
1725
- but the later `unify` cannot retroactively bind the original negation.
1726
- Tests of variable state and collection likewise depend on their actual
1727
- calls ([Section 7.5](#75-sets-and-operational-behavior)).
1728
-
1729
- A checker MUST NOT treat C7's instance test or C5's composition of a
1730
- `once` step as establishing the original call's result. To establish
1731
- operational query fidelity, it MUST validate the original call state,
1732
- propagation of bindings between ordered premises, freshening and scope,
1733
- and any first-solution choice or required search closure. These must follow
1734
- from the original question, source clauses and checked evidence. Generator
1735
- captures MUST remain independent of later caller bindings. The checker
1736
- MUST NOT invoke the reasoner to fill gaps.
1737
-
1738
- C10 supplies this certificate check in [Section 11.13](#1113-c10-call-fidelity).
1739
- A C1–C9 verdict alone MUST NOT be presented as establishing operational
1740
- query fidelity. Fidelity alone does not establish answer completeness,
1741
- which C10 checks separately, avoidance of an earlier contradiction, or
1742
- termination of preceding questions.
1743
-
1744
- ### 11.3 Reading the document
1745
-
1746
- The document MUST be read as data using [Section 9.1](#91-accepted-document-syntax),
1747
- without executing it. If it cannot be read, C3 fails and the document has no
1748
- claims and no steps. The reader classifies its statements as follows:
1749
-
1750
- | Statement | Requirement | Failure |
1751
- | --- | --- | --- |
1752
- | `clause(N, Display)` | `N` names a source clause whose display is identical to `Display`, including variable names ([Section 10.2](#102-clause-displays)). | C1 |
1753
- | `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 |
1754
- | `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 |
1755
- | `derived(Pattern, Facts)` | `Pattern` is callable and `Facts` is an array; no other listing names the same relation. | C3; set the statement aside |
1756
- | `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 |
1757
-
1758
- Every other statement is a claim, wherever it occurs in the document
1759
- ([Section 10.1](#101-structure)). Renaming variables in a clause display
1760
- does not make it identical to the source display.
1761
-
1762
- ### 11.4 C1 Resolution
1763
-
1764
- C1 checks that the displayed inference is an instance of the source
1765
- clause. For a `clause(N)` step:
1766
-
1767
- 1. `N` MUST identify a clause of the program. A value such as `'x'` or
1768
- `1.0` that is not a clause number fails C1.
1769
- 2. Rename the source clause apart. Each binding MUST name a distinct
1770
- variable of that clause and unify it with its displayed value.
1771
- 3. One head of the clause MUST unify with `Goal`. For a forward rule,
1772
- consider each conjunct of its head separately. The body MUST have the
1773
- same length as `Uses` and unify with it pairwise, in order.
1774
- 4. After these unifications, the head MUST be identical to `Goal`, and
1775
- each body goal to its corresponding use. The step's own terms MUST NOT
1776
- require further instantiation.
1777
-
1778
- For example, a source clause `same(X, X)` cannot justify `same('a', 'b')`.
1779
- Identity also keeps the sign of zero: a fact `z(0.0)` cannot justify
1780
- `z(-0.0)`.
1781
-
1782
- For a derived clause step, each enclosing generator MUST belong to the
1783
- program. Its bindings may name variables of those generators' scope
1784
- projections as well as of the clause itself. The checker renames these
1785
- projections together with the clause before applying the bindings.
1786
-
1787
- For a `source(N)` step, `N` MUST identify an eligible source rule of [Section
1788
- 6.3](#63-source-rule-inspection). Bindings and uses MUST both be empty. The rule's inspection term,
1789
- renamed apart, MUST unify with `Goal` and resolve exactly
1790
- to it without instantiating the step's own terms. This checks variable
1791
- sharing as well as the rule's direction and structure. The source rule is
1792
- read as data; its body is not derived by the checker. These steps count as
1793
- verified C1 steps and cite the usual source clause display.
1794
-
1795
- ### 11.5 C2 Well-foundedness
1796
-
1797
- No step MAY depend on itself through the uses of steps. Even individually
1798
- valid clause instances cannot justify each other in a circle.
1799
-
1800
- To find these dependencies, perform a depth-first walk starting from each
1801
- step not yet visited, in document order. Follow its uses in order to the
1802
- steps with those goals, following each conjunct of a conjunctive use
1803
- separately. Each use that leads back to a step on the current path is one
1804
- C2 failure, whose conclusion is the goal of that step. Circular search
1805
- tables are checked separately by C9 and C10.
1806
-
1807
- ### 11.6 C3 Justification
1808
-
1809
- `By` MUST be one of the forms of [Section 10.3](#103-steps). The following
1810
- forms MUST have no bindings and no uses:
1811
-
1812
- | `By` | Required goal |
1813
- | --- | --- |
1814
- | `'builtin'` | A primitive |
1815
- | `called(Called)` | A state test |
1816
- | `'absent'` | A negation `not(G)` |
1817
- | `'collected'` | A collection `findall(T, G, L)` or `findall_sorted(T, G, L)` |
1818
-
1819
- A well-formed negation or collection step is called a **boundary**. A step
1820
- that fails C3 is not a trusted boundary: it counts in neither `trusted`, C6
1821
- nor C9. The checks for clause and source justifications are in C1; control
1822
- composition is checked by C5.
1823
-
1824
- ### 11.7 C4 Coverage
1825
-
1826
- C4 checks that the proof has no missing premises:
1827
-
1828
- - Each conjunct of each claim MUST have a step.
1829
- - Each use, and each conjunct of a use, MUST have a step or be identical to
1830
- an instance of a source fact. Source facts can therefore serve directly
1831
- as premises, but claims still require steps.
1832
-
1833
- For a missing use, the failure's conclusion is the goal of the step that
1834
- uses it. A document without claims establishes no answers; it is valid if
1835
- no condition fails, and C10 decides whether it shows that the original
1836
- questions have none.
1837
-
1838
- ### 11.8 C5 Re-decision
1839
-
1840
- C5 recomputes primitives and checks how control steps use their premises:
1841
-
1842
- - **Primitive.** A `'builtin'` step's goal, solved as a primitive with no
1843
- prior bindings, MUST succeed without binding anything.
1844
- - **State test.** For `called(Called)`, `Called` MUST have the goal's name
1845
- and arity. Rename `Called` apart and solve it as a primitive with no
1846
- prior bindings; it MUST succeed without binding anything. The displayed
1847
- goal MUST be an instance of `Called`, so only variables the test leaves
1848
- unbound may differ.
1849
- - **Control.** A `'control'` step MUST have no bindings. Its uses MUST be
1850
- identical, in order, to the conjuncts of the argument of `call` or
1851
- `once`, or of one side of a disjunction.
1852
- - **Strict checking.** When trusted boundaries are forbidden, each
1853
- `'absent'` or `'collected'` step that C9 did not settle fails C5.
1854
-
1855
- C5 checks the displayed primitive or chosen control branch. Whether a
1856
- state test actually ran with the claimed bindings, or `once` selected that
1857
- answer from the original open call, is checked by C10
1858
- ([Section 11.13](#1113-c10-call-fidelity)).
1859
-
1860
- Host math is the one exception to identical re-decision. A `'builtin'` step
1861
- `is(V, E)`, where `V` is a float and `E` applies `exp`, `log`, `log2`,
1862
- `log10`, a trigonometric or hyperbolic function, or `pow`, also passes C5
1863
- when `E` evaluates to a float at most 4 units in the last place from `V`,
1864
- that is, with at most 3 floats between them. Such results may differ between
1865
- conforming implementations ([Section 13](#13-conformance)). C5 therefore accepts this bounded
1866
- variation. C10 still compares actual answers of the original question;
1867
- when those answers depend on host math, a proof MAY fail C10 on another
1868
- implementation even when its primitive steps pass C5. Every other recomputed result MUST be identical; a difference
1869
- that grows beyond this bound, for example through cancellation, MAY make a
1870
- proof fail on an implementation other than the one that made it.
1871
-
1872
- ### 11.9 C6 Boundary consistency
1873
-
1874
- C6 can refute an unsettled boundary using evidence already at hand. It
1875
- cannot establish that a search is complete. C9 checks boundaries whose
1876
- certificates settle or refute them; C6 checks the other well-formed
1877
- boundary steps ([Section 11.12](#1112-c9-search-closure)).
1878
-
1879
- For a ground primitive, recompute whether it holds: the evidence is the
1880
- goal itself when it holds, and otherwise the fact that it fails. Controls
1881
- provide no evidence for this check and leave the boundary undecided. For
1882
- other goals, use the source facts and the document's step goals with the
1883
- same name and arity. Such a goal **has evidence** only if at least one
1884
- such fact or step exists. No evidence leaves the boundary undecided;
1885
- it does not establish absence.
1886
-
1887
- - An absence `not(G)` is decided when `G` is a single goal, or a ground
1888
- conjunction, whose every goal has evidence. It fails C6 when every goal of
1889
- `G` unifies with some of its evidence; the anonymous variables of `G`
1890
- unify with anything.
1891
- - A collection `findall(T, G, L)` or `findall_sorted(T, G, L)` fails C6 when `L` is not a list, and is
1892
- decided when `G` is a single goal with evidence. It fails C6 when an
1893
- instance of `T` for some evidence of `G` unifies with no element of `L`.
1894
-
1895
- For example, evidence of `p('a')` refutes `not(p('a'))` and refutes
1896
- `findall(X, p(X), [])`. Merely failing to find evidence of `p('b')` does
1897
- not prove `not(p('b'))` by C6.
1898
-
1899
- A trusted boundary that is not refuted remains an obligation. Even a
1900
- boundary that C6 has decided without finding a contradiction remains
1901
- conditional until C9 settles it ([Section 12](#12-check-reports)).
1902
-
1903
- ### 11.10 C7 Relevance
1904
-
1905
- C7 checks that claims answer relevant questions and that evidence serves
1906
- those claims. When external goals were given and no claim is `'false'`,
1907
- the questions are those goals. Otherwise take, for each forward rule:
1908
-
1909
- - each ordinary head other than `'true'`;
1910
- - its body as a conjunction when one head is `'true'` and no claim is
1911
- `'false'`.
1912
-
1913
- Each claim MUST be an instance of a question. This instance test alone
1914
- does not establish that an original question returns the claim; C10 checks
1915
- that separately.
1916
-
1917
- Each step MUST be reachable from a conjunct of a claim through the
1918
- conjuncts of uses or, from a settled boundary, through facts in the listings
1919
- it rests on. Each table and listing MUST be consulted by a boundary's
1920
- search or closure check, or by the C10 check of a claim. Facts in listings
1921
- consulted by C10 are reachable through that evidence
1922
- ([Section 11.13](#1113-c10-call-fidelity)).
1923
-
1924
- ### 11.11 C8 Witness integrity
1925
-
1926
- A forward rule's head MAY contain variables its body does not contain.
1927
- Each such variable asserts existence and receives a Skolem term identifying
1928
- the firing ([Section 8.2](#82-forward-evaluation-and-witnesses)). C1 alone
1929
- would accept an arbitrary value for it. C8 checks that the value is the
1930
- specified witness and that its arguments come from the firing's evidence.
1931
-
1932
- **Witness shape.** For a `clause(N)` step citing a forward rule, under the
1933
- substitution of C1, each head-only variable `V` MUST be bound to
1934
- `skolem(N, Name, Args)`, where:
1935
-
1936
- - `Name` is the name of `V` as the program writes it ([Section 8.2](#82-forward-evaluation-and-witnesses));
1937
- - `Args` is the same for every such variable of the step, and is the list of
1938
- the values of the heads' variables, in order of their first occurrence in
1939
- the heads, omitting a value only when it holds a fresh parameter of this
1940
- firing, as established below. The spelling of a Skolem term alone MUST
1941
- NOT establish that it is fresh.
1942
-
1943
- **Which values belong in `Args`.** A value containing
1944
- `skolem(N, _, Args)` is a **candidate** for omission.
1945
- Values of variables occurring only in the head hold the witnesses checked
1946
- above. If any other head variable's value is omitted, the checker MUST
1947
- establish its **parametric provenance**:
1948
-
1949
- 1. In the instantiated full head and premises, replace each distinct term
1950
- `skolem(N, Name, Args)` by one fresh variable, using the same replacement
1951
- throughout. Distinct such terms receive distinct variables, disjoint
1952
- from all source and document variables. The abstracted head and premises
1953
- together MUST still be an instance of the source clause, with all
1954
- variable sharing preserved and without further instantiating their terms.
1955
- A literal Skolem-shaped constant of the source is therefore fixed data,
1956
- not a parameter the proof may abstract.
1957
- 2. Each affected premise MUST have evidence under this same abstraction.
1958
- Follow the recorded uses: backward clauses MUST still satisfy C1,
1959
- inspection steps the source-instance check of C1, primitives C5, and
1960
- controls the composition check of C5. An unrecorded source fact is
1961
- available as in C4. A previously derived forward fact is fixed evidence:
1962
- the abstracted premise MUST be an instance of that fact, allowing only
1963
- its existing universal variables to be instantiated. Its ground terms
1964
- MUST NOT be generalized. Each original step remains subject to its own
1965
- checks, including C8 and C2; this traversal supplies no missing derivation.
1966
- 3. Captured values and enclosing generator projections of a premise's
1967
- derived backward rule instance are fixed before its use and MUST NOT
1968
- change under abstraction. Likewise, this firing's captures MUST NOT
1969
- change. A backward caller cannot make an earlier firing's data fresh.
1970
- 4. An unchanged boundary may use its original evidence or obligation. A
1971
- changed boundary MUST already be settled in its original form, and its
1972
- abstracted form MUST also be settled by [Section 11.12](#1112-c9-search-closure), consulting only
1973
- tables and listings the original boundary rests on. A missing or
1974
- incomplete certificate fails provenance; an obligation for a specific
1975
- boundary MUST NOT silently become an obligation for a stronger one.
1976
-
1977
- Failure of this provenance check is C8, not C1: the original step may be a
1978
- valid clause instance while proposing the wrong witness context. Provenance
1979
- rechecks do not add steps or change the C1, C5 or C9 counts. They establish
1980
- that the displayed firing's evidence permits fresh parameters, not that the
1981
- firing is the one an original open call would select ([Section 11.2](#112-operational-query-fidelity)).
1982
-
1983
- **Groundness.** When a forward clause has head-only variables, its full
1984
- head under the step's substitution MUST be ground. A step that leaves such
1985
- a variable unbound, or bound to anything but its Skolem term, fails C8
1986
- rather than C1. A generic inspection pattern cannot share one existential
1987
- witness across all its instances ([Section 6.3](#63-source-rule-inspection)).
1988
-
1989
- **Generators and captures.** For a generator, use its scope projection
1990
- ([Section 6.2](#62-inline-rule-templates)) as the head for this
1991
- check. For every derived clause step, including a backward clause step, the
1992
- checker MUST also perform C8 for each enclosing generator under the same
1993
- substitution. A forged outer witness cannot be authorized by using it in a
1994
- backward conclusion. Variables supplied by the instance's captures are not
1995
- new witnesses of the derived clause.
1996
-
1997
- For an appended forward clause of [Section 6.2](#62-inline-rule-templates), prepend the capture list,
1998
- instantiated under the step's substitution, as one element of `Args`, as
1999
- required by [Section 8.2](#82-forward-evaluation-and-witnesses). The checker MUST compute this from the source
2000
- template's capture list and the substitution, not from the witness term.
2001
-
2002
- **Coverage.** A variable of the head that also occurs in the body is not
2003
- checked by C8, even when the body leaves it unbound; its value comes from
2004
- the uses, which other conditions check. Its effect on a head-only
2005
- variable's witness context is nevertheless subject to the provenance check
2006
- above. A step with no witnesses in its own forward head or enclosing
2007
- generators is not covered by C8.
2008
-
2009
- ### 11.12 C9 Search closure
2010
-
2011
- C9 establishes that a recorded negation or collection has the stated search
2012
- result. A step's uses alone cannot show that nothing matches, or that no
2013
- result was omitted. The **search certificate** supplies complete answer
2014
- tables and forward-fact listings for the checker to validate
2015
- ([Section 10.4](#104-search-certificates)):
2016
-
2017
- | Statement in the proof | Claim to check |
2018
- | --- | --- |
2019
- | `searched(Call, Answers)` | These are all answers to this call, in search order, repetitions included. |
2020
- | `derived(Pattern, Facts)` | These are the forward-derived facts for this relation; each has evidence, and none required by closure is omitted. |
2021
-
2022
- A boundary is **settled** only when the certificate is supported, complete
2023
- for its search, applicable under the restrictions below, and agrees with
2024
- the boundary's result. C9 checks the goal as displayed in the step. C10
2025
- separately checks the bindings with which the original question called it.
2026
-
2027
- **Answering calls from the certificate.** Search the boundary's inner goal
2028
- `G` according to [Section 8.1](#81-goal-search), with these changes:
2029
-
2030
- - Answer a relation defined by backward rules or concluded by forward
2031
- rules from the `searched/2` table whose call is identical up to variable
2032
- renaming. Rename each answer apart before using it.
2033
- - Answer a relation defined by source facts alone from those facts, in
2034
- clause order; it needs no table.
2035
- - Answer an inspection goal from the catalogue of [Section 6.3](#63-source-rule-inspection),
2036
- in source order, each rule renamed apart; it needs no table.
2037
- - Use a listed derived pattern ([Section 6.3](#63-source-rule-inspection))
2038
- renamed apart, as it is freshened at every use.
2039
- - Inside this search, negation treats unbound variables as anonymous.
2040
- This does not establish that a named variable was bound at the original
2041
- call; that is a C10 requirement.
2042
-
2043
- **Expanding and checking tables.** The **expansion** of a call is one level
2044
- of the search of [Section 8.1](#81-goal-search): try its relation's listed
2045
- forward facts in listing order, then source facts and backward rules in
2046
- clause order. Search each rule's body in its place, answering inner calls
2047
- as above. Each table MUST equal its expansion: the same number of answers,
2048
- each identical up to variable renaming to the answer in the same position.
2049
-
2050
- A backward rule appended by a template ([Section 6.2](#62-inline-rule-templates))
2051
- answers through its instances. A rule whose enclosing generators are not
2052
- all in the program has none. Otherwise, search the generator's part of its
2053
- body first, with none of the call's bindings, and take its solutions in
2054
- order, skipping a solution whose captured values are identical to an
2055
- earlier one's. For each, unify the call with the head and search the
2056
- template's part of the body. This is the order in which the run made the
2057
- instances only when the generator's search consults no table and no
2058
- listing, and its generators have no guard and introduce no witnesses;
2059
- otherwise the search is unsettled. Captured values that are not ground
2060
- also leave it unsettled.
2061
-
2062
- The boundary **rests on** every table and listing its search consults,
2063
- including those consulted transitively by table expansions and listing
2064
- closure checks. No table it rests on may depend on itself through the
2065
- tables consulted by its expansion.
2066
-
2067
- The same dependency graph establishes **answer order**. A table has
2068
- certified answer order exactly when its expansion consults no forward
2069
- listing and every table it depends on has certified answer order.
2070
-
2071
- **Supporting and closing listings.** Every listed fact MUST have a step,
2072
- have the listing's name and arity, and be ground, unless the program
2073
- inspects source rules and the fact is a derived pattern
2074
- ([Section 6.3](#63-source-rule-inspection)): its step is then the step of a
2075
- pattern identical to it up to the renaming of its variables. Its step is
2076
- subject to the other proof conditions. A listing is **closed** when, for
2077
- every forward rule with a head of its relation, each solution of the body
2078
- under the certificate gives head instances that are listed, a pattern up to
2079
- the renaming of its variables, or are ground source facts. Bind the rule's
2080
- witnesses to their specified Skolem terms when checking this closure
2081
- ([Section 8.2](#82-forward-evaluation-and-witnesses)). A head instance that
2082
- keeps a variable no inspection or listed pattern supplied leaves the
2083
- boundary unsettled: the run would have bound it to a Skolem term.
2084
-
2085
- Support rules out invented facts; closure rules out omitted facts. For
2086
- example, an empty answer table is insufficient if a forward rule could
2087
- derive a matching fact left out of the listing.
2088
-
2089
- **Comparing the result.** With all relied-on evidence checked, settlement
2090
- requires:
2091
-
2092
- - For `not(G)`, `G` has no solution.
2093
- - For `findall(T, G, L)`, `L` is an instance of the list of instances of
2094
- `T`, one per solution of `G`, in order, each renamed apart. Repeated
2095
- solutions remain repeated list elements. The instance test allows later
2096
- goals to have bound variables in the copied results.
2097
- - For `findall_sorted(T, G, L)`, `L` is an instance of that list sorted as
2098
- [Section 4.2](#42-controls) specifies.
2099
-
2100
- **Certificate limits.** Settlement also requires all of the following:
2101
-
2102
- - Every table used by `findall` or `once`, or by `findall_sorted` whose
2103
- results include a nonground item, MUST have certified answer order. This
2104
- applies in the boundary's search, relied-on tables and closure checks.
2105
- Support and closure do not establish the publication order of forward
2106
- facts. A `findall_sorted` of ground items depends on the solutions and
2107
- how often each occurs, not on their order.
2108
- - No consulted listing's relation is concluded by a forward rule within a
2109
- template's scope ([Section 6.2](#62-inline-rule-templates)) that
2110
- introduces witnesses, or whose generators have a guard or introduce
2111
- witnesses. A rule appended by a template fires once for each instance, so
2112
- closure searches its whole body, generator's part first. A rule whose
2113
- enclosing generators are not all in the program never fires, and closure
2114
- skips it.
2115
-
2116
- For example, a proof of a negation can contain this step and certificate:
2117
-
2118
- ```js
2119
- step(not(nonpacifist('ada')), 'absent', {}, [])
1533
+ For a program with negation, "follows" is relative to the facts the
1534
+ listings hold: the check establishes that they are supported by replayed
1535
+ firings, closed under the forward rules and consistent with every negation
1536
+ decided from them. A stratified or chain-stratified program has exactly one
1537
+ such set of facts ([Section 7.4](#74-negation-and-collection)), its result, so the listings are the facts the
1538
+ original calls consult.
2120
1539
 
2121
- derived(nonpacifist(A), [nonpacifist('nixon')])
2122
- searched(nonpacifist('ada'), [])
2123
- ```
1540
+ A checked proof does not establish:
2124
1541
 
2125
- The table expands to no answers: the listed fact does not match Ada and no
2126
- backward rule defines `nonpacifist/1`. The only forward rule for that
2127
- relation derives Nixon's fact, which is listed and has a step elsewhere in
2128
- the proof. Thus the listing is supported and closed, and the negation is
2129
- settled. Replacing the listing with `[]` would fail closure.
1542
+ - that the claims of a halted proof, which contain `'false'`, are every
1543
+ answer;
1544
+ - that the program derives no `'false'`;
1545
+ - that execution of the whole program terminates or reaches every question;
1546
+ - that the supplied program expresses the author's intended model.
2130
1547
 
2131
- For a backward-defined relation `p/1` whose ordered answers are `p('a')`
2132
- and `p('b')`, a collection can instead have these entries:
1548
+ Some results cannot be established by this proof format, and their proofs
1549
+ do not check: a first answer or a collection whose order rests on several
1550
+ derived facts, whose publication order the format does not show; a firing of a
1551
+ restricted rule, whose guard held before the firing but not in the final
1552
+ facts ([Section 7.2](#72-variables-and-witnesses)); a comparison `compare/3` of terms that are not ground,
1553
+ since renaming a table need not preserve the order of variable names; and a
1554
+ search whose table would not close.
1555
+
1556
+ ### 11.2 Original questions
1557
+
1558
+ The **original questions** are the external goals, if any; otherwise, if any
1559
+ forward rule has the head `'true'`, those rules' bodies as conjunctions;
1560
+ otherwise the ordinary forward heads other than `'false'`. Questions
1561
+ identical up to renaming that preserves anonymous-variable status count once.
1562
+ They are not instantiated with the proof's final bindings.
1563
+
1564
+ A proof whose claims contain `'false'` is **halted** and has no original
1565
+ questions ([Section 11.5](#115-deciding-the-claims)).
1566
+
1567
+ ### 11.3 Answering calls
1568
+
1569
+ Each original question is answered by searching it according to [Section 8.1](#81-goal-search),
1570
+ with these changes:
1571
+
1572
+ - A call to a relation defined by backward rules or concluded by forward
1573
+ rules is answered from the call table whose call is identical to it up to
1574
+ renaming that preserves anonymous-variable status. Each answer is renamed
1575
+ apart before it is used. A call without a table cannot be established.
1576
+ - A call to a relation defined by source facts alone is answered from those
1577
+ facts, in clause order; it needs no table.
1578
+ - An inspection goal is answered from the catalogue of [Section 6.3](#63-source-rule-inspection),
1579
+ in source order, each rule renamed apart; it needs no table.
1580
+ - Primitives run as [Section 4.3](#43-primitives) specifies, and `not`, `once` and the
1581
+ collections keep their meanings of [Section 4.2](#42-controls), including the error for a
1582
+ negation with an unbound named variable. A comparison `compare/3` with
1583
+ either compared term not ground cannot be established. A search that
1584
+ raises an error fails the check.
1585
+
1586
+ The **expansion** of a call is one level of the search of [Section 8.1](#81-goal-search):
1587
+ try its relation's listed facts in listing order, each derived pattern
1588
+ renamed apart, then source facts and backward rules in clause order,
1589
+ searching each rule's body in its place and answering inner calls as above.
1590
+ Each consulted call table MUST equal its expansion: the same number of
1591
+ answers, each identical up to renaming that preserves anonymous-variable
1592
+ status to the answer in the same position.
1593
+
1594
+ A backward rule appended by a template ([Section 6.2](#62-inline-rule-templates)) answers through its
1595
+ instances. A rule whose enclosing generators are not all in the program has
1596
+ none. Otherwise, search the generator's part of its body first, with none of
1597
+ the call's bindings, and take its solutions in order, skipping a solution
1598
+ whose captured values are identical to an earlier one's. For each, unify the
1599
+ call with the head and search the template's part of the body. This is the
1600
+ order in which the run made the instances only when the generator's search
1601
+ consults no table and no listing, and its generators have no guard and
1602
+ introduce no witnesses; otherwise the search cannot be established. Captured
1603
+ values that are not ground cannot be established either.
1604
+
1605
+ The tables a search consults, directly or through the expansions of other
1606
+ tables and the closure of listings, MUST NOT depend on themselves. A table
1607
+ has **certified answer order** exactly when it has at most one distinct
1608
+ answer, or its expansion consults no listing and every table it depends on
1609
+ has certified answer order. A search
1610
+ whose `once`, `findall`, or `findall_sorted` with a result that is not
1611
+ ground, consults a table without certified answer order cannot be
1612
+ established: support and closure do not establish the order in which forward
1613
+ facts were published. A `findall_sorted` of ground items depends on the
1614
+ solutions and how often each occurs, not on their order.
1615
+
1616
+ Every consulted listing MUST be closed. Each of its facts has its relation's
1617
+ name and arity and is ground, unless the program inspects source rules and
1618
+ the fact is a derived pattern. A listing is **closed** when, for every
1619
+ forward rule with a head of its relation, each solution of the rule's body
1620
+ under the certificate gives head instances that are listed (a pattern up to
1621
+ the renaming of its variables) or are ground source facts. Bind the rule's
1622
+ witnesses to their Skolem terms when checking this ([Section 8.2](#82-forward-evaluation-and-witnesses)). A head
1623
+ instance that is not ground cannot be established unless the program inspects
1624
+ source rules; it is then a derived pattern the listing must hold, and its
1625
+ replay decides whether an inspection supplied its variables. A rule appended by a template
1626
+ searches its whole body, generator's part first; one whose enclosing
1627
+ generators are not all in the program never fires and is skipped. A rule
1628
+ within a template's scope that introduces witnesses, or whose generators
1629
+ have a guard or introduce witnesses, cannot be established.
1630
+
1631
+ For example, with `fact(p('a'), p('b'))`, `implied_by(r(X), p(X))` and the
1632
+ question `r(X)`, the certificate holds the call table:
2133
1633
 
2134
1634
  ```js
2135
- step(findall(A, p(A), ['a', 'b']), 'collected', {}, [])
2136
-
2137
- searched(p(B), [p('a'), p('b')])
1635
+ called(r(A), [r('a'), r('b')])
2138
1636
  ```
2139
1637
 
2140
- The checker expands `p(B)` against its source definition to validate the
2141
- table, then copies the template once per answer and compares the resulting
2142
- `['a', 'b']` with the step's list.
1638
+ The checker expands `r(X)` against its source definition: the call `p(X)`
1639
+ is answered from the facts, giving `r('a')` and `r('b')`, which equal the
1640
+ table. A table that left out `r('b')` or listed `r('c')` fails.
2143
1641
 
2144
- **Failures and obligations.** The checker distinguishes a false certificate
2145
- from evidence that cannot settle the boundary:
1642
+ ### 11.4 Replaying derived facts
2146
1643
 
2147
- | Finding | Result |
2148
- | --- | --- |
2149
- | 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. |
2150
- | A needed table or listing is missing, evidence is incomplete, or a certificate limit above applies. | The boundary is not settled. |
2151
- | A collection's list disagrees with the certificate's search results. | The boundary is not settled; C6 may refute it from available evidence. |
2152
- | A listing contains a nonground fact, and the program inspects no source rules. | At the first such fact in listing order, leave the boundary unsettled rather than fail it. |
2153
-
2154
- An incorrect table or listing is reported once, for the first boundary
2155
- resting on it. Any boundary C9 did not settle counts as trusted, including
2156
- one that failed C9; this count does not cancel the failure. C6 confronts
2157
- boundaries C9 neither settled nor refuted. An unresolved boundary remains
2158
- an obligation, and strict checking rejects it.
2159
-
2160
- A collection mismatch alone is left unsettled because a step shows the
2161
- goal after the whole solution's substitution; later bindings may have
2162
- specialized the goal that was actually searched. C10 checks collection
2163
- against the original call and cannot use that final substitution to
2164
- specialize the question.
2165
-
2166
- ### 11.13 C10 Call fidelity
2167
-
2168
- C10 checks that the original question can return each claimed answer. It
2169
- uses `called(Call, Answers)` tables in the proof, distinct from C9's
2170
- `searched/2` tables. Both checks share applicable `derived/2` listings.
2171
- Every proof check includes C10; unresolved evidence leaves a call-fidelity
2172
- obligation rather than an unconditional `checked` verdict.
2173
-
2174
- **Selecting the original questions.** Use the external goals, if any.
2175
- Otherwise, if any forward rule has a head `'true'`, use those rules' bodies
2176
- as conjunctions. Otherwise use the ordinary forward heads, excluding
2177
- `'false'`. Do not instantiate these questions with the proof's final
2178
- bindings. Every question needs a certificate, including one of which no
2179
- claim is an instance: its answers must still be shown to be claimed.
2180
-
2181
- When the claims contain `'false'`, C10 is inapplicable: it covers no
2182
- answers and adds no call-fidelity obligations for that halted proof.
2183
- A proof without claims certifies that a question has no answers only
2184
- through that question's certificate.
2185
-
2186
- **Checking calls.** For each relevant original question, use the one-level
2187
- expansion and closure checks of [Section 11.12](#1112-c9-search-closure),
2188
- with these differences:
2189
-
2190
- 1. Inner relation calls use `called/2` rather than `searched/2`. Call and
2191
- answer comparison preserves anonymous-variable status ([Section 10.5](#105-call-fidelity-certificates)).
2192
- Facts alone and primitives need no table, as in C9. Source clauses,
2193
- freshened apart, determine the bindings passed between ordered premises;
2194
- the final values displayed by a logical step are not inputs to that search.
2195
- 2. Negation MUST enforce [Section 4.2](#42-controls)'s binding restriction at the actual
2196
- call. C9's treatment of an unbound named variable as anonymous MUST NOT
2197
- be used. A source search that raises an error fails its certificate.
2198
- 3. `once` and the collections keep their [Section 4.2](#42-controls) meanings, so the first answer
2199
- or collected answers come from the actual inner call. [Section 11.12](#1112-c9-search-closure)'s
2200
- restriction on order-sensitive uses of derived listings still applies.
2201
- The order of unrelated answers of an ordinary question need not be
2202
- established to check membership of a claim.
2203
- 4. A comparison `compare/3` with either compared term nonground is not
2204
- supported by this certificate format: alpha renaming of a table need
2205
- not preserve the order of variable names. Such a search leaves call fidelity unproved.
2206
- 5. Each fact of every consulted forward listing MUST replay its recorded
2207
- firing as specified below. Support and closure alone MUST NOT certify
2208
- bindings or control choices that the recorded firing never makes.
2209
-
2210
- For the `once` example in [Section 11.2](#112-operational-query-fidelity),
2211
- the call certificate contains:
2212
-
2213
- ```js
2214
- called(q(A), [q('a')])
2215
- called(p(B), [p('a'), p('b')])
2216
- ```
1644
+ Support and closure show which facts a listing must hold, but not that each
1645
+ was derived by a firing the run could make. Every fact of every consulted
1646
+ listing MUST therefore **replay** the firing its step records, and so MUST
1647
+ each claim of a halted proof.
2217
1648
 
2218
- The checker validates the first table by expanding the original question
2219
- `q(X)` using the source rule. Its inner call is `p(X)` with `X` unbound.
2220
- The second table, checked against `p`'s source definition, supplies `'a'`
2221
- first, and `once` selects it. Thus `q('a')` is an answer and `q('b')` is
2222
- excluded. Substituting `called(p('b'), [p('b')])` cannot establish the
2223
- different call `p(X)`.
2224
-
2225
- **Replaying forward listings.** In addition to the support and closure
2226
- checks of C9, every fact of every consulted listing MUST replay. Replay
2227
- follows the source rule and the step's uses in order, starting with no
2228
- bindings. It checks the bindings at each premise, rather than assuming
2229
- the proof's final substitution was already available. It MUST NOT call a
2230
- reasoner or supply a missing derivation.
2231
-
2232
- A listing with a fact that does not replay is unsupported for C10 and
2233
- leaves the obligations specified below. C1–C9 still check its steps normally.
2234
-
2235
- A fact's step MUST cite a forward rule that is not restricted and introduces
2236
- no witnesses within a template's scope. For a rule appended by a template,
1649
+ A fact's step MUST cite a forward rule that has no guard and introduces no
1650
+ witnesses within a template's scope. For a rule appended by a template,
2237
1651
  every enclosing generator MUST belong to the program and have no guard or
2238
- witnesses. Replay checks each body goal against the step's corresponding
2239
- use as follows:
2240
-
2241
- - A primitive runs on the bindings of that point of the search. Its first
2242
- solution under which the goal can still unify with the use is taken.
2243
- `compare/3` with a nonground compared term does not replay.
2244
- - `once/1`, `not/1`, `findall/3` and `findall_sorted/3` take the answers of the goal, as it
2245
- stands at that point, from the call tables and listings, as in checking
2246
- the original calls. A negation with an unbound named variable does not
2247
- replay, and neither does a first answer or a collection whose order rests
2248
- on a listing. The first answer is taken, and the goal MUST still unify
2249
- with the use.
2250
- - `call/1` and a disjunction replay the goals their `'control'` step uses,
2251
- for a disjunction from the side those uses form.
2252
- - A call to an ordinary relation follows the use's step, whose rule MUST
2253
- meet the conditions above other than direction. A forward rule's
2254
- conclusion MUST itself replay, and is then unified with the goal. A
2255
- source fact, renamed apart, is unified with the goal. A backward rule,
2256
- renamed apart, has its head unified with the goal and its body replayed
2257
- against its step's uses. For a backward rule appended by a template, the
2258
- generator's part of the body replays first, before the head meets the
2259
- goal, and the template's part after. A use with no step is unified with a source fact
2260
- of the relation, renamed apart. A cycle through recorded uses does not
2261
- replay, as required by C2.
2262
- - An inspection follows its use's `source(N)` step: rule `N` of the
2263
- catalogue, renamed apart, is unified with the goal.
1652
+ witnesses. Rename the rule apart and replay each body goal, in order and
1653
+ starting with no bindings, against the step's corresponding use:
1654
+
1655
+ - A primitive runs on the bindings of that point. Its first solution under
1656
+ which the goal can still unify with the use is taken. `compare/3` with a
1657
+ compared term that is not ground does not replay.
1658
+ - `once/1`, `not/1`, `findall/3` and `findall_sorted/3` take the answers of
1659
+ the goal, as it stands at that point, from the certificate, as in
1660
+ [Section 11.3](#113-answering-calls). A negation with an unbound named variable does not replay,
1661
+ and neither does a first answer or a collection whose order rests on a
1662
+ listing. The first answer is taken, and the goal MUST still unify with the
1663
+ use.
1664
+ - Any other goal, as it stands at that point, is answered from the
1665
+ certificate as in [Section 11.3](#113-answering-calls), when that search consults no listing:
1666
+ the answer identical to the use up to renaming is taken, or else the first
1667
+ answer under which the goal can still unify with the use. An answer's
1668
+ variables are a derived pattern's only when its search read the catalogue
1669
+ of [Section 6.3](#63-source-rule-inspection) or a listed pattern.
1670
+ - Otherwise the goal follows the use's step. A call to a relation whose step
1671
+ cites a forward rule replays that rule's fact in turn, which is then unified
1672
+ with the goal. One citing a backward rule, renamed apart, has its head
1673
+ unified with the goal and its body replayed against the step's uses; for
1674
+ a backward rule appended by a template, the generator's part of the body
1675
+ replays first, before the head meets the goal, and the template's part
1676
+ after. `call/1` and a disjunction replay the goals their `'control'` step
1677
+ uses, for a disjunction from the side those uses form. A step whose replay
1678
+ meets the same step again does not replay, so derived facts support each
1679
+ other only without a cycle.
2264
1680
  - After each goal, the goal MUST still unify with its use, since a step
2265
1681
  shows its goals after the whole solution's bindings.
2266
1682
 
2267
- Each witness is then bound to its Skolem term
2268
- ([Section 8.2](#82-forward-evaluation-and-witnesses)), and the fact MUST be
2269
- identical to an instance of one of the rule's heads, or for a derived
2270
- pattern identical up to the renaming of its variables, every one of which an
2271
- inspection or a listed pattern supplied. Replay re-executes each
2272
- recorded firing, so a test of whether a variable is bound sees what a search
2273
- sees, a first answer is the search's first answer, and host math is
2274
- computed rather than accepted within a tolerance. C2 keeps the steps a
2275
- replay follows acyclic.
2276
-
2277
- Supported facts and closed listings then establish the least ground
2278
- closure and, with negations, a set of facts that is supported, closed under
2279
- the rules and consistent with each negation, every negation being decided
2280
- by the listed facts alone. A stratified or chain-stratified program has
2281
- exactly one such set ([Section 7.4](#74-negation-and-collection)), its
2282
- result, so the listings are the facts the original calls consult. A
2283
- collection or first answer over facts that forward rules derive depends on
2284
- their publication order, which this format does not establish, and a
2285
- restricted rule's firings can depend on the order of rule applications:
2286
- both leave call fidelity unproved.
2287
-
2288
- **Deciding claims.** Every relevant call certificate MUST be valid. Each
2289
- claim MUST be identical, up to variable renaming, to an answer of at least
2290
- one corresponding original question. Being an instance of a more general
2291
- answer is insufficient: a claim `p('a')` cannot replace an original call's
2292
- actual universal answer `p(A)`.
2293
-
2294
- For each claim, apply these outcomes:
2295
-
2296
- | Evidence for matching original questions | C10 result |
2297
- | --- | --- |
2298
- | Any corresponding question has a false certificate. | Fail the claim once. |
2299
- | No corresponding certificate is false, and at least one complete certificate returns the claim up to renaming. | Establish call fidelity for the claim. |
2300
- | Every matching question has a complete certificate, and all exclude the claim. | Fail the claim once. |
2301
- | No certificate establishes the claim, and an applicable certificate is missing, incomplete or unsupported. | Leave `obligation('call_fidelity', 'original_call', Claim)`. |
2302
-
2303
- An unresolved alternative question leaves an obligation unless another
2304
- question certifies the answer. With no applicable complete certificate,
2305
- call fidelity also remains an obligation. When trusted obligations are
2306
- forbidden, each such obligation fails C10. C10 does not discharge C6/C9
2307
- obligations: both the recorded boundary and the original call need their
2308
- respective evidence.
2309
-
2310
- **Answer completeness.** A valid certificate for an original question
2311
- gives all of its answers, so C10 also checks the converse: each answer is
2312
- claimed. The **required answers** of a question are its certificate's
2313
- answers when the conclusions answer goals or `query()` rules. When the
2314
- conclusions are the derived facts ([Section 8.6](#86-reported-conclusions)),
2315
- they are the facts of the question's relation in its consulted listing
2316
- that are instances of the question, since a source fact or a backward
2317
- answer is no derived fact. For each original question, in question order:
2318
-
2319
- | Evidence for the question | C10 result |
2320
- | --- | --- |
2321
- | Its certificate is false. | Fail the question once, unless a claim that is an instance of it already failed for that certificate. |
2322
- | Its certificate is valid and complete, and every required answer is identical, up to renaming, to a claim. | Establish answer completeness for the question. |
2323
- | Its certificate is valid and complete, and a required answer is not claimed. | Fail once for each required answer not claimed. |
2324
- | Its certificate is missing, incomplete or unsupported. | Leave `obligation('call_fidelity', 'all_answers', Question)`. |
1683
+ Each witness is then bound to its Skolem term ([Section 8.2](#82-forward-evaluation-and-witnesses)), computed from the
1684
+ values of the heads' other variables, which MUST be ground. Once the whole
1685
+ firing has replayed, the fact with the rule's body instance MUST be one of
1686
+ the rule's heads with its body, and each step followed within the firing its
1687
+ rule's head with its body, identical up to the renaming of variables; a
1688
+ derived pattern's variables are all supplied by an inspection or a listed
1689
+ pattern. Each step's bindings MUST name distinct variables of its rule,
1690
+ whose values unify with what the replay gave them.
1691
+
1692
+ Replay re-executes each recorded firing, so a test of whether a variable is
1693
+ bound sees what a search sees, a first answer is the search's first answer,
1694
+ and arithmetic is computed rather than accepted.
1695
+
1696
+ ### 11.5 Deciding the claims
1697
+
1698
+ For a proof that is not halted:
1699
+
1700
+ - Each original question MUST be answered by its certificate
1701
+ ([Section 11.3](#113-answering-calls)), and every fact of the listings its search consults MUST
1702
+ replay.
1703
+ - Each claim MUST be an instance of an original question, and identical, up
1704
+ to renaming, to an answer of such a question. Being an instance of a more
1705
+ general answer is insufficient: a claim `p('a')` cannot replace an
1706
+ answer `p(A)`.
1707
+ - Every **required answer** of each question MUST be identical, up to
1708
+ renaming, to a claim. The required answers are the question's answers when
1709
+ the conclusions answer goals or `query()` rules. When the conclusions are
1710
+ the derived facts ([Section 8.6](#86-reported-conclusions)), they are the facts of the question's
1711
+ relation in its listing that are instances of the question, since a source
1712
+ fact or a backward answer is no derived fact.
2325
1713
 
2326
1714
  For example, with `fact(p('a'), p('b'))` and `query(p(X))`, a proof that
2327
- claims only `p('a')` fails C10 for `p('b')`, though `p('a')` follows. With
1715
+ claims only `p('a')` fails, though `p('a')` follows. With
2328
1716
  `implied_by(r(X), p(X))` and `query(r('c'))`, the proof without claims
2329
- holding `called(r('c'), [])` establishes that the question has no answers;
2330
- an empty document leaves `r('c')` as an obligation. A question answered
2331
- from source facts alone needs no table, so its required answers come from
2332
- the facts.
2333
-
2334
- **Limits and production of certificates.** The certificate format requires
2335
- complete tables, even for a relation called under `once`. Later recursion
2336
- or an error may prevent a table from closing although `once` itself
2337
- terminates. A certificate for just the searched prefix is not defined, so
2338
- call fidelity then remains unproved.
2339
-
2340
- A reasoner MUST attempt call-fidelity certification for every proof it
2341
- generates ([Section 8.7](#87-proof-generation)). It MAY bound this auxiliary
2342
- production. Exceeding that bound leaves an obligation and MUST NOT change
2343
- the run's answers. The bounds are implementation-defined, so conforming
2344
- reasoners may differ in which generated claims carry call-fidelity
2345
- obligations. A checker MUST
2346
- decide each supplied certificate from its contents and the source program,
2347
- without assuming the limits or decisions of the processor that produced it.
2348
-
2349
- **Relevance and counts.** Call tables and their supporting listings serve
2350
- the claims for C7; their listed facts are reachable through that evidence.
2351
- C10 does not change C1–C9 covered counts. Its own covered count includes
2352
- claims whose call fidelity is established or refuted and questions whose
2353
- answer completeness is established or refuted, excluding unresolved ones.
2354
- Report failures in claim order, then in question order, after checking
2355
- boundaries and before C7 and C2 ([Section 12](#12-check-reports)).
2356
-
2357
- These checks establish that the claims are exactly the answers of the
2358
- original questions, up to renaming. They do not establish that preceding
2359
- distinct questions terminated.
2360
-
2361
- ### 11.14 Counts and validity
2362
-
2363
- The report distinguishes how many items a condition covered from how many
2364
- failures it found. A zero failure count does not by itself establish a
2365
- negation, collection or original call that remains an obligation.
2366
-
2367
- | Condition | Covered |
2368
- | --- | --- |
2369
- | C1 resolution | `clause` and `source` steps that passed C1 |
2370
- | C2 well_founded | steps |
2371
- | C3 justification | steps |
2372
- | C4 coverage | claims plus uses |
2373
- | C5 re_decision | `'builtin'`, `called(Called)` and `'control'` steps that passed C5 |
2374
- | C6 boundary_consistency | boundaries not settled that the evidence decided |
2375
- | C7 relevance | claims plus steps |
2376
- | C8 witness_integrity | `clause` steps with witnesses in their forward head or enclosing generators that passed C8 |
2377
- | C9 search_closure | boundaries their search certificate settled or refuted |
2378
- | C10 call_fidelity | claims whose call fidelity, and questions whose answer completeness, is established or refuted |
2379
-
2380
- A check also records these totals:
2381
-
2382
- - **steps**: the steps it read;
2383
- - **claims**: the claims it read;
2384
- - **verified**: the `clause` and `source` inspection steps verified by C1;
2385
- - **recomputed**: the `'builtin'` and `called(Called)` steps that passed C5;
2386
- - **composed**: the `'control'` steps that passed C5;
2387
- - **trusted**: the `'absent'` and `'collected'` steps C9 did not settle,
2388
- plus each claim whose call fidelity and each question whose answer
2389
- completeness remains unproved by C10.
2390
-
2391
- A proof is **valid** when no condition failed. It is valid *conditional on*
2392
- any obligations that remain. Section [12](#12-check-reports) specifies the
2393
- report format and verdict; strict checking forbids those obligations.
1717
+ holding `called(r('c'), [])` establishes that the question has no answers.
1718
+
1719
+ A halted run stopped before its fixpoint, so its questions have no certified
1720
+ answers. For a halted proof, each claim, `'false'` included, MUST replay as a
1721
+ derived fact ([Section 11.4](#114-replaying-derived-facts)), its step citing the forward rule or
1722
+ `contradiction` that concluded it. A listing its replays consult MUST still
1723
+ be closed, so a negation or collection over a relation the halt left
1724
+ unfinished cannot be established.
1725
+
1726
+ ### 11.6 Nothing unused
1727
+
1728
+ Every statement of a proof MUST be used by its check: each step followed by
1729
+ a replay, each call table consulted by a search, an expansion, a closure or a
1730
+ replay, and each listing consulted by one of those. A step, table or listing
1731
+ the check does not use fails it, so a proof carries no evidence that goes
1732
+ unchecked.
2394
1733
 
2395
1734
  ## 12. Check Reports
2396
1735
 
2397
- A check report is a document ([Section 9.1](#91-accepted-document-syntax)) beginning with the proof's claims,
2398
- in proof order, in canonical text, one per line, followed by a blank line and
2399
- the following report facts, one per line:
2400
-
2401
- 1. `condition(Id, Name, Outcome, Covered)` for C1 to C10, where `Outcome` is
2402
- `'ok'` or `failed(N)`, `N` the number of that condition's failures;
2403
- 2. `failure(Condition, Subject, Detail)` per failure, where `Subject` is the
2404
- term concerned or `'proof_document'`, and `Detail` an atom;
2405
- 3. `obligation(Kind, 'theory_scoped', Goal)` per trusted boundary, in step
2406
- order, where `Kind` is `'absent'` or `'collected'`, followed by
2407
- `obligation('call_fidelity', 'original_call', Claim)` per unresolved claim,
2408
- in claim order, then `obligation('call_fidelity', 'all_answers', Question)`
2409
- per question whose answer completeness is unresolved, in question order;
2410
- 4. `steps(N)`, `verified(N)`, `recomputed(N)`, `composed(N)`, `trusted(N)`,
2411
- `claims(N)`, the counts of [Section 11.14](#1114-counts-and-validity);
2412
- 5. `verdict(V)`, where `V` is `failed(N)` when `N` failures were recorded,
2413
- otherwise `'checked_with_obligations'` when there are obligations,
2414
- otherwise `'checked'`.
2415
-
2416
- Comments MUST identify these initial terms as checked answers only when the
2417
- report is valid with no obligations. A valid report with obligations MUST
2418
- label them as conditional on those obligations. A failed report MUST label
2419
- them as unverified claims; their inclusion does not validate them. A valid
2420
- report with no claims MUST say it establishes no conclusions, unless it is
2421
- valid with no obligations: it then establishes that the original questions
2422
- have no answers. Comments also explain the C1-C10 order, failures and
2423
- obligations when present, the statistics, and whether the verdict
2424
- establishes that the claims are every answer. Comments are informative
2425
- and MAY be worded differently. They are ignored when the document is read.
2426
-
2427
- Failures are listed in the order they are found: those of reading the
2428
- document ([Section 11.3](#113-reading-the-document)), in document order; C4 for each claim, in claim
2429
- order; then for each step, in document order, C4 for its uses and the C1, C3,
2430
- C5 or C8 failure of its justification; for each boundary, in step order, the
2431
- C9 failures of its search certificate in the order found, or else its C6
2432
- failure; C10 for each claim, then for each question; C7 for each claim, then
2433
- for each step, then for each table and listing, in document order; and C2.
2434
-
2435
- `Detail` is informative text identifying what failed; its wording is not
2436
- specified. It MUST NOT affect validity, counts or the condition reported.
2437
-
2438
- The initial answers keep the variable names of the proof. The variables of
2439
- each subsequent report fact are renamed `A`, `B`, ..., `Z`, `A1`, ... in order
2440
- of first occurrence. A report is ordinary data: `facts_from` ([Section 3.4](#34-statements))
2441
- states it as facts.
1736
+ A check report is a document ([Section 9.1](#91-accepted-document-syntax)) holding:
1737
+
1738
+ 1. a comment line, then the proof's claims, in proof order, in canonical
1739
+ text, one per line, keeping the variable names of the proof;
1740
+ 2. an empty line;
1741
+ 3. when the check failed, a comment line, then one `failure(Detail)` per
1742
+ failure, where `Detail` is an atom, then an empty line;
1743
+ 4. `verdict('checked')`, or `verdict(failed(N))` where `N`, at least 1, is
1744
+ the number of failure lines.
1745
+
1746
+ The comment MUST identify the claims as checked answers only when the proof
1747
+ checks, as following from a halted program when it checks and is halted, and
1748
+ as unverified claims when it fails; a proof without claims that checks MUST
1749
+ be said to establish that the original questions have no answers. Comments
1750
+ are informative and MAY be worded differently. The wording of `Detail`, and
1751
+ the number and order of failures, are informative: a conforming checker
1752
+ agrees on the verdict `checked` or failed. A report is ordinary data:
1753
+ `facts_from` ([Section 3.4](#34-statements)) states it as facts.
2442
1754
 
2443
1755
  ## 13. Conformance
2444
1756
 
@@ -2450,12 +1762,12 @@ without invoking a reasoner to complete the certificate. Conformance does
2450
1762
  not require a particular command-line interface, library API, browser
2451
1763
  interface or test runner.
2452
1764
 
2453
- Canonical term spelling, conclusion order, proof contents and report counts
2454
- are required as specified. Comment wording and failure `Detail` text are
2455
- informative. Fresh variable names are unspecified where [Section 2.4](#24-standard-order) says
2456
- so. Float results of `exp`, logarithms, trigonometric and hyperbolic
2457
- functions, and `pow` with floats MAY differ by one unit in the last place,
2458
- and C5 accepts a result of such a function within 4 units ([Section 11.8](#118-c5-re-decision)).
1765
+ Canonical term spelling, conclusion order, proof contents and the verdict
1766
+ are required as specified. Comment wording and failures are informative.
1767
+ Fresh variable names are unspecified where [Section 2.4](#24-standard-order) says so. Float results
1768
+ of `exp`, logarithms, trigonometric and hyperbolic functions, and `pow` with
1769
+ floats MAY differ by one unit in the last place; a proof whose answers rest
1770
+ on such a result MAY therefore not check on another implementation.
2459
1771
 
2460
1772
  Tests and example documents can provide evidence of conformance. Passing
2461
1773
  a test suite does not replace these requirements, and the behavior of an
@@ -2470,8 +1782,8 @@ without executing code. A deployment accepting untrusted documents SHOULD
2470
1782
  bound their size, nesting depth, processing time and memory, in addition to
2471
1783
  the reasoning bounds of [Section 8.3](#83-resource-bounds). A regular expression can take time exponential in
2472
1784
  the length of the text it searches ([Section 4.3](#43-primitives)), and no reasoning bound counts
2473
- that time, so a deployment running untrusted programs SHOULD also bound it. A valid proof establishes only the
2474
- claims and assumptions described in [Section 11.1](#111-scope-of-a-valid-proof).
1785
+ that time, so a deployment running untrusted programs SHOULD also bound it. A proof that checks establishes only the
1786
+ claims described in [Section 11.1](#111-what-a-checked-proof-establishes).
2475
1787
 
2476
1788
  ## Appendix A. Document Grammar
2477
1789
 
@@ -2535,19 +1847,12 @@ Its proof document ([Section 10](#10-proof-documents)):
2535
1847
  type('socrates', 'mortal')
2536
1848
  type('socrates', 'human')
2537
1849
 
2538
- // Clauses: the program clauses the steps cite, by clause number.
2539
- clause(1, fact(type('socrates', 'human')))
2540
- clause(2, fact(subclass_of('human', 'mortal')))
2541
- clause(3, implies([type(S, A), subclass_of(A, B)], type(S, B)))
2542
-
2543
- // Steps: each goal, what justifies it (a clause, a builtin, a control, an
2544
- // absence or a collection), the bindings and the goals it uses.
1850
+ // Steps: each derived fact and what it rests on: the clause or control that
1851
+ // justifies it, the bindings and the goals it uses.
2545
1852
  step(type('socrates', 'mortal'), clause(3), {S: 'socrates', A: 'human', B: 'mortal'}, [type('socrates', 'human'), subclass_of('human', 'mortal')])
2546
1853
  step(type('socrates', 'human'), clause(1), {}, [])
2547
- step(subclass_of('human', 'mortal'), clause(2), {}, [])
2548
1854
 
2549
- // Search certificate: derived facts and complete answers used to check
2550
- // negations, collections and the original questions.
1855
+ // Certificate: the derived facts and every answer of each call the questions make.
2551
1856
  derived(type(A, B), [type('socrates', 'mortal')])
2552
1857
  called(type(A, B), [type('socrates', 'mortal'), type('socrates', 'human')])
2553
1858
  ```
@@ -2555,31 +1860,9 @@ called(type(A, B), [type('socrates', 'mortal'), type('socrates', 'human')])
2555
1860
  Its check report ([Section 12](#12-check-reports)):
2556
1861
 
2557
1862
  ```js
2558
- // Checked answers: these follow from the input program.
1863
+ // Checked answers: these follow from the input program and are every answer of its questions.
2559
1864
  type('socrates', 'mortal')
2560
1865
  type('socrates', 'human')
2561
1866
 
2562
- // C1-C10: resolution, acyclicity, justification, coverage, re-decision,
2563
- // boundary consistency, relevance, witness integrity, search closure and call fidelity.
2564
- condition('C1', 'resolution', 'ok', 3)
2565
- condition('C2', 'well_founded', 'ok', 3)
2566
- condition('C3', 'justification', 'ok', 3)
2567
- condition('C4', 'coverage', 'ok', 4)
2568
- condition('C5', 're_decision', 'ok', 0)
2569
- condition('C6', 'boundary_consistency', 'ok', 0)
2570
- condition('C7', 'relevance', 'ok', 5)
2571
- condition('C8', 'witness_integrity', 'ok', 0)
2572
- condition('C9', 'search_closure', 'ok', 0)
2573
- condition('C10', 'call_fidelity', 'ok', 3)
2574
-
2575
- // Proof statistics: recorded steps and how they were checked.
2576
- steps(3)
2577
- verified(3)
2578
- recomputed(0)
2579
- composed(0)
2580
- trusted(0)
2581
- claims(2)
2582
-
2583
- // This verdict also establishes that the claims above are every answer of the original questions.
2584
1867
  verdict('checked')
2585
1868
  ```