occam-verify-cli 0.0.1067 → 0.0.1068

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 (73) hide show
  1. package/lib/assertion/contained.js +2 -2
  2. package/lib/assertion/defined.js +2 -2
  3. package/lib/assignment/judgement.js +3 -3
  4. package/lib/conclusion.js +4 -4
  5. package/lib/consequent.js +4 -4
  6. package/lib/declaration.js +90 -3
  7. package/lib/frame.js +109 -48
  8. package/lib/judgement.js +84 -5
  9. package/lib/metaType.js +24 -3
  10. package/lib/metavariable.js +93 -25
  11. package/lib/mixins/statement/unify.js +2 -17
  12. package/lib/mixins/statement/verify.js +13 -13
  13. package/lib/premise.js +10 -6
  14. package/lib/reference.js +11 -9
  15. package/lib/rule.js +5 -2
  16. package/lib/ruleNames.js +5 -1
  17. package/lib/statement/unqualified.js +26 -2
  18. package/lib/statement.js +4 -2
  19. package/lib/substitution/frameForMetavariable.js +61 -60
  20. package/lib/substitution/statementForMetavariable.js +52 -29
  21. package/lib/substitution/termForVariable.js +53 -52
  22. package/lib/substitution.js +28 -28
  23. package/lib/substitutions.js +46 -40
  24. package/lib/supposition.js +4 -4
  25. package/lib/unifier/intrinsicLevel.js +4 -4
  26. package/lib/unifier/metaLevel.js +11 -7
  27. package/lib/unifier/statementWithCombinator.js +2 -2
  28. package/lib/utilities/node.js +24 -10
  29. package/lib/utilities/tokens.js +8 -1
  30. package/lib/variable.js +9 -5
  31. package/package.json +1 -1
  32. package/src/assertion/contained.js +1 -1
  33. package/src/assertion/defined.js +1 -1
  34. package/src/assignment/judgement.js +3 -4
  35. package/src/conclusion.js +4 -4
  36. package/src/consequent.js +4 -4
  37. package/src/declaration.js +57 -4
  38. package/src/frame.js +149 -90
  39. package/src/judgement.js +109 -3
  40. package/src/metaType.js +29 -3
  41. package/src/metavariable.js +145 -42
  42. package/src/mixins/statement/unify.js +1 -23
  43. package/src/mixins/statement/verify.js +15 -13
  44. package/src/premise.js +13 -6
  45. package/src/reference.js +11 -7
  46. package/src/rule.js +7 -1
  47. package/src/ruleNames.js +1 -0
  48. package/src/statement/unqualified.js +31 -1
  49. package/src/statement.js +3 -1
  50. package/src/substitution/frameForMetavariable.js +65 -84
  51. package/src/substitution/statementForMetavariable.js +63 -32
  52. package/src/substitution/termForVariable.js +56 -77
  53. package/src/substitution.js +21 -21
  54. package/src/substitutions.js +51 -46
  55. package/src/supposition.js +4 -4
  56. package/src/unifier/intrinsicLevel.js +4 -3
  57. package/src/unifier/metaLevel.js +19 -7
  58. package/src/unifier/statementWithCombinator.js +1 -1
  59. package/src/utilities/node.js +26 -10
  60. package/src/utilities/tokens.js +7 -0
  61. package/src/variable.js +14 -5
  62. package/lib/unify/metavariableWithFrame.js +0 -40
  63. package/lib/unify/simpleSubstitutionStatementWithComplexSubstitutionStatement.js +0 -31
  64. package/lib/verify/declaration.js +0 -83
  65. package/lib/verify/frame.js +0 -120
  66. package/lib/verify/judgement.js +0 -88
  67. package/lib/verify/metavariableGivenMetaType.js +0 -44
  68. package/src/unify/metavariableWithFrame.js +0 -40
  69. package/src/unify/simpleSubstitutionStatementWithComplexSubstitutionStatement.js +0 -27
  70. package/src/verify/declaration.js +0 -113
  71. package/src/verify/frame.js +0 -157
  72. package/src/verify/judgement.js +0 -127
  73. package/src/verify/metavariableGivenMetaType.js +0 -45
@@ -56,7 +56,7 @@ export default class DefinedAssertion {
56
56
  }
57
57
 
