eyemind 0.1.37 → 0.1.38
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 +3 -2
- package/SPEC.md +2 -2
- package/package.json +1 -1
- package/src/goals.js +8 -4
- package/src/version.js +1 -1
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ draws conclusions, and every conclusion can come with a proof that a separate
|
|
|
9
9
|
checker verifies against your program. It runs as a command-line program, a
|
|
10
10
|
JavaScript library, and a browser application, with no dependencies.
|
|
11
11
|
|
|
12
|
-
- **[Playground](https://eyereasoner.github.io/eyemind/playground)**: run
|
|
12
|
+
- **[Playground](https://eyereasoner.github.io/eyemind/playground/)**: run
|
|
13
13
|
programs in your browser.
|
|
14
14
|
- **[Guide](https://eyereasoner.github.io/eyemind/GUIDE)**: run programs,
|
|
15
15
|
write rules, check proofs, use the library, and develop eyemind.
|
|
@@ -18,8 +18,9 @@ JavaScript library, and a browser application, with no dependencies.
|
|
|
18
18
|
- **[Examples](https://eyereasoner.github.io/eyemind/examples/)**:
|
|
19
19
|
94 runnable programs, each with a card deck and saved conclusions, proofs
|
|
20
20
|
and check reports.
|
|
21
|
-
- **[Conformance suite](conformance/)**:
|
|
21
|
+
- **[Conformance suite](conformance/)**: 530 cases that test any
|
|
22
22
|
implementation of the specification through its command line.
|
|
23
|
+
Run the suite [in your browser](https://eyereasoner.github.io/eyemind/playground/conformance).
|
|
23
24
|
|
|
24
25
|
```js
|
|
25
26
|
fact(type('socrates', 'human'))
|
package/SPEC.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
```text
|
|
4
4
|
Title: The eyemind Rule Language and Proof Format
|
|
5
|
-
Version: eyemind 0.1.
|
|
5
|
+
Version: eyemind 0.1.38
|
|
6
6
|
```
|
|
7
7
|
|
|
8
8
|
This document specifies the syntax and meaning of eyemind programs and data
|
|
@@ -1099,7 +1099,7 @@ use. A step's own terms MUST NOT need further instantiation to match: a
|
|
|
1099
1099
|
source clause `same(X, X)` cannot justify `same('a', 'b')`.
|
|
1100
1100
|
|
|
1101
1101
|
For a `source(N)` step, `N` MUST identify an eligible source rule of Section
|
|
1102
|
-
|
|
1102
|
+
6.3. Bindings and uses MUST both be empty. The rule's inspection term,
|
|
1103
1103
|
renamed apart, MUST unify with `Goal` and resolve exactly
|
|
1104
1104
|
to it without instantiating the step's own terms. This checks variable
|
|
1105
1105
|
sharing as well as the rule's direction and structure. The source rule is
|
package/package.json
CHANGED
package/src/goals.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// is and(p(X), q(X)). A goal position is a statement's goal, an argument of
|
|
5
5
|
// and, or, not, call or once, either part of a rule template, or the goal of
|
|
6
6
|
// findall. Anywhere else an array is a list.
|
|
7
|
-
import { EMPTY, Env, Struct, conjunction, properListItems } from './terms.js';
|
|
7
|
+
import { EMPTY, Env, EyemindError, Struct, Var, conjunction, properListItems } from './terms.js';
|
|
8
8
|
import { readTerm } from './reader.js';
|
|
9
9
|
|
|
10
10
|
const EMPTY_ENV = new Env();
|
|
@@ -32,8 +32,12 @@ function isList(term) {
|
|
|
32
32
|
export function normalizeGoal(term) {
|
|
33
33
|
if (isList(term)) {
|
|
34
34
|
const items = properListItems(term, EMPTY_ENV);
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
if (items === null) {
|
|
36
|
+
let tail = term;
|
|
37
|
+
while (isList(tail) && tail !== EMPTY) tail = tail.args[1];
|
|
38
|
+
throw new EyemindError(tail instanceof Var ? 'an open list is not a goal' : 'an improper list is not a goal');
|
|
39
|
+
}
|
|
40
|
+
if (!items.length) throw new EyemindError('an empty array is not a goal');
|
|
37
41
|
return conjunction(items.map(normalizeGoal));
|
|
38
42
|
}
|
|
39
43
|
if (!(term instanceof Struct)) return term;
|
|
@@ -61,5 +65,5 @@ export function readGoal(text) {
|
|
|
61
65
|
|
|
62
66
|
// A goal given either as text or as a term already.
|
|
63
67
|
export function goalTerm(goal) {
|
|
64
|
-
return typeof goal === 'string' ? readGoal(goal) : goal;
|
|
68
|
+
return typeof goal === 'string' ? readGoal(goal) : normalizeGoal(goal);
|
|
65
69
|
}
|
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.1.
|
|
2
|
+
export const VERSION = '0.1.38';
|