occam-verify-cli 1.0.642 → 1.0.649
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/action/verify.js +23 -3
- package/lib/context/file/nominal.js +14 -14
- package/lib/context.js +22 -8
- package/lib/element/assertion/type.js +9 -6
- package/lib/element/combinator.js +12 -8
- package/lib/element/conclusion.js +4 -15
- package/lib/element/constructor.js +43 -8
- package/lib/element/declaration/combinator.js +25 -15
- package/lib/element/declaration/complexType.js +43 -33
- package/lib/element/declaration/constructor.js +45 -100
- package/lib/element/declaration/simpleType.js +77 -53
- package/lib/element/declaration/typePrefix.js +30 -20
- package/lib/element/declaration/variable.js +3 -5
- package/lib/element/metavariable.js +2 -2
- package/lib/element/statement.js +2 -2
- package/lib/element/term.js +1 -1
- package/lib/element/topLevelAssertion/axiom.js +2 -2
- package/lib/element/type.js +6 -5
- package/lib/node/declaration/complexType.js +1 -8
- package/lib/node/declaration/simpleType.js +1 -8
- package/lib/process/assign.js +11 -24
- package/lib/process/unify.js +41 -1
- package/lib/process/verify.js +61 -13
- package/lib/utilities/element.js +31 -19
- package/lib/utilities/fileContext.js +1 -1
- package/lib/utilities/json.js +1 -1
- package/lib/utilities/type.js +3 -3
- package/package.json +4 -4
- package/src/action/verify.js +35 -1
- package/src/context/file/nominal.js +13 -13
- package/src/context.js +24 -10
- package/src/element/assertion/type.js +10 -6
- package/src/element/combinator.js +13 -11
- package/src/element/conclusion.js +3 -27
- package/src/element/constructor.js +54 -3
- package/src/element/declaration/combinator.js +5 -2
- package/src/element/declaration/complexType.js +9 -6
- package/src/element/declaration/constructor.js +33 -99
- package/src/element/declaration/simpleType.js +73 -44
- package/src/element/declaration/typePrefix.js +5 -2
- package/src/element/declaration/variable.js +3 -8
- package/src/element/metavariable.js +1 -1
- package/src/element/statement.js +1 -1
- package/src/element/term.js +7 -7
- package/src/element/topLevelAssertion/axiom.js +1 -1
- package/src/element/type.js +4 -3
- package/src/node/declaration/complexType.js +0 -7
- package/src/node/declaration/simpleType.js +0 -7
- package/src/process/assign.js +15 -23
- package/src/process/unify.js +32 -0
- package/src/process/verify.js +48 -18
- package/src/utilities/element.js +33 -18
- package/src/utilities/fileContext.js +1 -1
- package/src/utilities/json.js +1 -0
- package/src/utilities/type.js +2 -3
|
@@ -6,13 +6,6 @@ import { PROVISIONAL } from "../../constants";
|
|
|
6
6
|
import { TYPE_RULE_NAME, TYPES_RULE_NAME } from "../../ruleNames";
|
|
7
7
|
|
|
8
8
|
export default class SimpleTypeDeclarationNode extends DeclarationNode {
|
|
9
|
-
isPrefixed() {
|
|
10
|
-
const typeNode = this.getTypeNode(),
|
|
11
|
-
prefixed = typeNode.isPrefixed();
|
|
12
|
-
|
|
13
|
-
return prefixed;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
9
|
isProvisional() {
|
|
17
10
|
let provisional = false;
|
|
18
11
|
|
package/src/process/assign.js
CHANGED
|
@@ -55,32 +55,24 @@ export function rightVariableAssignmentFromEquality(equality, context) {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
export function variableAssignmentFromTypeAssertion(typeAssertion, context) {
|
|
58
|
+
let variableAssignment = null;
|
|
58
59
|
|
|
59
|
-
|
|
60
|
+
const term = typeAssertion.getTerm(),
|
|
61
|
+
termSingular = term.isSingular();
|
|
60
62
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
//
|
|
69
|
-
// if (!provisional) {
|
|
70
|
-
// type = this.type;
|
|
71
|
-
// } else {
|
|
72
|
-
// provisional = false;
|
|
73
|
-
//
|
|
74
|
-
// type = Type.fromTypeAndProvisional(this.type, provisional);
|
|
75
|
-
// }
|
|
76
|
-
//
|
|
77
|
-
// const singularVariableNode = termNode.getSingularVariableNode();
|
|
78
|
-
//
|
|
79
|
-
// if (singularVariableNode !== null) {
|
|
80
|
-
// const variableNode = singularVariableNode, ///
|
|
81
|
-
// variable = Variable.fromVariableNodeAndType(variableNode, type, context),
|
|
82
|
-
// variableAssignment = variableAssignmentFromVariable(variable),
|
|
63
|
+
if (termSingular) {
|
|
64
|
+
const variableIdentifier = term.getVariableIdentifier(),
|
|
65
|
+
variable = context.findVariableByVariableIdentifier(variableIdentifier);
|
|
66
|
+
|
|
67
|
+
if (variable !== null) {
|
|
68
|
+
const type = typeAssertion.getType(),
|
|
69
|
+
variableNode = variable.getNode();
|
|
83
70
|
|
|
71
|
+
variableAssignment = variableAssignmentFromVariableNodeAndType(variableNode, type, context);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return variableAssignment;
|
|
84
76
|
}
|
|
85
77
|
|
|
86
78
|
export function variableAssignmentFromPrepertyAssertion(propertyAssertion, context) {
|
package/src/process/unify.js
CHANGED
|
@@ -145,6 +145,22 @@ class MetaLevelPass extends ZipPass {
|
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
class CombinatorPass extends ZipPass {
|
|
148
|
+
run(combinatorStatementNode, statementNode, stated, generalContext, specificContext) {
|
|
149
|
+
let success = false;
|
|
150
|
+
|
|
151
|
+
const specificnonTerminalNode = statementNode, ///
|
|
152
|
+
generalcnonTerminalNode = combinatorStatementNode, ///
|
|
153
|
+
specificChildNodes = specificnonTerminalNode.getChildNodes(), ///
|
|
154
|
+
generalcChildNodes = generalcnonTerminalNode.getChildNodes(), ///
|
|
155
|
+
descended = this.descend(generalcChildNodes, specificChildNodes, stated, generalContext, specificContext);
|
|
156
|
+
|
|
157
|
+
if (descended) {
|
|
158
|
+
success = true;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return success;
|
|
162
|
+
}
|
|
163
|
+
|
|
148
164
|
static maps = [
|
|
149
165
|
{
|
|
150
166
|
generalNodeQuery: metaTypeNodeQuery,
|
|
@@ -236,6 +252,22 @@ class CombinatorPass extends ZipPass {
|
|
|
236
252
|
}
|
|
237
253
|
|
|
238
254
|
class ConstructorPass extends ZipPass {
|
|
255
|
+
run(constructorTermNode, termNode, generalContext, specificContext) {
|
|
256
|
+
let success = false;
|
|
257
|
+
|
|
258
|
+
const specificnonTerminalNode = termNode, ///
|
|
259
|
+
generalcnonTerminalNode = constructorTermNode, ///
|
|
260
|
+
specificChildNodes = specificnonTerminalNode.getChildNodes(), ///
|
|
261
|
+
generalcChildNodes = generalcnonTerminalNode.getChildNodes(), ///
|
|
262
|
+
descended = this.descend(generalcChildNodes, specificChildNodes, generalContext, specificContext);
|
|
263
|
+
|
|
264
|
+
if (descended) {
|
|
265
|
+
success = true;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
return success;
|
|
269
|
+
}
|
|
270
|
+
|
|
239
271
|
static maps = [
|
|
240
272
|
{
|
|
241
273
|
generalNodeQuery: typeNodeQuery,
|
package/src/process/verify.js
CHANGED
|
@@ -288,6 +288,20 @@ class TopLevelPass extends AsyncPass {
|
|
|
288
288
|
}
|
|
289
289
|
|
|
290
290
|
class ConbinatorPass extends SimplePass {
|
|
291
|
+
run(statementNode, context) {
|
|
292
|
+
let success = false;
|
|
293
|
+
|
|
294
|
+
const nonTerminalNode = statementNode, ///
|
|
295
|
+
childNodes = nonTerminalNode.getChildNodes(), ///
|
|
296
|
+
descended = this.descend(childNodes, context);
|
|
297
|
+
|
|
298
|
+
if (descended) {
|
|
299
|
+
success = true;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
return success;
|
|
303
|
+
}
|
|
304
|
+
|
|
291
305
|
static maps = [
|
|
292
306
|
{
|
|
293
307
|
nodeQuery: statementNodeQuery,
|
|
@@ -350,6 +364,20 @@ class ConbinatorPass extends SimplePass {
|
|
|
350
364
|
}
|
|
351
365
|
|
|
352
366
|
class ConstructorPass extends SimplePass {
|
|
367
|
+
run(termNode, context) {
|
|
368
|
+
let success = false;
|
|
369
|
+
|
|
370
|
+
const nonTerminalNode = termNode, ///
|
|
371
|
+
childNodes = nonTerminalNode.getChildNodes(), ///
|
|
372
|
+
descended = this.descend(childNodes, context);
|
|
373
|
+
|
|
374
|
+
if (descended) {
|
|
375
|
+
success = true;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
return success;
|
|
379
|
+
}
|
|
380
|
+
|
|
353
381
|
static maps = [
|
|
354
382
|
{
|
|
355
383
|
nodeQuery: termNodeQuery,
|
|
@@ -408,26 +436,28 @@ export async function verifyFile(fileNode, context) {
|
|
|
408
436
|
return fileVerifies;
|
|
409
437
|
}
|
|
410
438
|
|
|
411
|
-
export function
|
|
412
|
-
|
|
413
|
-
statement = combintot.getStatement(),
|
|
414
|
-
statementNode = statement.getNode(),
|
|
415
|
-
nonTerminalNode = statementNode, ///
|
|
416
|
-
childNodes = nonTerminalNode.getChildNodes(),
|
|
417
|
-
descended = combinatorPass.descend(childNodes, context),
|
|
418
|
-
combinatorVerifies = descended; ///
|
|
439
|
+
export function verifyTermAsConstructor(term, context) {
|
|
440
|
+
let termVerifiesAsConstructor = false;
|
|
419
441
|
|
|
420
|
-
|
|
442
|
+
const termNode = term.getNode(),
|
|
443
|
+
success = constructorPass.run(termNode, context);
|
|
444
|
+
|
|
445
|
+
if (success) {
|
|
446
|
+
termVerifiesAsConstructor = true;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
return termVerifiesAsConstructor;
|
|
421
450
|
}
|
|
422
451
|
|
|
423
|
-
export function
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
452
|
+
export function verifyStatementAsCombinator(statement, context) {
|
|
453
|
+
let statementVerifiesAsCombinator = false;
|
|
454
|
+
|
|
455
|
+
const statementNode = statement.getNode(),
|
|
456
|
+
success = combinatorPass.run(statementNode, context);
|
|
457
|
+
|
|
458
|
+
if (success) {
|
|
459
|
+
statementVerifiesAsCombinator = true;
|
|
460
|
+
}
|
|
431
461
|
|
|
432
|
-
return
|
|
462
|
+
return statementVerifiesAsCombinator;
|
|
433
463
|
}
|
package/src/utilities/element.js
CHANGED
|
@@ -741,9 +741,9 @@ export function simpleTypeDeclarationFromSimpleTypeDeclarationNode(simpleTypeDec
|
|
|
741
741
|
node = simpleTypeDeclarationNode, ///
|
|
742
742
|
string = context.nodeAsString(node),
|
|
743
743
|
type = typeFromSimpleTypeDeclarationNode(simpleTypeDeclarationNode, context),
|
|
744
|
-
prefixed = prefixedFromSimpleTypeDeclarationNode(simpleTypeDeclarationNode, context),
|
|
745
744
|
superTypes = superTypesFromSimpleTypeDeclarationNode(simpleTypeDeclarationNode, context),
|
|
746
|
-
|
|
745
|
+
provisional = provisionalFromSimpleTypeDeclarationNode(simpleTypeDeclarationNode, context),
|
|
746
|
+
simpleTypeDeclaration = new SimpleTypeDeclaration(context, string, node, type, superTypes, provisional);
|
|
747
747
|
|
|
748
748
|
return simpleTypeDeclaration;
|
|
749
749
|
}
|
|
@@ -789,8 +789,9 @@ export function complexTypeDeclarationFromComplexTypeDeclarationNode(complexType
|
|
|
789
789
|
node = complexTypeDeclarationNode, ///
|
|
790
790
|
string = context.nodeAsString(node),
|
|
791
791
|
type = typeFromComplexTypeDeclarationNode(complexTypeDeclarationNode, context),
|
|
792
|
-
|
|
793
|
-
|
|
792
|
+
superTypes = superTypesFromComplexTypeDeclarationNode(complexTypeDeclarationNode, context),
|
|
793
|
+
provisional = provisionalFromComplexTypeDeclarationNode(complexTypeDeclarationNode, context),
|
|
794
|
+
complexTypeDeclaration = new ComplexTypeDeclaration(context, string, node, type, superTypes, provisional);
|
|
794
795
|
|
|
795
796
|
return complexTypeDeclaration;
|
|
796
797
|
}
|
|
@@ -1584,12 +1585,6 @@ export function suppositionsFromTopLevelAssertionNode(topLevelAsssertionNode, co
|
|
|
1584
1585
|
return suppositions;
|
|
1585
1586
|
}
|
|
1586
1587
|
|
|
1587
|
-
export function prefixedFromSimpleTypeDeclarationNode(simpleTypeDeclarationNode, context) {
|
|
1588
|
-
const prefixed = simpleTypeDeclarationNode.isPrefixed();
|
|
1589
|
-
|
|
1590
|
-
return prefixed;
|
|
1591
|
-
}
|
|
1592
|
-
|
|
1593
1588
|
export function resolvedFromStatementSubstitutionNode(statementSubstitutionNode, context) {
|
|
1594
1589
|
const resolved = statementSubstitutionNode.isResolved();
|
|
1595
1590
|
|
|
@@ -1603,12 +1598,6 @@ export function deductionFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode,
|
|
|
1603
1598
|
return deduction;
|
|
1604
1599
|
}
|
|
1605
1600
|
|
|
1606
|
-
export function prefixedFromComplexTypeDeclarationNode(complexTypeDeclarationNode, context) {
|
|
1607
|
-
const prefixed = complexTypeDeclarationNode.isPrefixed();
|
|
1608
|
-
|
|
1609
|
-
return prefixed;
|
|
1610
|
-
}
|
|
1611
|
-
|
|
1612
1601
|
export function procedureReferenceFromProcedureCallNode(procedureCallNode, context) {
|
|
1613
1602
|
const procedureReferenceNode = procedureCallNode.getProcedureReferenceNode(),
|
|
1614
1603
|
procedureReference = procedureReferenceFromProcedureReferenceNode(procedureReferenceNode, context);
|
|
@@ -1658,12 +1647,26 @@ export function metaTypeFromMetavariableDeclarationNode(metavariableDeclarationN
|
|
|
1658
1647
|
return metaType;
|
|
1659
1648
|
}
|
|
1660
1649
|
|
|
1661
|
-
export function
|
|
1662
|
-
const provisional =
|
|
1650
|
+
export function provisionalFromSimpleTypeDeclarationNode(simpleTypeDeclarationNode, context) {
|
|
1651
|
+
const provisional = simpleTypeDeclarationNode.isProvisional();
|
|
1663
1652
|
|
|
1664
1653
|
return provisional;
|
|
1665
1654
|
}
|
|
1666
1655
|
|
|
1656
|
+
export function superTypesFromComplexTypeDeclarationNode(complexTypeDeclarationNode, context) {
|
|
1657
|
+
let superTypes = [];
|
|
1658
|
+
|
|
1659
|
+
const typesNode = complexTypeDeclarationNode.getTypesNode();
|
|
1660
|
+
|
|
1661
|
+
if (typesNode !== null) {
|
|
1662
|
+
const types = typesFromTypesNode(typesNode, context);
|
|
1663
|
+
|
|
1664
|
+
superTypes = types; ///
|
|
1665
|
+
}
|
|
1666
|
+
|
|
1667
|
+
return superTypes;
|
|
1668
|
+
}
|
|
1669
|
+
|
|
1667
1670
|
export function replacementFrameFromFrameSubstitutionNode(frameSubstitutionNode, context) {
|
|
1668
1671
|
const replacementFrameNode = frameSubstitutionNode.getReplacementFrameNode(),
|
|
1669
1672
|
replacementFrame = frameFromFrameNode(replacementFrameNode, context);
|
|
@@ -1700,6 +1703,18 @@ export function constructorFromConstructorDeclarationNode(constructorDeclaration
|
|
|
1700
1703
|
return constructor;
|
|
1701
1704
|
}
|
|
1702
1705
|
|
|
1706
|
+
export function provisionalFromConstructorDeclarationNode(constructorDeclarationNode, context) {
|
|
1707
|
+
const provisional = constructorDeclarationNode.isProvisional();
|
|
1708
|
+
|
|
1709
|
+
return provisional;
|
|
1710
|
+
}
|
|
1711
|
+
|
|
1712
|
+
export function provisionalFromComplexTypeDeclarationNode(complexTypeDeclarationNode, context) {
|
|
1713
|
+
const provisional = complexTypeDeclarationNode.isProvisional();
|
|
1714
|
+
|
|
1715
|
+
return provisional;
|
|
1716
|
+
}
|
|
1717
|
+
|
|
1703
1718
|
export function metavariableFromMetavariableDeclarationNode(metavariableDeclarationNode, context) {
|
|
1704
1719
|
const metavariableNode = metavariableDeclarationNode.getMetavariableNode(),
|
|
1705
1720
|
metavariable = metavariableFromMetavariableNode(metavariableNode, context);
|
|
@@ -11,7 +11,7 @@ export function FileContextFromFilePath(filePath) {
|
|
|
11
11
|
let FileContext = null;
|
|
12
12
|
|
|
13
13
|
const filePathFurtleFilePath = isFilePathFurtleFilePath(filePath),
|
|
14
|
-
|
|
14
|
+
filePathNominalFilePath = isFilePathNominalFilePath(filePath);
|
|
15
15
|
|
|
16
16
|
if (filePathFurtleFilePath) {
|
|
17
17
|
FileContext = FurtleFileContext; ///
|
package/src/utilities/json.js
CHANGED
package/src/utilities/type.js
CHANGED
|
@@ -10,10 +10,9 @@ export function baseTypeFromNothing() {
|
|
|
10
10
|
if (baseType === null) {
|
|
11
11
|
const { Type } = elements,
|
|
12
12
|
name = BASE_TYPE_SYMBOL, ///
|
|
13
|
-
context = null
|
|
14
|
-
provisional = false;
|
|
13
|
+
context = null;
|
|
15
14
|
|
|
16
|
-
baseType = Type.
|
|
15
|
+
baseType = Type.fromName(name, context);
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
return baseType;
|