occam-verify-cli 0.0.1087 → 0.0.1089

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.
Files changed (45) hide show
  1. package/lib/assertion/contained.js +3 -3
  2. package/lib/assertion/defined.js +4 -4
  3. package/lib/axiom.js +33 -81
  4. package/lib/conjecture.js +33 -85
  5. package/lib/context/file.js +43 -1
  6. package/lib/context/local.js +38 -2
  7. package/lib/declaration.js +7 -41
  8. package/lib/frame.js +49 -26
  9. package/lib/judgement.js +28 -16
  10. package/lib/lemma.js +34 -85
  11. package/lib/metaLemma.js +35 -102
  12. package/lib/metatheorem.js +34 -60
  13. package/lib/mixins/statement/qualified/unify.js +21 -63
  14. package/lib/mixins/statement/verify.js +2 -17
  15. package/lib/proofStep.js +6 -6
  16. package/lib/reference.js +14 -4
  17. package/lib/statement.js +8 -8
  18. package/lib/term.js +8 -8
  19. package/lib/theorem.js +34 -85
  20. package/lib/topLevelAssertion.js +62 -5
  21. package/lib/utilities/json.js +2 -2
  22. package/lib/variable.js +2 -2
  23. package/package.json +1 -1
  24. package/src/assertion/contained.js +4 -4
  25. package/src/assertion/defined.js +4 -4
  26. package/src/axiom.js +10 -63
  27. package/src/conjecture.js +10 -72
  28. package/src/context/file.js +42 -0
  29. package/src/context/local.js +13 -2
  30. package/src/declaration.js +7 -55
  31. package/src/frame.js +58 -31
  32. package/src/judgement.js +40 -20
  33. package/src/lemma.js +12 -72
  34. package/src/metaLemma.js +12 -81
  35. package/src/metatheorem.js +10 -78
  36. package/src/mixins/statement/qualified/unify.js +37 -104
  37. package/src/mixins/statement/verify.js +0 -27
  38. package/src/proofStep.js +7 -5
  39. package/src/reference.js +25 -4
  40. package/src/statement.js +8 -8
  41. package/src/term.js +8 -8
  42. package/src/theorem.js +10 -71
  43. package/src/topLevelAssertion.js +86 -4
  44. package/src/utilities/json.js +1 -1
  45. package/src/variable.js +1 -1
