occam-verify-cli 0.0.869 → 0.0.870
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 +3 -3
- package/lib/equality.js +2 -4
- package/lib/equivalence.js +1 -1
- package/lib/premise.js +4 -4
- package/lib/ruleNames.js +1 -29
- package/lib/substitution/metastatementForMetavariable.js +3 -2
- package/lib/substitution/statementForMetavariable.js +27 -64
- package/lib/substitution/termForVariable.js +5 -5
- package/lib/utilities/verifier.js +86 -0
- package/lib/verifier/node/metastatement.js +41 -28
- package/lib/verifier/node/statementAsCombinator.js +41 -28
- package/lib/verifier/node/termAsConstructor.js +30 -22
- package/lib/verifier/nodes/equality.js +27 -32
- package/lib/verifier/nodes/intrinsicLevel.js +25 -34
- package/lib/verifier/nodes/intrinsicLevelAgainstMetaLevel.js +270 -0
- package/lib/verifier/nodes/metaLevel.js +25 -34
- package/lib/verifier/nodes/statementAgainstCombinator.js +45 -49
- package/lib/verifier/nodes/termAgainstConstructor.js +24 -51
- package/lib/verify/argumentAgainstArgument.js +24 -0
- package/lib/verify/containment.js +5 -5
- package/lib/verify/equality.js +9 -9
- package/lib/verify/metaDerivation.js +19 -19
- package/lib/verify/metaLemma.js +1 -1
- package/lib/verify/metaproof.js +4 -6
- package/lib/verify/metavariable.js +7 -5
- package/lib/verify/metavariableAgainstMetastatement.js +44 -0
- package/lib/verify/metavariableAgainstStatement.js +65 -0
- package/lib/verify/statement.js +4 -4
- package/lib/verify/statementAgainstMetaType.js +24 -0
- package/lib/verify/statementAtainstStatement.js +52 -0
- package/lib/verify/term.js +7 -8
- package/lib/verify/termAgainstTerm.js +22 -0
- package/lib/verify/termAgainstType.js +26 -0
- package/lib/verify/terms.js +2 -3
- package/lib/verify/type.js +7 -5
- package/lib/verify/typeAssertion.js +45 -40
- package/lib/verify/variable.js +7 -5
- package/lib/verify/variableAgainstTerm.js +70 -0
- package/package.json +4 -4
- package/src/conclusion.js +2 -2
- package/src/equality.js +3 -9
- package/src/equivalence.js +1 -1
- package/src/premise.js +3 -3
- package/src/ruleNames.js +0 -7
- package/src/substitution/metastatementForMetavariable.js +3 -1
- package/src/substitution/statementForMetavariable.js +32 -74
- package/src/substitution/termForVariable.js +3 -3
- package/src/utilities/verifier.js +46 -0
- package/src/verifier/node/metastatement.js +41 -34
- package/src/verifier/node/statementAsCombinator.js +39 -32
- package/src/verifier/node/termAsConstructor.js +30 -25
- package/src/verifier/nodes/equality.js +31 -36
- package/src/verifier/nodes/intrinsicLevel.js +30 -38
- package/src/verifier/nodes/intrinsicLevelAgainstMetaLevel.js +222 -0
- package/src/verifier/nodes/metaLevel.js +30 -38
- package/src/verifier/nodes/statementAgainstCombinator.js +52 -55
- package/src/verifier/nodes/termAgainstConstructor.js +30 -71
- package/src/verify/argumentAgainstArgument.js +15 -0
- package/src/verify/containment.js +4 -4
- package/src/verify/equality.js +8 -8
- package/src/verify/metaDerivation.js +18 -18
- package/src/verify/metaLemma.js +2 -2
- package/src/verify/metaproof.js +3 -6
- package/src/verify/metavariable.js +7 -5
- package/src/verify/metavariableAgainstMetastatement.js +42 -0
- package/src/verify/metavariableAgainstStatement.js +77 -0
- package/src/verify/statement.js +5 -5
- package/src/verify/statementAgainstMetaType.js +21 -0
- package/src/verify/statementAtainstStatement.js +60 -0
- package/src/verify/term.js +13 -17
- package/src/verify/termAgainstTerm.js +20 -0
- package/src/verify/termAgainstType.js +28 -0
- package/src/verify/terms.js +1 -3
- package/src/verify/type.js +7 -5
- package/src/verify/typeAssertion.js +56 -55
- package/src/verify/variable.js +7 -5
- package/src/verify/variableAgainstTerm.js +86 -0
- package/lib/verifier/nodes/metaLevelToIntrinsicLevel.js +0 -327
- package/lib/verifier/nodes/substitution.js +0 -223
- package/lib/verify/givenMetavariable.js +0 -31
- package/lib/verify/givenType.js +0 -31
- package/lib/verify/givenVariable.js +0 -31
- package/lib/verify/termAndGivenType.js +0 -39
- package/src/verifier/nodes/metaLevelToIntrinsicLevel.js +0 -219
- package/src/verifier/nodes/substitution.js +0 -125
- package/src/verify/givenMetavariable.js +0 -31
- package/src/verify/givenType.js +0 -31
- package/src/verify/givenVariable.js +0 -31
- package/src/verify/termAndGivenType.js +0 -37
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return verifyVariableAgainstTerm;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var _term = /*#__PURE__*/ _interop_require_default(require("../verify/term"));
|
|
12
|
+
var _termForVariable = /*#__PURE__*/ _interop_require_default(require("../substitution/termForVariable"));
|
|
13
|
+
var _array = require("../utilities/array");
|
|
14
|
+
var _query = require("../utilities/query");
|
|
15
|
+
function _interop_require_default(obj) {
|
|
16
|
+
return obj && obj.__esModule ? obj : {
|
|
17
|
+
default: obj
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
var variableNodeQuery = (0, _query.nodeQuery)("/term/variable");
|
|
21
|
+
function verifyVariableAgainstTerm(variableNode, termNode, substitutions, localContextA, localContextB, verifyAhead) {
|
|
22
|
+
var variableVerifiedAgainstTerm = false;
|
|
23
|
+
var substitution = substitutions.find(function(substitution) {
|
|
24
|
+
var substitutionMatchesVariableNodeA = substitution.matchVariableNode(variableNode);
|
|
25
|
+
if (substitutionMatchesVariableNodeA) {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
}) || null;
|
|
29
|
+
if (substitution !== null) {
|
|
30
|
+
var termNodeMatches = substitution.matchTermNode(termNode);
|
|
31
|
+
if (termNodeMatches) {
|
|
32
|
+
var verifiedAhead = verifyAhead();
|
|
33
|
+
variableVerifiedAgainstTerm = verifiedAhead; ///
|
|
34
|
+
}
|
|
35
|
+
} else {
|
|
36
|
+
var variableA = localContextA.findVariableByVariableNode(variableNode);
|
|
37
|
+
if (variableA !== null) {
|
|
38
|
+
var terms = [], termVerified = (0, _term.default)(termNode, terms, localContextB, function() {
|
|
39
|
+
var verifiedAhead = false;
|
|
40
|
+
var firstTerm = (0, _array.first)(terms), termB = firstTerm, variableB = variableFromTerm(termB, localContextB);
|
|
41
|
+
if (variableA === variableB) {
|
|
42
|
+
verifiedAhead = verifyAhead();
|
|
43
|
+
} else {
|
|
44
|
+
var term = termB, variable = variableA, termType = term.getType(), variableType = variable.getType(), variableTypeEqualToOrSuperTypeOfTermType = variableType.isEqualToOrSuperTypeOf(termType);
|
|
45
|
+
if (variableTypeEqualToOrSuperTypeOfTermType) {
|
|
46
|
+
var termForVariableSubstitution = _termForVariable.default.fromVariableNodeAndTermNode(variableNode, termNode), substitution = termForVariableSubstitution; ///
|
|
47
|
+
substitutions.push(substitution);
|
|
48
|
+
verifiedAhead = verifyAhead();
|
|
49
|
+
if (!verifiedAhead) {
|
|
50
|
+
substitutions.pop();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return verifiedAhead;
|
|
55
|
+
});
|
|
56
|
+
variableVerifiedAgainstTerm = termVerified; ///
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return variableVerifiedAgainstTerm;
|
|
60
|
+
}
|
|
61
|
+
function variableFromTerm(term, localContext) {
|
|
62
|
+
var variable = null;
|
|
63
|
+
var termNode = term.getNode(), variableNode = variableNodeQuery(termNode);
|
|
64
|
+
if (variableNode !== null) {
|
|
65
|
+
variable = localContext.findVariableByVariableNode(variableNode);
|
|
66
|
+
}
|
|
67
|
+
return variable;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy92ZXJpZnkvdmFyaWFibGVBZ2FpbnN0VGVybS5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyJcInVzZSBzdHJpY3RcI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gdGVybS5nZXRUeXBlKCksXG4gICAgICAgICAgICAgICAgICAgICAgdmFyaWFibGVUeXBlID0gdmFyaWFibGUuZ2V0VHlwZSgpLFxuICAgICAgICAgICAgICAgICAgICAgIHZhcmlhYmxlVHlwZUVxdWFsVG9PclN1cGVyVHlwZU9mVGVybVR5cGUgPSB2YXJpYWJsZVR5cGUuaXNFcXVhbFRvT3JTdXBlclR5cGVPZih0ZXJtVHlwZSk7XG5cbiAgICAgICAgICAgICAgICBpZiAodmFyaWFibGVUeXBlRXF1YWxUb09yU3VwZXJUeXBlT2ZUZXJtVHlwZSkge1xuICAgICAgICAgICAgICAgICAgY29uc3QgdGVybUZvclZhcmlhYmxlU3Vic3RpdHV0aW9uID0gVGVybUZvclZhcmlhYmxlU3Vic3RpdHV0aW9uLmZyb21WYXJpYWJsZU5vZGVBbmRUZXJtTm9kZSh2YXJpYWJsZU5vZGUsIHRlcm1Ob2RlKSxcbiAgICAgICAgICAgICAgICAgICAgICAgIHN1YnN0aXR1dGlvbiA9IHRlcm1Gb3JWYXJpYWJsZVN1YnN0aXR1dGlvbjsgIC8vL1xuXG4gICAgICAgICAgICAgICAgICBzdWJzdGl0dXRpb25zLnB1c2goc3Vic3RpdHV0aW9uKTtcblxuICAgICAgICAgICAgICAgICAgdmVyaWZpZWRBaGVhZCA9IHZlcmlmeUFoZWFkKCk7XG5cbiAgICAgICAgICAgICAgICAgIGlmICghdmVyaWZpZWRBaGVhZCkge1xuICAgICAgICAgICAgICAgICAgICBzdWJzdGl0dXRpb25zLnBvcCgpO1xuICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgIHJldHVybiB2ZXJpZmllZEFoZWFkO1xuICAgICAgICAgICAgfSk7XG5cbiAgICAgIHZhcmlhYmxlVmVyaWZpZWRBZ2FpbnN0VGVybSA9IHRlcm1WZXJpZmllZDsgIC8vL1xuICAgIH1cbiAgfVxuXG4gIHJldH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BT3lCO0FBQ1QifQ==
|
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.870",
|
|
5
5
|
"license": "MIT, Anti-996",
|
|
6
6
|
"homepage": "https://github.com/djalbat/occam-verify-cli",
|
|
7
7
|
"description": "Occam's Verifier",
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"argumentative": "^2.0.28",
|
|
14
14
|
"necessary": "^14.0.1",
|
|
15
|
-
"occam-custom-grammars": "^5.0.
|
|
16
|
-
"occam-entities": "^1.0.
|
|
17
|
-
"occam-file-system": "^6.0.
|
|
15
|
+
"occam-custom-grammars": "^5.0.777",
|
|
16
|
+
"occam-entities": "^1.0.134",
|
|
17
|
+
"occam-file-system": "^6.0.176",
|
|
18
18
|
"occam-grammar-utilities": "^8.0.205",
|
|
19
19
|
"occam-query": "^3.1.174"
|
|
20
20
|
},
|
package/src/conclusion.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import metaLevelNodesVerifier from "./verifier/nodes/metaLevel";
|
|
4
|
-
import
|
|
4
|
+
import intrinsicLevelAgainstMetaLevelNodesVerifier from "./verifier/nodes/intrinsicLevelAgainstMetaLevel";
|
|
5
5
|
|
|
6
6
|
import { nodeAsString } from "./utilities/string";
|
|
7
7
|
import { metastatementNodeFromMetastatementString } from "./utilities/node";
|
|
@@ -20,7 +20,7 @@ export default class Conclusion {
|
|
|
20
20
|
nonTerminalNodeB = statementNode, ///
|
|
21
21
|
localContextA = localContext, ///
|
|
22
22
|
localContextB = statementLocalContext, ///
|
|
23
|
-
nonTerminalNodeVerified =
|
|
23
|
+
nonTerminalNodeVerified = intrinsicLevelAgainstMetaLevelNodesVerifier.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, localContextA, localContextB, () => {
|
|
24
24
|
const verifyAhead = true;
|
|
25
25
|
|
|
26
26
|
return verifyAhead;
|
package/src/equality.js
CHANGED
|
@@ -29,17 +29,11 @@ export default class Equality {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
isEqual(localContext) {
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
leftTermNode = leftTerm.getNode(),
|
|
35
|
-
rightTermNode = rightTerm.getNode(),
|
|
32
|
+
const leftTermNode = this.leftTerm.getNode(),
|
|
33
|
+
rightTermNode = this.rightTerm.getNode(),
|
|
36
34
|
nonTerminalNodeA = leftTermNode, ///
|
|
37
35
|
nonTerminalNodeB = rightTermNode, ///
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
localContext = this; ///
|
|
41
|
-
|
|
42
|
-
const nonTerminalNodeVerified = equalityNodesVerifier.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, equivalences, localContext, () => {
|
|
36
|
+
nonTerminalNodeVerified = equalityNodesVerifier.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, localContext, () => {
|
|
43
37
|
const verifiedAhead = true;
|
|
44
38
|
|
|
45
39
|
return verifiedAhead;
|
package/src/equivalence.js
CHANGED
package/src/premise.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import LocalContext from "./context/local";
|
|
4
4
|
import metaLevelNodesVerifier from "./verifier/nodes/metaLevel";
|
|
5
|
-
import
|
|
5
|
+
import intrinsicLevelAgainstMetaLevelNodesVerifier from "./verifier/nodes/intrinsicLevelAgainstMetaLevel";
|
|
6
6
|
|
|
7
7
|
import { match } from "./utilities/array";
|
|
8
8
|
import { nodeAsString } from "./utilities/string";
|
|
@@ -48,7 +48,7 @@ export default class Premise {
|
|
|
48
48
|
fileContextA = fileContext, ///
|
|
49
49
|
localContextA = LocalContext.fromFileContext(fileContextA),
|
|
50
50
|
localContextB = statementLocalContext, ///
|
|
51
|
-
nonTerminalNodeVerified =
|
|
51
|
+
nonTerminalNodeVerified = intrinsicLevelAgainstMetaLevelNodesVerifier.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, localContextA, localContextB, () => {
|
|
52
52
|
const verifiedAhead = true;
|
|
53
53
|
|
|
54
54
|
return verifiedAhead;
|
|
@@ -70,7 +70,7 @@ export default class Premise {
|
|
|
70
70
|
fileContextA = fileContext, ///
|
|
71
71
|
localContextA = LocalContext.fromFileContext(fileContextA),
|
|
72
72
|
localContextB = statementLocalContext, ///
|
|
73
|
-
nonTerminalNodeVerified =
|
|
73
|
+
nonTerminalNodeVerified = intrinsicLevelAgainstMetaLevelNodesVerifier.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, localContextA, localContextB, () => {
|
|
74
74
|
const verifiedAhead = true;
|
|
75
75
|
|
|
76
76
|
return verifiedAhead;
|
package/src/ruleNames.js
CHANGED
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
export const TERM_RULE_NAME = "term";
|
|
4
|
-
export const TYPE_RULE_NAME = "type";
|
|
5
3
|
export const LABEL_RULE_NAME = "label";
|
|
6
|
-
export const VARIABLE_RULE_NAME = "variable";
|
|
7
|
-
export const ARGUMENT_RULE_NAME = "argument";
|
|
8
4
|
export const SUBPROOF_RULE_NAME = "subproof";
|
|
9
|
-
export const STATEMENT_RULE_NAME = "statement";
|
|
10
|
-
export const METAVARIABLE_RULE_NAME = "metavariable";
|
|
11
|
-
export const METASTATEMENT_RULE_NAME = "metastatement";
|
|
12
5
|
export const RULE_SUBPROOF_RULE_NAME = "ruleSubproof";
|
|
13
6
|
export const META_SUBPROOF_RULE_NAME = "metaSubproof";
|
|
14
7
|
export const META_ARGUMENT_RULE_NAME = "metaArgument";
|
|
@@ -45,7 +45,9 @@ export default class MetastatementForMetavariableSubstitution extends Substituti
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
static fromMetavariableNodeAndMetastatementNode(metavariableNode, metastatementNode) {
|
|
48
|
-
let metastatementForMetavariableSubstitution
|
|
48
|
+
let metastatementForMetavariableSubstitution;
|
|
49
|
+
|
|
50
|
+
metastatementForMetavariableSubstitution = new MetastatementForMetavariableSubstitution(metavariableNode, metastatementNode);
|
|
49
51
|
|
|
50
52
|
const bracketedMetastatementChildNode = bracketedMetastatementChildNodeFromMetastatementNode(metastatementNode);
|
|
51
53
|
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import Substitution from "../substitution";
|
|
4
|
-
|
|
5
|
-
import substitutionNodesVerifier from "../verifier/nodes/substitution";
|
|
6
4
|
import TermForVariableSubstitution from "./termForVariable";
|
|
7
|
-
import
|
|
5
|
+
import verifyStatementAgainstStatement from "../verify/statementAtainstStatement";
|
|
8
6
|
|
|
9
|
-
import { push } from "../utilities/array";
|
|
10
7
|
import { bracketedStatementChildNodeFromStatementNode } from "../utilities/proof";
|
|
11
8
|
|
|
12
9
|
export default class StatementForMetavariableSubstitution extends Substitution {
|
|
@@ -33,37 +30,25 @@ export default class StatementForMetavariableSubstitution extends Substitution {
|
|
|
33
30
|
matchStatementNode(statementNode, substitutions, localContextA, localContextB) {
|
|
34
31
|
let statementNodeMatches;
|
|
35
32
|
|
|
36
|
-
|
|
33
|
+
const substitution = this.substitution, ///
|
|
34
|
+
statementNodeA = statementNode, ///
|
|
35
|
+
statementNodeB = this.statementNode; ///
|
|
36
|
+
|
|
37
|
+
statementNodeMatches = matchStatementNode(statementNodeA, statementNodeB, substitution, substitutions, localContextA, localContextB);
|
|
37
38
|
|
|
38
39
|
if (!statementNodeMatches) {
|
|
39
40
|
const bracketedStatementChildNode = bracketedStatementChildNodeFromStatementNode(statementNode);
|
|
40
41
|
|
|
41
42
|
if (bracketedStatementChildNode !== null) {
|
|
42
|
-
const
|
|
43
|
+
const statementNodeA = bracketedStatementChildNode; ///
|
|
43
44
|
|
|
44
|
-
statementNodeMatches =
|
|
45
|
+
statementNodeMatches = matchStatementNode(statementNodeA, statementNodeB, substitution, substitutions, localContextA, localContextB);
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
return statementNodeMatches;
|
|
49
50
|
}
|
|
50
51
|
|
|
51
|
-
matchStatementNodeEx(statementNode, substitutions, localContextA, localContextB) {
|
|
52
|
-
let statementNodeMatches;
|
|
53
|
-
|
|
54
|
-
if (this.substitution === null) {
|
|
55
|
-
statementNodeMatches = this.statementNode.match(statementNode);
|
|
56
|
-
} else {
|
|
57
|
-
const substitution = this.substitution, ///
|
|
58
|
-
statementNodeA = statementNode, ///
|
|
59
|
-
statementNodeB = this.statementNode; ///
|
|
60
|
-
|
|
61
|
-
statementNodeMatches = matchStatementNode(statementNodeA, statementNodeB, substitution, substitutions, localContextA, localContextB);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return statementNodeMatches;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
52
|
matchMetavariableNode(metavariableNode) {
|
|
68
53
|
const metavariableNodeMatches = this.metavariableNode.match(metavariableNode);
|
|
69
54
|
|
|
@@ -71,9 +56,11 @@ export default class StatementForMetavariableSubstitution extends Substitution {
|
|
|
71
56
|
}
|
|
72
57
|
|
|
73
58
|
static fromMetavariableNodeAndStatementNode(metavariableNode, statementNode) {
|
|
59
|
+
let statementForMetavariableSubstitution;
|
|
60
|
+
|
|
74
61
|
const substitution = null;
|
|
75
62
|
|
|
76
|
-
|
|
63
|
+
statementForMetavariableSubstitution = new StatementForMetavariableSubstitution(metavariableNode, statementNode, substitution);
|
|
77
64
|
|
|
78
65
|
const bracketedStatementChildNode = bracketedStatementChildNodeFromStatementNode(statementNode);
|
|
79
66
|
|
|
@@ -86,8 +73,18 @@ export default class StatementForMetavariableSubstitution extends Substitution {
|
|
|
86
73
|
return statementForMetavariableSubstitution;
|
|
87
74
|
}
|
|
88
75
|
|
|
89
|
-
static
|
|
90
|
-
let statementForMetavariableSubstitution
|
|
76
|
+
static fromMetavariableNodeStatementNodeAndSubstitutionNode(metavariableNode, statementNode, substitutionNode) {
|
|
77
|
+
let statementForMetavariableSubstitution;
|
|
78
|
+
|
|
79
|
+
let substitution = null;
|
|
80
|
+
|
|
81
|
+
if (substitutionNode !== null) {
|
|
82
|
+
const termForVariableSubstitution = TermForVariableSubstitution.fromSubstitutionNode(substitutionNode);
|
|
83
|
+
|
|
84
|
+
substitution = termForVariableSubstitution; ///
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
statementForMetavariableSubstitution = new StatementForMetavariableSubstitution(metavariableNode, statementNode, substitution);
|
|
91
88
|
|
|
92
89
|
const bracketedStatementChildNode = bracketedStatementChildNodeFromStatementNode(statementNode);
|
|
93
90
|
|
|
@@ -101,56 +98,17 @@ export default class StatementForMetavariableSubstitution extends Substitution {
|
|
|
101
98
|
}
|
|
102
99
|
}
|
|
103
100
|
|
|
104
|
-
function
|
|
105
|
-
|
|
106
|
-
const substitution = substitutionA, ///
|
|
107
|
-
substitutions = substitutionsB,
|
|
108
|
-
termForVariableSubstitution = TermForVariableSubstitution.fromSubstitutionAndSubstitutions(substitution, substitutions);
|
|
109
|
-
|
|
110
|
-
substitutionA = termForVariableSubstitution; ///
|
|
101
|
+
function matchStatementNode(statementNodeA, statementNodeB, substitution, substitutions, localContextA, localContextB) {
|
|
102
|
+
let statementNodeMatches;
|
|
111
103
|
|
|
112
|
-
|
|
113
|
-
|
|
104
|
+
if (substitution === null) {
|
|
105
|
+
statementNodeMatches = statementNodeB.match(statementNodeA);
|
|
106
|
+
} else {
|
|
107
|
+
const statementVerifiedAgainstStatement = verifyStatementAgainstStatement(statementNodeA, statementNodeB, substitution, substitutions, localContextA, localContextB);
|
|
114
108
|
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export function matchStatementNode(statementNodeA, statementNodeB, substitution, substitutions, localContextA, localContextB) {
|
|
119
|
-
let statementNodeMatches = false;
|
|
120
|
-
|
|
121
|
-
const termForVariableSubstitution = TermForVariableSubstitution.fromSubstitutionAndSubstitutions(substitution, substitutions),
|
|
122
|
-
intrinsic = termForVariableSubstitution.isIntrinsic(substitution);
|
|
123
|
-
|
|
124
|
-
let substitutionsA = []; ///
|
|
125
|
-
|
|
126
|
-
if (intrinsic) {
|
|
127
|
-
const substitutionA = termForVariableSubstitution; ///
|
|
128
|
-
|
|
129
|
-
substitutionsA.push(substitutionA);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
const nonTerminalNodeA = statementNodeA, ///
|
|
133
|
-
nonTerminalNodeB = statementNodeB, ///
|
|
134
|
-
nonTerminalNodeVerified = substitutionNodesVerifier.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutionsA, localContextA, localContextB, () => {
|
|
135
|
-
const verifiedAhead = true;
|
|
136
|
-
|
|
137
|
-
return verifiedAhead;
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
if (nonTerminalNodeVerified) {
|
|
141
|
-
if (!intrinsic) {
|
|
142
|
-
const substitutionB = termForVariableSubstitution, ///
|
|
143
|
-
substitutionsB = [
|
|
144
|
-
substitutionB
|
|
145
|
-
];
|
|
146
|
-
|
|
147
|
-
substitutionsA = transformSubstitutions(substitutionsA, substitutionsB);
|
|
148
|
-
|
|
149
|
-
push(substitutions, substitutionsA);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
statementNodeMatches = true;
|
|
109
|
+
statementNodeMatches = statementVerifiedAgainstStatement; ///
|
|
153
110
|
}
|
|
154
111
|
|
|
155
112
|
return statementNodeMatches;
|
|
156
|
-
|
|
113
|
+
|
|
114
|
+
}
|
|
@@ -23,14 +23,14 @@ export default class TermForVariableSubstitution extends Substitution {
|
|
|
23
23
|
return this.termNode;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
isTransformed(substitution) {
|
|
27
27
|
const termNod = substitution.getTermNode(),
|
|
28
28
|
variableNode = substitution.getVariableNode(),
|
|
29
29
|
termNodeMatches = this.termNode.match(termNod),
|
|
30
30
|
variableNodeMatches = this.variableNode.match(variableNode),
|
|
31
|
-
|
|
31
|
+
transformed = ((!termNodeMatches) && (!variableNodeMatches));
|
|
32
32
|
|
|
33
|
-
return
|
|
33
|
+
return transformed;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
matchTermNode(termNode) {
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export function verifyNode(nodeQueryMaps, nonTerminalNode, ...remainingArguments) {
|
|
4
|
+
let nodeVerified;
|
|
5
|
+
|
|
6
|
+
nodeVerified = nodeQueryMaps.some((nodeQueryMap) => {
|
|
7
|
+
let nodeVerified = false;
|
|
8
|
+
|
|
9
|
+
const { nodeQuery, verifyNode } = nodeQueryMap;
|
|
10
|
+
|
|
11
|
+
const node = nodeQuery(nonTerminalNode);
|
|
12
|
+
|
|
13
|
+
if (node !== null) {
|
|
14
|
+
nodeVerified = verifyNode(node, ...remainingArguments);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (nodeVerified) {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
return nodeVerified;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function verifyNodes(nodeQueryMaps, nonTerminalNodeA, nonTerminalNodeB, ...remainingArguments) {
|
|
26
|
+
let nodesVerified;
|
|
27
|
+
|
|
28
|
+
nodesVerified = nodeQueryMaps.some((nodeQueryMap) => {
|
|
29
|
+
let nodesVerified = false;
|
|
30
|
+
|
|
31
|
+
const { nodeQueryA, nodeQueryB, verifyNodes } = nodeQueryMap;
|
|
32
|
+
|
|
33
|
+
const nodeA = nodeQueryA(nonTerminalNodeA), ///
|
|
34
|
+
nodeB = nodeQueryB(nonTerminalNodeB); ///
|
|
35
|
+
|
|
36
|
+
if ((nodeA !== null) && (nodeB !== null)) {
|
|
37
|
+
nodesVerified = verifyNodes(nodeA, nodeB, ...remainingArguments);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (nodesVerified) {
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
return nodesVerified;
|
|
46
|
+
}
|
|
@@ -3,58 +3,65 @@
|
|
|
3
3
|
import LocalContext from "../../context/local";
|
|
4
4
|
import NodeVerifier from "../../verifier/node";
|
|
5
5
|
|
|
6
|
+
import { nodeQuery } from "../../utilities/query";
|
|
7
|
+
import { verifyNode } from "../../utilities/verifier";
|
|
6
8
|
import { verifyStandaloneTerm } from "../../verify/term";
|
|
7
9
|
import { verifyStandaloneVariable } from "../../verify/variable";
|
|
8
10
|
import { verifyStandaloneMetavariable } from "../../verify/metavariable";
|
|
9
|
-
|
|
11
|
+
|
|
12
|
+
const termNodeQuery = nodeQuery("/term!"),
|
|
13
|
+
variableNodeQuery = nodeQuery("/variable!"),
|
|
14
|
+
metavariableNodeQuery = nodeQuery("/metavariable!");
|
|
10
15
|
|
|
11
16
|
class MetastatementNodeVerifier extends NodeVerifier {
|
|
12
17
|
verifyNonTerminalNode(nonTerminalNode, localMetaContext, verifyAhead) {
|
|
13
18
|
let nonTerminalNodeVerified;
|
|
14
19
|
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
const nodeQueryMaps = [
|
|
21
|
+
{
|
|
22
|
+
nodeQuery: termNodeQuery,
|
|
23
|
+
verifyNode: this.verifyTermNode
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
nodeQuery: variableNodeQuery,
|
|
27
|
+
verifyNode: this.verifyVariableNode
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
nodeQuery: metavariableNodeQuery,
|
|
31
|
+
verifyNode: this.verifyMetavariableNode
|
|
26
32
|
}
|
|
33
|
+
];
|
|
27
34
|
|
|
28
|
-
|
|
29
|
-
const variableNode = nonTerminalNode, ///
|
|
30
|
-
localContext = LocalContext.fromLocalMetaContext(localMetaContext),
|
|
31
|
-
standaloneVariableVerified = verifyStandaloneVariable(variableNode, localContext, verifyAhead),
|
|
32
|
-
variableNodeVerified = standaloneVariableVerified; ///
|
|
35
|
+
const nodeVerified = verifyNode(nodeQueryMaps, nonTerminalNode, localMetaContext, verifyAhead);
|
|
33
36
|
|
|
34
|
-
|
|
37
|
+
nonTerminalNodeVerified = nodeVerified ?
|
|
38
|
+
true :
|
|
39
|
+
super.verifyNonTerminalNode(nonTerminalNode, localMetaContext, verifyAhead);
|
|
35
40
|
|
|
36
|
-
|
|
37
|
-
|
|
41
|
+
return nonTerminalNodeVerified;
|
|
42
|
+
}
|
|
38
43
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
standaloneTermVerified = verifyStandaloneTerm(termNode, localContext, verifyAhead),
|
|
43
|
-
termNodeVerified = standaloneTermVerified; ///
|
|
44
|
+
verifyMetavariableNode(metavariableNode, localMetaContext, verifyAhead) {
|
|
45
|
+
const standaloneMetavariableVerified = verifyStandaloneMetavariable(metavariableNode, localMetaContext, verifyAhead),
|
|
46
|
+
metavariableNodeVerified = standaloneMetavariableVerified; ///
|
|
44
47
|
|
|
45
|
-
|
|
48
|
+
return metavariableNodeVerified;
|
|
49
|
+
}
|
|
46
50
|
|
|
47
|
-
|
|
48
|
-
|
|
51
|
+
verifyVariableNode(variableNode, localMetaContext, verifyAhead) {
|
|
52
|
+
const localContext = LocalContext.fromLocalMetaContext(localMetaContext),
|
|
53
|
+
standaloneVariableVerified = verifyStandaloneVariable(variableNode, localContext, verifyAhead),
|
|
54
|
+
variableNodeVerified = standaloneVariableVerified; ///
|
|
49
55
|
|
|
50
|
-
|
|
51
|
-
|
|
56
|
+
return variableNodeVerified;
|
|
57
|
+
}
|
|
52
58
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
59
|
+
verifyTermNode(termNode, localMetaContext, verifyAhead) {
|
|
60
|
+
const localContext = LocalContext.fromLocalMetaContext(localMetaContext),
|
|
61
|
+
standaloneTermVerified = verifyStandaloneTerm(termNode, localContext, verifyAhead),
|
|
62
|
+
termNodeVerified = standaloneTermVerified; ///
|
|
56
63
|
|
|
57
|
-
return
|
|
64
|
+
return termNodeVerified;
|
|
58
65
|
}
|
|
59
66
|
}
|
|
60
67
|
|
|
@@ -2,56 +2,63 @@
|
|
|
2
2
|
|
|
3
3
|
import NodeVerifier from "../../verifier/node";
|
|
4
4
|
|
|
5
|
+
import { nodeQuery } from "../../utilities/query";
|
|
6
|
+
import { verifyNode } from "../../utilities/verifier";
|
|
5
7
|
import { verifyStandaloneType } from "./../../verify/type";
|
|
6
8
|
import { verifyStandaloneTerm } from "./../../verify/term";
|
|
7
9
|
import { verifyStandaloneStatement } from "../../verify/statement";
|
|
8
|
-
|
|
10
|
+
|
|
11
|
+
const termNodeQuery = nodeQuery("/term!"),
|
|
12
|
+
typeNodeQuery = nodeQuery("/type!"),
|
|
13
|
+
statementNodeQuery = nodeQuery("/statement!");
|
|
9
14
|
|
|
10
15
|
class StatementAsCombinatorNodeVerifier extends NodeVerifier {
|
|
11
16
|
verifyNonTerminalNode(nonTerminalNode, localContext, verifyAhead) {
|
|
12
17
|
let nonTerminalNodeVerified;
|
|
13
18
|
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
const nodeQueryMaps = [
|
|
20
|
+
{
|
|
21
|
+
nodeQuery: termNodeQuery,
|
|
22
|
+
verifyNode: this.verifyTermNode
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
nodeQuery: typeNodeQuery,
|
|
26
|
+
verifyNode: this.verifyTypeNode
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
nodeQuery: statementNodeQuery,
|
|
30
|
+
verifyNode: this.verifyStatementNode
|
|
25
31
|
}
|
|
32
|
+
];
|
|
26
33
|
|
|
27
|
-
|
|
28
|
-
const termNode = nonTerminalNode, ///
|
|
29
|
-
standaloneTermVerified = verifyStandaloneTerm(termNode, localContext, verifyAhead),
|
|
30
|
-
termNodeVerified = standaloneTermVerified; ///
|
|
34
|
+
const nodeVerified = verifyNode(nodeQueryMaps, nonTerminalNode, localContext, verifyAhead);
|
|
31
35
|
|
|
32
|
-
|
|
36
|
+
nonTerminalNodeVerified = nodeVerified ?
|
|
37
|
+
true :
|
|
38
|
+
super.verifyNonTerminalNode(nonTerminalNode, localContext, verifyAhead);
|
|
33
39
|
|
|
34
|
-
|
|
35
|
-
|
|
40
|
+
return nonTerminalNodeVerified;
|
|
41
|
+
}
|
|
36
42
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
typeNodeVerified = standaloneTypeVerified; ///
|
|
43
|
+
verifyStatementNode(statementNode, localContext, verifyAhead) {
|
|
44
|
+
const standaloneStatementVerified = verifyStandaloneStatement(statementNode, localContext, verifyAhead),
|
|
45
|
+
statementNodeVerified = standaloneStatementVerified; ///
|
|
41
46
|
|
|
42
|
-
|
|
47
|
+
return statementNodeVerified;
|
|
48
|
+
}
|
|
43
49
|
|
|
44
|
-
|
|
45
|
-
|
|
50
|
+
verifyTermNode(termNode, localContext, verifyAhead) {
|
|
51
|
+
const standaloneTermVerified = verifyStandaloneTerm(termNode, localContext, verifyAhead),
|
|
52
|
+
termNodeVerified = standaloneTermVerified; ///
|
|
46
53
|
|
|
47
|
-
|
|
48
|
-
|
|
54
|
+
return termNodeVerified;
|
|
55
|
+
}
|
|
49
56
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
57
|
+
verifyTypeNode(typeNode, localContext, verifyAhead) {
|
|
58
|
+
const standaloneTypeVerified = verifyStandaloneType(typeNode, localContext, verifyAhead),
|
|
59
|
+
typeNodeVerified = standaloneTypeVerified; ///
|
|
53
60
|
|
|
54
|
-
return
|
|
61
|
+
return typeNodeVerified;
|
|
55
62
|
}
|
|
56
63
|
}
|
|
57
64
|
|