occam-verify-cli 0.0.527 → 0.0.529
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/README.md +4 -0
- package/bin/abbreviations.js +5 -1
- package/bin/action/help.js +4 -0
- package/bin/action/verify.js +35 -13
- package/bin/actions.js +11 -6
- package/bin/defaults.js +4 -0
- package/bin/options.js +4 -0
- package/bin/utilities/releaseContext.js +5 -7
- package/lib/axiom.js +3 -3
- package/lib/axiomLemmaTheoremConjecture.js +5 -5
- package/lib/combinator.js +4 -3
- package/lib/conclusion.js +8 -7
- package/lib/conjecture.js +3 -3
- package/lib/consequence.js +6 -5
- package/lib/constants.js +8 -12
- package/lib/constructor.js +5 -4
- package/lib/context/file.js +13 -35
- package/lib/context/metaproof.js +12 -11
- package/lib/context/proof.js +11 -10
- package/lib/context/release/directory.js +6 -6
- package/lib/context/release/file.js +15 -26
- package/lib/context/release.js +32 -51
- package/lib/equality.js +5 -4
- package/lib/index.js +4 -4
- package/lib/label.js +4 -3
- package/lib/lemma.js +3 -3
- package/lib/log.js +146 -0
- package/lib/matcher.js +14 -23
- package/lib/metaTypeNames.js +13 -0
- package/lib/mixins/logging.js +13 -13
- package/lib/node/metastatement/bracketed.js +16 -0
- package/lib/node/statement/bracketed.js +16 -0
- package/lib/node/statement/combinator/bracketed.js +17 -0
- package/lib/node/statement/combinator/equality.js +17 -0
- package/lib/node/statement/equality.js +16 -0
- package/lib/ocmbinator/bracketed.js +3 -4
- package/lib/ocmbinator/equality.js +3 -4
- package/lib/premise.js +10 -9
- package/lib/rule.js +5 -5
- package/lib/step/metaproof.js +28 -25
- package/lib/step/proof.js +15 -14
- package/lib/substitution/metastatementForMetavariable.js +16 -13
- package/lib/substitution/statementForMetavariable.js +17 -18
- package/lib/substitution/termForVariable.js +8 -18
- package/lib/supposition.js +7 -6
- package/lib/theorem.js +3 -3
- package/lib/type.js +5 -5
- package/lib/utilities/metaproof.js +60 -0
- package/lib/utilities/node.js +56 -0
- package/lib/utilities/proof.js +60 -0
- package/lib/utilities/releaseContext.js +24 -12
- package/lib/utilities/string.js +1 -32
- package/lib/{matcher → verifier}/metastatementForMetavariable/conclusion.js +12 -12
- package/lib/{matcher → verifier}/metastatementForMetavariable/premise.js +12 -12
- package/lib/verifier/metastatementForMetavariable.js +198 -0
- package/lib/{matcher → verifier}/statementForMetavariable/conclusion.js +12 -12
- package/lib/{matcher → verifier}/statementForMetavariable/premise.js +12 -12
- package/lib/verifier/statementForMetavariable.js +203 -0
- package/lib/{matcher → verifier}/termForVariable/consequence.js +12 -12
- package/lib/{matcher → verifier}/termForVariable/supposition.js +12 -12
- package/lib/verifier/termForVariable.js +198 -0
- package/lib/verifier.js +92 -0
- package/lib/verify/assertion/type.js +6 -8
- package/lib/verify/axiom.js +3 -5
- package/lib/verify/conclusion.js +2 -4
- package/lib/verify/conjecture.js +3 -5
- package/lib/verify/consequence.js +2 -4
- package/lib/verify/declaration/combinator.js +1 -3
- package/lib/verify/declaration/constructor.js +1 -3
- package/lib/verify/declaration/topLevel.js +1 -3
- package/lib/verify/declaration/type.js +1 -3
- package/lib/verify/declaration/variable.js +1 -3
- package/lib/verify/derivation.js +1 -5
- package/lib/verify/label.js +1 -3
- package/lib/verify/lemma.js +3 -5
- package/lib/verify/metastatement/qualified.js +2 -4
- package/lib/verify/metastatement/unqualified.js +2 -4
- package/lib/verify/metastatement.js +1 -3
- package/lib/verify/premise.js +2 -4
- package/lib/verify/proof.js +3 -5
- package/lib/verify/rule.js +3 -5
- package/lib/verify/ruleDerivation.js +1 -5
- package/lib/verify/ruleProof.js +3 -5
- package/lib/verify/statement/qualified.js +2 -4
- package/lib/verify/statement/unqualified.js +2 -4
- package/lib/verify/statement.js +14 -17
- package/lib/verify/statementAsCombinator.js +4 -6
- package/lib/verify/supposition.js +2 -4
- package/lib/verify/term.js +4 -10
- package/lib/verify/termAsConstructor.js +6 -9
- package/lib/verify/theorem.js +3 -5
- package/lib/verify/type.js +5 -9
- package/lib/verify/variable.js +5 -9
- package/package.json +1 -1
- package/src/axiom.js +1 -1
- package/src/axiomLemmaTheoremConjecture.js +4 -4
- package/src/combinator.js +3 -3
- package/src/conclusion.js +7 -7
- package/src/conjecture.js +1 -1
- package/src/consequence.js +5 -5
- package/src/constants.js +2 -3
- package/src/constructor.js +4 -4
- package/src/context/file.js +6 -30
- package/src/context/metaproof.js +13 -10
- package/src/context/proof.js +11 -9
- package/src/context/release/directory.js +7 -7
- package/src/context/release/file.js +17 -32
- package/src/context/release.js +23 -32
- package/src/equality.js +6 -8
- package/src/index.js +2 -1
- package/src/label.js +3 -3
- package/src/lemma.js +1 -1
- package/src/log.js +116 -0
- package/src/matcher.js +11 -9
- package/src/metaTypeNames.js +3 -0
- package/src/mixins/logging.js +6 -6
- package/src/node/metastatement/bracketed.js +9 -0
- package/src/node/statement/bracketed.js +9 -0
- package/src/node/statement/combinator/bracketed.js +10 -0
- package/src/node/statement/combinator/equality.js +11 -0
- package/src/node/statement/equality.js +10 -0
- package/src/ocmbinator/bracketed.js +2 -5
- package/src/ocmbinator/equality.js +2 -5
- package/src/premise.js +9 -9
- package/src/rule.js +4 -4
- package/src/step/metaproof.js +32 -29
- package/src/step/proof.js +15 -14
- package/src/substitution/metastatementForMetavariable.js +10 -15
- package/src/substitution/statementForMetavariable.js +12 -24
- package/src/substitution/termForVariable.js +2 -30
- package/src/supposition.js +6 -6
- package/src/theorem.js +1 -1
- package/src/type.js +4 -4
- package/src/utilities/metaproof.js +62 -0
- package/src/utilities/node.js +73 -0
- package/src/utilities/proof.js +62 -0
- package/src/utilities/releaseContext.js +30 -12
- package/src/utilities/string.js +0 -47
- package/src/verifier/metastatementForMetavariable/conclusion.js +9 -0
- package/src/verifier/metastatementForMetavariable/premise.js +9 -0
- package/src/{matcher → verifier}/metastatementForMetavariable.js +2 -2
- package/src/verifier/statementForMetavariable/conclusion.js +9 -0
- package/src/verifier/statementForMetavariable/premise.js +9 -0
- package/src/{matcher → verifier}/statementForMetavariable.js +2 -2
- package/src/verifier/termForVariable/consequence.js +9 -0
- package/src/verifier/termForVariable/supposition.js +9 -0
- package/src/{matcher → verifier}/termForVariable.js +2 -2
- package/src/verifier.js +74 -0
- package/src/verify/assertion/type.js +5 -11
- package/src/verify/axiom.js +2 -8
- package/src/verify/conclusion.js +1 -7
- package/src/verify/conjecture.js +2 -8
- package/src/verify/consequence.js +1 -7
- package/src/verify/declaration/combinator.js +0 -6
- package/src/verify/declaration/constructor.js +0 -6
- package/src/verify/declaration/topLevel.js +0 -6
- package/src/verify/declaration/type.js +0 -6
- package/src/verify/declaration/variable.js +0 -6
- package/src/verify/derivation.js +0 -12
- package/src/verify/label.js +0 -6
- package/src/verify/lemma.js +4 -10
- package/src/verify/metastatement/qualified.js +1 -7
- package/src/verify/metastatement/unqualified.js +1 -7
- package/src/verify/metastatement.js +0 -6
- package/src/verify/premise.js +1 -7
- package/src/verify/proof.js +1 -7
- package/src/verify/rule.js +2 -8
- package/src/verify/ruleDerivation.js +0 -12
- package/src/verify/ruleProof.js +1 -7
- package/src/verify/statement/qualified.js +1 -7
- package/src/verify/statement/unqualified.js +1 -7
- package/src/verify/statement.js +24 -34
- package/src/verify/statementAsCombinator.js +3 -9
- package/src/verify/supposition.js +1 -7
- package/src/verify/term.js +3 -21
- package/src/verify/termAsConstructor.js +5 -13
- package/src/verify/theorem.js +2 -8
- package/src/verify/type.js +4 -13
- package/src/verify/variable.js +4 -13
- package/bin/callbacks.js +0 -48
- package/lib/callbacks.js +0 -75
- package/lib/context/release/combinator.js +0 -64
- package/lib/matcher/metastatementForMetavariable.js +0 -198
- package/lib/matcher/statementForMetavariable.js +0 -203
- package/lib/matcher/termForVariable.js +0 -198
- package/lib/mixins/callbacks.js +0 -27
- package/lib/utilities/substitution.js +0 -60
- package/src/callbacks.js +0 -39
- package/src/context/release/combinator.js +0 -39
- package/src/matcher/metastatementForMetavariable/conclusion.js +0 -9
- package/src/matcher/metastatementForMetavariable/premise.js +0 -9
- package/src/matcher/statementForMetavariable/conclusion.js +0 -9
- package/src/matcher/statementForMetavariable/premise.js +0 -9
- package/src/matcher/termForVariable/consequence.js +0 -9
- package/src/matcher/termForVariable/supposition.js +0 -9
- package/src/mixins/callbacks.js +0 -15
- package/src/utilities/substitution.js +0 -81
package/src/verify/derivation.js
CHANGED
|
@@ -17,8 +17,6 @@ const childNodesQuery = nodesQuery("/derivation|subDerivation/*"),
|
|
|
17
17
|
export default function verifyDerivation(derivationNode, proofContext) {
|
|
18
18
|
let derivationVerified;
|
|
19
19
|
|
|
20
|
-
proofContext.begin(derivationNode);
|
|
21
|
-
|
|
22
20
|
const childNodes = childNodesQuery(derivationNode);
|
|
23
21
|
|
|
24
22
|
derivationVerified = childNodes.every((childNode) => {
|
|
@@ -29,18 +27,12 @@ export default function verifyDerivation(derivationNode, proofContext) {
|
|
|
29
27
|
}
|
|
30
28
|
});
|
|
31
29
|
|
|
32
|
-
derivationVerified ?
|
|
33
|
-
proofContext.complete(derivationNode) :
|
|
34
|
-
proofContext.halt(derivationNode);
|
|
35
|
-
|
|
36
30
|
return derivationVerified;
|
|
37
31
|
}
|
|
38
32
|
|
|
39
33
|
function verifySubDerivation(subDerivationNode, proofContext) {
|
|
40
34
|
let subDerivationVerified;
|
|
41
35
|
|
|
42
|
-
proofContext.begin(subDerivationNode);
|
|
43
|
-
|
|
44
36
|
const childNodes = childNodesQuery(subDerivationNode);
|
|
45
37
|
|
|
46
38
|
subDerivationVerified = childNodes.every((childNode) => {
|
|
@@ -51,10 +43,6 @@ function verifySubDerivation(subDerivationNode, proofContext) {
|
|
|
51
43
|
}
|
|
52
44
|
});
|
|
53
45
|
|
|
54
|
-
subDerivationVerified ?
|
|
55
|
-
proofContext.complete(subDerivationNode) :
|
|
56
|
-
proofContext.halt(subDerivationNode);
|
|
57
|
-
|
|
58
46
|
return subDerivationVerified;
|
|
59
47
|
}
|
|
60
48
|
|
package/src/verify/label.js
CHANGED
|
@@ -7,8 +7,6 @@ import { labelNameFromLabelNode } from "../utilities/query";
|
|
|
7
7
|
export default function verifyLabel(labelNode, labels, fileContext) {
|
|
8
8
|
let labelVerified = false;
|
|
9
9
|
|
|
10
|
-
fileContext.begin(labelNode);
|
|
11
|
-
|
|
12
10
|
const labelName = labelNameFromLabelNode(labelNode),
|
|
13
11
|
labelPresent = fileContext.isLabelPresentByLabelName(labelName);
|
|
14
12
|
|
|
@@ -24,9 +22,5 @@ export default function verifyLabel(labelNode, labels, fileContext) {
|
|
|
24
22
|
labelVerified = true;
|
|
25
23
|
}
|
|
26
24
|
|
|
27
|
-
labelVerified ?
|
|
28
|
-
fileContext.complete(labelNode) :
|
|
29
|
-
fileContext.halt(labelNode);
|
|
30
|
-
|
|
31
25
|
return labelVerified;
|
|
32
26
|
}
|
package/src/verify/lemma.js
CHANGED
|
@@ -19,15 +19,13 @@ const proofNodeQuery = nodeQuery("/lemma/proof!"),
|
|
|
19
19
|
export default function verifyLemma(lemmaNode, fileContext) {
|
|
20
20
|
let lemmaVerified = false;
|
|
21
21
|
|
|
22
|
-
fileContext.begin(lemmaNode);
|
|
23
|
-
|
|
24
22
|
const labelNodes = labelNodesQuery(lemmaNode),
|
|
25
23
|
labelsString = fileContext.nodesAsString(labelNodes),
|
|
26
24
|
proofContext = ProofContext.fromFileContext(fileContext);
|
|
27
25
|
|
|
28
26
|
(labelsString === EMPTY_STRING) ?
|
|
29
|
-
fileContext.debug(`Verifying a lemma
|
|
30
|
-
fileContext.debug(`Verifying the '${labelsString}' lemma
|
|
27
|
+
fileContext.debug(`Verifying a lemma...`, lemmaNode) :
|
|
28
|
+
fileContext.debug(`Verifying the '${labelsString}' lemma...`, lemmaNode);
|
|
31
29
|
|
|
32
30
|
const labels = [],
|
|
33
31
|
labelsVerified = verifyLabels(labelNodes, labels, fileContext);
|
|
@@ -67,13 +65,9 @@ export default function verifyLemma(lemmaNode, fileContext) {
|
|
|
67
65
|
|
|
68
66
|
if (lemmaVerified) {
|
|
69
67
|
(labelsString === EMPTY_STRING) ?
|
|
70
|
-
fileContext.info(`Verified the lemma
|
|
71
|
-
fileContext.info(`Verified the '${labelsString}' lemma
|
|
68
|
+
fileContext.info(`Verified the lemma.`, lemmaNode) :
|
|
69
|
+
fileContext.info(`Verified the '${labelsString}' lemma.`, lemmaNode);
|
|
72
70
|
}
|
|
73
71
|
|
|
74
|
-
lemmaVerified ?
|
|
75
|
-
fileContext.complete(lemmaNode) :
|
|
76
|
-
fileContext.complete(lemmaNode);
|
|
77
|
-
|
|
78
72
|
return lemmaVerified;
|
|
79
73
|
}
|
|
@@ -10,14 +10,12 @@ const referenceNodeQuery = nodeQuery("/qualifiedMetastatement/qualification!/ref
|
|
|
10
10
|
export default function verifyQualifiedMetastatement(qualifiedMetastatementNode, assertions, derived, metaproofContext) {
|
|
11
11
|
let qualifiedMetastatementVerified = false;
|
|
12
12
|
|
|
13
|
-
metaproofContext.begin(qualifiedMetastatementNode);
|
|
14
|
-
|
|
15
13
|
const metastatementNode = metastatementNodeQuery(qualifiedMetastatementNode);
|
|
16
14
|
|
|
17
15
|
if (metastatementNode !== null) {
|
|
18
16
|
const metastatementString = metaproofContext.nodeAsString(metastatementNode);
|
|
19
17
|
|
|
20
|
-
metaproofContext.debug(`Verifying the '${metastatementString}' qualified metastatement
|
|
18
|
+
metaproofContext.debug(`Verifying the '${metastatementString}' qualified metastatement...`, qualifiedMetastatementNode);
|
|
21
19
|
|
|
22
20
|
let ruleMatchesMetastatement = true;
|
|
23
21
|
|
|
@@ -39,9 +37,5 @@ export default function verifyQualifiedMetastatement(qualifiedMetastatementNode,
|
|
|
39
37
|
}
|
|
40
38
|
}
|
|
41
39
|
|
|
42
|
-
qualifiedMetastatementVerified ?
|
|
43
|
-
metaproofContext.complete(qualifiedMetastatementNode) :
|
|
44
|
-
metaproofContext.halt(qualifiedMetastatementNode);
|
|
45
|
-
|
|
46
40
|
return qualifiedMetastatementVerified;
|
|
47
41
|
}
|
|
@@ -9,14 +9,12 @@ const metastatementNodeQuery = nodeQuery("/unqualifiedMetastatement/metastatemen
|
|
|
9
9
|
export default function verifyUnqualifiedMetastatement(unqualifiedMetastatementNode, assertions, derived, metaproofContext) {
|
|
10
10
|
let unqualifiedMetastatementVerified = false;
|
|
11
11
|
|
|
12
|
-
metaproofContext.begin(unqualifiedMetastatementNode);
|
|
13
|
-
|
|
14
12
|
const metastatementNode = metastatementNodeQuery(unqualifiedMetastatementNode);
|
|
15
13
|
|
|
16
14
|
if (metastatementNode !== null) {
|
|
17
15
|
const metastatementString = metaproofContext.nodeAsString(metastatementNode);
|
|
18
16
|
|
|
19
|
-
metaproofContext.debug(`Verifying the '${metastatementString}' unqualified metastatement
|
|
17
|
+
metaproofContext.debug(`Verifying the '${metastatementString}' unqualified metastatement...`, unqualifiedMetastatementNode);
|
|
20
18
|
|
|
21
19
|
let metastatementMatches = true;
|
|
22
20
|
|
|
@@ -31,9 +29,5 @@ export default function verifyUnqualifiedMetastatement(unqualifiedMetastatementN
|
|
|
31
29
|
}
|
|
32
30
|
}
|
|
33
31
|
|
|
34
|
-
unqualifiedMetastatementVerified ?
|
|
35
|
-
metaproofContext.complete(unqualifiedMetastatementNode) :
|
|
36
|
-
metaproofContext.halt(unqualifiedMetastatementNode);
|
|
37
|
-
|
|
38
32
|
return unqualifiedMetastatementVerified;
|
|
39
33
|
}
|
|
@@ -3,13 +3,7 @@
|
|
|
3
3
|
export default function verifyMetastatement(metastatementNode, assertions, derived, metaproofContext) {
|
|
4
4
|
let metastatementVerified = true; ///
|
|
5
5
|
|
|
6
|
-
metaproofContext.begin(metastatementNode);
|
|
7
|
-
|
|
8
6
|
///
|
|
9
7
|
|
|
10
|
-
metastatementVerified ?
|
|
11
|
-
metaproofContext.complete(metastatementNode) :
|
|
12
|
-
metaproofContext.halt(metastatementNode);
|
|
13
|
-
|
|
14
8
|
return metastatementVerified;
|
|
15
9
|
}
|
package/src/verify/premise.js
CHANGED
|
@@ -12,11 +12,9 @@ const metastatementNodeQuery = nodeQuery("/unqualifiedMetastatement/metastatemen
|
|
|
12
12
|
export default function verifyPremise(premiseNode, premises, metaproofContext) {
|
|
13
13
|
let premiseVerified;
|
|
14
14
|
|
|
15
|
-
metaproofContext.begin(premiseNode);
|
|
16
|
-
|
|
17
15
|
const premiseString = metaproofContext.nodeAsString(premiseNode);
|
|
18
16
|
|
|
19
|
-
metaproofContext.debug(`Verifying the '${premiseString}' premise
|
|
17
|
+
metaproofContext.debug(`Verifying the '${premiseString}' premise...`, premiseNode);
|
|
20
18
|
|
|
21
19
|
const derived = false,
|
|
22
20
|
assertions = [],
|
|
@@ -35,9 +33,5 @@ export default function verifyPremise(premiseNode, premises, metaproofContext) {
|
|
|
35
33
|
premiseVerified = true;
|
|
36
34
|
}
|
|
37
35
|
|
|
38
|
-
premiseVerified ?
|
|
39
|
-
metaproofContext.complete(premiseNode) :
|
|
40
|
-
metaproofContext.halt(premiseNode);
|
|
41
|
-
|
|
42
36
|
return premiseVerified;
|
|
43
37
|
}
|
package/src/verify/proof.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import matcher from "../matcher";
|
|
3
4
|
import verifyDerivation from "../verify/derivation";
|
|
4
5
|
|
|
5
|
-
import { matcher } from "../matcher";
|
|
6
6
|
import { nodeQuery } from "../utilities/query";
|
|
7
7
|
|
|
8
8
|
const derivationNodeQuery = nodeQuery("/proof/derivation!");
|
|
@@ -10,8 +10,6 @@ const derivationNodeQuery = nodeQuery("/proof/derivation!");
|
|
|
10
10
|
export default function verifyProof(proofNode, conclusion, proofContext) {
|
|
11
11
|
let proofVerified = false;
|
|
12
12
|
|
|
13
|
-
proofContext.begin(proofNode);
|
|
14
|
-
|
|
15
13
|
const derivationNode = derivationNodeQuery(proofNode),
|
|
16
14
|
derivationVerified = verifyDerivation(derivationNode, proofContext);
|
|
17
15
|
|
|
@@ -27,9 +25,5 @@ export default function verifyProof(proofNode, conclusion, proofContext) {
|
|
|
27
25
|
proofVerified = nodeMatches; ///
|
|
28
26
|
}
|
|
29
27
|
|
|
30
|
-
proofVerified ?
|
|
31
|
-
proofContext.complete(proofNode) :
|
|
32
|
-
proofContext.complete(proofNode);
|
|
33
|
-
|
|
34
28
|
return proofVerified;
|
|
35
29
|
}
|
package/src/verify/rule.js
CHANGED
|
@@ -18,13 +18,11 @@ const labelNodesQuery = nodesQuery("/rule/label"),
|
|
|
18
18
|
export default function verifyRule(ruleNode, fileContext) {
|
|
19
19
|
let ruleVerified = false;
|
|
20
20
|
|
|
21
|
-
fileContext.begin(ruleNode);
|
|
22
|
-
|
|
23
21
|
const labelNodes = labelNodesQuery(ruleNode),
|
|
24
22
|
labelsString = fileContext.nodesAsString(labelNodes),
|
|
25
23
|
metaProofContext = MetaproofContext.fromFileContext(fileContext);
|
|
26
24
|
|
|
27
|
-
fileContext.debug(`Verifying the '${labelsString}' rule
|
|
25
|
+
fileContext.debug(`Verifying the '${labelsString}' rule...`, ruleNode);
|
|
28
26
|
|
|
29
27
|
const labels = [],
|
|
30
28
|
labelsVerified = verifyLabels(labelNodes, labels, fileContext);
|
|
@@ -68,12 +66,8 @@ export default function verifyRule(ruleNode, fileContext) {
|
|
|
68
66
|
}
|
|
69
67
|
|
|
70
68
|
if (ruleVerified) {
|
|
71
|
-
fileContext.info(`Verified the '${labelsString}' rule
|
|
69
|
+
fileContext.info(`Verified the '${labelsString}' rule.`, ruleNode);
|
|
72
70
|
}
|
|
73
71
|
|
|
74
|
-
ruleVerified ?
|
|
75
|
-
fileContext.complete(ruleNode) :
|
|
76
|
-
fileContext.complete(ruleNode);
|
|
77
|
-
|
|
78
72
|
return ruleVerified;
|
|
79
73
|
}
|
|
@@ -17,8 +17,6 @@ const childNodesQuery = nodesQuery("/ruleDerivation|ruleSubDerivation/*"),
|
|
|
17
17
|
export default function verifyRuleDerivation(ruleDerivationNode, metaproofContext) {
|
|
18
18
|
let ruleDerivationVerified;
|
|
19
19
|
|
|
20
|
-
metaproofContext.begin(ruleDerivationNode);
|
|
21
|
-
|
|
22
20
|
const childNodes = childNodesQuery(ruleDerivationNode);
|
|
23
21
|
|
|
24
22
|
ruleDerivationVerified = childNodes.every((childNode) => {
|
|
@@ -29,18 +27,12 @@ export default function verifyRuleDerivation(ruleDerivationNode, metaproofContex
|
|
|
29
27
|
}
|
|
30
28
|
});
|
|
31
29
|
|
|
32
|
-
ruleDerivationVerified ?
|
|
33
|
-
metaproofContext.complete(ruleDerivationNode) :
|
|
34
|
-
metaproofContext.halt(ruleDerivationNode);
|
|
35
|
-
|
|
36
30
|
return ruleDerivationVerified;
|
|
37
31
|
}
|
|
38
32
|
|
|
39
33
|
function verifyRuleSubDerivation(ruleSubDerivationNode, metaproofContext) {
|
|
40
34
|
let ruleSubDerivationVerified;
|
|
41
35
|
|
|
42
|
-
metaproofContext.begin(ruleSubDerivationNode);
|
|
43
|
-
|
|
44
36
|
const childNodes = childNodesQuery(ruleSubDerivationNode);
|
|
45
37
|
|
|
46
38
|
ruleSubDerivationVerified = childNodes.every((childNode) => {
|
|
@@ -51,10 +43,6 @@ function verifyRuleSubDerivation(ruleSubDerivationNode, metaproofContext) {
|
|
|
51
43
|
}
|
|
52
44
|
});
|
|
53
45
|
|
|
54
|
-
ruleSubDerivationVerified ?
|
|
55
|
-
metaproofContext.complete(ruleSubDerivationNode) :
|
|
56
|
-
metaproofContext.halt(ruleSubDerivationNode);
|
|
57
|
-
|
|
58
46
|
return ruleSubDerivationVerified;
|
|
59
47
|
}
|
|
60
48
|
|
package/src/verify/ruleProof.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import matcher from "../matcher";
|
|
3
4
|
import verifyRuleDerivation from "../verify/ruleDerivation";
|
|
4
5
|
|
|
5
|
-
import { matcher } from "../matcher";
|
|
6
6
|
import { nodeQuery } from "../utilities/query";
|
|
7
7
|
|
|
8
8
|
const ruleDerivationNodeQuery = nodeQuery("/ruleProof/ruleDerivation!");
|
|
@@ -10,8 +10,6 @@ const ruleDerivationNodeQuery = nodeQuery("/ruleProof/ruleDerivation!");
|
|
|
10
10
|
export default function verifyRuleProof(ruleProofNode, conclusion, metaproofContext) {
|
|
11
11
|
let ruleProofVerified = false;
|
|
12
12
|
|
|
13
|
-
metaproofContext.begin(ruleProofNode);
|
|
14
|
-
|
|
15
13
|
const ruleDerivationNode = ruleDerivationNodeQuery(ruleProofNode),
|
|
16
14
|
ruleDerivationVerified = verifyRuleDerivation(ruleDerivationNode, metaproofContext);
|
|
17
15
|
|
|
@@ -27,9 +25,5 @@ export default function verifyRuleProof(ruleProofNode, conclusion, metaproofCont
|
|
|
27
25
|
ruleProofVerified = nodeMatches; ///
|
|
28
26
|
}
|
|
29
27
|
|
|
30
|
-
ruleProofVerified ?
|
|
31
|
-
metaproofContext.complete(ruleProofNode) :
|
|
32
|
-
metaproofContext.complete(ruleProofNode);
|
|
33
|
-
|
|
34
28
|
return ruleProofVerified;
|
|
35
29
|
}
|
|
@@ -10,14 +10,12 @@ const referenceNodeQuery = nodeQuery("/qualifiedStatement/qualification!/referen
|
|
|
10
10
|
export default function verifyQualifiedStatement(qualifiedStatementNode, assertions, derived, proofContext) {
|
|
11
11
|
let qualifiedStatementVerified = false;
|
|
12
12
|
|
|
13
|
-
proofContext.begin(qualifiedStatementNode);
|
|
14
|
-
|
|
15
13
|
const statementNode = statementNodeQuery(qualifiedStatementNode);
|
|
16
14
|
|
|
17
15
|
if (statementNode !== null) {
|
|
18
16
|
const statementString = proofContext.nodeAsString(statementNode);
|
|
19
17
|
|
|
20
|
-
proofContext.debug(`Verifying the '${statementString}' qualified statement
|
|
18
|
+
proofContext.debug(`Verifying the '${statementString}' qualified statement...`, qualifiedStatementNode);
|
|
21
19
|
|
|
22
20
|
const referenceNode = referenceNodeQuery(qualifiedStatementNode);
|
|
23
21
|
|
|
@@ -81,9 +79,5 @@ export default function verifyQualifiedStatement(qualifiedStatementNode, asserti
|
|
|
81
79
|
}
|
|
82
80
|
}
|
|
83
81
|
|
|
84
|
-
qualifiedStatementVerified ?
|
|
85
|
-
proofContext.complete(qualifiedStatementNode) :
|
|
86
|
-
proofContext.halt(qualifiedStatementNode);
|
|
87
|
-
|
|
88
82
|
return qualifiedStatementVerified;
|
|
89
83
|
}
|
|
@@ -9,14 +9,12 @@ const statementNodeQuery = nodeQuery("/unqualifiedStatement/statement!");
|
|
|
9
9
|
export default function verifyUnqualifiedStatement(unqualifiedStatementNode, assertions, derived, proofContext) {
|
|
10
10
|
let unqualifiedStatementVerified = false;
|
|
11
11
|
|
|
12
|
-
proofContext.begin(unqualifiedStatementNode);
|
|
13
|
-
|
|
14
12
|
const statementNode = statementNodeQuery(unqualifiedStatementNode);
|
|
15
13
|
|
|
16
14
|
if (statementNode !== null) {
|
|
17
15
|
const statementString = proofContext.nodeAsString(statementNode);
|
|
18
16
|
|
|
19
|
-
proofContext.debug(`Verifying the '${statementString}' unqualified statement
|
|
17
|
+
proofContext.debug(`Verifying the '${statementString}' unqualified statement...`, unqualifiedStatementNode);
|
|
20
18
|
|
|
21
19
|
let statementMatches = true;
|
|
22
20
|
|
|
@@ -32,9 +30,5 @@ export default function verifyUnqualifiedStatement(unqualifiedStatementNode, ass
|
|
|
32
30
|
}
|
|
33
31
|
}
|
|
34
32
|
|
|
35
|
-
unqualifiedStatementVerified ?
|
|
36
|
-
proofContext.complete(unqualifiedStatementNode) :
|
|
37
|
-
proofContext.halt(unqualifiedStatementNode);
|
|
38
|
-
|
|
39
33
|
return unqualifiedStatementVerified;
|
|
40
34
|
}
|
package/src/verify/statement.js
CHANGED
|
@@ -14,15 +14,14 @@ import { ARGUMENT_RULE_NAME, META_ARGUMENT_RULE_NAME } from "../ruleNames";
|
|
|
14
14
|
|
|
15
15
|
const termNodeQuery = nodeQuery("/argument/term!"),
|
|
16
16
|
typeNodeQuery = nodeQuery("/argument/type!"),
|
|
17
|
-
metaTypeNodeQuery = nodeQuery("/metaArgument/metaType
|
|
17
|
+
metaTypeNodeQuery = nodeQuery("/metaArgument/metaType!"),
|
|
18
18
|
statementNodeQuery = nodeQuery("/metaArgument/statement!"),
|
|
19
|
-
typeAssertionNodeQuery = nodeQuery("/statement/typeAssertion!")
|
|
19
|
+
typeAssertionNodeQuery = nodeQuery("/statement/typeAssertion!"),
|
|
20
|
+
metaTypeTerminalNodeQuery = nodeQuery("/metaType/@meta-type");
|
|
20
21
|
|
|
21
22
|
export default function verifyStatement(statementNode, assertions, derived, context) {
|
|
22
23
|
let statementVerified = false;
|
|
23
24
|
|
|
24
|
-
context.begin(statementNode);
|
|
25
|
-
|
|
26
25
|
if (!statementVerified) {
|
|
27
26
|
const statementVerifiedAgainstCombinators = verifyStatementAgainstCombinators(statementNode, context);
|
|
28
27
|
|
|
@@ -41,10 +40,6 @@ export default function verifyStatement(statementNode, assertions, derived, cont
|
|
|
41
40
|
statementVerified = statementVerifiedAsEquality; //
|
|
42
41
|
}
|
|
43
42
|
|
|
44
|
-
statementVerified ?
|
|
45
|
-
context.complete(statementNode) :
|
|
46
|
-
context.halt(statementNode);
|
|
47
|
-
|
|
48
43
|
return statementVerified;
|
|
49
44
|
}
|
|
50
45
|
|
|
@@ -69,12 +64,12 @@ function verifyStatementAgainstCombinators(statementNode, context) {
|
|
|
69
64
|
];
|
|
70
65
|
|
|
71
66
|
const combinator = combinators.find((combinator) => {
|
|
72
|
-
|
|
67
|
+
const statementVerifiedAgainstCombinator = verifyStatementAgainstCombinator(statementNode, combinator, context);
|
|
73
68
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
69
|
+
if (statementVerifiedAgainstCombinator) {
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
}) || null;
|
|
78
73
|
|
|
79
74
|
if (combinator !== null) {
|
|
80
75
|
statementVerifiedAgainstCombinators = true;
|
|
@@ -229,7 +224,7 @@ function verifyArgumentNode(argumentNode, combinatorArgumentNode, context) {
|
|
|
229
224
|
if (termNode === null) {
|
|
230
225
|
const argumentString = context.nodeAsString(argumentNode);
|
|
231
226
|
|
|
232
|
-
context.error(`The ${argumentString} argument should be a term, not a type
|
|
227
|
+
context.error(`The ${argumentString} argument should be a term, not a type`, argumentNode);
|
|
233
228
|
} else {
|
|
234
229
|
const types = [],
|
|
235
230
|
termVerified = verifyTerm(termNode, types, context);
|
|
@@ -256,32 +251,27 @@ function verifyArgumentNode(argumentNode, combinatorArgumentNode, context) {
|
|
|
256
251
|
function verifyMetaargumentNode(metaArgumentNode, combinatorMetaargumentNode, context) {
|
|
257
252
|
let metaArgumentNodeVerified = false;
|
|
258
253
|
|
|
259
|
-
const statementNode = statementNodeQuery(metaArgumentNode)
|
|
254
|
+
const statementNode = statementNodeQuery(metaArgumentNode),
|
|
255
|
+
combinatorMetaTYpeNode = metaTypeNodeQuery(combinatorMetaargumentNode);
|
|
260
256
|
|
|
261
257
|
if (statementNode === null) {
|
|
262
258
|
const metaArgumentString = context.nodeAsString(metaArgumentNode);
|
|
263
259
|
|
|
264
|
-
context.error(`
|
|
260
|
+
context.error(`Expected a statement but got a '${metaArgumentString}' meta-type.`, metaArgumentNode);
|
|
265
261
|
} else {
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
statementVerified = verifyStatement(statementNode, assertions, derived, context);
|
|
269
|
-
|
|
270
|
-
if (statementVerified) {
|
|
271
|
-
const combinatorMetaTYpeNode = metaTypeNodeQuery(combinatorMetaargumentNode);
|
|
272
|
-
|
|
273
|
-
if (combinatorMetaTYpeNode !== null) {
|
|
274
|
-
const terminalNode = combinatorMetaTYpeNode, ///
|
|
275
|
-
terminalNodeContent = terminalNode.getContent(),
|
|
276
|
-
terminalNodeContentStatementMetaType = (terminalNodeContent === STATEMENT_META_TYPE);
|
|
262
|
+
if (combinatorMetaTYpeNode === null) {
|
|
263
|
+
const combinatorMetaargumentString = context.nodeAsString(combinatorMetaargumentNode);
|
|
277
264
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
265
|
+
context.error(`Expected a meta-type but got a '${combinatorMetaargumentString}' statement.`, metaArgumentNode);
|
|
266
|
+
} else {
|
|
267
|
+
const combinatorMetaTypeTerminalNode = metaTypeTerminalNodeQuery(combinatorMetaTYpeNode),
|
|
268
|
+
content = combinatorMetaTypeTerminalNode.getContent(),
|
|
269
|
+
contentStatementMetaType = (content === STATEMENT_META_TYPE);
|
|
270
|
+
|
|
271
|
+
if (!contentStatementMetaType) {
|
|
272
|
+
context.error(`Expected the meta-type to be 'Statement' but got '${content}'.`, metaArgumentNode);
|
|
273
|
+
} else {
|
|
274
|
+
metaArgumentNodeVerified = true;
|
|
285
275
|
}
|
|
286
276
|
}
|
|
287
277
|
}
|
|
@@ -10,11 +10,9 @@ import { TYPE_RULE_NAME, TERM_RULE_NAME, STATEMENT_RULE_NAME } from "../ruleName
|
|
|
10
10
|
export default function verifyStatementAsCombinator(statementNode, fileContext) {
|
|
11
11
|
let statementVerifiedAsCombinator = false;
|
|
12
12
|
|
|
13
|
-
fileContext.begin(statementNode);
|
|
14
|
-
|
|
15
13
|
const statementString = fileContext.nodeAsString(statementNode);
|
|
16
14
|
|
|
17
|
-
fileContext.debug(`Verifying the '${statementString}' combinator
|
|
15
|
+
fileContext.debug(`Verifying the '${statementString}' combinator....`, statementNode);
|
|
18
16
|
|
|
19
17
|
const nonTerminalNode = statementNode, ///
|
|
20
18
|
childNodes = nonTerminalNode.getChildNodes(),
|
|
@@ -29,13 +27,9 @@ export default function verifyStatementAsCombinator(statementNode, fileContext)
|
|
|
29
27
|
}
|
|
30
28
|
|
|
31
29
|
if (statementVerifiedAsCombinator) {
|
|
32
|
-
fileContext.info(`Verified the '${statementString}' combinator
|
|
30
|
+
fileContext.info(`Verified the '${statementString}' combinator.`, statementNode);
|
|
33
31
|
}
|
|
34
32
|
|
|
35
|
-
statementVerifiedAsCombinator ?
|
|
36
|
-
fileContext.complete(statementNode) :
|
|
37
|
-
fileContext.halt(statementNode);
|
|
38
|
-
|
|
39
33
|
return statementVerifiedAsCombinator;
|
|
40
34
|
}
|
|
41
35
|
|
|
@@ -131,7 +125,7 @@ function verifyTypeNode(typeNode, fileContext) {
|
|
|
131
125
|
typePresent = fileContext.isTypePresentByTypeName(typeName);
|
|
132
126
|
|
|
133
127
|
if (!typePresent) {
|
|
134
|
-
fileContext.error(`The type '${typeName}'
|
|
128
|
+
fileContext.error(`The type '${typeName}' not present.`, typeNode);
|
|
135
129
|
} else {
|
|
136
130
|
typeNodeVerified = true;
|
|
137
131
|
}
|
|
@@ -12,11 +12,9 @@ const statementNodeQuery = nodeQuery("/unqualifiedStatement/statement!"),
|
|
|
12
12
|
export default function verifySupposition(suppositionNode, suppositions, proofContext) {
|
|
13
13
|
let suppositionVerified;
|
|
14
14
|
|
|
15
|
-
proofContext.begin(suppositionNode);
|
|
16
|
-
|
|
17
15
|
const suppositionString = proofContext.nodeAsString(suppositionNode);
|
|
18
16
|
|
|
19
|
-
proofContext.debug(`Verifying the '${suppositionString}' supposition
|
|
17
|
+
proofContext.debug(`Verifying the '${suppositionString}' supposition...`, suppositionNode);
|
|
20
18
|
|
|
21
19
|
const derived = false,
|
|
22
20
|
assertions = [],
|
|
@@ -39,9 +37,5 @@ export default function verifySupposition(suppositionNode, suppositions, proofCo
|
|
|
39
37
|
suppositionVerified = true;
|
|
40
38
|
}
|
|
41
39
|
|
|
42
|
-
suppositionVerified ?
|
|
43
|
-
proofContext.complete(suppositionNode) :
|
|
44
|
-
proofContext.halt(suppositionNode);
|
|
45
|
-
|
|
46
40
|
return suppositionVerified;
|
|
47
41
|
}
|
package/src/verify/term.js
CHANGED
|
@@ -13,11 +13,9 @@ const termNodeQuery = nodeQuery("/argument/term!"),
|
|
|
13
13
|
export default function verifyTerm(termNode, types, context) {
|
|
14
14
|
let termVerified = false;
|
|
15
15
|
|
|
16
|
-
context.begin(termNode);
|
|
17
|
-
|
|
18
16
|
const termString = context.nodeAsString(termNode);
|
|
19
17
|
|
|
20
|
-
context.
|
|
18
|
+
context.trace(`Verifying the '${termString}' term...`, termNode);
|
|
21
19
|
|
|
22
20
|
if (!termVerified) {
|
|
23
21
|
const variables = [],
|
|
@@ -43,21 +41,15 @@ export default function verifyTerm(termNode, types, context) {
|
|
|
43
41
|
}
|
|
44
42
|
|
|
45
43
|
if (termVerified) {
|
|
46
|
-
context.
|
|
44
|
+
context.debug(`Verified the '${termString}' term.`, termNode);
|
|
47
45
|
}
|
|
48
46
|
|
|
49
|
-
termVerified ?
|
|
50
|
-
context.complete(termNode) :
|
|
51
|
-
context.halt(termNode);
|
|
52
|
-
|
|
53
47
|
return termVerified;
|
|
54
48
|
}
|
|
55
49
|
|
|
56
50
|
export function verifyTermAsVariable(termNode, variables, context) {
|
|
57
51
|
let termVerifiedAsVariable = false;
|
|
58
52
|
|
|
59
|
-
context.begin(termNode);
|
|
60
|
-
|
|
61
53
|
const variableNode = variableNodeQuery(termNode);
|
|
62
54
|
|
|
63
55
|
if (variableNode !== null) {
|
|
@@ -73,18 +65,12 @@ export function verifyTermAsVariable(termNode, variables, context) {
|
|
|
73
65
|
}
|
|
74
66
|
}
|
|
75
67
|
|
|
76
|
-
termVerifiedAsVariable ?
|
|
77
|
-
context.complete(termNode) :
|
|
78
|
-
context.halt(termNode);
|
|
79
|
-
|
|
80
68
|
return termVerifiedAsVariable;
|
|
81
69
|
}
|
|
82
70
|
|
|
83
71
|
export function verifyTermAgainstConstructors(termNode, types, context) {
|
|
84
72
|
let termVerifiedAgainstConstructors = false;
|
|
85
73
|
|
|
86
|
-
context.begin(termNode);
|
|
87
|
-
|
|
88
74
|
const constructors = context.getConstructors(),
|
|
89
75
|
constructor = constructors.find((constructor) => {
|
|
90
76
|
const termVerifiedAgainstConstructor = verifyTermAgainstConstructor(termNode, constructor, context);
|
|
@@ -102,10 +88,6 @@ export function verifyTermAgainstConstructors(termNode, types, context) {
|
|
|
102
88
|
termVerifiedAgainstConstructors = true;
|
|
103
89
|
}
|
|
104
90
|
|
|
105
|
-
termVerifiedAgainstConstructors ?
|
|
106
|
-
context.complete(termNode) :
|
|
107
|
-
context.halt(termNode);
|
|
108
|
-
|
|
109
91
|
return termVerifiedAgainstConstructors;
|
|
110
92
|
}
|
|
111
93
|
|
|
@@ -219,7 +201,7 @@ function verifyArgumentNode(argumentNode, constructorArgumentNode, context) {
|
|
|
219
201
|
if (termNode === null) {
|
|
220
202
|
const argumentString = context.nodeAsString(argumentNode);
|
|
221
203
|
|
|
222
|
-
context.error(`The ${argumentString} argument should be a term, not a type
|
|
204
|
+
context.error(`The ${argumentString} argument should be a term, not a type`, argumentNode);
|
|
223
205
|
} else {
|
|
224
206
|
const types = [],
|
|
225
207
|
termVerified = verifyTerm(termNode, types, context);
|
|
@@ -12,15 +12,11 @@ const typeNodeQuery = nodeQuery("/argument/type");
|
|
|
12
12
|
export default function verifyTermAsConstructor(termNode, typeNode, fileContext) {
|
|
13
13
|
let termVerifiedAsConstructor = false;
|
|
14
14
|
|
|
15
|
-
fileContext.begin(termNode);
|
|
16
|
-
|
|
17
15
|
let type = null;
|
|
18
16
|
|
|
19
17
|
const nonTerminalNode = termNode, ///
|
|
20
18
|
termString = fileContext.nodeAsString(termNode);
|
|
21
19
|
|
|
22
|
-
fileContext.debug(`Verifying the '${termString}' constructor...`);
|
|
23
|
-
|
|
24
20
|
const childNodes = nonTerminalNode.getChildNodes(),
|
|
25
21
|
childNodesVerified = verifyChildNodes(childNodes, fileContext);
|
|
26
22
|
|
|
@@ -35,7 +31,7 @@ export default function verifyTermAsConstructor(termNode, typeNode, fileContext)
|
|
|
35
31
|
if (type !== null) {
|
|
36
32
|
termVerifiedAsConstructor = true;
|
|
37
33
|
} else {
|
|
38
|
-
fileContext.error(`The '${termString}' constructor's '${typeName}' type is
|
|
34
|
+
fileContext.error(`The '${termString}' constructor's '${typeName}' type is not present.`, termNode);
|
|
39
35
|
}
|
|
40
36
|
}
|
|
41
37
|
}
|
|
@@ -47,13 +43,9 @@ export default function verifyTermAsConstructor(termNode, typeNode, fileContext)
|
|
|
47
43
|
}
|
|
48
44
|
|
|
49
45
|
if (termVerifiedAsConstructor) {
|
|
50
|
-
fileContext.info(`Verified the '${termString}' constructor
|
|
46
|
+
fileContext.info(`Verified the '${termString}' constructor.`, termNode);
|
|
51
47
|
}
|
|
52
48
|
|
|
53
|
-
termVerifiedAsConstructor ?
|
|
54
|
-
fileContext.complete(termNode) :
|
|
55
|
-
fileContext.halt(termNode);
|
|
56
|
-
|
|
57
49
|
return termVerifiedAsConstructor;
|
|
58
50
|
}
|
|
59
51
|
|
|
@@ -124,7 +116,7 @@ function verifyNonTerminalNode(nonTerminalNode, fileContext) {
|
|
|
124
116
|
if (type !== null) {
|
|
125
117
|
const termString = fileContext.nodeAsString(termNode);
|
|
126
118
|
|
|
127
|
-
fileContext.error(`The type of the constructor's compound '${termString}' term node is not null
|
|
119
|
+
fileContext.error(`The type of the constructor's compound '${termString}' term node is not null.`, termNode);
|
|
128
120
|
} else {
|
|
129
121
|
nonTerminalNodeVerified = true; ///
|
|
130
122
|
}
|
|
@@ -154,13 +146,13 @@ function verifyArgumentNode(argumentNode, fileContext) {
|
|
|
154
146
|
if (typeNode === null) {
|
|
155
147
|
const argumentString = fileContext.nodeAsString(argumentNode);
|
|
156
148
|
|
|
157
|
-
fileContext.error(`The ${argumentString} argument should be a type
|
|
149
|
+
fileContext.error(`The ${argumentString} argument should be a type.`, argumentNode);
|
|
158
150
|
} else {
|
|
159
151
|
const typeName = typeNameFromTypeNode(typeNode),
|
|
160
152
|
typePresent = fileContext.isTypePresentByTypeName(typeName);
|
|
161
153
|
|
|
162
154
|
if (!typePresent) {
|
|
163
|
-
fileContext.error(`The type '${typeName}' is
|
|
155
|
+
fileContext.error(`The type '${typeName}' is not present.`, argumentNode);
|
|
164
156
|
} else {
|
|
165
157
|
typeNodeVerified = true;
|
|
166
158
|
}
|