occam-verify-cli 0.0.1003 → 0.0.1005
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -2
- package/bin/abbreviations.js +1 -3
- package/bin/action/help.js +0 -2
- package/bin/action/verify.js +4 -24
- package/bin/defaults.js +0 -2
- package/bin/main.js +3 -4
- package/bin/options.js +0 -2
- package/lib/assertion/subproof.js +106 -0
- package/lib/assignment/metavariable.js +2 -2
- package/lib/combinator.js +50 -16
- package/lib/conclusion.js +73 -14
- package/lib/context/file.js +191 -31
- package/lib/context/local.js +37 -49
- package/lib/context/release.js +42 -35
- package/lib/context/release.other.js +605 -0
- package/lib/declaration/combinator.js +83 -0
- package/lib/derivation.js +86 -0
- package/lib/equality.js +3 -11
- package/lib/index.js +1 -1
- package/lib/judgement.js +3 -10
- package/lib/label.js +58 -16
- package/lib/log.js +3 -11
- package/lib/metaType.js +31 -19
- package/lib/metavariable.js +39 -12
- package/lib/mixins/statement/qualified/unify.js +118 -0
- package/lib/mixins/statement/unify.js +57 -0
- package/lib/mixins/statement/verify.js +184 -0
- package/lib/node/statement/combinator/bracketed.js +15 -11
- package/lib/ocmbinator/bracketed.js +52 -8
- package/lib/premise.js +109 -56
- package/lib/proof.js +91 -0
- package/lib/proofStep.js +78 -25
- package/lib/reference.js +62 -16
- package/lib/rule.js +146 -26
- package/lib/ruleNames.js +5 -5
- package/lib/statement/qualified.js +127 -0
- package/lib/statement/unqualified.js +89 -0
- package/lib/statement.js +176 -0
- package/lib/subDerivation.js +86 -0
- package/lib/subproof.js +155 -0
- package/lib/substitution/frameForMetavariable.js +14 -15
- package/lib/substitution/statementForMetavariable.js +23 -24
- package/lib/substitution/termForVariable.js +11 -12
- package/lib/substitution.js +9 -2
- package/lib/substitutions.js +14 -14
- package/lib/supposition.js +92 -60
- package/lib/unifier/statementWithCombinator.js +3 -3
- package/lib/unify/metavariableWithFrame.js +2 -2
- package/lib/unify/metavariableWithStatement.js +2 -2
- package/lib/unify/metavariableWithStatementGivenSubstitution.js +2 -2
- package/lib/unify/variableWithTerm.js +2 -2
- package/lib/utilities/node.js +13 -11
- package/lib/utilities/releaseContext.js +3 -3
- package/lib/utilities/string.js +8 -2
- package/lib/utilities/subproof.js +5 -5
- package/lib/utilities/tokens.js +10 -10
- package/lib/variable.js +1 -10
- package/lib/verifier/metaLevel.js +2 -2
- package/lib/verifier/topLevel.js +5 -5
- package/lib/verify/axiom.js +3 -5
- package/lib/verify/conjecture.js +4 -7
- package/lib/verify/consequent.js +2 -3
- package/lib/verify/declaration/combinator.js +2 -14
- package/lib/verify/declaration/metavariable.js +9 -10
- package/lib/verify/files.js +4 -4
- package/lib/verify/frame.js +12 -12
- package/lib/verify/lemma.js +4 -7
- package/lib/verify/metaLemma.js +4 -7
- package/lib/verify/metatheorem.js +4 -7
- package/lib/verify/proofStep.js +2 -31
- package/lib/verify/theorem.js +4 -7
- package/package.json +1 -1
- package/src/assertion/subproof.js +84 -0
- package/src/assignment/metavariable.js +2 -2
- package/src/combinator.js +45 -15
- package/src/conclusion.js +83 -13
- package/src/context/file.js +223 -11
- package/src/context/local.js +12 -16
- package/src/context/release.js +57 -39
- package/src/context/release.other.js +547 -0
- package/src/declaration/combinator.js +44 -0
- package/src/derivation.js +50 -0
- package/src/equality.js +2 -9
- package/src/index.js +0 -1
- package/src/judgement.js +2 -8
- package/src/label.js +56 -13
- package/src/log.js +2 -9
- package/src/metaType.js +26 -14
- package/src/metavariable.js +57 -9
- package/src/mixins/statement/qualified/unify.js +186 -0
- package/src/mixins/statement/unify.js +70 -0
- package/src/mixins/statement/verify.js +274 -0
- package/src/node/statement/combinator/bracketed.js +4 -3
- package/src/ocmbinator/bracketed.js +15 -12
- package/src/premise.js +136 -44
- package/src/proof.js +58 -0
- package/src/proofStep.js +92 -22
- package/src/reference.js +58 -12
- package/src/rule.js +199 -30
- package/src/ruleNames.js +1 -1
- package/src/statement/qualified.js +104 -0
- package/src/statement/unqualified.js +60 -0
- package/src/statement.js +179 -0
- package/src/subDerivation.js +52 -0
- package/src/subproof.js +99 -0
- package/src/substitution/frameForMetavariable.js +20 -17
- package/src/substitution/statementForMetavariable.js +31 -29
- package/src/substitution/termForVariable.js +15 -14
- package/src/substitution.js +8 -0
- package/src/substitutions.js +12 -13
- package/src/supposition.js +94 -44
- package/src/unifier/statementWithCombinator.js +6 -3
- package/src/unify/metavariableWithFrame.js +1 -1
- package/src/unify/metavariableWithStatement.js +1 -1
- package/src/unify/metavariableWithStatementGivenSubstitution.js +1 -1
- package/src/unify/variableWithTerm.js +1 -1
- package/src/utilities/node.js +18 -12
- package/src/utilities/releaseContext.js +2 -2
- package/src/utilities/string.js +6 -2
- package/src/utilities/subproof.js +2 -2
- package/src/utilities/tokens.js +7 -7
- package/src/variable.js +0 -10
- package/src/verifier/metaLevel.js +3 -2
- package/src/verifier/topLevel.js +6 -4
- package/src/verify/axiom.js +1 -2
- package/src/verify/conjecture.js +2 -3
- package/src/verify/consequent.js +1 -1
- package/src/verify/declaration/combinator.js +0 -20
- package/src/verify/declaration/metavariable.js +8 -12
- package/src/verify/files.js +3 -3
- package/src/verify/frame.js +11 -11
- package/src/verify/lemma.js +2 -3
- package/src/verify/metaLemma.js +2 -3
- package/src/verify/metatheorem.js +2 -3
- package/src/verify/proofStep.js +0 -41
- package/src/verify/theorem.js +2 -3
- package/lib/tokens/combinatorStatement/bracketed.js +0 -17
- package/lib/unify/premiseWithProofStep.js +0 -41
- package/lib/unify/premisesWithProofSteps.js +0 -31
- package/lib/unify/qualifiedStatement.js +0 -136
- package/lib/unify/statementWithBracketedCombinator.js +0 -30
- package/lib/unify/statementWithCombinator.js +0 -29
- package/lib/unify/statementWithCombinators.js +0 -31
- package/lib/unify/statementWithMetaType.js +0 -24
- package/lib/verify/conclusion.js +0 -39
- package/lib/verify/derivation.js +0 -31
- package/lib/verify/label.js +0 -37
- package/lib/verify/labels.js +0 -28
- package/lib/verify/premise.js +0 -45
- package/lib/verify/premises.js +0 -28
- package/lib/verify/proof.js +0 -34
- package/lib/verify/rule.js +0 -56
- package/lib/verify/statement/qualified.js +0 -41
- package/lib/verify/statement/unqualified.js +0 -45
- package/lib/verify/statement.js +0 -219
- package/lib/verify/statementAsCombinator.js +0 -33
- package/lib/verify/statementGivenMetaType.js +0 -52
- package/lib/verify/subproof.js +0 -34
- package/lib/verify/supposition.js +0 -45
- package/lib/verify/suppositions.js +0 -28
- package/src/tokens/combinatorStatement/bracketed.js +0 -10
- package/src/unify/premiseWithProofStep.js +0 -54
- package/src/unify/premisesWithProofSteps.js +0 -23
- package/src/unify/qualifiedStatement.js +0 -208
- package/src/unify/statementWithBracketedCombinator.js +0 -22
- package/src/unify/statementWithCombinator.js +0 -22
- package/src/unify/statementWithCombinators.js +0 -23
- package/src/unify/statementWithMetaType.js +0 -14
- package/src/verify/conclusion.js +0 -40
- package/src/verify/derivation.js +0 -23
- package/src/verify/label.js +0 -34
- package/src/verify/labels.js +0 -17
- package/src/verify/premise.js +0 -49
- package/src/verify/premises.js +0 -17
- package/src/verify/proof.js +0 -31
- package/src/verify/rule.js +0 -71
- package/src/verify/statement/qualified.js +0 -40
- package/src/verify/statement/unqualified.js +0 -49
- package/src/verify/statement.js +0 -312
- package/src/verify/statementAsCombinator.js +0 -27
- package/src/verify/statementGivenMetaType.js +0 -52
- package/src/verify/subproof.js +0 -32
- package/src/verify/supposition.js +0 -49
- package/src/verify/suppositions.js +0 -17
package/lib/verify/theorem.js
CHANGED
|
@@ -9,12 +9,9 @@ Object.defineProperty(exports, "default", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
var _theorem = /*#__PURE__*/ _interop_require_default(require("../theorem"));
|
|
12
|
-
var _proof = /*#__PURE__*/ _interop_require_default(require("../verify/proof"));
|
|
13
|
-
var _labels = /*#__PURE__*/ _interop_require_default(require("../verify/labels"));
|
|
14
12
|
var _local = /*#__PURE__*/ _interop_require_default(require("../context/local"));
|
|
15
13
|
var _substitutions = /*#__PURE__*/ _interop_require_default(require("../substitutions"));
|
|
16
14
|
var _consequent = /*#__PURE__*/ _interop_require_default(require("../verify/consequent"));
|
|
17
|
-
var _suppositions = /*#__PURE__*/ _interop_require_default(require("../verify/suppositions"));
|
|
18
15
|
var _array = require("../utilities/array");
|
|
19
16
|
var _query = require("../utilities/query");
|
|
20
17
|
function _interop_require_default(obj) {
|
|
@@ -27,13 +24,13 @@ function verifyTheorem(theoremNode, fileContext) {
|
|
|
27
24
|
var theoremVerified = false;
|
|
28
25
|
var labelNodes = labelNodesQuery(theoremNode), labelsString = fileContext.nodesAsString(labelNodes);
|
|
29
26
|
fileContext.trace("Verifying the '".concat(labelsString, "' theorem..."), theoremNode);
|
|
30
|
-
var labels = [], labelsVerified = (
|
|
27
|
+
var labels = [], labelsVerified = verifyLabels(labelNodes, labels, fileContext);
|
|
31
28
|
if (labelsVerified) {
|
|
32
|
-
var localContext = _local.default.fromFileContext(fileContext), suppositions = [], suppositionNodes = suppositionsNodeQuery(theoremNode), suppositionsVerified = (
|
|
29
|
+
var localContext = _local.default.fromFileContext(fileContext), suppositions = [], suppositionNodes = suppositionsNodeQuery(theoremNode), suppositionsVerified = verifySuppositions(suppositionNodes, suppositions, localContext);
|
|
33
30
|
if (suppositionsVerified) {
|
|
34
31
|
var consequents = [], consequentNode = consequentNodeQuery(theoremNode), consequentVerified = (0, _consequent.default)(consequentNode, consequents, localContext);
|
|
35
32
|
if (consequentVerified) {
|
|
36
|
-
var proofNode = proofNodeQuery(theoremNode), firstConsequent = (0, _array.first)(consequents), consequent = firstConsequent, statementNode = consequent.getStatementNode(), substitutions = _substitutions.default.fromNothing(), proofVerified = (
|
|
33
|
+
var proofNode = proofNodeQuery(theoremNode), firstConsequent = (0, _array.first)(consequents), consequent = firstConsequent, statementNode = consequent.getStatementNode(), substitutions = _substitutions.default.fromNothing(), proofVerified = verifyProof(proofNode, statementNode, substitutions, localContext);
|
|
37
34
|
if (proofVerified) {
|
|
38
35
|
var substitutions1 = _substitutions.default.fromNothing(), theorem = _theorem.default.fromLabelsSuppositionsConsequentSubstitutionsAndFileContext(labels, suppositions, consequent, substitutions1, fileContext);
|
|
39
36
|
fileContext.addTheorem(theorem);
|
|
@@ -48,4 +45,4 @@ function verifyTheorem(theoremNode, fileContext) {
|
|
|
48
45
|
return theoremVerified;
|
|
49
46
|
}
|
|
50
47
|
|
|
51
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
48
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy92ZXJpZnkvdGhlb3JlbS5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyJcInVzZSBzdHJpY3RcIjtcblxuaW1wb3J0IFRoZW9yZW0gZnJvbSBcIi4uL3RoZW9yZW1cIjtcbi8vIGltcG9ydCB2ZXJpZnlQcm9vZiBmcm9tIFwiLi4vdmVyaWZ5L3Byb29mXCI7XG5pbXBvcnQgTG9jYWxDb250ZXh0IGZyb20gXCIuLi9jb250ZXh0L2xvY2FsXCI7XG5pbXBvcnQgU3Vic3RpdHV0aW9ucyBmcm9tIFwiLi4vc3Vic3RpdHV0aW9uc1wiO1xuaW1wb3J0IHZlcmlmeUNvbnNlcXVlbnQgZnJvbSBcIi4uL3ZlcmlmeS9jb25zZXF1ZW50XCI7XG4vLyBpbXBvcnQgdmVyaWZ5U3VwcG9zaXRpb25zIGZyb20gXCIuLi92ZXJpZnkvc3VwcG9zaXRpb25zXCI7XG5cbmltcG9ydCB7IGZpcnN0IH0gZnJvbSBcIi4uL3V0aWxpdGllcy9hcnJheVwiO1xuaW1wb3J0IHsgbm9kZVF1ZXJ5LCBub2Rlc1F1ZXJ5IH0gZnJvbSBcIi4uL3V0aWxpdGllcy9xdWVyeVwiO1xuXG5jb25zdCBwcm9vZk5vZGVRdWVyeSA9IG5vZGVRdWVyeShcIi90aGVvcmVtL3Byb29mIVwiKSxcbiAgICAgIGxhYmVsTm9kZXNRdWVyeSA9IG5vZGVzU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elUnifier from "../unifier/metaLevel";
|
|
6
|
+
|
|
7
|
+
import { match } from "../utilities/array";
|
|
8
|
+
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
9
|
+
|
|
10
|
+
const statementNodesQuery = nodesQuery("/subproofAssertion/statement"),
|
|
11
|
+
subproofAssertionNodeQuery = nodeQuery("/statement/subproofAssertion");
|
|
12
|
+
|
|
13
|
+
export default class SubproofAssertion {
|
|
14
|
+
constructor(fileContext, string, statements) {
|
|
15
|
+
this.fileContext = fileContext;
|
|
16
|
+
this.string = string;
|
|
17
|
+
this.statements = statements;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
getFileContext() {
|
|
21
|
+
return this.fileContext;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
getString() {
|
|
25
|
+
return this.string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
getStatements() {
|
|
29
|
+
return this.statements;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
unifySubproof(subproof, substitutions, localContext) {
|
|
33
|
+
let subproofUnified;
|
|
34
|
+
|
|
35
|
+
const subproofString = subproof.getString(),
|
|
36
|
+
subproofStatements = subproof.getStatements(),
|
|
37
|
+
subproofAssertionString = this.string; ///
|
|
38
|
+
|
|
39
|
+
localContext.trace(`Unifying the '${subproofString}' subproof with the '${subproofAssertionString}' subproof assertion...`);
|
|
40
|
+
|
|
41
|
+
subproofUnified = match(this.statements, subproofStatements, (statement, subproofStatement) => {
|
|
42
|
+
const statementNode = statement.getNode(),
|
|
43
|
+
subproofStatementNode = subproofStatement.getNode(),
|
|
44
|
+
nodeA = statementNode, ///
|
|
45
|
+
nodeB = subproofStatementNode, ///
|
|
46
|
+
fileContextA = this.fileContext, ///
|
|
47
|
+
localContextA = LocalContext.fromFileContext(fileContextA),
|
|
48
|
+
localContextB = localContext, ///
|
|
49
|
+
unified = metaLevelUnifier.unify(nodeA, nodeB, substitutions, localContextA, localContextB);
|
|
50
|
+
|
|
51
|
+
if (unified) {
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
if (subproofUnified) {
|
|
57
|
+
localContext.debug(`...unified the '${subproofString}' subproof with the '${subproofAssertionString}' subproof assertion.`);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return subproofUnified;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
static fromStatementNode(statementNode, fileContext) {
|
|
64
|
+
let subproofAssertion = null;
|
|
65
|
+
|
|
66
|
+
const subproofAssertionNode = subproofAssertionNodeQuery(statementNode);
|
|
67
|
+
|
|
68
|
+
if (subproofAssertionNode !== null) {
|
|
69
|
+
const node = subproofAssertionNode, ///
|
|
70
|
+
string = fileContext.nodeAsString(node),
|
|
71
|
+
localContext = LocalContext.fromFileContext(fileContext),
|
|
72
|
+
statementNodes = statementNodesQuery(subproofAssertionNode),
|
|
73
|
+
statements = statementNodes.map((statementNode) => {
|
|
74
|
+
const statement = Statement.fromStatementNode(statementNode, localContext);
|
|
75
|
+
|
|
76
|
+
return statement;
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
subproofAssertion = new SubproofAssertion(fileContext, string, statements);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return subproofAssertion;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -16,8 +16,8 @@ export default class MetavariableAssignment {
|
|
|
16
16
|
metavariableAssigned = metavariableAdded; ///
|
|
17
17
|
|
|
18
18
|
metavariableAssigned ?
|
|
19
|
-
fileContext.trace(`Assigned the '${metavariableString}' metavariable
|
|
20
|
-
fileContext.debug(`Unable to assign the '${metavariableString}' metavariable
|
|
19
|
+
fileContext.trace(`Assigned the '${metavariableString}' metavariable.`) :
|
|
20
|
+
fileContext.debug(`Unable to assign the '${metavariableString}' metavariable.`);
|
|
21
21
|
|
|
22
22
|
return metavariableAssigned;
|
|
23
23
|
}
|
package/src/combinator.js
CHANGED
|
@@ -1,32 +1,62 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import shim from "./shim";
|
|
4
|
+
import LocalContext from "./context/local";
|
|
5
|
+
|
|
6
|
+
import { nodeQuery } from "./utilities/query";
|
|
7
|
+
|
|
8
|
+
const statementNodeQuery = nodeQuery("/combinatorDeclaration/statement");
|
|
4
9
|
|
|
5
10
|
export default class Combinator {
|
|
6
|
-
constructor(
|
|
7
|
-
this.
|
|
8
|
-
|
|
11
|
+
constructor(statement) {
|
|
12
|
+
this.statement = statement;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
getStatement() {
|
|
16
|
+
return this.statement;
|
|
9
17
|
}
|
|
10
18
|
|
|
19
|
+
getString() { return this.statement.getString(); }
|
|
20
|
+
|
|
11
21
|
getStatementNode() {
|
|
12
|
-
|
|
22
|
+
const statementNode = this.statement.getNode();
|
|
23
|
+
|
|
24
|
+
return statementNode;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
verify(fileContext) {
|
|
28
|
+
const localContext = LocalContext.fromFileContext(fileContext),
|
|
29
|
+
statementVerifiedAsCombinator = this.statement.verifyAsCombinator(localContext),
|
|
30
|
+
verified = statementVerifiedAsCombinator; ///
|
|
31
|
+
|
|
32
|
+
return verified;
|
|
13
33
|
}
|
|
14
34
|
|
|
15
|
-
|
|
16
|
-
|
|
35
|
+
toJSON() {
|
|
36
|
+
const statementString = this.statement.getString(),
|
|
37
|
+
statement = statementString, ///
|
|
38
|
+
json = {
|
|
39
|
+
statement
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
return json;
|
|
17
43
|
}
|
|
18
44
|
|
|
19
|
-
static
|
|
20
|
-
|
|
21
|
-
|
|
45
|
+
static fromJSON(json, fileContext) {
|
|
46
|
+
let combinator = null;
|
|
47
|
+
|
|
48
|
+
debugger
|
|
22
49
|
|
|
23
50
|
return combinator;
|
|
24
51
|
}
|
|
25
|
-
}
|
|
26
52
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
53
|
+
static fromCombinatorDeclarationNode(combinatorDeclarationNode, fileContext) {
|
|
54
|
+
const { Statement } = shim,
|
|
55
|
+
statementNode = statementNodeQuery(combinatorDeclarationNode),
|
|
56
|
+
localContext = LocalContext.fromFileContext(fileContext),
|
|
57
|
+
statement = Statement.fromStatementNode(statementNode, localContext),
|
|
58
|
+
combinator = new Combinator(statement);
|
|
30
59
|
|
|
31
|
-
|
|
60
|
+
return combinator;
|
|
61
|
+
}
|
|
32
62
|
}
|
package/src/conclusion.js
CHANGED
|
@@ -1,32 +1,102 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import metaLevelUnifier from "./unifier/metaLevel";
|
|
4
|
+
import UnqualifiedStatement from "./statement/unqualified";
|
|
5
|
+
|
|
6
|
+
import { nodeQuery } from "./utilities/query";
|
|
7
|
+
import LocalContext from "./context/local";
|
|
8
|
+
|
|
9
|
+
const unqualifiedStatementNodeQuery = nodeQuery("/conclusion/unqualifiedStatement");
|
|
4
10
|
|
|
5
11
|
export default class Conclusion {
|
|
6
|
-
constructor(
|
|
7
|
-
this.
|
|
12
|
+
constructor(fileContext, unqualifiedStatement) {
|
|
13
|
+
this.fileContext = fileContext;
|
|
14
|
+
this.unqualifiedStatement = unqualifiedStatement;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
getFileContext() {
|
|
18
|
+
return this.fileContext;
|
|
8
19
|
}
|
|
9
20
|
|
|
10
|
-
|
|
11
|
-
return this.
|
|
21
|
+
getUnqualifiedStatement() {
|
|
22
|
+
return this.unqualifiedStatement;
|
|
12
23
|
}
|
|
13
24
|
|
|
14
|
-
|
|
15
|
-
|
|
25
|
+
getString() { return this.unqualifiedStatement.getString(); }
|
|
26
|
+
|
|
27
|
+
getStatement() { return this.unqualifiedStatement.getStatement(); }
|
|
28
|
+
|
|
29
|
+
unifyStatement(statement, substitutions, localContext) {
|
|
30
|
+
let statementUnified;
|
|
31
|
+
|
|
32
|
+
const conclusion = this, ///
|
|
33
|
+
statementString = statement.getString(),
|
|
34
|
+
conclusionStatement = conclusion.getStatement(),
|
|
35
|
+
conclusionStatementString = conclusionStatement.getString();
|
|
16
36
|
|
|
17
|
-
|
|
18
|
-
const nodeA = this.statementNode, ///
|
|
19
|
-
nodeB = statementNodeB, ///
|
|
20
|
-
unified = metaLevelUnifier.unify(nodeA, nodeB, substitutions, localContextA, localContextB);
|
|
37
|
+
localContext.trace(`Unifying the '${statementString}' statement with the conclusion's '${conclusionStatementString}' statement...`);
|
|
21
38
|
|
|
22
|
-
|
|
39
|
+
const statementNode = statement.getNode(),
|
|
40
|
+
conclusionStatementNode = conclusionStatement.getNode(),
|
|
41
|
+
nodeA = conclusionStatementNode, ///
|
|
42
|
+
nodeB = statementNode, ///
|
|
43
|
+
fileContextA = this.fileContext, ///
|
|
44
|
+
localContextA = LocalContext.fromFileContext(fileContextA),
|
|
45
|
+
localContextB = localContext, ///
|
|
46
|
+
unified = metaLevelUnifier.unify(nodeA, nodeB, substitutions, localContextA, localContextB);
|
|
47
|
+
|
|
48
|
+
statementUnified = unified; ///
|
|
49
|
+
|
|
50
|
+
if (statementUnified) {
|
|
51
|
+
localContext.debug(`...unified the '${statementString}' statement with the conclusion's '${conclusionStatementString}' statement.`);
|
|
23
52
|
}
|
|
24
53
|
|
|
25
54
|
return statementUnified;
|
|
26
55
|
}
|
|
27
56
|
|
|
28
|
-
|
|
29
|
-
|
|
57
|
+
verify(localContext) {
|
|
58
|
+
let verified = false;
|
|
59
|
+
|
|
60
|
+
const conclusionString = this.getString(); ///
|
|
61
|
+
|
|
62
|
+
localContext.trace(`Verifying the '${conclusionString}' conclusion...`);
|
|
63
|
+
|
|
64
|
+
const stated = true,
|
|
65
|
+
assignments = [],
|
|
66
|
+
unqualifiedStatementVerified = this.unqualifiedStatement.verify(assignments, stated, localContext);
|
|
67
|
+
|
|
68
|
+
if (unqualifiedStatementVerified) {
|
|
69
|
+
verified = true;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (verified) {
|
|
73
|
+
localContext.debug(`...verified the '${conclusionString}' conclusion.`);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return verified;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
toJSON() {
|
|
80
|
+
const unqualifiedStatementString = this.unqualifiedStatement.getString(),
|
|
81
|
+
unqualifiedStatement = unqualifiedStatementString, ///
|
|
82
|
+
json = {
|
|
83
|
+
unqualifiedStatement
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
return json;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
static fromJSON(json, fileContext) {
|
|
90
|
+
let conclusion = null;
|
|
91
|
+
|
|
92
|
+
debugger
|
|
93
|
+
|
|
94
|
+
return conclusion;
|
|
95
|
+
}
|
|
96
|
+
static fromConclusionNode(conclusionNode, fileContext) {
|
|
97
|
+
const unqualifiedStatementNode = unqualifiedStatementNodeQuery(conclusionNode),
|
|
98
|
+
unqualifiedStatement = UnqualifiedStatement.fromUnqualifiedStatementNode(unqualifiedStatementNode, fileContext),
|
|
99
|
+
conclusion = new Conclusion(fileContext, unqualifiedStatement);
|
|
30
100
|
|
|
31
101
|
return conclusion;
|
|
32
102
|
}
|
package/src/context/file.js
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import Type from "../type";
|
|
4
|
+
import Rule from "../rule";
|
|
5
|
+
import Axiom from "../axiom";
|
|
6
|
+
import Lemma from "../lemma";
|
|
7
|
+
import Theorem from "../theorem";
|
|
8
|
+
import Variable from "../variable";
|
|
3
9
|
import metaTypes from "../metaTypes";
|
|
10
|
+
import MetaLemma from "../metaLemma";
|
|
11
|
+
import Conjecture from "../conjecture";
|
|
12
|
+
import Combinator from "../combinator";
|
|
13
|
+
import Constructor from "../constructor";
|
|
14
|
+
import Metatheorem from "../metatheorem";
|
|
15
|
+
import Metavariable from "../metavariable";
|
|
4
16
|
import topLevelVerifier from "../verifier/topLevel";
|
|
5
17
|
|
|
6
18
|
import { push } from "../utilities/array";
|
|
@@ -348,8 +360,9 @@ export default class FileContext {
|
|
|
348
360
|
return label;
|
|
349
361
|
}
|
|
350
362
|
|
|
351
|
-
|
|
363
|
+
findRuleByReference(reference) {
|
|
352
364
|
const rules = this.getRules(),
|
|
365
|
+
metavariableNode = reference.getMetavariableNode(),
|
|
353
366
|
rule = rules.find((rule) => {
|
|
354
367
|
const metavariableNodeMatches = rule.matchMetavariableNode(metavariableNode);
|
|
355
368
|
|
|
@@ -361,8 +374,9 @@ export default class FileContext {
|
|
|
361
374
|
return rule;
|
|
362
375
|
}
|
|
363
376
|
|
|
364
|
-
|
|
377
|
+
findAxiomByReference(reference) {
|
|
365
378
|
const axioms = this.getAxioms(),
|
|
379
|
+
metavariableNode = reference.getMetavariableNode(),
|
|
366
380
|
axiom = axioms.find((axiom) => {
|
|
367
381
|
const metavariableNodeMatches = axiom.matchMetavariableNode(metavariableNode);
|
|
368
382
|
|
|
@@ -374,8 +388,9 @@ export default class FileContext {
|
|
|
374
388
|
return axiom;
|
|
375
389
|
}
|
|
376
390
|
|
|
377
|
-
|
|
391
|
+
findLemmaByReference(reference) {
|
|
378
392
|
const lemmas = this.getLemmas(),
|
|
393
|
+
metavariableNode = reference.getMetavariableNode(),
|
|
379
394
|
lemma = lemmas.find((lemma) => {
|
|
380
395
|
const metavariableNodeMatches = lemma.matchMetavariableNode(metavariableNode);
|
|
381
396
|
|
|
@@ -387,8 +402,9 @@ export default class FileContext {
|
|
|
387
402
|
return lemma;
|
|
388
403
|
}
|
|
389
404
|
|
|
390
|
-
|
|
405
|
+
findTheoremByReference(reference) {
|
|
391
406
|
const theorems = this.getTheorems(),
|
|
407
|
+
metavariableNode = reference.getMetavariableNode(),
|
|
392
408
|
theorem = theorems.find((theorem) => {
|
|
393
409
|
const metavariableNodeMatches = theorem.matchMetavariableNode(metavariableNode);
|
|
394
410
|
|
|
@@ -400,8 +416,9 @@ export default class FileContext {
|
|
|
400
416
|
return theorem;
|
|
401
417
|
}
|
|
402
418
|
|
|
403
|
-
|
|
419
|
+
findMetaLemmaByReference(reference) {
|
|
404
420
|
const metaLemmas = this.getMetaLemmas(),
|
|
421
|
+
metavariableNode = reference.getMetavariableNode(),
|
|
405
422
|
metaLemma = metaLemmas.find((metaLemma) => {
|
|
406
423
|
const metavariableNodeMatches = metaLemma.matchMetavariableNode(metavariableNode);
|
|
407
424
|
|
|
@@ -413,8 +430,9 @@ export default class FileContext {
|
|
|
413
430
|
return metaLemma;
|
|
414
431
|
}
|
|
415
432
|
|
|
416
|
-
|
|
433
|
+
findConjectureByReference(reference) {
|
|
417
434
|
const conjectures = this.getConjectures(),
|
|
435
|
+
metavariableNode = reference.getMetavariableNode(),
|
|
418
436
|
conjecture = conjectures.find((conjecture) => {
|
|
419
437
|
const metavariableNodeMatches = conjecture.matchMetavariableNode(metavariableNode);
|
|
420
438
|
|
|
@@ -426,8 +444,9 @@ export default class FileContext {
|
|
|
426
444
|
return conjecture;
|
|
427
445
|
}
|
|
428
446
|
|
|
429
|
-
|
|
447
|
+
findMetatheoremByReference(reference) {
|
|
430
448
|
const metatheorems = this.getMetatheorems(),
|
|
449
|
+
metavariableNode = reference.getMetavariableNode(),
|
|
431
450
|
metatheorem = metatheorems.find((metatheorem) => {
|
|
432
451
|
const metavariableNodeMatches = metatheorem.matchMetavariableNode(metavariableNode);
|
|
433
452
|
|
|
@@ -606,8 +625,6 @@ export default class FileContext {
|
|
|
606
625
|
|
|
607
626
|
error(message, node) { this.releaseContext.error(message, node, this.tokens, this.filePath); }
|
|
608
627
|
|
|
609
|
-
fatal(message, node) { this.releaseContext.fatal(message, node, this.tokens, this.filePath); }
|
|
610
|
-
|
|
611
628
|
reset() {
|
|
612
629
|
this.types = [];
|
|
613
630
|
this.rules = [];
|
|
@@ -649,15 +666,210 @@ export default class FileContext {
|
|
|
649
666
|
|
|
650
667
|
toJSON() {
|
|
651
668
|
const filePath = this.filePath,
|
|
652
|
-
|
|
669
|
+
types = this.types.map((type) => {
|
|
670
|
+
const typeJSON = type.toJSON();
|
|
671
|
+
|
|
672
|
+
type = typeJSON; ///
|
|
673
|
+
|
|
674
|
+
return type;
|
|
675
|
+
}),
|
|
676
|
+
rules = this.rules.map((rule) => {
|
|
677
|
+
const ruleJSON = rule.toJSON();
|
|
678
|
+
|
|
679
|
+
rule = ruleJSON; ///
|
|
680
|
+
|
|
681
|
+
return rule;
|
|
682
|
+
}),
|
|
683
|
+
axioms = this.axioms.map((axiom) => {
|
|
684
|
+
const axiomJSON = axiom.toJSON();
|
|
685
|
+
|
|
686
|
+
axiom = axiomJSON; ///
|
|
687
|
+
|
|
688
|
+
return axiom;
|
|
689
|
+
}),
|
|
690
|
+
lemmas = this.lemmas.map((lemma) => {
|
|
691
|
+
const lemmaJSON = lemma.toJSON();
|
|
692
|
+
|
|
693
|
+
lemma = lemmaJSON; ///
|
|
694
|
+
|
|
695
|
+
return lemma;
|
|
696
|
+
}),
|
|
697
|
+
theorems = this.theorems.map((theorem) => {
|
|
698
|
+
const theoremJSON = theorem.toJSON();
|
|
699
|
+
|
|
700
|
+
theorem = theoremJSON; ///
|
|
701
|
+
|
|
702
|
+
return theorem;
|
|
703
|
+
}),
|
|
704
|
+
variables = this.variables.map((variable) => {
|
|
705
|
+
const variableJSON = variable.toJSON();
|
|
706
|
+
|
|
707
|
+
variable = variableJSON; ///
|
|
708
|
+
|
|
709
|
+
return variable;
|
|
710
|
+
}),
|
|
711
|
+
metaLemmas = this.metaLemmas.map((metaLemma) => {
|
|
712
|
+
const metaLemmaJSON = metaLemma.toJSON();
|
|
713
|
+
|
|
714
|
+
metaLemma = metaLemmaJSON; ///
|
|
715
|
+
|
|
716
|
+
return metaLemma;
|
|
717
|
+
}),
|
|
718
|
+
conjectures = this.conjectures.map((conjecture) => {
|
|
719
|
+
const conjectureJSON = conjecture.toJSON();
|
|
720
|
+
|
|
721
|
+
conjecture = conjectureJSON; ///
|
|
722
|
+
|
|
723
|
+
return conjecture;
|
|
724
|
+
}),
|
|
725
|
+
combinators = this.combinators.map((combinator) => {
|
|
726
|
+
const combinatorJSON = combinator.toJSON();
|
|
727
|
+
|
|
728
|
+
combinator = combinatorJSON; ///
|
|
729
|
+
|
|
730
|
+
return combinator;
|
|
731
|
+
}),
|
|
732
|
+
constructors = this.constructors.map((constructor) => {
|
|
733
|
+
const constructorJSON = constructor.toJSON();
|
|
734
|
+
|
|
735
|
+
constructor = constructorJSON; ///
|
|
736
|
+
|
|
737
|
+
return constructor;
|
|
738
|
+
}),
|
|
739
|
+
metatheorems = this.metatheorems.map((metatheorem) => {
|
|
740
|
+
const metatheoremJSON = metatheorem.toJSON();
|
|
741
|
+
|
|
742
|
+
metatheorem = metatheoremJSON; ///
|
|
743
|
+
|
|
744
|
+
return metatheorem;
|
|
745
|
+
}),
|
|
746
|
+
metavariables = this.metavariables.map((metavariable) => {
|
|
747
|
+
const metavariableJSON = metavariable.toJSON();
|
|
748
|
+
|
|
749
|
+
metavariable = metavariableJSON; ///
|
|
750
|
+
|
|
751
|
+
return metavariable;
|
|
752
|
+
}),
|
|
653
753
|
json = {
|
|
654
754
|
filePath,
|
|
655
|
-
|
|
755
|
+
types,
|
|
756
|
+
rules,
|
|
757
|
+
axioms,
|
|
758
|
+
lemmas,
|
|
759
|
+
theorems,
|
|
760
|
+
variables,
|
|
761
|
+
metaLemmas,
|
|
762
|
+
conjectures,
|
|
763
|
+
combinators,
|
|
764
|
+
constructors,
|
|
765
|
+
metatheorems,
|
|
766
|
+
metavariables
|
|
656
767
|
};
|
|
657
768
|
|
|
658
769
|
return json;
|
|
659
770
|
}
|
|
660
771
|
|
|
772
|
+
static fromJSON(json) {
|
|
773
|
+
const { types, rules, axioms, lemmas, theorems, metaLemmas, variables, conjectures, combinators, constructors, metatheorems, metavariables } = json,
|
|
774
|
+
fileContext = this, ///
|
|
775
|
+
typesJSON = types, ///
|
|
776
|
+
rulesJSON = rules, ///
|
|
777
|
+
axiomsJSON = axioms, ///
|
|
778
|
+
lemmasJSON = lemmas, ///
|
|
779
|
+
theoremsJSON = theorems, ///
|
|
780
|
+
variablesJSON = variables, ///
|
|
781
|
+
metaLemmasJSON = metaLemmas, ///
|
|
782
|
+
conjecturesJSON = conjectures, ///
|
|
783
|
+
combinatorsJSON = combinators, ///
|
|
784
|
+
constructorsJSON = constructors, ///
|
|
785
|
+
metatheoremsJSON = metatheorems, ///
|
|
786
|
+
metavariablesJSON = metavariables; ///
|
|
787
|
+
|
|
788
|
+
typesJSON.forEach((typeJSON) => {
|
|
789
|
+
const json = typeJSON, ///
|
|
790
|
+
type = Type.fromJSON(json, fileContext);
|
|
791
|
+
|
|
792
|
+
this.types.push(type);
|
|
793
|
+
});
|
|
794
|
+
|
|
795
|
+
rulesJSON.forEach((ruleJSON) => {
|
|
796
|
+
const json = ruleJSON, ///
|
|
797
|
+
rule = Rule.fromJSON(json, fileContext);
|
|
798
|
+
|
|
799
|
+
this.rules.push(rule);
|
|
800
|
+
});
|
|
801
|
+
|
|
802
|
+
axiomsJSON.forEach((axiomJSON) => {
|
|
803
|
+
const json = axiomJSON, ///
|
|
804
|
+
axiom = Axiom.fromJSON(json, fileContext);
|
|
805
|
+
|
|
806
|
+
this.axioms.push(axiom);
|
|
807
|
+
});
|
|
808
|
+
|
|
809
|
+
lemmasJSON.forEach((lemmaJSON) => {
|
|
810
|
+
const json = lemmaJSON, ///
|
|
811
|
+
lemma = Lemma.fromJSON(json, fileContext);
|
|
812
|
+
|
|
813
|
+
this.lemmas.push(lemma);
|
|
814
|
+
});
|
|
815
|
+
|
|
816
|
+
theoremsJSON.forEach((theoremJSON) => {
|
|
817
|
+
const json = theoremJSON, ///
|
|
818
|
+
theorem = Theorem.fromJSON(json, fileContext);
|
|
819
|
+
|
|
820
|
+
this.theorems.push(theorem);
|
|
821
|
+
});
|
|
822
|
+
|
|
823
|
+
variablesJSON.forEach((variableJSON) => {
|
|
824
|
+
const json = variableJSON, ///
|
|
825
|
+
variable = Variable.fromJSON(json, fileContext);
|
|
826
|
+
|
|
827
|
+
this.variables.push(variable);
|
|
828
|
+
});
|
|
829
|
+
|
|
830
|
+
metaLemmasJSON.forEach((metaLemmaJSON) => {
|
|
831
|
+
const json = metaLemmaJSON, ///
|
|
832
|
+
metaLemma = MetaLemma.fromJSON(json, fileContext);
|
|
833
|
+
|
|
834
|
+
this.metaLemmas.push(metaLemma);
|
|
835
|
+
});
|
|
836
|
+
|
|
837
|
+
conjecturesJSON.forEach((conjectureJSON) => {
|
|
838
|
+
const json = conjectureJSON, ///
|
|
839
|
+
conjecture = Conjecture.fromJSON(json, fileContext);
|
|
840
|
+
|
|
841
|
+
this.conjectures.push(conjecture);
|
|
842
|
+
});
|
|
843
|
+
|
|
844
|
+
combinatorsJSON.forEach((combinatorJSON) => {
|
|
845
|
+
const json = combinatorJSON, ///
|
|
846
|
+
combinator = Combinator.fromJSON(json, fileContext);
|
|
847
|
+
|
|
848
|
+
this.combinators.push(combinator);
|
|
849
|
+
});
|
|
850
|
+
|
|
851
|
+
constructorsJSON.forEach((constructorJSON) => {
|
|
852
|
+
const json = constructorJSON, ///
|
|
853
|
+
constructor = Constructor.fromJSON(json, fileContext);
|
|
854
|
+
|
|
855
|
+
this.constructors.push(constructor);
|
|
856
|
+
});
|
|
857
|
+
|
|
858
|
+
metatheoremsJSON.forEach((metatheoremJSON) => {
|
|
859
|
+
const json = metatheoremJSON, ///
|
|
860
|
+
metatheorem = Metatheorem.fromJSON(json, fileContext);
|
|
861
|
+
|
|
862
|
+
this.metatheorems.push(metatheorem);
|
|
863
|
+
});
|
|
864
|
+
|
|
865
|
+
metavariablesJSON.forEach((metavariableJSON) => {
|
|
866
|
+
const json = metavariableJSON, ///
|
|
867
|
+
metavariable = Metavariable.fromJSON(json, fileContext);
|
|
868
|
+
|
|
869
|
+
this.metavariables.push(metavariable);
|
|
870
|
+
});
|
|
871
|
+
}
|
|
872
|
+
|
|
661
873
|
static fromFileAndReleaseContext(file, releaseContext) {
|
|
662
874
|
const fileContent = file.getContent(),
|
|
663
875
|
filePath = file.getPath(),
|