occam-verify-cli 0.0.317 → 0.0.318
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/bin/callbacks.js +27 -0
- package/bin/main.js +2 -5
- package/bin/messages.js +11 -0
- package/bin/utilities/logging.js +2 -10
- package/bin/utilities/release.js +67 -34
- package/lib/callbacks.js +68 -0
- package/lib/context/file.js +58 -81
- package/lib/context/metaproof.js +30 -118
- package/lib/context/proof.js +73 -137
- package/lib/context/release.js +81 -15
- package/lib/index.js +5 -1
- package/lib/mixins/callbacks.js +27 -0
- package/lib/mixins/file.js +23 -0
- package/lib/mixins/logging.js +39 -0
- package/lib/rule.js +3 -3
- package/lib/verify/IndicativeConditional.js +9 -5
- package/lib/verify/assertion/type.js +12 -10
- package/lib/verify/axiom.js +10 -14
- package/lib/verify/conclusion.js +5 -3
- package/lib/verify/conditinalInference.js +7 -5
- package/lib/verify/declaration/combinator.js +7 -3
- package/lib/verify/declaration/constructor.js +7 -3
- package/lib/verify/declaration/topLevel.js +11 -9
- package/lib/verify/declaration/type.js +8 -3
- package/lib/verify/declaration/variable.js +7 -3
- package/lib/verify/equality.js +8 -6
- package/lib/verify/file.js +7 -9
- package/lib/verify/label.js +6 -4
- package/lib/verify/labels.js +5 -4
- package/lib/verify/metaDerivation.js +21 -18
- package/lib/verify/metaproof.js +6 -4
- package/lib/verify/metastatement/qualified.js +7 -5
- package/lib/verify/metastatement/unqualified.js +7 -5
- package/lib/verify/premiseOrPremises.js +11 -12
- package/lib/verify/release.js +28 -18
- package/lib/verify/rule.js +11 -14
- package/lib/verify/statement/qualified.js +7 -3
- package/lib/verify/statement/unqualified.js +6 -4
- package/lib/verify/statement.js +8 -10
- package/lib/verify/statementAsCombinator.js +33 -36
- package/lib/verify/term.js +4 -2
- package/lib/verify/termAsConstructor.js +38 -39
- package/lib/verify/termAsVariable.js +4 -2
- package/lib/verify/type.js +18 -14
- package/lib/verify/unconditionalInference.js +5 -3
- package/lib/verify/variable.js +13 -10
- package/package.json +1 -1
- package/src/callbacks.js +27 -0
- package/src/context/file.js +62 -61
- package/src/context/metaproof.js +29 -44
- package/src/context/proof.js +51 -64
- package/src/context/release.js +33 -11
- package/src/index.js +1 -0
- package/src/mixins/callbacks.js +15 -0
- package/src/mixins/file.js +12 -0
- package/src/mixins/logging.js +24 -0
- package/src/rule.js +2 -2
- package/src/verify/IndicativeConditional.js +18 -9
- package/src/verify/assertion/type.js +15 -8
- package/src/verify/axiom.js +15 -17
- package/src/verify/conclusion.js +8 -2
- package/src/verify/conditinalInference.js +10 -4
- package/src/verify/declaration/combinator.js +12 -3
- package/src/verify/declaration/constructor.js +12 -3
- package/src/verify/declaration/topLevel.js +15 -9
- package/src/verify/declaration/type.js +14 -4
- package/src/verify/declaration/variable.js +12 -3
- package/src/verify/equality.js +11 -4
- package/src/verify/file.js +6 -8
- package/src/verify/label.js +9 -3
- package/src/verify/labels.js +5 -3
- package/src/verify/metaDerivation.js +26 -19
- package/src/verify/metaproof.js +9 -3
- package/src/verify/metastatement/qualified.js +10 -4
- package/src/verify/metastatement/unqualified.js +10 -4
- package/src/verify/premiseOrPremises.js +18 -14
- package/src/verify/release.js +45 -27
- package/src/verify/rule.js +15 -16
- package/src/verify/statement/qualified.js +12 -3
- package/src/verify/statement/unqualified.js +9 -3
- package/src/verify/statement.js +10 -9
- package/src/verify/statementAsCombinator.js +45 -46
- package/src/verify/term.js +7 -1
- package/src/verify/termAsConstructor.js +48 -45
- package/src/verify/termAsVariable.js +7 -1
- package/src/verify/type.js +25 -21
- package/src/verify/unconditionalInference.js +8 -2
- package/src/verify/variable.js +18 -11
- package/lib/mixins/log.js +0 -41
- package/lib/verify/supposition.js +0 -29
- package/src/mixins/log.js +0 -28
- package/src/verify/supposition.js +0 -22
package/src/context/release.js
CHANGED
|
@@ -2,21 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
import { lexersUtilities, parsersUtilities } from "occam-custom-grammars";
|
|
4
4
|
|
|
5
|
-
import logMixins from "../mixins/log";
|
|
6
|
-
|
|
7
5
|
import { push } from "../utilities/array";
|
|
8
6
|
import { customGrammarFromRelease, combinedCustomGrammarFromReleaseContexts } from "../utilities/customGrammar";
|
|
9
7
|
|
|
10
8
|
const { florenceLexerFromCombinedCustomGrammar } = lexersUtilities,
|
|
11
9
|
{ florenceParserFromCombinedCustomGrammar } = parsersUtilities;
|
|
12
10
|
|
|
13
|
-
class ReleaseContext {
|
|
14
|
-
constructor(log, release, verified, customGrammar, fileContexts, florenceLexer, florenceParser, releaseContexts) {
|
|
11
|
+
export default class ReleaseContext {
|
|
12
|
+
constructor(log, release, callbacks, verified, customGrammar, fileContexts, florenceLexer, florenceParser, releaseContexts) {
|
|
15
13
|
this.log = log;
|
|
16
14
|
this.release = release;
|
|
15
|
+
this.callbacks = callbacks;
|
|
17
16
|
this.verified = verified;
|
|
18
17
|
this.customGrammar = customGrammar;
|
|
19
|
-
|
|
20
18
|
this.fileContexts = fileContexts;
|
|
21
19
|
this.florenceLexer = florenceLexer;
|
|
22
20
|
this.florenceParser = florenceParser;
|
|
@@ -31,6 +29,10 @@ class ReleaseContext {
|
|
|
31
29
|
return this.release;
|
|
32
30
|
}
|
|
33
31
|
|
|
32
|
+
getCallbacks() {
|
|
33
|
+
return this.callbacks;
|
|
34
|
+
}
|
|
35
|
+
|
|
34
36
|
isVerified() {
|
|
35
37
|
return this.verified;
|
|
36
38
|
}
|
|
@@ -65,6 +67,8 @@ class ReleaseContext {
|
|
|
65
67
|
|
|
66
68
|
getDependencies() { return this.release.getDependencies(); }
|
|
67
69
|
|
|
70
|
+
matchShortenedVersion(shortenedVersion) { return this.release.matchShortenedVersion(shortenedVersion); }
|
|
71
|
+
|
|
68
72
|
getRules(releaseNames = []) {
|
|
69
73
|
const name = this.getName(),
|
|
70
74
|
rules = [],
|
|
@@ -204,10 +208,32 @@ class ReleaseContext {
|
|
|
204
208
|
this.fileContexts.push(fileContext);
|
|
205
209
|
}
|
|
206
210
|
|
|
211
|
+
setVerified(verified) {
|
|
212
|
+
this.verified = verified;
|
|
213
|
+
}
|
|
214
|
+
|
|
207
215
|
tokenise(content) { return this.florenceLexer.tokenise(content); }
|
|
208
216
|
|
|
209
217
|
parse(tokens) { return this.florenceParser.parse(tokens); }
|
|
210
218
|
|
|
219
|
+
trace(message) { this.log.trace(message); }
|
|
220
|
+
|
|
221
|
+
debug(message) { this.log.debug(message); }
|
|
222
|
+
|
|
223
|
+
info(message) { this.log.info(message); }
|
|
224
|
+
|
|
225
|
+
warning(message) { this.log.warning(message); }
|
|
226
|
+
|
|
227
|
+
error(message) { this.log.error(message); }
|
|
228
|
+
|
|
229
|
+
fatal(message) { this.log.fatal(message); }
|
|
230
|
+
|
|
231
|
+
halt(filePath, leastLineIndex, greatestLineIndex) { this.callbacks.halt(filePath, leastLineIndex, greatestLineIndex); }
|
|
232
|
+
|
|
233
|
+
begin(filePath, leastLineIndex, greatestLineIndex) { this.callbacks.begin(filePath, leastLineIndex, greatestLineIndex); }
|
|
234
|
+
|
|
235
|
+
complete(filePath, leastLineIndex, greatestLineIndex) { this.callbacks.complete(filePath, leastLineIndex, greatestLineIndex); }
|
|
236
|
+
|
|
211
237
|
initialise(releaseContexts, dependencyReleaseContexts) {
|
|
212
238
|
const releaseContext = this; ///
|
|
213
239
|
|
|
@@ -222,19 +248,15 @@ class ReleaseContext {
|
|
|
222
248
|
this.releaseContexts = releaseContexts;
|
|
223
249
|
}
|
|
224
250
|
|
|
225
|
-
static
|
|
251
|
+
static fromLogReleaseAndCallbacks(log, release, callbacks, ...remainingArguments) {
|
|
226
252
|
const verified = false,
|
|
227
253
|
customGrammar = customGrammarFromRelease(release),
|
|
228
254
|
fileContexts = [],
|
|
229
255
|
florenceLexer = null,
|
|
230
256
|
florenceParser = null,
|
|
231
257
|
releaseContexts = [],
|
|
232
|
-
releaseContext = new ReleaseContext(log, release, verified, customGrammar, fileContexts, florenceLexer, florenceParser, releaseContexts, ...remainingArguments);
|
|
258
|
+
releaseContext = new ReleaseContext(log, release, callbacks, verified, customGrammar, fileContexts, florenceLexer, florenceParser, releaseContexts, ...remainingArguments);
|
|
233
259
|
|
|
234
260
|
return releaseContext;
|
|
235
261
|
}
|
|
236
262
|
}
|
|
237
|
-
|
|
238
|
-
Object.assign(ReleaseContext.prototype, logMixins);
|
|
239
|
-
|
|
240
|
-
export default ReleaseContext;
|
package/src/index.js
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function halt(node) { this.context.halt(node); }
|
|
4
|
+
|
|
5
|
+
function begin(node) { this.context.begin(node); }
|
|
6
|
+
|
|
7
|
+
function complete(node) { this.context.complete(node); }
|
|
8
|
+
|
|
9
|
+
const callbacksMixins = {
|
|
10
|
+
halt,
|
|
11
|
+
begin,
|
|
12
|
+
complete
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default callbacksMixins;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function findRuleByReferenceName(referenceName) { return this.context.findRuleByReferenceName(referenceName); }
|
|
4
|
+
|
|
5
|
+
function findAxiomByReferenceName(referenceName) { return this.context.findAxiomByReferenceName(referenceName); }
|
|
6
|
+
|
|
7
|
+
const fileMixins = {
|
|
8
|
+
findRuleByReferenceName,
|
|
9
|
+
findAxiomByReferenceName
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default fileMixins;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function trace(message) { this.context.trace(message); }
|
|
4
|
+
|
|
5
|
+
function debug(message) { this.context.debug(message); }
|
|
6
|
+
|
|
7
|
+
function info(message) { this.context.info(message); }
|
|
8
|
+
|
|
9
|
+
function warning(message) { this.context.warning(message); }
|
|
10
|
+
|
|
11
|
+
function error(message) { this.context.error(message); }
|
|
12
|
+
|
|
13
|
+
function fatal(message) { this.context.fatal(message); }
|
|
14
|
+
|
|
15
|
+
const loggingMixins = {
|
|
16
|
+
trace,
|
|
17
|
+
debug,
|
|
18
|
+
info,
|
|
19
|
+
warning,
|
|
20
|
+
error,
|
|
21
|
+
fatal
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default loggingMixins;
|
package/src/rule.js
CHANGED
|
@@ -23,7 +23,7 @@ export default class Rule {
|
|
|
23
23
|
return this.conclusion;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
matchMetastatement(metastatementNode,
|
|
26
|
+
matchMetastatement(metastatementNode, metaproofContext) {
|
|
27
27
|
let metastatementNatches;
|
|
28
28
|
|
|
29
29
|
const premisesLength = this.premises.length;
|
|
@@ -34,7 +34,7 @@ export default class Rule {
|
|
|
34
34
|
|
|
35
35
|
metastatementNatches = conclusionMatches; ///
|
|
36
36
|
} else {
|
|
37
|
-
const metaAssertions =
|
|
37
|
+
const metaAssertions = metaproofContext.getMetaAssertions();
|
|
38
38
|
|
|
39
39
|
metastatementNatches = someSubArray(metaAssertions, premisesLength, (metaAssertions) => {
|
|
40
40
|
const premisesMatchConclusion = matchPremisesAndConclusion(this.premises, this.conclusion, metaAssertions, metastatementNode);
|
|
@@ -1,20 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import verifyUnqualifiedStatement from "../verify/
|
|
3
|
+
import verifyUnqualifiedStatement from "../verify/statement/unqualified";
|
|
4
4
|
|
|
5
5
|
import { nodesQuery } from "../utilities/query";
|
|
6
6
|
|
|
7
7
|
const unqualifiedStatementNodesQuery = nodesQuery("/indicativeConditional/unqualifiedStatement");
|
|
8
8
|
|
|
9
|
-
export default function verifyIndicativeConditional(indicativeConditionalNode, statementNodes,
|
|
10
|
-
|
|
11
|
-
indicativeConditionalVerified = unqualifiedStatementNodes.every((unqualifiedStatementNode) => {
|
|
12
|
-
const unqualifiedStatementVerified = verifyUnqualifiedStatement(unqualifiedStatementNode, context);
|
|
9
|
+
export default function verifyIndicativeConditional(indicativeConditionalNode, statementNodes, proofContext) {
|
|
10
|
+
let indicativeConditionalVerified;
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
proofContext.begin(indicativeConditionalNode);
|
|
13
|
+
|
|
14
|
+
const unqualifiedStatementNodes = unqualifiedStatementNodesQuery(indicativeConditionalNode);
|
|
15
|
+
|
|
16
|
+
indicativeConditionalVerified = unqualifiedStatementNodes.every((unqualifiedStatementNode) => {
|
|
17
|
+
const unqualifiedStatementVerified = verifyUnqualifiedStatement(unqualifiedStatementNode, proofContext);
|
|
18
|
+
|
|
19
|
+
if (unqualifiedStatementVerified) {
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
indicativeConditionalVerified ?
|
|
25
|
+
proofContext.complete(indicativeConditionalNode) :
|
|
26
|
+
proofContext.halt(indicativeConditionalNode);
|
|
18
27
|
|
|
19
28
|
return indicativeConditionalVerified;
|
|
20
29
|
}
|
|
@@ -9,17 +9,19 @@ import { nodeQuery, typeNameFromTypeNode } from "../../utilities/query";
|
|
|
9
9
|
const termNodeQuery = nodeQuery("/typeAssertion/term"),
|
|
10
10
|
typeNodeQuery = nodeQuery("/typeAssertion/type");
|
|
11
11
|
|
|
12
|
-
export default function verifyTypeAssertion(typeAssertionNode,
|
|
12
|
+
export default function verifyTypeAssertion(typeAssertionNode, proofContext) {
|
|
13
13
|
let typeAssertionVerified = false;
|
|
14
14
|
|
|
15
|
+
proofContext.begin(typeAssertionNode);
|
|
16
|
+
|
|
15
17
|
const typeNode = typeNodeQuery(typeAssertionNode),
|
|
16
18
|
typeName = typeNameFromTypeNode(typeNode),
|
|
17
|
-
typePresent =
|
|
19
|
+
typePresent = proofContext.isTypePresentByTypeName(typeName);
|
|
18
20
|
|
|
19
21
|
if (!typePresent) {
|
|
20
|
-
|
|
22
|
+
proofContext.error(`The ${typeName} type is not present.`);
|
|
21
23
|
} else {
|
|
22
|
-
const derived =
|
|
24
|
+
const derived = proofContext.isDerived();
|
|
23
25
|
|
|
24
26
|
if (derived) {
|
|
25
27
|
debugger
|
|
@@ -27,6 +29,7 @@ export default function verifyTypeAssertion(typeAssertionNode, context) {
|
|
|
27
29
|
const types = [],
|
|
28
30
|
names = [],
|
|
29
31
|
values = [],
|
|
32
|
+
context = proofContext, ///
|
|
30
33
|
termNode = termNodeQuery(typeAssertionNode),
|
|
31
34
|
termVerified = verifyTermAsVariable(termNode, types, names, values, context);
|
|
32
35
|
|
|
@@ -37,20 +40,20 @@ export default function verifyTypeAssertion(typeAssertionNode, context) {
|
|
|
37
40
|
value = firstValue;
|
|
38
41
|
|
|
39
42
|
if (value !== undefined) {
|
|
40
|
-
|
|
43
|
+
proofContext.error(`The value of the ${variableName} variable is not undefined.`);
|
|
41
44
|
} else {
|
|
42
|
-
const type =
|
|
45
|
+
const type = proofContext.findTypeByTypeName(typeName),
|
|
43
46
|
firstType = first(types),
|
|
44
47
|
variableType = firstType, ///
|
|
45
48
|
typeSubTypeOfVariableType = type.isSubTypeOf(variableType);
|
|
46
49
|
|
|
47
50
|
if (!typeSubTypeOfVariableType) {
|
|
48
|
-
|
|
51
|
+
proofContext.error(`The asserted type of the ${variableName} variable is not a sub-type of its declared type.`);
|
|
49
52
|
} else {
|
|
50
53
|
const name = variableName, ///
|
|
51
54
|
variable = Variable.fromTypeAndName(type, name);
|
|
52
55
|
|
|
53
|
-
|
|
56
|
+
proofContext.addVariable(variable);
|
|
54
57
|
|
|
55
58
|
typeAssertionVerified = true;
|
|
56
59
|
}
|
|
@@ -59,5 +62,9 @@ export default function verifyTypeAssertion(typeAssertionNode, context) {
|
|
|
59
62
|
}
|
|
60
63
|
}
|
|
61
64
|
|
|
65
|
+
typeAssertionVerified ?
|
|
66
|
+
proofContext.complete(typeAssertionNode) :
|
|
67
|
+
proofContext.halt(typeAssertionNode);
|
|
68
|
+
|
|
62
69
|
return typeAssertionVerified;
|
|
63
70
|
}
|
package/src/verify/axiom.js
CHANGED
|
@@ -13,30 +13,28 @@ const labelNodesQuery = nodesQuery("/axiom/label"),
|
|
|
13
13
|
unqualifiedStatementNodeQuery = nodeQuery("/axiom/unqualifiedStatement!"),
|
|
14
14
|
indicativeConditionalNodeQuery = nodeQuery("/axiom/indicativeConditional!");
|
|
15
15
|
|
|
16
|
-
export default function verifyAxiom(axiomNode,
|
|
17
|
-
|
|
18
|
-
labelsString = nodesAsString(labelNodes);
|
|
19
|
-
|
|
20
|
-
context.debug(`Verifying the '${labelsString}' axiom...`, axiomNode);
|
|
21
|
-
|
|
22
|
-
const proofContext = ProofContext.fromContext(context);
|
|
16
|
+
export default function verifyAxiom(axiomNode, fileContext) {
|
|
17
|
+
let axiomVerified = false;
|
|
23
18
|
|
|
24
|
-
|
|
19
|
+
fileContext.begin(axiomNode);
|
|
25
20
|
|
|
26
|
-
const
|
|
21
|
+
const labelNodes = labelNodesQuery(axiomNode),
|
|
22
|
+
labelsString = nodesAsString(labelNodes),
|
|
23
|
+
proofContext = ProofContext.fromFileContext(fileContext),
|
|
24
|
+
unqualifiedStatementNode = unqualifiedStatementNodeQuery(axiomNode),
|
|
27
25
|
indicativeConditionalNode = indicativeConditionalNodeQuery(axiomNode);
|
|
28
26
|
|
|
29
|
-
|
|
27
|
+
fileContext.debug(`Verifying the '${labelsString}' axiom...`);
|
|
30
28
|
|
|
31
29
|
if (unqualifiedStatementNode !== null) {
|
|
32
|
-
const unqualifiedStatementVerified = verifyUnqualifiedStatement(unqualifiedStatementNode,
|
|
30
|
+
const unqualifiedStatementVerified = verifyUnqualifiedStatement(unqualifiedStatementNode, proofContext);
|
|
33
31
|
|
|
34
32
|
if (unqualifiedStatementVerified) {
|
|
35
33
|
const statementNode = statementNodeQuery(unqualifiedStatementNode),
|
|
36
34
|
labels = labelsString, ///
|
|
37
35
|
axiom = Axiom.fromStatementNodeAndLabels(statementNode, labels);
|
|
38
36
|
|
|
39
|
-
|
|
37
|
+
fileContext.addAxiom(axiom);
|
|
40
38
|
|
|
41
39
|
axiomVerified = true;
|
|
42
40
|
}
|
|
@@ -44,7 +42,7 @@ export default function verifyAxiom(axiomNode, context) {
|
|
|
44
42
|
|
|
45
43
|
if (indicativeConditionalNode !== null) {
|
|
46
44
|
const statementNodes = [],
|
|
47
|
-
indicativeConditionalVerified = verifyIndicativeConditional(indicativeConditionalNode, statementNodes,
|
|
45
|
+
indicativeConditionalVerified = verifyIndicativeConditional(indicativeConditionalNode, statementNodes, proofContext);
|
|
48
46
|
|
|
49
47
|
if (indicativeConditionalVerified !== null) {
|
|
50
48
|
const labels = labelsString, ///
|
|
@@ -54,15 +52,15 @@ export default function verifyAxiom(axiomNode, context) {
|
|
|
54
52
|
consequentStatementNode = secondStatementNode, ///
|
|
55
53
|
axiom = Axiom.fromSuppositionStatementNodeConsequentStatementNodeAndLabels(suppositionStatementNode, consequentStatementNode, labels);
|
|
56
54
|
|
|
57
|
-
|
|
55
|
+
fileContext.addAxiom(axiom);
|
|
58
56
|
|
|
59
57
|
axiomVerified = true;
|
|
60
58
|
}
|
|
61
59
|
}
|
|
62
60
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
axiomVerified ?
|
|
62
|
+
fileContext.complete(axiomNode) :
|
|
63
|
+
fileContext.halt(axiomNode);
|
|
66
64
|
|
|
67
65
|
return axiomVerified;
|
|
68
66
|
}
|
package/src/verify/conclusion.js
CHANGED
|
@@ -8,13 +8,15 @@ import { nodeQuery } from "../utilities/query";
|
|
|
8
8
|
const metastatementNodeQuery = nodeQuery("/*/metastatement!"),
|
|
9
9
|
unqualifiedMetastatementNodeQuery = nodeQuery("/conclusion/unqualifiedMetastatement!");
|
|
10
10
|
|
|
11
|
-
export default function verifyConclusion(conclusionNode, conclusions,
|
|
11
|
+
export default function verifyConclusion(conclusionNode, conclusions, metaproofContext) {
|
|
12
12
|
let conclusionVerified = false;
|
|
13
13
|
|
|
14
|
+
metaproofContext.begin(conclusionNode);
|
|
15
|
+
|
|
14
16
|
const unqualifiedMetastatementNode = unqualifiedMetastatementNodeQuery(conclusionNode);
|
|
15
17
|
|
|
16
18
|
if (unqualifiedMetastatementNode !== null) {
|
|
17
|
-
const unqualifiedMetastatementVerified = verifyUnqualifiedMetastatement(unqualifiedMetastatementNode,
|
|
19
|
+
const unqualifiedMetastatementVerified = verifyUnqualifiedMetastatement(unqualifiedMetastatementNode, metaproofContext);
|
|
18
20
|
|
|
19
21
|
if (unqualifiedMetastatementVerified) {
|
|
20
22
|
const metastatementNode = metastatementNodeQuery(unqualifiedMetastatementNode),
|
|
@@ -26,5 +28,9 @@ export default function verifyConclusion(conclusionNode, conclusions, context) {
|
|
|
26
28
|
}
|
|
27
29
|
}
|
|
28
30
|
|
|
31
|
+
conclusionVerified ?
|
|
32
|
+
metaproofContext.complete(conclusionNode) :
|
|
33
|
+
metaproofContext.halt(conclusionNode);
|
|
34
|
+
|
|
29
35
|
return conclusionVerified;
|
|
30
36
|
}
|
|
@@ -8,18 +8,24 @@ import { nodeQuery } from "../utilities/query";
|
|
|
8
8
|
const conclusionNodeQuery = nodeQuery("/conditionalInference/conclusion!"),
|
|
9
9
|
premiseOrPremisesNodeQuery = nodeQuery("/conditionalInference/premise|premises!");
|
|
10
10
|
|
|
11
|
-
export default function verifyConditionalInference(conditionalInferenceNode, premises, conclusions,
|
|
11
|
+
export default function verifyConditionalInference(conditionalInferenceNode, premises, conclusions, metaproofContext) {
|
|
12
12
|
let conditionalInferenceVerified = false;
|
|
13
13
|
|
|
14
|
+
metaproofContext.begin(conditionalInferenceNode);
|
|
15
|
+
|
|
14
16
|
const conclusionNode = conclusionNodeQuery(conditionalInferenceNode),
|
|
15
17
|
premiseOrPremisesNode = premiseOrPremisesNodeQuery(conditionalInferenceNode),
|
|
16
|
-
premiseOrPremisesVerified = verifyPremiseOrPremises(premiseOrPremisesNode, premises,
|
|
18
|
+
premiseOrPremisesVerified = verifyPremiseOrPremises(premiseOrPremisesNode, premises, metaproofContext);
|
|
17
19
|
|
|
18
20
|
if (premiseOrPremisesVerified) {
|
|
19
|
-
const conclusionVerified = verifyConclusion(conclusionNode, conclusions,
|
|
21
|
+
const conclusionVerified = verifyConclusion(conclusionNode, conclusions, metaproofContext);
|
|
20
22
|
|
|
21
|
-
conditionalInferenceVerified = conclusionVerified;
|
|
23
|
+
conditionalInferenceVerified = conclusionVerified; ///
|
|
22
24
|
}
|
|
23
25
|
|
|
26
|
+
conditionalInferenceVerified ?
|
|
27
|
+
metaproofContext.complete(conditionalInferenceNode) :
|
|
28
|
+
metaproofContext.halt(conditionalInferenceNode);
|
|
29
|
+
|
|
24
30
|
return conditionalInferenceVerified;
|
|
25
31
|
}
|
|
@@ -6,10 +6,19 @@ import { nodeQuery } from "../../utilities/query";
|
|
|
6
6
|
|
|
7
7
|
const statementNodeQuery = nodeQuery("/combinatorDeclaration/statement");
|
|
8
8
|
|
|
9
|
-
export default function verifyCombinatorDeclaration(combinatorDeclarationNode,
|
|
9
|
+
export default function verifyCombinatorDeclaration(combinatorDeclarationNode, fileContext) {
|
|
10
|
+
let combinatorDeclarationVerified;
|
|
11
|
+
|
|
12
|
+
fileContext.begin(combinatorDeclarationNode);
|
|
13
|
+
|
|
10
14
|
const statementNode = statementNodeQuery(combinatorDeclarationNode),
|
|
11
|
-
statementVerifiedAsCombinator = verifyStatementAsCombinator(statementNode,
|
|
12
|
-
|
|
15
|
+
statementVerifiedAsCombinator = verifyStatementAsCombinator(statementNode, fileContext);
|
|
16
|
+
|
|
17
|
+
combinatorDeclarationVerified = statementVerifiedAsCombinator; ///
|
|
18
|
+
|
|
19
|
+
combinatorDeclarationVerified ?
|
|
20
|
+
fileContext.complete(combinatorDeclarationNode) :
|
|
21
|
+
fileContext.halt(combinatorDeclarationNode);
|
|
13
22
|
|
|
14
23
|
return combinatorDeclarationVerified;
|
|
15
24
|
}
|
|
@@ -7,11 +7,20 @@ import { nodeQuery } from "../../utilities/query";
|
|
|
7
7
|
const termNodeQuery = nodeQuery("/constructorDeclaration/term"),
|
|
8
8
|
typeNodeQuery = nodeQuery("/constructorDeclaration/type");
|
|
9
9
|
|
|
10
|
-
export default function verifyConstructorDeclaration(constructorDeclarationNode,
|
|
10
|
+
export default function verifyConstructorDeclaration(constructorDeclarationNode, fileContext) {
|
|
11
|
+
let constructorDeclarationVerified;
|
|
12
|
+
|
|
13
|
+
fileContext.begin(constructorDeclarationNode);
|
|
14
|
+
|
|
11
15
|
const termNode = termNodeQuery(constructorDeclarationNode),
|
|
12
16
|
typeNode = typeNodeQuery(constructorDeclarationNode),
|
|
13
|
-
termVerifiedAsConstructor = verifyTermAsConstructor(termNode, typeNode,
|
|
14
|
-
|
|
17
|
+
termVerifiedAsConstructor = verifyTermAsConstructor(termNode, typeNode, fileContext);
|
|
18
|
+
|
|
19
|
+
constructorDeclarationVerified = termVerifiedAsConstructor; ///
|
|
20
|
+
|
|
21
|
+
constructorDeclarationVerified ?
|
|
22
|
+
fileContext.complete(constructorDeclarationNode) :
|
|
23
|
+
fileContext.halt(constructorDeclarationNode);
|
|
15
24
|
|
|
16
25
|
return constructorDeclarationVerified;
|
|
17
26
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { nodeQuery } from "../../utilities/query";
|
|
4
|
-
|
|
5
3
|
import verifyRule from "../../verify/rule";
|
|
6
4
|
import verifyAxiom from "../../verify/axiom";
|
|
7
5
|
import verifyTypeDeclaration from "../../verify/declaration/type";
|
|
@@ -9,6 +7,8 @@ import verifyVariableDeclaration from "../../verify/declaration/variable";
|
|
|
9
7
|
import verifyCombinatorDeclaration from "../../verify/declaration/combinator";
|
|
10
8
|
import verifyConstructorDeclaration from "../../verify/declaration/constructor";
|
|
11
9
|
|
|
10
|
+
import { nodeQuery } from "../../utilities/query";
|
|
11
|
+
|
|
12
12
|
const ruleNodeQuery = nodeQuery("/topLevelDeclaration/rule!"),
|
|
13
13
|
axiomNodeQuery = nodeQuery("/topLevelDeclaration/axiom!"),
|
|
14
14
|
typeDeclarationNodeQuery = nodeQuery("/topLevelDeclaration/typeDeclaration!"),
|
|
@@ -16,9 +16,11 @@ const ruleNodeQuery = nodeQuery("/topLevelDeclaration/rule!"),
|
|
|
16
16
|
combinatorDeclarationNodeQuery = nodeQuery("/topLevelDeclaration/combinatorDeclaration!"),
|
|
17
17
|
constructorDeclarationNodeQuery = nodeQuery("/topLevelDeclaration/constructorDeclaration!");
|
|
18
18
|
|
|
19
|
-
export default function verifyTopLevelDeclaration(topLevelDeclarationNode,
|
|
19
|
+
export default function verifyTopLevelDeclaration(topLevelDeclarationNode, fileContext) {
|
|
20
20
|
let topLevelDeclarationVerified = false;
|
|
21
21
|
|
|
22
|
+
fileContext.begin(topLevelDeclarationNode);
|
|
23
|
+
|
|
22
24
|
const node = topLevelDeclarationNode, ///
|
|
23
25
|
ruleNode = ruleNodeQuery(node),
|
|
24
26
|
axiomNode = axiomNodeQuery(node),
|
|
@@ -30,30 +32,34 @@ export default function verifyTopLevelDeclaration(topLevelDeclarationNode, conte
|
|
|
30
32
|
if (false) {
|
|
31
33
|
///
|
|
32
34
|
} else if (ruleNode !== null) {
|
|
33
|
-
const ruleVerified = verifyRule(ruleNode,
|
|
35
|
+
const ruleVerified = verifyRule(ruleNode, fileContext);
|
|
34
36
|
|
|
35
37
|
topLevelDeclarationVerified = ruleVerified; ///
|
|
36
38
|
} else if (axiomNode !== null) {
|
|
37
|
-
const axiomVerified = verifyAxiom(axiomNode,
|
|
39
|
+
const axiomVerified = verifyAxiom(axiomNode, fileContext);
|
|
38
40
|
|
|
39
41
|
topLevelDeclarationVerified = axiomVerified; ///
|
|
40
42
|
} else if (typeDeclarationNode !== null) {
|
|
41
|
-
const typeDeclarationVerified = verifyTypeDeclaration(typeDeclarationNode,
|
|
43
|
+
const typeDeclarationVerified = verifyTypeDeclaration(typeDeclarationNode, fileContext);
|
|
42
44
|
|
|
43
45
|
topLevelDeclarationVerified = typeDeclarationVerified; ///
|
|
44
46
|
} else if (variableDeclarationNode !== null) {
|
|
45
|
-
const variableDeclarationVerified = verifyVariableDeclaration(variableDeclarationNode,
|
|
47
|
+
const variableDeclarationVerified = verifyVariableDeclaration(variableDeclarationNode, fileContext);
|
|
46
48
|
|
|
47
49
|
topLevelDeclarationVerified = variableDeclarationVerified; ///
|
|
48
50
|
} else if (combinatorDeclarationNode !== null) {
|
|
49
|
-
const combinatorDeclarationVerified = verifyCombinatorDeclaration(combinatorDeclarationNode,
|
|
51
|
+
const combinatorDeclarationVerified = verifyCombinatorDeclaration(combinatorDeclarationNode, fileContext);
|
|
50
52
|
|
|
51
53
|
topLevelDeclarationVerified = combinatorDeclarationVerified; ///
|
|
52
54
|
} else if (constructorDeclarationNode !== null) {
|
|
53
|
-
const constructorDeclarationVerified = verifyConstructorDeclaration(constructorDeclarationNode,
|
|
55
|
+
const constructorDeclarationVerified = verifyConstructorDeclaration(constructorDeclarationNode, fileContext);
|
|
54
56
|
|
|
55
57
|
topLevelDeclarationVerified = constructorDeclarationVerified; ///
|
|
56
58
|
}
|
|
57
59
|
|
|
60
|
+
topLevelDeclarationVerified ?
|
|
61
|
+
fileContext.complete(topLevelDeclarationNode) :
|
|
62
|
+
fileContext.halt(topLevelDeclarationNode);
|
|
63
|
+
|
|
58
64
|
return topLevelDeclarationVerified;
|
|
59
65
|
}
|
|
@@ -7,13 +7,23 @@ import { nodeQuery } from "../../utilities/query";
|
|
|
7
7
|
const firstTypeNodeQuery = nodeQuery("/typeDeclaration/type[0]"),
|
|
8
8
|
secondTypeNodeQuery = nodeQuery("/typeDeclaration/type[1]");
|
|
9
9
|
|
|
10
|
-
export default function verifyTypeDeclaration(typeDeclarationNode,
|
|
10
|
+
export default function verifyTypeDeclaration(typeDeclarationNode, fileContext) {
|
|
11
|
+
let typeDeclarationVerified;
|
|
12
|
+
|
|
13
|
+
fileContext.begin(typeDeclarationNode);
|
|
14
|
+
|
|
11
15
|
const firstTypeNode = firstTypeNodeQuery(typeDeclarationNode),
|
|
12
16
|
secondTypeNode = secondTypeNodeQuery(typeDeclarationNode),
|
|
13
17
|
typeNode = firstTypeNode, ///
|
|
14
|
-
superTypeNode = secondTypeNode
|
|
15
|
-
|
|
16
|
-
|
|
18
|
+
superTypeNode = secondTypeNode; ///
|
|
19
|
+
|
|
20
|
+
const typeVerified = verifyType(typeNode, superTypeNode, fileContext);
|
|
21
|
+
|
|
22
|
+
typeDeclarationVerified = typeVerified; ///
|
|
23
|
+
|
|
24
|
+
typeDeclarationVerified ?
|
|
25
|
+
fileContext.complete(typeDeclarationNode) :
|
|
26
|
+
fileContext.halt(typeDeclarationNode);
|
|
17
27
|
|
|
18
28
|
return typeDeclarationVerified;
|
|
19
29
|
}
|
|
@@ -7,11 +7,20 @@ import { nodeQuery } from "../../utilities/query";
|
|
|
7
7
|
const typeNodeQuery = nodeQuery("/variableDeclaration/type"),
|
|
8
8
|
variableNodeQuery = nodeQuery("/variableDeclaration/variable");
|
|
9
9
|
|
|
10
|
-
export default function verifyVariableDeclaration(variableDeclarationNode,
|
|
10
|
+
export default function verifyVariableDeclaration(variableDeclarationNode, fileContext) {
|
|
11
|
+
let variableDeclarationVerified;
|
|
12
|
+
|
|
13
|
+
fileContext.begin(variableDeclarationNode);
|
|
14
|
+
|
|
11
15
|
const typeNode = typeNodeQuery(variableDeclarationNode),
|
|
12
16
|
variableNode = variableNodeQuery(variableDeclarationNode),
|
|
13
|
-
variableVVerified = verifyVariable(variableNode, typeNode,
|
|
14
|
-
|
|
17
|
+
variableVVerified = verifyVariable(variableNode, typeNode, fileContext);
|
|
18
|
+
|
|
19
|
+
variableDeclarationVerified = variableVVerified; ///
|
|
20
|
+
|
|
21
|
+
variableDeclarationVerified ?
|
|
22
|
+
fileContext.complete(variableDeclarationNode) :
|
|
23
|
+
fileContext.halt(variableDeclarationNode);
|
|
15
24
|
|
|
16
25
|
return variableDeclarationVerified;
|
|
17
26
|
}
|
package/src/verify/equality.js
CHANGED
|
@@ -8,11 +8,14 @@ import { first, second } from "../utilities/array";
|
|
|
8
8
|
const firstTermNodeQuery = nodeQuery("/equality/term[0]"),
|
|
9
9
|
secondTermNodeQuery = nodeQuery("/equality/term[1]");
|
|
10
10
|
|
|
11
|
-
export default function verifyEquality(equalityNode,
|
|
11
|
+
export default function verifyEquality(equalityNode, proofContext) {
|
|
12
12
|
let equalityVerified = false;
|
|
13
13
|
|
|
14
|
+
proofContext.begin(equalityNode);
|
|
15
|
+
|
|
14
16
|
const types = [],
|
|
15
17
|
values = [],
|
|
18
|
+
context = proofContext,
|
|
16
19
|
firstTermNode = firstTermNodeQuery(equalityNode),
|
|
17
20
|
secondTermNode = secondTermNodeQuery(equalityNode),
|
|
18
21
|
firstTermVerified = verifyTerm(firstTermNode, types, values, context),
|
|
@@ -24,10 +27,10 @@ export default function verifyEquality(equalityNode, context) {
|
|
|
24
27
|
firstTypeEqualToSubTypeOfOrSuperTypeOfSecondType = firstType.isEqualToSubTypeOfOrSuperTypeOf(secondType);
|
|
25
28
|
|
|
26
29
|
if (firstTypeEqualToSubTypeOfOrSuperTypeOfSecondType) {
|
|
27
|
-
const derived =
|
|
30
|
+
const derived = proofContext.isDerived();
|
|
28
31
|
|
|
29
32
|
if (derived) {
|
|
30
|
-
const termsEqual = equateTerms(firstTermNode, secondTermNode,
|
|
33
|
+
const termsEqual = equateTerms(firstTermNode, secondTermNode, proofContext);
|
|
31
34
|
|
|
32
35
|
if (termsEqual) {
|
|
33
36
|
equalityVerified = true;
|
|
@@ -38,10 +41,14 @@ export default function verifyEquality(equalityNode, context) {
|
|
|
38
41
|
}
|
|
39
42
|
}
|
|
40
43
|
|
|
44
|
+
equalityVerified ?
|
|
45
|
+
proofContext.complete(equalityNode) :
|
|
46
|
+
proofContext.halt(equalityNode);
|
|
47
|
+
|
|
41
48
|
return equalityVerified;
|
|
42
49
|
}
|
|
43
50
|
|
|
44
|
-
function equateTerms(firstTermNode, secondTermNode,
|
|
51
|
+
function equateTerms(firstTermNode, secondTermNode, proofContext) {
|
|
45
52
|
let termsEqual = true; ///
|
|
46
53
|
|
|
47
54
|
debugger
|