occam-verify-cli 0.0.867 → 0.0.868
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/context/file.js +22 -22
- package/lib/mixins/context.js +16 -16
- package/lib/utilities/name.js +2 -9
- package/lib/verify/axiom.js +2 -2
- package/lib/verify/conjecture.js +2 -2
- package/lib/verify/lemma.js +2 -2
- package/lib/verify/metaLemma.js +2 -2
- package/lib/verify/metastatement/qualified.js +3 -3
- package/lib/verify/metatheorem.js +2 -2
- package/lib/verify/rule.js +2 -2
- package/lib/verify/statement/qualified.js +29 -29
- package/lib/verify/theorem.js +2 -2
- package/package.json +4 -4
- package/src/context/file.js +14 -21
- package/src/mixins/context.js +10 -10
- package/src/utilities/name.js +1 -10
- package/src/verify/axiom.js +1 -1
- package/src/verify/conjecture.js +1 -1
- package/src/verify/lemma.js +1 -1
- package/src/verify/metaLemma.js +1 -1
- package/src/verify/metastatement/qualified.js +3 -3
- package/src/verify/metatheorem.js +1 -1
- package/src/verify/rule.js +1 -1
- package/src/verify/statement/qualified.js +34 -34
- package/src/verify/theorem.js +1 -1
package/src/mixins/context.js
CHANGED
|
@@ -30,15 +30,15 @@ function findTypeByTypeNode(labelNode) { return this.context.findTypeByTypeNode(
|
|
|
30
30
|
|
|
31
31
|
function findLabelByLabelNode(labelNode) { return this.context.findLabelByLabelNode(labelNode); }
|
|
32
32
|
|
|
33
|
-
function
|
|
33
|
+
function findRuleByLabelNode(labelNode) { return this.context.findRuleByLabelNode(labelNode); }
|
|
34
34
|
|
|
35
|
-
function
|
|
35
|
+
function findAxiomByLabelNode(labelNode) { return this.context.findAxiomByLabelNode(labelNode); }
|
|
36
36
|
|
|
37
|
-
function
|
|
37
|
+
function findLemmaByLabelNode(labelNode) { return this.context.findLemmaByLabelNode(labelNode); }
|
|
38
38
|
|
|
39
|
-
function
|
|
39
|
+
function findTheoremByLabelNode(labelNode) { return this.context.findTheoremByLabelNode(labelNode); }
|
|
40
40
|
|
|
41
|
-
function
|
|
41
|
+
function findConjectureByLabelNode(labelNode) { return this.context.findConjectureByLabelNode(labelNode); }
|
|
42
42
|
|
|
43
43
|
function isTypePresentByTypeName(typeName) { return this.context.isTypePresentByTypeName(typeName); }
|
|
44
44
|
|
|
@@ -66,11 +66,11 @@ const contextMixins = {
|
|
|
66
66
|
findTypeByTypeName,
|
|
67
67
|
findTypeByTypeNode,
|
|
68
68
|
findLabelByLabelNode,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
69
|
+
findRuleByLabelNode,
|
|
70
|
+
findAxiomByLabelNode,
|
|
71
|
+
findLemmaByLabelNode,
|
|
72
|
+
findTheoremByLabelNode,
|
|
73
|
+
findConjectureByLabelNode,
|
|
74
74
|
isTypePresentByTypeName,
|
|
75
75
|
isTypePresentByTypeNode,
|
|
76
76
|
isLabelPresentByLabelNode,
|
package/src/utilities/name.js
CHANGED
|
@@ -4,8 +4,7 @@ import { nodeQuery } from "../utilities/query";
|
|
|
4
4
|
|
|
5
5
|
const typeTerminalNodeQuery = nodeQuery("/type/@type"),
|
|
6
6
|
metaTypeTerminalNodeQuery = nodeQuery("/metaType/@meta-type"),
|
|
7
|
-
labelNameTerminalNodeQuery = nodeQuery("/label/@name")
|
|
8
|
-
referenceNameTerminalNodeQuery = nodeQuery("/reference/@name");
|
|
7
|
+
labelNameTerminalNodeQuery = nodeQuery("/label/@name");
|
|
9
8
|
|
|
10
9
|
export function typeNameFromTypeNode(typeNode) {
|
|
11
10
|
let typeName = null;
|
|
@@ -40,11 +39,3 @@ export function metaTypeNameFromMetaTypeNode(metaTypeNode) {
|
|
|
40
39
|
|
|
41
40
|
return metaTypeName;
|
|
42
41
|
}
|
|
43
|
-
|
|
44
|
-
export function referenceNameFromReferenceNode(referenceNode) {
|
|
45
|
-
const referenceNameTerminalNode = referenceNameTerminalNodeQuery(referenceNode),
|
|
46
|
-
referenceNameTerminalNodeContent = referenceNameTerminalNode.getContent(),
|
|
47
|
-
referenceName = referenceNameTerminalNodeContent; ///
|
|
48
|
-
|
|
49
|
-
return referenceName;
|
|
50
|
-
}
|
package/src/verify/axiom.js
CHANGED
|
@@ -9,7 +9,7 @@ import verifySuppositions from "../verify/suppositions";
|
|
|
9
9
|
import { first } from "../utilities/array";
|
|
10
10
|
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
11
11
|
|
|
12
|
-
const labelNodesQuery = nodesQuery("/axiom//
|
|
12
|
+
const labelNodesQuery = nodesQuery("/axiom//reference/label"),
|
|
13
13
|
consequentNodeQuery = nodeQuery("/axiom/consequent!"),
|
|
14
14
|
suppositionsNodeQuery = nodesQuery("/axiom/supposition");
|
|
15
15
|
|
package/src/verify/conjecture.js
CHANGED
|
@@ -11,7 +11,7 @@ import { first } from "../utilities/array";
|
|
|
11
11
|
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
12
12
|
|
|
13
13
|
const proofNodeQuery = nodeQuery("/conjecture/proof!"),
|
|
14
|
-
labelNodesQuery = nodesQuery("/conjecture//
|
|
14
|
+
labelNodesQuery = nodesQuery("/conjecture//reference/label"),
|
|
15
15
|
consequentNodeQuery = nodeQuery("/conjecture/consequent!"),
|
|
16
16
|
suppositionsNodeQuery = nodesQuery("/conjecture/supposition");
|
|
17
17
|
|
package/src/verify/lemma.js
CHANGED
|
@@ -12,7 +12,7 @@ import { EMPTY_STRING } from "../constants";
|
|
|
12
12
|
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
13
13
|
|
|
14
14
|
const proofNodeQuery = nodeQuery("/lemma/proof!"),
|
|
15
|
-
labelNodesQuery = nodesQuery("/lemma//
|
|
15
|
+
labelNodesQuery = nodesQuery("/lemma//reference/label"),
|
|
16
16
|
consequentNodeQuery = nodeQuery("/lemma/consequent!"),
|
|
17
17
|
suppositionsNodeQuery = nodesQuery("/lemma/supposition");
|
|
18
18
|
|
package/src/verify/metaLemma.js
CHANGED
|
@@ -11,7 +11,7 @@ import { first } from "../utilities/array";
|
|
|
11
11
|
import { EMPTY_STRING } from "../constants";
|
|
12
12
|
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
13
13
|
|
|
14
|
-
const labelNodesQuery = nodesQuery("/metaLemma//
|
|
14
|
+
const labelNodesQuery = nodesQuery("/metaLemma//reference/label"),
|
|
15
15
|
metaproofNodeQuery = nodeQuery("/metaLemma/metaproof!"),
|
|
16
16
|
metaConsequentNodeQuery = nodeQuery("/metaLemma/metaConsequent!"),
|
|
17
17
|
metaSuppositionsNodeQuery = nodesQuery("/metaLemma/metaSupposition");
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { nodeQuery } from "../../utilities/query";
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const labelNodeQuery = nodeQuery("/qualifiedMetastatement/qualification!/label!"),
|
|
6
6
|
metastatementNodeQuery = nodeQuery("/qualifiedMetastatement/metastatement!");
|
|
7
7
|
|
|
8
8
|
export default function verifyQualifiedMetastatement(qualifiedMetastatementNode, assignments, derived, localMetaContext) {
|
|
@@ -16,8 +16,8 @@ export default function verifyQualifiedMetastatement(qualifiedMetastatementNode,
|
|
|
16
16
|
|
|
17
17
|
localMetaContext.trace(`Verifying the '${metastatementString}' qualified metastatement...`, qualifiedMetastatementNode);
|
|
18
18
|
|
|
19
|
-
const
|
|
20
|
-
rule = localMetaContext.
|
|
19
|
+
const labelNode = labelNodeQuery(qualifiedMetastatementNode),
|
|
20
|
+
rule = localMetaContext.findRuleByLabelNode(labelNode);
|
|
21
21
|
|
|
22
22
|
if (rule !== null) {
|
|
23
23
|
const ruleMatchesMetastatement = rule.matchMetastatement(metastatementNode, metastatementLocalMetaContext);
|
|
@@ -10,7 +10,7 @@ import verifyMetaSuppositions from "../verify/metaSuppositions";
|
|
|
10
10
|
import { first } from "../utilities/array";
|
|
11
11
|
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
12
12
|
|
|
13
|
-
const labelNodesQuery = nodesQuery("/metatheorem//
|
|
13
|
+
const labelNodesQuery = nodesQuery("/metatheorem//reference/label"),
|
|
14
14
|
metaproofNodeQuery = nodeQuery("/metatheorem/metaproof!"),
|
|
15
15
|
metaConsequentNodeQuery = nodeQuery("/metatheorem/metaConsequent!"),
|
|
16
16
|
metaSuppositionsNodeQuery = nodesQuery("/metatheorem/metaSupposition");
|
package/src/verify/rule.js
CHANGED
|
@@ -10,7 +10,7 @@ import verifyConclusion from "../verify/conclusion";
|
|
|
10
10
|
import { first } from "../utilities/array";
|
|
11
11
|
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
12
12
|
|
|
13
|
-
const labelNodesQuery = nodesQuery("/rule//
|
|
13
|
+
const labelNodesQuery = nodesQuery("/rule//reference/label"),
|
|
14
14
|
premisesNodeQuery = nodesQuery("/rule/premise"),
|
|
15
15
|
ruleProofNodeQuery = nodeQuery("/rule/ruleProof!"),
|
|
16
16
|
conclusionNodeQuery = nodeQuery("/rule/conclusion!");
|
|
@@ -5,8 +5,8 @@ import verifyTypeAssertion from "../typeAssertion";
|
|
|
5
5
|
|
|
6
6
|
import { nodeQuery } from "../../utilities/query";
|
|
7
7
|
|
|
8
|
-
const
|
|
9
|
-
|
|
8
|
+
const labelNodeQuery = nodeQuery("/qualifiedStatement/qualification!/label!"),
|
|
9
|
+
equalityNodeQuery = nodeQuery("/qualifiedStatement/statement/equality!"),
|
|
10
10
|
statementNodeQuery = nodeQuery("/qualifiedStatement/statement!"),
|
|
11
11
|
typeAssertionNodeQuery = nodeQuery("/qualifiedStatement/statement/typeAssertion!");
|
|
12
12
|
|
|
@@ -20,7 +20,7 @@ export default function verifyQualifiedStatement(qualifiedStatementNode, assignm
|
|
|
20
20
|
|
|
21
21
|
localContext.trace(`Verifying the '${qualifiedStatementString}' qualified statement...`, qualifiedStatementNode);
|
|
22
22
|
|
|
23
|
-
const
|
|
23
|
+
const labelNode = labelNodeQuery(qualifiedStatementNode),
|
|
24
24
|
verifyQualifiedStatementFunctions = [
|
|
25
25
|
verifyQualifiedStatementAAgainstRule,
|
|
26
26
|
verifyQualifiedStatementAAgainstAxiom,
|
|
@@ -30,7 +30,7 @@ export default function verifyQualifiedStatement(qualifiedStatementNode, assignm
|
|
|
30
30
|
];
|
|
31
31
|
|
|
32
32
|
qualifiedStatementVerified = verifyQualifiedStatementFunctions.some((verifyQualifiedStatementFunction) => { ///
|
|
33
|
-
const qualifiedStatementVerified = verifyQualifiedStatementFunction(qualifiedStatementNode,
|
|
33
|
+
const qualifiedStatementVerified = verifyQualifiedStatementFunction(qualifiedStatementNode, labelNode, localContext);
|
|
34
34
|
|
|
35
35
|
if (qualifiedStatementVerified) {
|
|
36
36
|
return true;
|
|
@@ -66,125 +66,125 @@ export default function verifyQualifiedStatement(qualifiedStatementNode, assignm
|
|
|
66
66
|
return qualifiedStatementVerified;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
function verifyQualifiedStatementAAgainstRule(qualifiedStatementNode,
|
|
69
|
+
function verifyQualifiedStatementAAgainstRule(qualifiedStatementNode, labelNode, localContext) {
|
|
70
70
|
let qualifiedStatementVerifiedAgainstRule = false;
|
|
71
71
|
|
|
72
|
-
const rule = localContext.
|
|
72
|
+
const rule = localContext.findRuleByLabelNode(labelNode);
|
|
73
73
|
|
|
74
74
|
if (rule !== null) {
|
|
75
|
-
const
|
|
76
|
-
|
|
75
|
+
const labelString = localContext.nodeAsString(labelNode),
|
|
76
|
+
statementNode = statementNodeQuery(qualifiedStatementNode),
|
|
77
77
|
statementLocalContext = localContext, ///
|
|
78
78
|
qualifiedStatementString = localContext.nodeAsString(qualifiedStatementNode);
|
|
79
79
|
|
|
80
|
-
localContext.trace(`Verifying the '${qualifiedStatementString}' qualified statement against the '${
|
|
80
|
+
localContext.trace(`Verifying the '${qualifiedStatementString}' qualified statement against the '${labelString}' rule...`, statementNode);
|
|
81
81
|
|
|
82
82
|
const ruleMatchesStatement = rule.matchStatement(statementNode, statementLocalContext);
|
|
83
83
|
|
|
84
84
|
qualifiedStatementVerifiedAgainstRule = ruleMatchesStatement; ///
|
|
85
85
|
|
|
86
86
|
if (qualifiedStatementVerifiedAgainstRule) {
|
|
87
|
-
localContext.debug(`...verified the '${qualifiedStatementString}' qualified statement against the '${
|
|
87
|
+
localContext.debug(`...verified the '${qualifiedStatementString}' qualified statement against the '${labelString}' rule.`, statementNode);
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
return qualifiedStatementVerifiedAgainstRule;
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
function verifyQualifiedStatementAAgainstAxiom(qualifiedStatementNode,
|
|
94
|
+
function verifyQualifiedStatementAAgainstAxiom(qualifiedStatementNode, labelNode, localContext) {
|
|
95
95
|
let qualifiedStatementVerifiedAgainstAxiom = false;
|
|
96
96
|
|
|
97
|
-
const axiom = localContext.
|
|
97
|
+
const axiom = localContext.findAxiomByLabelNode(labelNode);
|
|
98
98
|
|
|
99
99
|
if (axiom !== null) {
|
|
100
|
-
const
|
|
101
|
-
|
|
100
|
+
const labelString = localContext.nodeAsString(labelNode),
|
|
101
|
+
statementNode = statementNodeQuery(qualifiedStatementNode),
|
|
102
102
|
statementLocalContext = localContext, ///
|
|
103
103
|
qualifiedStatementString = localContext.nodeAsString(qualifiedStatementNode);
|
|
104
104
|
|
|
105
|
-
localContext.trace(`Verifying the '${qualifiedStatementString}' qualified statement against the '${
|
|
105
|
+
localContext.trace(`Verifying the '${qualifiedStatementString}' qualified statement against the '${labelString}' axiom...`, statementNode);
|
|
106
106
|
|
|
107
107
|
const axiomMatchesStatement = axiom.matchStatement(statementNode, statementLocalContext);
|
|
108
108
|
|
|
109
109
|
qualifiedStatementVerifiedAgainstAxiom = axiomMatchesStatement; ///
|
|
110
110
|
|
|
111
111
|
if (qualifiedStatementVerifiedAgainstAxiom) {
|
|
112
|
-
localContext.debug(`...verified the '${qualifiedStatementString}' qualified statement against the '${
|
|
112
|
+
localContext.debug(`...verified the '${qualifiedStatementString}' qualified statement against the '${labelString}' axiom.`, statementNode);
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
return qualifiedStatementVerifiedAgainstAxiom;
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
function verifyQualifiedStatementAAgainstLemma(qualifiedStatementNode,
|
|
119
|
+
function verifyQualifiedStatementAAgainstLemma(qualifiedStatementNode, labelNode, localContext) {
|
|
120
120
|
let qualifiedStatementVerifiedAgainstLemma = false;
|
|
121
121
|
|
|
122
|
-
const lemma = localContext.
|
|
122
|
+
const lemma = localContext.findLemmaByLabelNode(labelNode);
|
|
123
123
|
|
|
124
124
|
if (lemma !== null) {
|
|
125
|
-
const
|
|
126
|
-
|
|
125
|
+
const labelString = localContext.nodeAsString(labelNode),
|
|
126
|
+
statementNode = statementNodeQuery(qualifiedStatementNode),
|
|
127
127
|
statementLocalContext = localContext, ///
|
|
128
128
|
qualifiedStatementString = localContext.nodeAsString(qualifiedStatementNode);
|
|
129
129
|
|
|
130
|
-
localContext.trace(`Verifying the '${qualifiedStatementString}' qualified statement against the '${
|
|
130
|
+
localContext.trace(`Verifying the '${qualifiedStatementString}' qualified statement against the '${labelString}' lemma...`, statementNode);
|
|
131
131
|
|
|
132
132
|
const lemmaMatchesStatement = lemma.matchStatement(statementNode, statementLocalContext);
|
|
133
133
|
|
|
134
134
|
qualifiedStatementVerifiedAgainstLemma = lemmaMatchesStatement; ///
|
|
135
135
|
|
|
136
136
|
if (qualifiedStatementVerifiedAgainstLemma) {
|
|
137
|
-
localContext.debug(`...verified the '${qualifiedStatementString}' qualified statement against the '${
|
|
137
|
+
localContext.debug(`...verified the '${qualifiedStatementString}' qualified statement against the '${labelString}' lemma.`, statementNode);
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
return qualifiedStatementVerifiedAgainstLemma;
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
function verifyQualifiedStatementAAgainstTheorem(qualifiedStatementNode,
|
|
144
|
+
function verifyQualifiedStatementAAgainstTheorem(qualifiedStatementNode, labelNode, localContext) {
|
|
145
145
|
let qualifiedStatementVerifiedAgainstTheorem = false;
|
|
146
146
|
|
|
147
|
-
const theorem = localContext.
|
|
147
|
+
const theorem = localContext.findTheoremByLabelNode(labelNode);
|
|
148
148
|
|
|
149
149
|
if (theorem !== null) {
|
|
150
|
-
const
|
|
151
|
-
|
|
150
|
+
const labelString = localContext.nodeAsString(labelNode),
|
|
151
|
+
statementNode = statementNodeQuery(qualifiedStatementNode),
|
|
152
152
|
statementLocalContext = localContext, ///
|
|
153
153
|
qualifiedStatementString = localContext.nodeAsString(qualifiedStatementNode);
|
|
154
154
|
|
|
155
|
-
localContext.trace(`Verifying the '${qualifiedStatementString}' qualified statement against the '${
|
|
155
|
+
localContext.trace(`Verifying the '${qualifiedStatementString}' qualified statement against the '${labelString}' theorem...`, statementNode);
|
|
156
156
|
|
|
157
157
|
const theoremMatchesStatement = theorem.matchStatement(statementNode, statementLocalContext);
|
|
158
158
|
|
|
159
159
|
qualifiedStatementVerifiedAgainstTheorem = theoremMatchesStatement; ///
|
|
160
160
|
|
|
161
161
|
if (qualifiedStatementVerifiedAgainstTheorem) {
|
|
162
|
-
localContext.debug(`...verified the '${qualifiedStatementString}' qualified statement against the '${
|
|
162
|
+
localContext.debug(`...verified the '${qualifiedStatementString}' qualified statement against the '${labelString}' theorem.`, statementNode);
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
return qualifiedStatementVerifiedAgainstTheorem;
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
-
function verifyQualifiedStatementAAgainstConjecture(qualifiedStatementNode,
|
|
169
|
+
function verifyQualifiedStatementAAgainstConjecture(qualifiedStatementNode, labelNode, localContext) {
|
|
170
170
|
let qualifiedStatementVerifiedAgainstConjecture = false;
|
|
171
171
|
|
|
172
|
-
const conjecture = localContext.
|
|
172
|
+
const conjecture = localContext.findConjectureByLabelNode(labelNode);
|
|
173
173
|
|
|
174
174
|
if (conjecture !== null) {
|
|
175
|
-
const
|
|
176
|
-
|
|
175
|
+
const labelString = localContext.nodeAsString(labelNode),
|
|
176
|
+
statementNode = statementNodeQuery(qualifiedStatementNode),
|
|
177
177
|
statementLocalContext = localContext, ///
|
|
178
178
|
qualifiedStatementString = localContext.nodeAsString(qualifiedStatementNode);
|
|
179
179
|
|
|
180
|
-
localContext.trace(`Verifying the '${qualifiedStatementString}' qualified statement against the '${
|
|
180
|
+
localContext.trace(`Verifying the '${qualifiedStatementString}' qualified statement against the '${labelString}' conjecture...`, statementNode);
|
|
181
181
|
|
|
182
182
|
const conjectureMatchesStatement = conjecture.matchStatement(statementNode, statementLocalContext);
|
|
183
183
|
|
|
184
184
|
qualifiedStatementVerifiedAgainstConjecture = conjectureMatchesStatement; ///
|
|
185
185
|
|
|
186
186
|
if (qualifiedStatementVerifiedAgainstConjecture) {
|
|
187
|
-
localContext.debug(`...verified the '${qualifiedStatementString}' qualified statement against the '${
|
|
187
|
+
localContext.debug(`...verified the '${qualifiedStatementString}' qualified statement against the '${labelString}' conjecture.`, statementNode);
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
190
|
|
package/src/verify/theorem.js
CHANGED
|
@@ -11,7 +11,7 @@ import { first } from "../utilities/array";
|
|
|
11
11
|
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
12
12
|
|
|
13
13
|
const proofNodeQuery = nodeQuery("/theorem/proof!"),
|
|
14
|
-
labelNodesQuery = nodesQuery("/theorem//
|
|
14
|
+
labelNodesQuery = nodesQuery("/theorem//reference/label"),
|
|
15
15
|
consequentNodeQuery = nodeQuery("/theorem/consequent!"),
|
|
16
16
|
suppositionsNodeQuery = nodesQuery("/theorem/supposition");
|
|
17
17
|
|