occam-verify-cli 0.0.902 → 0.0.903
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/axiomLemmaTheoremConjecture.js +18 -34
- package/lib/constants.js +1 -9
- package/lib/metaLemmaMetatheorem.js +22 -40
- package/lib/rule.js +45 -83
- package/lib/ruleNames.js +1 -21
- package/lib/utilities/array.js +49 -42
- package/lib/utilities/verifier.js +4 -10
- package/lib/verifier/node/statementAsCombinator.js +7 -2
- package/lib/verifier/nodes/metaLevel.js +13 -3
- package/lib/verify/containedAssertion.js +2 -2
- package/lib/verify/premise.js +1 -3
- package/lib/verify/statement/qualified.js +4 -7
- package/lib/verify/statement/unqualified.js +2 -5
- package/lib/verify/statement.js +30 -18
- package/package.json +1 -1
- package/src/axiomLemmaTheoremConjecture.js +27 -47
- package/src/constants.js +0 -2
- package/src/metaLemmaMetatheorem.js +33 -54
- package/src/rule.js +58 -101
- package/src/ruleNames.js +0 -5
- package/src/utilities/array.js +22 -42
- package/src/utilities/verifier.js +3 -11
- package/src/verifier/node/statementAsCombinator.js +11 -4
- package/src/verifier/nodes/metaLevel.js +19 -4
- package/src/verify/containedAssertion.js +1 -1
- package/src/verify/premise.js +0 -2
- package/src/verify/statement/qualified.js +3 -7
- package/src/verify/statement/unqualified.js +1 -5
- package/src/verify/statement.js +33 -17
- package/lib/permutationsMatrix.js +0 -466136
- package/lib/utilities/permutations.js +0 -114
- package/src/permutationsMatrix.js +0 -6
- package/src/utilities/permutations.js +0 -148
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { fileSystemUtilities } from "necessary";
|
|
4
|
-
|
|
5
|
-
import { push, last, first } from "../utilities/array";
|
|
6
|
-
import { MAXIMUM_INDEXES_LENGTH, MAXIMUM_PERMUTATION_LENGTH } from "../constants";
|
|
7
|
-
|
|
8
|
-
const { writeFile } = fileSystemUtilities;
|
|
9
|
-
|
|
10
|
-
writePermutationsMatrixFile();
|
|
11
|
-
|
|
12
|
-
function permutationsMatrixFromNothing() {
|
|
13
|
-
const permutationsMatrix = [];
|
|
14
|
-
|
|
15
|
-
for (let indexesLength = 0; indexesLength <= MAXIMUM_INDEXES_LENGTH; indexesLength++) {
|
|
16
|
-
const permutationsArray = [];
|
|
17
|
-
|
|
18
|
-
for (let permutationLength = 0; permutationLength <= MAXIMUM_PERMUTATION_LENGTH; permutationLength++) {
|
|
19
|
-
const permutations = ((permutationLength === 0) || (permutationLength > indexesLength)) ?
|
|
20
|
-
null :
|
|
21
|
-
permutationsFromIndexesLengthAndPermutationLength(indexesLength, permutationLength);
|
|
22
|
-
|
|
23
|
-
permutationsArray.push(permutations);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
permutationsMatrix.push(permutationsArray);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return permutationsMatrix;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function writePermutationsMatrixFile() {
|
|
33
|
-
const permutationsMatrix = permutationsMatrixFromNothing(),
|
|
34
|
-
permutationsMatrixJSON = JSON.stringify(permutationsMatrix),
|
|
35
|
-
permutationsMatrixFileName = "./bin/permutationsMatrix.js",
|
|
36
|
-
permutationsMatrixFileContent = `"use strict";
|
|
37
|
-
|
|
38
|
-
const permutationsMatrix = ${permutationsMatrixJSON};
|
|
39
|
-
|
|
40
|
-
export default permutationsMatrix;
|
|
41
|
-
`;
|
|
42
|
-
|
|
43
|
-
writeFile(permutationsMatrixFileName, permutationsMatrixFileContent)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function permutationsFromChoice(choice) {
|
|
47
|
-
const permutations = [],
|
|
48
|
-
choiceLength = choice.length;
|
|
49
|
-
|
|
50
|
-
if (choiceLength === 1) {
|
|
51
|
-
const permutation = choice.slice();
|
|
52
|
-
|
|
53
|
-
permutations.push(permutation);
|
|
54
|
-
} else {
|
|
55
|
-
const innerChoice = choice.slice(0),
|
|
56
|
-
start = 0,
|
|
57
|
-
deleteCount = 1,
|
|
58
|
-
indexes = innerChoice.splice(start, deleteCount),
|
|
59
|
-
firstIndex = first(indexes),
|
|
60
|
-
innerPermutations = permutationsFromChoice(innerChoice);
|
|
61
|
-
|
|
62
|
-
innerPermutations.forEach((innerPermutation) => {
|
|
63
|
-
for (let position = 0; position < choiceLength; position++) {
|
|
64
|
-
const permutation = innerPermutation.slice(0),
|
|
65
|
-
start = position, ///
|
|
66
|
-
deleteCount = 0;
|
|
67
|
-
|
|
68
|
-
permutation.splice(start, deleteCount, firstIndex);
|
|
69
|
-
|
|
70
|
-
permutations.push(permutation);
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return permutations;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function permutationsFromChoices(choices) {
|
|
79
|
-
const permutations = [];
|
|
80
|
-
|
|
81
|
-
choices.forEach((choice) => {
|
|
82
|
-
const choicePermutations = permutationsFromChoice(choice);
|
|
83
|
-
|
|
84
|
-
push(permutations, choicePermutations);
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
return permutations;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
function indexesFromIndexesLength(indexesLength) {
|
|
91
|
-
const indexes = [];
|
|
92
|
-
|
|
93
|
-
for (let index = 0; index < indexesLength; index++) {
|
|
94
|
-
indexes.push(index);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
return indexes;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
function choicesFromIndexesAndChoiceLength(indexes, choiceLength) {
|
|
101
|
-
const choices = [],
|
|
102
|
-
indexesLength = indexes.length;
|
|
103
|
-
|
|
104
|
-
if (choiceLength === 0) {
|
|
105
|
-
///
|
|
106
|
-
} else if (choiceLength === 1) {
|
|
107
|
-
for (let position = 0; position < indexesLength; position++) {
|
|
108
|
-
const index = indexes[position],
|
|
109
|
-
choice = [
|
|
110
|
-
index
|
|
111
|
-
];
|
|
112
|
-
|
|
113
|
-
choices.push(choice);
|
|
114
|
-
}
|
|
115
|
-
} else {
|
|
116
|
-
const innerChoiceLength = choiceLength - 1;
|
|
117
|
-
|
|
118
|
-
for (let position = 0; position < indexesLength; position++) {
|
|
119
|
-
const innerIndexes = indexes.slice(0),
|
|
120
|
-
start = 0, ///
|
|
121
|
-
deleteCount = position + 1,
|
|
122
|
-
deletedIndexes = innerIndexes.splice(start, deleteCount),
|
|
123
|
-
lastDeletedIndex = last(deletedIndexes),
|
|
124
|
-
index = lastDeletedIndex, ///
|
|
125
|
-
innerChoices = choicesFromIndexesAndChoiceLength(innerIndexes, innerChoiceLength);
|
|
126
|
-
|
|
127
|
-
innerChoices.forEach((innerChoice) => {
|
|
128
|
-
const choice = [
|
|
129
|
-
index,
|
|
130
|
-
...innerChoice
|
|
131
|
-
];
|
|
132
|
-
|
|
133
|
-
choices.push(choice);
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
return choices;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
function permutationsFromIndexesLengthAndPermutationLength(indexesLength, permutationLength) {
|
|
142
|
-
const choiceLength = permutationLength, ///
|
|
143
|
-
indexes = indexesFromIndexesLength(indexesLength),
|
|
144
|
-
choices = choicesFromIndexesAndChoiceLength(indexes, choiceLength),
|
|
145
|
-
permutations = permutationsFromChoices(choices);
|
|
146
|
-
|
|
147
|
-
return permutations;
|
|
148
|
-
}
|