occam-verify-cli 0.0.317 → 0.0.319
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 +47 -46
- 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 +9 -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/utilities/verification.js +45 -0
- 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 +3 -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/utilities/verification.js +41 -0
- 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
|
@@ -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;
|
|
@@ -15,10 +15,14 @@ const metaDerivationNodeQuery = nodeQuery("/metaSubproof/metaDerivation!"),
|
|
|
15
15
|
unqualifiedMetastatementNodeQuery = nodeQuery("/unqualifiedMetastatement!"),
|
|
16
16
|
qualifiedOrUnqualifiedMetastatementNodesQuery = nodesQuery("/metaSubproof/qualifiedMetastatement|unqualifiedMetastatement")
|
|
17
17
|
|
|
18
|
-
export default function verifyMetaDerivation(metaDerivationNode,
|
|
18
|
+
export default function verifyMetaDerivation(metaDerivationNode, metaproofContext) {
|
|
19
|
+
let metaDerivationVerified;
|
|
20
|
+
|
|
21
|
+
metaproofContext.begin(metaDerivationNode);
|
|
22
|
+
|
|
19
23
|
const derived = true;
|
|
20
24
|
|
|
21
|
-
|
|
25
|
+
metaproofContext.setDerived(derived);
|
|
22
26
|
|
|
23
27
|
const metaDerivationChildNodes = metaDerivationChildNodesQuery(metaDerivationNode),
|
|
24
28
|
metaDerivationChildNodesVerified = metaDerivationChildNodes.every((metaDerivationChildNode) => {
|
|
@@ -29,12 +33,12 @@ export default function verifyMetaDerivation(metaDerivationNode, context) {
|
|
|
29
33
|
switch (ruleName) {
|
|
30
34
|
case META_SUBPROOF_RULE_NAME: {
|
|
31
35
|
const metaSubproofNode = metaDerivationChildNode, ///
|
|
32
|
-
metaSubproofVerified = verifyMetaSubproof(metaSubproofNode,
|
|
36
|
+
metaSubproofVerified = verifyMetaSubproof(metaSubproofNode, metaproofContext);
|
|
33
37
|
|
|
34
38
|
if (metaSubproofVerified) {
|
|
35
39
|
const metaAssertion = MetaAssertion.fromMetaSubproofNode(metaSubproofNode);
|
|
36
40
|
|
|
37
|
-
|
|
41
|
+
metaproofContext.addMetaAssertion(metaAssertion);
|
|
38
42
|
|
|
39
43
|
metaDerivationChildNodeVerified = true;
|
|
40
44
|
}
|
|
@@ -44,12 +48,12 @@ export default function verifyMetaDerivation(metaDerivationNode, context) {
|
|
|
44
48
|
|
|
45
49
|
case QUALIFIED_METASTATEMENT_RULE_NAME: {
|
|
46
50
|
const qualifiedMetastatementNode = metaDerivationChildNode, ///
|
|
47
|
-
qualifiedMetastatementVerified = verifyQualifiedMetastatement(qualifiedMetastatementNode,
|
|
51
|
+
qualifiedMetastatementVerified = verifyQualifiedMetastatement(qualifiedMetastatementNode, metaproofContext);
|
|
48
52
|
|
|
49
53
|
if (qualifiedMetastatementVerified) {
|
|
50
54
|
const metaAssertion = MetaAssertion.fromQualifiedMetastatementNode(qualifiedMetastatementNode);
|
|
51
55
|
|
|
52
|
-
|
|
56
|
+
metaproofContext.addMetaAssertion(metaAssertion);
|
|
53
57
|
|
|
54
58
|
metaDerivationChildNodeVerified = qualifiedMetastatementVerified; ///
|
|
55
59
|
}
|
|
@@ -59,12 +63,12 @@ export default function verifyMetaDerivation(metaDerivationNode, context) {
|
|
|
59
63
|
|
|
60
64
|
case UNQUALIFIED_METASTATEMENT_RULE_NAME: {
|
|
61
65
|
const unqualifiedMetastatementNode = metaDerivationChildNode, ///
|
|
62
|
-
unqualifiedMetastatementVerified = verifyUnqualifiedMetastatement(unqualifiedMetastatementNode,
|
|
66
|
+
unqualifiedMetastatementVerified = verifyUnqualifiedMetastatement(unqualifiedMetastatementNode, metaproofContext);
|
|
63
67
|
|
|
64
68
|
if (unqualifiedMetastatementVerified) {
|
|
65
69
|
const metaAssertion = MetaAssertion.fromUnqualifiedMetastatementNode(unqualifiedMetastatementNode);
|
|
66
70
|
|
|
67
|
-
|
|
71
|
+
metaproofContext.addMetaAssertion(metaAssertion);
|
|
68
72
|
|
|
69
73
|
metaDerivationChildNodeVerified = true;
|
|
70
74
|
}
|
|
@@ -74,35 +78,38 @@ export default function verifyMetaDerivation(metaDerivationNode, context) {
|
|
|
74
78
|
}
|
|
75
79
|
|
|
76
80
|
return metaDerivationChildNodeVerified;
|
|
77
|
-
})
|
|
78
|
-
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
metaDerivationVerified = metaDerivationChildNodesVerified; ///
|
|
84
|
+
|
|
85
|
+
metaDerivationVerified ?
|
|
86
|
+
metaproofContext.complete(metaDerivationNode) :
|
|
87
|
+
metaproofContext.halt(metaDerivationNode);
|
|
79
88
|
|
|
80
89
|
return metaDerivationVerified;
|
|
81
90
|
}
|
|
82
91
|
|
|
83
|
-
function verifyMetaSubproof(metaSubproofNode,
|
|
92
|
+
function verifyMetaSubproof(metaSubproofNode, metaproofContext) {
|
|
84
93
|
let metaSubproofVerified = false;
|
|
85
94
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
context = metaproofContext; ///
|
|
95
|
+
metaproofContext = MetaproofContext.fromMetaproofContext(metaproofContext); ///
|
|
89
96
|
|
|
90
97
|
const qualifiedOrUnqualifiedMetastatementNodes = qualifiedOrUnqualifiedMetastatementNodesQuery(metaSubproofNode),
|
|
91
98
|
firstQualifiedOrUnqualifiedMetastatementNode = first(qualifiedOrUnqualifiedMetastatementNodes),
|
|
92
99
|
unqualifiedMetastatementNode = firstQualifiedOrUnqualifiedMetastatementNode, ///
|
|
93
|
-
unqualifiedMetastatementVerified = verifyUnqualifiedMetastatement(unqualifiedMetastatementNode,
|
|
100
|
+
unqualifiedMetastatementVerified = verifyUnqualifiedMetastatement(unqualifiedMetastatementNode, metaproofContext);
|
|
94
101
|
|
|
95
102
|
if (unqualifiedMetastatementVerified) {
|
|
96
103
|
const metaAssertion = MetaAssertion.fromUnqualifiedMetastatementNode(unqualifiedMetastatementNode);
|
|
97
104
|
|
|
98
|
-
|
|
105
|
+
metaproofContext.addMetaAssertion(metaAssertion);
|
|
99
106
|
|
|
100
107
|
let metaDerivationVerified = true;
|
|
101
108
|
|
|
102
109
|
const metaDerivationNode = metaDerivationNodeQuery(metaSubproofNode);
|
|
103
110
|
|
|
104
111
|
if (metaDerivationNode !== null) {
|
|
105
|
-
metaDerivationVerified = verifyMetaDerivation(metaDerivationNode,
|
|
112
|
+
metaDerivationVerified = verifyMetaDerivation(metaDerivationNode, metaproofContext);
|
|
106
113
|
}
|
|
107
114
|
|
|
108
115
|
if (metaDerivationVerified) {
|
|
@@ -112,13 +119,13 @@ function verifyMetaSubproof(metaSubproofNode, context) {
|
|
|
112
119
|
unqualifiedMetastatementNode = unqualifiedMetastatementNodeQuery(qualifiedOrUnqualifiedMetastatementNode);
|
|
113
120
|
|
|
114
121
|
if (qualifiedMetastatementNode !== null) {
|
|
115
|
-
const qualifiedMetastatementVerified = verifyQualifiedMetastatement(qualifiedMetastatementNode,
|
|
122
|
+
const qualifiedMetastatementVerified = verifyQualifiedMetastatement(qualifiedMetastatementNode, metaproofContext);
|
|
116
123
|
|
|
117
124
|
metaSubproofVerified = qualifiedMetastatementVerified; ///
|
|
118
125
|
}
|
|
119
126
|
|
|
120
127
|
if (unqualifiedMetastatementNode !== null) {
|
|
121
|
-
const unqualifiedMetastatementVerified = verifyUnqualifiedMetastatement(unqualifiedMetastatementNode,
|
|
128
|
+
const unqualifiedMetastatementVerified = verifyUnqualifiedMetastatement(unqualifiedMetastatementNode, metaproofContext);
|
|
122
129
|
|
|
123
130
|
metaSubproofVerified = unqualifiedMetastatementVerified; ///
|
|
124
131
|
}
|
package/src/verify/metaproof.js
CHANGED
|
@@ -9,20 +9,22 @@ const metaDerivationNodeQuery = nodeQuery("/metaproof/metaDerivation!"),
|
|
|
9
9
|
qualifiedStatementNodeQuery = nodeQuery("/metaproof/qualifiedMetastatement!"),
|
|
10
10
|
metaProofMetastatementNodeQuery = nodeQuery("/metaproof/qualifiedMetastatement/metastatement!");
|
|
11
11
|
|
|
12
|
-
export default function verifyMetaproof(metaproofNode, conclusion,
|
|
12
|
+
export default function verifyMetaproof(metaproofNode, conclusion, metaproofContext) {
|
|
13
13
|
let metaproofVerified = false;
|
|
14
14
|
|
|
15
|
+
metaproofContext.begin(metaproofNode);
|
|
16
|
+
|
|
15
17
|
const metaDerivationNode = metaDerivationNodeQuery(metaproofNode);
|
|
16
18
|
|
|
17
19
|
let metaDerivationVerified = true;
|
|
18
20
|
|
|
19
21
|
if (metaDerivationNode !== null) {
|
|
20
|
-
metaDerivationVerified = verifyMetaDerivation(metaDerivationNode,
|
|
22
|
+
metaDerivationVerified = verifyMetaDerivation(metaDerivationNode, metaproofContext);
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
if (metaDerivationVerified) {
|
|
24
26
|
const qualifiedMetastatementNode = qualifiedStatementNodeQuery(metaproofNode),
|
|
25
|
-
qualifiedMetastatementVerified = verifyQualifiedMetastatement(qualifiedMetastatementNode,
|
|
27
|
+
qualifiedMetastatementVerified = verifyQualifiedMetastatement(qualifiedMetastatementNode, metaproofContext);
|
|
26
28
|
|
|
27
29
|
if (qualifiedMetastatementVerified) {
|
|
28
30
|
const metastatementNode = conclusion.getMetastatementNode(),
|
|
@@ -33,6 +35,10 @@ export default function verifyMetaproof(metaproofNode, conclusion, context) {
|
|
|
33
35
|
}
|
|
34
36
|
}
|
|
35
37
|
|
|
38
|
+
metaproofVerified ?
|
|
39
|
+
metaproofContext.complete(metaproofNode) :
|
|
40
|
+
metaproofContext.complete(metaproofNode);
|
|
41
|
+
|
|
36
42
|
return metaproofVerified;
|
|
37
43
|
}
|
|
38
44
|
|
|
@@ -6,18 +6,20 @@ import { nodeQuery, referenceNameFromReferenceNode } from "../../utilities/query
|
|
|
6
6
|
const referenceNodeQuery = nodeQuery("/qualifiedMetastatement/qualification!/reference!"),
|
|
7
7
|
metastatementNodeQuery = nodeQuery("/qualifiedMetastatement/metastatement!");
|
|
8
8
|
|
|
9
|
-
export default function verifyQualifiedMetastatement(qualifiedMetastatementNode,
|
|
9
|
+
export default function verifyQualifiedMetastatement(qualifiedMetastatementNode, metaproofContext) {
|
|
10
10
|
let qualifiedMetastatementVerified = false;
|
|
11
11
|
|
|
12
|
+
metaproofContext.begin(qualifiedMetastatementNode);
|
|
13
|
+
|
|
12
14
|
const metastatementNode = metastatementNodeQuery(qualifiedMetastatementNode);
|
|
13
15
|
|
|
14
16
|
if (metastatementNode !== null) {
|
|
15
17
|
const referenceNode = referenceNodeQuery(qualifiedMetastatementNode),
|
|
16
18
|
referenceName = referenceNameFromReferenceNode(referenceNode),
|
|
17
|
-
rule =
|
|
19
|
+
rule = metaproofContext.findRuleByReferenceName(referenceName);
|
|
18
20
|
|
|
19
21
|
if (rule !== null) {
|
|
20
|
-
const ruleMatchesMetastatement = rule.matchMetastatement(metastatementNode,
|
|
22
|
+
const ruleMatchesMetastatement = rule.matchMetastatement(metastatementNode, metaproofContext);
|
|
21
23
|
|
|
22
24
|
qualifiedMetastatementVerified = ruleMatchesMetastatement; ///
|
|
23
25
|
}
|
|
@@ -26,8 +28,12 @@ export default function verifyQualifiedMetastatement(qualifiedMetastatementNode,
|
|
|
26
28
|
if (qualifiedMetastatementVerified) {
|
|
27
29
|
const metastatementString = nodeAsString(metastatementNode);
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
metaproofContext.debug(`Verified the '${metastatementString}' qualified metastatement.`);
|
|
30
32
|
}
|
|
31
33
|
|
|
34
|
+
qualifiedMetastatementVerified ?
|
|
35
|
+
metaproofContext.complete(qualifiedMetastatementNode) :
|
|
36
|
+
metaproofContext.halt(qualifiedMetastatementNode);
|
|
37
|
+
|
|
32
38
|
return qualifiedMetastatementVerified;
|
|
33
39
|
}
|
|
@@ -7,17 +7,19 @@ import { nodeAsString } from "../../utilities/string";
|
|
|
7
7
|
|
|
8
8
|
const metastatementNodeQuery = nodeQuery("/unqualifiedMetastatement/metastatement!");
|
|
9
9
|
|
|
10
|
-
export default function verifyUnqualifiedMetastatement(unqualifiedMetastatementNode,
|
|
10
|
+
export default function verifyUnqualifiedMetastatement(unqualifiedMetastatementNode, metaproofContext) {
|
|
11
11
|
let unqualifiedMetastatementVerified = false;
|
|
12
12
|
|
|
13
|
+
metaproofContext.begin(unqualifiedMetastatementNode);
|
|
14
|
+
|
|
13
15
|
const metastatementNode = metastatementNodeQuery(unqualifiedMetastatementNode);
|
|
14
16
|
|
|
15
17
|
if (metastatementNode !== null) {
|
|
16
|
-
const derived =
|
|
18
|
+
const derived = metaproofContext.isDerived();
|
|
17
19
|
|
|
18
20
|
if (derived) {
|
|
19
21
|
const metaAssertion = MetaAssertion.fromMetastatementNode(metastatementNode),
|
|
20
|
-
metaAssertionMatches =
|
|
22
|
+
metaAssertionMatches = metaproofContext.matchMetaAssertion(metaAssertion);
|
|
21
23
|
|
|
22
24
|
unqualifiedMetastatementVerified = metaAssertionMatches; ///
|
|
23
25
|
} else {
|
|
@@ -28,8 +30,12 @@ export default function verifyUnqualifiedMetastatement(unqualifiedMetastatementN
|
|
|
28
30
|
if (unqualifiedMetastatementVerified) {
|
|
29
31
|
const metastatementString = nodeAsString(metastatementNode);
|
|
30
32
|
|
|
31
|
-
|
|
33
|
+
metaproofContext.debug(`Verified the '${metastatementString}' unqualified metastatement.`);
|
|
32
34
|
}
|
|
33
35
|
|
|
36
|
+
unqualifiedMetastatementVerified ?
|
|
37
|
+
metaproofContext.complete(unqualifiedMetastatementNode) :
|
|
38
|
+
metaproofContext.halt(unqualifiedMetastatementNode);
|
|
39
|
+
|
|
34
40
|
return unqualifiedMetastatementVerified;
|
|
35
41
|
}
|
|
@@ -9,28 +9,32 @@ import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
|
9
9
|
const metastatementNodeQuery = nodeQuery("/unqualifiedMetastatement/metastatement"),
|
|
10
10
|
unqualifiedMetastatementNodesQuery = nodesQuery("/premise|premises/unqualifiedMetastatement");
|
|
11
11
|
|
|
12
|
-
export default function verifyPremiseOrPremises(premiseOrPremisesNode, premises,
|
|
13
|
-
|
|
14
|
-
premiseOrPremisesVerified = unqualifiedMetastatementNodes.every((unqualifiedMetastatementNode) => {
|
|
15
|
-
const unqualifiedMetastatementVerified = verifyUnqualifiedMetastatement(unqualifiedMetastatementNode, context);
|
|
12
|
+
export default function verifyPremiseOrPremises(premiseOrPremisesNode, premises, metaproofContext) {
|
|
13
|
+
let premiseOrPremisesVerified;
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
const metaAssertion = MetaAssertion.fromUnqualifiedMetastatementNode(unqualifiedMetastatementNode);
|
|
15
|
+
metaproofContext.begin(premiseOrPremisesNode);
|
|
19
16
|
|
|
20
|
-
|
|
17
|
+
const unqualifiedMetastatementNodes = unqualifiedMetastatementNodesQuery(premiseOrPremisesNode);
|
|
21
18
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
});
|
|
19
|
+
premiseOrPremisesVerified = unqualifiedMetastatementNodes.every((unqualifiedMetastatementNode) => {
|
|
20
|
+
const unqualifiedMetastatementVerified = verifyUnqualifiedMetastatement(unqualifiedMetastatementNode, metaproofContext);
|
|
25
21
|
|
|
26
|
-
|
|
27
|
-
unqualifiedMetastatementNodes.forEach((unqualifiedMetastatementNode) => {
|
|
22
|
+
if (unqualifiedMetastatementVerified) {
|
|
28
23
|
const metastatementNode = metastatementNodeQuery(unqualifiedMetastatementNode),
|
|
24
|
+
metaAssertion = MetaAssertion.fromUnqualifiedMetastatementNode(unqualifiedMetastatementNode),
|
|
29
25
|
premise = Premise.fromMetastatementNode(metastatementNode);
|
|
30
26
|
|
|
31
27
|
premises.push(premise);
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
|
|
29
|
+
metaproofContext.addMetaAssertion(metaAssertion);
|
|
30
|
+
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
premiseOrPremisesVerified ?
|
|
36
|
+
metaproofContext.complete(premiseOrPremisesNode) :
|
|
37
|
+
metaproofContext.halt(premiseOrPremisesNode);
|
|
34
38
|
|
|
35
39
|
return premiseOrPremisesVerified;
|
|
36
40
|
}
|
package/src/verify/release.js
CHANGED
|
@@ -2,51 +2,69 @@
|
|
|
2
2
|
|
|
3
3
|
import verifyFiles from "../verify/files";
|
|
4
4
|
|
|
5
|
-
export default function verifyRelease(name, releaseContextMap
|
|
5
|
+
export default function verifyRelease(name, releaseContextMap) {
|
|
6
6
|
const releaseContext = releaseContextMap[name],
|
|
7
|
-
verified = releaseContext.isVerified()
|
|
7
|
+
verified = releaseContext.isVerified();
|
|
8
8
|
|
|
9
9
|
let releaseVerified = verified; ///
|
|
10
10
|
|
|
11
11
|
if (!releaseVerified) {
|
|
12
12
|
releaseContext.debug(`Verifying the '${name}' package...`);
|
|
13
13
|
|
|
14
|
-
const
|
|
15
|
-
dependencyReleasesVVerified = dependencies.everyDependency((dependency) => {
|
|
16
|
-
const name = dependency.getName(),
|
|
17
|
-
releaseVerified = verifyRelease(name, releaseContextMap, releaseContexts);
|
|
18
|
-
|
|
19
|
-
if (releaseVerified) {
|
|
20
|
-
return true;
|
|
21
|
-
}
|
|
22
|
-
});
|
|
14
|
+
const dependencyReleasesVVerified = verifyDependencyReleases(releaseContext, releaseContextMap);
|
|
23
15
|
|
|
24
16
|
if (dependencyReleasesVVerified) {
|
|
25
|
-
const
|
|
26
|
-
const name = dependency.getName(),
|
|
27
|
-
releaseContext = releaseContextMap[name];
|
|
28
|
-
|
|
29
|
-
return releaseContext;
|
|
30
|
-
}),
|
|
31
|
-
dependencyReleaseContexts = retrieveDependencyReleaseContexts(dependencies, releaseContextMap);
|
|
32
|
-
|
|
33
|
-
releaseContext.initialise(releaseContexts, dependencyReleaseContexts);
|
|
17
|
+
const releaseFilesVerified = verifyReleaseFiles(releaseContext, releaseContextMap);
|
|
34
18
|
|
|
35
|
-
|
|
19
|
+
if (releaseFilesVerified) {
|
|
20
|
+
releaseVerified = true;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
36
24
|
|
|
37
|
-
|
|
25
|
+
if (releaseVerified) {
|
|
26
|
+
const verified = true;
|
|
38
27
|
|
|
39
|
-
|
|
40
|
-
releaseContexts.push(releaseContext);
|
|
28
|
+
releaseContext.setVerified(verified);
|
|
41
29
|
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
}
|
|
30
|
+
releaseContext.info(`Verified the '${name}' package.`);
|
|
45
31
|
}
|
|
46
32
|
|
|
47
33
|
return releaseVerified;
|
|
48
34
|
}
|
|
49
35
|
|
|
36
|
+
function verifyReleaseFiles(releaseContext, releaseContextMap) {
|
|
37
|
+
const dependencies = releaseContext.getDependencies(),
|
|
38
|
+
releaseContexts = dependencies.mapDependency((dependency) => {
|
|
39
|
+
const name = dependency.getName(),
|
|
40
|
+
releaseContext = releaseContextMap[name];
|
|
41
|
+
|
|
42
|
+
return releaseContext;
|
|
43
|
+
}),
|
|
44
|
+
dependencyReleaseContexts = retrieveDependencyReleaseContexts(dependencies, releaseContextMap);
|
|
45
|
+
|
|
46
|
+
releaseContext.initialise(releaseContexts, dependencyReleaseContexts);
|
|
47
|
+
|
|
48
|
+
const filesVerified = verifyFiles(releaseContext),
|
|
49
|
+
releaseFilesVerified = filesVerified; ///
|
|
50
|
+
|
|
51
|
+
return releaseFilesVerified;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function verifyDependencyReleases(releaseContext, releaseContextMap) {
|
|
55
|
+
const dependencies = releaseContext.getDependencies(),
|
|
56
|
+
dependencyReleasesVVerified = dependencies.everyDependency((dependency) => {
|
|
57
|
+
const name = dependency.getName(),
|
|
58
|
+
releaseVerified = verifyRelease(name, releaseContextMap);
|
|
59
|
+
|
|
60
|
+
if (releaseVerified) {
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
return dependencyReleasesVVerified;
|
|
66
|
+
}
|
|
67
|
+
|
|
50
68
|
function retrieveDependencyReleaseContexts(dependencies, releaseContextMap, dependencyReleaseContexts = []) {
|
|
51
69
|
dependencies.forEachDependency((dependency) => {
|
|
52
70
|
const dependencyName = dependency.getName(),
|