occam-verify-cli 0.0.837 → 0.0.839
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/constants.js +5 -1
- package/lib/context/file.js +24 -9
- package/lib/context/local.js +77 -39
- package/lib/context/localMeta.js +3 -3
- package/lib/context/release.js +4 -5
- package/lib/equality.js +2 -2
- package/lib/equivalence.js +244 -0
- package/lib/log.js +3 -3
- package/lib/term.js +40 -1
- package/lib/utilities/array.js +5 -5
- package/lib/utilities/equivalences.js +169 -0
- package/lib/verifier/node/metastatement.js +12 -31
- package/lib/verifier/node/statementAsCombinator.js +4 -4
- package/lib/verifier/node/termAsConstructor.js +7 -27
- package/lib/verifier/nodes/equality.js +8 -8
- package/lib/verifier/nodes/metaLevelToIntrinsicLevel.js +22 -6
- package/lib/verify/containment.js +22 -12
- package/lib/verify/defining.js +38 -0
- package/lib/verify/metavariable.js +26 -4
- package/lib/verify/statement.js +62 -45
- package/lib/verify/term.js +6 -6
- package/lib/verify/type.js +7 -7
- package/lib/verify/variable.js +26 -4
- package/package.json +1 -1
- package/src/constants.js +1 -0
- package/src/context/file.js +35 -8
- package/src/context/local.js +113 -44
- package/src/context/localMeta.js +3 -3
- package/src/context/release.js +6 -9
- package/src/equality.js +2 -2
- package/src/{collection.js → equivalence.js} +84 -28
- package/src/log.js +2 -2
- package/src/term.js +48 -0
- package/src/utilities/array.js +1 -1
- package/src/utilities/equivalences.js +152 -0
- package/src/verifier/node/metastatement.js +23 -51
- package/src/verifier/node/statementAsCombinator.js +9 -6
- package/src/verifier/node/termAsConstructor.js +13 -44
- package/src/verifier/nodes/equality.js +7 -7
- package/src/verifier/nodes/metaLevelToIntrinsicLevel.js +38 -12
- package/src/verify/containment.js +31 -20
- package/src/verify/defining.js +43 -0
- package/src/verify/metavariable.js +22 -0
- package/src/verify/statement.js +88 -54
- package/src/verify/term.js +4 -5
- package/src/verify/type.js +6 -7
- package/src/verify/variable.js +22 -0
- package/lib/collection.js +0 -192
- package/lib/utilities/collection.js +0 -121
- package/src/utilities/collection.js +0 -103
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { compress } from "../utilities/array";
|
|
4
|
-
|
|
5
|
-
export function areTermNodesEqual(leftTermNode, rightTermNode, collections) {
|
|
6
|
-
let termNodesEqual;
|
|
7
|
-
|
|
8
|
-
const leftTermNodeMatchesRightTermNode = leftTermNode.match(rightTermNode);
|
|
9
|
-
|
|
10
|
-
if (leftTermNodeMatchesRightTermNode) {
|
|
11
|
-
termNodesEqual = true;
|
|
12
|
-
} else {
|
|
13
|
-
const termNodes = [
|
|
14
|
-
leftTermNode,
|
|
15
|
-
rightTermNode
|
|
16
|
-
],
|
|
17
|
-
collection = findCollectionByTermNodes(collections, termNodes);
|
|
18
|
-
|
|
19
|
-
termNodesEqual = (collection !== null);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return termNodesEqual;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export function mergeCollections(collectionsA, collectionsB, localContext) {
|
|
26
|
-
const typesA = typesFromCollections(collectionsA, localContext),
|
|
27
|
-
typesB = typesFromCollections(collectionsB, localContext),
|
|
28
|
-
types = [
|
|
29
|
-
...typesA,
|
|
30
|
-
...typesB
|
|
31
|
-
];
|
|
32
|
-
|
|
33
|
-
compress(types, (typeA, typeB) => {
|
|
34
|
-
if (typeA === typeB) {
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
const collections = types.map((type) => {
|
|
40
|
-
let collection;
|
|
41
|
-
|
|
42
|
-
const collectionA = findCollectionByType(collectionsA, type, localContext),
|
|
43
|
-
collectionB = findCollectionByType(collectionsB, type, localContext);
|
|
44
|
-
|
|
45
|
-
if ((collectionA !== null) && (collectionB !== null)) {
|
|
46
|
-
collection = Collection.fromCollections(collectionA, collectionB);
|
|
47
|
-
} else if (collectionA !== null) {
|
|
48
|
-
collection = collectionA; ///
|
|
49
|
-
} else if (collectionB !== null) {
|
|
50
|
-
collection = collectionB; ///
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return collection;
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
return collections;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export function findCollectionByType(collections, type, localContext) {
|
|
60
|
-
const collection = collections.find((collection) => {
|
|
61
|
-
const collectionMatchesType = collection.matchType(type, localContext);
|
|
62
|
-
|
|
63
|
-
if (collectionMatchesType) {
|
|
64
|
-
return true;
|
|
65
|
-
}
|
|
66
|
-
}) || null;
|
|
67
|
-
|
|
68
|
-
return collection;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export function findCollectionByTerm(collections, term) {
|
|
72
|
-
const collection = collections.find((collection) => {
|
|
73
|
-
const collectionMatchesTerm = collection.matchTerm(term);
|
|
74
|
-
|
|
75
|
-
if (collectionMatchesTerm) {
|
|
76
|
-
return true;
|
|
77
|
-
}
|
|
78
|
-
}) || null;
|
|
79
|
-
|
|
80
|
-
return collection;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function findCollectionByTermNodes(collections, termNodes) {
|
|
84
|
-
const collection = collections.find((collection) => {
|
|
85
|
-
const collectionMatchesTerms = collection.matchTermNodes(termNodes);
|
|
86
|
-
|
|
87
|
-
if (collectionMatchesTerms) {
|
|
88
|
-
return true;
|
|
89
|
-
}
|
|
90
|
-
}) || null;
|
|
91
|
-
|
|
92
|
-
return collection;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
function typesFromCollections(collections, localContext) {
|
|
96
|
-
const types = collections.map((collection) => {
|
|
97
|
-
const type = collection.getType(localContext);
|
|
98
|
-
|
|
99
|
-
return type;
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
return types;
|
|
103
|
-
}
|