occam-verify-cli 0.0.836 → 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.
Files changed (50) hide show
  1. package/lib/constants.js +5 -1
  2. package/lib/context/file.js +24 -9
  3. package/lib/context/local.js +77 -39
  4. package/lib/context/localMeta.js +3 -3
  5. package/lib/context/release.js +4 -5
  6. package/lib/equality.js +2 -2
  7. package/lib/equivalence.js +244 -0
  8. package/lib/log.js +3 -3
  9. package/lib/term.js +40 -1
  10. package/lib/utilities/array.js +5 -5
  11. package/lib/utilities/equivalences.js +169 -0
  12. package/lib/verifier/node/metastatement.js +12 -31
  13. package/lib/verifier/node/statementAsCombinator.js +4 -4
  14. package/lib/verifier/node/termAsConstructor.js +7 -27
  15. package/lib/verifier/nodes/equality.js +8 -8
  16. package/lib/verifier/nodes/metaLevelToIntrinsicLevel.js +22 -6
  17. package/lib/verify/containment.js +22 -12
  18. package/lib/verify/defining.js +38 -0
  19. package/lib/verify/metavariable.js +26 -4
  20. package/lib/verify/statement.js +62 -45
  21. package/lib/verify/term.js +6 -6
  22. package/lib/verify/type.js +7 -7
  23. package/lib/verify/variable.js +26 -4
  24. package/package.json +2 -2
  25. package/src/constants.js +1 -0
  26. package/src/context/file.js +35 -8
  27. package/src/context/local.js +113 -44
  28. package/src/context/localMeta.js +3 -3
  29. package/src/context/release.js +6 -9
  30. package/src/equality.js +2 -2
  31. package/src/{collection.js → equivalence.js} +84 -28
  32. package/src/log.js +2 -2
  33. package/src/term.js +48 -0
  34. package/src/utilities/array.js +1 -1
  35. package/src/utilities/equivalences.js +152 -0
  36. package/src/verifier/node/metastatement.js +23 -51
  37. package/src/verifier/node/statementAsCombinator.js +9 -6
  38. package/src/verifier/node/termAsConstructor.js +13 -44
  39. package/src/verifier/nodes/equality.js +7 -7
  40. package/src/verifier/nodes/metaLevelToIntrinsicLevel.js +38 -12
  41. package/src/verify/containment.js +31 -20
  42. package/src/verify/defining.js +43 -0
  43. package/src/verify/metavariable.js +22 -0
  44. package/src/verify/statement.js +88 -54
  45. package/src/verify/term.js +4 -5
  46. package/src/verify/type.js +6 -7
  47. package/src/verify/variable.js +22 -0
  48. package/lib/collection.js +0 -192
  49. package/lib/utilities/collection.js +0 -121
  50. 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
- }