occam-verify-cli 0.0.881 → 0.0.882
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/axiomLemmaTheoremConjecture.js +4 -10
- package/lib/context/file.js +40 -41
- package/lib/context/localMeta.js +27 -2
- package/lib/declaration.js +90 -0
- package/lib/frame.js +52 -13
- package/lib/judgement.js +28 -9
- package/lib/label.js +3 -3
- package/lib/metaLemmaMetatheorem.js +4 -4
- package/lib/mixins/context.js +32 -24
- package/lib/premise.js +2 -26
- package/lib/rule.js +4 -10
- package/lib/supposition.js +1 -53
- package/lib/verify/declaration.js +34 -16
- package/lib/verify/frame.js +47 -6
- package/lib/verify/judgement.js +63 -47
- package/lib/verify/label.js +8 -8
- package/lib/verify/labels.js +4 -4
- package/lib/verify/metastatement/qualified.js +12 -8
- package/lib/verify/statement/qualified.js +6 -6
- package/package.json +2 -2
- package/src/axiomLemmaTheoremConjecture.js +3 -12
- package/src/context/file.js +32 -33
- package/src/context/localMeta.js +32 -1
- package/src/declaration.js +58 -0
- package/src/frame.js +52 -10
- package/src/judgement.js +16 -6
- package/src/label.js +2 -2
- package/src/metaLemmaMetatheorem.js +3 -3
- package/src/mixins/context.js +21 -15
- package/src/premise.js +0 -41
- package/src/rule.js +3 -12
- package/src/supposition.js +0 -45
- package/src/verify/declaration.js +47 -20
- package/src/verify/frame.js +66 -5
- package/src/verify/judgement.js +101 -50
- package/src/verify/label.js +7 -8
- package/src/verify/labels.js +4 -3
- package/src/verify/metastatement/qualified.js +14 -11
- package/src/verify/statement/qualified.js +10 -10
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import Declaration from "../declaration"
|
|
3
4
|
import referenceMetaType from "../metaType/reference";
|
|
4
5
|
import metastatementNodeVerifier from "../verifier/node/metastatement";
|
|
5
6
|
|
|
@@ -8,7 +9,7 @@ import { nodeQuery } from "../utilities/query";
|
|
|
8
9
|
const metavariableNodeQuery = nodeQuery("/declaration/metavariable!"),
|
|
9
10
|
metastatementNodeQuery = nodeQuery("/declaration/metastatement!");
|
|
10
11
|
|
|
11
|
-
export default function verifyDeclaration(declarationNode,
|
|
12
|
+
export default function verifyDeclaration(declarationNode, declarations, localMetaContext) {
|
|
12
13
|
let declarationVerified = false;
|
|
13
14
|
|
|
14
15
|
const declarationString = localMetaContext.nodeAsString(declarationNode);
|
|
@@ -16,31 +17,26 @@ export default function verifyDeclaration(declarationNode, derived, localMetaCon
|
|
|
16
17
|
localMetaContext.trace(`Verifying the '${declarationString}' declaration...`, declarationNode);
|
|
17
18
|
|
|
18
19
|
const metavariableNode = metavariableNodeQuery(declarationNode),
|
|
19
|
-
|
|
20
|
+
metavariableVerified = verifyMetavariable(metavariableNode, localMetaContext);
|
|
20
21
|
|
|
21
|
-
if (
|
|
22
|
-
const
|
|
22
|
+
if (metavariableVerified) {
|
|
23
|
+
const metastatementNode = metastatementNodeQuery(declarationNode);
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
const { verifyMetastatement } = metastatementNodeVerifier,
|
|
26
|
+
derived = false,
|
|
27
|
+
assignments = [],
|
|
28
|
+
metastatementVerified = verifyMetastatement(metastatementNode, assignments, derived, localMetaContext, () => {
|
|
29
|
+
const verifiedAhead = true;
|
|
26
30
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
assignments = [],
|
|
30
|
-
metastatementVerified = verifyMetastatement(metastatementNode, assignments, derived, localMetaContext, () => {
|
|
31
|
-
const verifiedAhead = true;
|
|
31
|
+
return verifiedAhead;
|
|
32
|
+
});
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
if (metastatementVerified) {
|
|
35
|
+
const declaration = Declaration.fromMetavariableNodeAndMetastatementNode(metavariableNode, metastatementNode);
|
|
35
36
|
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
} else {
|
|
39
|
-
const referenceMetaTypeName = referenceMetaType.getName(),
|
|
40
|
-
metavariableString = localMetaContext.nodeAsString(metavariableNode),
|
|
41
|
-
metaTypeString = metaType.asString();
|
|
37
|
+
declarations.push(declaration);
|
|
42
38
|
|
|
43
|
-
|
|
39
|
+
declarationVerified = true;
|
|
44
40
|
}
|
|
45
41
|
}
|
|
46
42
|
|
|
@@ -49,4 +45,35 @@ export default function verifyDeclaration(declarationNode, derived, localMetaCon
|
|
|
49
45
|
}
|
|
50
46
|
|
|
51
47
|
return declarationVerified;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function verifyMetavariable(metavariableNode, localMetaContext) {
|
|
51
|
+
let metavariableVerified = false;
|
|
52
|
+
|
|
53
|
+
const metavariableString = localMetaContext.nodeAsString(metavariableNode);
|
|
54
|
+
|
|
55
|
+
localMetaContext.trace(`Verifying the '${metavariableString}' metavariable...`, metavariableNode);
|
|
56
|
+
|
|
57
|
+
const metavariable = localMetaContext.findMetavariableByMetavariableNode(metavariableNode, localMetaContext);
|
|
58
|
+
|
|
59
|
+
if (metavariable !== null) {
|
|
60
|
+
const metaType = metavariable.getMetaType();
|
|
61
|
+
|
|
62
|
+
if (metaType === referenceMetaType) {
|
|
63
|
+
metavariableVerified = true;
|
|
64
|
+
} else {
|
|
65
|
+
const referenceMetaTypeName = referenceMetaType.getName(),
|
|
66
|
+
metaTypeString = metaType.asString();
|
|
67
|
+
|
|
68
|
+
localMetaContext.debug(`The '${metavariableString}' metavariable's meta-type is '${metaTypeString}' when it should be '${referenceMetaTypeName}'.`, metavariableNode);
|
|
69
|
+
}
|
|
70
|
+
} else {
|
|
71
|
+
localMetaContext.debug(`The '${metavariableString}' metavariable is not present'.`, metavariableNode);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (metavariableVerified) {
|
|
75
|
+
localMetaContext.debug(`...verified the '${metavariableString}' metavariable.`, metavariableNode);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return metavariableVerified;
|
|
52
79
|
}
|
package/src/verify/frame.js
CHANGED
|
@@ -1,30 +1,91 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import Frame from "../frame";
|
|
4
|
+
import frameMetaType from "../metaType/frame";
|
|
3
5
|
import verifyDeclaration from "../verify/declaration";
|
|
4
6
|
|
|
7
|
+
import { push } from "../utilities/array";
|
|
5
8
|
import { nodesQuery } from "../utilities/query";
|
|
6
9
|
|
|
7
|
-
const declarationNodesQuery = nodesQuery("/frame/declaration")
|
|
10
|
+
const declarationNodesQuery = nodesQuery("/frame/declaration"),
|
|
11
|
+
metavariableNodesQuery = nodesQuery("/frame/metavariable");
|
|
8
12
|
|
|
9
|
-
export default function verifyFrame(frameNode, derived, localMetaContext) {
|
|
13
|
+
export default function verifyFrame(frameNode, frames, derived, localMetaContext) {
|
|
10
14
|
let frameVerified;
|
|
11
15
|
|
|
12
16
|
const frameString = localMetaContext.nodeAsString(frameNode);
|
|
13
17
|
|
|
14
18
|
localMetaContext.trace(`Verifying the '${frameString}' frame...`, frameNode);
|
|
15
19
|
|
|
16
|
-
const
|
|
20
|
+
const declarations = [],
|
|
21
|
+
declarationNodes = declarationNodesQuery(frameNode),
|
|
17
22
|
declarationsVerified = declarationNodes.every((declarationNode) => {
|
|
18
|
-
const declarationVerified = verifyDeclaration(declarationNode,
|
|
23
|
+
const declarationVerified = verifyDeclaration(declarationNode, declarations, localMetaContext);
|
|
19
24
|
|
|
20
25
|
return declarationVerified;
|
|
21
26
|
});
|
|
22
27
|
|
|
23
|
-
|
|
28
|
+
if (declarationsVerified) {
|
|
29
|
+
const metavariableNodes = metavariableNodesQuery(frameNode),
|
|
30
|
+
metavariablesVerified = metavariableNodes.every((metavariableNode) => {
|
|
31
|
+
const metavariableVerified = verifyMetavariable(metavariableNode, declarations, localMetaContext);
|
|
32
|
+
|
|
33
|
+
return metavariableVerified;
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
if (metavariablesVerified) {
|
|
37
|
+
const frame = Frame.fromDeclarations(declarations);
|
|
38
|
+
|
|
39
|
+
frames.push(frame);
|
|
40
|
+
|
|
41
|
+
frameVerified = true;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
24
44
|
|
|
25
45
|
if (frameVerified) {
|
|
26
46
|
localMetaContext.debug(`...verified the '${frameString}' frame.`, frameNode);
|
|
27
47
|
}
|
|
28
48
|
|
|
29
49
|
return frameVerified;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function verifyMetavariable(metavariableNode, declarations, localMetaContext) {
|
|
53
|
+
let metavariableVerified = false;
|
|
54
|
+
|
|
55
|
+
const metavariableString = localMetaContext.nodeAsString(metavariableNode);
|
|
56
|
+
|
|
57
|
+
localMetaContext.trace(`Verifying the '${metavariableString}' metavariable...`, metavariableNode);
|
|
58
|
+
|
|
59
|
+
const metavariable = localMetaContext.findMetavariableByMetavariableNode(metavariableNode, localMetaContext);
|
|
60
|
+
|
|
61
|
+
if (metavariable !== null) {
|
|
62
|
+
const metaType = metavariable.getMetaType();
|
|
63
|
+
|
|
64
|
+
if (metaType === frameMetaType) {
|
|
65
|
+
const judgement = localMetaContext.findJudgementByMetavariableNode(metavariableNode);
|
|
66
|
+
|
|
67
|
+
if (judgement !== null) {
|
|
68
|
+
const judgementDeclarations = judgement.getDeclarations();
|
|
69
|
+
|
|
70
|
+
push(declarations, judgementDeclarations);
|
|
71
|
+
|
|
72
|
+
metavariableVerified = true;
|
|
73
|
+
} else {
|
|
74
|
+
localMetaContext.debug(`There is no judgement for the '${metavariableString}' metavariable.`, metavariableNode);
|
|
75
|
+
}
|
|
76
|
+
} else {
|
|
77
|
+
const frameMetaTypeName = frameMetaType.getName(),
|
|
78
|
+
metaTypeString = metaType.asString();
|
|
79
|
+
|
|
80
|
+
localMetaContext.debug(`The '${metavariableString}' metavariable's meta-type is '${metaTypeString}' when it should be '${frameMetaTypeName}'.`, metavariableNode);
|
|
81
|
+
}
|
|
82
|
+
} else {
|
|
83
|
+
localMetaContext.debug(`The '${metavariableString}' metavariable is not present'.`, metavariableNode);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (metavariableVerified) {
|
|
87
|
+
localMetaContext.debug(`...verified the '${metavariableString}' metavariable.`, metavariableNode);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return metavariableVerified;
|
|
30
91
|
}
|
package/src/verify/judgement.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import Judgement from "../judgement";
|
|
3
4
|
import verifyFrame from "../verify/frame";
|
|
4
5
|
import frameMetaType from "../metaType/frame";
|
|
6
|
+
import JudgementAssignment from "../assignment/judgement";
|
|
5
7
|
|
|
8
|
+
import { first } from "../utilities/array";
|
|
6
9
|
import { nodeQuery } from "../utilities/query";
|
|
7
10
|
|
|
8
11
|
const frameNodeQuery = nodeQuery("/judgement/frame!"),
|
|
@@ -39,38 +42,59 @@ function verifyDerivedJudgement(judgementNode, assignments, derived, localMetaCo
|
|
|
39
42
|
let derivedJudgementVerified = false;
|
|
40
43
|
|
|
41
44
|
if (derived) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
45
|
+
const judgementString = localMetaContext.nodeAsString(judgementNode);
|
|
46
|
+
|
|
47
|
+
localMetaContext.trace(`Verifying the '${judgementString}' derived judgement...`, judgementNode);
|
|
48
|
+
|
|
49
|
+
const metavariableNode = metavariableNodeQuery(judgementNode),
|
|
50
|
+
metavariableVerified = verifyMetavariable(metavariableNode, localMetaContext);
|
|
51
|
+
|
|
52
|
+
if (metavariableVerified) {
|
|
53
|
+
const judgement = localMetaContext.findJudgementByMetavariableNode(metavariableNode);
|
|
54
|
+
|
|
55
|
+
if (judgement !== null) {
|
|
56
|
+
const frames = [],
|
|
57
|
+
frameNode = frameNodeQuery(judgementNode),
|
|
58
|
+
frameVerified = verifyFrame(frameNode, frames, derived, localMetaContext);
|
|
59
|
+
|
|
60
|
+
if (frameVerified) {
|
|
61
|
+
const firstFrame = first(frames),
|
|
62
|
+
frame = firstFrame, ///
|
|
63
|
+
frameSingular = frame.isSingular();
|
|
64
|
+
|
|
65
|
+
if (frameSingular) {
|
|
66
|
+
const declaration = frame.getDeclaration(),
|
|
67
|
+
metavariableNode = declaration.getMetavariableNode(),
|
|
68
|
+
metaLemma = localMetaContext.findMetaLemmaByMetavariableNode(metavariableNode),
|
|
69
|
+
metatheorem = localMetaContext.findMetatheoremByMetavariableNode(metavariableNode),
|
|
70
|
+
metaLemmaMetatheorem = (metaLemma || metatheorem); ///
|
|
71
|
+
|
|
72
|
+
if (metaLemmaMetatheorem !== null) {
|
|
73
|
+
const judgementMatchesMetaLemmaMetatheorem = judgement.matchMetaLemmaOrMetaTheorem(metaLemmaMetatheorem),
|
|
74
|
+
declarationMatchesMetaLemmaMetatheorem = declaration.matchMetaLemmaOrMetaTheorem(metaLemmaMetatheorem);
|
|
75
|
+
|
|
76
|
+
derivedJudgementVerified = (judgementMatchesMetaLemmaMetatheorem && declarationMatchesMetaLemmaMetatheorem);
|
|
77
|
+
} else {
|
|
78
|
+
const metavariableString = localMetaContext.nodeAsString(metavariableNode);
|
|
79
|
+
|
|
80
|
+
localMetaContext.debug(`There are no meta-lemmas or metatheorems corresponding to the '${metavariableString}' metavariable.`, judgementNode);
|
|
81
|
+
}
|
|
82
|
+
} else {
|
|
83
|
+
const frameString = localMetaContext.nodeAsString(frameNode);
|
|
84
|
+
|
|
85
|
+
localMetaContext.debug(`The '${frameString}' is not singular.`, judgementNode);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
} else {
|
|
89
|
+
const metavariableString = localMetaContext.nodeAsString(metavariableNode);
|
|
90
|
+
|
|
91
|
+
localMetaContext.debug(`There is no judgement present for the '${metavariableString}' metavariable.`, judgementNode);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (derivedJudgementVerified) {
|
|
96
|
+
localMetaContext.debug(`...verified the '${judgementString}' derived judgement.`, judgementNode);
|
|
97
|
+
}
|
|
74
98
|
}
|
|
75
99
|
|
|
76
100
|
return derivedJudgementVerified;
|
|
@@ -85,27 +109,23 @@ function verifyStatedJudgement(judgementNode, assignments, derived, localMetaCon
|
|
|
85
109
|
localMetaContext.trace(`Verifying the '${judgementString}' stated judgement...`, judgementNode);
|
|
86
110
|
|
|
87
111
|
const metavariableNode = metavariableNodeQuery(judgementNode),
|
|
88
|
-
|
|
112
|
+
metavariableVerified = verifyMetavariable(metavariableNode, localMetaContext);
|
|
89
113
|
|
|
90
|
-
if (
|
|
91
|
-
const
|
|
114
|
+
if (metavariableVerified) {
|
|
115
|
+
const frames = [],
|
|
116
|
+
frameNode = frameNodeQuery(judgementNode),
|
|
117
|
+
frameVerified = verifyFrame(frameNode, frames, derived, localMetaContext);
|
|
92
118
|
|
|
93
|
-
if (
|
|
94
|
-
const
|
|
119
|
+
if (frameVerified) {
|
|
120
|
+
const firstFrame = first(frames),
|
|
121
|
+
frame = firstFrame, ///
|
|
122
|
+
judgement = Judgement.fromJudgementNodeFrameAndMetavariableNode(judgementNode, frame, metavariableNode),
|
|
123
|
+
judgementAssignment = JudgementAssignment.fromJudgement(judgement),
|
|
124
|
+
assignment = judgementAssignment;
|
|
95
125
|
|
|
96
|
-
|
|
97
|
-
const frameVerified = verifyFrame(frameNode, derived, localMetaContext);
|
|
98
|
-
|
|
99
|
-
statedJudgementVerified = frameVerified; ///
|
|
100
|
-
} else {
|
|
101
|
-
localMetaContext.debug(`The right hand side of the '${judgementString}' judgement must be a frame.`, judgementNode);
|
|
102
|
-
}
|
|
103
|
-
} else {
|
|
104
|
-
const frameMetaTypeName = frameMetaType.getName(),
|
|
105
|
-
metavariableString = localMetaContext.nodeAsString(metavariableNode),
|
|
106
|
-
metaTypeString = metaType.asString();
|
|
126
|
+
assignments.push(assignment);
|
|
107
127
|
|
|
108
|
-
|
|
128
|
+
statedJudgementVerified = true;
|
|
109
129
|
}
|
|
110
130
|
}
|
|
111
131
|
|
|
@@ -115,4 +135,35 @@ function verifyStatedJudgement(judgementNode, assignments, derived, localMetaCon
|
|
|
115
135
|
}
|
|
116
136
|
|
|
117
137
|
return statedJudgementVerified;
|
|
118
|
-
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function verifyMetavariable(metavariableNode, localMetaContext) {
|
|
141
|
+
let metavariableVerified = false;
|
|
142
|
+
|
|
143
|
+
const metavariableString = localMetaContext.nodeAsString(metavariableNode);
|
|
144
|
+
|
|
145
|
+
localMetaContext.trace(`Verifying the '${metavariableString}' metavariable...`, metavariableNode);
|
|
146
|
+
|
|
147
|
+
const metavariable = localMetaContext.findMetavariableByMetavariableNode(metavariableNode, localMetaContext);
|
|
148
|
+
|
|
149
|
+
if (metavariable !== null) {
|
|
150
|
+
const metaType = metavariable.getMetaType();
|
|
151
|
+
|
|
152
|
+
if (metaType === frameMetaType) {
|
|
153
|
+
metavariableVerified = true;
|
|
154
|
+
} else {
|
|
155
|
+
const frameMetaTypeName = frameMetaType.getName(),
|
|
156
|
+
metaTypeString = metaType.asString();
|
|
157
|
+
|
|
158
|
+
localMetaContext.debug(`The '${metavariableString}' metavariable's meta-type is '${metaTypeString}' when it should be '${frameMetaTypeName}'.`, metavariableNode);
|
|
159
|
+
}
|
|
160
|
+
} else {
|
|
161
|
+
localMetaContext.debug(`The '${metavariableString}' metavariable is not present'.`, metavariableNode);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (metavariableVerified) {
|
|
165
|
+
localMetaContext.debug(`...verified the '${metavariableString}' metavariable.`, metavariableNode);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return metavariableVerified;
|
|
169
|
+
}
|
package/src/verify/label.js
CHANGED
|
@@ -2,20 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
import Label from "../label";
|
|
4
4
|
|
|
5
|
-
export default function verifyLabel(
|
|
5
|
+
export default function verifyLabel(metavariableNode, labels, fileContext) {
|
|
6
6
|
let labelVerified = false;
|
|
7
7
|
|
|
8
|
-
const labelMetavariableString = fileContext.nodeAsString(
|
|
8
|
+
const labelMetavariableString = fileContext.nodeAsString(metavariableNode);
|
|
9
9
|
|
|
10
|
-
fileContext.trace(`Verifying the '${labelMetavariableString}' label...`,
|
|
10
|
+
fileContext.trace(`Verifying the '${labelMetavariableString}' label...`, metavariableNode);
|
|
11
11
|
|
|
12
|
-
const labelPresent = fileContext.
|
|
12
|
+
const labelPresent = fileContext.isLabelPresentByMetavariableNode(metavariableNode);
|
|
13
13
|
|
|
14
14
|
if (labelPresent) {
|
|
15
|
-
fileContext.debug(`The '${labelMetavariableString}' label is already present.`,
|
|
15
|
+
fileContext.debug(`The '${labelMetavariableString}' label is already present.`, metavariableNode);
|
|
16
16
|
} else {
|
|
17
|
-
const
|
|
18
|
-
label = Label.fromMetavariableNode(metavariableNode);
|
|
17
|
+
const label = Label.fromMetavariableNode(metavariableNode);
|
|
19
18
|
|
|
20
19
|
labels.push(label);
|
|
21
20
|
|
|
@@ -23,7 +22,7 @@ export default function verifyLabel(labelsMetavariableNode, labels, fileContext)
|
|
|
23
22
|
}
|
|
24
23
|
|
|
25
24
|
if (labelVerified) {
|
|
26
|
-
fileContext.debug(`...verified the '${labelMetavariableString}' label.`,
|
|
25
|
+
fileContext.debug(`...verified the '${labelMetavariableString}' label.`, metavariableNode);
|
|
27
26
|
}
|
|
28
27
|
|
|
29
28
|
return labelVerified;
|
package/src/verify/labels.js
CHANGED
|
@@ -12,10 +12,11 @@ export default function verifyLabels(labelsNode, labels, fileContext) {
|
|
|
12
12
|
if (labelsNode === null) {
|
|
13
13
|
labelsVerified = true;
|
|
14
14
|
} else {
|
|
15
|
-
const labelsMetavariableNodes = labelsMetavariableNodesQuery(labelsNode)
|
|
15
|
+
const labelsMetavariableNodes = labelsMetavariableNodesQuery(labelsNode),
|
|
16
|
+
metavariableNodes = labelsMetavariableNodes; ///
|
|
16
17
|
|
|
17
|
-
labelsVerified =
|
|
18
|
-
const labelVerified = verifyLabel(
|
|
18
|
+
labelsVerified = metavariableNodes.every((metavariableNode) => {
|
|
19
|
+
const labelVerified = verifyLabel(metavariableNode, labels, fileContext);
|
|
19
20
|
|
|
20
21
|
if (labelVerified) {
|
|
21
22
|
return true;
|
|
@@ -5,8 +5,8 @@ import verifyMetavariableAgainstMetastatement from "../../verify/metavariableAga
|
|
|
5
5
|
|
|
6
6
|
import { nodeQuery } from "../../utilities/query";
|
|
7
7
|
|
|
8
|
-
const
|
|
9
|
-
|
|
8
|
+
const metavariableNodeQuery = nodeQuery("/qualifiedMetastatement/reference!/metavariable!"),
|
|
9
|
+
metastatementNodeQuery = nodeQuery("/qualifiedMetastatement/metastatement!");
|
|
10
10
|
|
|
11
11
|
export default function verifyQualifiedMetastatement(qualifiedMetastatementNode, substitutions, assignments, derived, localMetaContext) {
|
|
12
12
|
let qualifiedMetastatementVerified = false;
|
|
@@ -19,18 +19,21 @@ export default function verifyQualifiedMetastatement(qualifiedMetastatementNode,
|
|
|
19
19
|
|
|
20
20
|
localMetaContext.trace(`Verifying the '${metastatementString}' qualified metastatement...`, qualifiedMetastatementNode);
|
|
21
21
|
|
|
22
|
-
const
|
|
23
|
-
labelMetavariableNode = referenceMetavariableNode, ///
|
|
24
|
-
rule = localMetaContext.findRuleByLabelMetavariableNode(labelMetavariableNode);
|
|
22
|
+
const metavariableNode = metavariableNodeQuery(qualifiedMetastatementNode);
|
|
25
23
|
|
|
26
|
-
if (
|
|
27
|
-
const
|
|
24
|
+
if (!qualifiedMetastatementVerified) {
|
|
25
|
+
const rule = localMetaContext.findRuleByMetavariableNode(metavariableNode);
|
|
28
26
|
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
if (rule !== null) {
|
|
28
|
+
const ruleMatchesMetastatement = rule.matchMetastatement(metastatementNode, metastatementLocalMetaContext);
|
|
29
|
+
|
|
30
|
+
qualifiedMetastatementVerified = ruleMatchesMetastatement; ///
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (!qualifiedMetastatementVerified) {
|
|
31
35
|
if (substitutions !== null) {
|
|
32
|
-
const
|
|
33
|
-
metavariablePresent = localMetaContext.isMetavariablePresentByMetavariableNode(metavariableNode, localMetaContext);
|
|
36
|
+
const metavariablePresent = localMetaContext.isMetavariablePresentByMetavariableNode(metavariableNode, localMetaContext);
|
|
34
37
|
|
|
35
38
|
if (metavariablePresent) {
|
|
36
39
|
const metastatementVerified = verifyMetastatement(metastatementNode, assignments, derived, localMetaContext, () => {
|
|
@@ -69,8 +69,8 @@ export default function verifyQualifiedStatement(qualifiedStatementNode, assignm
|
|
|
69
69
|
function verifyQualifiedStatementAAgainstRule(qualifiedStatementNode, referenceMetavariableNode, localContext) {
|
|
70
70
|
let qualifiedStatementVerifiedAgainstRule = false;
|
|
71
71
|
|
|
72
|
-
const
|
|
73
|
-
rule = localContext.
|
|
72
|
+
const metavariableNode = referenceMetavariableNode, ///
|
|
73
|
+
rule = localContext.findRuleByMetavariableNode(metavariableNode);
|
|
74
74
|
|
|
75
75
|
if (rule !== null) {
|
|
76
76
|
const referenceMetavariableString = localContext.nodeAsString(referenceMetavariableNode),
|
|
@@ -95,8 +95,8 @@ function verifyQualifiedStatementAAgainstRule(qualifiedStatementNode, referenceM
|
|
|
95
95
|
function verifyQualifiedStatementAAgainstAxiom(qualifiedStatementNode, referenceMetavariableNode, localContext) {
|
|
96
96
|
let qualifiedStatementVerifiedAgainstAxiom = false;
|
|
97
97
|
|
|
98
|
-
const
|
|
99
|
-
axiom = localContext.
|
|
98
|
+
const metavariableNode = referenceMetavariableNode, ///
|
|
99
|
+
axiom = localContext.findAxiomByMetavariableNode(metavariableNode);
|
|
100
100
|
|
|
101
101
|
if (axiom !== null) {
|
|
102
102
|
const referenceMetavariableString = localContext.nodeAsString(referenceMetavariableNode),
|
|
@@ -121,8 +121,8 @@ function verifyQualifiedStatementAAgainstAxiom(qualifiedStatementNode, reference
|
|
|
121
121
|
function verifyQualifiedStatementAAgainstLemma(qualifiedStatementNode, referenceMetavariableNode, localContext) {
|
|
122
122
|
let qualifiedStatementVerifiedAgainstLemma = false;
|
|
123
123
|
|
|
124
|
-
const
|
|
125
|
-
lemma = localContext.
|
|
124
|
+
const metavariableNode = referenceMetavariableNode, ///
|
|
125
|
+
lemma = localContext.findLemmaByMetavariableNode(metavariableNode);
|
|
126
126
|
|
|
127
127
|
if (lemma !== null) {
|
|
128
128
|
const referenceMetavariableString = localContext.nodeAsString(referenceMetavariableNode),
|
|
@@ -147,8 +147,8 @@ function verifyQualifiedStatementAAgainstLemma(qualifiedStatementNode, reference
|
|
|
147
147
|
function verifyQualifiedStatementAAgainstTheorem(qualifiedStatementNode, referenceMetavariableNode, localContext) {
|
|
148
148
|
let qualifiedStatementVerifiedAgainstTheorem = false;
|
|
149
149
|
|
|
150
|
-
const
|
|
151
|
-
theorem = localContext.
|
|
150
|
+
const metavariableNode = referenceMetavariableNode, ///
|
|
151
|
+
theorem = localContext.findTheoremByMetavariableNode(metavariableNode);
|
|
152
152
|
|
|
153
153
|
if (theorem !== null) {
|
|
154
154
|
const referenceMetavariableString = localContext.nodeAsString(referenceMetavariableNode),
|
|
@@ -173,8 +173,8 @@ function verifyQualifiedStatementAAgainstTheorem(qualifiedStatementNode, referen
|
|
|
173
173
|
function verifyQualifiedStatementAAgainstConjecture(qualifiedStatementNode, referenceMetavariableNode, localContext) {
|
|
174
174
|
let qualifiedStatementVerifiedAgainstConjecture = false;
|
|
175
175
|
|
|
176
|
-
const
|
|
177
|
-
conjecture = localContext.
|
|
176
|
+
const metavariableNode = referenceMetavariableNode, ///
|
|
177
|
+
conjecture = localContext.findConjectureByMetavariableNode(metavariableNode);
|
|
178
178
|
|
|
179
179
|
if (conjecture !== null) {
|
|
180
180
|
const referenceMetavariableString = localContext.nodeAsString(referenceMetavariableNode),
|