occam-verify-cli 0.0.1056 → 0.0.1059
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/lib/assertion/subproof.js +5 -4
- package/lib/context/file.js +30 -29
- package/lib/context/local.js +5 -4
- package/lib/context/release.js +30 -76
- package/lib/derivation.js +4 -3
- package/lib/frame.js +4 -3
- package/lib/rule.js +6 -5
- package/lib/subDerivation.js +4 -3
- package/lib/substitutions.js +16 -7
- package/lib/term.js +5 -4
- package/lib/topLevelAssertion.js +6 -5
- package/lib/utilities/arguments.js +4 -3
- package/lib/utilities/equivalences.js +7 -6
- package/lib/utilities/releaseContext.js +4 -3
- package/lib/utilities/unifier.js +5 -4
- package/lib/verify/judgement.js +6 -5
- package/lib/verify/metaLemma.js +4 -3
- package/lib/verify/metatheorem.js +4 -3
- package/package.json +7 -7
- package/src/assertion/subproof.js +4 -1
- package/src/context/file.js +4 -1
- package/src/context/local.js +4 -1
- package/src/context/release.js +11 -38
- package/src/derivation.js +4 -1
- package/src/frame.js +4 -1
- package/src/rule.js +4 -1
- package/src/subDerivation.js +4 -1
- package/src/substitutions.js +14 -1
- package/src/term.js +5 -2
- package/src/topLevelAssertion.js +3 -1
- package/src/utilities/arguments.js +4 -1
- package/src/utilities/equivalences.js +3 -1
- package/src/utilities/releaseContext.js +3 -1
- package/src/utilities/unifier.js +3 -1
- package/src/verify/judgement.js +4 -1
- package/src/verify/metaLemma.js +4 -1
- package/src/verify/metatheorem.js +4 -1
- package/lib/utilities/array.js +0 -127
- package/src/utilities/array.js +0 -55
|
@@ -8,16 +8,17 @@ Object.defineProperty(exports, "default", {
|
|
|
8
8
|
return verifyMetatheorem;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
+
var _necessary = require("necessary");
|
|
11
12
|
var _metatheorem = /*#__PURE__*/ _interop_require_default(require("../metatheorem"));
|
|
12
13
|
var _local = /*#__PURE__*/ _interop_require_default(require("../context/local"));
|
|
13
14
|
var _substitutions = /*#__PURE__*/ _interop_require_default(require("../substitutions"));
|
|
14
|
-
var _array = require("../utilities/array");
|
|
15
15
|
var _query = require("../utilities/query");
|
|
16
16
|
function _interop_require_default(obj) {
|
|
17
17
|
return obj && obj.__esModule ? obj : {
|
|
18
18
|
default: obj
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
|
+
var first = _necessary.arrayUtilities.first;
|
|
21
22
|
var labelNodesQuery = (0, _query.nodesQuery)("/metatheorem/label"), proofNodeQuery = (0, _query.nodeQuery)("/metatheorem/proof!"), consequentNodeQuery = (0, _query.nodeQuery)("/metatheorem/consequent!"), suppositionsNodeQuery = (0, _query.nodesQuery)("/metatheorem/supposition");
|
|
22
23
|
function verifyMetatheorem(metatheoremNode, fileContext) {
|
|
23
24
|
var metatheoremVerified = false;
|
|
@@ -29,7 +30,7 @@ function verifyMetatheorem(metatheoremNode, fileContext) {
|
|
|
29
30
|
if (suppositionsVerified) {
|
|
30
31
|
var consequents = [], consequentNode = consequentNodeQuery(metatheoremNode), consequentVerified = verifyConsequent(consequentNode, consequents, localContext);
|
|
31
32
|
if (consequentVerified) {
|
|
32
|
-
var proofNode = proofNodeQuery(metatheoremNode), firstConsequent =
|
|
33
|
+
var proofNode = proofNodeQuery(metatheoremNode), firstConsequent = first(consequents), consequent = firstConsequent, substitutions = _substitutions.default.fromNothing(), statementNode = consequent.getStatementNode(), proofVerified = verifyProof(proofNode, statementNode, substitutions, localContext);
|
|
33
34
|
if (proofVerified) {
|
|
34
35
|
var metatheorem = _metatheorem.default.fromLabelsSuppositionsConsequentSubstitutionsAndFileContext(labels, suppositions, consequent, substitutions, fileContext);
|
|
35
36
|
fileContext.addMetatheorem(metatheorem);
|
|
@@ -44,4 +45,4 @@ function verifyMetatheorem(metatheoremNode, fileContext) {
|
|
|
44
45
|
return metatheoremVerified;
|
|
45
46
|
}
|
|
46
47
|
|
|
47
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
48
|
+
//# sourceMappingURL=data:application/json;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sRUFDakJDLG1CQUFtQmYsc0JBQXNCQyxrQkFDekNlLHVCQUF1QkMsbUJBQW1CRixrQkFBa0JELGNBQWNIO1FBRWhGLElBQUlLLHNCQUFzQjtZQUN4QixJQUFNRSxjQUFjLEVBQUUsRUFDaEJDLGlCQUFpQnBCLG9CQUFvQkUsa0JBQ3JDbUIscUJBQXFCQyxpQkFBaUJGLGdCQUFnQkQsYUFBYVA7WUFFekUsSUFBSVMsb0JBQW9CO2dCQUN0QixJQUFNRSxZQUFZekIsZUFBZUksa0JBQzNCc0Isa0JBQWtCOUIsTUFBTXlCLGNBQ3hCTSxhQUFhRCxpQkFDYkUsZ0JBQWdCQyxzQkFBYSxDQUFDQyxXQUFXLElBQ3pDQyxnQkFBZ0JKLFdBQVdLLGdCQUFnQixJQUMzQ0MsZ0JBQWdCQyxZQUFZVCxXQUFXTSxlQUFlSCxlQUFlZDtnQkFFM0UsSUFBSW1CLGVBQWU7b0JBQ2pCLElBQU1FLGNBQWNDLG9CQUFXLENBQUNDLDJEQUEyRCxDQUFDMUIsUUFBUU0sY0FBY1UsWUFBWUMsZUFBZXZCO29CQUU3SUEsWUFBWWlDLGNBQWMsQ0FBQ0g7b0JBRTNCN0Isc0JBQXNCO2dCQUN4QjtZQUNGO1FBQ0Y7SUFDRjtJQUVBLElBQUlBLHFCQUFxQjtRQUN2QkQsWUFBWWtDLEtBQUssQ0FBQyxBQUFDLG9CQUFnQyxPQUFiL0IsY0FBYSxtQkFBaUJKO0lBQ3RFO0lBRUEsT0FBT0U7QUFDVCJ9
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "occam-verify-cli",
|
|
3
3
|
"author": "James Smith",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.1059",
|
|
5
5
|
"license": "MIT, Anti-996",
|
|
6
6
|
"homepage": "https://github.com/djalbat/occam-verify-cli",
|
|
7
7
|
"description": "Occam's Verifier",
|
|
@@ -11,12 +11,12 @@
|
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"argumentative": "^2.0.32",
|
|
14
|
-
"necessary": "^14.
|
|
15
|
-
"occam-custom-grammars": "^5.0.
|
|
16
|
-
"occam-entities": "^1.0.
|
|
17
|
-
"occam-file-system": "^6.0.
|
|
18
|
-
"occam-grammar-utilities": "^8.0.
|
|
19
|
-
"occam-query": "^3.1.
|
|
14
|
+
"necessary": "^14.2.1",
|
|
15
|
+
"occam-custom-grammars": "^5.0.885",
|
|
16
|
+
"occam-entities": "^1.0.175",
|
|
17
|
+
"occam-file-system": "^6.0.212",
|
|
18
|
+
"occam-grammar-utilities": "^8.0.220",
|
|
19
|
+
"occam-query": "^3.1.196"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@swc/core": "^1.5.6",
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { arrayUtilities } from "necessary";
|
|
4
|
+
|
|
3
5
|
import shim from "../shim";
|
|
4
6
|
import LocalContext from "../context/local";
|
|
5
7
|
import metaLevelUnifier from "../unifier/metaLevel";
|
|
6
8
|
import metaLevelVerifier from "../verifier/metaLevel";
|
|
7
9
|
|
|
8
|
-
import { front, last, match } from "../utilities/array";
|
|
9
10
|
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
10
11
|
|
|
12
|
+
const { front, last, match } = arrayUtilities;
|
|
13
|
+
|
|
11
14
|
const statementNodesQuery = nodesQuery("/subproofAssertion/statement"),
|
|
12
15
|
subproofAssertionNodeQuery = nodeQuery("/statement/subproofAssertion");
|
|
13
16
|
|
package/src/context/file.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { arrayUtilities } from "necessary";
|
|
4
|
+
|
|
3
5
|
import shim from "../shim";
|
|
4
6
|
import Rule from "../rule";
|
|
5
7
|
import Axiom from "../axiom";
|
|
@@ -14,10 +16,11 @@ import Constructor from "../constructor";
|
|
|
14
16
|
import Metatheorem from "../metatheorem";
|
|
15
17
|
import Metavariable from "../metavariable";
|
|
16
18
|
|
|
17
|
-
import { push } from "../utilities/array";
|
|
18
19
|
import { objectType } from "../type";
|
|
19
20
|
import { nodeAsString, nodesAsString } from "../utilities/string";
|
|
20
21
|
|
|
22
|
+
const { push } = arrayUtilities;
|
|
23
|
+
|
|
21
24
|
export default class FileContext {
|
|
22
25
|
constructor(releaseContext, filePath, tokens, node, types, rules, axioms, lemmas, theorems, variables, metaLemmas, conjectures, combinators, constructors, metatheorems, metavariables) {
|
|
23
26
|
this.releaseContext = releaseContext;
|
package/src/context/local.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { arrayUtilities } from "necessary";
|
|
4
|
+
|
|
3
5
|
import Equivalence from "../equivalence";
|
|
4
6
|
|
|
5
|
-
import { last, reverse } from "../utilities/array";
|
|
6
7
|
import { metavariableNameFromMetavariableNode } from "../utilities/name";
|
|
7
8
|
import { mergeEquivalences, findEquivalenceByTerm, groundedTermsAndDefinedVariablesFromFromEquivalences } from "../utilities/equivalences";
|
|
8
9
|
|
|
10
|
+
const { last, reverse } = arrayUtilities;
|
|
11
|
+
|
|
9
12
|
class LocalContext {
|
|
10
13
|
constructor(context, variables, proofSteps, judgements, equivalences, metavariables) {
|
|
11
14
|
this.context = context;
|
package/src/context/release.js
CHANGED
|
@@ -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
|
|
|
@@ -478,43 +480,14 @@ function fileContextsFromEntries(entries, fileContexts, releaseContext) {
|
|
|
478
480
|
}
|
|
479
481
|
|
|
480
482
|
function verifyFileContexts(fileContexts, verifiedFileContexts) {
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
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);
|
|
483
|
+
const resolved = resolve(fileContexts, verifiedFileContexts, (fileContext) => {
|
|
484
|
+
const fileContextVerified = verifyFileContext(fileContext);
|
|
485
|
+
|
|
486
|
+
if (fileContextVerified) {
|
|
487
|
+
return true;
|
|
488
|
+
}
|
|
489
|
+
}),
|
|
490
|
+
fileContextsVerified = resolved; ///
|
|
518
491
|
|
|
519
492
|
return fileContextsVerified;
|
|
520
493
|
}
|
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 {
|
|
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"),
|
package/src/subDerivation.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("/subDerivation/proofStep|lastProofStep");
|
|
9
12
|
|
|
10
13
|
export default class SubDerivation {
|
package/src/substitutions.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { arrayUtilities } from "necessary";
|
|
4
|
+
|
|
3
5
|
import { EMPTY_STRING } from "./constants";
|
|
4
|
-
|
|
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 {
|
|
10
|
+
import { objectType } from "./type";
|
|
9
11
|
import { nodesQuery } from "./utilities/query"
|
|
10
12
|
import { termNodeFromTermString } from "./utilities/node";
|
|
11
|
-
|
|
13
|
+
|
|
14
|
+
const { filter } = arrayUtilities;
|
|
12
15
|
|
|
13
16
|
const variableNodesQuery = nodesQuery("//variable");
|
|
14
17
|
|
package/src/topLevelAssertion.js
CHANGED
|
@@ -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
|
-
|
|
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 {
|
|
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
|
-
|
|
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 {
|
|
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,
|
package/src/utilities/unifier.js
CHANGED
package/src/verify/judgement.js
CHANGED
|
@@ -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
|
|
package/src/verify/metaLemma.js
CHANGED
|
@@ -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!"),
|
package/lib/utilities/array.js
DELETED
|
@@ -1,127 +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
|
-
function _array_like_to_array(arr, len) {
|
|
66
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
67
|
-
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
68
|
-
return arr2;
|
|
69
|
-
}
|
|
70
|
-
function _array_without_holes(arr) {
|
|
71
|
-
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
72
|
-
}
|
|
73
|
-
function _iterable_to_array(iter) {
|
|
74
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
75
|
-
}
|
|
76
|
-
function _non_iterable_spread() {
|
|
77
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
78
|
-
}
|
|
79
|
-
function _to_consumable_array(arr) {
|
|
80
|
-
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
81
|
-
}
|
|
82
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
83
|
-
if (!o) return;
|
|
84
|
-
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
85
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
86
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
87
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
88
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
89
|
-
}
|
|
90
|
-
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, extract = _necessary.arrayUtilities.extract, filter = _necessary.arrayUtilities.filter, compress = _necessary.arrayUtilities.compress, separate = _necessary.arrayUtilities.separate;
|
|
91
|
-
function reverse(array) {
|
|
92
|
-
array = _to_consumable_array(array).reverse();
|
|
93
|
-
return array;
|
|
94
|
-
}
|
|
95
|
-
function correlate(arrayA, arrayB, callback) {
|
|
96
|
-
arrayB = _to_consumable_array(arrayB);
|
|
97
|
-
var correlates = arrayA.every(function(elementA) {
|
|
98
|
-
var elementB = extract(arrayB, function(elementB) {
|
|
99
|
-
var result = callback(elementA, elementB);
|
|
100
|
-
if (result) {
|
|
101
|
-
return true;
|
|
102
|
-
}
|
|
103
|
-
}) || null;
|
|
104
|
-
if (elementB !== null) {
|
|
105
|
-
return true;
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
return correlates;
|
|
109
|
-
}
|
|
110
|
-
function leftDifference(arrayA, arrayB) {
|
|
111
|
-
filter(arrayA, function(elementA) {
|
|
112
|
-
var arrayBIncludesElementA = arrayB.includes(elementA);
|
|
113
|
-
if (!arrayBIncludesElementA) {
|
|
114
|
-
return true;
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
function rightDifference(arrayA, arrayB) {
|
|
119
|
-
filter(arrayB, function(elementB) {
|
|
120
|
-
var arrayAIncludesElementB = arrayA.includes(elementB);
|
|
121
|
-
if (!arrayAIncludesElementB) {
|
|
122
|
-
return true;
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsaXRpZXMvYXJyYXkuanMiXSwic291cmNlc0NvbnRlbnQiOlsiXCJ1c2Ugc3RyaWN0XCI7XG5cbmltcG9ydCB7IGFycmF5VXRpbGl0aWVzIH0gZnJvbSBcIm5lY2Vzc2FyeVwiO1xuXG5leHBvcnQgY29uc3QgeyBmaXJzdCwgbGFzdCwgZnJvbnQsIHRhaWwsIHB1c2gsIGZpbmQsIG1hdGNoLCBjbGVhciwgcHJ1bmUsIGV4dHJhY3QsIGZpbHRlciwgY29tcHJlc3MsIHNlcGFyYXRlIH0gPSBhcnJheVV0aWxpdGllcztcblxuZXhwb3J0IGZ1bmN0aW9uIHJldmVyc2UoYXJyYXkpIHtcbiAgYXJyYXkgPSBbIC8vL1xuICAgIC4uLmFycmF5XG4gIF0ucmV2ZXJzZSgpO1xuXG4gIHJldHVybiBh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NKO1FBRS9DLElBQUksQ0FBQ0csd0JBQXdCO1lBQzNCLE9BQU87UUFDVDtJQUNGO0FBQ0Y7QUFFTyxTQUFTYixnQkFBZ0JLLE1BQU0sRUFBRUMsTUFBTTtJQUM1Q2hCLE9BQU9nQixRQUFRLFNBQUNLO1FBQ2QsSUFBTUkseUJBQXlCVixPQUFPUyxRQUFRLENBQUNIO1FBRS9DLElBQUksQ0FBQ0ksd0JBQXdCO1lBQzNCLE9BQU87UUFDVDtJQUNGO0FBQ0YifQ==
|
package/src/utilities/array.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { arrayUtilities } from "necessary";
|
|
4
|
-
|
|
5
|
-
export const { first, last, front, tail, push, find, match, clear, prune, extract, filter, compress, separate } = arrayUtilities;
|
|
6
|
-
|
|
7
|
-
export function reverse(array) {
|
|
8
|
-
array = [ ///
|
|
9
|
-
...array
|
|
10
|
-
].reverse();
|
|
11
|
-
|
|
12
|
-
return array;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function correlate(arrayA, arrayB, callback) {
|
|
16
|
-
arrayB = [ ///
|
|
17
|
-
...arrayB
|
|
18
|
-
];
|
|
19
|
-
|
|
20
|
-
const correlates = arrayA.every((elementA) => {
|
|
21
|
-
const elementB = extract(arrayB, (elementB) => {
|
|
22
|
-
const result = callback(elementA, elementB);
|
|
23
|
-
|
|
24
|
-
if (result) {
|
|
25
|
-
return true;
|
|
26
|
-
}
|
|
27
|
-
}) || null;
|
|
28
|
-
|
|
29
|
-
if (elementB !== null) {
|
|
30
|
-
return true;
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
return correlates;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export function leftDifference(arrayA, arrayB) {
|
|
38
|
-
filter(arrayA, (elementA) => {
|
|
39
|
-
const arrayBIncludesElementA = arrayB.includes(elementA);
|
|
40
|
-
|
|
41
|
-
if (!arrayBIncludesElementA) {
|
|
42
|
-
return true;
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export function rightDifference(arrayA, arrayB) {
|
|
48
|
-
filter(arrayB, (elementB) => {
|
|
49
|
-
const arrayAIncludesElementB = arrayA.includes(elementB);
|
|
50
|
-
|
|
51
|
-
if (!arrayAIncludesElementB) {
|
|
52
|
-
return true;
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
}
|