occam-verify-cli 0.0.272 → 0.0.274
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/.swcrc +5 -0
- package/bin/abbreviations.js +4 -2
- package/bin/context/{package → release}/fileSystem.js +38 -25
- package/bin/fileNames.js +7 -7
- package/bin/loadReleaseContexts.js +52 -0
- package/bin/main.js +8 -9
- package/bin/options.js +2 -2
- package/bin/utilities/fileSystem.js +13 -15
- package/lib/assertion.js +140 -0
- package/lib/axiom.js +90 -0
- package/lib/browser.js +27 -0
- package/lib/combinator.js +58 -0
- package/lib/conclusion.js +140 -0
- package/lib/constants.js +42 -0
- package/lib/constructor.js +76 -0
- package/lib/context/file.js +342 -0
- package/lib/context/metaproof.js +232 -0
- package/lib/context/proof.js +211 -0
- package/lib/context/release.js +303 -0
- package/lib/main.js +27 -0
- package/lib/metaAssertion.js +200 -0
- package/lib/metaSubstitution.js +123 -0
- package/lib/permutationsMatrix.js +466136 -0
- package/lib/premise.js +168 -0
- package/lib/rule.js +139 -0
- package/lib/ruleNames.js +46 -0
- package/lib/type.js +153 -0
- package/lib/utilities/array.js +99 -0
- package/lib/utilities/metastatement.js +45 -0
- package/lib/utilities/permutations.js +114 -0
- package/lib/utilities/query.js +81 -0
- package/lib/utilities/string.js +54 -0
- package/lib/variable.js +94 -0
- package/lib/verify/IndicativeConditional.js +29 -0
- package/lib/verify/assertion/type.js +52 -0
- package/lib/verify/axiom.js +52 -0
- package/lib/verify/conclusion.js +34 -0
- package/lib/verify/conditinalInference.js +30 -0
- package/lib/verify/declaration/combinator.js +24 -0
- package/lib/verify/declaration/constructor.js +24 -0
- package/lib/verify/declaration/topLevel.js +51 -0
- package/lib/verify/declaration/type.js +24 -0
- package/lib/verify/declaration/variable.js +24 -0
- package/lib/verify/equality.js +45 -0
- package/lib/verify/file.js +39 -0
- package/lib/verify/files.js +48 -0
- package/lib/verify/label.js +24 -0
- package/lib/verify/labels.js +27 -0
- package/lib/verify/metaDerivation.js +94 -0
- package/lib/verify/metaproof.js +81 -0
- package/lib/verify/metastatement/qualified.js +31 -0
- package/lib/verify/metastatement/unqualified.js +39 -0
- package/lib/verify/premiseOrPremises.js +39 -0
- package/lib/verify/release.js +61 -0
- package/lib/verify/rule.js +61 -0
- package/lib/verify/statement/qualified.js +24 -0
- package/lib/verify/statement/unqualified.js +32 -0
- package/lib/verify/statement.js +43 -0
- package/lib/verify/statementAsCombinator.js +102 -0
- package/lib/verify/supposition.js +29 -0
- package/lib/verify/term.js +121 -0
- package/lib/verify/termAsConstructor.js +126 -0
- package/lib/verify/termAsVariable.js +31 -0
- package/lib/verify/type.js +45 -0
- package/lib/verify/unconditionalInference.js +31 -0
- package/lib/verify/variable.js +48 -0
- package/package.json +21 -5
- package/{bin → src}/assertion.js +2 -4
- package/src/axiom.js +49 -0
- package/src/browser.js +4 -0
- package/{bin → src}/combinator.js +2 -4
- package/{bin → src}/conclusion.js +4 -6
- package/src/constants.js +9 -0
- package/{bin → src}/constructor.js +2 -4
- package/{bin → src}/context/file.js +34 -24
- package/{bin → src}/context/metaproof.js +13 -3
- package/{bin → src}/context/proof.js +13 -3
- package/src/context/release.js +219 -0
- package/src/main.js +4 -0
- package/{bin → src}/metaAssertion.js +4 -6
- package/{bin → src}/metaSubstitution.js +11 -4
- package/{bin → src}/permutationsMatrix.js +1 -1
- package/{bin → src}/premise.js +6 -8
- package/{bin → src}/rule.js +24 -15
- package/src/ruleNames.js +10 -0
- package/{bin → src}/type.js +1 -3
- package/{bin → src}/utilities/array.js +19 -24
- package/{bin → src}/utilities/metastatement.js +18 -12
- package/{bin → src}/utilities/permutations.js +4 -4
- package/{bin → src}/utilities/query.js +8 -18
- package/{bin → src}/utilities/string.js +4 -10
- package/{bin → src}/variable.js +1 -3
- package/src/verify/IndicativeConditional.js +20 -0
- package/{bin → src}/verify/assertion/type.js +8 -14
- package/src/verify/axiom.js +68 -0
- package/{bin → src}/verify/conclusion.js +4 -6
- package/src/verify/conditinalInference.js +25 -0
- package/{bin → src}/verify/declaration/combinator.js +3 -5
- package/{bin → src}/verify/declaration/constructor.js +3 -5
- package/{bin → src}/verify/declaration/topLevel.js +8 -10
- package/{bin → src}/verify/declaration/type.js +3 -5
- package/{bin → src}/verify/declaration/variable.js +3 -5
- package/{bin → src}/verify/equality.js +4 -6
- package/{bin → src}/verify/file.js +9 -15
- package/{bin → src}/verify/files.js +5 -7
- package/{bin → src}/verify/label.js +3 -9
- package/{bin → src}/verify/labels.js +2 -4
- package/{bin → src}/verify/metaDerivation.js +25 -19
- package/{bin → src}/verify/metaproof.js +6 -7
- package/{bin → src}/verify/metastatement/qualified.js +4 -10
- package/{bin → src}/verify/metastatement/unqualified.js +5 -11
- package/{bin → src}/verify/premiseOrPremises.js +9 -10
- package/src/verify/release.js +70 -0
- package/{bin → src}/verify/rule.js +17 -20
- package/{bin → src}/verify/statement/qualified.js +3 -5
- package/{bin → src}/verify/statement/unqualified.js +3 -5
- package/{bin → src}/verify/statement.js +7 -13
- package/{bin → src}/verify/statementAsCombinator.js +8 -14
- package/{bin → src}/verify/supposition.js +4 -6
- package/{bin → src}/verify/term.js +7 -13
- package/{bin → src}/verify/termAsConstructor.js +13 -19
- package/{bin → src}/verify/termAsVariable.js +3 -9
- package/{bin → src}/verify/type.js +7 -13
- package/{bin → src}/verify/unconditionalInference.js +4 -11
- package/{bin → src}/verify/variable.js +6 -12
- package/bin/axiom.js +0 -52
- package/bin/consequent.js +0 -19
- package/bin/constants.js +0 -19
- package/bin/context/package.js +0 -221
- package/bin/loadPackageContexts.js +0 -53
- package/bin/permutations.js +0 -3
- package/bin/ruleNames.js +0 -23
- package/bin/verify/axiom/IndicativeConditional.js +0 -54
- package/bin/verify/axiom/unqualifiedStatement.js +0 -40
- package/bin/verify/axiom.js +0 -37
- package/bin/verify/conditinalInference.js +0 -42
- package/bin/verify/consequent.js +0 -32
- package/bin/verify/metaConsequent.js +0 -23
- package/bin/verify/metaSupposition.js +0 -24
- package/bin/verify/package.js +0 -81
- package/index.js +0 -9
package/bin/context/package.js
DELETED
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const { CustomGrammar, lexersUtilities, parsersUtilities, CombinedCustomGrammar } = require("occam-custom-grammars");
|
|
4
|
-
|
|
5
|
-
const { push } = require("../utilities/array");
|
|
6
|
-
|
|
7
|
-
const { florenceLexerFromCombinedCustomGrammar } = lexersUtilities,
|
|
8
|
-
{ florenceParserFromCombinedCustomGrammar } = parsersUtilities;
|
|
9
|
-
|
|
10
|
-
class PackageContext {
|
|
11
|
-
constructor(packageName, fileContexts, florenceLexer, florenceParser, packageContexts, packageVerified) {
|
|
12
|
-
this.packageName = packageName;
|
|
13
|
-
this.fileContexts = fileContexts;
|
|
14
|
-
this.florenceLexer = florenceLexer;
|
|
15
|
-
this.florenceParser = florenceParser;
|
|
16
|
-
this.packageContexts = packageContexts;
|
|
17
|
-
this.packageVerified = packageVerified;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
getPackageName() {
|
|
21
|
-
return this.packageName;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
getFileContexts() {
|
|
25
|
-
return this.fileContexts;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
getFlorenceLexer() {
|
|
29
|
-
return this.florenceLexer;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
getFlorenceParser() {
|
|
33
|
-
return this.florenceParser;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
getPackageContexts() {
|
|
37
|
-
return this.packageContexts;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
isPackageVerified() {
|
|
41
|
-
return this.packageVerified;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
getRules(packageNames = []) {
|
|
45
|
-
const rules = [],
|
|
46
|
-
packageNamesIncludesPackageName = packageNames.includes(this.packageName);
|
|
47
|
-
|
|
48
|
-
if (!packageNamesIncludesPackageName) {
|
|
49
|
-
packageNames.push(this.packageName);
|
|
50
|
-
|
|
51
|
-
const bubble = false;
|
|
52
|
-
|
|
53
|
-
this.fileContexts.forEach((fileContext) => {
|
|
54
|
-
const fileContextRules = fileContext.getRules(bubble);
|
|
55
|
-
|
|
56
|
-
push(rules, fileContextRules);
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
this.packageContexts.forEach((packageContext) => {
|
|
60
|
-
const packageContextRules = packageContext.getRules(packageNames);
|
|
61
|
-
|
|
62
|
-
push(rules, packageContextRules);
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return rules;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
getTypes(packageNames = []) {
|
|
70
|
-
const types = [],
|
|
71
|
-
packageNamesIncludesPackageName = packageNames.includes(this.packageName);
|
|
72
|
-
|
|
73
|
-
if (!packageNamesIncludesPackageName) {
|
|
74
|
-
packageNames.push(this.packageName);
|
|
75
|
-
|
|
76
|
-
const bubble = false;
|
|
77
|
-
|
|
78
|
-
this.fileContexts.forEach((fileContext) => {
|
|
79
|
-
const fileContextTypes = fileContext.getTypes(bubble);
|
|
80
|
-
|
|
81
|
-
push(types, fileContextTypes);
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
this.packageContexts.forEach((packageContext) => {
|
|
85
|
-
const packageContextTypes = packageContext.getTypes(packageNames);
|
|
86
|
-
|
|
87
|
-
push(types, packageContextTypes);
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return types;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
getAxioms(packageNames = []) {
|
|
95
|
-
const axioms = [],
|
|
96
|
-
packageNamesIncludesPackageName = packageNames.includes(this.packageName);
|
|
97
|
-
|
|
98
|
-
if (!packageNamesIncludesPackageName) {
|
|
99
|
-
packageNames.push(this.packageName);
|
|
100
|
-
|
|
101
|
-
const bubble = false;
|
|
102
|
-
|
|
103
|
-
this.fileContexts.forEach((fileContext) => {
|
|
104
|
-
const fileContextAxioms = fileContext.getAxioms(bubble);
|
|
105
|
-
|
|
106
|
-
push(axioms, fileContextAxioms);
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
this.packageContexts.forEach((packageContext) => {
|
|
110
|
-
const packageContextAxioms = packageContext.getAxioms(packageNames);
|
|
111
|
-
|
|
112
|
-
push(axioms, packageContextAxioms);
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
return axioms;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
getCombinators(packageNames = []) {
|
|
120
|
-
const combinators = [],
|
|
121
|
-
packageNamesIncludesPackageName = packageNames.includes(this.packageName);
|
|
122
|
-
|
|
123
|
-
if (!packageNamesIncludesPackageName) {
|
|
124
|
-
packageNames.push(this.packageName);
|
|
125
|
-
|
|
126
|
-
const bubble = false;
|
|
127
|
-
|
|
128
|
-
this.fileContexts.forEach((fileContext) => {
|
|
129
|
-
const fileContextCombinators = fileContext.getCombinators(bubble);
|
|
130
|
-
|
|
131
|
-
push(combinators, fileContextCombinators);
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
this.packageContexts.forEach((packageContext) => {
|
|
135
|
-
const packageContextCombinators = packageContext.getCombinators(packageNames);
|
|
136
|
-
|
|
137
|
-
push(combinators, packageContextCombinators);
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
return combinators;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
getConstructors(packageNames = []) {
|
|
145
|
-
const constructors = [],
|
|
146
|
-
packageNamesIncludesPackageName = packageNames.includes(this.packageName);
|
|
147
|
-
|
|
148
|
-
if (!packageNamesIncludesPackageName) {
|
|
149
|
-
packageNames.push(this.packageName);
|
|
150
|
-
|
|
151
|
-
const bubble = false;
|
|
152
|
-
|
|
153
|
-
this.fileContexts.forEach((fileContext) => {
|
|
154
|
-
const fileContextConstructors = fileContext.getConstructors(bubble);
|
|
155
|
-
|
|
156
|
-
push(constructors, fileContextConstructors);
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
this.packageContexts.forEach((packageContext) => {
|
|
160
|
-
const packageContextConstructors = packageContext.getConstructors(packageNames);
|
|
161
|
-
|
|
162
|
-
push(constructors, packageContextConstructors);
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
return constructors;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
getCustomGrammar() {
|
|
170
|
-
const name = this.packageName, ///
|
|
171
|
-
termBNF = this.getTermBNF(),
|
|
172
|
-
statementBNF = this.getStatementBNF(),
|
|
173
|
-
metastatementBNF = this.getMetastatementBNF(),
|
|
174
|
-
typePattern = this.getTypePattern(),
|
|
175
|
-
symbolPattern = this.getSymbolPattern(),
|
|
176
|
-
operatorPattern = this.getOperatorPattern(),
|
|
177
|
-
customGrammar = new CustomGrammar(name, termBNF, statementBNF, metastatementBNF, typePattern, symbolPattern, operatorPattern);
|
|
178
|
-
|
|
179
|
-
return customGrammar;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
addFileContext(fileContext) {
|
|
183
|
-
this.fileContexts.push(fileContext);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
tokenise(content) { return this.florenceLexer.tokenise(content); }
|
|
187
|
-
|
|
188
|
-
parse(tokens) { return this.florenceParser.parse(tokens); }
|
|
189
|
-
|
|
190
|
-
initialise(packageContexts, dependencyPackageContexts) {
|
|
191
|
-
this.packageContexts = packageContexts;
|
|
192
|
-
|
|
193
|
-
const packageContext = this; ///
|
|
194
|
-
|
|
195
|
-
packageContexts = [ packageContext, ...dependencyPackageContexts ]; ///
|
|
196
|
-
|
|
197
|
-
const customGrammars = packageContexts.map((packageContext) => {
|
|
198
|
-
const customGrammar = packageContext.getCustomGrammar();
|
|
199
|
-
|
|
200
|
-
return customGrammar;
|
|
201
|
-
}),
|
|
202
|
-
combinedCustomGrammar = CombinedCustomGrammar.fromCustomGrammars(customGrammars);
|
|
203
|
-
|
|
204
|
-
this.florenceLexer = florenceLexerFromCombinedCustomGrammar(combinedCustomGrammar);
|
|
205
|
-
|
|
206
|
-
this.florenceParser = florenceParserFromCombinedCustomGrammar(combinedCustomGrammar);
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
static fromPackageName(Class, packageName, ...remainingArguments) {
|
|
210
|
-
const fileContexts = [],
|
|
211
|
-
florenceLexer = null,
|
|
212
|
-
florenceParser = null,
|
|
213
|
-
packageContexts = [],
|
|
214
|
-
packageVerified = false,
|
|
215
|
-
packageContext = new Class(packageName, fileContexts, florenceLexer, florenceParser, packageContexts, packageVerified, ...remainingArguments);
|
|
216
|
-
|
|
217
|
-
return packageContext;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
module.exports = PackageContext;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const { loggingUtilities } = require("necessary");
|
|
4
|
-
|
|
5
|
-
const FileSystemPackageContext = require("./context/package/fileSystem");
|
|
6
|
-
|
|
7
|
-
const { first } = require("./utilities/array");
|
|
8
|
-
|
|
9
|
-
const { log } = loggingUtilities;
|
|
10
|
-
|
|
11
|
-
function loadPackageContexts(packageName, packageContextMap = {}, dependentPackageNames = []) {
|
|
12
|
-
const cyclicDependencyExists = checkCyclicDependencyExists(packageName, dependentPackageNames);
|
|
13
|
-
|
|
14
|
-
if (!cyclicDependencyExists) {
|
|
15
|
-
const packageContext = packageContextMap[packageName] || null;
|
|
16
|
-
|
|
17
|
-
if (packageContext === null) {
|
|
18
|
-
const fileSystemPackageContext = FileSystemPackageContext.fromPackageName(packageName),
|
|
19
|
-
packageContext = fileSystemPackageContext; ///
|
|
20
|
-
|
|
21
|
-
packageContextMap[packageName] = packageContext;
|
|
22
|
-
|
|
23
|
-
const dependencyPackageNames = packageContext.getDependencyPackageNames(packageName);
|
|
24
|
-
|
|
25
|
-
dependentPackageNames = [ ...dependentPackageNames, packageName ]; ///
|
|
26
|
-
|
|
27
|
-
dependencyPackageNames.forEach((dependencyPackageName) => {
|
|
28
|
-
const packageName = dependencyPackageName; ///
|
|
29
|
-
|
|
30
|
-
loadPackageContexts(packageName, packageContextMap, dependentPackageNames);
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return packageContextMap;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
module.exports = loadPackageContexts;
|
|
39
|
-
|
|
40
|
-
function checkCyclicDependencyExists(packageName, dependentPackageNames) {
|
|
41
|
-
const dependentPackageNamesIncludesPackageName = dependentPackageNames.includes(packageName),
|
|
42
|
-
cyclicDependencyExists = dependentPackageNamesIncludesPackageName; ///
|
|
43
|
-
|
|
44
|
-
if (cyclicDependencyExists) {
|
|
45
|
-
const firstDependentPackageName = first(dependentPackageNames),
|
|
46
|
-
packageNames = dependentPackageNames.concat(firstDependentPackageName),
|
|
47
|
-
packageNamesString = packageNames.join(`' -> '`);
|
|
48
|
-
|
|
49
|
-
log.error(`There is a cyclic dependency: '${packageNamesString}'.`);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return cyclicDependencyExists;
|
|
53
|
-
}
|
package/bin/permutations.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
[[0,1,2],[1,0,2],[1,2,0],[0,2,1],[2,0,1],[2,1,0],[0,1,3],[1,0,3],[1,3,0],[0,3,1],[3,0,1],[3,1,0],[0,1,4],[1,0,4],[1,4,0],[0,4,1],[4,0,1],[4,1,0],[0,2,3],[2,0,3],[2,3,0],[0,3,2],[3,0,2],[3,2,0],[0,2,4],[2,0,4],[2,4,0],[0,4,2],[4,0,2],[4,2,0],[0,3,4],[3,0,4],[3,4,0],[0,4,3],[4,0,3],[4,3,0],[1,2,3],[2,1,3],[2,3,1],[1,3,2],[3,1,2],[3,2,1],[1,2,4],[2,1,4],[2,4,1],[1,4,2],[4,1,2],[4,2,1],[1,3,4],[3,1,4],[3,4,1],[1,4,3],[4,1,3],[4,3,1],[2,3,4],[3,2,4],[3,4,2],[2,4,3],[4,2,3],[4,3,2]]
|
package/bin/ruleNames.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const TERM_RULE_NAME = "term",
|
|
4
|
-
TYPE_RULE_NAME = "type",
|
|
5
|
-
ARGUMENT_RULE_NAME = "argument",
|
|
6
|
-
METAVARIABLE_RULE_NAME = "metavariable",
|
|
7
|
-
METASTATEMENT_RULE_NAME = "metastatement",
|
|
8
|
-
META_SUBPROOF_RULE_NAME = "metaSubproof",
|
|
9
|
-
META_SUBPROOF_ASSERTION_RULE_NAME = "metaSubproofAssertion",
|
|
10
|
-
QUALIFIED_METASTATEMENT_RULE_NAME = "qualifiedMetastatement",
|
|
11
|
-
UNQUALIFIED_METASTATEMENT_RULE_NAME = "unqualifiedMetastatement";
|
|
12
|
-
|
|
13
|
-
module.exports = {
|
|
14
|
-
TERM_RULE_NAME,
|
|
15
|
-
TYPE_RULE_NAME,
|
|
16
|
-
ARGUMENT_RULE_NAME,
|
|
17
|
-
METAVARIABLE_RULE_NAME,
|
|
18
|
-
METASTATEMENT_RULE_NAME,
|
|
19
|
-
META_SUBPROOF_RULE_NAME,
|
|
20
|
-
META_SUBPROOF_ASSERTION_RULE_NAME,
|
|
21
|
-
QUALIFIED_METASTATEMENT_RULE_NAME,
|
|
22
|
-
UNQUALIFIED_METASTATEMENT_RULE_NAME
|
|
23
|
-
};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const Axiom = require("../../axiom"),
|
|
4
|
-
verifyLabels = require("../../verify/labels"),
|
|
5
|
-
verifySupposition = require("../../verify/antecedent"),
|
|
6
|
-
verifyConsequent = require("../../verify/consequent");
|
|
7
|
-
|
|
8
|
-
const { first } = require("../../utilities/array"),
|
|
9
|
-
{ nodeQuery, nodesQuery } = require("../../utilities/query");
|
|
10
|
-
|
|
11
|
-
const labelNodesQuery = nodesQuery("/axiom/label"),
|
|
12
|
-
antecedentNodeQuery = nodeQuery("/indicativeConditional/antecedent!"),
|
|
13
|
-
consequentNodeQuery = nodeQuery("/indicativeConditional/consequent!"),
|
|
14
|
-
indicativeConditionalNodeQuery = nodeQuery("/axiom/indicativeConditional!");
|
|
15
|
-
|
|
16
|
-
function verifyIndicativeConditionalAxiom(axiomNode, context) {
|
|
17
|
-
let indicativeConditionalAxiomVerified = false;
|
|
18
|
-
|
|
19
|
-
const indicativeConditionalNode = indicativeConditionalNodeQuery(axiomNode);
|
|
20
|
-
|
|
21
|
-
if (indicativeConditionalNode !== null) {
|
|
22
|
-
const labels = [],
|
|
23
|
-
labelNodes = labelNodesQuery(axiomNode),
|
|
24
|
-
labelsVerified = verifyLabels(labelNodes, labels, context);
|
|
25
|
-
|
|
26
|
-
if (labelsVerified) {
|
|
27
|
-
const antecedents = [],
|
|
28
|
-
antecedentNode = antecedentNodeQuery(indicativeConditionalNode),
|
|
29
|
-
antecedentVerified = verifySupposition(antecedentNode, antecedents, context);
|
|
30
|
-
|
|
31
|
-
if (antecedentVerified) {
|
|
32
|
-
const consequents = [],
|
|
33
|
-
consequentNode = consequentNodeQuery(indicativeConditionalNode),
|
|
34
|
-
consequentVerified = verifyConsequent(consequentNode, consequents, context);
|
|
35
|
-
|
|
36
|
-
if (consequentVerified) {
|
|
37
|
-
const firstSupposition = first(antecedents),
|
|
38
|
-
firstConsequent = first(consequents),
|
|
39
|
-
antecedent = firstSupposition, ///
|
|
40
|
-
consequent = firstConsequent, ///
|
|
41
|
-
axiom = Axiom.fromSuppositionConsequentAndLabels(antecedent, consequent, labels);
|
|
42
|
-
|
|
43
|
-
context.addAxiom(axiom);
|
|
44
|
-
|
|
45
|
-
indicativeConditionalAxiomVerified = true;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return indicativeConditionalAxiomVerified;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
module.exports = verifyIndicativeConditionalAxiom;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const Axiom = require("../../axiom"),
|
|
4
|
-
verifyLabels = require("../../verify/labels"),
|
|
5
|
-
verifyUnqualifiedStatement = require("../../verify/statement/unqualified");
|
|
6
|
-
|
|
7
|
-
const { nodeQuery, nodesQuery } = require("../../utilities/query");
|
|
8
|
-
|
|
9
|
-
const labelNodesQuery = nodesQuery("/axiom/label"),
|
|
10
|
-
statementNodeQuery = nodeQuery("/*/statement"),
|
|
11
|
-
unqualifiedStatementNodeQuery = nodeQuery("/axiom/unqualifiedStatement!");
|
|
12
|
-
|
|
13
|
-
function verifyUnqualifiedStatementAxiom(axiomNode, context) {
|
|
14
|
-
let unqualifiedStatementAxiomVerified = false;
|
|
15
|
-
|
|
16
|
-
const unqualifiedStatementNode = unqualifiedStatementNodeQuery(axiomNode);
|
|
17
|
-
|
|
18
|
-
if (unqualifiedStatementNode !== null) {
|
|
19
|
-
const labels = [],
|
|
20
|
-
labelNodes = labelNodesQuery(axiomNode),
|
|
21
|
-
labelsVerified = verifyLabels(labelNodes, labels, context);
|
|
22
|
-
|
|
23
|
-
if (labelsVerified) {
|
|
24
|
-
const unqualifiedStatementVerified = verifyUnqualifiedStatement(unqualifiedStatementNode, context);
|
|
25
|
-
|
|
26
|
-
if (unqualifiedStatementVerified) {
|
|
27
|
-
const statementNode = statementNodeQuery(unqualifiedStatementNode),
|
|
28
|
-
axiom = Axiom.fromStatementNodeAndLabels(statementNode, labels);
|
|
29
|
-
|
|
30
|
-
context.addAxiom(axiom);
|
|
31
|
-
|
|
32
|
-
unqualifiedStatementAxiomVerified = true;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return unqualifiedStatementAxiomVerified;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
module.exports = verifyUnqualifiedStatementAxiom;
|
package/bin/verify/axiom.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const { loggingUtilities } = require("necessary");
|
|
4
|
-
|
|
5
|
-
const ProofContext = require("../context/proof"),
|
|
6
|
-
verifyUnqualifiedStatementAxiom = require("../verify/axiom/unqualifiedStatement"),
|
|
7
|
-
verifyIndicativeConditionalAxiom = require("../verify/axiom/indicativeConditional");
|
|
8
|
-
|
|
9
|
-
const { nodesQuery } = require("../utilities/query"),
|
|
10
|
-
{ nodesAsString } = require("../utilities/string");
|
|
11
|
-
|
|
12
|
-
const { log } = loggingUtilities;
|
|
13
|
-
|
|
14
|
-
const labelNodesQuery = nodesQuery("/axiom/label");
|
|
15
|
-
|
|
16
|
-
function verifyAxiom(axiomNode, context) {
|
|
17
|
-
const labelNodes = labelNodesQuery(axiomNode),
|
|
18
|
-
labelsString = nodesAsString(labelNodes);
|
|
19
|
-
|
|
20
|
-
log.debug(`Verifying the '${labelsString}' axiom...`);
|
|
21
|
-
|
|
22
|
-
const proofContext = ProofContext.fromContext(context);
|
|
23
|
-
|
|
24
|
-
context = proofContext; ///
|
|
25
|
-
|
|
26
|
-
const unqualifiedStatementAxiomVerified = verifyUnqualifiedStatementAxiom(axiomNode, context),
|
|
27
|
-
indicativeConditionalAxiomVerified = verifyIndicativeConditionalAxiom(axiomNode, context),
|
|
28
|
-
axiomVerified = (unqualifiedStatementAxiomVerified || indicativeConditionalAxiomVerified);
|
|
29
|
-
|
|
30
|
-
if (axiomVerified) {
|
|
31
|
-
log.info(`Verified the '${labelsString}' axiom.`);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return axiomVerified;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
module.exports = verifyAxiom;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const verifyMetaproof = require("../verify/metaproof"),
|
|
4
|
-
MetaproofContext = require("../context/metaproof"),
|
|
5
|
-
verifyConclusion = require("../verify/conclusion"),
|
|
6
|
-
verifyPremiseOrPremises = require("../verify/premiseOrPremises");
|
|
7
|
-
|
|
8
|
-
const { nodeQuery } = require("../utilities/query");
|
|
9
|
-
const Conclusion = require("../conclusion");
|
|
10
|
-
|
|
11
|
-
const conclusionNodeQuery = nodeQuery("/conditionalInference/conclusion!"),
|
|
12
|
-
metastatementNodeQuery = nodeQuery("/conditionalInference/conclusion!/unqualifiedMetastatement!/metastatement!"),
|
|
13
|
-
premiseOrPremisesNodeQuery = nodeQuery("/conditionalInference/premise|premises!");
|
|
14
|
-
|
|
15
|
-
function verifyConditionalInference(conditionalInferenceNode, premises, conclusions, context) {
|
|
16
|
-
let conditionalInferenceVerified = false;
|
|
17
|
-
|
|
18
|
-
const metaproofContext = MetaproofContext.fromContext(context);
|
|
19
|
-
|
|
20
|
-
context = metaproofContext; ///
|
|
21
|
-
|
|
22
|
-
const conclusionNode = conclusionNodeQuery(conditionalInferenceNode),
|
|
23
|
-
metastatementNode = metastatementNodeQuery(conditionalInferenceNode),
|
|
24
|
-
premiseOrPremisesNode = premiseOrPremisesNodeQuery(conditionalInferenceNode),
|
|
25
|
-
premiseOrPremisesVerified = verifyPremiseOrPremises(premiseOrPremisesNode, premises, context);
|
|
26
|
-
|
|
27
|
-
if (premiseOrPremisesVerified) {
|
|
28
|
-
const conclusionVerified = verifyConclusion(conclusionNode, conclusions, context);
|
|
29
|
-
|
|
30
|
-
if (conclusionVerified) {
|
|
31
|
-
const conclusion = Conclusion.fromMetastatementNode(metastatementNode);
|
|
32
|
-
|
|
33
|
-
conclusions.push(conclusion);
|
|
34
|
-
|
|
35
|
-
conditionalInferenceVerified = true;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return conditionalInferenceVerified;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
module.exports = verifyConditionalInference;
|
package/bin/verify/consequent.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const Consequent = require("../consequent"),
|
|
4
|
-
verifyUnqualifiedStatement = require("../verify/statement/unqualified");
|
|
5
|
-
|
|
6
|
-
const { nodeQuery } = require("../utilities/query");
|
|
7
|
-
|
|
8
|
-
const statementNodeQuery = nodeQuery("/unqualifiedStatement/statement!"),
|
|
9
|
-
unqualifiedStatementNodeQuery = nodeQuery("/consequent/unqualifiedStatement!");
|
|
10
|
-
|
|
11
|
-
function verifyConsequent(consequentNode, consequents, context) {
|
|
12
|
-
let consequentVerified = false;
|
|
13
|
-
|
|
14
|
-
const unqualifiedStatementNode = unqualifiedStatementNodeQuery(consequentNode);
|
|
15
|
-
|
|
16
|
-
if (unqualifiedStatementNode !== null) {
|
|
17
|
-
const unqualifiedStatementVerified = verifyUnqualifiedStatement(unqualifiedStatementNode, context);
|
|
18
|
-
|
|
19
|
-
if (unqualifiedStatementVerified) {
|
|
20
|
-
const statementNode = statementNodeQuery(unqualifiedStatementNode),
|
|
21
|
-
consequent = Consequent.fromStatementNode(statementNode);
|
|
22
|
-
|
|
23
|
-
consequents.push(consequent);
|
|
24
|
-
|
|
25
|
-
consequentVerified = true;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return consequentVerified;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
module.exports = verifyConsequent;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const verifyUnqualifiedMetaStatement = require("../verify/metastatement/unqualified");
|
|
4
|
-
|
|
5
|
-
const { nodeQuery } = require("../utilities/query");
|
|
6
|
-
|
|
7
|
-
const unqualifiedMetaStatementNodeQuery = nodeQuery("/metaConsequent/unqualifiedMetaStatement!");
|
|
8
|
-
|
|
9
|
-
function verifyMetaConsequent(metaConsequentNode, metaConsequents, context) {
|
|
10
|
-
let metaConsequentVerified = false;
|
|
11
|
-
|
|
12
|
-
const unqualifiedMetaStatementNode = unqualifiedMetaStatementNodeQuery(metaConsequentNode);
|
|
13
|
-
|
|
14
|
-
if (unqualifiedMetaStatementNode !== null) {
|
|
15
|
-
const unqualifiedMetaStatementVerified = verifyUnqualifiedMetaStatement(unqualifiedMetaStatementNode, context);
|
|
16
|
-
|
|
17
|
-
metaConsequentVerified = unqualifiedMetaStatementVerified;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return metaConsequentVerified;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
module.exports = verifyMetaConsequent;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const MetaAssertion = require("../metaAssertion"),
|
|
4
|
-
verifyUnqualifiedMetastatement = require("../verify/metastatement/unqualified");
|
|
5
|
-
|
|
6
|
-
const { nodeQuery } = require("../utilities/query");
|
|
7
|
-
|
|
8
|
-
const unqualifiedMetastatementNodeQuery = nodeQuery("/metaSupposition/unqualifiedMetastatement!");
|
|
9
|
-
|
|
10
|
-
function verifyMetaSupposition(metaSuppositionNode, context) {
|
|
11
|
-
const unqualifiedMetastatementNode = unqualifiedMetastatementNodeQuery(metaSuppositionNode),
|
|
12
|
-
unqualifiedMetastatementVerified = verifyUnqualifiedMetastatement(unqualifiedMetastatementNode, context),
|
|
13
|
-
metaSuppositionVerified = unqualifiedMetastatementVerified; ///
|
|
14
|
-
|
|
15
|
-
if (metaSuppositionVerified) {
|
|
16
|
-
const metaAssertion = MetaAssertion.fromUnqualifiedMetastatementNode(unqualifiedMetastatementNode);
|
|
17
|
-
|
|
18
|
-
context.addMetaAssertion(metaAssertion);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return metaSuppositionVerified;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
module.exports = verifyMetaSupposition;
|
package/bin/verify/package.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const { loggingUtilities } = require("necessary");
|
|
4
|
-
|
|
5
|
-
const verifyFiles = require("../verify/files");
|
|
6
|
-
|
|
7
|
-
const { log } = loggingUtilities;
|
|
8
|
-
|
|
9
|
-
function verifyPackage(packageName, packageContextMap, packageContexts = []) {
|
|
10
|
-
const packageContext = packageContextMap[packageName];
|
|
11
|
-
|
|
12
|
-
let packageVerified = packageContext.isPackageVerified();
|
|
13
|
-
|
|
14
|
-
if (!packageVerified) {
|
|
15
|
-
log.debug(`Verifying the '${packageName}' package...`);
|
|
16
|
-
|
|
17
|
-
const dependencyPackageNames = packageContext.getDependencyPackageNames(),
|
|
18
|
-
dependencyPackagesVVerified = dependencyPackageNames.every((dependencyPackageName) => {
|
|
19
|
-
const packageName = dependencyPackageName, ///
|
|
20
|
-
packageVerified = verifyPackage(packageName, packageContextMap, packageContexts);
|
|
21
|
-
|
|
22
|
-
if (packageVerified) {
|
|
23
|
-
return true;
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
if (dependencyPackagesVVerified) {
|
|
28
|
-
const packageNames = dependencyPackageNames, ///
|
|
29
|
-
packageContexts = packageNames.map((packageName) => {
|
|
30
|
-
const packageContext = packageContextMap[packageName];
|
|
31
|
-
|
|
32
|
-
return packageContext;
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
const dependencyPackageContexts = retrieveDependencyPackageContexts(dependencyPackageNames, packageContextMap);
|
|
36
|
-
|
|
37
|
-
sortDependencyPackageContexts(dependencyPackageContexts, packageContexts);
|
|
38
|
-
|
|
39
|
-
packageContext.initialise(packageContexts, dependencyPackageContexts);
|
|
40
|
-
|
|
41
|
-
const filesVerified = verifyFiles(packageContext);
|
|
42
|
-
|
|
43
|
-
packageVerified = filesVerified; ///
|
|
44
|
-
|
|
45
|
-
if (packageVerified) {
|
|
46
|
-
packageContexts.push(packageContext);
|
|
47
|
-
|
|
48
|
-
log.info(`Verified the '${packageName}' package.`);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return packageVerified;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
module.exports = verifyPackage;
|
|
57
|
-
|
|
58
|
-
function sortDependencyPackageContexts(dependencyPackageContexts, packageContexts) {
|
|
59
|
-
dependencyPackageContexts.sort((dependencyPackageContextA, dependencyPackageContextB) => {
|
|
60
|
-
const indexA = packageContexts.indexOf(dependencyPackageContextA),
|
|
61
|
-
indexB = packageContexts.indexOf(dependencyPackageContextB),
|
|
62
|
-
difference = (indexB - indexA);
|
|
63
|
-
|
|
64
|
-
return difference;
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function retrieveDependencyPackageContexts(dependencyPackageNames, packageContextMap, dependencyPackageContexts = []) {
|
|
69
|
-
dependencyPackageNames.forEach((dependencyPackageName) => {
|
|
70
|
-
const dependencyPackageContext = packageContextMap[dependencyPackageName],
|
|
71
|
-
dependencyPackageContextsIncludesDependencyPackageContext = dependencyPackageContexts.includes(dependencyPackageContext);
|
|
72
|
-
|
|
73
|
-
if (!dependencyPackageContextsIncludesDependencyPackageContext) {
|
|
74
|
-
dependencyPackageContexts.push(dependencyPackageContext);
|
|
75
|
-
|
|
76
|
-
retrieveDependencyPackageContexts(dependencyPackageNames, packageContextMap, dependencyPackageContexts);
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
return dependencyPackageContexts;
|
|
81
|
-
}
|