occam-verify-cli 0.0.1057 → 0.0.1061

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.
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ import { arrayUtilities } from "necessary";
4
+
3
5
  import FileContext from "./file";
4
6
  import topLevelVerifier from "../verifier/topLevel";
5
7
 
@@ -7,10 +9,10 @@ import { filePathUtilities } from "occam-entities";
7
9
  import { lexersUtilities, parsersUtilities } from "occam-custom-grammars";
8
10
 
9
11
  import { objectType } from "../type";
10
- import { tail, push, clear, leftDifference } from "../utilities/array";
11
12
  import { customGrammarFromNameAndEntries, combinedCustomGrammarFromReleaseContexts } from "../utilities/customGrammar";
12
13
 
13
14
  const { isFilePathNominalFilePath } = filePathUtilities,
15
+ { tail, push, clear, resolve } = arrayUtilities,
14
16
  { nominalLexerFromCombinedCustomGrammar } = lexersUtilities,
15
17
  { nominalParserFromCombinedCustomGrammar } = parsersUtilities;
16
18
 
@@ -79,11 +81,7 @@ export default class ReleaseContext {
79
81
  return released;
80
82
  }
81
83
 
82
- findFile(filePath) {
83
- const file = this.entries.getFile(filePath);
84
-
85
- return file;
86
- }
84
+ findFile(filePath) { return this.entries.findFile(filePath); }
87
85
 
