eyemind 0.5.31 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +79 -159
- package/SPEC.md +382 -1099
- package/package.json +1 -1
- package/src/cli.js +7 -12
- package/src/closure.js +81 -99
- package/src/common.js +36 -1
- package/src/engine.js +64 -51
- package/src/fidelity.js +141 -107
- package/src/formats.js +0 -12
- package/src/index.js +1 -2
- package/src/n3-parser.js +6 -9
- package/src/program.js +1 -1
- package/src/proof.js +114 -960
- package/src/srl.js +12 -11
- package/src/version.js +1 -1
- package/src/native-proof.js +0 -316
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ eyemind is a **JavaScript rule language** with forward and backward reasoning an
|
|
|
7
7
|
|
|
8
8
|
[Playground](https://eyereasoner.github.io/eyemind/playground/) · [Specification](https://eyereasoner.github.io/eyemind/SPEC) · [Conformance](https://eyereasoner.github.io/eyemind/conformance/) · [Examples](https://eyereasoner.github.io/eyemind/examples/)
|
|
9
9
|
|
|
10
|
-
The playground runs programs in your browser; the specification defines the language, its canonical text, the proof format and
|
|
10
|
+
The playground runs programs in your browser; the specification defines the language, its canonical text, the proof format and how a proof is checked. The examples are 135 runnable programs, each with a card deck and saved conclusions, proofs and check reports. The conformance suite has 1246 cases that test language and proof behavior through a command adapter, together with implementation interface checks; run it [in your browser](https://eyereasoner.github.io/eyemind/playground/conformance).
|
|
11
11
|
|
|
12
12
|
## Contents
|
|
13
13
|
|
|
@@ -24,7 +24,6 @@ The playground runs programs in your browser; the specification defines the lang
|
|
|
24
24
|
- [SPARQL 1.2 RL](#sparql-12-rl)
|
|
25
25
|
- [How eyemind reasons](#how-eyemind-reasons)
|
|
26
26
|
- [Proofs, and what checking one means](#proofs-and-what-checking-one-means)
|
|
27
|
-
- [Native proof data](#native-proof-data)
|
|
28
27
|
- [JSON check reports](#json-check-reports)
|
|
29
28
|
- [Why negation and collection are safe](#why-negation-and-collection-are-safe)
|
|
30
29
|
- [Checking the translation](#checking-the-translation)
|
|
@@ -46,9 +45,9 @@ Prolog, Datalog, N3 and SRL already exist, and eyemind adds no new logic: rules
|
|
|
46
45
|
1. **The proof covers everything that went into the answer.**
|
|
47
46
|
- Most engines show an answer, or at best a trace you have to trust.
|
|
48
47
|
- eyemind proofs include the hard parts:
|
|
49
|
-
- "nothing matched" (negation and collections),
|
|
50
|
-
- what a rule says exists, as the Skolem term of that rule firing
|
|
51
|
-
- whether each answer really answers the question asked, and whether every answer of the question is there
|
|
48
|
+
- "nothing matched" (negation and collections), decided from complete answer tables whose listings of derived facts must be closed;
|
|
49
|
+
- what a rule says exists, as the Skolem term of that rule firing;
|
|
50
|
+
- whether each answer really answers the question asked, and whether every answer of the question is there.
|
|
52
51
|
- A forged proof must never pass the check, so a result is something you can hand to someone who does not trust your engine.
|
|
53
52
|
2. **Programs are plain JavaScript.**
|
|
54
53
|
- There is no syntax to learn, no parser to install and no dependency.
|
|
@@ -148,7 +147,7 @@ for (let level = 1; level <= 10; level++) {
|
|
|
148
147
|
- **Arithmetic is a term, not an operator.** `is(Y, add(X, 1))` computes and `gt(X, 1)` compares. `X + 1` or `X > 1` stops the program with a message saying what to write instead, and operators on plain numbers are JavaScript's own (`2 ** 60 + 1` arrives already rounded). The primitives are listed in [SPEC §4](https://eyereasoner.github.io/eyemind/SPEC#4-goals-and-primitives) and the arithmetic functions in [SPEC §5](https://eyereasoner.github.io/eyemind/SPEC#5-arithmetic).
|
|
149
148
|
- **Numbers are exact.** An integral number is an integer, `2` and `2.0` alike, and `float(2)` is a float; write integers beyond 2^53 as a `BigInt`, `9007199254740993n`. `1` and `float(1)` do not unify, yet compare equal.
|
|
150
149
|
- **Something exists.** A variable only a forward rule's conclusion mentions becomes a Skolem term of that firing: `implies(person(X), has_parent(X, P))` concludes `has_parent('ann', skolem(2, 'P', ['ann']))`.
|
|
151
|
-
- **Data is not a program.** eyemind's term documents are plain expressions. `facts_from` reads one as facts and never executes it, so it is the safe way to take in data you do not trust, and lets one run reason over another's proof, as [audited-grants](https://github.com/eyereasoner/eyemind/blob/main/examples/audited-grants.js) does.
|
|
150
|
+
- **Data is not a program.** eyemind's term documents are plain expressions. `facts_from` reads one as facts and never executes it, so it is the safe way to take in data you do not trust, and lets one run reason over another's proof, as [audited-grants](https://github.com/eyereasoner/eyemind/blob/main/examples/audited-grants.js) does.
|
|
152
151
|
|
|
153
152
|
### Deriving rules
|
|
154
153
|
|
|
@@ -276,8 +275,7 @@ Examples run directly from their N3 source in the playground and on the command
|
|
|
276
275
|
[invoice collection](https://eyereasoner.github.io/eyemind/examples/deck/invoice-n3),
|
|
277
276
|
[French cities](https://eyereasoner.github.io/eyemind/examples/deck/french-cities-n3), and
|
|
278
277
|
[Skolem IRI witnesses](https://eyereasoner.github.io/eyemind/examples/deck/witnesses-n3).
|
|
279
|
-
Each deck shows the N3 result and what its saved proof establishes
|
|
280
|
-
any remaining obligations.
|
|
278
|
+
Each deck shows the N3 result and what its saved proof establishes.
|
|
281
279
|
|
|
282
280
|
### RDF Messages
|
|
283
281
|
|
|
@@ -293,7 +291,7 @@ Whole-log replay gives N3 or JavaScript rules an ordered view of the messages:
|
|
|
293
291
|
```sh
|
|
294
292
|
eyemind examples/message-boundaries-n3.n3 examples/data/message-boundaries-n3.trig
|
|
295
293
|
eyemind --proof examples/message-boundaries-n3.n3 examples/data/message-boundaries-n3.trig
|
|
296
|
-
eyemind --check-proof examples/proof/message-boundaries-n3.
|
|
294
|
+
eyemind --check-proof examples/proof/message-boundaries-n3.js examples/message-boundaries-n3.n3 examples/data/message-boundaries-n3.trig
|
|
297
295
|
```
|
|
298
296
|
|
|
299
297
|
The replay vocabulary is `eymsg:`, with namespace
|
|
@@ -331,7 +329,7 @@ text with the same boundaries. Whole-log replay supports proofs;
|
|
|
331
329
|
unused-clause modes. The [message-boundaries](https://eyereasoner.github.io/eyemind/examples/deck/message-boundaries-n3),
|
|
332
330
|
[message-alerts](https://eyereasoner.github.io/eyemind/examples/deck/message-alerts-n3)
|
|
333
331
|
and [message-provenance](https://eyereasoner.github.io/eyemind/examples/deck/message-provenance-n3)
|
|
334
|
-
decks show the outputs and
|
|
332
|
+
decks show the outputs and what their proofs establish.
|
|
335
333
|
|
|
336
334
|
Library hosts can import `RdfMessageReader` and `parseRdfMessages` from
|
|
337
335
|
`eyemind`. The former accepts text chunks through `write(text)` and
|
|
@@ -402,157 +400,89 @@ The two work together: a forward rule's premise can call a backward definition,
|
|
|
402
400
|
|
|
403
401
|
## Proofs, and what checking one means
|
|
404
402
|
|
|
405
|
-
A proof holds the claims, the
|
|
406
|
-
|
|
407
|
-
N3
|
|
403
|
+
A proof holds the claims, the certificate that answers the program's
|
|
404
|
+
questions, and the recorded firings behind derived facts as `step(...)`
|
|
405
|
+
records. Every input writes the same JavaScript proof: an N3 document or SRL rule set is compiled to an eyemind program, and
|
|
406
|
+
its proof cites that program's clauses, with triples as `rdf(S, P, O)` (an
|
|
407
|
+
SRL inference as `inf(S, P, O)`) over `iri(...)` and `literal(...)` terms:
|
|
408
408
|
|
|
409
409
|
```sh
|
|
410
|
-
eyemind --proof examples/socrates-n3.n3 > /tmp/socrates-proof.
|
|
411
|
-
eyemind --check-proof /tmp/socrates-proof.
|
|
412
|
-
eyemind --proof examples/socrates-srl.srl > /tmp/socrates-proof.
|
|
413
|
-
eyemind --check-proof /tmp/socrates-proof.
|
|
410
|
+
eyemind --proof examples/socrates-n3.n3 > /tmp/socrates-proof.js
|
|
411
|
+
eyemind --check-proof /tmp/socrates-proof.js examples/socrates-n3.n3
|
|
412
|
+
eyemind --proof examples/socrates-srl.srl > /tmp/socrates-proof.js
|
|
413
|
+
eyemind --check-proof /tmp/socrates-proof.js examples/socrates-srl.srl
|
|
414
414
|
```
|
|
415
415
|
|
|
416
|
-
|
|
417
|
-
conclusions, rule numbers, bindings and ordered uses. N3 displays statements
|
|
418
|
-
as quoted formulas; SRL displays them as RDF triple terms. Rule numbers name
|
|
419
|
-
clauses of the compiled eyemind program. The `em:` vocabulary,
|
|
420
|
-
`https://eyereasoner.github.io/eyemind/proof#`, keeps the exact terms and
|
|
421
|
-
ordered records, including all C9 search and C10 call tables. The checker
|
|
422
|
-
validates the displays against those records, then checks the certificate
|
|
423
|
-
against the source program. Altered displays, duplicate properties and extra
|
|
424
|
-
assertions fail checking. Proofs can be read as data by other N3 or SRL rules.
|
|
416
|
+
Check reports are JavaScript term documents too, or JSON with `--json`.
|
|
425
417
|
|
|
426
|
-
|
|
427
|
-
continues to accept JavaScript certificates for native inputs. Check reports
|
|
428
|
-
remain JavaScript term documents, or JSON with `--json`.
|
|
418
|
+
The proof of `examples/socrates.js` shows its parts:
|
|
429
419
|
|
|
430
|
-
|
|
420
|
+
```js
|
|
421
|
+
// Answers: each instance of a query() that holds.
|
|
422
|
+
type('socrates', 'mortal')
|
|
423
|
+
type('socrates', 'human')
|
|
431
424
|
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
425
|
+
// Steps: each derived fact and what it rests on: the clause or control that
|
|
426
|
+
// justifies it, the bindings and the goals it uses.
|
|
427
|
+
step(type('socrates', 'mortal'), clause(3), {S: 'socrates', A: 'human', B: 'mortal'}, [type('socrates', 'human'), subclass_of('human', 'mortal')])
|
|
428
|
+
step(type('socrates', 'human'), clause(1), {}, [])
|
|
429
|
+
|
|
430
|
+
// Certificate: the derived facts and every answer of each call the questions make.
|
|
431
|
+
derived(type(A, B), [type('socrates', 'mortal')])
|
|
432
|
+
called(type(A, B), [type('socrates', 'mortal'), type('socrates', 'human')])
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
- **The claims** are the run's conclusions.
|
|
436
|
+
- **The call tables**, `called(Call, Answers)`, list every answer of each call
|
|
437
|
+
the original questions make: here the query `type(X, Y)`.
|
|
438
|
+
- **The listings**, `derived(Pattern, Facts)`, list every fact forward rules
|
|
439
|
+
derived for a relation those searches consult.
|
|
440
|
+
- **The steps** record the firing behind each listed fact: the rule, its
|
|
441
|
+
bindings and the goals it used; and, for a goal whose call rests on derived
|
|
442
|
+
facts, how that goal was derived. `type(_, _)` is a relation the rule
|
|
443
|
+
derives, so the stated fact `type('socrates', 'human')` has a step citing
|
|
444
|
+
clause 1.
|
|
445
|
+
|
|
446
|
+
Checking is one procedure. The checker answers each original question by
|
|
447
|
+
searching it against the program, one level at a time, with every inner call
|
|
448
|
+
answered from its call table, and checks each table the same way, so a wrong
|
|
449
|
+
table shows up as a disagreement. Each listing must be closed under the
|
|
450
|
+
forward rules, and each listed fact must **replay** its recorded firing: the
|
|
451
|
+
checker re-runs the rule from no bindings, with primitives computed and
|
|
452
|
+
negations, collections and first answers taken from the tables at the
|
|
453
|
+
bindings they had when they ran, and each witness bound to the Skolem term of
|
|
454
|
+
its firing. The claims must then be exactly the answers: a claim the question
|
|
455
|
+
does not return fails, and so does an answer the proof leaves out. A step,
|
|
456
|
+
table or listing the check does not use fails it too, so nothing in a proof
|
|
457
|
+
goes unchecked.
|
|
458
|
+
|
|
459
|
+
**The checker follows the certificate:** it never calls the reasoner, so missing evidence fails rather than being quietly re-derived. **The source is the authority:** the proof cites clauses by number, read from the program. Proofs are read as data, so checking someone else's proof runs none of their code, and every proof eyemind generates is checked before it is returned. The report is a document too:
|
|
446
460
|
|
|
447
461
|
```js
|
|
448
|
-
// Checked answers: these follow from the input program.
|
|
462
|
+
// Checked answers: these follow from the input program and are every answer of its questions.
|
|
449
463
|
type('socrates', 'mortal')
|
|
450
464
|
type('socrates', 'human')
|
|
451
465
|
|
|
452
|
-
// C1-C10: resolution, acyclicity, justification, coverage, re-decision,
|
|
453
|
-
// boundary consistency, relevance, witness integrity, search closure and call fidelity.
|
|
454
|
-
condition('C1', 'resolution', 'ok', 3)
|
|
455
|
-
condition('C2', 'well_founded', 'ok', 3)
|
|
456
|
-
condition('C3', 'justification', 'ok', 3)
|
|
457
|
-
condition('C4', 'coverage', 'ok', 4)
|
|
458
|
-
condition('C5', 're_decision', 'ok', 0)
|
|
459
|
-
condition('C6', 'boundary_consistency', 'ok', 0)
|
|
460
|
-
condition('C7', 'relevance', 'ok', 5)
|
|
461
|
-
condition('C8', 'witness_integrity', 'ok', 0)
|
|
462
|
-
condition('C9', 'search_closure', 'ok', 0)
|
|
463
|
-
condition('C10', 'call_fidelity', 'ok', 3)
|
|
464
|
-
|
|
465
|
-
// Proof statistics: recorded steps and how they were checked.
|
|
466
|
-
steps(3)
|
|
467
|
-
verified(3)
|
|
468
|
-
recomputed(0)
|
|
469
|
-
composed(0)
|
|
470
|
-
trusted(0)
|
|
471
|
-
claims(2)
|
|
472
|
-
|
|
473
|
-
// This verdict also establishes that the claims above are every answer of the original questions.
|
|
474
466
|
verdict('checked')
|
|
475
467
|
```
|
|
476
468
|
|
|
477
|
-
A `checked` verdict thus establishes two things: every claim follows from the program, and the claims are every answer of the original questions.
|
|
478
|
-
|
|
479
|
-
### Native proof data
|
|
469
|
+
A `checked` verdict thus establishes two things: every claim follows from the program, and the claims are every answer of the original questions. A question with no claims is shown to have no answers by its table. A failed check lists `failure(Detail)` facts, ends with `verdict(failed(N))` and exits with code 2. A halted run's proof establishes that its claims follow, not that they are every answer. To check answers to `--goal` questions, pass the same goals when checking. [SPEC §11](https://eyereasoner.github.io/eyemind/SPEC#11-proof-checking) defines the check.
|
|
480
470
|
|
|
481
|
-
|
|
482
|
-
proof documents. Language and proof conformance does not require them.
|
|
471
|
+
Some results cannot be certified by this format, and `--proof` then reports an error while a plain run still gives the answers:
|
|
483
472
|
|
|
484
|
-
|
|
485
|
-
`
|
|
486
|
-
`
|
|
487
|
-
|
|
488
|
-
and `em:records` as an ordered collection of record IRIs. Record `N`, counted
|
|
489
|
-
from 1, is `<urn:eyemind:proof#recordN>` and has one `em:term` containing its
|
|
490
|
-
[Section 10](https://eyereasoner.github.io/eyemind/SPEC#10-proof-documents) statement, encoded as a tagged collection:
|
|
491
|
-
|
|
492
|
-
| Term | Collection |
|
|
493
|
-
| --- | --- |
|
|
494
|
-
| Atom | `(em:atom "text")` |
|
|
495
|
-
| Integer | `(em:integer "digits")`, with a minus for a negative integer |
|
|
496
|
-
| Float | `(em:float "number")`, preserving signed zero as `"-0"` |
|
|
497
|
-
| Variable | `(em:variable "name")`, including anonymous-variable status |
|
|
498
|
-
| `iri(I)` with an RDF-compatible IRI | `(em:iri <I>)` |
|
|
499
|
-
| Nonempty proper list | `(em:list (EncodedItem ...))` |
|
|
500
|
-
| Compound | `(em:compound "name" (EncodedArgument ...))` |
|
|
501
|
-
|
|
502
|
-
The empty list is the atom `"[]"`. Other compounds, including open lists,
|
|
503
|
-
quoted graphs and Skolem terms, use the compound encoding. A string field
|
|
504
|
-
containing a character RDF cannot represent uses an `em:utf16` typed literal
|
|
505
|
-
whose lexical form is four lowercase hexadecimal digits per UTF-16 code
|
|
506
|
-
unit. This retains every atom and variable name accepted by
|
|
507
|
-
[Section 9.2](https://eyereasoner.github.io/eyemind/SPEC#92-canonical-atoms-numbers-variables-and-lists).
|
|
508
|
-
|
|
509
|
-
A triple goal's display is an N3 quoted formula, or an SRL RDF triple term.
|
|
510
|
-
Other goals use their tagged encoding. A step record also displays
|
|
511
|
-
`pe:conclusion`, `pe:rule` for a `clause(N)` justification, `pe:source` for
|
|
512
|
-
`source(N)`, or `pe:justification` for another justification. `pe:binding`
|
|
513
|
-
is an ordered collection of `(VariableName Value)` pairs, and `pe:uses` an
|
|
514
|
-
ordered collection of premise displays. Non-native binding values retain
|
|
515
|
-
their tagged encoding. Search records display `pe:derived`, `pe:searched`
|
|
516
|
-
or `pe:called` and an ordered `pe:answers` collection. Clause numbers name
|
|
517
|
-
the compiled program's clauses, whose authority is still the source input.
|
|
518
|
-
SRL proofs contain only `DATA` and declarations, never rules or imports.
|
|
519
|
-
|
|
520
|
-
When an SRL rule set uses `NOW`, `UUID` or `STRUUID`, its compiled program
|
|
521
|
-
includes one ground `srl_execution(Now, Seed)` fact. `Now` is an ISO UTC
|
|
522
|
-
timestamp with milliseconds and `Seed` contains 64 lowercase hexadecimal
|
|
523
|
-
digits. The compiler captures these external inputs once per compilation;
|
|
524
|
-
they remain fixed throughout evaluation. To check a saved SRL proof, the
|
|
525
|
-
format loader may recover this fact from its clause records, validate its
|
|
526
|
-
two fields, and recompile the source with that execution context. All other
|
|
527
|
-
clauses still come from the source, and all displays undergo C1–C10 as
|
|
528
|
-
usual. This establishes consequences of the recorded context, without
|
|
529
|
-
certifying a clock observation or the entropy of the seed.
|
|
530
|
-
|
|
531
|
-
The reader decodes every record, verifies all displays and properties against
|
|
532
|
-
those records, and applies the unchanged checks of
|
|
533
|
-
[Section 11](https://eyereasoner.github.io/eyemind/SPEC#11-proof-checking) to the decoded
|
|
534
|
-
certificate. A missing, extra, duplicate or inconsistent property fails C3.
|
|
535
|
-
Numeric literal displays retain their decimal digits during this comparison;
|
|
536
|
-
distinct decimal literals do not agree merely by rounding to binary64.
|
|
537
|
-
Prefix aliases and reordering top-level properties are accepted, as is
|
|
538
|
-
consistent blank-node renaming; the order of collections and formula triples
|
|
539
|
-
is retained. Displayed claims cannot replace encoded claims, and neither
|
|
540
|
-
representation can change the source authority or supply missing evidence.
|
|
473
|
+
- a first answer or a collection whose order rests on derived facts with more than one answer, since a listing does not show the order facts were derived in (a `findall_sorted` of ground items does not depend on it);
|
|
474
|
+
- a firing of a `restricted` rule whose guard is a negation, which held before the firing but no longer does after it;
|
|
475
|
+
- `compare/3` on terms that are not ground, and rules appended by templates whose generators consult derived facts or introduce witnesses;
|
|
476
|
+
- a call table larger than the bound of [Resource limits](#resource-limits).
|
|
541
477
|
|
|
542
478
|
### JSON check reports
|
|
543
479
|
|
|
544
|
-
With `--json`, checking modes write a JSON report instead of a term document
|
|
545
|
-
|
|
546
|
-
texts, including unverified claims when `valid` is false
|
|
547
|
-
`
|
|
548
|
-
`
|
|
549
|
-
|
|
550
|
-
for a claim's call-fidelity obligation and `reason: 'all_answers'` for a
|
|
551
|
-
question's answer-completeness obligation), `failures` (a list of
|
|
552
|
-
`{condition, detail, conclusion?}`) and `conditions` (a list of
|
|
553
|
-
`{id, name, covered, failed}`), where `conclusion` is a canonical text.
|
|
554
|
-
Its variables keep the names the document gives them, rather than being
|
|
555
|
-
renamed for each report fact as in the text form.
|
|
480
|
+
With `--json`, checking modes write a JSON report instead of a term document:
|
|
481
|
+
`valid` (boolean), `claims` and `steps` (the numbers read), `answers` (the
|
|
482
|
+
claims' canonical texts, including unverified claims when `valid` is false),
|
|
483
|
+
`halted` (whether the claims contain `'false'`) and `failures` (a list of
|
|
484
|
+
`{detail, subject?}`, where `subject` is the canonical text of the term
|
|
485
|
+
concerned). Its variables keep the names the document gives them.
|
|
556
486
|
|
|
557
487
|
### Why negation and collection are safe
|
|
558
488
|
|
|
@@ -560,9 +490,8 @@ A negation `not(G)` concludes from what is *absent* and a collection `findall(T,
|
|
|
560
490
|
|
|
561
491
|
- **Ask only once the answer is final.** Rules are ranked so that everything a negation or collection inspects reaches its fixpoint first; a program with no such ranking, such as `implies(not(q), p)` with `implies(p, q)`, is rejected.
|
|
562
492
|
- **Negate only what is bound.** The variables of `not(G)` must be bound when it runs; write `not(q(X, _))` for "no value at all".
|
|
563
|
-
- **Check the search, not just its result.** A proof ends with
|
|
564
|
-
- **
|
|
565
|
-
- **Certify the original questions.** Closed listings establish the original calls and all their answers when every listed fact's recorded firing replays. The checker follows the source rule and the recorded premise evidence in order, starting with no bindings, so a state test sees the bindings of its actual call and `once` takes the actual first answer. It does not call the reasoner or supply missing evidence. Rules generated by templates are checked through their instances, and source rule inspection through the program's catalogue. A proof within these bounds can be `checked` with no obligation, even under `--strict-proof`. A `findall_sorted` of ground items is certified from the set of derived facts alone. `findall` and first answers over derived facts, whose order a listing cannot show, and `restricted` rules with new witnesses keep an obligation.
|
|
493
|
+
- **Check the search, not just its result.** A proof ends with its certificate: `called(Call, Answers)` lists each call's answers and `derived(Pattern, Facts)` each consulted relation. The checker expands each call one level against the program, so a wrong table shows up as a disagreement, and requires each listing to be closed under the rules, so an omitted fact shows up too.
|
|
494
|
+
- **Decide at the actual call.** Replay runs each recorded firing from its source rule with the bindings of each point of the search, so a negation sees the goal as it was called, a state test sees the bindings of its actual call, and `once` takes the actual first answer.
|
|
566
495
|
|
|
567
496
|
## Checking the translation
|
|
568
497
|
|
|
@@ -605,7 +534,6 @@ eyemind [OPTION ...] [FILE ...]
|
|
|
605
534
|
| `--check-proof FILE` | Check a saved proof (`-` for standard input) against the program. |
|
|
606
535
|
| `--json` | With a checking mode, print the report as JSON. |
|
|
607
536
|
| `--goal GOAL` | Ask `GOAL` after forward reasoning; may be repeated. |
|
|
608
|
-
| `--strict-proof` | With a checking mode, reject proofs with any obligation. |
|
|
609
537
|
| `--unused` | List the clauses that make no difference to the conclusions. |
|
|
610
538
|
| `--stream-messages` | Read an RDF Message Log and run the rules independently per message; Node reads files, stdin and HTTP(S) incrementally. |
|
|
611
539
|
| `--stats` | Print reasoning statistics as JSON to standard error. |
|
|
@@ -617,7 +545,7 @@ eyemind [OPTION ...] [FILE ...]
|
|
|
617
545
|
| `-v`, `--version`, `-h`, `--help` | Print the version or the usage. |
|
|
618
546
|
|
|
619
547
|
`--proof`, `--prove-and-check`, `--check-proof` and `--unused` are mutually
|
|
620
|
-
exclusive. `--json`
|
|
548
|
+
exclusive. `--json` needs a checking mode. `--goal` reads
|
|
621
549
|
each goal as a data document, with an array denoting conjunction. With
|
|
622
550
|
`--check-proof`, supply the original goals the proof answers.
|
|
623
551
|
|
|
@@ -640,8 +568,7 @@ before exhaustion.
|
|
|
640
568
|
| 2 | An invalid proof check; the report is printed as usual. |
|
|
641
569
|
| 65 | The run concluded `'false'` and halted. |
|
|
642
570
|
|
|
643
|
-
The command line, JSON output, additional input formats,
|
|
644
|
-
encodings, library API and browser interface describe this implementation.
|
|
571
|
+
The command line, JSON output, additional input formats, library API and browser interface describe this implementation.
|
|
645
572
|
They are outside the language and proof specification.
|
|
646
573
|
|
|
647
574
|
### Resource limits
|
|
@@ -657,10 +584,10 @@ Arithmetic also limits integer growth: `pow(A, B)` with integer `B > 0` and
|
|
|
657
584
|
2^26. An integer left shift `shl(A, B)` raises an error when `B` exceeds
|
|
658
585
|
2^26. These limits protect the process from excessively large allocations.
|
|
659
586
|
|
|
660
|
-
|
|
587
|
+
Making a proof's call tables is bounded per question by the smaller of the
|
|
661
588
|
run's inference limit and 500,000 calls plus answers, and by 8,388,608 UTF-16
|
|
662
|
-
code units of answer text.
|
|
663
|
-
does not change the run
|
|
589
|
+
code units of answer text. Exceeding these bounds makes `--proof` report an
|
|
590
|
+
error; it does not change the answers of a plain run.
|
|
664
591
|
|
|
665
592
|
### Unused clauses
|
|
666
593
|
|
|
@@ -720,14 +647,7 @@ console.log(result.bindings);
|
|
|
720
647
|
console.log(checkProof(socrates, result.proof, { goals }).valid);
|
|
721
648
|
```
|
|
722
649
|
|
|
723
|
-
`run()` returns `conclusions`, `answers`, `bindings`, `inferred`, `stdout`, `proof`, `proofReport`, `stats` and `haltCode`, and takes `goal`, `goals`, `proof`, `maxDepth`, `maxIterations` and `maxInferences`; exceeding a bound throws an `EyemindError`. `conclusions` holds the answer terms; `answers`, `bindings` and `stdout` are rendered when first read. Ground N3 conclusions are written directly from their terms. `loadSources([[text, filename], ...], io)` loads several sources as one program; pass `nodeIO` from `eyemind/node` as `io` to let `facts_from(path)` read files. `checkProof(program, document, { goals
|
|
724
|
-
|
|
725
|
-
The core library's `result.proof` is the JavaScript certificate.
|
|
726
|
-
`writeNativeProof(result.proof, { format: 'n3', prefixes })` writes its N3
|
|
727
|
-
representation; use `format: 'srl'` for SRL. `readNativeProof(document)`
|
|
728
|
-
returns the decoded terms, and `readProofTerms(document)` reads any supported
|
|
729
|
-
proof as `[term, line]` pairs. Native records have line 0. `checkProof`
|
|
730
|
-
accepts all three representations and never evaluates proof text.
|
|
650
|
+
`run()` returns `conclusions`, `answers`, `bindings`, `inferred`, `stdout`, `proof`, `proofReport`, `stats` and `haltCode`, and takes `goal`, `goals`, `proof`, `maxDepth`, `maxIterations` and `maxInferences`; exceeding a bound throws an `EyemindError`. `conclusions` holds the answer terms; `answers`, `bindings` and `stdout` are rendered when first read. Ground N3 conclusions are written directly from their terms. `loadSources([[text, filename], ...], io)` loads several sources as one program; pass `nodeIO` from `eyemind/node` as `io` to let `facts_from(path)` read files. `checkProof(program, document, { goals })` checks a proof. `checkReport`, `readTerm`, `readTerms` and `write` format reports and read and write the canonical text.
|
|
731
651
|
|
|
732
652
|
## What is deliberately absent
|
|
733
653
|
|