occam-verify-cli 0.0.913 → 0.0.915
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/lib/assignment/frameAssertion.js +4 -4
- package/lib/axiomLemmaTheoremConjecture.js +4 -3
- package/lib/conclusion.js +5 -5
- package/lib/context/file.js +3 -3
- package/lib/context/local/intrinsicLevel.js +326 -0
- package/lib/context/local/metaLevel.js +290 -0
- package/lib/metaConsequent.js +4 -4
- package/lib/metaLemmaMetatheorem.js +11 -11
- package/lib/metaSupposition.js +7 -7
- package/lib/metavariable.js +5 -5
- package/lib/premise.js +12 -12
- package/lib/rule.js +12 -12
- package/lib/verifier/node/metaLevel.js +214 -0
- package/lib/verifier/node/statementAsCombinator.js +9 -9
- package/lib/verifier/node/termAsConstructor.js +7 -7
- package/lib/verify/axiom.js +3 -3
- package/lib/verify/conclusion.js +7 -7
- package/lib/verify/conjecture.js +3 -3
- package/lib/verify/containedAssertion.js +23 -4
- package/lib/verify/declaration.js +15 -15
- package/lib/verify/definedAssertion.js +18 -4
- package/lib/verify/derivation.js +3 -3
- package/lib/verify/frame.js +16 -16
- package/lib/verify/frameAssertion.js +33 -33
- package/lib/verify/lemma.js +3 -3
- package/lib/verify/metaConsequent.js +7 -7
- package/lib/verify/metaDerivation.js +3 -3
- package/lib/verify/metaLemma.js +6 -6
- package/lib/verify/metaSubDerivation.js +3 -3
- package/lib/verify/metaSubproof.js +7 -6
- package/lib/verify/metaSupposition.js +9 -9
- package/lib/verify/metaSuppositions.js +3 -3
- package/lib/verify/metaproof.js +7 -6
- package/lib/verify/metaproofStep.js +23 -23
- package/lib/verify/metastatement/qualified.js +22 -22
- package/lib/verify/metastatement/unqualified.js +7 -7
- package/lib/verify/metastatement.js +26 -26
- package/lib/verify/metatheorem.js +6 -6
- package/lib/verify/metavariable.js +6 -6
- package/lib/verify/premise.js +9 -9
- package/lib/verify/premises.js +3 -3
- package/lib/verify/proof.js +4 -3
- package/lib/verify/rule.js +6 -6
- package/lib/verify/ruleDerivation.js +3 -3
- package/lib/verify/ruleProof.js +7 -6
- package/lib/verify/ruleProofStep.js +26 -25
- package/lib/verify/ruleSubDerivation.js +3 -3
- package/lib/verify/ruleSubproof.js +7 -6
- package/lib/verify/statement.js +4 -17
- package/lib/verify/subDerivation.js +3 -3
- package/lib/verify/subproof.js +4 -3
- package/lib/verify/termAsConstructor.js +3 -3
- package/lib/verify/theorem.js +4 -4
- package/package.json +2 -2
- package/src/assignment/frameAssertion.js +5 -5
- package/src/axiomLemmaTheoremConjecture.js +4 -2
- package/src/conclusion.js +7 -7
- package/src/context/file.js +2 -2
- package/src/context/{local.js → local/intrinsicLevel.js} +25 -20
- package/src/context/{localMeta.js → local/metaLevel.js} +21 -16
- package/src/metaConsequent.js +7 -7
- package/src/metaLemmaMetatheorem.js +11 -11
- package/src/metaSupposition.js +13 -13
- package/src/metavariable.js +6 -7
- package/src/premise.js +26 -26
- package/src/rule.js +12 -12
- package/src/verifier/node/{metastatement.js → metaLevel.js} +19 -21
- package/src/verifier/node/statementAsCombinator.js +8 -8
- package/src/verifier/node/termAsConstructor.js +6 -6
- package/src/verify/axiom.js +4 -3
- package/src/verify/conclusion.js +5 -6
- package/src/verify/conjecture.js +4 -3
- package/src/verify/containedAssertion.js +24 -3
- package/src/verify/declaration.js +15 -15
- package/src/verify/definedAssertion.js +23 -3
- package/src/verify/derivation.js +2 -2
- package/src/verify/frame.js +15 -15
- package/src/verify/frameAssertion.js +33 -33
- package/src/verify/lemma.js +4 -3
- package/src/verify/metaConsequent.js +5 -6
- package/src/verify/metaDerivation.js +2 -2
- package/src/verify/metaLemma.js +8 -7
- package/src/verify/metaSubDerivation.js +2 -2
- package/src/verify/metaSubproof.js +7 -5
- package/src/verify/metaSupposition.js +7 -8
- package/src/verify/metaSuppositions.js +2 -2
- package/src/verify/metaproof.js +7 -5
- package/src/verify/metaproofStep.js +21 -25
- package/src/verify/metastatement/qualified.js +24 -24
- package/src/verify/metastatement/unqualified.js +6 -6
- package/src/verify/metastatement.js +25 -25
- package/src/verify/metatheorem.js +8 -7
- package/src/verify/metavariable.js +5 -5
- package/src/verify/premise.js +7 -8
- package/src/verify/premises.js +2 -2
- package/src/verify/proof.js +4 -2
- package/src/verify/rule.js +8 -7
- package/src/verify/ruleDerivation.js +2 -2
- package/src/verify/ruleProof.js +7 -5
- package/src/verify/ruleProofStep.js +22 -25
- package/src/verify/ruleSubDerivation.js +2 -2
- package/src/verify/ruleSubproof.js +7 -5
- package/src/verify/statement.js +2 -22
- package/src/verify/subDerivation.js +2 -2
- package/src/verify/subproof.js +4 -2
- package/src/verify/termAsConstructor.js +4 -3
- package/src/verify/theorem.js +5 -4
- package/lib/context/local.js +0 -320
- package/lib/context/localMeta.js +0 -284
- package/lib/verifier/node/metastatement.js +0 -214
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import verifyFrameAssertion from "../verify/frameAssertion";
|
|
4
|
-
import
|
|
4
|
+
import metaLevelNodeVerifier from "../verifier/node/metaLevel";
|
|
5
5
|
|
|
6
6
|
import { nodeQuery } from "../utilities/query";
|
|
7
7
|
|
|
8
8
|
const frameAssertionNodeQuery = nodeQuery("/metastatement/frameAssertion!");
|
|
9
9
|
|
|
10
|
-
function verifyMetastatement(metastatementNode, assignments, derived,
|
|
10
|
+
function verifyMetastatement(metastatementNode, assignments, derived, localContext) {
|
|
11
11
|
let metastatementVerified;
|
|
12
12
|
|
|
13
|
-
const metastatementString =
|
|
13
|
+
const metastatementString = localContext.nodeAsString(metastatementNode);
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
localContext.trace(`Verifying the '${metastatementString}' metastatement...`, metastatementNode);
|
|
16
16
|
|
|
17
17
|
const verifyMetaStatementFunctions = [
|
|
18
18
|
verifyMetastatementAsFrameAssertion,
|
|
@@ -20,7 +20,7 @@ function verifyMetastatement(metastatementNode, assignments, derived, localMetaC
|
|
|
20
20
|
];
|
|
21
21
|
|
|
22
22
|
metastatementVerified = verifyMetaStatementFunctions.some((verifyStatementFunction) => {
|
|
23
|
-
const metastatementVerified = verifyStatementFunction(metastatementNode, assignments, derived,
|
|
23
|
+
const metastatementVerified = verifyStatementFunction(metastatementNode, assignments, derived, localContext);
|
|
24
24
|
|
|
25
25
|
if (metastatementVerified) {
|
|
26
26
|
return true;
|
|
@@ -28,49 +28,49 @@ function verifyMetastatement(metastatementNode, assignments, derived, localMetaC
|
|
|
28
28
|
});
|
|
29
29
|
|
|
30
30
|
if (metastatementVerified) {
|
|
31
|
-
|
|
31
|
+
localContext.debug(`...verified the '${metastatementString}' metastatement.`, metastatementNode);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
return metastatementVerified;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
Object.assign(
|
|
37
|
+
Object.assign(metaLevelNodeVerifier, {
|
|
38
38
|
verifyMetastatement
|
|
39
39
|
});
|
|
40
40
|
|
|
41
41
|
export default verifyMetastatement;
|
|
42
42
|
|
|
43
|
-
function verifyMetastatementAsFrameAssertion(metastatementNode, assignments, derived,
|
|
43
|
+
function verifyMetastatementAsFrameAssertion(metastatementNode, assignments, derived, localContext) {
|
|
44
44
|
let metastatementVerifiedAsFrameAssertion = false;
|
|
45
45
|
|
|
46
46
|
const frameAssertionNode = frameAssertionNodeQuery(metastatementNode);
|
|
47
47
|
|
|
48
48
|
if (frameAssertionNode !== null) {
|
|
49
|
-
const metastatementString =
|
|
49
|
+
const metastatementString = localContext.nodeAsString(metastatementNode);
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
localContext.trace(`Verifying the '${metastatementString}' metastatement as a frame assertion...`, metastatementNode);
|
|
52
52
|
|
|
53
|
-
const frameAssertionVerified = verifyFrameAssertion(frameAssertionNode, assignments, derived,
|
|
53
|
+
const frameAssertionVerified = verifyFrameAssertion(frameAssertionNode, assignments, derived, localContext);
|
|
54
54
|
|
|
55
55
|
metastatementVerifiedAsFrameAssertion = frameAssertionVerified; ///
|
|
56
56
|
|
|
57
57
|
if (metastatementVerifiedAsFrameAssertion) {
|
|
58
|
-
|
|
58
|
+
localContext.debug(`...verified the '${metastatementString}' metastatement as a frame assertion.`, metastatementNode);
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
return metastatementVerifiedAsFrameAssertion;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
function verifyMetastatementAsIs(metastatementNode, assignments, derived,
|
|
65
|
+
function verifyMetastatementAsIs(metastatementNode, assignments, derived, localContext) {
|
|
66
66
|
let metastatementVerifiedAsIs;
|
|
67
67
|
|
|
68
68
|
const frameAssertionNode = frameAssertionNodeQuery(metastatementNode);
|
|
69
69
|
|
|
70
70
|
if (frameAssertionNode === null) {
|
|
71
|
-
const metastatementString =
|
|
71
|
+
const metastatementString = localContext.nodeAsString(metastatementNode);
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
localContext.trace(`Verifying the '${metastatementString}' metastatement as is...`, metastatementNode);
|
|
74
74
|
|
|
75
75
|
const verifyMetastatementAsIsFunctions = [
|
|
76
76
|
verifyDerivedMetastatementAsIs,
|
|
@@ -78,7 +78,7 @@ function verifyMetastatementAsIs(metastatementNode, assignments, derived, localM
|
|
|
78
78
|
];
|
|
79
79
|
|
|
80
80
|
metastatementVerifiedAsIs = verifyMetastatementAsIsFunctions.some((verifyMetastatementAsIsFunction) => {
|
|
81
|
-
const metastatementVerifiedAsIs = verifyMetastatementAsIsFunction(metastatementNode, assignments, derived,
|
|
81
|
+
const metastatementVerifiedAsIs = verifyMetastatementAsIsFunction(metastatementNode, assignments, derived, localContext);
|
|
82
82
|
|
|
83
83
|
if (metastatementVerifiedAsIs) {
|
|
84
84
|
return true;
|
|
@@ -86,35 +86,35 @@ function verifyMetastatementAsIs(metastatementNode, assignments, derived, localM
|
|
|
86
86
|
});
|
|
87
87
|
|
|
88
88
|
if (metastatementVerifiedAsIs) {
|
|
89
|
-
|
|
89
|
+
localContext.debug(`...verified the '${metastatementString}' metastatement as is.`, metastatementNode);
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
return metastatementVerifiedAsIs;
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
function verifyDerivedMetastatementAsIs(metastatementNode, assignments, derived,
|
|
96
|
+
function verifyDerivedMetastatementAsIs(metastatementNode, assignments, derived, localContext) {
|
|
97
97
|
let derivedMetastatementVerifiedAsIs = false;
|
|
98
98
|
|
|
99
99
|
if (derived) {
|
|
100
|
-
const metastatementString =
|
|
100
|
+
const metastatementString = localContext.nodeAsString(metastatementNode);
|
|
101
101
|
|
|
102
|
-
|
|
102
|
+
localContext.debug(`Cannot verify the derived '${metastatementString}' metastatement as is.`, metastatementNode);
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
return derivedMetastatementVerifiedAsIs;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
function verifyStatedMetastatementAsIs(metastatementNode, assignments, derived,
|
|
108
|
+
function verifyStatedMetastatementAsIs(metastatementNode, assignments, derived, localContext) {
|
|
109
109
|
let statedMetastatementVerifiedAsIs = false;
|
|
110
110
|
|
|
111
111
|
if (!derived) {
|
|
112
|
-
const metastatementString =
|
|
112
|
+
const metastatementString = localContext.nodeAsString(metastatementNode);
|
|
113
113
|
|
|
114
|
-
|
|
114
|
+
localContext.trace(`Verifying the stated '${metastatementString}' metastatement as is...`, metastatementNode);
|
|
115
115
|
|
|
116
116
|
const nonTerminalNode = metastatementNode, ///
|
|
117
|
-
nonTerminalNodeVerified =
|
|
117
|
+
nonTerminalNodeVerified = metaLevelNodeVerifier.verifyNonTerminalNode(nonTerminalNode, localContext, () => {
|
|
118
118
|
const verifiedAhead = true;
|
|
119
119
|
|
|
120
120
|
return verifiedAhead;
|
|
@@ -123,7 +123,7 @@ function verifyStatedMetastatementAsIs(metastatementNode, assignments, derived,
|
|
|
123
123
|
statedMetastatementVerifiedAsIs = nonTerminalNodeVerified; ///
|
|
124
124
|
|
|
125
125
|
if (statedMetastatementVerifiedAsIs) {
|
|
126
|
-
|
|
126
|
+
localContext.debug(`...verified the stated '${metastatementString}' metastatement as is.`, metastatementNode);
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import Metatheorem from "../metatheorem";
|
|
4
4
|
import verifyLabels from "../verify/labels";
|
|
5
5
|
import verifyMetaproof from "../verify/metaproof";
|
|
6
|
-
import LocalMetaContext from "../context/localMeta";
|
|
7
6
|
import verifyMetaConsequent from "../verify/metaConsequent";
|
|
7
|
+
import MetaLevelLocalContext from "../context/local/metaLevel";
|
|
8
8
|
import verifyMetaSuppositions from "../verify/metaSuppositions";
|
|
9
9
|
|
|
10
10
|
import { first } from "../utilities/array";
|
|
@@ -19,8 +19,7 @@ export default function verifyMetatheorem(metatheoremNode, fileContext) {
|
|
|
19
19
|
let metatheoremVerified = false;
|
|
20
20
|
|
|
21
21
|
const labelNodes = labelNodesQuery(metatheoremNode),
|
|
22
|
-
labelsString = fileContext.nodesAsString(labelNodes)
|
|
23
|
-
localMetaContext = LocalMetaContext.fromFileContext(fileContext);
|
|
22
|
+
labelsString = fileContext.nodesAsString(labelNodes);
|
|
24
23
|
|
|
25
24
|
fileContext.trace(`Verifying the '${labelsString}' metatheorem...`, metatheoremNode);
|
|
26
25
|
|
|
@@ -28,21 +27,23 @@ export default function verifyMetatheorem(metatheoremNode, fileContext) {
|
|
|
28
27
|
labelsVerified = verifyLabels(labelNodes, labels, fileContext);
|
|
29
28
|
|
|
30
29
|
if (labelsVerified) {
|
|
31
|
-
const
|
|
30
|
+
const metaLevelLocalContext = MetaLevelLocalContext.fromFileContext(fileContext),
|
|
31
|
+
localContext = metaLevelLocalContext, ///
|
|
32
|
+
substitutions = [],
|
|
32
33
|
metaSuppositions = [],
|
|
33
34
|
metaSuppositionNodes = metaSuppositionsNodeQuery(metatheoremNode),
|
|
34
|
-
metaSuppositionsVerified = verifyMetaSuppositions(metaSuppositionNodes, metaSuppositions, substitutions,
|
|
35
|
+
metaSuppositionsVerified = verifyMetaSuppositions(metaSuppositionNodes, metaSuppositions, substitutions, localContext);
|
|
35
36
|
|
|
36
37
|
if (metaSuppositionsVerified) {
|
|
37
38
|
const metaConsequents = [],
|
|
38
39
|
metaConsequentNode = metaConsequentNodeQuery(metatheoremNode),
|
|
39
|
-
metaConsequentVerified = verifyMetaConsequent(metaConsequentNode, metaConsequents, substitutions,
|
|
40
|
+
metaConsequentVerified = verifyMetaConsequent(metaConsequentNode, metaConsequents, substitutions, localContext);
|
|
40
41
|
|
|
41
42
|
if (metaConsequentVerified) {
|
|
42
43
|
const metaproofNode = metaproofNodeQuery(metatheoremNode),
|
|
43
44
|
firstMetaConsequent = first(metaConsequents),
|
|
44
45
|
metaConsequent = firstMetaConsequent, ///
|
|
45
|
-
metaproofVerified = verifyMetaproof(metaproofNode, metaConsequent, substitutions,
|
|
46
|
+
metaproofVerified = verifyMetaproof(metaproofNode, metaConsequent, substitutions, localContext);
|
|
46
47
|
|
|
47
48
|
if (metaproofVerified) {
|
|
48
49
|
const metatheorem = Metatheorem.fromLabelsMetaSuppositionsMetaConsequentSubstitutionsAndFileContext(labels, metaSuppositions, metaConsequent, substitutions, fileContext);
|
|
@@ -66,14 +66,14 @@ export default function verifyMetavariable(metavariableNode, metaTypeNode, fileC
|
|
|
66
66
|
return metavariableVerified;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
export function verifyStandaloneMetavariable(metavariableNode,
|
|
69
|
+
export function verifyStandaloneMetavariable(metavariableNode, localContext, verifyAhead) {
|
|
70
70
|
let standaloneMetavariableVerified = false;
|
|
71
71
|
|
|
72
|
-
const metavariableString =
|
|
72
|
+
const metavariableString = localContext.nodeAsString(metavariableNode);
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
localContext.trace(`Verifying the '${metavariableString}' standalone metavariable...`, metavariableNode);
|
|
75
75
|
|
|
76
|
-
const metavariablePresent =
|
|
76
|
+
const metavariablePresent = localContext.isMetavariablePresentByMetavariableNode(metavariableNode, localContext);
|
|
77
77
|
|
|
78
78
|
if (metavariablePresent) {
|
|
79
79
|
const verifiedAhead = verifyAhead();
|
|
@@ -82,7 +82,7 @@ export function verifyStandaloneMetavariable(metavariableNode, localMetaContext,
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
if (standaloneMetavariableVerified) {
|
|
85
|
-
|
|
85
|
+
localContext.debug(`...verified the '${metavariableString}' standalone metavariable.`, metavariableNode);
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
return standaloneMetavariableVerified;
|
package/src/verify/premise.js
CHANGED
|
@@ -13,12 +13,12 @@ const statementNodeQuery = nodeQuery("/unqualifiedStatement/statement!"),
|
|
|
13
13
|
unqualifiedStatementNodeQuery = nodeQuery("/premise/unqualifiedStatement!"),
|
|
14
14
|
unqualifiedMetastatementNodeQuery = nodeQuery("/premise/unqualifiedMetastatement!");
|
|
15
15
|
|
|
16
|
-
export default function verifyPremise(premiseNode, premises,
|
|
16
|
+
export default function verifyPremise(premiseNode, premises, localContext) {
|
|
17
17
|
let premiseVerified;
|
|
18
18
|
|
|
19
|
-
const premiseString =
|
|
19
|
+
const premiseString = localContext.nodeAsString(premiseNode);
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
localContext.trace(`Verifying the '${premiseString}' premise...`, premiseNode);
|
|
22
22
|
|
|
23
23
|
const unqualifiedStatementNode = unqualifiedStatementNodeQuery(premiseNode),
|
|
24
24
|
unqualifiedMetastatementNode = unqualifiedMetastatementNodeQuery(premiseNode);
|
|
@@ -26,7 +26,6 @@ export default function verifyPremise(premiseNode, premises, localMetaContext) {
|
|
|
26
26
|
if (unqualifiedStatementNode !== null) {
|
|
27
27
|
const derived = false,
|
|
28
28
|
assignments = [],
|
|
29
|
-
localContext = localMetaContext, ///
|
|
30
29
|
unqualifiedStatementVerified = verifyUnqualifiedStatement(unqualifiedStatementNode, assignments, derived, localContext);
|
|
31
30
|
|
|
32
31
|
if (unqualifiedStatementVerified) {
|
|
@@ -39,10 +38,10 @@ export default function verifyPremise(premiseNode, premises, localMetaContext) {
|
|
|
39
38
|
if (unqualifiedMetastatementNode !== null) {
|
|
40
39
|
const derived = false,
|
|
41
40
|
assignments = [],
|
|
42
|
-
unqualifiedMetastatementVerified = verifyUnqualifiedMetastatement(unqualifiedMetastatementNode, assignments, derived,
|
|
41
|
+
unqualifiedMetastatementVerified = verifyUnqualifiedMetastatement(unqualifiedMetastatementNode, assignments, derived, localContext);
|
|
43
42
|
|
|
44
43
|
if (unqualifiedMetastatementVerified) {
|
|
45
|
-
const localContext =
|
|
44
|
+
const localContext = localContext, ///
|
|
46
45
|
assignmentAssigned = assignAssignment(assignments, localContext);
|
|
47
46
|
|
|
48
47
|
premiseVerified = assignmentAssigned; ///
|
|
@@ -71,9 +70,9 @@ export default function verifyPremise(premiseNode, premises, localMetaContext) {
|
|
|
71
70
|
|
|
72
71
|
premises.push(premise);
|
|
73
72
|
|
|
74
|
-
|
|
73
|
+
localContext.addMetaproofStep(metaproofStep);
|
|
75
74
|
|
|
76
|
-
|
|
75
|
+
localContext.debug(`...verified the '${premiseString}' premise.`, premiseNode);
|
|
77
76
|
}
|
|
78
77
|
|
|
79
78
|
return premiseVerified;
|
package/src/verify/premises.js
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
import verifyPremise from "../verify/premise";
|
|
4
4
|
|
|
5
|
-
export default function verifyPremises(premiseNodes, premises,
|
|
5
|
+
export default function verifyPremises(premiseNodes, premises, localContext) {
|
|
6
6
|
let premisesVerified;
|
|
7
7
|
|
|
8
8
|
premisesVerified = premiseNodes.every((premiseNode) => {
|
|
9
|
-
const premiseVerified = verifyPremise(premiseNode, premises,
|
|
9
|
+
const premiseVerified = verifyPremise(premiseNode, premises, localContext);
|
|
10
10
|
|
|
11
11
|
if (premiseVerified) {
|
|
12
12
|
return true;
|
package/src/verify/proof.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import LocalContext from "../context/local";
|
|
4
3
|
import verifyDerivation from "../verify/derivation";
|
|
4
|
+
import IntrinsicLevelLocalContext from "../context/local/intrinsicLevel";
|
|
5
5
|
|
|
6
6
|
import { nodeQuery } from "../utilities/query";
|
|
7
7
|
|
|
@@ -10,7 +10,9 @@ const derivationNodeQuery = nodeQuery("/proof/derivation!");
|
|
|
10
10
|
export default function verifyProof(proofNode, conclusion, localContext) {
|
|
11
11
|
let proofVerified = false;
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
const intrinsicLevelLocalContext = IntrinsicLevelLocalContext.fromLocalContext(localContext); ///
|
|
14
|
+
|
|
15
|
+
localContext = intrinsicLevelLocalContext; ///
|
|
14
16
|
|
|
15
17
|
const derivationNode = derivationNodeQuery(proofNode),
|
|
16
18
|
derivationVerified = verifyDerivation(derivationNode, localContext);
|
package/src/verify/rule.js
CHANGED
|
@@ -4,8 +4,8 @@ import Rule from "../rule";
|
|
|
4
4
|
import verifyLabels from "../verify/labels";
|
|
5
5
|
import verifyPremises from "../verify/premises";
|
|
6
6
|
import verifyRuleProof from "../verify/ruleProof";
|
|
7
|
-
import LocalMetaContext from "../context/localMeta";
|
|
8
7
|
import verifyConclusion from "../verify/conclusion";
|
|
8
|
+
import MetaLevelLocalContext from "../context/local/metaLevel";
|
|
9
9
|
|
|
10
10
|
import { first } from "../utilities/array";
|
|
11
11
|
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
@@ -19,8 +19,7 @@ export default function verifyRule(ruleNode, fileContext) {
|
|
|
19
19
|
let ruleVerified = false;
|
|
20
20
|
|
|
21
21
|
const labelNodes = labelNodesQuery(ruleNode),
|
|
22
|
-
labelsString = fileContext.nodesAsString(labelNodes)
|
|
23
|
-
localMetaContext = LocalMetaContext.fromFileContext(fileContext);
|
|
22
|
+
labelsString = fileContext.nodesAsString(labelNodes);
|
|
24
23
|
|
|
25
24
|
fileContext.trace(`Verifying the '${labelsString}' rule...`, ruleNode);
|
|
26
25
|
|
|
@@ -28,14 +27,16 @@ export default function verifyRule(ruleNode, fileContext) {
|
|
|
28
27
|
labelsVerified = verifyLabels(labelNodes, labels, fileContext);
|
|
29
28
|
|
|
30
29
|
if (labelsVerified) {
|
|
31
|
-
const
|
|
30
|
+
const metaLevelLocalContext = MetaLevelLocalContext.fromFileContext(fileContext),
|
|
31
|
+
premises = [],
|
|
32
|
+
localContext = metaLevelLocalContext, ///
|
|
32
33
|
premiseNodes = premisesNodeQuery(ruleNode),
|
|
33
|
-
premisesVerified = verifyPremises(premiseNodes, premises,
|
|
34
|
+
premisesVerified = verifyPremises(premiseNodes, premises, localContext);
|
|
34
35
|
|
|
35
36
|
if (premisesVerified) {
|
|
36
37
|
const conclusions = [],
|
|
37
38
|
conclusionNode = conclusionNodeQuery(ruleNode),
|
|
38
|
-
conclusionVerified = verifyConclusion(conclusionNode, conclusions,
|
|
39
|
+
conclusionVerified = verifyConclusion(conclusionNode, conclusions, localContext);
|
|
39
40
|
|
|
40
41
|
if (conclusionVerified) {
|
|
41
42
|
const ruleProofNode = ruleProofNodeQuery(ruleNode),
|
|
@@ -45,7 +46,7 @@ export default function verifyRule(ruleNode, fileContext) {
|
|
|
45
46
|
let ruleProofVerified = true; ///
|
|
46
47
|
|
|
47
48
|
if (ruleProofNode !== null) {
|
|
48
|
-
ruleProofVerified = verifyRuleProof(ruleProofNode, conclusion,
|
|
49
|
+
ruleProofVerified = verifyRuleProof(ruleProofNode, conclusion, localContext);
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
if (ruleProofVerified) {
|
|
@@ -6,13 +6,13 @@ import { nodesQuery } from "../utilities/query";
|
|
|
6
6
|
|
|
7
7
|
const ruleProofStepNodesQuery = nodesQuery("/ruleDerivation/ruleProofStep|lastRuleProofStep");
|
|
8
8
|
|
|
9
|
-
export default function verifyRuleDerivation(ruleDerivationNode,
|
|
9
|
+
export default function verifyRuleDerivation(ruleDerivationNode, localContext) {
|
|
10
10
|
let ruleDerivationVerified;
|
|
11
11
|
|
|
12
12
|
const ruleProofStepNodes = ruleProofStepNodesQuery(ruleDerivationNode);
|
|
13
13
|
|
|
14
14
|
ruleDerivationVerified = ruleProofStepNodes.every((ruleProofStepNode) => {
|
|
15
|
-
const ruleProofStepVerified = verifyRuleProofStep(ruleProofStepNode,
|
|
15
|
+
const ruleProofStepVerified = verifyRuleProofStep(ruleProofStepNode, localContext);
|
|
16
16
|
|
|
17
17
|
if (ruleProofStepVerified) {
|
|
18
18
|
return true;
|
package/src/verify/ruleProof.js
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import LocalMetaContext from "../context/localMeta";
|
|
4
3
|
import verifyRuleDerivation from "../verify/ruleDerivation";
|
|
4
|
+
import MetaLevelLocalContext from "../context/local/metaLevel";
|
|
5
5
|
|
|
6
6
|
import { nodeQuery } from "../utilities/query";
|
|
7
7
|
|
|
8
8
|
const ruleDerivationNodeQuery = nodeQuery("/ruleProof/ruleDerivation!");
|
|
9
9
|
|
|
10
|
-
export default function verifyRuleProof(ruleProofNode, conclusion,
|
|
10
|
+
export default function verifyRuleProof(ruleProofNode, conclusion, localContext) {
|
|
11
11
|
let ruleProofVerified = false;
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
const metaLevelLocalContext = MetaLevelLocalContext.fromLocalContext(localContext);
|
|
14
|
+
|
|
15
|
+
localContext = metaLevelLocalContext; ///
|
|
14
16
|
|
|
15
17
|
const ruleDerivationNode = ruleDerivationNodeQuery(ruleProofNode),
|
|
16
|
-
ruleDerivationVerified = verifyRuleDerivation(ruleDerivationNode,
|
|
18
|
+
ruleDerivationVerified = verifyRuleDerivation(ruleDerivationNode, localContext);
|
|
17
19
|
|
|
18
20
|
if (ruleDerivationVerified) {
|
|
19
|
-
const lastMetaproofStep =
|
|
21
|
+
const lastMetaproofStep = localContext.getLastMetaproofStep(),
|
|
20
22
|
metaproofStep = lastMetaproofStep, ///
|
|
21
23
|
metastatementNode = metaproofStep.getMetastatementNode(),
|
|
22
24
|
conclusionMetastatementNode = conclusion.getMetastatementNode(),
|
|
@@ -4,6 +4,7 @@ import MetaproofStep from "../step/metaproof";
|
|
|
4
4
|
import verifyRuleSubproof from "../verify/ruleSubproof";
|
|
5
5
|
import verifyRuleSubDerivation from "../verify/ruleSubDerivation";
|
|
6
6
|
import verifyQualifiedStatement from "../verify/statement/qualified";
|
|
7
|
+
import verifyUnqualifiedStatement from "../verify/statement/unqualified";
|
|
7
8
|
import verifyQualifiedMetastatement from "../verify/metastatement/qualified";
|
|
8
9
|
import verifyUnqualifiedMetastatement from "../verify/metastatement/unqualified";
|
|
9
10
|
|
|
@@ -18,7 +19,7 @@ const statementNodeQuery = nodeQuery("/qualifiedStatement|unqualifiedStatement/s
|
|
|
18
19
|
qualifiedMetastatementNodeQuery = nodeQuery("/ruleProofStep|lastRuleProofStep/qualifiedMetastatement!"),
|
|
19
20
|
unqualifiedMetastatementNodeQuery = nodeQuery("/ruleProofStep|lastRuleProofStep/unqualifiedMetastatement!");
|
|
20
21
|
|
|
21
|
-
export default function verifyRuleProofStep(ruleProofStepNode,
|
|
22
|
+
export default function verifyRuleProofStep(ruleProofStepNode, localContext) {
|
|
22
23
|
let ruleProofStepVerified = false;
|
|
23
24
|
|
|
24
25
|
const ruleSubproofNode = ruleSubproofNodeQuery(ruleProofStepNode),
|
|
@@ -32,20 +33,19 @@ export default function verifyRuleProofStep(ruleProofStepNode, localMetaContext)
|
|
|
32
33
|
} else if (ruleSubproofNode !== null) {
|
|
33
34
|
let ruleSubproofVerified;
|
|
34
35
|
|
|
35
|
-
ruleSubproofVerified = verifyRuleSubproof(ruleSubproofNode,
|
|
36
|
+
ruleSubproofVerified = verifyRuleSubproof(ruleSubproofNode, localContext);
|
|
36
37
|
|
|
37
38
|
if (ruleSubproofVerified) {
|
|
38
39
|
const metaproofStep = MetaproofStep.fromRuleSubproofNode(ruleSubproofNode);
|
|
39
40
|
|
|
40
|
-
|
|
41
|
+
localContext.addMetaproofStep(metaproofStep);
|
|
41
42
|
|
|
42
43
|
ruleProofStepVerified = true;
|
|
43
44
|
}
|
|
44
45
|
} else if (qualifiedStatementNode !== null) {
|
|
45
46
|
let qualifiedStatementVerified;
|
|
46
47
|
|
|
47
|
-
const assignments = []
|
|
48
|
-
localContext = localMetaContext; ///
|
|
48
|
+
const assignments = [];
|
|
49
49
|
|
|
50
50
|
qualifiedStatementVerified = verifyQualifiedStatement(qualifiedStatementNode, assignments, localContext);
|
|
51
51
|
|
|
@@ -59,32 +59,31 @@ export default function verifyRuleProofStep(ruleProofStepNode, localMetaContext)
|
|
|
59
59
|
const statementNode = statementNodeQuery(qualifiedStatementNode),
|
|
60
60
|
metaproofStep = MetaproofStep.fromStatementNode(statementNode);
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
localContext.addMetaproofStep(metaproofStep);
|
|
63
63
|
|
|
64
64
|
ruleProofStepVerified = true;
|
|
65
65
|
}
|
|
66
66
|
} else if (unqualifiedStatementNode !== null) {
|
|
67
|
-
let
|
|
67
|
+
let unqualifiedStatementVerified;
|
|
68
68
|
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
substitutions = null;
|
|
69
|
+
const derived = true,
|
|
70
|
+
assignments = [];
|
|
72
71
|
|
|
73
|
-
|
|
72
|
+
unqualifiedStatementVerified = verifyUnqualifiedStatement(unqualifiedStatementNode, assignments, derived, localContext);
|
|
74
73
|
|
|
75
|
-
if (
|
|
74
|
+
if (unqualifiedStatementVerified) {
|
|
76
75
|
const assignmentAssigned = assignAssignment(assignments, localContext);
|
|
77
76
|
|
|
78
|
-
|
|
77
|
+
unqualifiedStatementVerified = assignmentAssigned; ///
|
|
79
78
|
}
|
|
80
79
|
|
|
81
|
-
if (
|
|
82
|
-
const statementNode = statementNodeQuery(
|
|
80
|
+
if (unqualifiedStatementVerified) {
|
|
81
|
+
const statementNode = statementNodeQuery(unqualifiedStatementNode),
|
|
83
82
|
metaproofStep = MetaproofStep.fromStatementNode(statementNode);
|
|
84
83
|
|
|
85
|
-
|
|
84
|
+
localContext.addMetaproofStep(metaproofStep);
|
|
86
85
|
|
|
87
|
-
ruleProofStepVerified =
|
|
86
|
+
ruleProofStepVerified = unqualifiedStatementVerified; ///
|
|
88
87
|
}
|
|
89
88
|
} else if (qualifiedMetastatementNode !== null) {
|
|
90
89
|
let qualifiedMetastatementVerified;
|
|
@@ -92,11 +91,10 @@ export default function verifyRuleProofStep(ruleProofStepNode, localMetaContext)
|
|
|
92
91
|
const assignments = [],
|
|
93
92
|
substitutions = null;
|
|
94
93
|
|
|
95
|
-
qualifiedMetastatementVerified = verifyQualifiedMetastatement(qualifiedMetastatementNode, substitutions, assignments,
|
|
94
|
+
qualifiedMetastatementVerified = verifyQualifiedMetastatement(qualifiedMetastatementNode, substitutions, assignments, localContext);
|
|
96
95
|
|
|
97
96
|
if (qualifiedMetastatementVerified) {
|
|
98
|
-
const
|
|
99
|
-
assignmentAssigned = assignAssignment(assignments, localContext);
|
|
97
|
+
const assignmentAssigned = assignAssignment(assignments, localContext);
|
|
100
98
|
|
|
101
99
|
qualifiedMetastatementVerified = assignmentAssigned; ///
|
|
102
100
|
}
|
|
@@ -105,7 +103,7 @@ export default function verifyRuleProofStep(ruleProofStepNode, localMetaContext)
|
|
|
105
103
|
const metastatementNode = metastatementNodeQuery(qualifiedMetastatementNode),
|
|
106
104
|
metaproofStep = MetaproofStep.fromMetastatementNode(metastatementNode);
|
|
107
105
|
|
|
108
|
-
|
|
106
|
+
localContext.addMetaproofStep(metaproofStep);
|
|
109
107
|
|
|
110
108
|
ruleProofStepVerified = qualifiedMetastatementVerified; ///
|
|
111
109
|
}
|
|
@@ -115,11 +113,10 @@ export default function verifyRuleProofStep(ruleProofStepNode, localMetaContext)
|
|
|
115
113
|
const derived = true,
|
|
116
114
|
assignments = [];
|
|
117
115
|
|
|
118
|
-
unqualifiedMetastatementVerified = verifyUnqualifiedMetastatement(unqualifiedMetastatementNode, assignments, derived,
|
|
116
|
+
unqualifiedMetastatementVerified = verifyUnqualifiedMetastatement(unqualifiedMetastatementNode, assignments, derived, localContext);
|
|
119
117
|
|
|
120
118
|
if (unqualifiedMetastatementVerified) {
|
|
121
|
-
const
|
|
122
|
-
assignmentAssigned = assignAssignment(assignments, localContext);
|
|
119
|
+
const assignmentAssigned = assignAssignment(assignments, localContext);
|
|
123
120
|
|
|
124
121
|
unqualifiedMetastatementVerified = assignmentAssigned; ///
|
|
125
122
|
}
|
|
@@ -128,7 +125,7 @@ export default function verifyRuleProofStep(ruleProofStepNode, localMetaContext)
|
|
|
128
125
|
const metastatementNode = metastatementNodeQuery(unqualifiedMetastatementNode),
|
|
129
126
|
metaproofStep = MetaproofStep.fromMetastatementNode(metastatementNode);
|
|
130
127
|
|
|
131
|
-
|
|
128
|
+
localContext.addMetaproofStep(metaproofStep);
|
|
132
129
|
|
|
133
130
|
ruleProofStepVerified = true;
|
|
134
131
|
}
|
|
@@ -4,14 +4,14 @@ import { nodesQuery } from "../utilities/query";
|
|
|
4
4
|
|
|
5
5
|
const ruleProofStepNodesQuery = nodesQuery("/ruleSubDerivation/ruleProofStep|lastRuleProofStep");
|
|
6
6
|
|
|
7
|
-
export default function verifyRuleSubDerivation(ruleSubDerivationNode,
|
|
7
|
+
export default function verifyRuleSubDerivation(ruleSubDerivationNode, localContext) {
|
|
8
8
|
let ruleSubDerivationVerified;
|
|
9
9
|
|
|
10
10
|
const ruleProofStepNodes = ruleProofStepNodesQuery(ruleSubDerivationNode);
|
|
11
11
|
|
|
12
12
|
ruleSubDerivationVerified = ruleProofStepNodes.every((ruleProofStepNode) => {
|
|
13
13
|
const { verifyRuleProofStep } = verifyRuleSubDerivation,
|
|
14
|
-
ruleProofStepVerified = verifyRuleProofStep(ruleProofStepNode,
|
|
14
|
+
ruleProofStepVerified = verifyRuleProofStep(ruleProofStepNode, localContext);
|
|
15
15
|
|
|
16
16
|
if (ruleProofStepVerified) {
|
|
17
17
|
return true;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import verifyPremises from "../verify/premises";
|
|
4
|
-
import
|
|
4
|
+
import MetaLevelLocalContext from "../context/local/metaLevel";
|
|
5
5
|
import verifyRuleSubDerivation from "../verify/ruleSubDerivation";
|
|
6
6
|
|
|
7
7
|
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
@@ -9,18 +9,20 @@ import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
|
9
9
|
const premiseNodesQuery = nodesQuery("/ruleSubproof/premise"),
|
|
10
10
|
ruleSubDerivationNodeQuery = nodeQuery("/ruleSubproof/ruleSubDerivation");
|
|
11
11
|
|
|
12
|
-
export default function verifyRuleSubproof(ruleSubproofNode,
|
|
12
|
+
export default function verifyRuleSubproof(ruleSubproofNode, localContext) {
|
|
13
13
|
let ruleSubproofVerified = false;
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
const metaLevelLocalContext = MetaLevelLocalContext.fromLocalContext(localContext);
|
|
16
|
+
|
|
17
|
+
localContext = metaLevelLocalContext; ///
|
|
16
18
|
|
|
17
19
|
const premises = [],
|
|
18
20
|
premiseNodes = premiseNodesQuery(ruleSubproofNode),
|
|
19
|
-
premisesVerified = verifyPremises(premiseNodes, premises,
|
|
21
|
+
premisesVerified = verifyPremises(premiseNodes, premises, localContext);
|
|
20
22
|
|
|
21
23
|
if (premisesVerified) {
|
|
22
24
|
const ruleSubDerivationNode = ruleSubDerivationNodeQuery(ruleSubproofNode),
|
|
23
|
-
ruleSubDerivationVerified = verifyRuleSubDerivation(ruleSubDerivationNode,
|
|
25
|
+
ruleSubDerivationVerified = verifyRuleSubDerivation(ruleSubDerivationNode, localContext);
|
|
24
26
|
|
|
25
27
|
if (ruleSubDerivationVerified) {
|
|
26
28
|
ruleSubproofVerified = true;
|
package/src/verify/statement.js
CHANGED
|
@@ -10,7 +10,6 @@ import statementAgainstCombinatorNodesVerifier from "../verifier/nodes/statement
|
|
|
10
10
|
import { nodeQuery } from "../utilities/query";
|
|
11
11
|
|
|
12
12
|
const equalityNodeQuery = nodeQuery("/statement/equality!"),
|
|
13
|
-
statementNodeQuery = nodeQuery("/containedAssertion/statement!"),
|
|
14
13
|
typeAssertionNodeQuery = nodeQuery("/statement/typeAssertion!"),
|
|
15
14
|
definedAssertionNodeQuery = nodeQuery("/statement/definedAssertion!"),
|
|
16
15
|
containedAssertionNodeQuery = nodeQuery("/statement/containedAssertion!");
|
|
@@ -159,28 +158,9 @@ function verifyStatementAsContainedAssertion(statementNode, assignments, derived
|
|
|
159
158
|
|
|
160
159
|
localContext.trace(`Verifying the '${statementString}' statement as a contained assertion...`, containedAssertionNode);
|
|
161
160
|
|
|
162
|
-
const
|
|
161
|
+
const containedAssertionVerified = verifyContainedAssertion(containedAssertionNode, assignments, derived, localContext);
|
|
163
162
|
|
|
164
|
-
|
|
165
|
-
statementNode = statementNodeQuery(containedAssertionNode); ///
|
|
166
|
-
|
|
167
|
-
const verifyStatementFunctions = [
|
|
168
|
-
verifyStatementAsEquality,
|
|
169
|
-
verifyStatementAgainstCombinators
|
|
170
|
-
];
|
|
171
|
-
|
|
172
|
-
const statementVerified = verifyStatementFunctions.some((verifyStatementFunction) => {
|
|
173
|
-
const derived = false,
|
|
174
|
-
assignments = [],
|
|
175
|
-
statementVerified = verifyStatementFunction(statementNode, assignments, derived, localContext);
|
|
176
|
-
|
|
177
|
-
if (statementVerified) {
|
|
178
|
-
return true;
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
statementVerifiedAsContainedAssertion = statementVerified; ///
|
|
183
|
-
}
|
|
163
|
+
statementVerifiedAsContainedAssertion = containedAssertionVerified; ///
|
|
184
164
|
|
|
185
165
|
if (statementVerifiedAsContainedAssertion) {
|
|
186
166
|
localContext.debug(`...verified the '${statementString}' statement as a contained assertion.`, containedAssertionNode);
|
|
@@ -4,14 +4,14 @@ import { nodesQuery } from "../utilities/query";
|
|
|
4
4
|
|
|
5
5
|
const proofStepNodesQuery = nodesQuery("/subDerivation/proofStep|lastProofStep");
|
|
6
6
|
|
|
7
|
-
export default function verifySubDerivation(subDerivationNode,
|
|
7
|
+
export default function verifySubDerivation(subDerivationNode, localContext) {
|
|
8
8
|
let subDerivationVerified;
|
|
9
9
|
|
|
10
10
|
const proofStepNodes = proofStepNodesQuery(subDerivationNode);
|
|
11
11
|
|
|
12
12
|
subDerivationVerified = proofStepNodes.every((proofStepNode) => {
|
|
13
13
|
const { verifyProofStep } = verifySubDerivation,
|
|
14
|
-
proofStepVerified = verifyProofStep(proofStepNode,
|
|
14
|
+
proofStepVerified = verifyProofStep(proofStepNode, localContext);
|
|
15
15
|
|
|
16
16
|
if (proofStepVerified) {
|
|
17
17
|
return true;
|