occam-verify-cli 0.0.936 → 0.0.938
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/conclusion.js +7 -10
- package/lib/consequent.js +7 -10
- package/lib/context/local.js +1 -1
- package/lib/equality.js +2 -5
- package/lib/premise.js +15 -21
- package/lib/proofStep.js +3 -6
- package/lib/rule.js +23 -23
- package/lib/substitution/statementForMetavariable.js +3 -6
- package/lib/supposition.js +15 -21
- package/lib/topLevelAssertion.js +27 -23
- package/lib/unifier/equality.js +37 -107
- package/lib/unifier/metaLevel.js +48 -121
- package/lib/unifier/statementAgainstCombinator.js +41 -123
- package/lib/unifier/termAgainstConstructor.js +29 -103
- package/lib/unifier.js +60 -41
- package/lib/unify/metavariableAgainstStatement.js +5 -5
- package/lib/unify/statementAgainstMetaType.js +10 -4
- package/lib/unify/statementAtainstStatement.js +3 -6
- package/lib/unify/termAgainstTerm.js +1 -1
- package/lib/unify/termAgainstType.js +10 -4
- package/lib/utilities/string.js +2 -2
- package/lib/utilities/unifier.js +51 -0
- package/lib/verifier/metaLevel.js +48 -128
- package/lib/verifier/statementAsCombinator.js +48 -128
- package/lib/verifier/termAsConstructor.js +42 -112
- package/lib/verifier.js +50 -33
- package/lib/verify/assertion/contained.js +3 -6
- package/lib/verify/assertion/defined.js +3 -6
- package/lib/verify/assertion/subproof.js +9 -14
- package/lib/verify/statement/qualified.js +7 -7
- package/lib/verify/statement.js +10 -54
- package/lib/verify/statementAsCombinator.js +4 -8
- package/lib/verify/term.js +5 -5
- package/lib/verify/termAsConstructor.js +30 -23
- package/package.json +2 -2
- package/src/conclusion.js +8 -12
- package/src/consequent.js +8 -12
- package/src/context/local.js +7 -7
- package/src/equality.js +2 -8
- package/src/premise.js +20 -28
- package/src/proofStep.js +5 -9
- package/src/rule.js +22 -22
- package/src/substitution/statementForMetavariable.js +4 -8
- package/src/supposition.js +20 -28
- package/src/topLevelAssertion.js +29 -22
- package/src/unifier/equality.js +31 -59
- package/src/unifier/metaLevel.js +50 -83
- package/src/unifier/statementAgainstCombinator.js +33 -83
- package/src/unifier/termAgainstConstructor.js +19 -57
- package/src/unifier.js +57 -31
- package/src/unify/metavariableAgainstStatement.js +5 -3
- package/src/unify/statementAgainstMetaType.js +8 -3
- package/src/unify/statementAtainstStatement.js +4 -8
- package/src/unify/termAgainstTerm.js +1 -1
- package/src/unify/termAgainstType.js +7 -3
- package/src/utilities/string.js +1 -1
- package/src/verifier/metaLevel.js +37 -81
- package/src/verifier/statementAsCombinator.js +39 -82
- package/src/verifier/termAsConstructor.js +33 -62
- package/src/verifier.js +47 -21
- package/src/verify/assertion/contained.js +2 -7
- package/src/verify/assertion/defined.js +2 -7
- package/src/verify/assertion/subproof.js +3 -16
- package/src/verify/statement/qualified.js +7 -7
- package/src/verify/statement.js +10 -78
- package/src/verify/statementAsCombinator.js +3 -11
- package/src/verify/term.js +8 -8
- package/src/verify/termAsConstructor.js +40 -27
- package/lib/unify/argumentAgainstArgument.js +0 -24
- package/lib/utilities/terminalNodes.js +0 -51
- package/src/unify/argumentAgainstArgument.js +0 -15
- /package/src/utilities/{terminalNodes.js → unifier.js} +0 -0
|
@@ -9,8 +9,8 @@ Object.defineProperty(exports, "default", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
var _constructor = /*#__PURE__*/ _interop_require_default(require("../constructor"));
|
|
12
|
-
var _local = /*#__PURE__*/ _interop_require_default(require("../context/local"));
|
|
13
12
|
var _termAsConstructor = /*#__PURE__*/ _interop_require_default(require("../verifier/termAsConstructor"));
|
|
13
|
+
var _array = require("../utilities/array");
|
|
14
14
|
function _interop_require_default(obj) {
|
|
15
15
|
return obj && obj.__esModule ? obj : {
|
|
16
16
|
default: obj
|
|
@@ -20,32 +20,39 @@ function verifyTermAsConstructor(termNode, typeNode, fileContext) {
|
|
|
20
20
|
var termVerifiedAsConstructor = false;
|
|
21
21
|
var termString = fileContext.nodeAsString(termNode);
|
|
22
22
|
fileContext.debug("Verifying the '".concat(termString, "' term as a constructor..."), termNode);
|
|
23
|
-
var
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
if (type !== null) {
|
|
34
|
-
termVerifiedAsConstructor = true;
|
|
35
|
-
} else {
|
|
36
|
-
var typeString = fileContext.nodeAsString(typeNode);
|
|
37
|
-
fileContext.debug("The '".concat(termString, "' constructor's '").concat(typeString, "' type is not present."), termNode);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
if (termVerifiedAsConstructor) {
|
|
41
|
-
var tokens = fileContext.getTokens(), constructor = _constructor.default.fromTermNodeTypeAndTokens(termNode, type, tokens);
|
|
42
|
-
fileContext.addConstructor(constructor);
|
|
43
|
-
}
|
|
23
|
+
var types = [], typeVerified = verifyType(typeNode, types, fileContext);
|
|
24
|
+
var type;
|
|
25
|
+
if (typeVerified) {
|
|
26
|
+
var firstType = (0, _array.first)(types);
|
|
27
|
+
type = firstType; ///
|
|
28
|
+
termVerifiedAsConstructor = _termAsConstructor.default.verify(termNode, fileContext);
|
|
29
|
+
}
|
|
30
|
+
if (termVerifiedAsConstructor) {
|
|
31
|
+
var tokens = fileContext.getTokens(), constructor = _constructor.default.fromTermNodeTypeAndTokens(termNode, type, tokens);
|
|
32
|
+
fileContext.addConstructor(constructor);
|
|
44
33
|
}
|
|
45
34
|
if (termVerifiedAsConstructor) {
|
|
46
35
|
fileContext.debug("...verified the '".concat(termString, "' term as a constructor."), termNode);
|
|
47
36
|
}
|
|
48
37
|
return termVerifiedAsConstructor;
|
|
49
38
|
}
|
|
39
|
+
function verifyType(typeNode, types, fileContext) {
|
|
40
|
+
var typeVerified = false;
|
|
41
|
+
if (typeNode === null) {
|
|
42
|
+
var type = null;
|
|
43
|
+
types.push(type);
|
|
44
|
+
typeVerified = true;
|
|
45
|
+
} else {
|
|
46
|
+
var type1 = fileContext.findTypeByTypeNode(typeNode);
|
|
47
|
+
if (type1 !== null) {
|
|
48
|
+
types.push(type1);
|
|
49
|
+
typeVerified = true;
|
|
50
|
+
} else {
|
|
51
|
+
var typeString = fileContext.nodeAsString(typeNode);
|
|
52
|
+
fileContext.debug("The '".concat(typeString, "' type is not present."), typeNode);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return typeVerified;
|
|
56
|
+
}
|
|
50
57
|
|
|
51
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
58
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy92ZXJpZnkvdGVybUFzQ29uc3RydWN0b3IuanMiXSwic291cmNlc0NvbnRlbnQiOlsiXCJ1c2Ugc3RyaWN0XCI7XG5cbmltcG9ydCBDb25zdHJ1Y3RvciBmcm9tIFwiLi4vY29uc3RydWN0b3JcIjtcbmltcG9ydCB0ZXJtQXNDb25zdHJ1Y3RvclZlcmlmaWVyIGZyb20gXCIuLi92ZXJpZmllci90ZXJtQXNDb25zdHJ1Y3RvclwiO1xuXG5pbXBvcnQgeyBmaXJzdCB9IGZyb20gXCIuLi91dGlsaXRpZXMvYXJyYXlcIjtcblxuZXhwb3J0IGRlZmF1bHQgZnVuY3Rpb24gdmVyaWZ5VGVybUFzQ29uc3RydWN0b3IodGVybU5vZGUsIHR5cGVOb2RlLCBmaWxlQ29udGV4dCkge1xuICBsZXQgdGVybVZlcmlmaWVkQXNDb25zdHJ1Y3RvciA9IGZhbHNlO1xuXG4gIGNvbnN0IHRlcm1TdHJpbmcgPSBmaWxlQ29udGV4dC5ub2RlQXNTdHJpbmcodGVybU5vZGUpO1xuXG4gIGZpbGVDb250ZXh0LmRlYnVnKGBWZXJpZnlpbmcgdGhlICcke3Rlcm1TdHJpbmd9JyB0ZXJtIGFzIGEgY29uc3RydWN0b3IuLi5gLCB0ZXJtTm9kZSk7XG5cbiAgY29uc3QgdHlwZXMgPSBbXS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CLGtCQUFrQixDQUFDckI7UUFFNUMsSUFBSVMsVUFBUyxNQUFNO1lBQ2pCSCxNQUFNYyxJQUFJLENBQUNYO1lBRVhGLGVBQWU7UUFDakIsT0FBTztZQUNMLElBQU1lLGFBQWFyQixZQUFZRyxZQUFZLENBQUNKO1lBRTVDQyxZQUFZSSxLQUFLLENBQUMsQUFBQyxRQUFrQixPQUFYaUIsWUFBVywyQkFBeUJ0QjtRQUNoRTtJQUNGO0lBRUEsT0FBT087QUFDVCJ9
|
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.938",
|
|
5
5
|
"license": "MIT, Anti-996",
|
|
6
6
|
"homepage": "https://github.com/djalbat/occam-verify-cli",
|
|
7
7
|
"description": "Occam's Verifier",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"argumentative": "^2.0.28",
|
|
14
14
|
"necessary": "^14.0.1",
|
|
15
|
-
"occam-custom-grammars": "^5.0.
|
|
15
|
+
"occam-custom-grammars": "^5.0.839",
|
|
16
16
|
"occam-entities": "^1.0.152",
|
|
17
17
|
"occam-file-system": "^6.0.192",
|
|
18
18
|
"occam-grammar-utilities": "^8.0.207",
|
package/src/conclusion.js
CHANGED
|
@@ -15,25 +15,21 @@ export default class Conclusion {
|
|
|
15
15
|
return this.statementNode;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
let
|
|
18
|
+
unifyStatement(statementNode, substitutions, fileContext, localContext) {
|
|
19
|
+
let statementUnified = false;
|
|
20
20
|
|
|
21
21
|
if (this.statementNode !== null) {
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
const nodeA = this.statementNode, ///
|
|
23
|
+
nodeB = statementNode, ///
|
|
24
|
+
fileContextA = fileContext, ///
|
|
25
25
|
localContextA = LocalContext.fromFileContext(fileContextA),
|
|
26
26
|
localContextB = localContext, ///
|
|
27
|
-
|
|
28
|
-
const verifiedAhead = true;
|
|
27
|
+
unified = metaLevelUnifier.unify(nodeA, nodeB, substitutions, localContextA, localContextB);
|
|
29
28
|
|
|
30
|
-
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
matchesStatementNode = nonTerminalNodeUnified; ///
|
|
29
|
+
statementUnified = unified; ///
|
|
34
30
|
}
|
|
35
31
|
|
|
36
|
-
return
|
|
32
|
+
return statementUnified;
|
|
37
33
|
}
|
|
38
34
|
|
|
39
35
|
toJSON(tokens) {
|
package/src/consequent.js
CHANGED
|
@@ -15,25 +15,21 @@ export default class Consequent {
|
|
|
15
15
|
return this.statementNode;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
let
|
|
18
|
+
unifyStatement(statementNode, substitutions, fileContext, localContext) {
|
|
19
|
+
let statementUnified = false;
|
|
20
20
|
|
|
21
21
|
if (this.statementNode !== null) {
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
const nodeA = this.statementNode, ///
|
|
23
|
+
nodeB = statementNode, ///
|
|
24
|
+
fileContextA = fileContext, ///
|
|
25
25
|
localContextA = LocalContext.fromFileContext(fileContextA),
|
|
26
26
|
localContextB = localContext, ///
|
|
27
|
-
|
|
28
|
-
const verifiedAhead = true;
|
|
27
|
+
unified = metaLevelUnifier.unify(nodeA, nodeB, substitutions, localContextA, localContextB);
|
|
29
28
|
|
|
30
|
-
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
matchesStatementNode = nonTerminalNodeUnified; ///
|
|
29
|
+
statementUnified = unified; ///
|
|
34
30
|
}
|
|
35
31
|
|
|
36
|
-
return
|
|
32
|
+
return statementUnified;
|
|
37
33
|
}
|
|
38
34
|
|
|
39
35
|
toJSON(tokens) {
|
package/src/context/local.js
CHANGED
|
@@ -336,14 +336,14 @@ class LocalContext {
|
|
|
336
336
|
|
|
337
337
|
findVariableByVariableNode(variableNode) {
|
|
338
338
|
const node = variableNode, ///
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
339
|
+
variables = this.getVariables(),
|
|
340
|
+
variable = variables.find((variable) => {
|
|
341
|
+
const matches = variable.matchNode(node);
|
|
342
342
|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
343
|
+
if (matches) {
|
|
344
|
+
return true;
|
|
345
|
+
}
|
|
346
|
+
}) || null;
|
|
347
347
|
|
|
348
348
|
return variable;
|
|
349
349
|
}
|
package/src/equality.js
CHANGED
|
@@ -31,14 +31,8 @@ export default class Equality {
|
|
|
31
31
|
isEqual(localContext) {
|
|
32
32
|
const leftTermNode = this.leftTerm.getNode(),
|
|
33
33
|
rightTermNode = this.rightTerm.getNode(),
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
nonTerminalNodeUnified = equalityUnifier.unifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, localContext, () => {
|
|
37
|
-
const verifiedAhead = true;
|
|
38
|
-
|
|
39
|
-
return verifiedAhead;
|
|
40
|
-
}),
|
|
41
|
-
equal = nonTerminalNodeUnified; ///
|
|
34
|
+
equalityUnified = equalityUnifier.unify(leftTermNode, rightTermNode, localContext),
|
|
35
|
+
equal = equalityUnified; ///
|
|
42
36
|
|
|
43
37
|
return equal;
|
|
44
38
|
}
|
package/src/premise.js
CHANGED
|
@@ -22,35 +22,34 @@ export default class Premise {
|
|
|
22
22
|
return this.statementNode;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
let
|
|
25
|
+
unifyStatement(statementNode, substitutions, fileContext, localContext) {
|
|
26
|
+
let statementUnified = false;
|
|
27
27
|
|
|
28
28
|
if (this.statementNode !== null) {
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
const nodeA = this.statementNode, ///
|
|
30
|
+
nodeB = statementNode, ///
|
|
31
|
+
fileContextA = fileContext, ///
|
|
32
32
|
localContextA = LocalContext.fromFileContext(fileContextA),
|
|
33
33
|
localContextB = localContext, ///
|
|
34
|
-
|
|
35
|
-
const verifiedAhead = true;
|
|
34
|
+
unified = metaLevelUnifier.unify(nodeA, nodeB, substitutions, localContextA, localContextB);
|
|
36
35
|
|
|
37
|
-
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
matchesStatementNode = nonTerminalNodeUnified; ///
|
|
36
|
+
statementUnified = unified; ///
|
|
41
37
|
}
|
|
42
38
|
|
|
43
|
-
return
|
|
39
|
+
return statementUnified;
|
|
44
40
|
}
|
|
45
41
|
|
|
46
|
-
|
|
47
|
-
let
|
|
42
|
+
unifySubproof(subproofNode, substitutions, fileContext, localContext) {
|
|
43
|
+
let subproofUnified = false;
|
|
48
44
|
|
|
49
45
|
if (this.statementNode !== null) {
|
|
50
46
|
const subproofAssertionNode = subproofAssertionNodeQuery(this.statementNode);
|
|
51
47
|
|
|
52
48
|
if (subproofAssertionNode !== null) {
|
|
53
|
-
const
|
|
49
|
+
const fileContextA = fileContext, ///
|
|
50
|
+
localContextA = LocalContext.fromFileContext(fileContextA),
|
|
51
|
+
localContextB = localContext, ///
|
|
52
|
+
subproofSuppositionStatementNodes = subproofSuppositionStatementNodesQuery(subproofNode),
|
|
54
53
|
subproofLastProofStepStatementNode = subproofLastProofStepStatementNodeQuery(subproofNode),
|
|
55
54
|
subproofStatementNodes = [
|
|
56
55
|
...subproofSuppositionStatementNodes,
|
|
@@ -58,26 +57,19 @@ export default class Premise {
|
|
|
58
57
|
],
|
|
59
58
|
subproofAssertionStatementNodes = subproofAssertionStatementNodesQuery(subproofAssertionNode);
|
|
60
59
|
|
|
61
|
-
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
localContextA = LocalContext.fromFileContext(fileContextA),
|
|
66
|
-
localContextB = localContext, ///
|
|
67
|
-
nonTerminalNodeUnified = metaLevelUnifier.unifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, localContextA, localContextB, () => {
|
|
68
|
-
const verifiedAhead = true;
|
|
69
|
-
|
|
70
|
-
return verifiedAhead;
|
|
71
|
-
});
|
|
60
|
+
subproofUnified = match(subproofAssertionStatementNodes, subproofStatementNodes, (subproofAssertionStatementNode, subproofStatementNode) => {
|
|
61
|
+
const nodeA = subproofAssertionStatementNode, ///
|
|
62
|
+
nodeB = subproofStatementNode, ///
|
|
63
|
+
unified = metaLevelUnifier.unify(nodeA, nodeB, substitutions, localContextA, localContextB);
|
|
72
64
|
|
|
73
|
-
if (
|
|
65
|
+
if (unified) {
|
|
74
66
|
return true;
|
|
75
67
|
}
|
|
76
68
|
});
|
|
77
69
|
}
|
|
78
70
|
}
|
|
79
71
|
|
|
80
|
-
return
|
|
72
|
+
return subproofUnified;
|
|
81
73
|
}
|
|
82
74
|
|
|
83
75
|
toJSON(tokens) {
|
package/src/proofStep.js
CHANGED
|
@@ -60,18 +60,14 @@ export default class ProofStep {
|
|
|
60
60
|
function unifyStatementAgainstStatement(statementNodeA, statementNodeB, equivalences, localContext) {
|
|
61
61
|
let statementUnifiedAgainstStatement = false;
|
|
62
62
|
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
substitutions = [],
|
|
63
|
+
const nodeA = statementNodeA, ///
|
|
64
|
+
nodeB = statementNodeB, ///
|
|
66
65
|
localContextA = localContext, ///
|
|
67
66
|
localContextB = localContext, ///
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
return verifiedAhead;
|
|
72
|
-
});
|
|
67
|
+
substitutions = [],
|
|
68
|
+
unified = metaLevelUnifier.unify(nodeA, nodeB, substitutions, localContextA, localContextB);
|
|
73
69
|
|
|
74
|
-
if (
|
|
70
|
+
if (unified) {
|
|
75
71
|
const substitutionsUnified = substitutions.every((substitution) => {
|
|
76
72
|
const substitutionUnified = equivalences.some((equivalence) => {
|
|
77
73
|
const substitutionUnifiedAgainstEquivalence = substitution.unifyAgainstEquivalence(equivalence, substitutions, localContext);
|
package/src/rule.js
CHANGED
|
@@ -30,20 +30,20 @@ export default class Rule {
|
|
|
30
30
|
return this.fileContext;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
let
|
|
33
|
+
unifyStatement(statementNode, localContext) {
|
|
34
|
+
let statementUnified = false;
|
|
35
35
|
|
|
36
36
|
const proofSteps = localContext.getProofSteps(),
|
|
37
37
|
substitutions = [],
|
|
38
|
-
|
|
38
|
+
premisesUnified = unifyPremises(this.premises, proofSteps, substitutions, this.fileContext, localContext);
|
|
39
39
|
|
|
40
|
-
if (
|
|
41
|
-
const
|
|
40
|
+
if (premisesUnified) {
|
|
41
|
+
const conclusionUnified = unifyConclusion(this.conclusion, statementNode, substitutions, this.fileContext, localContext);
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
statementUnified = conclusionUnified; ///
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
return
|
|
46
|
+
return statementUnified;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
matchMetavariableNode(metavariableNode) {
|
|
@@ -128,45 +128,45 @@ export default class Rule {
|
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
function matchPremise(premise, proofStep, substitutions, fileContext, localContext) {
|
|
131
|
-
let
|
|
131
|
+
let premiseUnified = false;
|
|
132
132
|
|
|
133
133
|
const subproofNode = proofStep.getSubproofNode(),
|
|
134
134
|
statementNode = proofStep.getStatementNode();
|
|
135
135
|
|
|
136
136
|
if (subproofNode !== null) {
|
|
137
|
-
const
|
|
137
|
+
const subproofUnified = premise.unifySubproof(subproofNode, substitutions, fileContext, localContext);
|
|
138
138
|
|
|
139
|
-
|
|
139
|
+
premiseUnified = subproofUnified; ///
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
if (statementNode !== null) {
|
|
143
|
-
const
|
|
143
|
+
const statementUnified = premise.unifyStatement(statementNode, substitutions, fileContext, localContext);
|
|
144
144
|
|
|
145
|
-
|
|
145
|
+
premiseUnified = statementUnified; ///
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
-
return
|
|
148
|
+
return premiseUnified;
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
function
|
|
151
|
+
function unifyPremises(premises, proofSteps, substitutions, fileContext, localContext) {
|
|
152
152
|
premises = reverse(premises); ///
|
|
153
153
|
|
|
154
154
|
proofSteps = reverse(proofSteps); ///
|
|
155
155
|
|
|
156
|
-
const
|
|
157
|
-
const
|
|
156
|
+
const premisesUnified = correlate(premises, proofSteps, (premise, proofStep) => {
|
|
157
|
+
const premiseUnified = matchPremise(premise, proofStep, substitutions, fileContext, localContext);
|
|
158
158
|
|
|
159
|
-
if (
|
|
159
|
+
if (premiseUnified) {
|
|
160
160
|
return true;
|
|
161
161
|
}
|
|
162
162
|
});
|
|
163
163
|
|
|
164
|
-
return
|
|
164
|
+
return premisesUnified;
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
-
function
|
|
168
|
-
const
|
|
169
|
-
|
|
167
|
+
function unifyConclusion(conclusion, statementNode, substitutions, fileContext, localContext) {
|
|
168
|
+
const statementUnified = conclusion.unifyStatement(statementNode, substitutions, fileContext, localContext),
|
|
169
|
+
conclusionUnified = statementUnified; ///
|
|
170
170
|
|
|
171
|
-
return
|
|
171
|
+
return conclusionUnified;
|
|
172
172
|
}
|
|
@@ -71,17 +71,13 @@ export default class StatementForMetavariableSubstitution extends Substitution {
|
|
|
71
71
|
];
|
|
72
72
|
|
|
73
73
|
const { metaLevelUnifier } = shim,
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
nodeA = this.metavariableNode, ///
|
|
75
|
+
nodeB = metavariableNode, ///
|
|
76
76
|
localContextA = localContext, ///
|
|
77
77
|
localContextB = localContext, ///
|
|
78
|
-
|
|
79
|
-
const verifiedAhead = true;
|
|
78
|
+
unified = metaLevelUnifier.unify(nodeA, nodeB, substitutions, localContextA, localContextB);
|
|
80
79
|
|
|
81
|
-
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
unifiedAgainstEquivalence = nonTerminalNodeUnified; ///
|
|
80
|
+
unifiedAgainstEquivalence = unified; ///
|
|
85
81
|
}
|
|
86
82
|
|
|
87
83
|
return unifiedAgainstEquivalence;
|
package/src/supposition.js
CHANGED
|
@@ -22,35 +22,34 @@ export default class Supposition {
|
|
|
22
22
|
return this.statementNode;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
let
|
|
25
|
+
unifyStatement(statementNode, substitutions, fileContext, localContext) {
|
|
26
|
+
let statementUnified = false;
|
|
27
27
|
|
|
28
28
|
if (this.statementNode !== null) {
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
const nodeA = this.statementNode, ///
|
|
30
|
+
nodeB = statementNode, ///
|
|
31
|
+
fileContextA = fileContext, ///
|
|
32
32
|
localContextA = LocalContext.fromFileContext(fileContextA),
|
|
33
33
|
localContextB = localContext, ///
|
|
34
|
-
|
|
35
|
-
const verifiedAhead = true;
|
|
34
|
+
unified = metaLevelUnifier.unify(nodeA, nodeB, substitutions, localContextA, localContextB);
|
|
36
35
|
|
|
37
|
-
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
matchesStatementNode = nonTerminalNodeUnified; ///
|
|
36
|
+
statementUnified = unified; ///
|
|
41
37
|
}
|
|
42
38
|
|
|
43
|
-
return
|
|
39
|
+
return statementUnified;
|
|
44
40
|
}
|
|
45
41
|
|
|
46
|
-
|
|
47
|
-
let
|
|
42
|
+
unifySubproof(subproofNode, substitutions, fileContext, localContext) {
|
|
43
|
+
let subproofUnified = false;
|
|
48
44
|
|
|
49
45
|
if (this.statementNode !== null) {
|
|
50
46
|
const subproofAssertionNode = subproofAssertionNodeQuery(this.statementNode);
|
|
51
47
|
|
|
52
48
|
if (subproofAssertionNode !== null) {
|
|
53
|
-
const
|
|
49
|
+
const fileContextA = fileContext, ///
|
|
50
|
+
localContextA = LocalContext.fromFileContext(fileContextA),
|
|
51
|
+
localContextB = localContext, ///
|
|
52
|
+
subproofSuppositionStatementNodes = subproofSuppositionStatementNodesQuery(subproofNode),
|
|
54
53
|
subproofLastProofStepStatementNode = subproofLastProofStepStatementNodeQuery(subproofNode),
|
|
55
54
|
subproofStatementNodes = [
|
|
56
55
|
...subproofSuppositionStatementNodes,
|
|
@@ -58,26 +57,19 @@ export default class Supposition {
|
|
|
58
57
|
],
|
|
59
58
|
subproofAssertionStatementNodes = subproofAssertionStatementNodesQuery(subproofAssertionNode);
|
|
60
59
|
|
|
61
|
-
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
localContextA = LocalContext.fromFileContext(fileContextA),
|
|
66
|
-
localContextB = localContext, ///
|
|
67
|
-
nonTerminalNodeUnified = metaLevelUnifier.unifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, localContextA, localContextB, () => {
|
|
68
|
-
const verifiedAhead = true;
|
|
69
|
-
|
|
70
|
-
return verifiedAhead;
|
|
71
|
-
});
|
|
60
|
+
subproofUnified = match(subproofAssertionStatementNodes, subproofStatementNodes, (subproofAssertionStatementNode, subproofStatementNode) => {
|
|
61
|
+
const nodeA = subproofAssertionStatementNode, ///
|
|
62
|
+
nodeB = subproofStatementNode, ///
|
|
63
|
+
unified = metaLevelUnifier.unify(nodeA, nodeB, substitutions, localContextA, localContextB);
|
|
72
64
|
|
|
73
|
-
if (
|
|
65
|
+
if (unified) {
|
|
74
66
|
return true;
|
|
75
67
|
}
|
|
76
68
|
});
|
|
77
69
|
}
|
|
78
70
|
}
|
|
79
71
|
|
|
80
|
-
return
|
|
72
|
+
return subproofUnified;
|
|
81
73
|
}
|
|
82
74
|
|
|
83
75
|
toJSON(tokens) {
|
package/src/topLevelAssertion.js
CHANGED
|
@@ -36,20 +36,20 @@ export default class TopLevelAssertion {
|
|
|
36
36
|
return this.fileContext;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
let
|
|
39
|
+
unifyStatement(statementNode, localContext) {
|
|
40
|
+
let statementUnified = false;
|
|
41
41
|
|
|
42
42
|
const proofSteps = localContext.getProofSteps(),
|
|
43
43
|
substitutions = [],
|
|
44
|
-
|
|
44
|
+
suppositionsUnified = unifySuppositions(this.suppositions, proofSteps, substitutions, this.fileContext, localContext);
|
|
45
45
|
|
|
46
|
-
if (
|
|
47
|
-
const
|
|
46
|
+
if (suppositionsUnified) {
|
|
47
|
+
const consequentUnified = unifyConsequent(this.consequent, statementNode, substitutions, this.fileContext, localContext);
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
statementUnified = consequentUnified; ///
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
return
|
|
52
|
+
return statementUnified;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
matchMetavariableNode(metavariableNode) {
|
|
@@ -140,39 +140,46 @@ export default class TopLevelAssertion {
|
|
|
140
140
|
static fromLabelsSuppositionsConsequentSubstitutionsAndFileContext(Class, labels, suppositions, consequent, substitutions, fileContext) { return new Class(labels, suppositions, consequent, substitutions, fileContext); }
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
function
|
|
143
|
+
function unifySuppositions(suppositions, proofSteps, substitutions, fileContext, localContext) {
|
|
144
144
|
suppositions = reverse(suppositions); ///
|
|
145
145
|
|
|
146
146
|
proofSteps = reverse(proofSteps); ///
|
|
147
147
|
|
|
148
|
-
const
|
|
149
|
-
const
|
|
148
|
+
const suppositionsUnified = correlate(suppositions, proofSteps, (supposition, proofStep) => {
|
|
149
|
+
const suppositionUnified = unifySupposition(supposition, proofStep, substitutions, fileContext, localContext);
|
|
150
150
|
|
|
151
|
-
if (
|
|
151
|
+
if (suppositionUnified) {
|
|
152
152
|
return true;
|
|
153
153
|
}
|
|
154
154
|
});
|
|
155
155
|
|
|
156
|
-
return
|
|
156
|
+
return suppositionsUnified;
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
function
|
|
160
|
-
let
|
|
159
|
+
function unifySupposition(supposition, proofStep, substitutions, fileContext, localContext) {
|
|
160
|
+
let suppositionUnified = false;
|
|
161
161
|
|
|
162
|
-
const
|
|
162
|
+
const subproofNode = proofStep.getSubproofNode(),
|
|
163
|
+
statementNode = proofStep.getStatementNode();
|
|
164
|
+
|
|
165
|
+
if (subproofNode !== null) {
|
|
166
|
+
const subproofUnified = supposition.unifySubproof(subproofNode, substitutions, fileContext, localContext);
|
|
167
|
+
|
|
168
|
+
suppositionUnified = subproofUnified; ///
|
|
169
|
+
}
|
|
163
170
|
|
|
164
171
|
if (statementNode !== null) {
|
|
165
|
-
const
|
|
172
|
+
const statementUnified = supposition.unifyStatement(statementNode, substitutions, fileContext, localContext);
|
|
166
173
|
|
|
167
|
-
|
|
174
|
+
suppositionUnified = statementUnified; ///
|
|
168
175
|
}
|
|
169
176
|
|
|
170
|
-
return
|
|
177
|
+
return suppositionUnified;
|
|
171
178
|
}
|
|
172
179
|
|
|
173
|
-
function
|
|
174
|
-
const
|
|
175
|
-
|
|
180
|
+
function unifyConsequent(consequent, statementNode, substitutions, fileContext, localContext) {
|
|
181
|
+
const statementUnified = consequent.unifyStatement(statementNode, substitutions, fileContext, localContext),
|
|
182
|
+
consequentUnified = statementUnified; ///
|
|
176
183
|
|
|
177
|
-
return
|
|
184
|
+
return consequentUnified;
|
|
178
185
|
}
|