88
86
  findFileContext(filePath) {
89
87
  const fileContext = this.fileContexts.find((fileContext) => {
@@ -455,7 +453,7 @@ function fileContextsFromJSONAndEntries(json, entries, fileContexts, releaseCont
455
453
 
456
454
  fileContextsJSON.forEach((fileContextJSON) => {
457
455
  const { filePath } = fileContextJSON,
458
- file = entries.getFile(filePath),
456
+ file = entries.findFile(filePath),
459
457
  fileContext = FileContext.fromFile(file, releaseContext);
460
458
 
461
459
  fileContext.initialise(fileContextJSON);
@@ -478,43 +476,14 @@ function fileContextsFromEntries(entries, fileContexts, releaseContext) {
478
476
  }
479
477
 
480
478
  function verifyFileContexts(fileContexts, verifiedFileContexts) {
481
- let fileContextsVerified;
482
-
483
- fileContexts = [ ///
484
- ...fileContexts
485
- ];
486
-
487
- for (;;) {
488
- const fileContextsLength = fileContexts.length;
489
-
490
- if (fileContextsLength === 0) {
491
- break;
492
- }
493
-
494
- let fileContextsVerified = false;
495
-
496
- fileContexts.forEach((fileContext) => {
497
- const fileContextVerified = verifyFileContext(fileContext);
498
-
499
- if (fileContextVerified) {
500
- const verifiedFileContext = fileContext; ///
501
-
502
- verifiedFileContexts.push(verifiedFileContext);
503
-
504
- fileContextsVerified = true;
505
- }
506
- });
507
-
508
- if (!fileContextsVerified) {
509
- break;
510
- }
511
-
512
- leftDifference(fileContexts, verifiedFileContexts);
513
- }
514
-
515
- const fileContextsLength = fileContexts.length;
516
-
517
- fileContextsVerified = (fileContextsLength === 0);
479
+ const resolved = resolve(fileContexts, verifiedFileContexts, (fileContext) => {
480
+ const fileContextVerified = verifyFileContext(fileContext);
481
+
482
+ if (fileContextVerified) {
483
+ return true;
484
+ }
485
+ }),
486
+ fileContextsVerified = resolved; ///
518
487
 
519
488
  return fileContextsVerified;
520
489
  }
package/src/derivation.js CHANGED
@@ -1,10 +1,13 @@
1
1
  "use strict";
2
2
 
3
+ import { arrayUtilities } from "necessary";
4
+
3
5
  import shim from "./shim";
4
6
 
5
- import { last } from "./utilities/array";
6
7
  import { nodesQuery } from "./utilities/query";
7
8
 
9
+ const { last } = arrayUtilities;
10
+
8
11
  const proofStepNodesQuery = nodesQuery("/derivation/proofStep|lastProofStep");
9
12
 
10
13
  export default class Derivation {
package/src/frame.js CHANGED
@@ -1,8 +1,11 @@
1
1
  "use strict";
2
2
 
3
- import { first } from "./utilities/array";
3
+ import { arrayUtilities } from "necessary";
4
+
4
5
  import { metavariableNameFromMetavariableNode } from "./utilities/name";
5
6
 
7
+ const { first } = arrayUtilities;
8
+
6
9
  export default class Frame {
7
10
  constructor(declarations, metavariableNodes) {
8
11
  this.declarations = declarations;
package/src/rule.js CHANGED
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ import { arrayUtilities } from "necessary";
4
+
3
5
  import Label from "./label";
4
6
  import Proof from "./proof";
5
7
  import Premise from "./premise";
@@ -7,9 +9,10 @@ import Conclusion from "./conclusion";
7
9
  import LocalContext from "./context/local";
8
10
  import Substitutions from "./substitutions";
9
11
 
10
- import { reverse, correlate } from "./utilities/array";
11
12
  import { nodeQuery, nodesQuery } from "./utilities/query";
12
13
 
14
+ const { reverse, correlate } = arrayUtilities;
15
+
13
16
  const proofNodeQuery = nodeQuery("/rule/proof"),
14
17
  labelNodesQuery = nodesQuery("/rule/label"),
15
18
  premiseNodesQuery = nodesQuery("/rule/premise"),
@@ -1,10 +1,13 @@
1
1
  "use strict";
2
2
 
3
+ import { arrayUtilities } from "necessary";
4
+
3
5
  import shim from "./shim";
4
6
 
5
- import { last } from "./utilities/array";
6
7
  import { nodesQuery } from "./utilities/query";
7
8
 
9
+ const { last } = arrayUtilities;
10
+
8
11
  const proofStepNodesQuery = nodesQuery("/subDerivation/proofStep|lastProofStep");
9
12
 
10
13
  export default class SubDerivation {
@@ -1,7 +1,10 @@
1
1
  "use strict";
2
2
 
3
+ import { arrayUtilities } from "necessary";
4
+
3
5
  import { EMPTY_STRING } from "./constants";
4
- import { find, first, prune, compress, rightDifference } from "./utilities/array";
6
+
7
+ const { find, first, prune, filter, compress } = arrayUtilities;
5
8
 
6
9
  export default class Substitutions {
7
10
  constructor(array, savedArray) {
@@ -286,3 +289,13 @@ export default class Substitutions {
286
289
  return substitutions;
287
290
  }
288
291
  }
292
+
293
+ function rightDifference(arrayA, arrayB) {
294
+ filter(arrayB, (elementB) => {
295
+ const arrayAIncludesElementB = arrayA.includes(elementB);
296
+
297
+ if (!arrayAIncludesElementB) {
298
+ return true;
299
+ }
300
+ });
301
+ }
package/src/term.js CHANGED
@@ -1,14 +1,17 @@
1
1
  "use strict";
2
2
 
3
+ import { arrayUtilities } from "necessary";
4
+
3
5
  import shim from "./shim";
4
6
  import unifyMixins from "./mixins/term/unify";
5
7
  import verifyMixins from "./mixins/term/verify";
6
8
  import termAsConstructorVerifier from "./verifier/termAsConstructor";
7
9
 
8
- import { filter } from "./utilities/array";
10
+ import { objectType } from "./type";
9
11
  import { nodesQuery } from "./utilities/query"
10
12
  import { termNodeFromTermString } from "./utilities/node";
11
- import {objectType} from "./type";
13
+
14
+ const { filter } = arrayUtilities;
12
15
 
13
16
  const variableNodesQuery = nodesQuery("//variable");
14
17
 
@@ -1,11 +1,13 @@
1
1
  "use strict";
2
2
 
3
+ import { arrayUtilities } from "necessary";
4
+
3
5
  import Label from "./label";
4
6
  import Consequent from "./consequent";
5
7
  import Supposition from "./supposition";
6
8
  import Substitutions from "./substitutions";
7
9
 
8
- import { reverse, correlate } from "./utilities/array";
10
+ const { reverse, correlate } = arrayUtilities;
9
11
 
10
12
  export default class TopLevelAssertion {
11
13
  constructor(fileContext, labels, suppositions, consequent, proof) {
@@ -1,8 +1,11 @@
1
1
  "use strict";
2
2
 
3
- import { last } from "./array";
3
+ import { arrayUtilities } from "necessary";
4
+
4
5
  import { FUNCTION } from "../constants";
5
6
 
7
+ const { last } = arrayUtilities;
8
+
6
9
  export function isLastRemainingArgumentFunction(remainingArguments) {
7
10
  let lastRemainingArgumentFunction = false;
8
11
 
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
 
3
+ import { arrayUtilities } from "necessary";
4
+
3
5
  import Equivalence from "../equivalence";
4
6
 
5
- import { push, compress, separate } from "../utilities/array";
7
+ const { push, compress, separate } = arrayUtilities;
6
8
 
7
9
  export function mergeEquivalences(equivalencesA, equivalencesB, localContext) {
8
10
  const typesA = typesFromEquivalences(equivalencesA, localContext),
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
 
3
- import { last } from "../utilities/array";
3
+ import { arrayUtilities } from "necessary";
4
+
5
+ const { last } = arrayUtilities;
4
6
 
5
7
  export function createReleaseContext(dependency, dependentNames, context, callback) {
6
8
  const { log, releaseContextMap } = context,
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
 
3
- import { match } from "../utilities/array";
3
+ import { arrayUtilities } from "necessary";
4
+
5
+ const { match } = arrayUtilities;
4
6
 
5
7
  export function terminalNodeMapFromNodes(nodes) {
6
8
  const terminalNodeMap = {};
@@ -1,13 +1,16 @@
1
1
  "use strict";
2
2
 
3
+ import { arrayUtilities } from "necessary";
4
+
3
5
  import Judgement from "../judgement";
4
6
  import verifyFrame from "../verify/frame";
5
7
  import verifyDeclaration from "./declaration";
6
8
  import JudgementAssignment from "../assignment/judgement";
7
9
 
8
- import { first } from "../utilities/array";
9
10
  import { nodeQuery } from "../utilities/query";
10
11
 
12
+ const { first } = arrayUtilities;
13
+
11
14
  const frameNodeQuery = nodeQuery("/judgement/frame"),
12
15
  declarationNodeQuery = nodeQuery("/judgement/declaration");
13
16
 
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ import { arrayUtilities } from "necessary";
4
+
3
5
  import MetaLemma from "../metaLemma";
4
6
  // import verifyProof from "../verify/proof";
5
7
  import LocalContext from "../context/local";
@@ -7,10 +9,11 @@ import Substitutions from "../substitutions";
7
9
  // import verifyConsequent from "../verify/consequent";
8
10
  // import verifySuppositions from "../verify/suppositions";
9
11
 
10
- import { first } from "../utilities/array";
11
12
  import { EMPTY_STRING } from "../constants";
12
13
  import { nodeQuery, nodesQuery } from "../utilities/query";
13
14
 
15
+ const { first } = arrayUtilities;
16
+
14
17
  const proofNodeQuery = nodeQuery("/metaLemma/proof!"),
15
18
  labelNodesQuery = nodesQuery("/metaLemma/label"),
16
19
  consequentNodeQuery = nodeQuery("/metaLemma/consequent!"),
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ import { arrayUtilities } from "necessary";
4
+
3
5
  // import verifyProof from "../verify/proof";
4
6
  import Metatheorem from "../metatheorem";
5
7
  import LocalContext from "../context/local";
@@ -7,9 +9,10 @@ import Substitutions from "../substitutions";
7
9
  // import verifyConsequent from "../verify/consequent";
8
10
  // import verifySuppositions from "../verify/suppositions";
9
11
 
10
- import { first } from "../utilities/array";
11
12
  import { nodeQuery, nodesQuery } from "../utilities/query";
12
13
 
14
+ const { first } = arrayUtilities;
15
+
13
16
  const labelNodesQuery = nodesQuery("/metatheorem/label"),
14
17
  proofNodeQuery = nodeQuery("/metatheorem/proof!"),
15
18
  consequentNodeQuery = nodeQuery("/metatheorem/consequent!"),
@@ -1,83 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
6
- for(var name in all)Object.defineProperty(target, name, {
7
- enumerable: true,
8
- get: all[name]
9
- });
10
- }
11
- _export(exports, {
12
- clear: function() {
13
- return clear;
14
- },
15
- compress: function() {
16
- return compress;
17
- },
18
- correlate: function() {
19
- return correlate;
20
- },
21
- extract: function() {
22
- return extract;
23
- },
24
- filter: function() {
25
- return filter;
26
- },
27
- find: function() {
28
- return find;
29
- },
30
- first: function() {
31
- return first;
32
- },
33
- front: function() {
34
- return front;
35
- },
36
- last: function() {
37
- return last;
38
- },
39
- leftDifference: function() {
40
- return leftDifference;
41
- },
42
- match: function() {
43
- return match;
44
- },
45
- prune: function() {
46
- return prune;
47
- },
48
- push: function() {
49
- return push;
50
- },
51
- reverse: function() {
52
- return reverse;
53
- },
54
- rightDifference: function() {
55
- return rightDifference;
56
- },
57
- separate: function() {
58
- return separate;
59
- },
60
- tail: function() {
61
- return tail;
62
- }
63
- });
64
- var _necessary = require("necessary");
65
- var first = _necessary.arrayUtilities.first, last = _necessary.arrayUtilities.last, front = _necessary.arrayUtilities.front, tail = _necessary.arrayUtilities.tail, push = _necessary.arrayUtilities.push, find = _necessary.arrayUtilities.find, match = _necessary.arrayUtilities.match, clear = _necessary.arrayUtilities.clear, prune = _necessary.arrayUtilities.prune, reverse = _necessary.arrayUtilities.reverse, extract = _necessary.arrayUtilities.extract, correlate = _necessary.arrayUtilities.correlate, filter = _necessary.arrayUtilities.filter, compress = _necessary.arrayUtilities.compress, separate = _necessary.arrayUtilities.separate;
66
- function leftDifference(arrayA, arrayB) {
67
- filter(arrayA, function(elementA) {
68
- var arrayBIncludesElementA = arrayB.includes(elementA);
69
- if (!arrayBIncludesElementA) {
70
- return true;
71
- }
72
- });
73
- }
74
- function rightDifference(arrayA, arrayB) {
75
- filter(arrayB, function(elementB) {
76
- var arrayAIncludesElementB = arrayA.includes(elementB);
77
- if (!arrayAIncludesElementB) {
78
- return true;
79
- }
80
- });
81
- }
82
-
83
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsaXRpZXMvYXJyYXkuanMiXSwic291cmNlc0NvbnRlbnQiOlsiXCJ1c2Ugc3RyaWN0XCI7XG5cbmltcG9ydCB7IGFycmF5VXRpbGl0aWVzIH0gZnJvbSBcIm5lY2Vzc2FyeVwiO1xuXG5leHBvcnQgY29uc3QgeyBmaXJzdCwgbGFzdCwgZnJvbnQsIHRhaWwsIHB1c2gsIGZpbmQsIG1hdGNoLCBjbGVhciwgcHJ1bmUsIHJldmVyc2UsIGV4dHJhY3QsIGNvcnJlbGF0ZSwgZmlsdGVyLCBjb21wcmVzcywgc2VwYXJhdGUgfSA9IGFycmF5VXRpbGl0aWVzO1xuXG5leHBvcnQgZnVuY3Rpb24gbGVmdERpZmZlcmVuY2UoYXJyYXlBLCBhcnJheUIpIHtcbiAgZmlsdGVyKGFycmF5QSwgKGVsZW1lbnRBKSA9PiB7XG4gICAgY29uc3QgYXJyYXlCSW5jbHVkZXNFbGVtZW50QSA9IGFycmF5Qi5pbmNsdWRlcyhlbGVtZW50QSk7XG5cbiAgICBpZiAoIWFycmF5QkluY2x1ZGVzRWxlbWVudEEpIHtcbiAgICAgIHJldHVybiB0cnVlO1xuICAgIH1cbiAgfSk7XG59XG5cbmV4cG9ydCBmdW5jdGlvbiByaWdodERpZmZlcmVuY2UoYXJyYXlBLCBhcnJheUIpIHtcbiAgZmlsdGVyKGFycmF5QiwgKGVsZW1lbnRCKSA9PiB7XG4gICAgY29uc3QgYXJyYXlBSW5jb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JJWCxPQUFPRSxPQUFnSFMseUJBQWMsQ0FBOUhULE1BQU1ELFFBQTBHVSx5QkFBYyxDQUF4SFYsT0FBT1MsT0FBbUdDLHlCQUFjLENBQWpIRCxNQUFNSixPQUE2RksseUJBQWMsQ0FBM0dMLE1BQU1QLE9BQXVGWSx5QkFBYyxDQUFyR1osTUFBTUssUUFBaUZPLHlCQUFjLENBQS9GUCxPQUFPVixRQUEwRWlCLHlCQUFjLENBQXhGakIsT0FBT1csUUFBbUVNLHlCQUFjLENBQWpGTixPQUFPRSxVQUE0REkseUJBQWMsQ0FBMUVKLFNBQVNWLFVBQW1EYyx5QkFBYyxDQUFqRWQsU0FBU0QsWUFBMENlLHlCQUFjLENBQXhEZixXQUFXRSxTQUErQmEseUJBQWMsQ0FBN0NiLFFBQVFILFdBQXVCZ0IseUJBQWMsQ0FBckNoQixVQUFVYyxXQUFhRSx5QkFBYyxDQUEzQkY7QUFFbEgsU0FBU04sZUFBZVMsTUFBTSxFQUFFQyxNQUFNO0lBQzNDZixPQUFPYyxRQUFRLFNBQUNFO1FBQ2QsSUFBTUMseUJBQXlCRixPQUFPRyxRQUFRLENBQUNGO1FBRS9DLElBQUksQ0FBQ0Msd0JBQXdCO1lBQzNCLE9BQU87UUFDVDtJQUNGO0FBQ0Y7QUFFTyxTQUFTUCxnQkFBZ0JJLE1BQU0sRUFBRUMsTUFBTTtJQUM1Q2YsT0FBT2UsUUFBUSxTQUFDSTtRQUNkLElBQU1DLHlCQUF5Qk4sT0FBT0ksUUFBUSxDQUFDQztRQUUvQyxJQUFJLENBQUNDLHdCQUF3QjtZQUMzQixPQUFPO1FBQ1Q7SUFDRjtBQUNGIn0=
@@ -1,25 +0,0 @@
1
- "use strict";
2
-
3
- import { arrayUtilities } from "necessary";
4
-
5
- export const { first, last, front, tail, push, find, match, clear, prune, reverse, extract, correlate, filter, compress, separate } = arrayUtilities;
6
-
7
- export function leftDifference(arrayA, arrayB) {
8
- filter(arrayA, (elementA) => {
9
- const arrayBIncludesElementA = arrayB.includes(elementA);
10
-
11
- if (!arrayBIncludesElementA) {
12
- return true;
13
- }
14
- });
15
- }
16
-
17
- export function rightDifference(arrayA, arrayB) {
18
- filter(arrayB, (elementB) => {
19
- const arrayAIncludesElementB = arrayA.includes(elementB);
20
-
21
- if (!arrayAIncludesElementB) {
22
- return true;
23
- }
24
- });
25
- }