occam-verify-cli 0.0.921 → 0.0.923
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 -4
- package/lib/conclusion.js +13 -43
- package/lib/constants.js +1 -5
- package/lib/context/local.js +386 -0
- package/lib/declaration.js +15 -15
- package/lib/metaLemmaMetatheorem.js +59 -59
- package/lib/mixins/context.js +17 -13
- package/lib/mixins/nodesVerifier/metaLevel.js +6 -6
- package/lib/premise.js +16 -94
- package/lib/{step/proof.js → proofStep.js} +1 -1
- package/lib/rule.js +1 -45
- package/lib/ruleNames.js +1 -9
- package/lib/substitution/statementForMetavariable.js +9 -1
- package/lib/substitution.js +1 -8
- package/lib/supposition.js +55 -1
- package/lib/utilities/customGrammar.js +2 -2
- package/lib/utilities/match.js +13 -50
- package/lib/utilities/node.js +2 -27
- package/lib/utilities/tokens.js +1 -8
- package/lib/utilities/verify.js +8 -24
- package/lib/verifier/nodes/intrinsicLevelAgainstMetaLevel.js +29 -29
- package/lib/verifier/nodes/metaLevel.js +13 -13
- package/lib/verify/axiom.js +3 -3
- package/lib/verify/conclusion.js +10 -11
- package/lib/verify/conjecture.js +3 -3
- package/lib/verify/declaration.js +6 -6
- package/lib/verify/lemma.js +3 -3
- package/lib/verify/metaLemma.js +13 -13
- package/lib/verify/metastatement.js +64 -64
- package/lib/verify/metatheorem.js +13 -13
- package/lib/verify/premise.js +11 -30
- package/lib/verify/proof.js +3 -4
- package/lib/verify/proofStep.js +5 -5
- package/lib/verify/rule.js +11 -11
- package/lib/verify/statement/qualified.js +35 -9
- package/lib/verify/statement/unqualified.js +1 -1
- package/lib/verify/subproof.js +3 -4
- package/lib/verify/supposition.js +3 -3
- package/lib/verify/termAsConstructor.js +3 -3
- package/lib/verify/theorem.js +3 -3
- package/package.json +4 -4
- package/src/axiomLemmaTheoremConjecture.js +2 -4
- package/src/conclusion.js +15 -54
- package/src/constants.js +0 -1
- package/src/context/{local/intrinsicLevel.js → local.js} +182 -97
- package/src/declaration.js +19 -19
- package/src/metaLemmaMetatheorem.js +58 -58
- package/src/mixins/context.js +12 -9
- package/src/mixins/nodesVerifier/metaLevel.js +8 -8
- package/src/premise.js +25 -143
- package/src/rule.js +0 -67
- package/src/ruleNames.js +0 -2
- package/src/substitution/statementForMetavariable.js +14 -0
- package/src/substitution.js +0 -6
- package/src/supposition.js +46 -0
- package/src/utilities/customGrammar.js +1 -2
- package/src/utilities/match.js +13 -60
- package/src/utilities/node.js +3 -32
- package/src/utilities/tokens.js +0 -8
- package/src/utilities/verify.js +4 -20
- package/src/verifier/nodes/intrinsicLevelAgainstMetaLevel.js +36 -37
- package/src/verifier/nodes/metaLevel.js +17 -17
- package/src/verify/axiom.js +3 -4
- package/src/verify/conclusion.js +9 -13
- package/src/verify/conjecture.js +3 -4
- package/src/verify/declaration.js +7 -7
- package/src/verify/lemma.js +3 -4
- package/src/verify/metaLemma.js +24 -25
- package/src/verify/metastatement.js +64 -64
- package/src/verify/metatheorem.js +23 -24
- package/src/verify/premise.js +14 -46
- package/src/verify/proof.js +2 -4
- package/src/verify/proofStep.js +1 -1
- package/src/verify/rule.js +11 -12
- package/src/verify/statement/qualified.js +43 -9
- package/src/verify/statement/unqualified.js +1 -1
- package/src/verify/subproof.js +2 -4
- package/src/verify/supposition.js +1 -1
- package/src/verify/termAsConstructor.js +3 -4
- package/src/verify/theorem.js +3 -4
- package/lib/context/local/intrinsicLevel.js +0 -326
- package/lib/context/local/metaLevel.js +0 -282
- package/lib/metaConsequent.js +0 -108
- package/lib/metaSupposition.js +0 -160
- package/lib/node/metastatement/bracketed.js +0 -16
- package/lib/step/metaproof.js +0 -106
- package/lib/substitution/metastatementForMetavariable.js +0 -173
- package/lib/verify/metaConsequent.js +0 -50
- package/lib/verify/metaDerivation.js +0 -31
- package/lib/verify/metaSubDerivation.js +0 -25
- package/lib/verify/metaSubproof.js +0 -35
- package/lib/verify/metaSupposition.js +0 -61
- package/lib/verify/metaSuppositions.js +0 -28
- package/lib/verify/metaproof.js +0 -32
- package/lib/verify/metaproofStep.js +0 -98
- package/lib/verify/metastatement/qualified.js +0 -95
- package/lib/verify/metastatement/unqualified.js +0 -37
- package/lib/verify/metastatementAsContainedAssertion.js +0 -109
- package/lib/verify/metastatementAsDefinedAssertion.js +0 -132
- package/lib/verify/metavariableAgainstMetastatement.js +0 -44
- package/src/context/local/metaLevel.js +0 -191
- package/src/metaConsequent.js +0 -83
- package/src/metaSupposition.js +0 -127
- package/src/node/metastatement/bracketed.js +0 -9
- package/src/step/metaproof.js +0 -73
- package/src/substitution/metastatementForMetavariable.js +0 -90
- package/src/verify/metaConsequent.js +0 -61
- package/src/verify/metaDerivation.js +0 -23
- package/src/verify/metaSubDerivation.js +0 -22
- package/src/verify/metaSubproof.js +0 -34
- package/src/verify/metaSupposition.js +0 -78
- package/src/verify/metaSuppositions.js +0 -17
- package/src/verify/metaproof.js +0 -30
- package/src/verify/metaproofStep.js +0 -137
- package/src/verify/metastatement/qualified.js +0 -130
- package/src/verify/metastatement/unqualified.js +0 -34
- package/src/verify/metastatementAsContainedAssertion.js +0 -127
- package/src/verify/metastatementAsDefinedAssertion.js +0 -156
- package/src/verify/metavariableAgainstMetastatement.js +0 -42
- /package/src/{step/proof.js → proofStep.js} +0 -0
|
@@ -7,8 +7,8 @@ import metaLevelNodeVerifier from "../verifier/node/metaLevel";
|
|
|
7
7
|
import { nodeQuery } from "../utilities/query";
|
|
8
8
|
|
|
9
9
|
const referenceNodeQuery = nodeQuery("/declaration/reference!"),
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
statementNodeQuery = nodeQuery("/declaration/statement!"),
|
|
11
|
+
metavariableNodeQuery = nodeQuery("/reference/metavariable!");
|
|
12
12
|
|
|
13
13
|
export default function verifyDeclaration(declarationNode, declarations, localContext) {
|
|
14
14
|
let declarationVerified = false;
|
|
@@ -21,20 +21,20 @@ export default function verifyDeclaration(declarationNode, declarations, localCo
|
|
|
21
21
|
referenceVerified = verifyReference(referenceNode, localContext);
|
|
22
22
|
|
|
23
23
|
if (referenceVerified) {
|
|
24
|
-
const
|
|
24
|
+
const statementNode = statementNodeQuery(declarationNode);
|
|
25
25
|
|
|
26
|
-
const {
|
|
26
|
+
const { verifyStatement } = metaLevelNodeVerifier,
|
|
27
27
|
derived = false,
|
|
28
28
|
assignments = [],
|
|
29
|
-
|
|
29
|
+
statementVerified = verifyStatement(statementNode, assignments, derived, localContext, () => {
|
|
30
30
|
const verifiedAhead = true;
|
|
31
31
|
|
|
32
32
|
return verifiedAhead;
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
-
if (
|
|
35
|
+
if (statementVerified) {
|
|
36
36
|
const metavariableNode = metavariableNodeQuery(referenceNode),
|
|
37
|
-
declaration = Declaration.
|
|
37
|
+
declaration = Declaration.fromMetavariableNodeAndStatementNode(metavariableNode, statementNode);
|
|
38
38
|
|
|
39
39
|
declarations.push(declaration);
|
|
40
40
|
|
package/src/verify/lemma.js
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
import Lemma from "../lemma";
|
|
4
4
|
import verifyProof from "../verify/proof";
|
|
5
5
|
import verifyLabels from "../verify/labels";
|
|
6
|
+
import LocalContext from "../context/local";
|
|
6
7
|
import verifyConsequent from "../verify/consequent";
|
|
7
8
|
import verifySuppositions from "../verify/suppositions";
|
|
8
|
-
import IntrinsicLevelLocalContext from "../context/local/intrinsicLevel";
|
|
9
9
|
|
|
10
10
|
import { first } from "../utilities/array";
|
|
11
11
|
import { EMPTY_STRING } from "../constants";
|
|
@@ -19,10 +19,9 @@ const proofNodeQuery = nodeQuery("/lemma/proof!"),
|
|
|
19
19
|
export default function verifyLemma(lemmaNode, fileContext) {
|
|
20
20
|
let lemmaVerified = false;
|
|
21
21
|
|
|
22
|
-
const
|
|
23
|
-
labelNodes = labelNodesQuery(lemmaNode),
|
|
22
|
+
const labelNodes = labelNodesQuery(lemmaNode),
|
|
24
23
|
labelsString = fileContext.nodesAsString(labelNodes),
|
|
25
|
-
localContext =
|
|
24
|
+
localContext = LocalContext.fromFileContext(fileContext);
|
|
26
25
|
|
|
27
26
|
(labelsString === EMPTY_STRING) ?
|
|
28
27
|
fileContext.trace(`Verifying a lemma...`, lemmaNode) :
|
package/src/verify/metaLemma.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import MetaLemma from "../metaLemma";
|
|
4
|
+
import verifyProof from "../verify/proof";
|
|
5
|
+
import LocalContext from "../context/local";
|
|
4
6
|
import verifyLabels from "../verify/labels";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import MetaLevelLocalContext from "../context/local/metaLevel";
|
|
8
|
-
import verifyMetaSuppositions from "../verify/metaSuppositions";
|
|
7
|
+
import verifyConsequent from "../verify/consequent";
|
|
8
|
+
import verifySuppositions from "../verify/suppositions";
|
|
9
9
|
|
|
10
10
|
import { first } from "../utilities/array";
|
|
11
11
|
import { EMPTY_STRING } from "../constants";
|
|
12
12
|
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
13
13
|
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
const proofNodeQuery = nodeQuery("/metaLemma/proof!"),
|
|
15
|
+
labelNodesQuery = nodesQuery("/metaLemma/label"),
|
|
16
|
+
consequentNodeQuery = nodeQuery("/metaLemma/consequent!"),
|
|
17
|
+
suppositionsNodeQuery = nodesQuery("/metaLemma/supposition");
|
|
18
18
|
|
|
19
19
|
export default function verifyMetaLemma(metaLemmaNode, fileContext) {
|
|
20
20
|
let metaLemmaVerified = false;
|
|
@@ -30,27 +30,26 @@ export default function verifyMetaLemma(metaLemmaNode, fileContext) {
|
|
|
30
30
|
labelsVerified = verifyLabels(labelNodes, labels, fileContext);
|
|
31
31
|
|
|
32
32
|
if (labelsVerified) {
|
|
33
|
-
const
|
|
34
|
-
localContext = metaLevelLocalContext, ///
|
|
33
|
+
const localContext = LocalContext.fromFileContext(fileContext), ///
|
|
35
34
|
substitutions = [],
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
suppositions = [],
|
|
36
|
+
suppositionNodes = suppositionsNodeQuery(metaLemmaNode),
|
|
37
|
+
suppositionsVerified = verifySuppositions(suppositionNodes, suppositions, substitutions, localContext);
|
|
39
38
|
|
|
40
|
-
if (
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
if (suppositionsVerified) {
|
|
40
|
+
const consequents = [],
|
|
41
|
+
consequentNode = consequentNodeQuery(metaLemmaNode),
|
|
42
|
+
consequentVerified = verifyConsequent(consequentNode, consequents, substitutions, localContext);
|
|
44
43
|
|
|
45
|
-
if (
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
44
|
+
if (consequentVerified) {
|
|
45
|
+
const proofNode = proofNodeQuery(metaLemmaNode),
|
|
46
|
+
firstConsequent = first(consequents),
|
|
47
|
+
consequent = firstConsequent, ///
|
|
48
|
+
statementNode = consequent.getStatementNode(),
|
|
49
|
+
proofVerified = verifyProof(proofNode, statementNode, substitutions, localContext);
|
|
51
50
|
|
|
52
|
-
if (
|
|
53
|
-
const metaLemma = MetaLemma.
|
|
51
|
+
if (proofVerified) {
|
|
52
|
+
const metaLemma = MetaLemma.fromLabelsSuppositionsConsequentSubstitutionsAndFileContext(labels, suppositions, consequent, substitutions, fileContext);
|
|
54
53
|
|
|
55
54
|
fileContext.addMetaLemma(metaLemma);
|
|
56
55
|
|
|
@@ -2,142 +2,142 @@
|
|
|
2
2
|
|
|
3
3
|
import verifyJudgement from "../verify/judgement";
|
|
4
4
|
import metaLevelNodeVerifier from "../verifier/node/metaLevel";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
5
|
+
import verifyStatementAsDefinedAssertion from "./statementAsDefinedAssertion";
|
|
6
|
+
import verifyStatementAsContainedAssertion from "./statementAsContainedAssertion";
|
|
7
7
|
|
|
8
8
|
import { nodeQuery } from "../utilities/query";
|
|
9
9
|
|
|
10
|
-
const judgementNodeQuery = nodeQuery("/
|
|
10
|
+
const judgementNodeQuery = nodeQuery("/statement/judgement!");
|
|
11
11
|
|
|
12
|
-
function
|
|
13
|
-
let
|
|
12
|
+
function verifyStatement(statementNode, assignments, derived, localContext) {
|
|
13
|
+
let statementVerified;
|
|
14
14
|
|
|
15
|
-
const
|
|
15
|
+
const statementString = localContext.nodeAsString(statementNode);
|
|
16
16
|
|
|
17
|
-
localContext.trace(`Verifying the '${
|
|
17
|
+
localContext.trace(`Verifying the '${statementString}' statement...`, statementNode);
|
|
18
18
|
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
const verifyStatementFunctions = [
|
|
20
|
+
verifyStatementAsJudgement,
|
|
21
|
+
verifyStatementAsDefinedAssertion,
|
|
22
|
+
verifyStatementAsContainedAssertion,
|
|
23
|
+
verifyStatementAsIs
|
|
24
24
|
];
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
const
|
|
26
|
+
statementVerified = verifyStatementFunctions.some((verifyStatementFunction) => {
|
|
27
|
+
const statementVerified = verifyStatementFunction(statementNode, assignments, derived, localContext);
|
|
28
28
|
|
|
29
|
-
if (
|
|
29
|
+
if (statementVerified) {
|
|
30
30
|
return true;
|
|
31
31
|
}
|
|
32
32
|
});
|
|
33
33
|
|
|
34
|
-
if (
|
|
35
|
-
localContext.debug(`...verified the '${
|
|
34
|
+
if (statementVerified) {
|
|
35
|
+
localContext.debug(`...verified the '${statementString}' statement.`, statementNode);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
return
|
|
38
|
+
return statementVerified;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
Object.assign(metaLevelNodeVerifier, {
|
|
42
|
-
|
|
42
|
+
verifyStatement
|
|
43
43
|
});
|
|
44
44
|
|
|
45
|
-
export default
|
|
45
|
+
export default verifyStatement;
|
|
46
46
|
|
|
47
|
-
function
|
|
48
|
-
let
|
|
47
|
+
function verifyStatementAsJudgement(statementNode, assignments, derived, localContext) {
|
|
48
|
+
let statementVerifiedAsJudgement = false;
|
|
49
49
|
|
|
50
|
-
const
|
|
50
|
+
const statementJudgement = isStatementJudgement(statementNode);
|
|
51
51
|
|
|
52
|
-
if (
|
|
53
|
-
const
|
|
52
|
+
if (statementJudgement) {
|
|
53
|
+
const statementString = localContext.nodeAsString(statementNode);
|
|
54
54
|
|
|
55
|
-
localContext.trace(`Verifying the '${
|
|
55
|
+
localContext.trace(`Verifying the '${statementString}' statement as a judgement...`, statementNode);
|
|
56
56
|
|
|
57
|
-
const judgementNode = judgementNodeQuery(
|
|
57
|
+
const judgementNode = judgementNodeQuery(statementNode),
|
|
58
58
|
judgementVerified = verifyJudgement(judgementNode, assignments, derived, localContext);
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
statementVerifiedAsJudgement = judgementVerified; ///
|
|
61
61
|
|
|
62
|
-
if (
|
|
63
|
-
localContext.debug(`...verified the '${
|
|
62
|
+
if (statementVerifiedAsJudgement) {
|
|
63
|
+
localContext.debug(`...verified the '${statementString}' statement as a judgement.`, statementNode);
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
return
|
|
67
|
+
return statementVerifiedAsJudgement;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
function
|
|
71
|
-
let
|
|
70
|
+
function verifyStatementAsIs(statementNode, assignments, derived, localContext) {
|
|
71
|
+
let statementVerifiedAsIs;
|
|
72
72
|
|
|
73
|
-
const
|
|
73
|
+
const statementJudgement = isStatementJudgement(statementNode);
|
|
74
74
|
|
|
75
|
-
if (!
|
|
76
|
-
const
|
|
75
|
+
if (!statementJudgement) {
|
|
76
|
+
const statementString = localContext.nodeAsString(statementNode);
|
|
77
77
|
|
|
78
|
-
localContext.trace(`Verifying the '${
|
|
78
|
+
localContext.trace(`Verifying the '${statementString}' statement as is...`, statementNode);
|
|
79
79
|
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
const verifyStatementAsIsFunctions = [
|
|
81
|
+
verifyDerivedStatementAsIs,
|
|
82
|
+
verifyStatedStatementAsIs
|
|
83
83
|
];
|
|
84
84
|
|
|
85
|
-
|
|
86
|
-
const
|
|
85
|
+
statementVerifiedAsIs = verifyStatementAsIsFunctions.some((verifyStatementAsIsFunction) => {
|
|
86
|
+
const statementVerifiedAsIs = verifyStatementAsIsFunction(statementNode, assignments, derived, localContext);
|
|
87
87
|
|
|
88
|
-
if (
|
|
88
|
+
if (statementVerifiedAsIs) {
|
|
89
89
|
return true;
|
|
90
90
|
}
|
|
91
91
|
});
|
|
92
92
|
|
|
93
|
-
if (
|
|
94
|
-
localContext.debug(`...verified the '${
|
|
93
|
+
if (statementVerifiedAsIs) {
|
|
94
|
+
localContext.debug(`...verified the '${statementString}' statement as is.`, statementNode);
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
return
|
|
98
|
+
return statementVerifiedAsIs;
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
function
|
|
102
|
-
let
|
|
101
|
+
function verifyDerivedStatementAsIs(statementNode, assignments, derived, localContext) {
|
|
102
|
+
let derivedStatementVerifiedAsIs = false;
|
|
103
103
|
|
|
104
104
|
if (derived) {
|
|
105
|
-
const
|
|
105
|
+
const statementString = localContext.nodeAsString(statementNode);
|
|
106
106
|
|
|
107
|
-
localContext.debug(`Cannot verify the derived '${
|
|
107
|
+
localContext.debug(`Cannot verify the derived '${statementString}' statement as is.`, statementNode);
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
return
|
|
110
|
+
return derivedStatementVerifiedAsIs;
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
function
|
|
114
|
-
let
|
|
113
|
+
function verifyStatedStatementAsIs(statementNode, assignments, derived, localContext) {
|
|
114
|
+
let statedStatementVerifiedAsIs = false;
|
|
115
115
|
|
|
116
116
|
if (!derived) {
|
|
117
|
-
const
|
|
117
|
+
const statementString = localContext.nodeAsString(statementNode);
|
|
118
118
|
|
|
119
|
-
localContext.trace(`Verifying the stated '${
|
|
119
|
+
localContext.trace(`Verifying the stated '${statementString}' statement as is...`, statementNode);
|
|
120
120
|
|
|
121
|
-
const nonTerminalNode =
|
|
121
|
+
const nonTerminalNode = statementNode, ///
|
|
122
122
|
nonTerminalNodeVerified = metaLevelNodeVerifier.verifyNonTerminalNode(nonTerminalNode, localContext, () => {
|
|
123
123
|
const verifiedAhead = true;
|
|
124
124
|
|
|
125
125
|
return verifiedAhead;
|
|
126
126
|
});
|
|
127
127
|
|
|
128
|
-
|
|
128
|
+
statedStatementVerifiedAsIs = nonTerminalNodeVerified; ///
|
|
129
129
|
|
|
130
|
-
if (
|
|
131
|
-
localContext.debug(`...verified the stated '${
|
|
130
|
+
if (statedStatementVerifiedAsIs) {
|
|
131
|
+
localContext.debug(`...verified the stated '${statementString}' statement as is.`, statementNode);
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
return
|
|
135
|
+
return statedStatementVerifiedAsIs;
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
function
|
|
139
|
-
const judgementNode = judgementNodeQuery(
|
|
140
|
-
|
|
138
|
+
function isStatementJudgement(statementNode) {
|
|
139
|
+
const judgementNode = judgementNodeQuery(statementNode),
|
|
140
|
+
statementJudgement = (judgementNode !== null);
|
|
141
141
|
|
|
142
|
-
return
|
|
142
|
+
return statementJudgement;
|
|
143
143
|
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import verifyProof from "../verify/proof";
|
|
3
4
|
import Metatheorem from "../metatheorem";
|
|
4
5
|
import verifyLabels from "../verify/labels";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import verifyMetaSuppositions from "../verify/metaSuppositions";
|
|
6
|
+
import LocalContext from "../context/local";
|
|
7
|
+
import verifyConsequent from "../verify/consequent";
|
|
8
|
+
import verifySuppositions from "../verify/suppositions";
|
|
9
9
|
|
|
10
10
|
import { first } from "../utilities/array";
|
|
11
11
|
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
12
12
|
|
|
13
13
|
const labelNodesQuery = nodesQuery("/metatheorem/label"),
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
proofNodeQuery = nodeQuery("/metatheorem/proof!"),
|
|
15
|
+
consequentNodeQuery = nodeQuery("/metatheorem/consequent!"),
|
|
16
|
+
suppositionsNodeQuery = nodesQuery("/metatheorem/supposition");
|
|
17
17
|
|
|
18
18
|
export default function verifyMetatheorem(metatheoremNode, fileContext) {
|
|
19
19
|
let metatheoremVerified = false;
|
|
@@ -27,27 +27,26 @@ export default function verifyMetatheorem(metatheoremNode, fileContext) {
|
|
|
27
27
|
labelsVerified = verifyLabels(labelNodes, labels, fileContext);
|
|
28
28
|
|
|
29
29
|
if (labelsVerified) {
|
|
30
|
-
const
|
|
31
|
-
localContext = metaLevelLocalContext, ///
|
|
30
|
+
const localContext = LocalContext.fromFileContext(fileContext), ///
|
|
32
31
|
substitutions = [],
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
suppositions = [],
|
|
33
|
+
suppositionNodes = suppositionsNodeQuery(metatheoremNode),
|
|
34
|
+
suppositionsVerified = verifySuppositions(suppositionNodes, suppositions, substitutions, localContext);
|
|
36
35
|
|
|
37
|
-
if (
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
if (suppositionsVerified) {
|
|
37
|
+
const consequents = [],
|
|
38
|
+
consequentNode = consequentNodeQuery(metatheoremNode),
|
|
39
|
+
consequentVerified = verifyConsequent(consequentNode, consequents, substitutions, localContext);
|
|
41
40
|
|
|
42
|
-
if (
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
41
|
+
if (consequentVerified) {
|
|
42
|
+
const proofNode = proofNodeQuery(metatheoremNode),
|
|
43
|
+
firstConsequent = first(consequents),
|
|
44
|
+
consequent = firstConsequent, ///
|
|
45
|
+
statementNode = consequent.getStatementNode(),
|
|
46
|
+
proofVerified = verifyProof(proofNode, statementNode, substitutions, localContext);
|
|
48
47
|
|
|
49
|
-
if (
|
|
50
|
-
const metatheorem = Metatheorem.
|
|
48
|
+
if (proofVerified) {
|
|
49
|
+
const metatheorem = Metatheorem.fromLabelsSuppositionsConsequentSubstitutionsAndFileContext(labels, suppositions, consequent, substitutions, fileContext);
|
|
51
50
|
|
|
52
51
|
fileContext.addMetatheorem(metatheorem);
|
|
53
52
|
|
package/src/verify/premise.js
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import Premise from "../premise";
|
|
4
|
-
import
|
|
4
|
+
import ProofStep from "../proofStep";
|
|
5
5
|
import verifyUnqualifiedStatement from "../verify/statement/unqualified";
|
|
6
|
-
import verifyUnqualifiedMetastatement from "../verify/metastatement/unqualified";
|
|
7
6
|
|
|
8
7
|
import { nodeQuery } from "../utilities/query";
|
|
9
8
|
import { assignAssignment } from "../utilities/assignments";
|
|
10
9
|
|
|
11
10
|
const statementNodeQuery = nodeQuery("/unqualifiedStatement/statement!"),
|
|
12
|
-
|
|
13
|
-
unqualifiedStatementNodeQuery = nodeQuery("/premise/unqualifiedStatement!"),
|
|
14
|
-
unqualifiedMetastatementNodeQuery = nodeQuery("/premise/unqualifiedMetastatement!");
|
|
11
|
+
unqualifiedStatementNodeQuery = nodeQuery("/premise/unqualifiedStatement!");
|
|
15
12
|
|
|
16
13
|
export default function verifyPremise(premiseNode, premises, localContext) {
|
|
17
14
|
let premiseVerified;
|
|
@@ -21,56 +18,27 @@ export default function verifyPremise(premiseNode, premises, localContext) {
|
|
|
21
18
|
localContext.trace(`Verifying the '${premiseString}' premise...`, premiseNode);
|
|
22
19
|
|
|
23
20
|
const unqualifiedStatementNode = unqualifiedStatementNodeQuery(premiseNode),
|
|
24
|
-
|
|
21
|
+
derived = false,
|
|
22
|
+
assignments = [],
|
|
23
|
+
unqualifiedStatementVerified = verifyUnqualifiedStatement(unqualifiedStatementNode, assignments, derived, localContext);
|
|
25
24
|
|
|
26
|
-
if (
|
|
27
|
-
const
|
|
28
|
-
assignments = [],
|
|
29
|
-
unqualifiedStatementVerified = verifyUnqualifiedStatement(unqualifiedStatementNode, assignments, derived, localContext);
|
|
25
|
+
if (unqualifiedStatementVerified) {
|
|
26
|
+
const assignmentAssigned = assignAssignment(assignments, localContext);
|
|
30
27
|
|
|
31
|
-
if (
|
|
32
|
-
const
|
|
28
|
+
if (assignmentAssigned) {
|
|
29
|
+
const statementNode = statementNodeQuery(unqualifiedStatementNode),
|
|
30
|
+
metaproofStep = ProofStep.fromStatementNode(statementNode),
|
|
31
|
+
premise = Premise.fromStatementNode(statementNode);
|
|
33
32
|
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
}
|
|
33
|
+
premises.push(premise);
|
|
37
34
|
|
|
38
|
-
|
|
39
|
-
const derived = false,
|
|
40
|
-
assignments = [],
|
|
41
|
-
unqualifiedMetastatementVerified = verifyUnqualifiedMetastatement(unqualifiedMetastatementNode, assignments, derived, localContext);
|
|
35
|
+
localContext.addProofStep(metaproofStep);
|
|
42
36
|
|
|
43
|
-
|
|
44
|
-
const assignmentAssigned = assignAssignment(assignments, localContext);
|
|
45
|
-
|
|
46
|
-
premiseVerified = assignmentAssigned; ///
|
|
37
|
+
premiseVerified = true;
|
|
47
38
|
}
|
|
48
39
|
}
|
|
49
40
|
|
|
50
41
|
if (premiseVerified) {
|
|
51
|
-
let premise,
|
|
52
|
-
metaproofStep;
|
|
53
|
-
|
|
54
|
-
if (unqualifiedStatementNode !== null) {
|
|
55
|
-
const statementNode = statementNodeQuery(unqualifiedStatementNode);
|
|
56
|
-
|
|
57
|
-
metaproofStep = MetaproofStep.fromMetastatementNode(statementNode);
|
|
58
|
-
|
|
59
|
-
premise = Premise.fromStatementNode(statementNode);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
if (unqualifiedMetastatementNode !== null) {
|
|
63
|
-
const metastatementNode = metastatementNodeQuery(unqualifiedMetastatementNode);
|
|
64
|
-
|
|
65
|
-
metaproofStep = MetaproofStep.fromMetastatementNode(metastatementNode);
|
|
66
|
-
|
|
67
|
-
premise = Premise.fromMetastatementNode(metastatementNode);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
premises.push(premise);
|
|
71
|
-
|
|
72
|
-
localContext.addMetaproofStep(metaproofStep);
|
|
73
|
-
|
|
74
42
|
localContext.debug(`...verified the '${premiseString}' premise.`, premiseNode);
|
|
75
43
|
}
|
|
76
44
|
|
package/src/verify/proof.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import LocalContext from "../context/local";
|
|
3
4
|
import verifyDerivation from "../verify/derivation";
|
|
4
|
-
import IntrinsicLevelLocalContext from "../context/local/intrinsicLevel";
|
|
5
5
|
|
|
6
6
|
import { nodeQuery } from "../utilities/query";
|
|
7
7
|
|
|
@@ -10,9 +10,7 @@ const derivationNodeQuery = nodeQuery("/proof/derivation!");
|
|
|
10
10
|
export default function verifyProof(proofNode, conclusion, localContext) {
|
|
11
11
|
let proofVerified = false;
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
localContext = intrinsicLevelLocalContext; ///
|
|
13
|
+
localContext = LocalContext.fromLocalContext(localContext); ///
|
|
16
14
|
|
|
17
15
|
const derivationNode = derivationNodeQuery(proofNode),
|
|
18
16
|
derivationVerified = verifyDerivation(derivationNode, localContext);
|
package/src/verify/proofStep.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import ProofStep from "../
|
|
3
|
+
import ProofStep from "../proofStep";
|
|
4
4
|
import verifySubproof from "../verify/subproof";
|
|
5
5
|
import verifySubDerivation from "../verify/subDerivation";
|
|
6
6
|
import verifyQualifiedStatement from "../verify/statement/qualified";
|
package/src/verify/rule.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import Rule from "../rule";
|
|
4
|
+
import verifyProof from "../verify/proof";
|
|
5
|
+
import LocalContext from "../context/local";
|
|
4
6
|
import verifyLabels from "../verify/labels";
|
|
5
7
|
import verifyPremises from "../verify/premises";
|
|
6
|
-
import verifyMetaproof from "../verify/metaproof";
|
|
7
8
|
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";
|
|
12
12
|
|
|
13
13
|
const labelNodesQuery = nodesQuery("/rule/label"),
|
|
14
14
|
premisesNodeQuery = nodesQuery("/rule/premise"),
|
|
15
|
-
|
|
15
|
+
proofNodeQuery = nodeQuery("/rule/proof!"),
|
|
16
16
|
conclusionNodeQuery = nodeQuery("/rule/conclusion!");
|
|
17
17
|
|
|
18
18
|
export default function verifyRule(ruleNode, fileContext) {
|
|
@@ -27,9 +27,8 @@ export default function verifyRule(ruleNode, fileContext) {
|
|
|
27
27
|
labelsVerified = verifyLabels(labelNodes, labels, fileContext);
|
|
28
28
|
|
|
29
29
|
if (labelsVerified) {
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
localContext = metaLevelLocalContext, ///
|
|
30
|
+
const premises = [],
|
|
31
|
+
localContext = LocalContext.fromFileContext(fileContext),
|
|
33
32
|
premiseNodes = premisesNodeQuery(ruleNode),
|
|
34
33
|
premisesVerified = verifyPremises(premiseNodes, premises, localContext);
|
|
35
34
|
|
|
@@ -39,20 +38,20 @@ export default function verifyRule(ruleNode, fileContext) {
|
|
|
39
38
|
conclusionVerified = verifyConclusion(conclusionNode, conclusions, localContext);
|
|
40
39
|
|
|
41
40
|
if (conclusionVerified) {
|
|
42
|
-
let
|
|
41
|
+
let proofVerified = true; ///
|
|
43
42
|
|
|
44
43
|
const firstConclusion = first(conclusions),
|
|
45
|
-
|
|
44
|
+
proofNode = proofNodeQuery(ruleNode),
|
|
46
45
|
conclusion = firstConclusion; ///
|
|
47
46
|
|
|
48
|
-
if (
|
|
47
|
+
if (proofNode !== null) {
|
|
49
48
|
const substitutions = [],
|
|
50
|
-
|
|
49
|
+
statementNode = conclusion.getStatementNode();
|
|
51
50
|
|
|
52
|
-
|
|
51
|
+
proofVerified = verifyProof(proofNode, statementNode, substitutions, localContext);
|
|
53
52
|
}
|
|
54
53
|
|
|
55
|
-
if (
|
|
54
|
+
if (proofVerified) {
|
|
56
55
|
const rule = Rule.fromLabelsPremisesConclusionAndFileContext(labels, premises, conclusion, fileContext);
|
|
57
56
|
|
|
58
57
|
fileContext.addRule(rule);
|