occam-verify-cli 1.0.428 → 1.0.437
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 +1 -1
- package/lib/element/assertion.js +115 -24
- package/lib/element/assumption.js +120 -20
- package/lib/element/axiomLemmaTheoremConjecture.js +118 -30
- package/lib/element/conclusion.js +113 -25
- package/lib/element/declaration.js +112 -37
- package/lib/element/deduction.js +112 -66
- package/lib/element/derivation.js +114 -5
- package/lib/element/equality.js +119 -26
- package/lib/element/equivalence.js +121 -28
- package/lib/element/equivalences.js +122 -7
- package/lib/element/error.js +115 -32
- package/lib/element/frame.js +119 -59
- package/lib/element/hypothesis.js +115 -27
- package/lib/element/judgement.js +120 -33
- package/lib/element/label.js +116 -63
- package/lib/element/lemma.js +1 -9
- package/lib/element/metaLemma.js +1 -8
- package/lib/element/metaLemmaMetatheorem.js +117 -29
- package/lib/element/metaType.js +68 -61
- package/lib/element/metatheorem.js +1 -8
- package/lib/element/metavariable.js +122 -93
- package/lib/element/parameter.js +120 -20
- package/lib/element/premise.js +114 -35
- package/lib/element/procedureCall.js +117 -99
- package/lib/element/procedureReference.js +120 -20
- package/lib/element/proof.js +111 -55
- package/lib/element/property.js +121 -35
- package/lib/element/propertyRelation.js +116 -72
- package/lib/element/reference.js +120 -70
- package/lib/element/rule.js +116 -41
- package/lib/element/section.js +114 -133
- package/lib/element/signature.js +120 -20
- package/lib/element/statement/combinator/bracketed.js +4 -9
- package/lib/element/statement.js +110 -125
- package/lib/element/step.js +115 -27
- package/lib/element/subDerivation.js +111 -43
- package/lib/element/subproof.js +115 -20
- package/lib/element/substitution.js +115 -31
- package/lib/element/substitutions.js +120 -6
- package/lib/element/supposition.js +114 -35
- package/lib/element/term/constructor/bracketed.js +4 -8
- package/lib/element/term.js +111 -98
- package/lib/element/theorem.js +1 -8
- package/lib/element/type.js +71 -91
- package/lib/element/typePrefix.js +120 -20
- package/lib/element/variable.js +116 -111
- package/lib/element.js +67 -0
- package/lib/node/{nonsense.js → equivalences.js} +10 -10
- package/lib/node/frame.js +11 -5
- package/lib/node/procedureReference.js +6 -6
- package/lib/node/statement.js +11 -5
- package/lib/node/term.js +8 -1
- package/lib/nonTerminalNodeMap.js +3 -3
- package/lib/process/instantiate.js +8 -39
- package/lib/process/verify.js +22 -29
- package/lib/ruleNames.js +5 -5
- package/lib/utilities/brackets.js +11 -11
- package/lib/utilities/element.js +588 -94
- package/lib/utilities/instance.js +61 -0
- package/lib/utilities/string.js +73 -1
- package/package.json +10 -10
- package/src/context/file.js +1 -1
- package/src/element/assertion.js +4 -16
- package/src/element/assumption.js +5 -12
- package/src/element/axiomLemmaTheoremConjecture.js +4 -16
- package/src/element/conclusion.js +4 -16
- package/src/element/declaration.js +4 -16
- package/src/element/deduction.js +5 -19
- package/src/element/derivation.js +5 -2
- package/src/element/equality.js +4 -16
- package/src/element/equivalence.js +4 -16
- package/src/element/equivalences.js +12 -5
- package/src/element/error.js +4 -24
- package/src/element/frame.js +5 -56
- package/src/element/hypothesis.js +6 -23
- package/src/element/judgement.js +5 -30
- package/src/element/label.js +8 -19
- package/src/element/lemma.js +0 -7
- package/src/element/metaLemma.js +0 -7
- package/src/element/metaLemmaMetatheorem.js +4 -16
- package/src/element/metaType.js +23 -64
- package/src/element/metatheorem.js +0 -7
- package/src/element/metavariable.js +6 -94
- package/src/element/parameter.js +10 -18
- package/src/element/premise.js +4 -31
- package/src/element/procedureCall.js +5 -77
- package/src/element/procedureReference.js +7 -17
- package/src/element/proof.js +5 -17
- package/src/element/property.js +8 -30
- package/src/element/propertyRelation.js +5 -33
- package/src/element/reference.js +8 -72
- package/src/element/rule.js +4 -41
- package/src/element/section.js +4 -129
- package/src/element/signature.js +7 -13
- package/src/element/statement/combinator/bracketed.js +3 -9
- package/src/element/statement.js +3 -126
- package/src/element/step.js +4 -16
- package/src/element/subDerivation.js +5 -3
- package/src/element/subproof.js +5 -12
- package/src/element/substitution.js +4 -24
- package/src/element/substitutions.js +6 -2
- package/src/element/supposition.js +4 -31
- package/src/element/term/constructor/bracketed.js +4 -9
- package/src/element/term.js +6 -59
- package/src/element/theorem.js +0 -7
- package/src/element/type.js +9 -104
- package/src/element/typePrefix.js +8 -13
- package/src/element/variable.js +6 -109
- package/src/element.js +29 -0
- package/src/node/{nonsense.js → equivalences.js} +2 -2
- package/src/node/frame.js +10 -5
- package/src/node/procedureReference.js +4 -4
- package/src/node/statement.js +10 -5
- package/src/node/term.js +7 -0
- package/src/nonTerminalNodeMap.js +3 -3
- package/src/process/instantiate.js +4 -36
- package/src/process/verify.js +42 -47
- package/src/ruleNames.js +1 -1
- package/src/utilities/brackets.js +13 -13
- package/src/utilities/element.js +731 -129
- package/src/utilities/instance.js +53 -0
- package/src/utilities/string.js +97 -0
package/src/element/type.js
CHANGED
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
import { arrayUtilities } from "necessary";
|
|
4
4
|
|
|
5
|
+
import Element from "../element";
|
|
6
|
+
|
|
5
7
|
import { define } from "../elements";
|
|
6
8
|
import { BASE_TYPE_SYMBOL } from "../constants";
|
|
7
|
-
import { typeFromTypeNode } from "../utilities/node.old";
|
|
8
9
|
import { typeStringFromTypeNameTypePrefixNameAndSuperTypes } from "../utilities/string";
|
|
9
10
|
import { superTypesFromJSON, propertiesFromJSON, superTypesToSuperTypesJSON, propertiesToPropertiesJSON } from "../utilities/json";
|
|
10
11
|
|
|
11
12
|
const { push, first } = arrayUtilities;
|
|
12
13
|
|
|
13
|
-
class Type {
|
|
14
|
-
constructor(string, node, name, prefixName, superTypes, properties, provisional) {
|
|
15
|
-
|
|
16
|
-
this.node = node;
|
|
14
|
+
class Type extends Element {
|
|
15
|
+
constructor(context, string, node, name, prefixName, superTypes, properties, provisional) {
|
|
16
|
+
super(context, string, node);
|
|
17
17
|
this.name = name;
|
|
18
18
|
this.prefixName = prefixName;
|
|
19
19
|
this.superTypes = superTypes;
|
|
@@ -21,14 +21,6 @@ class Type {
|
|
|
21
21
|
this.provisional = provisional;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
getString() {
|
|
25
|
-
return this.string;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
getNode() {
|
|
29
|
-
return this.node;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
24
|
getName() {
|
|
33
25
|
return this.name;
|
|
34
26
|
}
|
|
@@ -310,78 +302,8 @@ class Type {
|
|
|
310
302
|
typeName = name, ///
|
|
311
303
|
typePrefixName = null,
|
|
312
304
|
string = typeStringFromTypeNameTypePrefixNameAndSuperTypes(typeName, typePrefixName, superTypes),
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
return type;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
static fromTypeNode(typeNode, context) {
|
|
319
|
-
const type = typeFromTypeNode(typeNode, context);
|
|
320
|
-
|
|
321
|
-
return type;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
static fromSuperTypeNode(superTypeNode, context) {
|
|
325
|
-
context = null; ///
|
|
326
|
-
|
|
327
|
-
const typeNode = superTypeNode, ///
|
|
328
|
-
type = typeFromTypeNode(typeNode, context);
|
|
329
|
-
|
|
330
|
-
return type;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
static fromTypeAndProvisional(type, provisional) {
|
|
334
|
-
const name = type.getName(),
|
|
335
|
-
prefixName = type.getPrefixName(),
|
|
336
|
-
superType = type, ///
|
|
337
|
-
typeName = name, ///
|
|
338
|
-
typePrefixName = prefixName, ///
|
|
339
|
-
superTypes = [
|
|
340
|
-
superType
|
|
341
|
-
],
|
|
342
|
-
string = typeStringFromTypeNameTypePrefixNameAndSuperTypes(typeName, typePrefixName, superTypes),
|
|
343
|
-
properties = type.getProperties();
|
|
344
|
-
|
|
345
|
-
type = new Type(string, node, name, prefixName, superTypes, properties, provisional); ///
|
|
346
|
-
|
|
347
|
-
return type;
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
static fromPropertyDeclarationNode(propertyDeclarationNode, context) {
|
|
351
|
-
const typeNode = propertyDeclarationNode.getTypeNode(),
|
|
352
|
-
type = typeFromTypeNode(typeNode, context);
|
|
353
|
-
|
|
354
|
-
return type;
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
static fromSimpleTypeDeclarationNode(simpleTypeDeclarationNode, context) {
|
|
358
|
-
const typeName = simpleTypeDeclarationNode.getTypeName(),
|
|
359
|
-
provisional = simpleTypeDeclarationNode.isProvisional(),
|
|
360
|
-
typePrefixName = simpleTypeDeclarationNode.getTypePrefixName(),
|
|
361
|
-
superTypes = superTypesFromSimpleTypeDeclarationNode(simpleTypeDeclarationNode, context),
|
|
362
|
-
name = typeName, ///
|
|
363
|
-
prefixName = typePrefixName, ///
|
|
364
|
-
properties = [],
|
|
365
|
-
string = typeStringFromTypeNameTypePrefixNameAndSuperTypes(typeName, typePrefixName, superTypes),
|
|
366
|
-
type = new Type(string, node, name, prefixName, superTypes, properties, provisional);
|
|
367
|
-
|
|
368
|
-
return type;
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
static fromConstructorDeclarationNode(constructorDeclarationNode, context) {
|
|
372
|
-
let type;
|
|
373
|
-
|
|
374
|
-
const typeNode = constructorDeclarationNode.getTypeNode();
|
|
375
|
-
|
|
376
|
-
if (typeNode === null) {
|
|
377
|
-
type = baseType;
|
|
378
|
-
} else {
|
|
379
|
-
const provisional = constructorDeclarationNode.isProvisional();
|
|
380
|
-
|
|
381
|
-
type = typeFromTypeNode(typeNode, context);
|
|
382
|
-
|
|
383
|
-
type.setProvisional(provisional);
|
|
384
|
-
}
|
|
305
|
+
node = null,
|
|
306
|
+
type = new Type(context, string, node, name, prefixName, superTypes, properties, provisional);
|
|
385
307
|
|
|
386
308
|
return type;
|
|
387
309
|
}
|
|
@@ -389,34 +311,17 @@ class Type {
|
|
|
389
311
|
|
|
390
312
|
export default define(Type);
|
|
391
313
|
|
|
392
|
-
function superTypesFromSimpleTypeDeclarationNode(simpleTypeDeclarationNode, context) {
|
|
393
|
-
const superTypeNodes = simpleTypeDeclarationNode.getSuperTypeNodes(),
|
|
394
|
-
superTypes = superTypeNodes.map((superTypeNode) => {
|
|
395
|
-
const superType = Type.fromSuperTypeNode(superTypeNode, context);
|
|
396
|
-
|
|
397
|
-
return superType;
|
|
398
|
-
}),
|
|
399
|
-
superTypesLength = superTypes.length;
|
|
400
|
-
|
|
401
|
-
if (superTypesLength === 0) {
|
|
402
|
-
const superType = baseType; ///
|
|
403
|
-
|
|
404
|
-
superTypes.push(superType);
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
return superTypes;
|
|
408
|
-
}
|
|
409
|
-
|
|
410
314
|
class BaseType extends Type {
|
|
411
315
|
static fromNothing() {
|
|
412
316
|
const name = BASE_TYPE_SYMBOL, ///
|
|
317
|
+
context = null,
|
|
413
318
|
string = name, ///
|
|
414
319
|
node = null,
|
|
415
320
|
prefixName = null,
|
|
416
321
|
superTypes = [],
|
|
417
322
|
properties = [],
|
|
418
323
|
provisional = false,
|
|
419
|
-
baseType = new BaseType(string, node, name, prefixName, superTypes, properties, provisional);
|
|
324
|
+
baseType = new BaseType(context, string, node, name, prefixName, superTypes, properties, provisional);
|
|
420
325
|
|
|
421
326
|
return baseType;
|
|
422
327
|
}
|
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import Element from "../element";
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
constructor(string, node, name) {
|
|
7
|
-
this.string = string;
|
|
8
|
-
this.node = node;
|
|
9
|
-
this.name = name;
|
|
10
|
-
}
|
|
5
|
+
import { define } from "../elements";
|
|
11
6
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
export default define(class TypePrefix extends Element {
|
|
8
|
+
constructor(context, string, node, name) {
|
|
9
|
+
super(context, string, node);
|
|
15
10
|
|
|
16
|
-
|
|
17
|
-
return this.node;
|
|
11
|
+
this.name = name;
|
|
18
12
|
}
|
|
19
13
|
|
|
20
14
|
getName() {
|
|
@@ -41,7 +35,8 @@ export default define(class TypePrefix {
|
|
|
41
35
|
static fromJSON(json, context) {
|
|
42
36
|
const { name } = json,
|
|
43
37
|
string = name, ///
|
|
44
|
-
|
|
38
|
+
node = null,
|
|
39
|
+
typePrefix = new TypePrefix(context, string, node, name);
|
|
45
40
|
|
|
46
41
|
return typePrefix;
|
|
47
42
|
}
|
package/src/element/variable.js
CHANGED
|
@@ -1,30 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import Element from "../element";
|
|
3
4
|
import elements from "../elements";
|
|
4
5
|
|
|
5
6
|
import { define } from "../elements";
|
|
6
|
-
import { EMPTY_STRING } from "../constants";
|
|
7
|
-
import { typeFromTypeNode } from "../utilities/node.old";
|
|
8
7
|
import { instantiateVariable } from "../process/instantiate";
|
|
9
8
|
import { typeFromJSON, typeToTypeJSON } from "../utilities/json";
|
|
10
9
|
|
|
11
|
-
export default define(class Variable {
|
|
12
|
-
constructor(string, node, type, identifier, propertyRelations) {
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
export default define(class Variable extends Element {
|
|
11
|
+
constructor(context, string, node, type, identifier, propertyRelations) {
|
|
12
|
+
super(context, string, node);
|
|
13
|
+
|
|
15
14
|
this.type = type;
|
|
16
15
|
this.identifier = identifier;
|
|
17
16
|
this.propertyRelations = propertyRelations;
|
|
18
17
|
}
|
|
19
18
|
|
|
20
|
-
getString() {
|
|
21
|
-
return this.string;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
getNode() {
|
|
25
|
-
return this.node;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
19
|
getIdentifier() {
|
|
29
20
|
return this.identifier;
|
|
30
21
|
}
|
|
@@ -43,14 +34,6 @@ export default define(class Variable {
|
|
|
43
34
|
|
|
44
35
|
getTypeString() { return this.type.getString(); }
|
|
45
36
|
|
|
46
|
-
isEqualTo(variable) {
|
|
47
|
-
const variableNode = variable.getNode(),
|
|
48
|
-
matches = this.node.match(variableNode),
|
|
49
|
-
equalTo = matches; ///
|
|
50
|
-
|
|
51
|
-
return equalTo;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
37
|
matchParameter(parameter) {
|
|
55
38
|
const parameterName = parameter.getName(),
|
|
56
39
|
parameterNameMatchesIdentifier = (parameterName === this.identifier),
|
|
@@ -197,94 +180,8 @@ export default define(class Variable {
|
|
|
197
180
|
identifier = variableIdentifier, ///
|
|
198
181
|
type = typeFromJSON(json, context),
|
|
199
182
|
propertyRelations = [],
|
|
200
|
-
variable = new Variable(string, node, type, identifier, propertyRelations);
|
|
201
|
-
|
|
202
|
-
return variable;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
static fromTermNode(termNode, context) {
|
|
206
|
-
let variable = null;
|
|
207
|
-
|
|
208
|
-
const singularVariableNode = termNode.getSingularVariableNode();
|
|
209
|
-
|
|
210
|
-
if (singularVariableNode !== null) {
|
|
211
|
-
const variableNode = singularVariableNode, ///
|
|
212
|
-
type = null;
|
|
213
|
-
|
|
214
|
-
variable = variableFromVariableNodeAndType(variableNode, type);
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
return variable;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
static fromVariableNode(variableNode, context) {
|
|
221
|
-
let variable = null;
|
|
222
|
-
|
|
223
|
-
if (variableNode !== null) {
|
|
224
|
-
const type = null;
|
|
225
|
-
|
|
226
|
-
variable = variableFromVariableNodeAndType(variableNode, type);
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
return variable;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
static fromVariableNodeAndType(variableNode, type, context) {
|
|
233
|
-
const variable = variableFromVariableNodeAndType(variableNode, type);
|
|
234
|
-
|
|
235
|
-
return variable;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
static fromVariableDeclarationNode(variableDeclarationNode, context) {
|
|
239
|
-
const { Variable } = elements,
|
|
240
|
-
provisional = variableDeclarationNode.isProvisional(),
|
|
241
|
-
typeNode = variableDeclarationNode.getTypeNode(),
|
|
242
|
-
type = typeFromTypeNode(typeNode, context);
|
|
243
|
-
|
|
244
|
-
type.setProvisional(provisional);
|
|
245
|
-
|
|
246
|
-
const variableNode = variableDeclarationNode.getVariableNode(),
|
|
247
|
-
variableIdentifier = variableDeclarationNode.getVariableIdentifier(),
|
|
248
|
-
node = variableNode, ///
|
|
249
|
-
identifier = variableIdentifier, ///
|
|
250
|
-
string = identifier, ///
|
|
251
|
-
propertyRelations = [],
|
|
252
|
-
variable = new Variable(string, node, type, identifier, propertyRelations);
|
|
253
|
-
|
|
254
|
-
return variable;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
static fromVariableAndPropertyRelation(variable, propertyRelation, context) {
|
|
258
|
-
let propertyRelations;
|
|
259
|
-
|
|
260
|
-
const node = variable.getNode(),
|
|
261
|
-
type = variable.getType(),
|
|
262
|
-
identifier = variable.getIdentifier();
|
|
263
|
-
|
|
264
|
-
propertyRelations = variable.getPropertyRelations();
|
|
265
|
-
|
|
266
|
-
propertyRelations = [
|
|
267
|
-
...propertyRelations,
|
|
268
|
-
propertyRelation
|
|
269
|
-
];
|
|
270
|
-
|
|
271
|
-
const string = stringFromNameAndPropertyRelations(identifier, propertyRelations);
|
|
272
|
-
|
|
273
|
-
variable = new Variable(string, node, type, identifier, propertyRelations);
|
|
183
|
+
variable = new Variable(context, string, node, type, identifier, propertyRelations);
|
|
274
184
|
|
|
275
185
|
return variable;
|
|
276
186
|
}
|
|
277
187
|
});
|
|
278
|
-
|
|
279
|
-
function stringFromNameAndPropertyRelations(identifier, propertyRelations) {
|
|
280
|
-
const propertyRelationsString = propertyRelations.reduce((propertyRelationsString, propertyRelation) => {
|
|
281
|
-
const propertyRelationString = propertyRelation.getString();
|
|
282
|
-
|
|
283
|
-
propertyRelationsString = `${propertyRelationsString}, ${propertyRelationString}`;
|
|
284
|
-
|
|
285
|
-
return propertyRelationsString;
|
|
286
|
-
}, EMPTY_STRING),
|
|
287
|
-
string = `${identifier}${propertyRelationsString}`;
|
|
288
|
-
|
|
289
|
-
return string;
|
|
290
|
-
}
|
package/src/element.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export default class Element {
|
|
4
|
+
constructor(context, string, node) {
|
|
5
|
+
this.context = context;
|
|
6
|
+
this.string = string;
|
|
7
|
+
this.node = node;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
getContext() {
|
|
11
|
+
return this.context;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
getString() {
|
|
15
|
+
return this.string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
getNode() {
|
|
19
|
+
return this.node;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
isEQualTo(element) {
|
|
23
|
+
const elementNode = element.getNode(),
|
|
24
|
+
matches = this.node.match(elementNode),
|
|
25
|
+
equalTo = matches; ///
|
|
26
|
+
|
|
27
|
+
return equalTo;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import NonTerminalNode from "../nonTerminalNode";
|
|
4
4
|
|
|
5
|
-
export default class
|
|
6
|
-
static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return NonTerminalNode.fromRuleNameChildNodesOpacityAndPrecedence(
|
|
5
|
+
export default class EquivalencesNode extends NonTerminalNode {
|
|
6
|
+
static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return NonTerminalNode.fromRuleNameChildNodesOpacityAndPrecedence(EquivalencesNode, ruleName, childNodes, opacity, precedence); }
|
|
7
7
|
}
|
package/src/node/frame.js
CHANGED
|
@@ -27,17 +27,22 @@ export default class FrameNode extends NonTerminalNode {
|
|
|
27
27
|
getMetavariableName() {
|
|
28
28
|
let metavariableName = null;
|
|
29
29
|
|
|
30
|
-
const
|
|
30
|
+
const metavariableNode = this.getMetavariableNode();
|
|
31
31
|
|
|
32
|
-
if (
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
metavariableName = singularMetavariableNode.getMetavariableName();
|
|
32
|
+
if (metavariableName !== null) {
|
|
33
|
+
metavariableName = metavariableNode.getMetavariableName();
|
|
36
34
|
}
|
|
37
35
|
|
|
38
36
|
return metavariableName;
|
|
39
37
|
}
|
|
40
38
|
|
|
39
|
+
getMetavariableNode() {
|
|
40
|
+
const singularMetavariableNode = this.getSingularMetavariableNode(),
|
|
41
|
+
metavariableNode = singularMetavariableNode; ///
|
|
42
|
+
|
|
43
|
+
return metavariableNode;
|
|
44
|
+
}
|
|
45
|
+
|
|
41
46
|
getMetavariableNodes() {
|
|
42
47
|
const ruleName = METAVARIABLE_RULE_NAME,
|
|
43
48
|
metavariableNodes = this.getNodesByRuleName(ruleName);
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import NonTerminalNode from "../nonTerminalNode";
|
|
4
4
|
|
|
5
5
|
export default class ProcedureReferenceNode extends NonTerminalNode {
|
|
6
|
-
|
|
7
|
-
let
|
|
6
|
+
getName() {
|
|
7
|
+
let name;
|
|
8
8
|
|
|
9
9
|
this.someChildNode((childNode) => {
|
|
10
10
|
const childNodeTerminalNode = childNode.isTerminalNode();
|
|
@@ -13,13 +13,13 @@ export default class ProcedureReferenceNode extends NonTerminalNode {
|
|
|
13
13
|
const terminalNode = childNode, ///
|
|
14
14
|
content = terminalNode.getContent();
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
name = content; ///
|
|
17
17
|
|
|
18
18
|
return true;
|
|
19
19
|
}
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
-
return
|
|
22
|
+
return name;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return NonTerminalNode.fromRuleNameChildNodesOpacityAndPrecedence(ProcedureReferenceNode, ruleName, childNodes, opacity, precedence); }
|
package/src/node/statement.js
CHANGED
|
@@ -22,17 +22,22 @@ export default class StatementNode extends NonTerminalNode {
|
|
|
22
22
|
getMetavariableName() {
|
|
23
23
|
let metavariableName = null;
|
|
24
24
|
|
|
25
|
-
const
|
|
25
|
+
const metavariableNode = this.getMetavariableNode();
|
|
26
26
|
|
|
27
|
-
if (
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
metavariableName = singularMetavariableNode.getMetavariableName();
|
|
27
|
+
if (metavariableName !== null) {
|
|
28
|
+
metavariableName = metavariableNode.getMetavariableName();
|
|
31
29
|
}
|
|
32
30
|
|
|
33
31
|
return metavariableName;
|
|
34
32
|
}
|
|
35
33
|
|
|
34
|
+
getMetavariableNode() {
|
|
35
|
+
const singularMetavariableNode = this.getSingularMetavariableNode(),
|
|
36
|
+
metavariableNode = singularMetavariableNode; ///
|
|
37
|
+
|
|
38
|
+
return metavariableNode;
|
|
39
|
+
}
|
|
40
|
+
|
|
36
41
|
getSubstitutionNode() {
|
|
37
42
|
const frameSubstitutionNode = this.getFrameSubstitutionNode(),
|
|
38
43
|
termSubstitutionNode = this.getTermSubstitutionNode(),
|
package/src/node/term.js
CHANGED
|
@@ -19,6 +19,13 @@ export default class TermNode extends NonTerminalNode {
|
|
|
19
19
|
return variableIdentifier;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
getVariableNode() {
|
|
23
|
+
const singularVariableNode = this.getSingularVariableNode(),
|
|
24
|
+
variableNode = singularVariableNode; //
|
|
25
|
+
|
|
26
|
+
return variableNode;
|
|
27
|
+
}
|
|
28
|
+
|
|
22
29
|
isSingular() {
|
|
23
30
|
let singular = false;
|
|
24
31
|
|
|
@@ -15,7 +15,6 @@ import LabelsNode from "./node/labels";
|
|
|
15
15
|
import SectionNode from "./node/section";
|
|
16
16
|
import PremiseNode from "./node/premise";
|
|
17
17
|
import TheoremNode from "./node/theorem";
|
|
18
|
-
import NonsenseNode from "./node/nonsense";
|
|
19
18
|
import ArgumentNode from "./node/argument";
|
|
20
19
|
import SubproofNode from "./node/subproof";
|
|
21
20
|
import PropertyNode from "./node/property";
|
|
@@ -49,6 +48,7 @@ import AxiomHeaderNode from "./node/header/axiom";
|
|
|
49
48
|
import LemmaHeaderNode from "./node/header/lemma";
|
|
50
49
|
import MetatheoremNode from "./node/metatheorem";
|
|
51
50
|
import EquivalenceNode from "./node/equivalence";
|
|
51
|
+
import EquivalencesNode from "./node/equivalences";
|
|
52
52
|
import MetaArgumentNode from "./node/metaArgument";
|
|
53
53
|
import MetavariableNode from "./node/metavariable";
|
|
54
54
|
import QualificationNode from "./node/qualification";
|
|
@@ -99,7 +99,6 @@ import {
|
|
|
99
99
|
THEOREM_RULE_NAME,
|
|
100
100
|
PREMISE_RULE_NAME,
|
|
101
101
|
SECTION_RULE_NAME,
|
|
102
|
-
NONSENSE_RULE_NAME,
|
|
103
102
|
ARGUMENT_RULE_NAME,
|
|
104
103
|
SUBPROOF_RULE_NAME,
|
|
105
104
|
PROPERTY_RULE_NAME,
|
|
@@ -130,6 +129,7 @@ import {
|
|
|
130
129
|
CONSTRUCTOR_RULE_NAME,
|
|
131
130
|
METATHEOREM_RULE_NAME,
|
|
132
131
|
EQUIVALENCE_RULE_NAME,
|
|
132
|
+
EQUIVALENCES_RULE_NAME,
|
|
133
133
|
AXIOM_HEADER_RULE_NAME,
|
|
134
134
|
LEMMA_HEADER_RULE_NAME,
|
|
135
135
|
THEOREM_BODY_RULE_NAME,
|
|
@@ -188,7 +188,6 @@ const NonTerminalNodeMap = {
|
|
|
188
188
|
[SUBPROOF_RULE_NAME]: SubproofNode,
|
|
189
189
|
[EQUALITY_RULE_NAME]: EqualityNode,
|
|
190
190
|
[VARIABLE_RULE_NAME]: VariableNode,
|
|
191
|
-
[NONSENSE_RULE_NAME]: NonsenseNode,
|
|
192
191
|
[DOCUMENT_RULE_NAME]: DocumentNode,
|
|
193
192
|
[RULE_BODY_RULE_NAME]: RuleBodyNode,
|
|
194
193
|
[META_TYPE_RULE_NAME]: MetaTypeNode,
|
|
@@ -218,6 +217,7 @@ const NonTerminalNodeMap = {
|
|
|
218
217
|
[LEMMA_HEADER_RULE_NAME]: LemmaHeaderNode,
|
|
219
218
|
[THEOREM_BODY_RULE_NAME]: TheoremBodyNode,
|
|
220
219
|
[METAVARIABLE_RULE_NAME]: MetavariableNode,
|
|
220
|
+
[EQUIVALENCES_RULE_NAME]: EquivalencesNode,
|
|
221
221
|
[META_ARGUMENT_RULE_NAME]: MetaArgumentNode,
|
|
222
222
|
[QUALIFICATION_RULE_NAME]: QualificationNode,
|
|
223
223
|
[TYPE_ASSERTION_RULE_NAME]: TypeAssertionNode,
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import nominalContext from "../context/nominal";
|
|
4
|
-
|
|
5
3
|
import { ruleFromBNF } from "../utilities/bnf";
|
|
6
|
-
import { BASE_TYPE_SYMBOL } from "../constants";
|
|
7
|
-
import { STATEMENT_META_TYPE_NAME } from "../metaTypeNames";
|
|
8
4
|
|
|
9
5
|
const termPlaceholderBNF = ` _ ::= term... <END_OF_LINE> ; `,
|
|
10
6
|
variablePlaceholderBNF = ` _ ::= variable... <END_OF_LINE> ; `,
|
|
7
|
+
referencePlaceholderBNF = ` _ ::= reference... <END_OF_LINE> ; `,
|
|
11
8
|
statementPlaceholderBNF = ` _ ::= statement... <END_OF_LINE> ; `,
|
|
12
9
|
equivalencePlaceholderBNF = ` _ ::= equivalence... <END_OF_LINE> ; `,
|
|
13
10
|
metavariablePlaceholderBNF = ` _ ::= metavariable... <END_OF_LINE> ; `,
|
|
@@ -17,6 +14,7 @@ const termPlaceholderBNF = ` _ ::= term... <END_OF_LINE> ; `,
|
|
|
17
14
|
referenceSubstitutionPlaceholderBNF = ` _ ::= referenceSubstitution... <END_OF_LINE> ; `,
|
|
18
15
|
termPlaceholderRule = ruleFromBNF(termPlaceholderBNF),
|
|
19
16
|
variablePlaceholderRule = ruleFromBNF(variablePlaceholderBNF),
|
|
17
|
+
referencePlaceholderRule = ruleFromBNF(referencePlaceholderBNF),
|
|
20
18
|
statementPlaceholderRule = ruleFromBNF(statementPlaceholderBNF),
|
|
21
19
|
equivalencePlaceholderRule = ruleFromBNF(equivalencePlaceholderBNF),
|
|
22
20
|
metavariablePlaceholderRule = ruleFromBNF(metavariablePlaceholderBNF),
|
|
@@ -25,16 +23,12 @@ const termPlaceholderBNF = ` _ ::= term... <END_OF_LINE> ; `,
|
|
|
25
23
|
statementSubstitutionPlaceholderRule = ruleFromBNF(statementSubstitutionPlaceholderBNF),
|
|
26
24
|
referenceSubstitutionPlaceholderRule = ruleFromBNF(referenceSubstitutionPlaceholderBNF);
|
|
27
25
|
|
|
28
|
-
let bracketedConstructorTermNode = null,
|
|
29
|
-
bracketedCombinatorStatementNode = null;
|
|
30
|
-
|
|
31
|
-
export const bracketedConstructorTermString = `(${BASE_TYPE_SYMBOL})`;
|
|
32
|
-
export const bracketedCombinatorStatementString = `(${STATEMENT_META_TYPE_NAME})`;
|
|
33
|
-
|
|
34
26
|
export function instantiateTerm(string, context) { return instantiate(termPlaceholderRule, string, context); }
|
|
35
27
|
|
|
36
28
|
export function instantiateVariable(string, context) { return instantiate(variablePlaceholderRule, string, context); }
|
|
37
29
|
|
|
30
|
+
export function instantiateReference(string, context) { return instantiate(referencePlaceholderRule, string, context); }
|
|
31
|
+
|
|
38
32
|
export function instantiateStatement(string, context) { return instantiate(statementPlaceholderRule, string, context); }
|
|
39
33
|
|
|
40
34
|
export function instantiateEquivalence(string, context) { return instantiate(equivalencePlaceholderRule, string, context); }
|
|
@@ -49,32 +43,6 @@ export function instantiateStatementSubstitution(string, context) { return insta
|
|
|
49
43
|
|
|
50
44
|
export function instantiateReferenceSubstitution(string, context) { return instantiate(referenceSubstitutionPlaceholderRule, string, context); }
|
|
51
45
|
|
|
52
|
-
export function instantiateBracketedConstructorTerm() {
|
|
53
|
-
if (bracketedConstructorTermNode === null) {
|
|
54
|
-
const placeholderRule = termPlaceholderRule, ///
|
|
55
|
-
string = bracketedConstructorTermString,
|
|
56
|
-
context = nominalContext, ///
|
|
57
|
-
node = instantiate(placeholderRule, string, context);
|
|
58
|
-
|
|
59
|
-
bracketedConstructorTermNode = node; ///
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return bracketedConstructorTermNode;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export function instantiateBracketedCombinatorStatement() {
|
|
66
|
-
if (bracketedCombinatorStatementNode === null) {
|
|
67
|
-
const placeholderRule = statementPlaceholderRule, ///
|
|
68
|
-
string = bracketedCombinatorStatementString, ///
|
|
69
|
-
context = nominalContext, ///
|
|
70
|
-
node = instantiate(placeholderRule, string, context);
|
|
71
|
-
|
|
72
|
-
bracketedCombinatorStatementNode = node; ///
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return bracketedCombinatorStatementNode;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
46
|
function instantiate(placeholderRule, string, context) {
|
|
79
47
|
let node;
|
|
80
48
|
|