occam-verify-cli 0.0.892 → 0.0.893
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/axiomLemmaTheoremConjecture.js +3 -3
- package/lib/conclusion.js +4 -3
- package/lib/metaConsequent.js +4 -3
- package/lib/metaLemmaMetatheorem.js +13 -13
- package/lib/metaSupposition.js +6 -5
- package/lib/premise.js +9 -8
- package/lib/rule.js +16 -15
- package/lib/verifier/nodes/metaLevel.js +7 -7
- package/lib/verify/derivation.js +10 -90
- package/lib/verify/metaDerivation.js +7 -87
- package/lib/verify/metaProofStep.js +76 -0
- package/lib/verify/metaSubDerivation.js +25 -0
- package/lib/verify/metaSubproof.js +34 -0
- package/lib/verify/metaproof.js +7 -8
- package/lib/verify/metastatement/qualified.js +53 -34
- package/lib/verify/metastatement/unqualified.js +16 -19
- package/lib/verify/proofStep.js +70 -0
- package/lib/verify/ruleDerivation.js +7 -85
- package/lib/verify/ruleProofStep.js +76 -0
- package/lib/verify/ruleSubDerivation.js +25 -0
- package/lib/verify/ruleSubproof.js +34 -0
- package/lib/verify/statement/qualified.js +47 -89
- package/lib/verify/statement/unqualified.js +16 -19
- package/lib/verify/subDerivation.js +25 -0
- package/lib/verify/subproof.js +34 -0
- package/package.json +4 -4
- package/src/axiomLemmaTheoremConjecture.js +4 -2
- package/src/conclusion.js +6 -4
- package/src/metaConsequent.js +6 -4
- package/src/metaLemmaMetatheorem.js +12 -12
- package/src/metaSupposition.js +11 -8
- package/src/premise.js +15 -14
- package/src/rule.js +16 -14
- package/src/verifier/nodes/metaLevel.js +6 -6
- package/src/verify/derivation.js +10 -138
- package/src/verify/metaDerivation.js +7 -135
- package/src/verify/metaProofStep.js +98 -0
- package/src/verify/metaSubDerivation.js +22 -0
- package/src/verify/metaSubproof.js +32 -0
- package/src/verify/metaproof.js +11 -11
- package/src/verify/metastatement/qualified.js +67 -31
- package/src/verify/metastatement/unqualified.js +16 -19
- package/src/verify/proofStep.js +88 -0
- package/src/verify/ruleDerivation.js +7 -133
- package/src/verify/ruleProofStep.js +99 -0
- package/src/verify/ruleSubDerivation.js +22 -0
- package/src/verify/ruleSubproof.js +32 -0
- package/src/verify/statement/qualified.js +55 -127
- package/src/verify/statement/unqualified.js +16 -19
- package/src/verify/subDerivation.js +22 -0
- package/src/verify/subproof.js +32 -0
package/src/verify/derivation.js
CHANGED
|
@@ -1,151 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import LocalContext from "../context/local";
|
|
5
|
-
import verifySuppositions from "../verify/suppositions";
|
|
6
|
-
import verifyQualifiedStatement from "../verify/statement/qualified";
|
|
7
|
-
import verifyUnqualifiedStatement from "../verify/statement/unqualified";
|
|
3
|
+
import verifyProofStep from "../verify/proofStep";
|
|
8
4
|
|
|
9
|
-
import {
|
|
10
|
-
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
11
|
-
import { SUBPROOF_RULE_NAME, QUALIFIED_STATEMENT_RULE_NAME, UNQUALIFIED_STATEMENT_RULE_NAME } from "../ruleNames";
|
|
5
|
+
import { nodesQuery } from "../utilities/query";
|
|
12
6
|
|
|
13
|
-
const
|
|
14
|
-
statementNodeQuery = nodeQuery("/qualifiedStatement|unqualifiedStatement/statement!"),
|
|
15
|
-
suppositionNodesQuery = nodesQuery("/subproof/supposition"),
|
|
16
|
-
subDerivationNodeQuery = nodeQuery("/subproof/subDerivation");
|
|
7
|
+
const proofStepNodesQuery = nodesQuery("/derivation/proofStep|lastProofStep");
|
|
17
8
|
|
|
18
|
-
export default function verifyDerivation(
|
|
19
|
-
let
|
|
9
|
+
export default function verifyDerivation(ruleDerivationNode, localMetaContext) {
|
|
10
|
+
let ruleDerivationVerified;
|
|
20
11
|
|
|
21
|
-
const
|
|
12
|
+
const proofStepNodes = proofStepNodesQuery(ruleDerivationNode);
|
|
22
13
|
|
|
23
|
-
|
|
24
|
-
const
|
|
14
|
+
ruleDerivationVerified = proofStepNodes.every((proofStepNode) => {
|
|
15
|
+
const proofStepVerified = verifyProofStep(proofStepNode, localMetaContext);
|
|
25
16
|
|
|
26
|
-
if (
|
|
17
|
+
if (proofStepVerified) {
|
|
27
18
|
return true;
|
|
28
19
|
}
|
|
29
20
|
});
|
|
30
21
|
|
|
31
|
-
return
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function verifySubDerivation(subDerivationNode, localContext) {
|
|
35
|
-
let subDerivationVerified;
|
|
36
|
-
|
|
37
|
-
const childNodes = childNodesQuery(subDerivationNode);
|
|
38
|
-
|
|
39
|
-
subDerivationVerified = childNodes.every((childNode) => {
|
|
40
|
-
const childVerified = verifyChild(childNode, localContext);
|
|
41
|
-
|
|
42
|
-
if (childVerified) {
|
|
43
|
-
return true;
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
return subDerivationVerified;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function verifySubproof(subproofNode, localContext) {
|
|
51
|
-
let subproofVerified = false;
|
|
52
|
-
|
|
53
|
-
localContext = LocalContext.fromLocalContext(localContext); ///
|
|
54
|
-
|
|
55
|
-
const suppositions = [],
|
|
56
|
-
suppositionNodes = suppositionNodesQuery(subproofNode),
|
|
57
|
-
suppositionsVerified = verifySuppositions(suppositionNodes, suppositions, localContext);
|
|
58
|
-
|
|
59
|
-
if (suppositionsVerified) {
|
|
60
|
-
const subDerivationNode = subDerivationNodeQuery(subproofNode),
|
|
61
|
-
subDerivationVerified = verifySubDerivation(subDerivationNode, localContext);
|
|
62
|
-
|
|
63
|
-
if (subDerivationVerified) {
|
|
64
|
-
subproofVerified = true;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return subproofVerified;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function verifyChild(childNode, localContext) {
|
|
72
|
-
let childVerified = false;
|
|
73
|
-
|
|
74
|
-
const childNodeRuleName = childNode.getRuleName();
|
|
75
|
-
|
|
76
|
-
switch (childNodeRuleName) {
|
|
77
|
-
case SUBPROOF_RULE_NAME: {
|
|
78
|
-
let subproofVerified;
|
|
79
|
-
|
|
80
|
-
const subproofNode = childNode; ///
|
|
81
|
-
|
|
82
|
-
subproofVerified = verifySubproof(subproofNode, localContext);
|
|
83
|
-
|
|
84
|
-
if (subproofVerified) {
|
|
85
|
-
const proofStep = ProofStep.fromSubproofNode(subproofNode);
|
|
86
|
-
|
|
87
|
-
localContext.addProofStep(proofStep);
|
|
88
|
-
|
|
89
|
-
childVerified = true;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
break;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
case QUALIFIED_STATEMENT_RULE_NAME: {
|
|
96
|
-
let qualifiedStatementVerified;
|
|
97
|
-
|
|
98
|
-
const derived = true,
|
|
99
|
-
assignments = [],
|
|
100
|
-
qualifiedStatementNode = childNode; ///
|
|
101
|
-
|
|
102
|
-
qualifiedStatementVerified = verifyQualifiedStatement(qualifiedStatementNode, assignments, derived, localContext);
|
|
103
|
-
|
|
104
|
-
if (qualifiedStatementVerified) {
|
|
105
|
-
const assignmentAssigned = assignAssignment(assignments, localContext);
|
|
106
|
-
|
|
107
|
-
qualifiedStatementVerified = assignmentAssigned; ///
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
if (qualifiedStatementVerified) {
|
|
111
|
-
const statementNode = statementNodeQuery(qualifiedStatementNode),
|
|
112
|
-
proofStep = ProofStep.fromStatementNode(statementNode);
|
|
113
|
-
|
|
114
|
-
localContext.addProofStep(proofStep);
|
|
115
|
-
|
|
116
|
-
childVerified = true; ///
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
break;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
case UNQUALIFIED_STATEMENT_RULE_NAME: {
|
|
123
|
-
let unqualifiedStatementVerified;
|
|
124
|
-
|
|
125
|
-
const derived = true,
|
|
126
|
-
assignments = [],
|
|
127
|
-
unqualifiedStatementNode = childNode; ///
|
|
128
|
-
|
|
129
|
-
unqualifiedStatementVerified = verifyUnqualifiedStatement(unqualifiedStatementNode, assignments, derived, localContext);
|
|
130
|
-
|
|
131
|
-
if (unqualifiedStatementVerified) {
|
|
132
|
-
const assignmentAssigned = assignAssignment(assignments, localContext);
|
|
133
|
-
|
|
134
|
-
unqualifiedStatementVerified = assignmentAssigned; ///
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
if (unqualifiedStatementVerified) {
|
|
138
|
-
const statementNode = statementNodeQuery(unqualifiedStatementNode),
|
|
139
|
-
proofStep = ProofStep.fromStatementNode(statementNode);
|
|
140
|
-
|
|
141
|
-
localContext.addProofStep(proofStep);
|
|
142
|
-
|
|
143
|
-
childVerified = true;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
break;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
return childVerified;
|
|
22
|
+
return ruleDerivationVerified;
|
|
151
23
|
}
|
|
@@ -1,151 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import LocalMetaContext from "../context/localMeta";
|
|
5
|
-
import verifyMetaSuppositions from "../verify/metaSuppositions";
|
|
6
|
-
import verifyQualifiedMetastatement from "../verify/metastatement/qualified";
|
|
7
|
-
import verifyUnqualifiedMetastatement from "../verify/metastatement/unqualified";
|
|
3
|
+
import verifyMetaProofStep from "../verify/metaProofStep";
|
|
8
4
|
|
|
9
|
-
import {
|
|
10
|
-
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
11
|
-
import { META_SUBPROOF_RULE_NAME, QUALIFIED_METASTATEMENT_RULE_NAME, UNQUALIFIED_METASTATEMENT_RULE_NAME } from "../ruleNames";
|
|
5
|
+
import { nodesQuery } from "../utilities/query";
|
|
12
6
|
|
|
13
|
-
const
|
|
14
|
-
metastatementNodeQuery = nodeQuery("/qualifiedMetastatement|unqualifiedMetastatement/metastatement!"),
|
|
15
|
-
metaSuppositionNodesQuery = nodesQuery("/metaSubproof/metaSupposition"),
|
|
16
|
-
metaSubDerivationNodeQuery = nodeQuery("/metaSubproof/metaSubDerivation");
|
|
7
|
+
const metaProofStepNodesQuery = nodesQuery("/metaDerivation/metaProofStep|lastMetaProofStep");
|
|
17
8
|
|
|
18
9
|
export default function verifyMetaDerivation(metaDerivationNode, substitutions, localMetaContext) {
|
|
19
10
|
let metaDerivationVerified;
|
|
20
11
|
|
|
21
|
-
const
|
|
12
|
+
const metaProofStepNodes = metaProofStepNodesQuery(metaDerivationNode);
|
|
22
13
|
|
|
23
|
-
metaDerivationVerified =
|
|
24
|
-
const
|
|
14
|
+
metaDerivationVerified = metaProofStepNodes.every((metaProofStepNode) => {
|
|
15
|
+
const metaProofStepVerified = verifyMetaProofStep(metaProofStepNode, substitutions, localMetaContext);
|
|
25
16
|
|
|
26
|
-
if (
|
|
17
|
+
if (metaProofStepVerified) {
|
|
27
18
|
return true;
|
|
28
19
|
}
|
|
29
20
|
});
|
|
30
21
|
|
|
31
22
|
return metaDerivationVerified;
|
|
32
23
|
}
|
|
33
|
-
|
|
34
|
-
function verifyMetaSubDerivation(metaSubDerivationNode, substitutions, localMetaContext) {
|
|
35
|
-
let metaSubDerivationVerified;
|
|
36
|
-
|
|
37
|
-
const childNodes = childNodesQuery(metaSubDerivationNode);
|
|
38
|
-
|
|
39
|
-
metaSubDerivationVerified = childNodes.every((childNode) => {
|
|
40
|
-
const childVerified = verifyChild(childNode, substitutions, localMetaContext);
|
|
41
|
-
|
|
42
|
-
if (childVerified) {
|
|
43
|
-
return true;
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
return metaSubDerivationVerified;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function verifyMetaSubproof(metaSubproofNode, substitutions, localMetaContext) {
|
|
51
|
-
let metaSubproofVerified = false;
|
|
52
|
-
|
|
53
|
-
localMetaContext = LocalMetaContext.fromLocalMetaContext(localMetaContext); ///
|
|
54
|
-
|
|
55
|
-
const metaSuppositions = [],
|
|
56
|
-
metaSuppositionNodes = metaSuppositionNodesQuery(metaSubproofNode),
|
|
57
|
-
metaSuppositionsVerified = verifyMetaSuppositions(metaSuppositionNodes, metaSuppositions, substitutions, localMetaContext);
|
|
58
|
-
|
|
59
|
-
if (metaSuppositionsVerified) {
|
|
60
|
-
const metaSubDerivationNode = metaSubDerivationNodeQuery(metaSubproofNode),
|
|
61
|
-
metaSubDerivationVerified = verifyMetaSubDerivation(metaSubDerivationNode, substitutions, localMetaContext);
|
|
62
|
-
|
|
63
|
-
if (metaSubDerivationVerified) {
|
|
64
|
-
metaSubproofVerified = true;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return metaSubproofVerified;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function verifyChild(childNode, substitutions, localMetaContext) {
|
|
72
|
-
let childVerified = false;
|
|
73
|
-
|
|
74
|
-
const childNodeRuleName = childNode.getRuleName();
|
|
75
|
-
|
|
76
|
-
switch (childNodeRuleName) {
|
|
77
|
-
case META_SUBPROOF_RULE_NAME: {
|
|
78
|
-
let metaSubproofVerified;
|
|
79
|
-
|
|
80
|
-
const metaSubproofNode = childNode; ///
|
|
81
|
-
|
|
82
|
-
metaSubproofVerified = verifyMetaSubproof(metaSubproofNode, substitutions, localMetaContext);
|
|
83
|
-
|
|
84
|
-
if (metaSubproofVerified) {
|
|
85
|
-
const metaproofStep = MetaproofStep.fromMetaSubproofNode(metaSubproofNode);
|
|
86
|
-
|
|
87
|
-
localMetaContext.addMetaproofStep(metaproofStep);
|
|
88
|
-
|
|
89
|
-
childVerified = true;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
break;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
case QUALIFIED_METASTATEMENT_RULE_NAME: {
|
|
96
|
-
let qualifiedMetastatementVerified;
|
|
97
|
-
|
|
98
|
-
const derived = true,
|
|
99
|
-
assignments = [],
|
|
100
|
-
qualifiedMetastatementNode = childNode; ///
|
|
101
|
-
|
|
102
|
-
qualifiedMetastatementVerified = verifyQualifiedMetastatement(qualifiedMetastatementNode, substitutions, assignments, derived, localMetaContext);
|
|
103
|
-
|
|
104
|
-
if (qualifiedMetastatementVerified) {
|
|
105
|
-
const assignmentAssigned = assignAssignment(assignments, localMetaContext);
|
|
106
|
-
|
|
107
|
-
qualifiedMetastatementVerified = assignmentAssigned; ///
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
if (qualifiedMetastatementVerified) {
|
|
111
|
-
const metastatementNode = metastatementNodeQuery(qualifiedMetastatementNode),
|
|
112
|
-
metaproofStep = MetaproofStep.fromMetastatementNode(metastatementNode);
|
|
113
|
-
|
|
114
|
-
localMetaContext.addMetaproofStep(metaproofStep);
|
|
115
|
-
|
|
116
|
-
childVerified = true; ///
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
break;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
case UNQUALIFIED_METASTATEMENT_RULE_NAME: {
|
|
123
|
-
let unqualifiedMetastatementVerified;
|
|
124
|
-
|
|
125
|
-
const derived = true,
|
|
126
|
-
assignments = [],
|
|
127
|
-
unqualifiedMetastatementNode = childNode; ///
|
|
128
|
-
|
|
129
|
-
unqualifiedMetastatementVerified = verifyUnqualifiedMetastatement(unqualifiedMetastatementNode, assignments, derived, localMetaContext);
|
|
130
|
-
|
|
131
|
-
if (unqualifiedMetastatementVerified) {
|
|
132
|
-
const assignmentAssigned = assignAssignment(assignments, localMetaContext);
|
|
133
|
-
|
|
134
|
-
unqualifiedMetastatementVerified = assignmentAssigned; ///
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
if (unqualifiedMetastatementVerified) {
|
|
138
|
-
const metastatementNode = metastatementNodeQuery(unqualifiedMetastatementNode),
|
|
139
|
-
metaproofStep = MetaproofStep.fromMetastatementNode(metastatementNode);
|
|
140
|
-
|
|
141
|
-
localMetaContext.addMetaproofStep(metaproofStep);
|
|
142
|
-
|
|
143
|
-
childVerified = true;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
break;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
return childVerified;
|
|
151
|
-
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import MetaproofStep from "../step/metaproof";
|
|
4
|
+
import verifyMetaSubproof from "../verify/metaSubproof";
|
|
5
|
+
import verifyMetaSubDerivation from "../verify/metaSubDerivation";
|
|
6
|
+
import verifyQualifiedStatement from "../verify/statement/qualified";
|
|
7
|
+
import verifyUnqualifiedStatement from "../verify/statement/unqualified";
|
|
8
|
+
import verifyQualifiedMetastatement from "../verify/metastatement/qualified";
|
|
9
|
+
import verifyUnqualifiedMetastatement from "../verify/metastatement/unqualified";
|
|
10
|
+
|
|
11
|
+
import { nodeQuery } from "../utilities/query";
|
|
12
|
+
import { assignAssignment } from "../utilities/assignments";
|
|
13
|
+
|
|
14
|
+
const metaSubproofNodeQuery = nodeQuery("/metaProofStep|lastMetaProofStep/metaSubproof!"),
|
|
15
|
+
metastatementNodeQuery = nodeQuery("/qualifiedMetastatement|unqualifiedMetastatement/metastatement!"),
|
|
16
|
+
qualifiedStatementNodeQuery = nodeQuery("/metaProofStep|lastMetaProofStep/qualifiedStatement!"),
|
|
17
|
+
unqualifiedStatementNodeQuery = nodeQuery("/metaProofStep|lastMetaProofStep/unqualifiedStatement!"),
|
|
18
|
+
qualifiedMetastatementNodeQuery = nodeQuery("/metaProofStep|lastMetaProofStep/qualifiedMetastatement!"),
|
|
19
|
+
unqualifiedMetastatementNodeQuery = nodeQuery("/metaProofStep|lastMetaProofStep/unqualifiedMetastatement!");
|
|
20
|
+
|
|
21
|
+
export default function verifyMetaProofStep(metaProofStepNode, substitutions, localMetaContext) {
|
|
22
|
+
let metaProofStepVerified = false;
|
|
23
|
+
|
|
24
|
+
const metaSubproofNode = metaSubproofNodeQuery(metaProofStepNode),
|
|
25
|
+
qualifiedStatementNode = qualifiedStatementNodeQuery(metaProofStepNode),
|
|
26
|
+
unqualifiedStatementNode = unqualifiedStatementNodeQuery(metaProofStepNode),
|
|
27
|
+
qualifiedMetastatementNode = qualifiedMetastatementNodeQuery(metaProofStepNode),
|
|
28
|
+
unqualifiedMetastatementNode = unqualifiedMetastatementNodeQuery(metaProofStepNode);
|
|
29
|
+
|
|
30
|
+
if (false) {
|
|
31
|
+
///
|
|
32
|
+
} else if (metaSubproofNode !== null) {
|
|
33
|
+
let metaSubproofVerified;
|
|
34
|
+
|
|
35
|
+
metaSubproofVerified = verifyMetaSubproof(metaSubproofNode, localMetaContext);
|
|
36
|
+
|
|
37
|
+
if (metaSubproofVerified) {
|
|
38
|
+
const metaproofStep = MetaproofStep.fromMetaSubproofNode(metaSubproofNode);
|
|
39
|
+
|
|
40
|
+
localMetaContext.addMetaproofStep(metaproofStep);
|
|
41
|
+
|
|
42
|
+
metaProofStepVerified = true;
|
|
43
|
+
}
|
|
44
|
+
} else if (qualifiedStatementNode !== null) {
|
|
45
|
+
debugger
|
|
46
|
+
} else if (unqualifiedStatementNode !== null) {
|
|
47
|
+
debugger
|
|
48
|
+
} else if (qualifiedMetastatementNode !== null) {
|
|
49
|
+
let qualifiedMetastatementVerified;
|
|
50
|
+
|
|
51
|
+
const assignments = [];
|
|
52
|
+
|
|
53
|
+
qualifiedMetastatementVerified = verifyQualifiedMetastatement(qualifiedMetastatementNode, substitutions, assignments, localMetaContext);
|
|
54
|
+
|
|
55
|
+
if (qualifiedMetastatementVerified) {
|
|
56
|
+
const assignmentAssigned = assignAssignment(assignments, localMetaContext);
|
|
57
|
+
|
|
58
|
+
qualifiedMetastatementVerified = assignmentAssigned; ///
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (qualifiedMetastatementVerified) {
|
|
62
|
+
const metastatementNode = metastatementNodeQuery(qualifiedMetastatementNode),
|
|
63
|
+
metaproofStep = MetaproofStep.fromMetastatementNode(metastatementNode);
|
|
64
|
+
|
|
65
|
+
localMetaContext.addMetaproofStep(metaproofStep);
|
|
66
|
+
|
|
67
|
+
metaProofStepVerified = qualifiedMetastatementVerified; ///
|
|
68
|
+
}
|
|
69
|
+
} else if (unqualifiedMetastatementNode !== null) {
|
|
70
|
+
let unqualifiedMetastatementVerified;
|
|
71
|
+
|
|
72
|
+
const derived = true,
|
|
73
|
+
assignments = [];
|
|
74
|
+
|
|
75
|
+
unqualifiedMetastatementVerified = verifyUnqualifiedMetastatement(unqualifiedMetastatementNode, assignments, derived, localMetaContext);
|
|
76
|
+
|
|
77
|
+
if (unqualifiedMetastatementVerified) {
|
|
78
|
+
const assignmentAssigned = assignAssignment(assignments, localMetaContext);
|
|
79
|
+
|
|
80
|
+
unqualifiedMetastatementVerified = assignmentAssigned; ///
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (unqualifiedMetastatementVerified) {
|
|
84
|
+
const metastatementNode = metastatementNodeQuery(unqualifiedMetastatementNode),
|
|
85
|
+
metaproofStep = MetaproofStep.fromMetastatementNode(metastatementNode);
|
|
86
|
+
|
|
87
|
+
localMetaContext.addMetaproofStep(metaproofStep);
|
|
88
|
+
|
|
89
|
+
metaProofStepVerified = true;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return metaProofStepVerified;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
Object.assign(verifyMetaSubDerivation, {
|
|
97
|
+
verifyMetaProofStep
|
|
98
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { nodesQuery } from "../utilities/query";
|
|
4
|
+
|
|
5
|
+
const metaProofStepNodesQuery = nodesQuery("/metaSubDerivation/metaProofStep|lastMetaProofStep");
|
|
6
|
+
|
|
7
|
+
export default function verifyMetaSubDerivation(metaSubDerivationNode, localMetaContext) {
|
|
8
|
+
let metaSubDerivationVerified;
|
|
9
|
+
|
|
10
|
+
const metaProofStepNodes = metaProofStepNodesQuery(metaSubDerivationNode);
|
|
11
|
+
|
|
12
|
+
metaSubDerivationVerified = metaProofStepNodes.every((metaProofStepNode) => {
|
|
13
|
+
const { verifyMetaProofStep } = verifyMetaSubDerivation,
|
|
14
|
+
metaProofStepVerified = verifyMetaProofStep(metaProofStepNode, localMetaContext);
|
|
15
|
+
|
|
16
|
+
if (metaProofStepVerified) {
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
return metaSubDerivationVerified;
|
|
22
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import LocalMetaContext from "../context/localMeta";
|
|
4
|
+
import verifyMetaSuppositions from "../verify/metaSuppositions";
|
|
5
|
+
import verifyMetaSubDerivation from "../verify/metaSubDerivation";
|
|
6
|
+
|
|
7
|
+
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
8
|
+
|
|
9
|
+
const suppositionNodesQuery = nodesQuery("/metaSubproof/supposition"),
|
|
10
|
+
metaSubDerivationNodeQuery = nodeQuery("/metaSubproof/metaSubDerivation");
|
|
11
|
+
|
|
12
|
+
export default function verifyMetaSubproof(metaSubproofNode, localMetaContext) {
|
|
13
|
+
let metaSubproofVerified = false;
|
|
14
|
+
|
|
15
|
+
localMetaContext = LocalMetaContext.fromLocalMetaContext(localMetaContext); ///
|
|
16
|
+
|
|
17
|
+
const metaSuppositions = [],
|
|
18
|
+
suppositionNodes = suppositionNodesQuery(metaSubproofNode),
|
|
19
|
+
metaSuppositionsVerified = verifyMetaSuppositions(suppositionNodes, metaSuppositions, localMetaContext);
|
|
20
|
+
|
|
21
|
+
if (metaSuppositionsVerified) {
|
|
22
|
+
const metaSubDerivationNode = metaSubDerivationNodeQuery(metaSubproofNode),
|
|
23
|
+
metaSubDerivationVerified = verifyMetaSubDerivation(metaSubDerivationNode, localMetaContext);
|
|
24
|
+
|
|
25
|
+
if (metaSubDerivationVerified) {
|
|
26
|
+
metaSubproofVerified = true;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return metaSubproofVerified;
|
|
31
|
+
}
|
|
32
|
+
|
package/src/verify/metaproof.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import LocalMetaContext from "../context/localMeta";
|
|
3
4
|
import verifyMetaDerivation from "../verify/metaDerivation";
|
|
4
5
|
|
|
5
6
|
import { nodeQuery } from "../utilities/query";
|
|
6
7
|
|
|
7
8
|
const metaDerivationNodeQuery = nodeQuery("/metaproof/metaDerivation!");
|
|
8
9
|
|
|
9
|
-
export default function verifyMetaproof(metaproofNode, conclusion, substitutions,
|
|
10
|
+
export default function verifyMetaproof(metaproofNode, conclusion, substitutions, localMetaContext) {
|
|
10
11
|
let metaproofVerified = false;
|
|
11
12
|
|
|
13
|
+
localMetaContext = LocalMetaContext.fromLocalMetaContext(localMetaContext); ///
|
|
14
|
+
|
|
12
15
|
const metaDerivationNode = metaDerivationNodeQuery(metaproofNode),
|
|
13
|
-
metaDerivationVerified = verifyMetaDerivation(metaDerivationNode, substitutions,
|
|
16
|
+
metaDerivationVerified = verifyMetaDerivation(metaDerivationNode, substitutions, localMetaContext);
|
|
14
17
|
|
|
15
18
|
if (metaDerivationVerified) {
|
|
16
|
-
const lastMetaproofStep =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
conclusionMetastatementNode = conclusion.getMetastatementNode(),
|
|
22
|
-
metastatementNodeMatchesConclusionMetastatementNode = metastatementNode.match(conclusionMetastatementNode);
|
|
19
|
+
const lastMetaproofStep = localMetaContext.getLastMetaproofStep(),
|
|
20
|
+
metaproofStep = lastMetaproofStep, ///
|
|
21
|
+
metastatementNode = metaproofStep.getMetastatementNode(),
|
|
22
|
+
conclusionMetastatementNode = conclusion.getMetastatementNode(),
|
|
23
|
+
metastatementNodeMatchesConclusionMetastatementNode = metastatementNode.match(conclusionMetastatementNode);
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
}
|
|
25
|
+
metaproofVerified = metastatementNodeMatchesConclusionMetastatementNode; ///
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
return metaproofVerified;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import verifyMetastatement from "
|
|
3
|
+
import verifyMetastatement from "../../verify/metastatement";
|
|
4
4
|
import verifyMetavariableAgainstMetastatement from "../../verify/metavariableAgainstMetastatement";
|
|
5
5
|
|
|
6
6
|
import { nodeQuery } from "../../utilities/query";
|
|
@@ -8,57 +8,93 @@ import { nodeQuery } from "../../utilities/query";
|
|
|
8
8
|
const metavariableNodeQuery = nodeQuery("/qualifiedMetastatement/reference!/metavariable!"),
|
|
9
9
|
metastatementNodeQuery = nodeQuery("/qualifiedMetastatement/metastatement!");
|
|
10
10
|
|
|
11
|
-
export default function verifyQualifiedMetastatement(qualifiedMetastatementNode, substitutions, assignments,
|
|
12
|
-
let qualifiedMetastatementVerified
|
|
11
|
+
export default function verifyQualifiedMetastatement(qualifiedMetastatementNode, substitutions, assignments, localMetaContext) {
|
|
12
|
+
let qualifiedMetastatementVerified;
|
|
13
13
|
|
|
14
|
-
const
|
|
14
|
+
const qualifiedMetastatementString = localMetaContext.nodeAsString(qualifiedMetastatementNode);
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
const metastatementString = localMetaContext.nodeAsString(metastatementNode),
|
|
18
|
-
metastatementLocalMetaContext = localMetaContext; ///
|
|
16
|
+
localMetaContext.trace(`Verifying the '${qualifiedMetastatementString}' qualified metastatement...`, qualifiedMetastatementNode);
|
|
19
17
|
|
|
20
|
-
|
|
18
|
+
const derived = false,
|
|
19
|
+
metastatementNode = metastatementNodeQuery(qualifiedMetastatementNode),
|
|
20
|
+
metastatementVerified = verifyMetastatement(metastatementNode, assignments, derived, localMetaContext, () => {
|
|
21
|
+
const verifiedAhead = true;
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
return verifiedAhead;
|
|
24
|
+
});
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
if (metastatementVerified) {
|
|
27
|
+
const metavariableNode = metavariableNodeQuery(qualifiedMetastatementNode),
|
|
28
|
+
verifyQualifiedMetastatementFunctions = [
|
|
29
|
+
verifyQualifiedMetastatementAAgainstRule,
|
|
30
|
+
verifyQualifiedMetastatementAAgainstReference
|
|
31
|
+
];
|
|
26
32
|
|
|
27
|
-
|
|
28
|
-
|
|
33
|
+
qualifiedMetastatementVerified = verifyQualifiedMetastatementFunctions.some((verifyQualifiedMetastatementFunction) => { ///
|
|
34
|
+
const qualifiedMetastatementVerified = verifyQualifiedMetastatementFunction(qualifiedMetastatementNode, metavariableNode, substitutions, localMetaContext);
|
|
29
35
|
|
|
30
|
-
|
|
36
|
+
if (qualifiedMetastatementVerified) {
|
|
37
|
+
return true;
|
|
31
38
|
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (qualifiedMetastatementVerified) {
|
|
43
|
+
localMetaContext.debug(`...verified the '${qualifiedMetastatementString}' qualified metastatement.`, qualifiedMetastatementNode);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return qualifiedMetastatementVerified;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function verifyQualifiedMetastatementAAgainstRule(qualifiedMetastatementNode, metavariableNode, substitutions, localMetaContext) {
|
|
50
|
+
let qualifiedMetastatementVerifiedAgainstRule = false;
|
|
51
|
+
|
|
52
|
+
const rule = localMetaContext.findRuleByMetavariableNode(metavariableNode);
|
|
53
|
+
|
|
54
|
+
if (rule !== null) {
|
|
55
|
+
const metastatementNode = metastatementNodeQuery(qualifiedMetastatementNode),
|
|
56
|
+
metavariableString = localMetaContext.nodeAsString(metavariableNode),
|
|
57
|
+
qualifiedMetastatementString = localMetaContext.nodeAsString(qualifiedMetastatementNode);
|
|
58
|
+
|
|
59
|
+
localMetaContext.trace(`Verifying the '${qualifiedMetastatementString}' qualified metastatement against the '${metavariableString}' rule...`, qualifiedMetastatementNode);
|
|
60
|
+
|
|
61
|
+
const ruleMatchesMetastatement = rule.matchMetastatement(metastatementNode, localMetaContext);
|
|
62
|
+
|
|
63
|
+
qualifiedMetastatementVerifiedAgainstRule = ruleMatchesMetastatement; ///
|
|
64
|
+
|
|
65
|
+
if (qualifiedMetastatementVerifiedAgainstRule) {
|
|
66
|
+
localMetaContext.debug(`...verified the '${qualifiedMetastatementString}' qualified metastatement against the '${metavariableString}' rule.`, qualifiedMetastatementNode);
|
|
32
67
|
}
|
|
68
|
+
}
|
|
33
69
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
70
|
+
return qualifiedMetastatementVerifiedAgainstRule;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function verifyQualifiedMetastatementAAgainstReference(qualifiedMetastatementNode, metavariableNode, substitutions, localMetaContext) {
|
|
74
|
+
let qualifiedMetastatementVerifiedAgainstReference = false;
|
|
37
75
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
76
|
+
if (substitutions !== null) {
|
|
77
|
+
const metavariableString = localMetaContext.nodeAsString(metavariableNode),
|
|
78
|
+
metavariablePresent = localMetaContext.isMetavariablePresentByMetavariableNode(metavariableNode, localMetaContext),
|
|
79
|
+
qualifiedMetastatementString = localMetaContext.nodeAsString(qualifiedMetastatementNode);
|
|
41
80
|
|
|
42
|
-
|
|
43
|
-
});
|
|
81
|
+
localMetaContext.trace(`Verifying the '${qualifiedMetastatementString}' qualified metastatement against the '${metavariableString}' reference...`, qualifiedMetastatementNode);
|
|
44
82
|
|
|
45
|
-
|
|
46
|
-
|
|
83
|
+
if (metavariablePresent) {
|
|
84
|
+
const metastatementNode = metastatementNodeQuery(qualifiedMetastatementNode),
|
|
85
|
+
metavariableVerifiedAgainstMetastatement = verifyMetavariableAgainstMetastatement(metavariableNode, metastatementNode, substitutions, () => {
|
|
47
86
|
const verifiedAhead = true;
|
|
48
87
|
|
|
49
88
|
return verifiedAhead;
|
|
50
89
|
});
|
|
51
90
|
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
91
|
+
qualifiedMetastatementVerifiedAgainstReference = metavariableVerifiedAgainstMetastatement; ///
|
|
56
92
|
}
|
|
57
93
|
|
|
58
|
-
if (
|
|
59
|
-
localMetaContext.debug(`...verified the '${
|
|
94
|
+
if (qualifiedMetastatementVerifiedAgainstReference) {
|
|
95
|
+
localMetaContext.debug(`...verified the '${qualifiedMetastatementString}' qualified metastatement against the '${metavariableString}' reference.`, qualifiedMetastatementNode);
|
|
60
96
|
}
|
|
61
97
|
}
|
|
62
98
|
|
|
63
|
-
return
|
|
99
|
+
return qualifiedMetastatementVerifiedAgainstReference;
|
|
64
100
|
}
|