58
58
  if (this.frame!== null) {
59
- frameVerified = this.frame.verify(localContext);
59
+ frameVerified = this.frame.verify(assignments, stated, localContext);
60
60
  }
61
61
 
62
62
  if (termVerified && frameVerified) {
@@ -11,13 +11,12 @@ export default class JudgementAssignment {
11
11
 
12
12
  assign(localContext) {
13
13
  const judgementAdded = localContext.addJudgement(this.judgement),
14
- judgementNode = this.judgement.getNode(),
15
- judgementString = localContext.nodeAsString(judgementNode),
14
+ judgementString = this.judgement.getString(),
16
15
  judgementAssigned = judgementAdded; ///
17
16
 
18
17
  judgementAssigned ?
19
- localContext.trace(`Assigned the '${judgementString}' judgement.`, judgementNode) :
20
- localContext.debug(`Unable to assign the '${judgementString}' judgement.`, judgementNode);
18
+ localContext.trace(`Assigned the '${judgementString}' judgement.`) :
19
+ localContext.debug(`Unable to assign the '${judgementString}' judgement.`);
21
20
 
22
21
  return judgementAssigned;
23
22
  }
package/src/conclusion.js CHANGED
@@ -31,18 +31,18 @@ export default class Conclusion {
31
31
  const statementString = statement.getString(),
32
32
  conclusionString = this.getString();
33
33
 
34
- localContext.trace(`Unifying the '${statementString}' statement with the '${conclusionString}' conclusion...`);
35
-
36
- const localContextB = localContext;
34
+ const localContextB = localContext; ///
37
35
 
38
36
  localContext = LocalContext.fromFileContext(this.fileContext);
39
37
 
40
38
  const localContextA = localContext; ///
41
39
 
40
+ localContextB.trace(`Unifying the '${statementString}' statement with the '${conclusionString}' conclusion...`);
41
+
42
42
  statementUnified = this.unqualifiedStatement.unifyStatement(statement, substitutions, localContextA, localContextB);
43
43
 
44
44
  if (statementUnified) {
45
- localContext.debug(`...unified the '${statementString}' statement with the '${conclusionString}' conclusion.`);
45
+ localContextB.debug(`...unified the '${statementString}' statement with the '${conclusionString}' conclusion.`);
46
46
  }
47
47
 
48
48
  return statementUnified;
package/src/consequent.js CHANGED
@@ -31,18 +31,18 @@ export default class Consequent {
31
31
  const statementString = statement.getString(),
32
32
  consequentString = this.getString();
33
33
 
34
- localContext.trace(`Unifying the '${statementString}' statement with the '${consequentString}' consequent...`);
35
-
36
- const localContextB = localContext;
34
+ const localContextB = localContext; ///
37
35
 
38
36
  localContext = LocalContext.fromFileContext(this.fileContext);
39
37
 
40
38
  const localContextA = localContext; ///
41
39
 
40
+ localContextB.trace(`Unifying the '${statementString}' statement with the '${consequentString}' consequent...`);
41
+
42
42
  statementUnified = this.unqualifiedStatement.unifyStatement(statement, substitutions, localContextA, localContextB);
43
43
 
44
44
  if (statementUnified) {
45
- localContext.debug(`...unified the '${statementString}' statement with the '${consequentString}' consequent.`);
45
+ localContextB.debug(`...unified the '${statementString}' statement with the '${consequentString}' consequent.`);
46
46
  }
47
47
 
48
48
  return statementUnified;
@@ -1,13 +1,24 @@
1
1
  "use strict";
2
2
 
3
- import { stripBracketsFromStatement } from "./utilities/brackets";
3
+ import shim from "./shim";
4
+ import Reference from "./reference";
5
+
6
+ import { nodeQuery } from "./utilities/query";
7
+
8
+ const referenceNodeQuery = nodeQuery("/declaration/reference"),
9
+ statementNodeQuery = nodeQuery("/declaration/statement");
4
10
 
5
11
  export default class Declaration {
6
- constructor(reference, statement) {
12
+ constructor(string, reference, statement) {
13
+ this.string = string;
7
14
  this.reference = reference;
8
15
  this.statement = statement;
9
16
  }
10
17
 
18
+ getString() {
19
+ return this.string;
20
+ }
21
+
11
22
  getReference() {
12
23
  return this.reference;
13
24
  }
@@ -16,8 +27,6 @@ export default class Declaration {
16
27
  return this.statement;
17
28
  }
18
29
 
19
- // getMetavariableNode() { return this.reference.getMetavariableNode(); }
20
- //
21
30
  // unifyStatement(statementNode) {
22
31
  // statementNode = stripBracketsFromStatement(statementNode); ///
23
32
  //
@@ -59,4 +68,48 @@ export default class Declaration {
59
68
  //
60
69
  // return declaration;
61
70
  // }
71
+
72
+ verify(assignments, stated, localContext) {
73
+ let verified;
74
+
75
+ const declarationString = this.string; ///
76
+
77
+ localContext.trace(`Verifying the '${declarationString}' declaration...`);
78
+
79
+ stated = true;
80
+
81
+ assignments = null;
82
+
83
+ const referenceVerified = this.reference.verify(localContext);
84
+
85
+ if (referenceVerified) {
86
+ const statementVerified = this.statement.verify(assignments, stated, localContext);
87
+
88
+ verified = statementVerified; ///
89
+ }
90
+
91
+ if (verified) {
92
+ localContext.debug(`...verified the '${declarationString}' declaration.`);
93
+ }
94
+
95
+ return verified;
96
+ }
97
+
98
+ static fromDeclarationNode(declarationNode, localContext) {
99
+ let declaration = null;
100
+
101
+ if (declarationNode !== null) {
102
+ const { Statement } = shim,
103
+ referenceNode = referenceNodeQuery(declarationNode),
104
+ statementNode = statementNodeQuery(declarationNode),
105
+ reference = Reference.fromReferenceNode(referenceNode, localContext),
106
+ statement = Statement.fromStatementNode(statementNode, localContext),
107
+ node = declarationNode, ///
108
+ string = localContext.nodeAsString(node);
109
+
110
+ declaration = new Declaration(string, reference, statement);
111
+ }
112
+
113
+ return declaration;
114
+ }
62
115
  }
package/src/frame.js CHANGED
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ import { arrayUtilities } from "necessary";
4
+
3
5
  import shim from "./shim";
4
6
  import Declaration from "./declaration";
5
7
  import Metavariable from "./metavariable";
@@ -7,13 +9,17 @@ import Metavariable from "./metavariable";
7
9
  import { FRAME_META_TYPE_NAME } from "./metaTypeNames";
8
10
  import { nodeQuery, nodesQuery } from "./utilities/query";
9
11
 
10
- const declarationNodesQuery = nodesQuery("/frame/declaration"),
11
- metavariableNodesQuery = nodesQuery("/frame/metavariable"),
12
- frameMetavariableNodeQuery = nodeQuery("/*/frame/metavariable!");
12
+ const frameNodeQuery = nodeQuery("/*/frame"),
13
+ declarationNodesQuery = nodesQuery("/frame/declaration"),
14
+ metavariableNodeQuery = nodeQuery("/frame/metavariable!"),
15
+ metavariableNodesQuery = nodesQuery("/frame/metavariable");
16
+
17
+ const { first } = arrayUtilities;
13
18
 
14
19
  class Frame {
15
- constructor(string, declarations, metavariables) {
20
+ constructor(string, node, declarations, metavariables) {
16
21
  this.string = string;
22
+ this.node = node;
17
23
  this.declarations = declarations;
18
24
  this.metavariables = metavariables;
19
25
  }
@@ -22,6 +28,10 @@ class Frame {
22
28
  return this.string;
23
29
  }
24
30
 
31
+ getNode() {
32
+ return this.node;
33
+ }
34
+
25
35
  getDeclarations() {
26
36
  return this.declarations;
27
37
  }
@@ -44,24 +54,25 @@ class Frame {
44
54
  return metavariable;
45
55
  }
46
56
 
47
- // getMetavariableNode() {
48
- // let metavariableNode = null;
49
- //
50
- // const declarationsLength = this.declarations.length;
51
- //
52
- // if (declarationsLength === 0) {
53
- // const metavariableNodesLength = this.metavariableNodes.length;
54
- //
55
- // if (metavariableNodesLength === 1) {
56
- // const firstMetavariableNode = first(this.metavariableNodes);
57
- //
58
- // metavariableNode = firstMetavariableNode; ///
59
- // }
60
- // }
61
- //
62
- // return metavariableNode;
63
- // }
64
- //
57
+ getMetavariableNode() {
58
+ let metavariableNode = null;
59
+
60
+ const declarationsLength = this.declarations.length;
61
+
62
+ if (declarationsLength === 0) {
63
+ const metavariablesLength = this.metavariables.length;
64
+
65
+ if (metavariablesLength === 1) {
66
+ const firstMetavariable = first(this.metavariables),
67
+ metavariable = firstMetavariable; ///
68
+
69
+ metavariableNode = metavariable.getNode();
70
+ }
71
+ }
72
+
73
+ return metavariableNode;
74
+ }
75
+
65
76
  // matchMetavariableName(metavariableName) {
66
77
  // let metavariableNameMatches = false;
67
78
  //
@@ -106,15 +117,75 @@ class Frame {
106
117
  // return metaLemmaOrMetaTheoremUnified;
107
118
  // }
108
119
 
109
- verify(localContext) {
120
+ verify(assignments, stated, localContext) {
110
121
  let verified;
111
122
 
112
123
  const frameString = this.string; ///
113
124
 
114
125
  localContext.trace(`Verifying the '${frameString}' frame...`);
115
126
 
127
+ let verifiedWhenStated = false,
128
+ verifiedWhenDerived = false;
129
+
130
+ if (stated) {
131
+ verifiedWhenStated = this.verifyWhenStated(assignments, localContext);
132
+ } else {
133
+ verifiedWhenDerived = this.verifyWhenDerived(assignments, localContext);
134
+ }
135
+
136
+ if (verifiedWhenStated || verifiedWhenDerived) {
137
+ verified = true;
138
+ }
139
+
140
+ if (verified) {
141
+ localContext.debug(`...verified the '${frameString}' frame.`);
142
+ }
143
+
144
+ return verified;
145
+ }
146
+
147
+ verifyWhenStated(assignments, localContext) {
148
+ let verifiedWhenStated = false;
149
+
150
+ const frameString = this.string; ///
151
+
152
+ localContext.trace(`Verifying the '${frameString}' frame when stated...`);
153
+
154
+ const declarationsLength = this.declarations.length;
155
+
156
+ if (declarationsLength === 0) {
157
+ const metavariablesLength = this.metavariables.length;
158
+
159
+ if (metavariablesLength === 1) {
160
+ const firstMetavariable = first(this.metavariables),
161
+ metavariable = firstMetavariable, ///
162
+ metavariableVerified = metavariable.verify(localContext);
163
+
164
+ verifiedWhenStated = metavariableVerified; ///
165
+ } else {
166
+ localContext.trace(`The '${frameString}' stated frame cannot have more than one metavariable.`);
167
+ }
168
+ } else {
169
+ localContext.trace(`The '${frameString}' stated frame cannot have declarations.`);
170
+ }
171
+
172
+
173
+ if (verifiedWhenStated) {
174
+ localContext.debug(`...verified the '${frameString}' frame when stated.`);
175
+ }
176
+
177
+ return verifiedWhenStated;
178
+ }
179
+
180
+ verifyWhenDerived(assignments, localContext) {
181
+ let verifiedWhenDerived;
182
+
183
+ const frameString = this.string; ///
184
+
185
+ localContext.trace(`Verifying the '${frameString}' frame when derived...`);
186
+
116
187
  const declarationsVerified = this.declarations.every((declaration) => {
117
- const declarationVerified = declaration.verify(localContext);
188
+ const declarationVerified = declaration.verify(assignments, stated, localContext);
118
189
 
119
190
  return declarationVerified;
120
191
  });
@@ -126,17 +197,17 @@ class Frame {
126
197
  return metavariableVerified;
127
198
  });
128
199
 
129
- verified = metavariablesVerified; ///
200
+ verifiedWhenDerived = metavariablesVerified; ///
130
201
  }
131
202
 
132
- if (verified) {
133
- localContext.debug(`...verified the '${frameString}' frame.`);
203
+ if (verifiedWhenDerived) {
204
+ localContext.debug(`...verified the '${frameString}' frame when derived.`);
134
205
  }
135
206
 
136
- return verified;
207
+ return verifiedWhenDerived;
137
208
  }
138
209
 
139
- verifyGivenMetaType(metaType, localContext) {
210
+ verifyGivenMetaType(metaType, assignments, stated, localContext) {
140
211
  let verifiedGivenMetaType = false;
141
212
 
142
213
  const frameString = this.string, ///
@@ -147,7 +218,7 @@ class Frame {
147
218
  const metaTypeName = metaType.getName();
148
219
 
149
220
  if (metaTypeName === FRAME_META_TYPE_NAME) {
150
- const verified = this.verify(localContext)
221
+ const verified = this.verify(assignments, stated, localContext)
151
222
 
152
223
  verifiedGivenMetaType = verified; ///
153
224
  }
@@ -160,21 +231,26 @@ class Frame {
160
231
  }
161
232
 
162
233
  static fromFrameNode(frameNode, localContext) {
163
- const declarationNodes = declarationNodesQuery(frameNode),
164
- metavariableNodes = metavariableNodesQuery(frameNode),
165
- declarations = declarationNodes.map((declarationNode) => {
166
- const declaration = Declaration.fromDeclarationNode(declarationNode, localContext);
167
-
168
- return declaration;
169
- }),
170
- metavariables = metavariableNodes.map((metavariableNode) => {
171
- const metavariable = Metavariable.fromMetavariableNode(metavariableNode, localContext);
172
-
173
- return metavariable;
174
- }),
175
- node = frameNode, ///
176
- string = localContext.nodeAsString(node),
177
- frame = new Frame(string, declarations, metavariables);
234
+ let frame = null;
235
+
236
+ if (frameNode !== null) {
237
+ const declarationNodes = declarationNodesQuery(frameNode),
238
+ metavariableNodes = metavariableNodesQuery(frameNode),
239
+ declarations = declarationNodes.map((declarationNode) => {
240
+ const declaration = Declaration.fromDeclarationNode(declarationNode, localContext);
241
+
242
+ return declaration;
243
+ }),
244
+ metavariables = metavariableNodes.map((metavariableNode) => {
245
+ const metavariable = Metavariable.fromMetavariableNode(metavariableNode, localContext);
246
+
247
+ return metavariable;
248
+ }),
249
+ node = frameNode, ///
250
+ string = localContext.nodeAsString(node);
251
+
252
+ frame = new Frame(string, node, declarations, metavariables);
253
+ }
178
254
 
179
255
  return frame;
180
256
  }
@@ -182,19 +258,22 @@ class Frame {
182
258
  static fromDefinedAssertionNode(definedAssertionNode, localContext) {
183
259
  let frame = null;
184
260
 
185
- const frameMetavariableNode = frameMetavariableNodeQuery(definedAssertionNode);
261
+ const frameNode = frameNodeQuery(definedAssertionNode);
186
262
 
187
- if (frameMetavariableNode !== null) {
188
- const metavariableNode = frameMetavariableNode, ///
189
- metavariable = Metavariable.fromMetavariableNode(metavariableNode, localContext),
190
- declarations = [],
191
- metavariables = [
192
- metavariable
193
- ],
194
- node = metavariableNode, ///
195
- string = localContext.nodeAsString(node);
263
+ if (frameNode !== null) {
264
+ const metavariableNode = metavariableNodeQuery(frameNode);
265
+
266
+ if (metavariableNode !== null) {
267
+ const metavariable = Metavariable.fromMetavariableNode(metavariableNode, localContext),
268
+ declarations = [],
269
+ metavariables = [
270
+ metavariable
271
+ ],
272
+ node = frameNode, ///
273
+ string = localContext.nodeAsString(node);
196
274
 
197
- frame = new Frame(string, declarations, metavariables);
275
+ frame = new Frame(string, node, declarations, metavariables);
276
+ }
198
277
  }
199
278
 
200
279
  return frame;
@@ -203,46 +282,26 @@ class Frame {
203
282
  static fromContainedAssertionNode(containedAssertionNode, localContext) {
204
283
  let frame = null;
205
284
 
206
- const frameMetavariableNode = frameMetavariableNodeQuery(containedAssertionNode);
285
+ const frameNode = frameNodeQuery(containedAssertionNode);
207
286
 
208
- if (frameMetavariableNode !== null) {
209
- const metavariableNode = frameMetavariableNode, ///
210
- metavariable = Metavariable.fromMetavariableNode(metavariableNode, localContext),
211
- declarations = [],
212
- metavariables = [
213
- metavariable
214
- ],
215
- node = metavariableNode, ///
216
- string = localContext.nodeAsString(node);
287
+ if (frameNode !== null) {
288
+ const metavariableNode = metavariableNodeQuery(frameNode);
289
+
290
+ if (metavariableNode !== null) {
291
+ const metavariable = Metavariable.fromMetavariableNode(metavariableNode, localContext),
292
+ declarations = [],
293
+ metavariables = [
294
+ metavariable
295
+ ],
296
+ node = frameNode, ///
297
+ string = localContext.nodeAsString(node);
217
298
 
218
- frame = new Frame(string, declarations, metavariables);
299
+ frame = new Frame(string, node, declarations, metavariables);
300
+ }
219
301
  }
220
302
 
221
303
  return frame;
222
304
  }
223
-
224
- // static fromDeclarations(declarations) {
225
- // const metavariableNodes = [],
226
- // frame = new Frame(declarations, metavariableNodes);
227
- //
228
- // return frame;
229
- // }
230
- //
231
- // static fromMetavariableNode(metavariableNode) {
232
- // const declarations = [],
233
- // metavariableNodes = [
234
- // metavariableNode
235
- // ],
236
- // frame = new Frame(declarations, metavariableNodes);
237
- //
238
- // return frame;
239
- // }
240
- //
241
- // static fromDeclarationsAndMetavariableNodes(declarations, metavariableNodes) {
242
- // const frame = new Frame(declarations, metavariableNodes);
243
- //
244
- // return frame;
245
- // }
246
305
  }
247
306
 
248
307
  Object.assign(shim, {
package/src/judgement.js CHANGED
@@ -1,11 +1,25 @@
1
1
  "use strict";
2
2
 
3
+ import Frame from "./frame";
4
+ import Declaration from "./declaration";
5
+ import JudgementAssignment from "./assignment/judgement";
6
+
7
+ import { nodeQuery } from "./utilities/query";
8
+
9
+ const frameNodeQuery = nodeQuery("/judgement/frame"),
10
+ declarationNodeQuery = nodeQuery("/judgement/declaration");
11
+
3
12
  export default class Judgement {
4
- constructor(frame, declaration) {
13
+ constructor(string, frame, declaration) {
14
+ this.string = string;
5
15
  this.frame = frame;
6
16
  this.declaration = declaration;
7
17
  }
8
18
 
19
+ getString() {
20
+ return this.string;
21
+ }
22
+
9
23
  getFrame() {
10
24
  return this.frame;
11
25
  }
@@ -18,8 +32,100 @@ export default class Judgement {
18
32
 
19
33
  matchMetavariableName(metavariableName) { return this.frame.matchMetavariableName(metavariableName); }
20
34
 
21
- static fromJudgementNodeFrameAndDeclaration(judgementNode, frame, declaration) {
22
- const judgement = new Judgement(frame, declaration);
35
+ verify(assignments, stated, localContext) {
36
+ let verified;
37
+
38
+ const judgementString = this.string; ///
39
+
40
+ localContext.trace(`Verifying the '${judgementString}' judgement...`);
41
+
42
+ const frameVerified = this.frame.verify(assignments, stated, localContext),
43
+ declarationVerified = this.declaration.verify(assignments, stated, localContext);
44
+
45
+ if (frameVerified && declarationVerified) {
46
+ let verifiedWhenStated = false,
47
+ verifiedWhenDerived = false;
48
+
49
+ if (stated) {
50
+ verifiedWhenStated = this.verifyWhenStated(assignments, localContext);
51
+ } else {
52
+ verifiedWhenDerived = this.verifyWhenDerived(assignments, localContext);
53
+ }
54
+
55
+ if (verifiedWhenStated || verifiedWhenDerived) {
56
+ verified = true;
57
+ }
58
+ }
59
+
60
+ if (verified) {
61
+ localContext.debug(`...verified the '${judgementString}' judgement.`);
62
+ }
63
+
64
+ return verified;
65
+ }
66
+
67
+ verifyWhenStated(assignments, localContext) {
68
+ let verifiedWhenStated;
69
+
70
+ const judgementString = this.string; ///
71
+
72
+ localContext.trace(`Verifying the '${judgementString}' judgement when stated...`);
73
+
74
+ if (assignments !== null) {
75
+ const judgement = this, ///
76
+ judgementAssignment = JudgementAssignment.fromJudgement(judgement),
77
+ assignment = judgementAssignment;
78
+
79
+ assignments.push(assignment);
80
+ }
81
+
82
+ verifiedWhenStated = true;
83
+
84
+ if (verifiedWhenStated) {
85
+ localContext.debug(`...verified the '${judgementString}' judgement when stated.`);
86
+ }
87
+
88
+ return verifiedWhenStated;
89
+ }
90
+
91
+ verifyWhenDerived(assignments, localContext) {
92
+ let verifiedWhenDerived;
93
+
94
+ const judgementString = this.string; ///
95
+
96
+ localContext.trace(`Verifying the '${judgementString}' judgement when derived...`);
97
+
98
+ const reference = this.declaration.getReference(),
99
+ metatheorem = localContext.findMetatheoremByReference(reference),
100
+ metaLemma = localContext.findMetaLemmaByReference(reference),
101
+ metaLemmaMetatheorem = (metaLemma || metatheorem); ///
102
+
103
+ if (metaLemmaMetatheorem !== null) {
104
+ const metaLemmaMetatheoremUnified = this.frame.unifyMetaLemmaOrMetatheorem(metaLemmaMetatheorem);
105
+
106
+ verifiedWhenDerived = metaLemmaMetatheoremUnified; ///
107
+ }
108
+
109
+ if (verifiedWhenDerived) {
110
+ localContext.debug(`...verified the '${judgementString}' judgement when derived.`);
111
+ }
112
+
113
+ return verifiedWhenDerived;
114
+ }
115
+
116
+ static fromJudgementNode(judgementNode, localContext) {
117
+ let judgement = null;
118
+
119
+ if (judgementNode !== null) {
120
+ const frameNode = frameNodeQuery(judgementNode),
121
+ declarationNode = declarationNodeQuery(judgementNode),
122
+ node = judgementNode, ///
123
+ string = localContext.nodeAsString(node),
124
+ frame = Frame.fromFrameNode(frameNode, localContext),
125
+ declaration = Declaration.fromDeclarationNode(declarationNode, localContext);
126
+
127
+ judgement = new Judgement(string, frame, declaration);
128
+ }
23
129
 
24
130
  return judgement;
25
131
  }
package/src/metaType.js CHANGED
@@ -57,15 +57,15 @@ class MetaType {
57
57
 
58
58
  static fromJSON(json, fileContext) {
59
59
  const { name } = json,
60
- metaType = new MetaType(name);
60
+ metaTypeName = name, ///
61
+ metaType = metaTypeFromMetaTypeName(metaTypeName);
61
62
 
62
63
  return metaType;
63
64
  }
64
65
 
65
66
  static fromMetaTypeNode(metaTypeNode, localContext) {
66
67
  const metaTypeName = metaTypeNameFromMetaTypeNode(metaTypeNode),
67
- name = metaTypeName, ///
68
- metaType = new MetaType(name);
68
+ metaType = metaTypeFromMetaTypeName(metaTypeName);
69
69
 
70
70
  return metaType;
71
71
  }
@@ -107,3 +107,29 @@ class StatementMetaType extends MetaType {
107
107
  export const frameMetaType = FrameMetaType.fromNothing();
108
108
  export const referenceMetaType = ReferenceMetaType.fromNothing();
109
109
  export const statementMetaType = StatementMetaType.fromNothing();
110
+
111
+ function metaTypeFromMetaTypeName(metaTypeName) {
112
+ let metaType;
113
+
114
+ switch (metaTypeName) {
115
+ case FRAME_META_TYPE_NAME: {
116
+ metaType = frameMetaType; ///
117
+
118
+ break;
119
+ }
120
+
121
+ case REFERENCE_META_TYPE_NAME: {
122
+ metaType = referenceMetaType; ///
123
+
124
+ break;
125
+ }
126
+
127
+ case STATEMENT_META_TYPE_NAME: {
128
+ metaType = statementMetaType; ///
129
+
130
+ break;
131
+ }
132
+ }
133
+
134
+ return metaType;
135
+ }