@@ -100,71 +100,23 @@ class Declaration {
100
100
 
101
101
  localContext.trace(`Verifying the '${declarationString}' declaration...`);
102
102
 
103
- if (!verified) {
104
- const verifiedAtMetaLevel = this.verifyAtMetaLevel(assignments, stated, localContext);
105
-
106
- verified = verifiedAtMetaLevel; ///
107
- }
108
-
109
- if (!verified) {
110
- const verifiedAtIntrinsicLevel = this.verifyAtIntrinsicLevel(assignments, stated, localContext);
111
-
112
- verified = verifiedAtIntrinsicLevel; ///
113
- }
114
-
115
- if (verified) {
116
- localContext.debug(`...verified the '${declarationString}' declaration.`);
117
- }
118
-
119
- return verified;
120
- }
121
-
122
- verifyAtMetaLevel(assignments, stated, localContext) {
123
- let verifiedAtMetaLevel;
124
-
125
- const declarationString = this.string; ///
126
-
127
- localContext.trace(`Verifying the '${declarationString}' declaration at meta level...`);
128
-
129
103
  stated = true; ///
130
104
 
131
105
  assignments = null; ///
132
106
 
133
- const referenceVerified = this.reference.verify(localContext),
134
- statementVerified = this.statement.verify(assignments, stated, localContext);
107
+ const referenceVerified = this.reference.verify(localContext);
135
108
 
136
- verifiedAtMetaLevel = (referenceVerified && statementVerified);
109
+ if (referenceVerified) {
110
+ const statementVerified = this.statement.verify(assignments, stated, localContext);
137
111
 
138
- if (verifiedAtMetaLevel) {
139
- localContext.debug(`...verified the '${declarationString}' declaration at meta level.`);
112
+ verified = statementVerified; ///
140
113
  }
141
114
 
142
- return verifiedAtMetaLevel;
143
- }
144
-
145
- verifyAtIntrinsicLevel(assignments, stated, localContext) {
146
- let verifiedAtIntrinsicLevel = false;
147
-
148
- const declarationString = this.string; ///
149
-
150
- localContext.trace(`Verifying the '${declarationString}' declaration at intrinsic level...`);
151
-
152
- const lemma = localContext.findLemmaByReference(this.reference),
153
- theorem = localContext.findTheoremByReference(this.reference),
154
- lemmaOrTheorem = (lemma || theorem);
155
-
156
- if (lemmaOrTheorem !== null) {
157
- const lemmaOrTheoremStatement = lemmaOrTheorem.getStatement(),
158
- lemmaOrTheoremStatementEqualToStatement = lemmaOrTheoremStatement.isEqualTo(this.statement);
159
-
160
- verifiedAtIntrinsicLevel = lemmaOrTheoremStatementEqualToStatement; ///
161
- }
162
-
163
- if (verifiedAtIntrinsicLevel) {
164
- localContext.debug(`...verified the '${declarationString}' declaration at intrinsic level.`);
115
+ if (verified) {
116
+ localContext.debug(`...verified the '${declarationString}' declaration.`);
165
117
  }
166
118
 
167
- return verifiedAtIntrinsicLevel;
119
+ return verified;
168
120
  }
169
121
 
170
122
  static fromDeclarationNode(declarationNode, localContext) {
package/src/frame.js CHANGED
@@ -121,11 +121,11 @@ class Frame {
121
121
  }
122
122
 
123
123
  unifyMetaLemmaOrMetatheorem(metaLemmaMetatheorem, localContext) {
124
- let metaLemmaOrMetaTheoremUnified;
124
+ let metaLemmaMetatheoremUnified;
125
125
 
126
126
  const metaLemmaMetatheoremString = metaLemmaMetatheorem.getString();
127
127
 
128
- localContext.trace(`Unifying the '${metaLemmaMetatheoremString}' metatheorem or meta-lemma...`);
128
+ localContext.trace(`Unifying the '${metaLemmaMetatheoremString}' meta-lemma or metatheorem...`);
129
129
 
130
130
  const substitutions = metaLemmaMetatheorem.getSubstitutions(),
131
131
  substitutionsUnified = substitutions.everySubstitution((substitution) => {
@@ -136,45 +136,73 @@ class Frame {
136
136
  }
137
137
  });
138
138
 
139
- metaLemmaOrMetaTheoremUnified = substitutionsUnified; ///
139
+ metaLemmaMetatheoremUnified = substitutionsUnified; ///
140
140
 
141
- if (metaLemmaOrMetaTheoremUnified) {
142
- localContext.debug(`...unified the '${metaLemmaMetatheoremString}' metatheorem or meta-lemma.`);
141
+ if (metaLemmaMetatheoremUnified) {
142
+ localContext.debug(`...unified the '${metaLemmaMetatheoremString}' meta-lemma or metatheorem.`);
143
143
  }
144
144
 
145
- return metaLemmaOrMetaTheoremUnified;
145
+ return metaLemmaMetatheoremUnified;
146
+ }
147
+
148
+ unifyAxiomLemmaTheoremOrConjecture(axiomLemmaTheoremOrConjecture, localContext) {
149
+ let axiomLemmaTheoremOrConjectureUnified;
150
+
151
+ const axiomLemmaTheoremStringOrConjecture = axiomLemmaTheoremOrConjecture.getString();
152
+
153
+ localContext.trace(`Unifying the '${axiomLemmaTheoremStringOrConjecture}' axiom, lemma, theorem or conjecture...`);
154
+
155
+ const substitutions = axiomLemmaTheoremOrConjecture.getSubstitutions(),
156
+ substitutionsUnified = substitutions.everySubstitution((substitution) => {
157
+ const substitutionUnified = this.unifySubstitution(substitution, localContext);
158
+
159
+ if (substitutionUnified) {
160
+ return true;
161
+ }
162
+ });
163
+
164
+ axiomLemmaTheoremOrConjectureUnified = substitutionsUnified; ///
165
+
166
+ if (axiomLemmaTheoremOrConjectureUnified) {
167
+ localContext.debug(`...unified the '${axiomLemmaTheoremStringOrConjecture}' axiom, lemma, theorem or conjecture.`);
168
+ }
169
+
170
+ return axiomLemmaTheoremOrConjectureUnified;
146
171
  }
147
172
 
148
173
  verify(assignments, stated, localContext) {
149
- let verified;
174
+ let verified = false;
150
175
 
151
176
  const frameString = this.string; ///
152
177
 
153
178
  localContext.trace(`Verifying the '${frameString}' frame...`);
154
179
 
155
180
  const declarationsVerified = this.declarations.every((declaration) => {
156
- const declarationVerified = declaration.verify(assignments, stated, localContext);
181
+ const declarationVerified = declaration.verify(assignments, stated, localContext);
157
182
 
158
- return declarationVerified;
159
- }),
160
- metavariablesVerified = this.metavariables.every((metavariable) => {
161
- const metavariableVerified = metavariable.verify(localContext);
183
+ return declarationVerified;
184
+ });
162
185
 
163
- return metavariableVerified;
164
- });
186
+ if (declarationsVerified) {
187
+ const metavariablesVerified = this.metavariables.every((metavariable) => {
188
+ const metavariableVerified = metavariable.verify(localContext);
165
189
 
166
- if (declarationsVerified && metavariablesVerified) {
167
- let verifiedWhenStated = false,
168
- verifiedWhenDerived = false;
190
+ return metavariableVerified;
191
+ });
169
192
 
170
- if (stated) {
171
- verifiedWhenStated = this.verifyWhenStated(assignments, localContext);
172
- } else {
173
- verifiedWhenDerived = this.verifyWhenDerived(assignments, localContext);
174
- }
193
+ if (metavariablesVerified) {
194
+ let verifiedWhenStated = false,
195
+ verifiedWhenDerived = false;
196
+
197
+ if (stated) {
198
+ verifiedWhenStated = this.verifyWhenStated(assignments, localContext);
199
+ } else {
200
+ verifiedWhenDerived = this.verifyWhenDerived(assignments, localContext);
201
+ }
175
202
 
176
- if (verifiedWhenStated || verifiedWhenDerived) {
177
- verified = true;
203
+ if (verifiedWhenStated || verifiedWhenDerived) {
204
+ verified = true;
205
+ }
178
206
  }
179
207
  }
180
208
 
@@ -194,19 +222,18 @@ class Frame {
194
222
 
195
223
  const declarationsLength = this.declarations.length;
196
224
 
197
- if (declarationsLength === 0) {
225
+ if (declarationsLength > 0) {
226
+ localContext.trace(`The '${frameString}' stated frame cannot have declarations.`);
227
+ } else {
198
228
  const metavariablesLength = this.metavariables.length;
199
229
 
200
- if (metavariablesLength === 1) {
201
- verifiedWhenStated = true;
202
- } else {
230
+ if (metavariablesLength > 1) {
203
231
  localContext.trace(`The '${frameString}' stated frame cannot have more than one metavariable.`);
232
+ } else {
233
+ verifiedWhenStated = true;
204
234
  }
205
- } else {
206
- localContext.trace(`The '${frameString}' stated frame cannot have declarations.`);
207
235
  }
208
236
 
209
-
210
237
  if (verifiedWhenStated) {
211
238
  localContext.debug(`...verified the '${frameString}' frame when stated.`);
212
239
  }
package/src/judgement.js CHANGED
@@ -38,21 +38,24 @@ class Judgement {
38
38
 
39
39
  localContext.trace(`Verifying the '${judgementString}' judgement...`);
40
40
 
41
- const frameVerified = this.frame.verify(assignments, stated, localContext),
42
- declarationVerified = this.declaration.verify(assignments, stated, localContext);
41
+ const frameVerified = this.frame.verify(assignments, stated, localContext);
43
42
 
44
- if (frameVerified && declarationVerified) {
45
- let verifiedWhenStated = false,
46
- verifiedWhenDerived = false;
43
+ if (frameVerified) {
44
+ const declarationVerified = this.declaration.verify(assignments, stated, localContext);
47
45
 
48
- if (stated) {
49
- verifiedWhenStated = this.verifyWhenStated(assignments, localContext);
50
- } else {
51
- verifiedWhenDerived = this.verifyWhenDerived(assignments, localContext);
52
- }
46
+ if (declarationVerified) {
47
+ let verifiedWhenStated = false,
48
+ verifiedWhenDerived = false;
49
+
50
+ if (stated) {
51
+ verifiedWhenStated = this.verifyWhenStated(assignments, localContext);
52
+ } else {
53
+ verifiedWhenDerived = this.verifyWhenDerived(assignments, localContext);
54
+ }
53
55
 
54
- if (verifiedWhenStated || verifiedWhenDerived) {
55
- verified = true;
56
+ if (verifiedWhenStated || verifiedWhenDerived) {
57
+ verified = true;
58
+ }
56
59
  }
57
60
  }
58
61
 
@@ -88,21 +91,38 @@ class Judgement {
88
91
  }
89
92
 
90
93
  verifyWhenDerived(assignments, localContext) {
91
- let verifiedWhenDerived;
94
+ let verifiedWhenDerived = false;
92
95
 
93
96
  const judgementString = this.string; ///
94
97
 
95
98
  localContext.trace(`Verifying the '${judgementString}' judgement when derived...`);
96
99
 
97
- const reference = this.declaration.getReference(),
98
- metaLemma = localContext.findMetaLemmaByReference(reference),
99
- metatheorem = localContext.findMetatheoremByReference(reference),
100
- metaLemmaMetatheorem = (metaLemma || metatheorem); ///
100
+ if (!verifiedWhenDerived) {
101
+ const reference = this.declaration.getReference(),
102
+ metaLemma = localContext.findMetaLemmaByReference(reference),
103
+ metatheorem = localContext.findMetatheoremByReference(reference),
104
+ metaLemmaMetatheorem = (metaLemma || metatheorem); ///
105
+
106
+ if (metaLemmaMetatheorem !== null) {
107
+ const metaLemmaMetatheoremUnified = this.frame.unifyMetaLemmaOrMetatheorem(metaLemmaMetatheorem, localContext);
108
+
109
+ verifiedWhenDerived = metaLemmaMetatheoremUnified; ///
110
+ }
111
+ }
101
112
 
102
- if (metaLemmaMetatheorem !== null) {
103
- const metaLemmaMetatheoremUnified = this.frame.unifyMetaLemmaOrMetatheorem(metaLemmaMetatheorem, localContext);
113
+ if (!verifiedWhenDerived) {
114
+ const reference = this.declaration.getReference(),
115
+ axiom = localContext.findAxiomByReference(reference),
116
+ lemma = localContext.findLemmaByReference(reference),
117
+ theorem = localContext.findTheoremByReference(reference),
118
+ conjecture = localContext.findConjectureByReference(reference),
119
+ axiomLemmaTheoremOrConjecture = (axiom || lemma || theorem || conjecture);
104
120
 
105
- verifiedWhenDerived = metaLemmaMetatheoremUnified; ///
121
+ if (axiomLemmaTheoremOrConjecture !== null) {
122
+ const axiomLemmaTheoremOrConjectureUnified = this.frame.unifyAxiomLemmaTheoremOrConjecture(axiomLemmaTheoremOrConjecture, localContext);
123
+
124
+ verifiedWhenDerived = axiomLemmaTheoremOrConjectureUnified; ///
125
+ }
106
126
  }
107
127
 
108
128
  if (verifiedWhenDerived) {
package/src/lemma.js CHANGED
@@ -1,97 +1,37 @@
1
1
  "use strict";
2
2
 
3
3
  import shim from "./shim";
4
- import LocalContext from "./context/local";
5
4
  import TopLevelAssertion from "./topLevelAssertion";
6
5
 
7
6
  import { EMPTY_STRING } from "./constants";
8
- import { stringFromLabels } from "./topLevelAssertion";
9
- import { nodeQuery, nodesQuery } from "./utilities/query";
10
-
11
- const proofNodeQuery = nodeQuery("/lemma/proof"),
12
- labelNodesQuery = nodesQuery("/lemma/label"),
13
- consequentNodeQuery = nodeQuery("/lemma/consequent"),
14
- suppositionNodesQuery = nodesQuery("/lemma/supposition");
15
7
 
16
8
  class Lemma extends TopLevelAssertion {
17
9
  verify() {
18
- let verified = false;
10
+ let verified;
19
11
 
20
- const lemmaString = this.string; ///
12
+ const fileContext = this.getFileContext(),
13
+ lemmaString = this.string; ///
21
14
 
22
15
  (lemmaString === EMPTY_STRING) ?
23
- this.fileContext.trace(`Verifying a lemma...`) :
24
- this.fileContext.trace(`Verifying the '${lemmaString}' lemma...`);
25
-
26
- const labelsVerifiedWhenDeclared = this.labels.every((label) => {
27
- const labelVVerifiedWhenDeclared = label.verifyWhenDeclared(this.fileContext);
28
-
29
- if (labelVVerifiedWhenDeclared) {
30
- return true;
31
- }
32
- });
33
-
34
- if (labelsVerifiedWhenDeclared) {
35
- const localContext = LocalContext.fromFileContext(this.fileContext),
36
- suppositionsVerified = this.suppositions.every((supposition) => {
37
- const suppositionVerified = supposition.verify(localContext);
38
-
39
- if (suppositionVerified) {
40
- return true;
41
- }
42
- });
43
-
44
- if (suppositionsVerified) {
45
- const consequentVerified = this.consequent.verify(localContext);
46
-
47
- if (consequentVerified) {
48
- const { Substitutions } = shim,
49
- substitutions = Substitutions.fromNothing(),
50
- proofVerified = this.proof.verify(substitutions, this.consequent, localContext);
16
+ fileContext.trace(`Verifying a lemma...`) :
17
+ fileContext.trace(`Verifying the '${lemmaString}' lemma...`);
51
18
 
52
- if (proofVerified) {
53
- const lemma = this; ///
19
+ verified = super.verify();
54
20
 
55
- this.fileContext.addLemma(lemma);
21
+ if (verified) {
22
+ const lemma = this; ///
56
23
 
57
- verified = true;
58
- }
59
- }
60
- }
61
- }
24
+ fileContext.addLemma(lemma);
62
25
 
63
- if (verified) {
64
26
  (lemmaString === EMPTY_STRING) ?
65
- this.fileContext.debug(`...verified a lemma.`) :
66
- this.fileContext.debug(`...verified the '${lemmaString}' lemma.`);
27
+ fileContext.debug(`...verified a lemma.`) :
28
+ fileContext.debug(`...verified the '${lemmaString}' lemma.`);
67
29
  }
68
30
 
69
31
  return verified;
70
32
  }
71
33
 
72
- static fromLemmaNode(lemmaNode, fileContext) {
73
- const { Label, Proof, Supposition, Consequent } = shim,
74
- proofNode = proofNodeQuery(lemmaNode),
75
- labelNodes = labelNodesQuery(lemmaNode),
76
- consequentNode = consequentNodeQuery(lemmaNode),
77
- suppositionNodes = suppositionNodesQuery(lemmaNode),
78
- labels = labelNodes.map((labelNode) => {
79
- const label = Label.fromLabelNode(labelNode, fileContext);
80
-
81
- return label;
82
- }),
83
- suppositions = suppositionNodes.map((suppositionNode) => {
84
- const supposition = Supposition.fromSuppositionNode(suppositionNode, fileContext);
85
-
86
- return supposition;
87
- }),
88
- consequent = Consequent.fromConsequentNode(consequentNode, fileContext),
89
- string = stringFromLabels(labels),
90
- proof = Proof.fromProofNode(proofNode, fileContext),
91
- lemma = new Lemma(fileContext, string, labels, suppositions, consequent, proof);
92
-
93
- return lemma;
94
- }
34
+ static fromLemmaNode(metaLemmaNode, fileContext) { return TopLevelAssertion.fromNode(Lemma, metaLemmaNode, fileContext); }
95
35
  }
96
36
 
97
37
  Object.assign(shim, {
package/src/metaLemma.js CHANGED
@@ -1,106 +1,37 @@
1
1
  "use strict";
2
2
 
3
3
  import shim from "./shim";
4
- import LocalContext from "./context/local";
5
4
  import TopLevelAssertion from "./topLevelAssertion";
6
5
 
7
6
  import { EMPTY_STRING } from "./constants";
8
- import { stringFromLabels } from "./topLevelAssertion";
9
- import { nodeQuery, nodesQuery } from "./utilities/query";
10
-
11
- const proofNodeQuery = nodeQuery("/metaLemma/proof"),
12
- labelNodesQuery = nodesQuery("/metaLemma/label"),
13
- consequentNodeQuery = nodeQuery("/metaLemma/consequent"),
14
- suppositionNodesQuery = nodesQuery("/metaLemma/supposition");
15
7
 
16
8
  class MetaLemma extends TopLevelAssertion {
17
- constructor(fileContext, string, labels, suppositions, consequent, proof, substitutions) {
18
- super(fileContext, string, labels, suppositions, consequent, proof);
19
-
20
- this.substitutions = substitutions;
21
- }
22
-
23
- getSubstitutions() {
24
- return this.substitutions;
25
- }
26
-
27
9
  verify() {
28
- let verified = false;
10
+ let verified;
29
11
 
30
- const metaLemmaString = this.string; ///
12
+ const fileContext = this.getFileContext(),
13
+ metaLemmaString = this.string; ///
31
14
 
32
15
  (metaLemmaString === EMPTY_STRING) ?
33
- this.fileContext.trace(`Verifying a meta-lemma...`) :
34
- this.fileContext.trace(`Verifying the '${metaLemmaString}' meta-lemma...`);
35
-
36
- const labelsVerifiedWhenDeclared = this.labels.every((label) => {
37
- const labelVVerifiedWhenDeclared = label.verifyWhenDeclared(this.fileContext);
38
-
39
- if (labelVVerifiedWhenDeclared) {
40
- return true;
41
- }
42
- });
43
-
44
- if (labelsVerifiedWhenDeclared) {
45
- const localContext = LocalContext.fromFileContext(this.fileContext),
46
- suppositionsVerified = this.suppositions.every((supposition) => {
47
- const suppositionVerified = supposition.verify(localContext);
48
-
49
- if (suppositionVerified) {
50
- return true;
51
- }
52
- });
16
+ fileContext.trace(`Verifying a meta-lemma...`) :
17
+ fileContext.trace(`Verifying the '${metaLemmaString}' meta-lemma...`);
53
18
 
54
- if (suppositionsVerified) {
55
- const consequentVerified = this.consequent.verify(localContext);
19
+ verified = super.verify();
56
20
 
57
- if (consequentVerified) {
58
- const proofVerified = this.proof.verify(this.substitutions, this.consequent, localContext);
59
-
60
- if (proofVerified) {
61
- const metaLemma = this; ///
21
+ if (verified) {
22
+ const metaLemma = this; ///
62
23
 
63
- this.fileContext.addMetaLemma(metaLemma);
24
+ fileContext.addMetaLemma(metaLemma);
64
25
 
65
- verified = true;
66
- }
67
- }
68
- }
69
- }
70
-
71
- if (verified) {
72
26
  (metaLemmaString === EMPTY_STRING) ?
73
- this.fileContext.debug(`...verified a meta-lemma.`) :
74
- this.fileContext.debug(`...verified the '${metaLemmaString}' meta-lemma.`);
27
+ fileContext.debug(`...verified a meta-lemma.`) :
28
+ fileContext.debug(`...verified the '${metaLemmaString}' meta-lemma.`);
75
29
  }
76
30
 
77
31
  return verified;
78
32
  }
79
33
 
80
- static fromMetaLemmaNode(metaLemmaNode, fileContext) {
81
- const { Label, Proof, Consequent, Supposition, Substitutions } = shim,
82
- proofNode = proofNodeQuery(metaLemmaNode),
83
- labelNodes = labelNodesQuery(metaLemmaNode),
84
- consequentNode = consequentNodeQuery(metaLemmaNode),
85
- suppositionNodes = suppositionNodesQuery(metaLemmaNode),
86
- labels = labelNodes.map((labelNode) => {
87
- const label = Label.fromLabelNode(labelNode, fileContext);
88
-
89
- return label;
90
- }),
91
- suppositions = suppositionNodes.map((suppositionNode) => {
92
- const supposition = Supposition.fromSuppositionNode(suppositionNode, fileContext);
93
-
94
- return supposition;
95
- }),
96
- consequent = Consequent.fromConsequentNode(consequentNode, fileContext),
97
- proof = Proof.fromProofNode(proofNode, fileContext),
98
- string = stringFromLabels(labels),
99
- substitutions = Substitutions.fromNothing(),
100
- metaLemma = new MetaLemma(fileContext, string, labels, suppositions, consequent, proof, substitutions);
101
-
102
- return metaLemma;
103
- }
34
+ static fromMetaLemmaNode(metaLemmaNode, fileContext) { return TopLevelAssertion.fromNode(MetaLemma, metaLemmaNode, fileContext); }
104
35
  }
105
36
 
106
37
  Object.assign(shim, {
@@ -1,10 +1,8 @@
1
1
  "use strict";
2
2
 
3
3
  import shim from "./shim";
4
- import LocalContext from "./context/local";
5
4
  import TopLevelAssertion from "./topLevelAssertion";
6
5
 
7
- import { nodeQuery, nodesQuery } from "./utilities/query";
8
6
  import { stringFromLabels } from "./topLevelAssertion";
9
7
  import { labelsFromJSON,
10
8
  labelsToLabelsJSON,
@@ -15,66 +13,23 @@ import { labelsFromJSON,
15
13
  suppositionsToSuppositionsJSON,
16
14
  substitutionsToSubstitutionsJSON } from "./utilities/json";
17
15
 
18
- const proofNodeQuery = nodeQuery("/metatheorem/proof"),
19
- labelNodesQuery = nodesQuery("/metatheorem/label"),
20
- consequentNodeQuery = nodeQuery("/metatheorem/consequent"),
21
- suppositionNodesQuery = nodesQuery("/metatheorem/supposition");
22
-
23
16
  class Metatheorem extends TopLevelAssertion {
24
- constructor(fileContext, string, labels, suppositions, consequent, proof, substitutions) {
25
- super(fileContext, string, labels, suppositions, consequent, proof);
26
-
27
- this.substitutions = substitutions;
28
- }
29
-
30
- getSubstitutions() {
31
- return this.substitutions;
32
- }
33
-
34
17
  verify() {
35
- let verified = false;
36
-
37
- const metatheoremString = this.string; ///
38
-
39
- this.fileContext.trace(`Verifying the '${metatheoremString}' metatheorem...`);
40
-
41
- const labelsVerifiedWhenDeclared = this.labels.every((label) => {
42
- const labelVVerifiedWhenDeclared = label.verifyWhenDeclared(this.fileContext);
18
+ let verified;
43
19
 
44
- if (labelVVerifiedWhenDeclared) {
45
- return true;
46
- }
47
- });
20
+ const fileContext = this.getFileContext(),
21
+ metatheoremString = this.string; ///
48
22
 
49
- if (labelsVerifiedWhenDeclared) {
50
- const localContext = LocalContext.fromFileContext(this.fileContext),
51
- suppositionsVerified = this.suppositions.every((supposition) => {
52
- const suppositionVerified = supposition.verify(localContext);
23
+ fileContext.trace(`Verifying the '${metatheoremString}' metatheorem...`);
53
24
 
54
- if (suppositionVerified) {
55
- return true;
56
- }
57
- });
25
+ verified = super.verify();
58
26
 
59
- if (suppositionsVerified) {
60
- const consequentVerified = this.consequent.verify(localContext);
61
-
62
- if (consequentVerified) {
63
- const proofVerified = this.proof.verify(this.substitutions, this.consequent, localContext);
64
-
65
- if (proofVerified) {
66
- const metatheorem = this; ///
27
+ if (verified) {
28
+ const metaTheorem = this; ///
67
29
 
68
- this.fileContext.addMetatheorem(metatheorem);
30
+ fileContext.addMetatheorem(metaTheorem);
69
31
 
70
- verified = true;
71
- }
72
- }
73
- }
74
- }
75
-
76
- if (verified) {
77
- this.fileContext.debug(`...verified the '${metatheoremString}' metatheorem.`);
32
+ fileContext.debug(`...verified the '${metatheoremString}' metatheorem.`);
78
33
  }
79
34
 
80
35
  return verified;
@@ -111,30 +66,7 @@ class Metatheorem extends TopLevelAssertion {
111
66
  return topLevelAssertion;
112
67
  }
113
68
 
114
- static fromMetatheoremNode(metatheoremNode, fileContext) {
115
- const { Label, Proof, Consequent, Supposition, Substitutions } = shim,
116
- proofNode = proofNodeQuery(metatheoremNode),
117
- labelNodes = labelNodesQuery(metatheoremNode),
118
- consequentNode = consequentNodeQuery(metatheoremNode),
119
- suppositionNodes = suppositionNodesQuery(metatheoremNode),
120
- labels = labelNodes.map((labelNode) => {
121
- const label = Label.fromLabelNode(labelNode, fileContext);
122
-
123
- return label;
124
- }),
125
- suppositions = suppositionNodes.map((suppositionNode) => {
126
- const supposition = Supposition.fromSuppositionNode(suppositionNode, fileContext);
127
-
128
- return supposition;
129
- }),
130
- consequent = Consequent.fromConsequentNode(consequentNode, fileContext),
131
- proof = Proof.fromProofNode(proofNode, fileContext),
132
- string = stringFromLabels(labels),
133
- substitutions = Substitutions.fromNothing(),
134
- metatheorem = new Metatheorem(fileContext, string, labels, suppositions, consequent, proof, substitutions);
135
-
136
- return metatheorem;
137
- }
69
+ static fromMetatheoremNode(metatheoremNode, fileContext) { return TopLevelAssertion.fromNode(Metatheorem, metatheoremNode, fileContext); }
138
70
  }
139
71
 
140
72
  Object.assign(shim, {