occam-verify-cli 1.0.892 → 1.0.895
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/nominal.js +9 -3
- package/lib/context/mnemic.js +68 -8
- package/lib/context/synoptic.js +33 -1
- package/lib/context.js +11 -1
- package/lib/element/assertion/property.js +7 -7
- package/lib/element/declaration/complexType.js +2 -2
- package/lib/element/declaration/property.js +5 -3
- package/lib/element/declaration/simpleType.js +2 -2
- package/lib/element/property.js +50 -52
- package/lib/element/propertyRelation.js +37 -15
- package/lib/utilities/element.js +86 -14
- package/lib/utilities/json.js +10 -24
- package/lib/utilities/synoptic.js +23 -1
- package/package.json +1 -1
- package/src/context/file/nominal.js +10 -2
- package/src/context/mnemic.js +123 -14
- package/src/context/synoptic.js +49 -1
- package/src/context.js +16 -0
- package/src/element/assertion/property.js +6 -6
- package/src/element/declaration/complexType.js +1 -2
- package/src/element/declaration/property.js +6 -3
- package/src/element/declaration/simpleType.js +1 -2
- package/src/element/property.js +70 -64
- package/src/element/propertyRelation.js +54 -14
- package/src/utilities/element.js +91 -28
- package/src/utilities/json.js +16 -28
- package/src/utilities/synoptic.js +21 -1
package/src/element/property.js
CHANGED
|
@@ -6,22 +6,22 @@ import { define } from "../elements";
|
|
|
6
6
|
import { instantiate } from "../utilities/context";
|
|
7
7
|
import { instantiateProperty } from "../process/instantiate";
|
|
8
8
|
import { nameFromPropertyNode } from "../utilities/element";
|
|
9
|
-
import {
|
|
9
|
+
import { typeFromJSON, typeToTypeJSON } from "../utilities/json";
|
|
10
10
|
|
|
11
11
|
export default define(class Property extends Element {
|
|
12
|
-
constructor(context, string, node, lineIndex, name,
|
|
12
|
+
constructor(context, string, node, lineIndex, name, type) {
|
|
13
13
|
super(context, string, node, lineIndex);
|
|
14
14
|
|
|
15
15
|
this.name = name;
|
|
16
|
-
this.
|
|
16
|
+
this.type = type;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
getName() {
|
|
20
20
|
return this.name;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
return this.
|
|
23
|
+
getType() {
|
|
24
|
+
return this.type;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
getPropertyNode() {
|
|
@@ -31,16 +31,34 @@ export default define(class Property extends Element {
|
|
|
31
31
|
return properetyNode;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
setName(name) {
|
|
35
|
+
this.name = name;
|
|
36
|
+
}
|
|
36
37
|
|
|
37
|
-
|
|
38
|
+
setType(type) {
|
|
39
|
+
this.type = type;
|
|
38
40
|
}
|
|
39
41
|
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
+
isEqualTo(property) {
|
|
43
|
+
const propertyNode = property.getNode(),
|
|
44
|
+
propertyNodeMatches = this.matchPropertyNode(propertyNode),
|
|
45
|
+
equalTo = propertyNodeMatches; ///
|
|
42
46
|
|
|
43
|
-
return
|
|
47
|
+
return equalTo;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
matchPropertyNode(propertyNode) {
|
|
51
|
+
const node = propertyNode, ///
|
|
52
|
+
nodeMatches = this.matchNode(node),
|
|
53
|
+
propertyNodeMatches = nodeMatches; ///
|
|
54
|
+
|
|
55
|
+
return propertyNodeMatches;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
comparePropertyName(propertyName) {
|
|
59
|
+
const comparesToPropertyName = (this.name === propertyName);
|
|
60
|
+
|
|
61
|
+
return comparesToPropertyName;
|
|
44
62
|
}
|
|
45
63
|
|
|
46
64
|
verify(properties, context) {
|
|
@@ -53,11 +71,7 @@ export default define(class Property extends Element {
|
|
|
53
71
|
const naemVerifies = this.verifyName(properties, context);
|
|
54
72
|
|
|
55
73
|
if (naemVerifies) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
if (nominalTypeNameVerifies) {
|
|
59
|
-
verifies = true;
|
|
60
|
-
}
|
|
74
|
+
verifies = true;
|
|
61
75
|
}
|
|
62
76
|
|
|
63
77
|
if (verifies) {
|
|
@@ -76,41 +90,21 @@ export default define(class Property extends Element {
|
|
|
76
90
|
|
|
77
91
|
const propertyName = this.name, ///
|
|
78
92
|
count = properties.reduce((count, property) => {
|
|
79
|
-
|
|
93
|
+
if (property !== this) {
|
|
94
|
+
const propertyComparesToPropertyName = property.comparePropertyName(propertyName);
|
|
80
95
|
|
|
81
|
-
|
|
82
|
-
|
|
96
|
+
if (propertyComparesToPropertyName) {
|
|
97
|
+
count++;
|
|
98
|
+
}
|
|
83
99
|
}
|
|
84
100
|
|
|
85
101
|
return count;
|
|
86
102
|
}, 0);
|
|
87
103
|
|
|
88
|
-
if (count
|
|
89
|
-
|
|
104
|
+
if (count === 0) {
|
|
105
|
+
naemVerifies = true;
|
|
90
106
|
} else {
|
|
91
|
-
|
|
92
|
-
superType = superTypes.find((superType) => {
|
|
93
|
-
const superTypeProperties = superType.getProperties(),
|
|
94
|
-
superTypePropertyComparesToPropertyName = superTypeProperties.some((superTypeProperty) => {
|
|
95
|
-
const superTypePropertyComparesToPropertyName = superTypeProperty.comparePropertyName(propertyName);
|
|
96
|
-
|
|
97
|
-
if (superTypePropertyComparesToPropertyName) {
|
|
98
|
-
return true;
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
if (superTypePropertyComparesToPropertyName) {
|
|
103
|
-
return true;
|
|
104
|
-
}
|
|
105
|
-
}) || null;
|
|
106
|
-
|
|
107
|
-
if (superType !== null) {
|
|
108
|
-
const superTypeString = superType.getString();
|
|
109
|
-
|
|
110
|
-
context.debug(`The '${superTypeString}' super-type has the same property.`);
|
|
111
|
-
} else {
|
|
112
|
-
naemVerifies = true;
|
|
113
|
-
}
|
|
107
|
+
context.debug(`The '${propertyString}' property appears more than once.`);
|
|
114
108
|
}
|
|
115
109
|
|
|
116
110
|
if (naemVerifies) {
|
|
@@ -120,41 +114,53 @@ export default define(class Property extends Element {
|
|
|
120
114
|
return naemVerifies;
|
|
121
115
|
}
|
|
122
116
|
|
|
123
|
-
|
|
124
|
-
|
|
117
|
+
findValidProperty(context) {
|
|
118
|
+
const propertyNode = this.getPropertyNode(),
|
|
119
|
+
property = context.findPropertyByPropertyNode(propertyNode),
|
|
120
|
+
validProperty = property; ///
|
|
125
121
|
|
|
126
|
-
|
|
122
|
+
return validProperty;
|
|
123
|
+
}
|
|
127
124
|
|
|
128
|
-
|
|
125
|
+
validate(context) {
|
|
126
|
+
let property = null;
|
|
129
127
|
|
|
130
|
-
const
|
|
128
|
+
const propertyString = this.getString(); ///
|
|
131
129
|
|
|
132
|
-
|
|
133
|
-
|
|
130
|
+
context.trace(`Validating the '${propertyString}' property...`);
|
|
131
|
+
|
|
132
|
+
const validProperty = this.findValidProperty(context);
|
|
133
|
+
|
|
134
|
+
if (validProperty) {
|
|
135
|
+
property = validProperty; ///
|
|
136
|
+
|
|
137
|
+
context.debug(`...the '${propertyString}' property is already valid.`);
|
|
134
138
|
} else {
|
|
135
|
-
|
|
139
|
+
let validates = false;
|
|
136
140
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
+
debugger
|
|
142
|
+
|
|
143
|
+
if (validates) {
|
|
144
|
+
const property = this; ///
|
|
141
145
|
|
|
142
|
-
|
|
143
|
-
|
|
146
|
+
context.addProperty(property);
|
|
147
|
+
|
|
148
|
+
context.debug(`...validated the '${propertyString}' property.`);
|
|
149
|
+
}
|
|
144
150
|
}
|
|
145
151
|
|
|
146
|
-
return
|
|
152
|
+
return property;
|
|
147
153
|
}
|
|
148
154
|
|
|
149
155
|
toJSON() {
|
|
150
|
-
const
|
|
151
|
-
nominalTypeName = nominalTypeNameJSON, ///
|
|
156
|
+
const typeJSON = typeToTypeJSON(this.type),
|
|
152
157
|
string = this.getString(),
|
|
153
158
|
lineIndex = this.getLineIndex(),
|
|
159
|
+
type = typeJSON, ///
|
|
154
160
|
json = {
|
|
155
161
|
string,
|
|
156
162
|
lineIndex,
|
|
157
|
-
|
|
163
|
+
type
|
|
158
164
|
};
|
|
159
165
|
|
|
160
166
|
return json;
|
|
@@ -168,11 +174,11 @@ export default define(class Property extends Element {
|
|
|
168
174
|
propertyNode = instantiateProperty(string, context),
|
|
169
175
|
node = propertyNode, ///
|
|
170
176
|
name = nameFromPropertyNode(propertyNode, context),
|
|
171
|
-
|
|
177
|
+
type = typeFromJSON(json, context);
|
|
172
178
|
|
|
173
179
|
context = null;
|
|
174
180
|
|
|
175
|
-
const property = new Property(context, string, node, lineIndex, name,
|
|
181
|
+
const property = new Property(context, string, node, lineIndex, name, type);
|
|
176
182
|
|
|
177
183
|
return property;
|
|
178
184
|
}, context);
|
|
@@ -30,34 +30,74 @@ export default define(class PropertyRelation extends Element {
|
|
|
30
30
|
return propertyRelationNode;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
isEqualTo(propertyRelation) {
|
|
34
|
+
const propertyRelationNode = propertyRelation.getNode(),
|
|
35
|
+
propertyRelationNodeMatches = this.matchPropertyRelationNode(propertyRelationNode),
|
|
36
|
+
equalTo = propertyRelationNodeMatches; ///
|
|
37
|
+
|
|
38
|
+
return equalTo;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
matchPropertyRelationNode(propertyRelationNode) {
|
|
42
|
+
const node = propertyRelationNode, ///
|
|
43
|
+
nodeMatches = this.matchNode(node),
|
|
44
|
+
propertyRelationNodeMatches = nodeMatches; ///
|
|
45
|
+
|
|
46
|
+
return propertyRelationNodeMatches;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
findValidPropertyRelation(context) {
|
|
50
|
+
const propertyRelationNode = this.getPropertyRelationNode(),
|
|
51
|
+
propertyRelation = context.findPropertyRelationByPropertyRelationNode(propertyRelationNode),
|
|
52
|
+
validPropertyRelation = propertyRelation; ///
|
|
53
|
+
|
|
54
|
+
return validPropertyRelation;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
validate(context) {
|
|
58
|
+
let propertyRelation = null;
|
|
35
59
|
|
|
36
60
|
const propertyRelationString = this.getString(); ///
|
|
37
61
|
|
|
38
|
-
context.trace(`
|
|
62
|
+
context.trace(`Validating the '${propertyRelationString}' property relation...`);
|
|
39
63
|
|
|
40
|
-
const
|
|
64
|
+
const validPropertyRelation = this.findValidPropertyRelation(context);
|
|
41
65
|
|
|
42
|
-
if (
|
|
43
|
-
|
|
66
|
+
if (validPropertyRelation) {
|
|
67
|
+
propertyRelation = validPropertyRelation; ///
|
|
44
68
|
|
|
45
|
-
|
|
46
|
-
}
|
|
69
|
+
context.debug(`...the '${propertyRelationString}' property relation is already valid.`);
|
|
70
|
+
} else {
|
|
71
|
+
let validates = false;
|
|
72
|
+
|
|
73
|
+
const termValidates = this.validateTerm(context);
|
|
74
|
+
|
|
75
|
+
if (termValidates) {
|
|
76
|
+
const propertyVerifies = this.verifyProperty(context);
|
|
77
|
+
|
|
78
|
+
validates = propertyVerifies;
|
|
79
|
+
}
|
|
47
80
|
|
|
48
|
-
|
|
49
|
-
|
|
81
|
+
if (validates) {
|
|
82
|
+
const propertyRelation = this; ///
|
|
83
|
+
|
|
84
|
+
this.assign(context);
|
|
85
|
+
|
|
86
|
+
context.addPropertyRelation(propertyRelation);
|
|
87
|
+
|
|
88
|
+
context.debug(`...validated the '${propertyRelationString}' property relation.`);
|
|
89
|
+
}
|
|
50
90
|
}
|
|
51
91
|
|
|
52
|
-
return
|
|
92
|
+
return propertyRelation;
|
|
53
93
|
}
|
|
54
94
|
|
|
55
95
|
validateTerm(context) {
|
|
56
96
|
let termValidates = false;
|
|
57
97
|
|
|
58
|
-
const
|
|
98
|
+
const propertyRelationString = this.getString(); ///
|
|
59
99
|
|
|
60
|
-
context.trace(`Validating the '${
|
|
100
|
+
context.trace(`Validating the '${propertyRelationString}' property relation's term...`);
|
|
61
101
|
|
|
62
102
|
const term = this.term.validate(context, (term) => {
|
|
63
103
|
const validatesForwards = true;
|
|
@@ -72,7 +112,7 @@ export default define(class PropertyRelation extends Element {
|
|
|
72
112
|
}
|
|
73
113
|
|
|
74
114
|
if (termValidates) {
|
|
75
|
-
context.debug(`...validated the '${
|
|
115
|
+
context.debug(`...validated the '${propertyRelationString}' property relation's term.`);
|
|
76
116
|
}
|
|
77
117
|
|
|
78
118
|
return termValidates;
|
package/src/utilities/element.js
CHANGED
|
@@ -171,12 +171,15 @@ export function axiomFromAxiomNode(axiomNode, context) {
|
|
|
171
171
|
deduction = deductionFromTopLevelAssertionNode(topLevelAsssertionNode, context),
|
|
172
172
|
suppositions = suppositionsFromTopLevelAssertionNode(topLevelAsssertionNode, context),
|
|
173
173
|
signature = signatureFromTopLevelAssertionNode(topLevelAsssertionNode, context),
|
|
174
|
-
hypotheses =
|
|
174
|
+
hypotheses = hypothesesFromTopLevelAssertionNode(topLevelAsssertionNode, context),
|
|
175
175
|
topLevelAsssertionString = topLevelAssertionStringFromLabelsSuppositionsAndDeduction(labels, suppositions, deduction),
|
|
176
176
|
node = axiomNode, ///
|
|
177
177
|
string = topLevelAsssertionString, ///
|
|
178
|
-
lineIndex = null
|
|
179
|
-
|
|
178
|
+
lineIndex = null;
|
|
179
|
+
|
|
180
|
+
context = null;
|
|
181
|
+
|
|
182
|
+
const axiom = new Axiom(context, string, node, lineIndex, labels, suppositions, deduction, proof, signature, hypotheses);
|
|
180
183
|
|
|
181
184
|
return axiom;
|
|
182
185
|
}
|
|
@@ -220,7 +223,7 @@ export function theoremFromTheoremNode(theoremNode, context) {
|
|
|
220
223
|
deduction = deductionFromTopLevelAssertionNode(topLevelAsssertionNode, context),
|
|
221
224
|
suppositions = suppositionsFromTopLevelAssertionNode(topLevelAsssertionNode, context),
|
|
222
225
|
signature = signatureFromTopLevelAssertionNode(topLevelAsssertionNode, context),
|
|
223
|
-
hypotheses =
|
|
226
|
+
hypotheses = hypothesesFromTopLevelAssertionNode(topLevelAsssertionNode, context),
|
|
224
227
|
topLevelAsssertionString = topLevelAssertionStringFromLabelsSuppositionsAndDeduction(labels, suppositions, deduction),
|
|
225
228
|
node = theoremNode, ///
|
|
226
229
|
string = topLevelAsssertionString, ///
|
|
@@ -241,13 +244,12 @@ export function propertyFromPropertyNode(propertyNode, context) {
|
|
|
241
244
|
node = propertyNode, ///
|
|
242
245
|
string = context.nodeAsString(node),
|
|
243
246
|
lineIndex = null,
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
name = propertyName; ///
|
|
247
|
+
name = nameFromPropertyNode(propertyNode, context),
|
|
248
|
+
type = typeFromPropertyNode(propertyNode, context);
|
|
247
249
|
|
|
248
250
|
context = null;
|
|
249
251
|
|
|
250
|
-
property = new Property(context, string, node, lineIndex, name,
|
|
252
|
+
property = new Property(context, string, node, lineIndex, name, type);
|
|
251
253
|
}
|
|
252
254
|
|
|
253
255
|
return property;
|
|
@@ -258,9 +260,9 @@ export function variableFromVariableNode(variableNode, context) {
|
|
|
258
260
|
node = variableNode, ///
|
|
259
261
|
string = context.nodeAsString(node),
|
|
260
262
|
lineIndex = null,
|
|
261
|
-
type =
|
|
263
|
+
type = typeFromVariableNode(variableNode, context),
|
|
262
264
|
identifier = identifierFromVarialbeNode(variableNode, context),
|
|
263
|
-
propertyRelations =
|
|
265
|
+
propertyRelations = propertyRelationsFromVariableNode(variableNode, context);
|
|
264
266
|
|
|
265
267
|
context = null;
|
|
266
268
|
|
|
@@ -271,12 +273,12 @@ export function variableFromVariableNode(variableNode, context) {
|
|
|
271
273
|
|
|
272
274
|
export function subproofFromSubproofNode(subproofNode, context) {
|
|
273
275
|
const { Subproof } = elements,
|
|
274
|
-
node = subproofNode,
|
|
276
|
+
node = subproofNode, ///
|
|
277
|
+
lineIndex = null,
|
|
275
278
|
suppositions = suppositionsFromSubproofNode(subproofNode, context),
|
|
276
279
|
subDerivation = subDerivationFromSubproofNode(subproofNode, context),
|
|
277
280
|
subproofString = subproofStringFromSuppositionsAndSubDerivation(suppositions, subDerivation, context),
|
|
278
|
-
string = subproofString
|
|
279
|
-
lineIndex = null;
|
|
281
|
+
string = subproofString; ///
|
|
280
282
|
|
|
281
283
|
context = null;
|
|
282
284
|
|
|
@@ -390,8 +392,8 @@ export function parameterFromParameterNode(parameterNode, context) {
|
|
|
390
392
|
node = parameterNode, ///
|
|
391
393
|
string = context.nodeAsString(node),
|
|
392
394
|
lineIndex = null,
|
|
393
|
-
name = parameterNode
|
|
394
|
-
identifier = parameterNode
|
|
395
|
+
name = nameFromParamterNode(parameterNode, context),
|
|
396
|
+
identifier = identifierFromParamterNode(parameterNode, context);
|
|
395
397
|
|
|
396
398
|
context = null;
|
|
397
399
|
|
|
@@ -436,7 +438,7 @@ export function conjectureFromConjectureNode(conjectureNode, context) {
|
|
|
436
438
|
deduction = deductionFromTopLevelAssertionNode(topLevelAsssertionNode, context),
|
|
437
439
|
suppositions = suppositionsFromTopLevelAssertionNode(topLevelAsssertionNode, context),
|
|
438
440
|
signature = signatureFromTopLevelAssertionNode(topLevelAsssertionNode, context),
|
|
439
|
-
hypotheses =
|
|
441
|
+
hypotheses = hypothesesFromTopLevelAssertionNode(topLevelAsssertionNode, context),
|
|
440
442
|
topLevelAsssertionString = topLevelAssertionStringFromLabelsSuppositionsAndDeduction(labels, suppositions, deduction),
|
|
441
443
|
node = conjectureNode, ///
|
|
442
444
|
string = topLevelAsssertionString, ///
|
|
@@ -746,9 +748,9 @@ export function containedAssertionFromContainedAssertionNode(containedAssertionN
|
|
|
746
748
|
node = containedAssertionNode, ///
|
|
747
749
|
string = context.nodeAsString(node),
|
|
748
750
|
lineIndex = null,
|
|
749
|
-
negated = containedAssertionNode.isNegated(),
|
|
750
751
|
term = termFromContainedAssertionNode(containedAssertionNode, context),
|
|
751
752
|
frame = frameFromContainedAssertionNode(containedAssertionNode, context),
|
|
753
|
+
negated = negatedFromContainedAssertionNode(containedAssertionNode, context),
|
|
752
754
|
statement = statementFromContainedAssertionNode(containedAssertionNode, context);
|
|
753
755
|
|
|
754
756
|
context = null;
|
|
@@ -792,10 +794,8 @@ export function propertyDeclarationFromPropertyDeclarationNode(propertyDeclarati
|
|
|
792
794
|
node = propertyDeclarationNode, ///
|
|
793
795
|
string = context.nodeAsString(node),
|
|
794
796
|
lineIndex = null,
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
type = typeFromTypeNode(typeNode, context),
|
|
798
|
-
property = propertyFromPropertyNode(propertyNode, context);
|
|
797
|
+
type = typeFromPropertyDeclarationNode(propertyDeclarationNode, context),
|
|
798
|
+
property = propertyFromPropertyDeclarationNode(propertyDeclarationNode, context);
|
|
799
799
|
|
|
800
800
|
context = null;
|
|
801
801
|
|
|
@@ -809,11 +809,9 @@ export function variableDeclarationFromVariableDeclarationNode(variableDeclarati
|
|
|
809
809
|
node = variableDeclarationNode, ///
|
|
810
810
|
string = context.nodeAsString(node),
|
|
811
811
|
lineIndex = null,
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
type = typeFromTypeNode(typeNode, context),
|
|
816
|
-
variable = variableFromVariableNode(variableNode, context);
|
|
812
|
+
type = typeFromVariableDeclarationNode(variableDeclarationNode, context),
|
|
813
|
+
variable = variableFromVariableDeclarationNode(variableDeclarationNode, context),
|
|
814
|
+
provisional = provisionalFromVariableDeclarationNode(variableDeclarationNode, context);
|
|
817
815
|
|
|
818
816
|
context = null;
|
|
819
817
|
|
|
@@ -1065,7 +1063,26 @@ export function lemmaFromSectionNode(sectionNode, context) {
|
|
|
1065
1063
|
}
|
|
1066
1064
|
|
|
1067
1065
|
export function nameFromPropertyNode(propertyNode, context) {
|
|
1068
|
-
const
|
|
1066
|
+
const propertyName = propertyNode.getPropertyName(),
|
|
1067
|
+
name = propertyName;
|
|
1068
|
+
|
|
1069
|
+
return name;
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
export function typeFromPropertyNode(propertyNode, context) {
|
|
1073
|
+
const type = null; ///
|
|
1074
|
+
|
|
1075
|
+
return type;
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
export function typeFromVariableNode(variableNode, context) {
|
|
1079
|
+
const type = null;
|
|
1080
|
+
|
|
1081
|
+
return type;
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
export function nameFromParamterNode(parameterNode, context) {
|
|
1085
|
+
const name = parameterNode.getName();
|
|
1069
1086
|
|
|
1070
1087
|
return name;
|
|
1071
1088
|
}
|
|
@@ -1329,6 +1346,12 @@ export function identifierFromVarialbeNode(variableNode, context) {
|
|
|
1329
1346
|
return identifier;
|
|
1330
1347
|
}
|
|
1331
1348
|
|
|
1349
|
+
export function identifierFromParamterNode(parameterNode, context) {
|
|
1350
|
+
const identifier = parameterNode.getIdentifier();
|
|
1351
|
+
|
|
1352
|
+
return identifier;
|
|
1353
|
+
}
|
|
1354
|
+
|
|
1332
1355
|
export function statementFromDeductionNode(deductionNode, context) {
|
|
1333
1356
|
let statement = null;
|
|
1334
1357
|
|
|
@@ -1653,6 +1676,20 @@ export function labelsFromTopLevelAssertionNode(topLevelAsssertionNode, context)
|
|
|
1653
1676
|
return labels;
|
|
1654
1677
|
}
|
|
1655
1678
|
|
|
1679
|
+
export function typeFromPropertyDeclarationNode(propertyDeclarationNode, context) {
|
|
1680
|
+
const typeNode = propertyDeclarationNode.getTypeNode(),
|
|
1681
|
+
type = typeFromTypeNode(typeNode, context);
|
|
1682
|
+
|
|
1683
|
+
return type;
|
|
1684
|
+
}
|
|
1685
|
+
|
|
1686
|
+
export function typeFromVariableDeclarationNode(variableDeclarationNode, context) {
|
|
1687
|
+
const typeNode = variableDeclarationNode.getTypeNode(),
|
|
1688
|
+
type = typeFromTypeNode(typeNode, context);
|
|
1689
|
+
|
|
1690
|
+
return type;
|
|
1691
|
+
}
|
|
1692
|
+
|
|
1656
1693
|
export function procedureCallFromSuppositionNode(suppositionNode, context) {
|
|
1657
1694
|
let procedureCall = null;
|
|
1658
1695
|
|
|
@@ -1672,7 +1709,7 @@ export function negatedFromJDefinedAssertionNode(definedAssertionNode, context)
|
|
|
1672
1709
|
}
|
|
1673
1710
|
|
|
1674
1711
|
export function propertyFromPropertyRelationNode(propertyRelationNode, context) {
|
|
1675
|
-
const propertyNode = propertyRelationNode.
|
|
1712
|
+
const propertyNode = propertyRelationNode.getPropertyNode(),
|
|
1676
1713
|
property = propertyFromPropertyNode(propertyNode, context);
|
|
1677
1714
|
|
|
1678
1715
|
return property;
|
|
@@ -1692,6 +1729,12 @@ export function typeFromBracketedConstructorNode(bracketedCcnstructorNode, conte
|
|
|
1692
1729
|
return type;
|
|
1693
1730
|
}
|
|
1694
1731
|
|
|
1732
|
+
export function propertyRelationsFromVariableNode(variableNode, context) {
|
|
1733
|
+
const propertyRelations = [];
|
|
1734
|
+
|
|
1735
|
+
return propertyRelations;
|
|
1736
|
+
}
|
|
1737
|
+
|
|
1695
1738
|
export function definedAssertionFromStatementNode(statementNode, context) {
|
|
1696
1739
|
let definedAssertion = null;
|
|
1697
1740
|
|
|
@@ -1855,6 +1898,20 @@ export function hypothesesFromTopLevelAssertionNode(topLevelAsssertionNode, cont
|
|
|
1855
1898
|
return ypotheses;
|
|
1856
1899
|
}
|
|
1857
1900
|
|
|
1901
|
+
export function propertyFromPropertyDeclarationNode(propertyDeclarationNode, context) {
|
|
1902
|
+
const propertyNode = propertyDeclarationNode.getPropertyNode(),
|
|
1903
|
+
property = propertyFromPropertyNode(propertyNode, context);
|
|
1904
|
+
|
|
1905
|
+
return property;
|
|
1906
|
+
}
|
|
1907
|
+
|
|
1908
|
+
export function variableFromVariableDeclarationNode(variableDeclarationNode, context) {
|
|
1909
|
+
const variableNode = variableDeclarationNode.getVariableNode(),
|
|
1910
|
+
variable = variableFromVariableNode(variableNode, context);
|
|
1911
|
+
|
|
1912
|
+
return variable;
|
|
1913
|
+
}
|
|
1914
|
+
|
|
1858
1915
|
export function statementFromBracketedCombinatorNode(bracketedCombinatorNode, context) {
|
|
1859
1916
|
const statementNode = bracketedCombinatorNode.getStatementNode(),
|
|
1860
1917
|
statement = statementFromStatementNode(statementNode, context);
|
|
@@ -1927,6 +1984,12 @@ export function deductionFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode,
|
|
|
1927
1984
|
return deduction;
|
|
1928
1985
|
}
|
|
1929
1986
|
|
|
1987
|
+
export function provisionalFromVariableDeclarationNode(variableDeclarationNode, context) {
|
|
1988
|
+
const provisional = variableDeclarationNode.isProvisional();
|
|
1989
|
+
|
|
1990
|
+
return provisional;
|
|
1991
|
+
}
|
|
1992
|
+
|
|
1930
1993
|
export function procedureReferenceFromProcedureCallNode(procedureCallNode, context) {
|
|
1931
1994
|
const procedureReferenceNode = procedureCallNode.getProcedureReferenceNode(),
|
|
1932
1995
|
procedureReference = procedureReferenceFromProcedureReferenceNode(procedureReferenceNode, context);
|
package/src/utilities/json.js
CHANGED
|
@@ -221,12 +221,6 @@ export function procedureCallFromJSON(json, context) {
|
|
|
221
221
|
return procedureCall;
|
|
222
222
|
}
|
|
223
223
|
|
|
224
|
-
export function nominalTypeNameFromJSON(json, context) {
|
|
225
|
-
const { nominalTypeName } = json;
|
|
226
|
-
|
|
227
|
-
return nominalTypeName;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
224
|
export function procedureReferenceFromJSON(json, context) {
|
|
231
225
|
let { procedureReference } = json;
|
|
232
226
|
|
|
@@ -381,22 +375,6 @@ export function variablesFromJSON(json, context) {
|
|
|
381
375
|
return variables;
|
|
382
376
|
}
|
|
383
377
|
|
|
384
|
-
export function equalitiesFromJSON(json, context) {
|
|
385
|
-
let { equalities } = json;
|
|
386
|
-
|
|
387
|
-
const { Equality } = elements,
|
|
388
|
-
equalitiesJSON = equalities; ///
|
|
389
|
-
|
|
390
|
-
equalities = equalitiesJSON.map((equalityJSON) => {
|
|
391
|
-
const json = equalityJSON, ///
|
|
392
|
-
equality = Equality.fromJSON(json, context);
|
|
393
|
-
|
|
394
|
-
return equality;
|
|
395
|
-
});
|
|
396
|
-
|
|
397
|
-
return equalities;
|
|
398
|
-
}
|
|
399
|
-
|
|
400
378
|
export function propertiesFromJSON(json, context) {
|
|
401
379
|
let { properties } = json;
|
|
402
380
|
|
|
@@ -413,6 +391,22 @@ export function propertiesFromJSON(json, context) {
|
|
|
413
391
|
return properties;
|
|
414
392
|
}
|
|
415
393
|
|
|
394
|
+
export function equalitiesFromJSON(json, context) {
|
|
395
|
+
let { equalities } = json;
|
|
396
|
+
|
|
397
|
+
const { Equality } = elements,
|
|
398
|
+
equalitiesJSON = equalities; ///
|
|
399
|
+
|
|
400
|
+
equalities = equalitiesJSON.map((equalityJSON) => {
|
|
401
|
+
const json = equalityJSON, ///
|
|
402
|
+
equality = Equality.fromJSON(json, context);
|
|
403
|
+
|
|
404
|
+
return equality;
|
|
405
|
+
});
|
|
406
|
+
|
|
407
|
+
return equalities;
|
|
408
|
+
}
|
|
409
|
+
|
|
416
410
|
export function superTypesFromJSON(json, context) {
|
|
417
411
|
const { superTypes: superTypesJSON } = json;
|
|
418
412
|
|
|
@@ -877,12 +871,6 @@ export function procedureCallToProcedureCallJSON(procedureCall) {
|
|
|
877
871
|
return procedureCallJSON;
|
|
878
872
|
}
|
|
879
873
|
|
|
880
|
-
export function nominalTypeNameToNominalTypeNameJSON(nominalTypeName) {
|
|
881
|
-
const nominalTypeNameJSON = nominalTypeName; ///
|
|
882
|
-
|
|
883
|
-
return nominalTypeNameJSON;
|
|
884
|
-
}
|
|
885
|
-
|
|
886
874
|
export function mnemicContextToMnemicContextJSON(mnemicContext) {
|
|
887
875
|
const mnemicContextJSON = mnemicContext.toJSON();
|
|
888
876
|
|
|
@@ -24,6 +24,16 @@ export function compressFrames(frames) {
|
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
export function compressProperties(properties) {
|
|
28
|
+
compress(properties, (propertyA, propertyB) => {
|
|
29
|
+
const propertyAEqualToPropertyB = propertyA.isEqualTo(propertyB);
|
|
30
|
+
|
|
31
|
+
if (!propertyAEqualToPropertyB) {
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
27
37
|
export function compressEqualities(equalities) {
|
|
28
38
|
compress(equalities, (equalityA, equalityB) => {
|
|
29
39
|
const equalityAEqualToEqualityB = equalityA.isEqualTo(equalityB);
|
|
@@ -102,4 +112,14 @@ export function compressSubstitutions(substitutions) {
|
|
|
102
112
|
return true;
|
|
103
113
|
}
|
|
104
114
|
});
|
|
105
|
-
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export function compressPropertyRelations(propertyRelations) {
|
|
118
|
+
compress(propertyRelations, (propertyRelationA, propertyRelationB) => {
|
|
119
|
+
const propertyRelationAEqualToPropertyRelationB = propertyRelationA.isEqualTo(propertyRelationB);
|
|
120
|
+
|
|
121
|
+
if (!propertyRelationAEqualToPropertyRelationB) {
|
|
122
|
+
return true;
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}
|