occam-verify-cli 0.0.316 → 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 +3 -5
- package/bin/messages.js +11 -0
- package/bin/utilities/logging.js +2 -10
- package/bin/utilities/release.js +68 -43
- 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 +2 -2
- 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/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
|
package/src/verify/file.js
CHANGED
|
@@ -1,35 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import FileContext from "../context/file";
|
|
4
|
-
import
|
|
5
|
-
import verifyTopLevelDeclaration from "../verify/declaration/topLevel";
|
|
4
|
+
import verifyTopLevelDeclaration from "./declaration/topLevel";
|
|
6
5
|
|
|
7
6
|
import { nodesQuery } from "../utilities/query";
|
|
8
7
|
|
|
9
8
|
const topLevelDeclarationNodesQuery = nodesQuery("/document/topLevelDeclaration");
|
|
10
9
|
|
|
11
|
-
export default function verifyFile(filePath, releaseContext
|
|
12
|
-
let fileVerified
|
|
10
|
+
export default function verifyFile(filePath, releaseContext) {
|
|
11
|
+
let fileVerified;
|
|
13
12
|
|
|
14
13
|
releaseContext.debug(`Verifying the '${filePath}' file...`);
|
|
15
14
|
|
|
16
15
|
const fileContext = FileContext.fromReleaseContextAndFilePath(releaseContext, filePath),
|
|
17
|
-
context = fileContext, ///
|
|
18
16
|
node = fileContext.getNode(),
|
|
19
17
|
topLevelDeclarationNodes = topLevelDeclarationNodesQuery(node),
|
|
20
18
|
topLevelDeclarationsVerified = topLevelDeclarationNodes.every((topLevelDeclarationNode) => {
|
|
21
|
-
const topLevelDeclarationVerified = verifyTopLevelDeclaration(topLevelDeclarationNode,
|
|
19
|
+
const topLevelDeclarationVerified = verifyTopLevelDeclaration(topLevelDeclarationNode, fileContext);
|
|
22
20
|
|
|
23
21
|
if (topLevelDeclarationVerified) {
|
|
24
22
|
return true;
|
|
25
23
|
}
|
|
26
24
|
})
|
|
27
25
|
|
|
26
|
+
fileVerified = topLevelDeclarationsVerified; ///
|
|
27
|
+
|
|
28
28
|
if (topLevelDeclarationsVerified) {
|
|
29
29
|
releaseContext.addFileContext(fileContext);
|
|
30
30
|
|
|
31
|
-
fileVerified = true;
|
|
32
|
-
|
|
33
31
|
releaseContext.info(`Verified the '${filePath}' file.`);
|
|
34
32
|
}
|
|
35
33
|
|
package/src/verify/label.js
CHANGED
|
@@ -2,20 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
import { labelNameFromLabelNode } from "../utilities/query";
|
|
4
4
|
|
|
5
|
-
export default function verifyLabel(labelNode, labels,
|
|
5
|
+
export default function verifyLabel(labelNode, labels, fileContext) {
|
|
6
6
|
let labelVerified = false;
|
|
7
7
|
|
|
8
|
+
fileContext.begin(labelNode);
|
|
9
|
+
|
|
8
10
|
const labelName = labelNameFromLabelNode(labelNode),
|
|
9
11
|
label = labelName, ///
|
|
10
|
-
labelPresent =
|
|
12
|
+
labelPresent = fileContext.isLabelPresent(label);
|
|
11
13
|
|
|
12
14
|
if (labelPresent) {
|
|
13
|
-
|
|
15
|
+
fileContext.error(`The label ${label} is already present`, labelNode);
|
|
14
16
|
} else {
|
|
15
17
|
labels.push(label);
|
|
16
18
|
|
|
17
19
|
labelVerified = true;
|
|
18
20
|
}
|
|
19
21
|
|
|
22
|
+
labelVerified ?
|
|
23
|
+
fileContext.complete(labelNode) :
|
|
24
|
+
fileContext.halt(labelNode);
|
|
25
|
+
|
|
20
26
|
return labelVerified;
|
|
21
27
|
}
|
package/src/verify/labels.js
CHANGED
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
import verifyLabel from "../verify/label";
|
|
4
4
|
|
|
5
|
-
export default function verifyLabels(labelNodes, labels,
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
export default function verifyLabels(labelNodes, labels, fileContext) {
|
|
6
|
+
let labelsVerified;
|
|
7
|
+
|
|
8
|
+
labelsVerified = labelNodes.every((labelNode) => {
|
|
9
|
+
const labelVerified = verifyLabel(labelNode, labels, fileContext);
|
|
8
10
|
|
|
9
11
|
if (labelVerified) {
|
|
10
12
|
return true;
|