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/README.md +77 -71
- package/SPEC.md +382 -1099
- package/package.json +1 -1
- package/src/cli.js +14 -18
- 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/index.js +3 -3
- package/src/program.js +1 -1
- package/src/proof.js +112 -958
- package/src/srl.js +11 -9
- package/src/version.js +1 -1
package/src/srl.js
CHANGED
|
@@ -40,7 +40,7 @@ import { loadText, statementSources } from './lang.js';
|
|
|
40
40
|
import { Program, Source } from './program.js';
|
|
41
41
|
import { DEFAULT_GRAPH } from './rdf.js';
|
|
42
42
|
import { readTerms } from './reader.js';
|
|
43
|
-
import { Struct, Var, conjunction, identity, isGround } from './terms.js';
|
|
43
|
+
import { Env, Struct, Var, conjunction, identity, isGround, properListItems } from './terms.js';
|
|
44
44
|
import { write } from './writer.js';
|
|
45
45
|
|
|
46
46
|
export class SrlError extends Error {}
|
|
@@ -154,7 +154,9 @@ export function compileRuleSet(ruleSet, { data = [], source = '<input>', context
|
|
|
154
154
|
});
|
|
155
155
|
if (needed.has('srl_now') || needed.has('srl_uuid')) {
|
|
156
156
|
context = executionContext(context);
|
|
157
|
-
|
|
157
|
+
// A rule rather than a fact, so that a proof using the context holds its
|
|
158
|
+
// call table, from which a later check recompiles the same program.
|
|
159
|
+
parts.push(`implied_by(srl_execution(${q(context.now)}, ${q(context.seed)}), 'true')`);
|
|
158
160
|
}
|
|
159
161
|
parts.push('query(inf(S, P, O))');
|
|
160
162
|
const library = libraryText(needed);
|
|
@@ -206,17 +208,17 @@ function executionContext(context) {
|
|
|
206
208
|
|
|
207
209
|
export function srlContextFromProof(document) {
|
|
208
210
|
try {
|
|
211
|
+
// The proof records the execution context as the answer of the call
|
|
212
|
+
// table of srl_execution/2 that the firings using it consult.
|
|
209
213
|
const contexts = readTerms(document).map(([term]) => term)
|
|
210
|
-
.filter((t) => t instanceof Struct && t.name === '
|
|
211
|
-
|
|
212
|
-
.
|
|
213
|
-
.map((t) => t.args[0])
|
|
214
|
+
.filter((t) => t instanceof Struct && t.name === 'called' && t.args.length === 2 &&
|
|
215
|
+
t.args[0] instanceof Struct && t.args[0].name === 'srl_execution' && t.args[0].args.length === 2)
|
|
216
|
+
.flatMap((t) => properListItems(t.args[1], new Env()) ?? [])
|
|
214
217
|
.filter((t) => t instanceof Struct && t.name === 'srl_execution' && t.args.length === 2);
|
|
215
|
-
if (contexts.
|
|
218
|
+
if (new Set(contexts.map((t) => identity(t))).size !== 1) return null;
|
|
216
219
|
return executionContext({ now: contexts[0].args[0], seed: contexts[0].args[1] });
|
|
217
220
|
} catch {
|
|
218
|
-
// The ordinary checker reports malformed
|
|
219
|
-
// displays that disagree with their complete encoded records.
|
|
221
|
+
// The ordinary checker reports malformed proofs.
|
|
220
222
|
return null;
|
|
221
223
|
}
|
|
222
224
|
}
|
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.
|
|
2
|
+
export const VERSION = '0.6.1';
|