occam-verify-cli 1.0.890 → 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 +93 -134
- package/lib/element/declaration/property.js +81 -0
- package/lib/element/declaration/simpleType.js +8 -9
- package/lib/element/declaration/typePrefix.js +2 -27
- package/lib/element/metavariable.js +4 -4
- package/lib/element/property.js +81 -12
- package/lib/element/propertyRelation.js +37 -15
- package/lib/element/statement.js +2 -2
- package/lib/element/substitution/statement.js +2 -2
- package/lib/element/typePrefix.js +26 -1
- package/lib/preamble.js +2 -1
- package/lib/utilities/element.js +119 -18
- package/lib/utilities/json.js +10 -24
- package/lib/utilities/string.js +20 -2
- 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 +110 -168
- package/src/element/declaration/property.js +99 -0
- package/src/element/declaration/simpleType.js +8 -15
- package/src/element/declaration/typePrefix.js +1 -38
- package/src/element/metavariable.js +3 -3
- package/src/element/property.js +122 -13
- package/src/element/propertyRelation.js +54 -14
- package/src/element/statement.js +1 -1
- package/src/element/substitution/statement.js +1 -1
- package/src/element/typePrefix.js +36 -0
- package/src/preamble.js +1 -0
- package/src/utilities/element.js +139 -36
- package/src/utilities/json.js +16 -28
- package/src/utilities/string.js +37 -12
- package/src/utilities/synoptic.js +21 -1
package/src/utilities/element.js
CHANGED
|
@@ -10,7 +10,8 @@ import { equivalenceStringFromTerms,
|
|
|
10
10
|
subproofStringFromSuppositionsAndSubDerivation,
|
|
11
11
|
procedureCallStringFromProcedureReferenceAndParameters,
|
|
12
12
|
topLevelAssertionStringFromLabelsSuppositionsAndDeduction,
|
|
13
|
-
topLevelMetaAssertionStringFromLabelSuppositionsAndDeduction
|
|
13
|
+
topLevelMetaAssertionStringFromLabelSuppositionsAndDeduction,
|
|
14
|
+
complexTypeDeclarationStringFromTypeSuperTypesAndProvisional } from "../utilities/string";
|
|
14
15
|
|
|
15
16
|
export function typeFromTypeNode(typeNode, context) {
|
|
16
17
|
let type;
|
|
@@ -170,12 +171,15 @@ export function axiomFromAxiomNode(axiomNode, context) {
|
|
|
170
171
|
deduction = deductionFromTopLevelAssertionNode(topLevelAsssertionNode, context),
|
|
171
172
|
suppositions = suppositionsFromTopLevelAssertionNode(topLevelAsssertionNode, context),
|
|
172
173
|
signature = signatureFromTopLevelAssertionNode(topLevelAsssertionNode, context),
|
|
173
|
-
hypotheses =
|
|
174
|
+
hypotheses = hypothesesFromTopLevelAssertionNode(topLevelAsssertionNode, context),
|
|
174
175
|
topLevelAsssertionString = topLevelAssertionStringFromLabelsSuppositionsAndDeduction(labels, suppositions, deduction),
|
|
175
176
|
node = axiomNode, ///
|
|
176
177
|
string = topLevelAsssertionString, ///
|
|
177
|
-
lineIndex = null
|
|
178
|
-
|
|
178
|
+
lineIndex = null;
|
|
179
|
+
|
|
180
|
+
context = null;
|
|
181
|
+
|
|
182
|
+
const axiom = new Axiom(context, string, node, lineIndex, labels, suppositions, deduction, proof, signature, hypotheses);
|
|
179
183
|
|
|
180
184
|
return axiom;
|
|
181
185
|
}
|
|
@@ -219,7 +223,7 @@ export function theoremFromTheoremNode(theoremNode, context) {
|
|
|
219
223
|
deduction = deductionFromTopLevelAssertionNode(topLevelAsssertionNode, context),
|
|
220
224
|
suppositions = suppositionsFromTopLevelAssertionNode(topLevelAsssertionNode, context),
|
|
221
225
|
signature = signatureFromTopLevelAssertionNode(topLevelAsssertionNode, context),
|
|
222
|
-
hypotheses =
|
|
226
|
+
hypotheses = hypothesesFromTopLevelAssertionNode(topLevelAsssertionNode, context),
|
|
223
227
|
topLevelAsssertionString = topLevelAssertionStringFromLabelsSuppositionsAndDeduction(labels, suppositions, deduction),
|
|
224
228
|
node = theoremNode, ///
|
|
225
229
|
string = topLevelAsssertionString, ///
|
|
@@ -233,17 +237,20 @@ export function theoremFromTheoremNode(theoremNode, context) {
|
|
|
233
237
|
}
|
|
234
238
|
|
|
235
239
|
export function propertyFromPropertyNode(propertyNode, context) {
|
|
236
|
-
|
|
237
|
-
node = propertyNode, ///
|
|
238
|
-
string = context.nodeAsString(node),
|
|
239
|
-
lineIndex = null,
|
|
240
|
-
propertyName = propertyNode.getPropertyName(),
|
|
241
|
-
nominalTypeName = null,
|
|
242
|
-
name = propertyName; ///
|
|
240
|
+
let property = null;
|
|
243
241
|
|
|
244
|
-
|
|
242
|
+
if (propertyNode != null) {
|
|
243
|
+
const { Property } = elements,
|
|
244
|
+
node = propertyNode, ///
|
|
245
|
+
string = context.nodeAsString(node),
|
|
246
|
+
lineIndex = null,
|
|
247
|
+
name = nameFromPropertyNode(propertyNode, context),
|
|
248
|
+
type = typeFromPropertyNode(propertyNode, context);
|
|
245
249
|
|
|
246
|
-
|
|
250
|
+
context = null;
|
|
251
|
+
|
|
252
|
+
property = new Property(context, string, node, lineIndex, name, type);
|
|
253
|
+
}
|
|
247
254
|
|
|
248
255
|
return property;
|
|
249
256
|
}
|
|
@@ -253,9 +260,9 @@ export function variableFromVariableNode(variableNode, context) {
|
|
|
253
260
|
node = variableNode, ///
|
|
254
261
|
string = context.nodeAsString(node),
|
|
255
262
|
lineIndex = null,
|
|
256
|
-
type =
|
|
263
|
+
type = typeFromVariableNode(variableNode, context),
|
|
257
264
|
identifier = identifierFromVarialbeNode(variableNode, context),
|
|
258
|
-
propertyRelations =
|
|
265
|
+
propertyRelations = propertyRelationsFromVariableNode(variableNode, context);
|
|
259
266
|
|
|
260
267
|
context = null;
|
|
261
268
|
|
|
@@ -266,12 +273,12 @@ export function variableFromVariableNode(variableNode, context) {
|
|
|
266
273
|
|
|
267
274
|
export function subproofFromSubproofNode(subproofNode, context) {
|
|
268
275
|
const { Subproof } = elements,
|
|
269
|
-
node = subproofNode,
|
|
276
|
+
node = subproofNode, ///
|
|
277
|
+
lineIndex = null,
|
|
270
278
|
suppositions = suppositionsFromSubproofNode(subproofNode, context),
|
|
271
279
|
subDerivation = subDerivationFromSubproofNode(subproofNode, context),
|
|
272
280
|
subproofString = subproofStringFromSuppositionsAndSubDerivation(suppositions, subDerivation, context),
|
|
273
|
-
string = subproofString
|
|
274
|
-
lineIndex = null;
|
|
281
|
+
string = subproofString; ///
|
|
275
282
|
|
|
276
283
|
context = null;
|
|
277
284
|
|
|
@@ -385,8 +392,8 @@ export function parameterFromParameterNode(parameterNode, context) {
|
|
|
385
392
|
node = parameterNode, ///
|
|
386
393
|
string = context.nodeAsString(node),
|
|
387
394
|
lineIndex = null,
|
|
388
|
-
name = parameterNode
|
|
389
|
-
identifier = parameterNode
|
|
395
|
+
name = nameFromParamterNode(parameterNode, context),
|
|
396
|
+
identifier = identifierFromParamterNode(parameterNode, context);
|
|
390
397
|
|
|
391
398
|
context = null;
|
|
392
399
|
|
|
@@ -431,7 +438,7 @@ export function conjectureFromConjectureNode(conjectureNode, context) {
|
|
|
431
438
|
deduction = deductionFromTopLevelAssertionNode(topLevelAsssertionNode, context),
|
|
432
439
|
suppositions = suppositionsFromTopLevelAssertionNode(topLevelAsssertionNode, context),
|
|
433
440
|
signature = signatureFromTopLevelAssertionNode(topLevelAsssertionNode, context),
|
|
434
|
-
hypotheses =
|
|
441
|
+
hypotheses = hypothesesFromTopLevelAssertionNode(topLevelAsssertionNode, context),
|
|
435
442
|
topLevelAsssertionString = topLevelAssertionStringFromLabelsSuppositionsAndDeduction(labels, suppositions, deduction),
|
|
436
443
|
node = conjectureNode, ///
|
|
437
444
|
string = topLevelAsssertionString, ///
|
|
@@ -488,12 +495,11 @@ export function typePrefixFromTypePrefixNode(typePrefixNode, context) {
|
|
|
488
495
|
node = typePrefixNode, ///
|
|
489
496
|
string = context.nodeAsString(node),
|
|
490
497
|
lineIndex = null,
|
|
491
|
-
|
|
492
|
-
type = typeFromTypePrefixNode(typePrefixNode, context);
|
|
498
|
+
name = nameFromTypePrefixNode(typePrefixNode, context);
|
|
493
499
|
|
|
494
500
|
context = null;
|
|
495
501
|
|
|
496
|
-
const typePrefix = new TypePrefix(context, string, node, lineIndex,
|
|
502
|
+
const typePrefix = new TypePrefix(context, string, node, lineIndex, name);
|
|
497
503
|
|
|
498
504
|
return typePrefix;
|
|
499
505
|
}
|
|
@@ -742,9 +748,9 @@ export function containedAssertionFromContainedAssertionNode(containedAssertionN
|
|
|
742
748
|
node = containedAssertionNode, ///
|
|
743
749
|
string = context.nodeAsString(node),
|
|
744
750
|
lineIndex = null,
|
|
745
|
-
negated = containedAssertionNode.isNegated(),
|
|
746
751
|
term = termFromContainedAssertionNode(containedAssertionNode, context),
|
|
747
752
|
frame = frameFromContainedAssertionNode(containedAssertionNode, context),
|
|
753
|
+
negated = negatedFromContainedAssertionNode(containedAssertionNode, context),
|
|
748
754
|
statement = statementFromContainedAssertionNode(containedAssertionNode, context);
|
|
749
755
|
|
|
750
756
|
context = null;
|
|
@@ -783,16 +789,29 @@ export function procedureReferenceFromProcedureReferenceNode(procedureReferenceN
|
|
|
783
789
|
return procedureRefereence;
|
|
784
790
|
}
|
|
785
791
|
|
|
792
|
+
export function propertyDeclarationFromPropertyDeclarationNode(propertyDeclarationNode, context) {
|
|
793
|
+
const { PropertyDeclaration } = elements,
|
|
794
|
+
node = propertyDeclarationNode, ///
|
|
795
|
+
string = context.nodeAsString(node),
|
|
796
|
+
lineIndex = null,
|
|
797
|
+
type = typeFromPropertyDeclarationNode(propertyDeclarationNode, context),
|
|
798
|
+
property = propertyFromPropertyDeclarationNode(propertyDeclarationNode, context);
|
|
799
|
+
|
|
800
|
+
context = null;
|
|
801
|
+
|
|
802
|
+
const propertyDeclaration = new PropertyDeclaration(context, string, node, lineIndex, property, type);
|
|
803
|
+
|
|
804
|
+
return propertyDeclaration;
|
|
805
|
+
}
|
|
806
|
+
|
|
786
807
|
export function variableDeclarationFromVariableDeclarationNode(variableDeclarationNode, context) {
|
|
787
808
|
const { VariableDeclaration } = elements,
|
|
788
809
|
node = variableDeclarationNode, ///
|
|
789
810
|
string = context.nodeAsString(node),
|
|
790
811
|
lineIndex = null,
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
type = typeFromTypeNode(typeNode, context),
|
|
795
|
-
variable = variableFromVariableNode(variableNode, context);
|
|
812
|
+
type = typeFromVariableDeclarationNode(variableDeclarationNode, context),
|
|
813
|
+
variable = variableFromVariableDeclarationNode(variableDeclarationNode, context),
|
|
814
|
+
provisional = provisionalFromVariableDeclarationNode(variableDeclarationNode, context);
|
|
796
815
|
|
|
797
816
|
context = null;
|
|
798
817
|
|
|
@@ -938,15 +957,17 @@ export function constructorDeclarationFromConstructorDeclarationNode(constructor
|
|
|
938
957
|
export function complexTypeDeclarationFromComplexTypeDeclarationNode(complexTypeDeclarationNode, context) {
|
|
939
958
|
const { ComplexTypeDeclaration } = elements,
|
|
940
959
|
node = complexTypeDeclarationNode, ///
|
|
941
|
-
string = context.nodeAsString(node),
|
|
942
960
|
lineIndex = null,
|
|
943
961
|
type = typeFromComplexTypeDeclarationNode(complexTypeDeclarationNode, context),
|
|
944
962
|
superTypes = superTypesFromComplexTypeDeclarationNode(complexTypeDeclarationNode, context),
|
|
945
|
-
provisional = provisionalFromComplexTypeDeclarationNode(complexTypeDeclarationNode, context)
|
|
963
|
+
provisional = provisionalFromComplexTypeDeclarationNode(complexTypeDeclarationNode, context),
|
|
964
|
+
propertyDeclarations = propertyDeclarationsFromComplexTypeDeclarationNode(complexTypeDeclarationNode, context),
|
|
965
|
+
complexTypeDeclarationString = complexTypeDeclarationStringFromTypeSuperTypesAndProvisional(type, superTypes, provisional),
|
|
966
|
+
string = complexTypeDeclarationString; ///
|
|
946
967
|
|
|
947
968
|
context = null;
|
|
948
969
|
|
|
949
|
-
const complexTypeDeclaration = new ComplexTypeDeclaration(context, string, node, lineIndex, type, superTypes, provisional);
|
|
970
|
+
const complexTypeDeclaration = new ComplexTypeDeclaration(context, string, node, lineIndex, type, superTypes, provisional, propertyDeclarations);
|
|
950
971
|
|
|
951
972
|
return complexTypeDeclaration;
|
|
952
973
|
}
|
|
@@ -1042,7 +1063,26 @@ export function lemmaFromSectionNode(sectionNode, context) {
|
|
|
1042
1063
|
}
|
|
1043
1064
|
|
|
1044
1065
|
export function nameFromPropertyNode(propertyNode, context) {
|
|
1045
|
-
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();
|
|
1046
1086
|
|
|
1047
1087
|
return name;
|
|
1048
1088
|
}
|
|
@@ -1306,6 +1346,12 @@ export function identifierFromVarialbeNode(variableNode, context) {
|
|
|
1306
1346
|
return identifier;
|
|
1307
1347
|
}
|
|
1308
1348
|
|
|
1349
|
+
export function identifierFromParamterNode(parameterNode, context) {
|
|
1350
|
+
const identifier = parameterNode.getIdentifier();
|
|
1351
|
+
|
|
1352
|
+
return identifier;
|
|
1353
|
+
}
|
|
1354
|
+
|
|
1309
1355
|
export function statementFromDeductionNode(deductionNode, context) {
|
|
1310
1356
|
let statement = null;
|
|
1311
1357
|
|
|
@@ -1630,6 +1676,20 @@ export function labelsFromTopLevelAssertionNode(topLevelAsssertionNode, context)
|
|
|
1630
1676
|
return labels;
|
|
1631
1677
|
}
|
|
1632
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
|
+
|
|
1633
1693
|
export function procedureCallFromSuppositionNode(suppositionNode, context) {
|
|
1634
1694
|
let procedureCall = null;
|
|
1635
1695
|
|
|
@@ -1649,7 +1709,7 @@ export function negatedFromJDefinedAssertionNode(definedAssertionNode, context)
|
|
|
1649
1709
|
}
|
|
1650
1710
|
|
|
1651
1711
|
export function propertyFromPropertyRelationNode(propertyRelationNode, context) {
|
|
1652
|
-
const propertyNode = propertyRelationNode.
|
|
1712
|
+
const propertyNode = propertyRelationNode.getPropertyNode(),
|
|
1653
1713
|
property = propertyFromPropertyNode(propertyNode, context);
|
|
1654
1714
|
|
|
1655
1715
|
return property;
|
|
@@ -1669,6 +1729,12 @@ export function typeFromBracketedConstructorNode(bracketedCcnstructorNode, conte
|
|
|
1669
1729
|
return type;
|
|
1670
1730
|
}
|
|
1671
1731
|
|
|
1732
|
+
export function propertyRelationsFromVariableNode(variableNode, context) {
|
|
1733
|
+
const propertyRelations = [];
|
|
1734
|
+
|
|
1735
|
+
return propertyRelations;
|
|
1736
|
+
}
|
|
1737
|
+
|
|
1672
1738
|
export function definedAssertionFromStatementNode(statementNode, context) {
|
|
1673
1739
|
let definedAssertion = null;
|
|
1674
1740
|
|
|
@@ -1832,6 +1898,20 @@ export function hypothesesFromTopLevelAssertionNode(topLevelAsssertionNode, cont
|
|
|
1832
1898
|
return ypotheses;
|
|
1833
1899
|
}
|
|
1834
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
|
+
|
|
1835
1915
|
export function statementFromBracketedCombinatorNode(bracketedCombinatorNode, context) {
|
|
1836
1916
|
const statementNode = bracketedCombinatorNode.getStatementNode(),
|
|
1837
1917
|
statement = statementFromStatementNode(statementNode, context);
|
|
@@ -1904,6 +1984,12 @@ export function deductionFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode,
|
|
|
1904
1984
|
return deduction;
|
|
1905
1985
|
}
|
|
1906
1986
|
|
|
1987
|
+
export function provisionalFromVariableDeclarationNode(variableDeclarationNode, context) {
|
|
1988
|
+
const provisional = variableDeclarationNode.isProvisional();
|
|
1989
|
+
|
|
1990
|
+
return provisional;
|
|
1991
|
+
}
|
|
1992
|
+
|
|
1907
1993
|
export function procedureReferenceFromProcedureCallNode(procedureCallNode, context) {
|
|
1908
1994
|
const procedureReferenceNode = procedureCallNode.getProcedureReferenceNode(),
|
|
1909
1995
|
procedureReference = procedureReferenceFromProcedureReferenceNode(procedureReferenceNode, context);
|
|
@@ -2090,6 +2176,13 @@ export function replacementStatementFromStatementSubstitutionNode(statementSubst
|
|
|
2090
2176
|
return replacementStatement;
|
|
2091
2177
|
}
|
|
2092
2178
|
|
|
2179
|
+
export function propertyDeclarationsFromComplexTypeDeclarationNode(complexTypeDeclarationNode, context) {
|
|
2180
|
+
const propertyDeclarationnNodes = complexTypeDeclarationNode.getPropertyDeclarationNodes(),
|
|
2181
|
+
propertyDeclarations = propertyDeclarationsFromPropertyDeclarationNodes(propertyDeclarationnNodes, context);
|
|
2182
|
+
|
|
2183
|
+
return propertyDeclarations;
|
|
2184
|
+
}
|
|
2185
|
+
|
|
2093
2186
|
export function termsFromTermNodes(termNodes, context) {
|
|
2094
2187
|
const terms = termNodes.map((termNode) => {
|
|
2095
2188
|
const term = termFromTermNode(termNode, context);
|
|
@@ -2204,3 +2297,13 @@ export function stepsOrSubproofsFromSubDerivationNode(subDerivationNode, context
|
|
|
2204
2297
|
|
|
2205
2298
|
return stepsOrSubproofs;
|
|
2206
2299
|
}
|
|
2300
|
+
|
|
2301
|
+
export function propertyDeclarationsFromPropertyDeclarationNodes(propertyDeclarationnNodes, context) {
|
|
2302
|
+
const propertyDeclrations = propertyDeclarationnNodes.map((propertyDeclarationNode) => {
|
|
2303
|
+
const propertyDeclcaration = propertyDeclarationFromPropertyDeclarationNode(propertyDeclarationNode, context);
|
|
2304
|
+
|
|
2305
|
+
return propertyDeclcaration;
|
|
2306
|
+
});
|
|
2307
|
+
|
|
2308
|
+
return propertyDeclrations;
|
|
2309
|
+
}
|
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
|
|
package/src/utilities/string.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { baseTypeFromNothing } from "../utilities/type";
|
|
4
|
+
import { EMPTY_STRING, PROVISIONALLY } from "../constants";
|
|
4
5
|
|
|
5
6
|
export function termsStringFromTerms(terms) {
|
|
6
7
|
const termsString = terms.reduce((termsString, term) => {
|
|
@@ -59,18 +60,25 @@ export function hypothesesStringFromHypotheses(hypotheses) {
|
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
export function superTypesStringFromSuperTypes(superTypes) {
|
|
62
|
-
|
|
63
|
-
superTypesString = superTypes.reduce((superTypesString, superType) => {
|
|
64
|
-
if (superType !== baseType) {
|
|
65
|
-
const superTypeString = superType.getString();
|
|
63
|
+
let superTypesString;
|
|
66
64
|
|
|
67
|
-
|
|
68
|
-
`'${superTypeString}'` :
|
|
69
|
-
`${superTypesString}, '${superTypeString}'`;
|
|
70
|
-
}
|
|
65
|
+
const baseType = baseTypeFromNothing();
|
|
71
66
|
|
|
72
|
-
|
|
73
|
-
|
|
67
|
+
superTypesString = superTypes.reduce((superTypesString, superType) => {
|
|
68
|
+
if (superType !== baseType) {
|
|
69
|
+
const superTypeString = superType.getString();
|
|
70
|
+
|
|
71
|
+
superTypesString = (superTypesString === null) ?
|
|
72
|
+
`'${superTypeString}'` :
|
|
73
|
+
`${superTypesString}, '${superTypeString}'`;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return superTypesString;
|
|
77
|
+
}, null);
|
|
78
|
+
|
|
79
|
+
superTypesString = (superTypesString !== null) ?
|
|
80
|
+
`:${superTypesString}` :
|
|
81
|
+
EMPTY_STRING;
|
|
74
82
|
|
|
75
83
|
return superTypesString;
|
|
76
84
|
}
|
|
@@ -89,13 +97,21 @@ export function parametersStringFromParameters(parameters) {
|
|
|
89
97
|
return parametersString;
|
|
90
98
|
}
|
|
91
99
|
|
|
100
|
+
export function provisinalStringFromProvisional(provisional) {
|
|
101
|
+
const provisionString = provisional ?
|
|
102
|
+
PROVISIONALLY :
|
|
103
|
+
EMPTY_STRING;
|
|
104
|
+
|
|
105
|
+
return provisionString;
|
|
106
|
+
}
|
|
107
|
+
|
|
92
108
|
export function suppositionsStringFromSuppositions(suppositions) {
|
|
93
109
|
const suppositionsString = suppositions.reduce((suppositionsString, supposition) => {
|
|
94
110
|
const suppositionString = supposition.getString();
|
|
95
111
|
|
|
96
112
|
suppositionsString = (suppositionsString === null) ?
|
|
97
|
-
|
|
98
|
-
|
|
113
|
+
suppositionString: ///
|
|
114
|
+
`${suppositionsString}, ${suppositionString}`;
|
|
99
115
|
|
|
100
116
|
return suppositionsString;
|
|
101
117
|
}, null);
|
|
@@ -230,6 +246,15 @@ export function topLevelAssertionStringFromLabelsSuppositionsAndDeduction(labels
|
|
|
230
246
|
return topLevelAssertionString;
|
|
231
247
|
}
|
|
232
248
|
|
|
249
|
+
export function complexTypeDeclarationStringFromTypeSuperTypesAndProvisional(type, superTypes, provisional) {
|
|
250
|
+
const typeString = type.getString(),
|
|
251
|
+
superTypesString = superTypesStringFromSuperTypes(superTypes),
|
|
252
|
+
provisionalString = provisinalStringFromProvisional(provisional),
|
|
253
|
+
complexTypeDeclarationString = `${provisionalString}${typeString}${superTypesString}`;
|
|
254
|
+
|
|
255
|
+
return complexTypeDeclarationString;
|
|
256
|
+
}
|
|
257
|
+
|
|
233
258
|
export function topLevelMetaAssertionStringFromLabelSuppositionsAndDeduction(label, suppositions, deduction) {
|
|
234
259
|
const labelString = label.getString(),
|
|
235
260
|
deductionString = deduction.getString(),
|
|
@@ -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
|
+
}
|