eyemind 0.6.1 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [![DOI](https://img.shields.io/badge/DOI-10.5281%2Fzenodo.23824021-blue.svg)](https://doi.org/10.5281/zenodo.23824021)
4
4
  [![npm](https://img.shields.io/npm/v/eyemind.svg)](https://www.npmjs.com/package/eyemind)
5
5
 
6
- eyemind is a **JavaScript rule language** with forward and backward reasoning and checkable proofs. You write facts and rules in plain JavaScript; eyemind draws conclusions, and every conclusion can come with a proof that a separate checker verifies against your program. It runs as a command-line program, a JavaScript library, and a browser application, with no dependencies.
6
+ eyemind is a dependency-free reasoner for **Logic Script (LS)**, a rule language with JavaScript syntax. LS programs state facts, rules, and queries; eyemind draws conclusions using forward and backward reasoning, and can produce proofs that a separate checker verifies against your program. It interoperates with **RDF 1.2**, **Notation3 (N3)** and **SPARQL 1.2 RL (SRL)**: RDF supplies data, and N3 and SRL compile to LS programs whose proofs use the same checker. It runs as a command-line program, a JavaScript library, and a browser application.
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
 
@@ -49,7 +49,7 @@ Prolog, Datalog, N3 and SRL already exist, and eyemind adds no new logic: rules
49
49
  - what a rule says exists, as the Skolem term of that rule firing;
50
50
  - whether each answer really answers the question asked, and whether every answer of the question is there.
51
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.
52
- 2. **Programs are plain JavaScript.**
52
+ 2. **Logic Script programs are JavaScript scripts.**
53
53
  - There is no syntax to learn, no parser to install and no dependency.
54
54
  - The same program runs on the command line, as a library and in a browser tab.
55
55
  - Conclusions and proofs are data that is read back into terms without being run.
@@ -57,14 +57,14 @@ Prolog, Datalog, N3 and SRL already exist, and eyemind adds no new logic: rules
57
57
  - Classic Datalog is forward-only and has no function terms; Prolog is backward-only.
58
58
  - eyemind does both: forward rounds compute what follows, backward search answers questions, the two call each other, and what a rule says exists becomes a Skolem term.
59
59
  4. **A specification written for other implementers.**
60
- - The specification and its black-box [conformance suite](https://eyereasoner.github.io/eyemind/conformance/) let someone else build an independent eyemind and test it.
60
+ - The specification and its black-box [conformance suite](https://eyereasoner.github.io/eyemind/conformance/) let someone else build an independent LS implementation and test it.
61
61
  - Agreement between independent implementations is what makes a proof worth more than "trust our code".
62
62
  5. **Exact numbers.** Integers are BigInts and are never silently turned into floats.
63
63
 
64
64
  When eyemind is not the right tool:
65
65
 
66
66
  - If you do not need proofs, use the mature tools: SWI-Prolog and XSB have tabling, and Soufflé is fast at scale.
67
- - N3 and SRL are designed around RDF and Web data. eyemind does not compete there: RDF is read as data (see [RDF 1.2](#rdf-12)), and N3 programs and SRL rule sets compile to eyemind (see [Notation3](#notation3) and [SPARQL 1.2 RL](#sparql-12-rl)).
67
+ - N3 and SRL are designed around RDF and Web data. eyemind does not compete there: RDF is read as data (see [RDF 1.2](#rdf-12)), and N3 programs and SRL rule sets compile to LS (see [Notation3](#notation3) and [SPARQL 1.2 RL](#sparql-12-rl)).
68
68
  - eyemind is for cases where someone else has to be able to check why a conclusion holds: audits, compliance, and decisions between parties that do not trust each other.
69
69
 
70
70
  ## Install and run
@@ -93,7 +93,7 @@ The report ends with `verdict('checked')`. `eyemind -c examples/socrates.js` doe
93
93
 
94
94
  ## Your first program
95
95
 
96
- Save this as `/tmp/family.js`, or paste it into the [playground](https://eyereasoner.github.io/eyemind/playground/):
96
+ Logic Script sources use the `.js` extension. Save this LS program as `/tmp/family.js`, or paste it into the [playground](https://eyereasoner.github.io/eyemind/playground/):
97
97
 
98
98
  ```js
99
99
  fact(parent('alice', 'bob'))
@@ -200,7 +200,7 @@ A reified triple `<< s p o >>` and an annotation `{| ... |}` become their reifie
200
200
 
201
201
  ### Notation3
202
202
 
203
- A file ending in `.n3` is Notation3: eyemind compiles its facts and rules into a program, with the N3 built-ins it uses written as eyemind rules, and writes the conclusions back as N3. RDF default-graph data joins the N3 document as triples:
203
+ A file ending in `.n3` is Notation3: eyemind compiles its facts and rules into an LS program, with the N3 built-ins it uses written as LS rules, and writes the conclusions back as N3. RDF default-graph data joins the N3 document as triples:
204
204
 
205
205
  ```sh
206
206
  eyemind examples/family-n3.n3 # the derived triples as N3
@@ -341,7 +341,7 @@ returns `messages` plus its replay representation. Both take `format`,
341
341
 
342
342
  ### SPARQL 1.2 RL
343
343
 
344
- A file ending in `.srl` is a [SPARQL 1.2 RL](https://www.w3.org/TR/sparql12-rl/) rule set: eyemind parses and analyzes it, then compiles it into a program, with the SPARQL functions and aggregates it uses written as eyemind rules, and RDF data files given with it are its base graph. The result is the inference graph, as Turtle:
344
+ A file ending in `.srl` is a [SPARQL 1.2 RL](https://www.w3.org/TR/sparql12-rl/) rule set: eyemind parses and analyzes it, then compiles it into an LS program, with the SPARQL functions and aggregates it uses written as LS rules, and RDF data files given with it are its base graph. The result is the inference graph, as Turtle:
345
345
 
346
346
  ```sh
347
347
  eyemind rules.srl facts.ttl # the inference graph as Turtle
@@ -402,7 +402,7 @@ The two work together: a forward rule's premise can call a backward definition,
402
402
 
403
403
  A proof holds the claims, the certificate that answers the program's
404
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
405
+ records. Every input writes the same JavaScript proof: an N3 document or SRL rule set is compiled to an LS program, and
406
406
  its proof cites that program's clauses, with triples as `rdf(S, P, O)` (an
407
407
  SRL inference as `inf(S, P, O)`) over `iri(...)` and `literal(...)` terms:
408
408
 
@@ -528,7 +528,7 @@ eyemind [OPTION ...] [FILE ...]
528
528
 
529
529
  | Option | Meaning |
530
530
  | --- | --- |
531
- | (none) | Load the files, or standard input, as one program and print its conclusions. `.ttl`, `.trig`, `.nt` and `.nq` files are RDF data, `.n3` Notation3 and `.srl` a SPARQL 1.2 RL rule set. |
531
+ | (none) | Load the files, or standard input, as one program and print its conclusions. `.js` files and standard input are Logic Script, `.ttl`, `.trig`, `.nt` and `.nq` files RDF data, `.n3` Notation3 and `.srl` a SPARQL 1.2 RL rule set. |
532
532
  | `-p`, `--proof` | Print the proof instead. |
533
533
  | `-c`, `--prove-and-check` | Generate a proof, check it, and print the checked answers with the report. |
534
534
  | `--check-proof FILE` | Check a saved proof (`-` for standard input) against the program. |
@@ -714,4 +714,6 @@ the scorer's `--live` option checks the current remote resources instead.
714
714
 
715
715
  **eyemind** joins *eye* and *mind*: facts and rules lead to conclusions whose reasoning can be inspected and checked.
716
716
 
717
+ **Logic Script (LS)** names the language: facts, rules, and queries written in JavaScript syntax. eyemind is the reasoner that runs LS programs and checks their proofs.
718
+
717
719
  MIT licensed; see [LICENSE.md](LICENSE.md).
package/SPEC.md CHANGED
@@ -1,13 +1,13 @@
1
- # <img src="assets/eye.png" alt="" width="48" height="48" align="absmiddle"> eyemind specification
1
+ # <img src="assets/eye.png" alt="" width="48" height="48" align="absmiddle"> Logic Script (LS) specification
2
2
 
3
3
  ```text
4
- Title: The eyemind Rule Language and Proof Format
5
- Version: eyemind 0.6.1
4
+ Title: The Logic Script (LS) Language and Proof Format
5
+ Version: eyemind 0.6.2
6
6
  ```
7
7
 
8
- This document specifies the syntax and meaning of eyemind programs and data
9
- documents, their observable evaluation, their proofs, and how a proof is
10
- checked.
8
+ This document specifies Logic Script (LS): the syntax and meaning of its
9
+ programs and data documents, their observable evaluation, their proofs, and
10
+ how a proof is checked. eyemind is an implementation of LS.
11
11
 
12
12
  ## Table of Contents
13
13
 
@@ -83,9 +83,9 @@ checked.
83
83
 
84
84
  ### 1.1 Scope
85
85
 
86
- This specification defines eyemind's terms, program syntax, semantics,
86
+ This specification defines Logic Script's terms, program syntax, semantics,
87
87
  evaluation, data documents, proof documents and proof checking.
88
- Programs are JavaScript scripts. Conclusions, proofs and check reports are
88
+ LS programs are JavaScript scripts. Conclusions, proofs and check reports are
89
89
  data documents whose expressions MUST be read without execution.
90
90
 
91
91
  The requirements apply to any conforming implementation. JavaScript is the
@@ -285,8 +285,8 @@ own code point; a valid surrogate pair denotes one supplementary code point.
285
285
 
286
286
  ### 3.1 Scripts
287
287
 
288
- A program consists of one or more non-strict JavaScript scripts. Each script
289
- may use JavaScript declarations, expressions, functions and control flow to
288
+ A Logic Script program consists of one or more non-strict JavaScript scripts.
289
+ Each script may use JavaScript declarations, expressions, functions and control flow to
290
290
  construct its clauses. No import is required for the statements and term
291
291
  constructors defined here. Clauses are stated in the order their statement
292
292
  calls occur; multiple input scripts are processed in input order. Each
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "eyemind",
3
- "version": "0.6.1",
4
- "description": "A dependency-free JavaScript rule language with forward and backward reasoning and checkable proofs.",
3
+ "version": "0.6.2",
4
+ "description": "A dependency-free Logic Script (LS) reasoner with forward and backward reasoning, checkable proofs, and RDF 1.2, Notation3 (N3) and SPARQL 1.2 RL (SRL) interoperability.",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
7
7
  "exports": {
@@ -30,6 +30,8 @@
30
30
  "reasoner",
31
31
  "rules",
32
32
  "logic",
33
+ "logic-script",
34
+ "javascript",
33
35
  "proof",
34
36
  "datalog"
35
37
  ],
package/src/cli.js CHANGED
@@ -8,9 +8,9 @@ import { VERSION } from './version.js';
8
8
  import { srlContextFromProof } from './srl.js';
9
9
 
10
10
  export const HELP = `Usage: eyemind [OPTION ...] [FILE ...]
11
- Programs are JavaScript; forward rules run to a fixpoint. Other files are read
12
- by their extension: .ttl, .trig, .nt and .nq as RDF 1.2 data, .n3 as Notation3
13
- and .srl as a SPARQL 1.2 RL rule set, both compiled to an eyemind program.
11
+ Logic Script (LS) programs use JavaScript syntax. Forward rules run to a fixpoint.
12
+ Files are read by extension: .js as LS, .ttl, .trig, .nt and .nq as RDF 1.2 data,
13
+ .n3 as Notation3 and .srl as a SPARQL 1.2 RL rule set, both compiled to LS.
14
14
  -p, --proof Print a proof of the conclusions
15
15
  -c, --prove-and-check Generate a proof and check it against the input program
16
16
  --check-proof FILE Check a proof and print its answers and verdict (- for stdin)
package/src/formats.js CHANGED
@@ -1,17 +1,17 @@
1
- // The inputs of a run in other formats than JavaScript, and its output as
1
+ // The inputs of a run in other formats than Logic Script, and its output as
2
2
  // RDF or N3.
3
3
  //
4
4
  // A file's extension says what it holds:
5
5
  //
6
- // .js and standard input an eyemind program
6
+ // .js and standard input a Logic Script (LS) program
7
7
  // .ttl .trig .nt .nq RDF 1.2 data: with a program, rdf(S, P, O, G)
8
8
  // facts; with an N3 document, default triples and
9
9
  // graph:content formulas for named graphs; with a
10
10
  // rule set, its base graph
11
- // .n3 Notation3, compiled to an eyemind program
11
+ // .n3 Notation3, compiled to an LS program
12
12
  // .srl a SPARQL 1.2 RL rule set, compiled to one
13
13
  //
14
- // The compiled program is ordinary eyemind: proofs, checking and --unused
14
+ // The compiled program is ordinary LS: proofs, checking and --unused
15
15
  // apply to it. SRL execution functions capture a context that a saved proof
16
16
  // retains; compiling with that context reproduces the same program later.
17
17
  import { EyemindError, Struct } from './terms.js';
package/src/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  // eyemind: reasoning you can see, in JavaScript.
2
2
  //
3
- // Facts and rules are JavaScript. Forward rules materialize conclusions until
4
- // a fixpoint, backward rules are decided when a goal asks for them, and every
5
- // certifiable answer can come with a proof that a separate checker verifies
6
- // against the program, using its call tables and recorded firings.
3
+ // Logic Script (LS) states facts, rules and queries in JavaScript syntax.
4
+ // Forward rules materialize conclusions until a fixpoint; backward rules are
5
+ // decided when a goal asks for them. A separate checker verifies proofs
6
+ // against the program, using their call tables and recorded firings.
7
7
  export { VERSION } from './version.js';
8
8
  export { Result, run, unusedClauses } from './engine.js';
9
9
  export { readGoal } from './goals.js';
package/src/lang.js CHANGED
@@ -1,6 +1,6 @@
1
- // Writing programs in JavaScript.
1
+ // Writing Logic Script (LS) programs in JavaScript.
2
2
  //
3
- // A program is a JavaScript script that states facts and rules:
3
+ // An LS program is a JavaScript script that states facts, rules and queries:
4
4
  //
5
5
  // fact(type('socrates', 'human'))
6
6
  // fact(subclass_of('human', 'mortal'))
@@ -1,7 +1,7 @@
1
- // N3 built-ins as eyemind backward rules.
1
+ // N3 built-ins as Logic Script backward rules.
2
2
  //
3
3
  // Each built-in predicate of a rule body becomes a goal n3_<ns>_<name>(S, O)
4
- // whose definition is written here in eyemind itself, so the compiled program
4
+ // whose definition is written here in Logic Script, so the compiled program
5
5
  // is self-contained and every built-in step is an ordinary, checkable
6
6
  // derivation. A definition lists the helpers it needs; the compiler copies
7
7
  // the definitions a program uses, and their helpers, into the program.
package/src/n3.js CHANGED
@@ -1,8 +1,8 @@
1
- // N3 documents compiled to eyemind programs.
1
+ // N3 documents compiled to Logic Script (LS) programs.
2
2
  //
3
3
  // Every N3 statement becomes rdf(Subject, Predicate, Object): the document's
4
4
  // own triples are facts, and a run concludes the triples its forward rules
5
- // derive that were not already facts. Rules become eyemind rules:
5
+ // derive that were not already facts. Rules become LS rules:
6
6
  //
7
7
  // { B } => { H }. implies(B, H) forward; restricted(B, H)
8
8
  // when H has blank nodes
@@ -20,7 +20,7 @@
20
20
  // backward rules. A quoted formula is a graph term: its own blank nodes and
21
21
  // universals are qbnode(Label) and qvar(Name), and a rule's graph pattern
22
22
  // matches it as a set, up to a one-to-one renaming of those. Built-in
23
- // predicates of a body become goals defined in eyemind itself (builtins.mjs).
23
+ // predicates of a body become goals defined in LS (n3-builtins.js).
24
24
  import { run } from './engine.js';
25
25
  import { loadText } from './lang.js';
26
26
  import { Program, Source } from './program.js';
@@ -1,8 +1,8 @@
1
- // SPARQL expressions and aggregates as eyemind backward rules.
1
+ // SPARQL expressions and aggregates as Logic Script backward rules.
2
2
  //
3
3
  // An expression compiles to goals that bind its value; a function is a goal
4
4
  // srl_<name>(Arguments..., Result) whose definition is written here in
5
- // eyemind itself, so the compiled program is self-contained and every
5
+ // Logic Script, so the compiled program is self-contained and every
6
6
  // function step is an ordinary, checkable derivation. A SPARQL error is a
7
7
  // goal that fails: FILTER then rejects the solution and SET drops it, as
8
8
  // SPARQL 1.2 RL evaluates them. A definition lists the definitions it needs;
package/src/srl.js CHANGED
@@ -1,4 +1,4 @@
1
- // SPARQL 1.2 RL rule sets compiled to eyemind programs.
1
+ // SPARQL 1.2 RL rule sets compiled to Logic Script (LS) programs.
2
2
  //
3
3
  // Rule sets are read by the SRL tokenizer, parser and analysis (the
4
4
  // srl-*.js files): parsing gives the rule set's data blocks and rules, and the
package/src/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // The release this checkout is; ./release keeps it in step with package.json.
2
- export const VERSION = '0.6.1';
2
+ export const VERSION = '0.6.2';