occam-verify-cli 0.0.581 → 0.0.583
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/axiom.js +5 -5
- package/lib/axiomLemmaTheoremConjecture.js +26 -26
- package/lib/conjecture.js +3 -3
- package/lib/consequent.js +80 -0
- package/lib/lemma.js +4 -4
- package/lib/theorem.js +4 -4
- package/lib/verifier/termForVariable/{consequence.js → consequent.js} +1 -1
- package/lib/verify/axiom.js +6 -6
- package/lib/verify/conjecture.js +8 -8
- package/lib/verify/consequent.js +36 -0
- package/lib/verify/lemma.js +7 -7
- package/lib/verify/theorem.js +7 -7
- package/package.json +4 -4
- package/src/axiom.js +2 -2
- package/src/axiomLemmaTheoremConjecture.js +24 -24
- package/src/conjecture.js +1 -1
- package/src/{consequence.js → consequent.js} +7 -7
- package/src/lemma.js +1 -1
- package/src/theorem.js +1 -1
- package/src/verify/axiom.js +10 -10
- package/src/verify/conjecture.js +10 -11
- package/src/verify/consequent.js +37 -0
- package/src/verify/lemma.js +10 -10
- package/src/verify/theorem.js +10 -11
- package/lib/consequence.js +0 -80
- package/lib/verify/consequence.js +0 -36
- package/src/verify/consequence.js +0 -37
- /package/src/verifier/termForVariable/{consequence.js → consequent.js} +0 -0
package/lib/verify/lemma.js
CHANGED
|
@@ -12,8 +12,8 @@ var _lemma = /*#__PURE__*/ _interop_require_default(require("../lemma"));
|
|
|
12
12
|
var _proof = /*#__PURE__*/ _interop_require_default(require("../verify/proof"));
|
|
13
13
|
var _proof1 = /*#__PURE__*/ _interop_require_default(require("../context/proof"));
|
|
14
14
|
var _labels = /*#__PURE__*/ _interop_require_default(require("../verify/labels"));
|
|
15
|
+
var _consequent = /*#__PURE__*/ _interop_require_default(require("./consequent"));
|
|
15
16
|
var _supposition = /*#__PURE__*/ _interop_require_default(require("./supposition"));
|
|
16
|
-
var _consequence = /*#__PURE__*/ _interop_require_default(require("./consequence"));
|
|
17
17
|
var _array = require("../utilities/array");
|
|
18
18
|
var _constants = require("../constants");
|
|
19
19
|
var _query = require("../utilities/query");
|
|
@@ -22,7 +22,7 @@ function _interop_require_default(obj) {
|
|
|
22
22
|
default: obj
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
-
var proofNodeQuery = (0, _query.nodeQuery)("/lemma/proof!"), labelNodesQuery = (0, _query.nodesQuery)("/lemma/label"),
|
|
25
|
+
var proofNodeQuery = (0, _query.nodeQuery)("/lemma/proof!"), labelNodesQuery = (0, _query.nodesQuery)("/lemma/label"), consequentNodeQuery = (0, _query.nodeQuery)("/lemma/consequent!"), suppositionsNodeQuery = (0, _query.nodesQuery)("/lemma/supposition");
|
|
26
26
|
function verifyLemma(lemmaNode, fileContext) {
|
|
27
27
|
var lemmaVerified = false;
|
|
28
28
|
var labelNodes = labelNodesQuery(lemmaNode), labelsString = fileContext.nodesAsString(labelNodes), proofContext = _proof1.default.fromFileContext(fileContext);
|
|
@@ -36,11 +36,11 @@ function verifyLemma(lemmaNode, fileContext) {
|
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
38
|
if (suppositionsVerified) {
|
|
39
|
-
var
|
|
40
|
-
if (
|
|
41
|
-
var proofNode = proofNodeQuery(lemmaNode),
|
|
39
|
+
var consequents = [], consequentNode = consequentNodeQuery(lemmaNode), consequentVerified = (0, _consequent.default)(consequentNode, consequents, proofContext);
|
|
40
|
+
if (consequentVerified) {
|
|
41
|
+
var proofNode = proofNodeQuery(lemmaNode), firstConsequent = (0, _array.first)(consequents), consequent = firstConsequent, proofVerified = (0, _proof.default)(proofNode, consequent, proofContext);
|
|
42
42
|
if (proofVerified) {
|
|
43
|
-
var lemma = _lemma.default.
|
|
43
|
+
var lemma = _lemma.default.fromLabelsSuppositionsConsequentAndProofContext(labels, suppositions, consequent, proofContext);
|
|
44
44
|
fileContext.addLemma(lemma);
|
|
45
45
|
lemmaVerified = true;
|
|
46
46
|
}
|
|
@@ -53,4 +53,4 @@ function verifyLemma(lemmaNode, fileContext) {
|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SUFBSSxDQUFDLEFBQUMsaUJBQTZCLE9BQWIvQixjQUFhLGFBQVdKLFVBQVU7SUFDMUUsQ0FBQztJQUVELE9BQU9FO0FBQ1QifQ==
|
package/lib/verify/theorem.js
CHANGED
|
@@ -12,8 +12,8 @@ var _theorem = /*#__PURE__*/ _interop_require_default(require("../theorem"));
|
|
|
12
12
|
var _proof = /*#__PURE__*/ _interop_require_default(require("../verify/proof"));
|
|
13
13
|
var _proof1 = /*#__PURE__*/ _interop_require_default(require("../context/proof"));
|
|
14
14
|
var _labels = /*#__PURE__*/ _interop_require_default(require("../verify/labels"));
|
|
15
|
+
var _consequent = /*#__PURE__*/ _interop_require_default(require("./consequent"));
|
|
15
16
|
var _supposition = /*#__PURE__*/ _interop_require_default(require("./supposition"));
|
|
16
|
-
var _consequence = /*#__PURE__*/ _interop_require_default(require("./consequence"));
|
|
17
17
|
var _array = require("../utilities/array");
|
|
18
18
|
var _query = require("../utilities/query");
|
|
19
19
|
function _interop_require_default(obj) {
|
|
@@ -21,7 +21,7 @@ function _interop_require_default(obj) {
|
|
|
21
21
|
default: obj
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
var proofNodeQuery = (0, _query.nodeQuery)("/theorem/proof!"), labelNodesQuery = (0, _query.nodesQuery)("/theorem/label"),
|
|
24
|
+
var proofNodeQuery = (0, _query.nodeQuery)("/theorem/proof!"), labelNodesQuery = (0, _query.nodesQuery)("/theorem/label"), consequentNodeQuery = (0, _query.nodeQuery)("/theorem/consequent!"), suppositionsNodeQuery = (0, _query.nodesQuery)("/theorem/supposition");
|
|
25
25
|
function verifyTheorem(theoremNode, fileContext) {
|
|
26
26
|
var theoremVerified = false;
|
|
27
27
|
var labelNodes = labelNodesQuery(theoremNode), labelsString = fileContext.nodesAsString(labelNodes), proofContext = _proof1.default.fromFileContext(fileContext);
|
|
@@ -35,11 +35,11 @@ function verifyTheorem(theoremNode, fileContext) {
|
|
|
35
35
|
}
|
|
36
36
|
});
|
|
37
37
|
if (suppositionsVerified) {
|
|
38
|
-
var
|
|
39
|
-
if (
|
|
40
|
-
var proofNode = proofNodeQuery(theoremNode),
|
|
38
|
+
var consequents = [], consequentNode = consequentNodeQuery(theoremNode), consequentVerified = (0, _consequent.default)(consequentNode, consequents, proofContext);
|
|
39
|
+
if (consequentVerified) {
|
|
40
|
+
var proofNode = proofNodeQuery(theoremNode), firstConsequent = (0, _array.first)(consequents), consequent = firstConsequent, proofVerified = (0, _proof.default)(proofNode, consequent, proofContext);
|
|
41
41
|
if (proofVerified) {
|
|
42
|
-
var theorem = _theorem.default.
|
|
42
|
+
var theorem = _theorem.default.fromLabelsSuppositionsConsequentAndProofContext(labels, suppositions, consequent, proofContext);
|
|
43
43
|
fileContext.addTheorem(theorem);
|
|
44
44
|
theoremVerified = true;
|
|
45
45
|
}
|
|
@@ -52,4 +52,4 @@ function verifyTheorem(theoremNode, fileContext) {
|
|
|
52
52
|
return theoremVerified;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
55
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy92ZXJpZnkvdGhlb3JlbS5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyJcInVzZSBzdHJpY3RcIjtcblxuaW1wb3J0IFRoZW9yZW0gZnJvbSBcIi4uL3RoZW9yZW1cIjtcbmltcG9ydCB2ZXJpZnlQcm9vZiBmcm9tIFwiLi4vdmVyaWZ5L3Byb29mXCI7XG5pbXBvcnQgUHJvb2ZDb250ZXh0IGZyb20gXCIuLi9jb250ZXh0L3Byb29mXCI7XG5pbXBvcnQgdmVyaWZ5TGFiZWxzIGZyb20gXCIuLi92ZXJpZnkvbGFiZWxzXCI7XG5pbXBvcnQgdmVyaWZ5Q29uc2VxdWVudCBmcm9tIFwiLi9jb25zZXF1ZW50XCI7XG5pbXBvcnQgdmVyaWZ5U3VwcG9zaXRpb24gZnJvb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UVELElBQUlBLGlCQUFpQjtRQUNuQkQsWUFBWWlDLElBQUksQ0FBQyxBQUFDLGlCQUE2QixPQUFiOUIsY0FBYSxlQUFhSjtJQUM5RCxDQUFDO0lBRUQsT0FBT0U7QUFDVCJ9
|
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.583",
|
|
5
5
|
"license": "MIT, Anti-996",
|
|
6
6
|
"homepage": "https://github.com/djalbat/occam-verify-cli",
|
|
7
7
|
"description": "Occam's Verifier",
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"argumentative": "^2.0.21",
|
|
14
14
|
"necessary": "^11.2.1",
|
|
15
|
-
"occam-custom-grammars": "^5.0.
|
|
15
|
+
"occam-custom-grammars": "^5.0.438",
|
|
16
16
|
"occam-dom": "^3.1.31",
|
|
17
|
-
"occam-file-system": "^5.0.
|
|
18
|
-
"occam-grammar-utilities": "^7.0.
|
|
17
|
+
"occam-file-system": "^5.0.182",
|
|
18
|
+
"occam-grammar-utilities": "^7.0.88"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@swc/core": "^1.2.51",
|
package/src/axiom.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import AxiomLemmaTheoremConjecture from "./axiomLemmaTheoremConjecture";
|
|
4
4
|
|
|
5
5
|
export default class Axiom extends AxiomLemmaTheoremConjecture {
|
|
6
|
-
static fromJSONAndFileContext(json,
|
|
6
|
+
static fromJSONAndFileContext(json, fileContext) { return AxiomLemmaTheoremConjecture.fromJSONAndFileContext(Axiom, json, fileContext); }
|
|
7
7
|
|
|
8
|
-
static fromLabelsSuppositionsConsequenceAndProofContext(labels, suppositions,
|
|
8
|
+
static fromLabelsSuppositionsConsequenceAndProofContext(labels, suppositions, consequent, proofContext) { return AxiomLemmaTheoremConjecture.fromLabelsSuppositionsConsequenceAndProofContext(Axiom, labels, suppositions, consequent, proofContext); }
|
|
9
9
|
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import Label from "./label";
|
|
4
|
+
import Consequent from "./consequent";
|
|
4
5
|
import Supposition from "./supposition";
|
|
5
|
-
import Consequence from "./consequence";
|
|
6
6
|
import ProofContext from "./context/proof";
|
|
7
7
|
|
|
8
8
|
import { prune } from "./utilities/array";
|
|
9
9
|
import { someSubArray } from "./utilities/array";
|
|
10
10
|
|
|
11
11
|
export default class AxiomLemmaTheoremConjecture {
|
|
12
|
-
constructor(labels, suppositions,
|
|
12
|
+
constructor(labels, suppositions, consequent, proofContext) {
|
|
13
13
|
this.labels = labels;
|
|
14
14
|
this.suppositions = suppositions;
|
|
15
|
-
this.
|
|
15
|
+
this.consequent = consequent;
|
|
16
16
|
this.proofContext = proofContext;
|
|
17
17
|
}
|
|
18
18
|
|
|
@@ -24,8 +24,8 @@ export default class AxiomLemmaTheoremConjecture {
|
|
|
24
24
|
return this.suppositions;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
return this.
|
|
27
|
+
getConsequent() {
|
|
28
|
+
return this.consequent;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
getProofContext() {
|
|
@@ -52,25 +52,25 @@ export default class AxiomLemmaTheoremConjecture {
|
|
|
52
52
|
|
|
53
53
|
if (suppositionsLength === 0) {
|
|
54
54
|
const substitutions = [],
|
|
55
|
-
|
|
55
|
+
consequentMatches = matchConsequent(this.consequent, statementNode, substitutions, this.proofContext, statementProofContext);
|
|
56
56
|
|
|
57
|
-
statementNatches =
|
|
57
|
+
statementNatches = consequentMatches; ///
|
|
58
58
|
} else {
|
|
59
59
|
const proofSteps = statementProofContext.getProofSteps();
|
|
60
60
|
|
|
61
61
|
statementNatches = someSubArray(proofSteps, suppositionsLength, (proofSteps) => {
|
|
62
|
-
let
|
|
62
|
+
let suppositionsMatchConsequent = false;
|
|
63
63
|
|
|
64
64
|
const substitutions = [],
|
|
65
65
|
suppositionsMatch = matchSuppositions(this.suppositions, proofSteps, substitutions, this.proofContext, statementProofContext);
|
|
66
66
|
|
|
67
67
|
if (suppositionsMatch) {
|
|
68
|
-
const
|
|
68
|
+
const consequentMatches = matchConsequent(this.consequent, statementNode, substitutions, this.proofContext, statementProofContext);
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
suppositionsMatchConsequent = consequentMatches; ///
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
if (
|
|
73
|
+
if (suppositionsMatchConsequent) {
|
|
74
74
|
return true;
|
|
75
75
|
}
|
|
76
76
|
});
|
|
@@ -90,16 +90,16 @@ export default class AxiomLemmaTheoremConjecture {
|
|
|
90
90
|
|
|
91
91
|
return suppositionJSON;
|
|
92
92
|
}),
|
|
93
|
-
|
|
93
|
+
consequentJSON = this.consequent.toJSON(tokens),
|
|
94
94
|
proofContextJSON = this.proofContext.toJSON(tokens),
|
|
95
95
|
labels = labelsJSON, ///
|
|
96
96
|
suppositions = suppositionsJSON, ///
|
|
97
|
-
|
|
97
|
+
consequent = consequentJSON, ///
|
|
98
98
|
proofContext = proofContextJSON, ///
|
|
99
99
|
json = {
|
|
100
100
|
labels,
|
|
101
101
|
suppositions,
|
|
102
|
-
|
|
102
|
+
consequent,
|
|
103
103
|
proofContext
|
|
104
104
|
};
|
|
105
105
|
|
|
@@ -118,7 +118,7 @@ export default class AxiomLemmaTheoremConjecture {
|
|
|
118
118
|
return label;
|
|
119
119
|
});
|
|
120
120
|
|
|
121
|
-
let { suppositions,
|
|
121
|
+
let { suppositions, consequent, proofContext } = json;
|
|
122
122
|
|
|
123
123
|
const suppositionsJSON = suppositions; ///
|
|
124
124
|
|
|
@@ -129,11 +129,11 @@ export default class AxiomLemmaTheoremConjecture {
|
|
|
129
129
|
return supposition;
|
|
130
130
|
});
|
|
131
131
|
|
|
132
|
-
const
|
|
132
|
+
const consequentJSON = consequent; ///
|
|
133
133
|
|
|
134
|
-
json =
|
|
134
|
+
json = consequentJSON; ///
|
|
135
135
|
|
|
136
|
-
|
|
136
|
+
consequent = Consequent.fromJSONAndFileContext(json, fileContext);
|
|
137
137
|
|
|
138
138
|
const proofContextJSON = proofContext; ///
|
|
139
139
|
|
|
@@ -141,10 +141,10 @@ export default class AxiomLemmaTheoremConjecture {
|
|
|
141
141
|
|
|
142
142
|
proofContext = ProofContext.fromJSONAndFileContext(json, fileContext);
|
|
143
143
|
|
|
144
|
-
return new Class(labels, suppositions,
|
|
144
|
+
return new Class(labels, suppositions, consequent, proofContext); ///
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
static
|
|
147
|
+
static fromLabelsSuppositionsConsequentAndProofContext(Class, labels, suppositions, consequent, proofContext) { return new Class(labels, suppositions, consequent, proofContext); }
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
function matchSupposition(supposition, proofSteps, substitutions, proofContext, statementProofContext) {
|
|
@@ -187,9 +187,9 @@ function matchSuppositions(supposition, proofSteps, substitutions, proofContext,
|
|
|
187
187
|
return suppositionsMatch;
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
-
function
|
|
191
|
-
const nonTerminalNodeMatches =
|
|
192
|
-
|
|
190
|
+
function matchConsequent(consequent, statementNode, substitutions, proofContext, statementProofContext) {
|
|
191
|
+
const nonTerminalNodeMatches = consequent.matchStatementNode(statementNode, substitutions, proofContext, statementProofContext),
|
|
192
|
+
consequentMatches = nonTerminalNodeMatches; ///
|
|
193
193
|
|
|
194
|
-
return
|
|
194
|
+
return consequentMatches;
|
|
195
195
|
}
|
package/src/conjecture.js
CHANGED
|
@@ -5,5 +5,5 @@ import AxiomLemmaTheoremConjecture from "./axiomLemmaTheoremConjecture";
|
|
|
5
5
|
export default class Conjecture extends AxiomLemmaTheoremConjecture {
|
|
6
6
|
static fromJSONAndFileContext(json, fileContext) { return AxiomLemmaTheoremConjecture.fromJSONAndFileContext(Conjecture, json, fileContext); }
|
|
7
7
|
|
|
8
|
-
static fromLabelsSuppositionsConsequenceAndProofContext(labels, suppositions,
|
|
8
|
+
static fromLabelsSuppositionsConsequenceAndProofContext(labels, suppositions, consequent, proofContext) { return AxiomLemmaTheoremConjecture.fromLabelsSuppositionsConsequenceAndProofContext(Conjecture, labels, suppositions, consequent, proofContext); }
|
|
9
9
|
}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
import { nodeAsString } from "./utilities/string";
|
|
4
4
|
import { statementNodeFromStatementString } from "./utilities/node";
|
|
5
|
-
import {
|
|
5
|
+
import { consequentTermForVariableVerifier } from "./verifier/termForVariable/consequent";
|
|
6
6
|
|
|
7
|
-
export default class
|
|
7
|
+
export default class Consequent {
|
|
8
8
|
constructor(statementNode) {
|
|
9
9
|
this.statementNode = statementNode;
|
|
10
10
|
}
|
|
@@ -16,7 +16,7 @@ export default class Consequence {
|
|
|
16
16
|
matchStatementNode(statementNode, substitutions, proofContext) {
|
|
17
17
|
const nonTerminalNodeA = this.statementNode, ///
|
|
18
18
|
nonTerminalNodeB = statementNode, ///
|
|
19
|
-
nonTerminalNodeVerified =
|
|
19
|
+
nonTerminalNodeVerified = consequentTermForVariableVerifier.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, proofContext),
|
|
20
20
|
statementNodeMatches = nonTerminalNodeVerified; ///
|
|
21
21
|
|
|
22
22
|
return statementNodeMatches;
|
|
@@ -33,9 +33,9 @@ export default class Consequence {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
static fromStatementNode(statementNode) {
|
|
36
|
-
const
|
|
36
|
+
const consequent = new Consequent(statementNode);
|
|
37
37
|
|
|
38
|
-
return
|
|
38
|
+
return consequent;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
static fromJSONAndFileContext(json, fileContext) {
|
|
@@ -44,8 +44,8 @@ export default class Consequence {
|
|
|
44
44
|
lexer = fileContext.getLexer(),
|
|
45
45
|
parser = fileContext.getParser(),
|
|
46
46
|
statementNode = statementNodeFromStatementString(statementString, lexer, parser),
|
|
47
|
-
|
|
47
|
+
consequent = new Consequent(statementNode);
|
|
48
48
|
|
|
49
|
-
return
|
|
49
|
+
return consequent;
|
|
50
50
|
}
|
|
51
51
|
}
|
package/src/lemma.js
CHANGED
|
@@ -5,5 +5,5 @@ import AxiomLemmaTheoremConjecture from "./axiomLemmaTheoremConjecture";
|
|
|
5
5
|
export default class Lemma extends AxiomLemmaTheoremConjecture {
|
|
6
6
|
static fromJSONAndFileContext(json, fileContext) { return AxiomLemmaTheoremConjecture.fromJSONAndFileContext(Lemma,json, fileContext); }
|
|
7
7
|
|
|
8
|
-
static
|
|
8
|
+
static fromLabelsSuppositionsConsequentAndProofContext(labels, suppositions, consequent, proofContext) { return AxiomLemmaTheoremConjecture.fromLabelsSuppositionsConsequentAndProofContext(Lemma, labels, suppositions, consequent, proofContext); }
|
|
9
9
|
}
|
package/src/theorem.js
CHANGED
|
@@ -5,5 +5,5 @@ import AxiomLemmaTheoremConjecture from "./axiomLemmaTheoremConjecture";
|
|
|
5
5
|
export default class Theorem extends AxiomLemmaTheoremConjecture {
|
|
6
6
|
static fromJSONAndFileContext(json, fileContext) { return AxiomLemmaTheoremConjecture.fromJSONAndFileContext(Theorem, json, fileContext); }
|
|
7
7
|
|
|
8
|
-
static
|
|
8
|
+
static fromLabelsSuppositionsConsequentAndProofContext(labels, suppositions, consequent, proofContext) { return AxiomLemmaTheoremConjecture.fromLabelsSuppositionsConsequentAndProofContext(Theorem, labels, suppositions, consequent, proofContext); }
|
|
9
9
|
}
|
package/src/verify/axiom.js
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
import Axiom from "../axiom";
|
|
4
4
|
import ProofContext from "../context/proof";
|
|
5
5
|
import verifyLabels from "../verify/labels";
|
|
6
|
+
import verifyConsequent from "../verify/consequent";
|
|
6
7
|
import verifySupposition from "../verify/supposition";
|
|
7
|
-
import verifyConsequence from "../verify/consequence";
|
|
8
8
|
|
|
9
9
|
import { first } from "../utilities/array";
|
|
10
10
|
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
11
11
|
|
|
12
12
|
const labelNodesQuery = nodesQuery("/axiom/label"),
|
|
13
|
-
|
|
13
|
+
consequentNodeQuery = nodeQuery("/axiom/consequent!"),
|
|
14
14
|
suppositionsNodeQuery = nodesQuery("/axiom/supposition");
|
|
15
15
|
|
|
16
16
|
export default function verifyAxiom(axiomNode, fileContext) {
|
|
@@ -37,14 +37,14 @@ export default function verifyAxiom(axiomNode, fileContext) {
|
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
if (suppositionsVerified) {
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
if (
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
axiom = Axiom.
|
|
40
|
+
const consequents = [],
|
|
41
|
+
consequentNode = consequentNodeQuery(axiomNode),
|
|
42
|
+
consequentVerified = verifyConsequent(consequentNode, consequents, proofContext);
|
|
43
|
+
|
|
44
|
+
if (consequentVerified) {
|
|
45
|
+
const firstConsequent = first(consequents),
|
|
46
|
+
consequent = firstConsequent, ///
|
|
47
|
+
axiom = Axiom.fromLabelsSuppositionsConsequentAndProofContext(labels, suppositions, consequent, proofContext);
|
|
48
48
|
|
|
49
49
|
fileContext.addAxiom(axiom);
|
|
50
50
|
|
package/src/verify/conjecture.js
CHANGED
|
@@ -4,16 +4,15 @@ import Conjecture from "../conjecture";
|
|
|
4
4
|
import verifyProof from "../verify/proof";
|
|
5
5
|
import ProofContext from "../context/proof";
|
|
6
6
|
import verifyLabels from "../verify/labels";
|
|
7
|
+
import verifyConsequent from "./consequent";
|
|
7
8
|
import verifySupposition from "./supposition";
|
|
8
|
-
import verifyConsequence from "./consequence";
|
|
9
9
|
|
|
10
10
|
import { first } from "../utilities/array";
|
|
11
11
|
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
12
|
-
import proof from "../context/proof";
|
|
13
12
|
|
|
14
13
|
const proofNodeQuery = nodeQuery("/conjecture/proof!"),
|
|
15
14
|
labelNodesQuery = nodesQuery("/conjecture/label"),
|
|
16
|
-
|
|
15
|
+
consequentNodeQuery = nodeQuery("/conjecture/consequent!"),
|
|
17
16
|
suppositionsNodeQuery = nodesQuery("/conjecture/supposition");
|
|
18
17
|
|
|
19
18
|
export default function verifyConjecture(conjectureNode, fileContext) {
|
|
@@ -40,18 +39,18 @@ export default function verifyConjecture(conjectureNode, fileContext) {
|
|
|
40
39
|
});
|
|
41
40
|
|
|
42
41
|
if (suppositionsVerified) {
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
const consequents = [],
|
|
43
|
+
consequentNode = consequentNodeQuery(conjectureNode),
|
|
44
|
+
consequentVerified = verifyConsequent(consequentNode, consequents, proofContext);
|
|
46
45
|
|
|
47
|
-
if (
|
|
46
|
+
if (consequentVerified) {
|
|
48
47
|
const proofNode = proofNodeQuery(conjectureNode),
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
firstConsequent = first(consequents),
|
|
49
|
+
consequent = firstConsequent; ///
|
|
51
50
|
|
|
52
|
-
verifyProof(proofNode,
|
|
51
|
+
verifyProof(proofNode, consequent, proofContext);
|
|
53
52
|
|
|
54
|
-
const conjecture = Conjecture.
|
|
53
|
+
const conjecture = Conjecture.fromLabelsSuppositionsConsequentAndProofContext(labels, suppositions, consequent, proofContext);
|
|
55
54
|
|
|
56
55
|
fileContext.addConjecture(conjecture);
|
|
57
56
|
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import Consequent from "../consequent";
|
|
4
|
+
import verifyUnqualifiedStatement from "./statement/unqualified";
|
|
5
|
+
|
|
6
|
+
import { nodeQuery } from "../utilities/query";
|
|
7
|
+
|
|
8
|
+
const statementNodeQuery = nodeQuery("/unqualifiedStatement/statement!"),
|
|
9
|
+
unqualifiedStatementNodeQuery = nodeQuery("/consequent/unqualifiedStatement!");
|
|
10
|
+
|
|
11
|
+
export default function verifyConsequent(consequentNode, consequents, proofContext) {
|
|
12
|
+
let consequentVerified = false;
|
|
13
|
+
|
|
14
|
+
const consequentString = proofContext.nodeAsString(consequentNode);
|
|
15
|
+
|
|
16
|
+
proofContext.debug(`Verifying the '${consequentString}' consequent...`, consequentNode);
|
|
17
|
+
|
|
18
|
+
const derived = false,
|
|
19
|
+
assignments = [],
|
|
20
|
+
unqualifiedStatementNode = unqualifiedStatementNodeQuery(consequentNode),
|
|
21
|
+
unqualifiedStatementVerified = verifyUnqualifiedStatement(unqualifiedStatementNode, assignments, derived, proofContext);
|
|
22
|
+
|
|
23
|
+
if (unqualifiedStatementVerified) {
|
|
24
|
+
const statementNode = statementNodeQuery(unqualifiedStatementNode),
|
|
25
|
+
consequent = Consequent.fromStatementNode(statementNode);
|
|
26
|
+
|
|
27
|
+
consequents.push(consequent);
|
|
28
|
+
|
|
29
|
+
consequentVerified = true;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (consequentVerified) {
|
|
33
|
+
proofContext.info(`Verified the '${consequentString}' consequent.`, consequentNode);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return consequentVerified;
|
|
37
|
+
}
|
package/src/verify/lemma.js
CHANGED
|
@@ -4,8 +4,8 @@ import Lemma from "../lemma";
|
|
|
4
4
|
import verifyProof from "../verify/proof";
|
|
5
5
|
import ProofContext from "../context/proof";
|
|
6
6
|
import verifyLabels from "../verify/labels";
|
|
7
|
+
import verifyConsequent from "./consequent";
|
|
7
8
|
import verifySupposition from "./supposition";
|
|
8
|
-
import verifyConsequence from "./consequence";
|
|
9
9
|
|
|
10
10
|
import { first } from "../utilities/array";
|
|
11
11
|
import { EMPTY_STRING } from "../constants";
|
|
@@ -13,7 +13,7 @@ import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
|
13
13
|
|
|
14
14
|
const proofNodeQuery = nodeQuery("/lemma/proof!"),
|
|
15
15
|
labelNodesQuery = nodesQuery("/lemma/label"),
|
|
16
|
-
|
|
16
|
+
consequentNodeQuery = nodeQuery("/lemma/consequent!"),
|
|
17
17
|
suppositionsNodeQuery = nodesQuery("/lemma/supposition");
|
|
18
18
|
|
|
19
19
|
export default function verifyLemma(lemmaNode, fileContext) {
|
|
@@ -42,18 +42,18 @@ export default function verifyLemma(lemmaNode, fileContext) {
|
|
|
42
42
|
});
|
|
43
43
|
|
|
44
44
|
if (suppositionsVerified) {
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
const consequents = [],
|
|
46
|
+
consequentNode = consequentNodeQuery(lemmaNode),
|
|
47
|
+
consequentVerified = verifyConsequent(consequentNode, consequents, proofContext);
|
|
48
48
|
|
|
49
|
-
if (
|
|
49
|
+
if (consequentVerified) {
|
|
50
50
|
const proofNode = proofNodeQuery(lemmaNode),
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
proofVerified = verifyProof(proofNode,
|
|
51
|
+
firstConsequent = first(consequents),
|
|
52
|
+
consequent = firstConsequent, ///
|
|
53
|
+
proofVerified = verifyProof(proofNode, consequent, proofContext);
|
|
54
54
|
|
|
55
55
|
if (proofVerified) {
|
|
56
|
-
const lemma = Lemma.
|
|
56
|
+
const lemma = Lemma.fromLabelsSuppositionsConsequentAndProofContext(labels, suppositions, consequent, proofContext);
|
|
57
57
|
|
|
58
58
|
fileContext.addLemma(lemma);
|
|
59
59
|
|
package/src/verify/theorem.js
CHANGED
|
@@ -4,16 +4,15 @@ import Theorem from "../theorem";
|
|
|
4
4
|
import verifyProof from "../verify/proof";
|
|
5
5
|
import ProofContext from "../context/proof";
|
|
6
6
|
import verifyLabels from "../verify/labels";
|
|
7
|
+
import verifyConsequent from "./consequent";
|
|
7
8
|
import verifySupposition from "./supposition";
|
|
8
|
-
import verifyConsequence from "./consequence";
|
|
9
9
|
|
|
10
10
|
import { first } from "../utilities/array";
|
|
11
11
|
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
12
|
-
import proof from "../context/proof";
|
|
13
12
|
|
|
14
13
|
const proofNodeQuery = nodeQuery("/theorem/proof!"),
|
|
15
14
|
labelNodesQuery = nodesQuery("/theorem/label"),
|
|
16
|
-
|
|
15
|
+
consequentNodeQuery = nodeQuery("/theorem/consequent!"),
|
|
17
16
|
suppositionsNodeQuery = nodesQuery("/theorem/supposition");
|
|
18
17
|
|
|
19
18
|
export default function verifyTheorem(theoremNode, fileContext) {
|
|
@@ -40,18 +39,18 @@ export default function verifyTheorem(theoremNode, fileContext) {
|
|
|
40
39
|
});
|
|
41
40
|
|
|
42
41
|
if (suppositionsVerified) {
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
const consequents = [],
|
|
43
|
+
consequentNode = consequentNodeQuery(theoremNode),
|
|
44
|
+
consequentVerified = verifyConsequent(consequentNode, consequents, proofContext);
|
|
46
45
|
|
|
47
|
-
if (
|
|
46
|
+
if (consequentVerified) {
|
|
48
47
|
const proofNode = proofNodeQuery(theoremNode),
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
proofVerified = verifyProof(proofNode,
|
|
48
|
+
firstConsequent = first(consequents),
|
|
49
|
+
consequent = firstConsequent, ///
|
|
50
|
+
proofVerified = verifyProof(proofNode, consequent, proofContext);
|
|
52
51
|
|
|
53
52
|
if (proofVerified) {
|
|
54
|
-
const theorem = Theorem.
|
|
53
|
+
const theorem = Theorem.fromLabelsSuppositionsConsequentAndProofContext(labels, suppositions, consequent, proofContext);
|
|
55
54
|
|
|
56
55
|
fileContext.addTheorem(theorem);
|
|
57
56
|
|