occam-verify-cli 0.0.922 → 0.0.924
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/axiom.js +9 -9
- package/lib/conclusion.js +11 -41
- package/lib/conjecture.js +9 -9
- package/lib/constants.js +1 -13
- package/lib/context/file.js +3 -3
- package/lib/context/local.js +19 -59
- package/lib/declaration.js +15 -15
- package/lib/lemma.js +9 -9
- package/lib/metaLemma.js +7 -7
- package/lib/metatheorem.js +7 -7
- package/lib/metavariable.js +8 -1
- package/lib/mixins/nodesVerifier/metaLevel.js +6 -6
- package/lib/premise.js +14 -91
- 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/theorem.js +9 -9
- package/lib/topLevelAssertion.js +186 -0
- 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 +4 -4
- package/lib/verify/conclusion.js +10 -11
- package/lib/verify/conjecture.js +4 -4
- package/lib/verify/containedAssertion.js +91 -0
- package/lib/verify/declaration.js +7 -7
- package/lib/verify/definedAssertion.js +115 -0
- package/lib/verify/derivation.js +7 -7
- package/lib/verify/frame.js +2 -2
- package/lib/verify/judgement.js +2 -2
- package/lib/verify/lemma.js +5 -5
- package/lib/verify/metaLemma.js +12 -12
- package/lib/verify/metastatement.js +48 -67
- package/lib/verify/metatheorem.js +12 -12
- package/lib/verify/metavariable.js +2 -2
- package/lib/verify/premise.js +11 -30
- package/lib/verify/proof.js +3 -3
- package/lib/verify/proofStep.js +8 -8
- package/lib/verify/rule.js +10 -10
- package/lib/verify/statement/qualified.js +38 -15
- package/lib/verify/statement/unqualified.js +38 -10
- package/lib/verify/statement.js +85 -92
- package/lib/verify/subDerivation.js +3 -3
- package/lib/verify/subproof.js +3 -3
- package/lib/verify/supposition.js +3 -3
- package/lib/verify/termAsConstructor.js +2 -2
- package/lib/verify/theorem.js +4 -4
- package/package.json +2 -2
- package/src/axiom.js +4 -4
- package/src/conclusion.js +13 -52
- package/src/conjecture.js +4 -4
- package/src/constants.js +0 -3
- package/src/context/file.js +2 -2
- package/src/context/local.js +21 -67
- package/src/declaration.js +19 -19
- package/src/lemma.js +4 -4
- package/src/metaLemma.js +4 -4
- package/src/metatheorem.js +4 -4
- package/src/metavariable.js +6 -0
- package/src/mixins/nodesVerifier/metaLevel.js +8 -8
- package/src/premise.js +20 -137
- 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/theorem.js +4 -4
- package/src/{axiomLemmaTheoremConjecture.js → topLevelAssertion.js} +36 -23
- 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 +5 -4
- package/src/verify/conclusion.js +9 -13
- package/src/verify/conjecture.js +5 -4
- package/src/verify/{statementAsContainedAssertion.js → containedAssertion.js} +20 -36
- package/src/verify/declaration.js +8 -8
- package/src/verify/{statementAsDefinedAssertion.js → definedAssertion.js} +22 -37
- package/src/verify/derivation.js +6 -6
- package/src/verify/frame.js +1 -1
- package/src/verify/judgement.js +1 -1
- package/src/verify/lemma.js +8 -5
- package/src/verify/metaLemma.js +24 -24
- package/src/verify/metastatement.js +48 -76
- package/src/verify/metatheorem.js +23 -23
- package/src/verify/metavariable.js +1 -1
- package/src/verify/premise.js +14 -46
- package/src/verify/proof.js +2 -2
- package/src/verify/proofStep.js +4 -4
- package/src/verify/rule.js +11 -11
- package/src/verify/statement/qualified.js +56 -21
- package/src/verify/statement/unqualified.js +52 -10
- package/src/verify/statement.js +133 -39
- package/src/verify/subDerivation.js +2 -2
- package/src/verify/subproof.js +2 -2
- package/src/verify/supposition.js +1 -1
- package/src/verify/termAsConstructor.js +2 -2
- package/src/verify/theorem.js +7 -4
- package/lib/axiomLemmaTheoremConjecture.js +0 -174
- package/lib/metaConsequent.js +0 -108
- package/lib/metaLemmaMetatheorem.js +0 -191
- 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 -34
- package/lib/verify/metaSupposition.js +0 -61
- package/lib/verify/metaSuppositions.js +0 -28
- package/lib/verify/metaproof.js +0 -31
- 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/lib/verify/statementAsContainedAssertion.js +0 -109
- package/lib/verify/statementAsDefinedAssertion.js +0 -132
- package/src/metaConsequent.js +0 -83
- package/src/metaLemmaMetatheorem.js +0 -188
- 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 -32
- package/src/verify/metaSupposition.js +0 -78
- package/src/verify/metaSuppositions.js +0 -17
- package/src/verify/metaproof.js +0 -28
- 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,28 +7,70 @@ import { nodeQuery } from "../../utilities/query";
|
|
|
7
7
|
const statementNodeQuery = nodeQuery("/unqualifiedStatement/statement!");
|
|
8
8
|
|
|
9
9
|
export default function verifyUnqualifiedStatement(unqualifiedStatementNode, assignments, derived, localContext) {
|
|
10
|
-
let unqualifiedStatementVerified
|
|
10
|
+
let unqualifiedStatementVerified;
|
|
11
11
|
|
|
12
|
-
const
|
|
13
|
-
unqualifiedStatementString = localContext.nodeAsString(unqualifiedStatementNode);
|
|
12
|
+
const unqualifiedStatementString = localContext.nodeAsString(unqualifiedStatementNode);
|
|
14
13
|
|
|
15
14
|
localContext.trace(`Verifying the '${unqualifiedStatementString}' unqualified statement...`, unqualifiedStatementNode);
|
|
16
15
|
|
|
16
|
+
const verifyUnqualifiedStatementFunctions = [
|
|
17
|
+
verifyDerivedUnqualifiedStatement,
|
|
18
|
+
verifyStatedUnqualifiedStatement
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
unqualifiedStatementVerified = verifyUnqualifiedStatementFunctions.some((verifyUnqualifiedStatementFunction) => {
|
|
22
|
+
const unqualifiedStatementVerified = verifyUnqualifiedStatementFunction(unqualifiedStatementNode, assignments, derived, localContext);
|
|
23
|
+
|
|
24
|
+
if (unqualifiedStatementVerified) {
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
if (unqualifiedStatementVerified) {
|
|
30
|
+
localContext.debug(`...verified the '${unqualifiedStatementString}' unqualified statement.`, unqualifiedStatementNode);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return unqualifiedStatementVerified;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function verifyDerivedUnqualifiedStatement(unqualifiedStatementNode, assignments, derived, localContext) {
|
|
37
|
+
let derivedUnqualifiedStatementVerified = false;
|
|
38
|
+
|
|
17
39
|
if (derived) {
|
|
40
|
+
const statementNode = statementNodeQuery(unqualifiedStatementNode),
|
|
41
|
+
unqualifiedStatementString = localContext.nodeAsString(unqualifiedStatementNode);
|
|
42
|
+
|
|
43
|
+
localContext.trace(`Verifying the '${unqualifiedStatementString}' derived unqualified statement...`, unqualifiedStatementNode);
|
|
44
|
+
|
|
18
45
|
const matchesStatementNode = localContext.matchStatementNode(statementNode);
|
|
19
46
|
|
|
20
|
-
|
|
47
|
+
derivedUnqualifiedStatementVerified = matchesStatementNode; ///
|
|
48
|
+
|
|
49
|
+
if (derivedUnqualifiedStatementVerified) {
|
|
50
|
+
localContext.debug(`...verified the '${unqualifiedStatementString}' derived unqualified statement.`, unqualifiedStatementNode);
|
|
51
|
+
}
|
|
21
52
|
}
|
|
22
53
|
|
|
23
|
-
|
|
54
|
+
return derivedUnqualifiedStatementVerified;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function verifyStatedUnqualifiedStatement(unqualifiedStatementNode, assignments, derived, localContext) {
|
|
58
|
+
let statedUnqualifiedStatementVerified = false;
|
|
59
|
+
|
|
60
|
+
if (!derived) {
|
|
61
|
+
const statementNode = statementNodeQuery(unqualifiedStatementNode),
|
|
62
|
+
unqualifiedStatementString = localContext.nodeAsString(unqualifiedStatementNode);
|
|
63
|
+
|
|
64
|
+
localContext.trace(`Verifying the '${unqualifiedStatementString}' stated unqualified statement...`, unqualifiedStatementNode);
|
|
65
|
+
|
|
24
66
|
const statementVerified = verifyStatement(statementNode, assignments, derived, localContext);
|
|
25
67
|
|
|
26
|
-
|
|
27
|
-
}
|
|
68
|
+
statedUnqualifiedStatementVerified = statementVerified; ///
|
|
28
69
|
|
|
29
|
-
|
|
30
|
-
|
|
70
|
+
if (statedUnqualifiedStatementVerified) {
|
|
71
|
+
localContext.debug(`...verified the '${unqualifiedStatementString}' stated unqualified statement.`, unqualifiedStatementNode);
|
|
72
|
+
}
|
|
31
73
|
}
|
|
32
74
|
|
|
33
|
-
return
|
|
75
|
+
return statedUnqualifiedStatementVerified;
|
|
34
76
|
}
|
package/src/verify/statement.js
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import verifyEquality from "../verify/equality";
|
|
4
|
-
import
|
|
4
|
+
import verifyJudgement from "../verify/judgement";
|
|
5
5
|
import verifyTypeAssertion from "../verify/typeAssertion";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
6
|
+
import verifyDefinedAssertion from "./definedAssertion";
|
|
7
|
+
import verifyContainedAssertion from "./containedAssertion";
|
|
8
8
|
import statementAgainstCombinatorNodesVerifier from "../verifier/nodes/statementAgainstCombinator";
|
|
9
9
|
|
|
10
10
|
import { nodeQuery } from "../utilities/query";
|
|
11
|
-
import {
|
|
12
|
-
import { isStatementContainedAssertion } from "../verify/statementAsContainedAssertion";
|
|
11
|
+
import { STATEMENT_META_TYPE_NAME } from "../metaTypeNames";
|
|
13
12
|
|
|
14
13
|
const equalityNodeQuery = nodeQuery("/statement/equality!"),
|
|
15
|
-
|
|
14
|
+
judgementNodeQuery = nodeQuery("/statement/judgement!"),
|
|
15
|
+
metavariableNodeQuery = nodeQuery("/statement/metavariable!"),
|
|
16
|
+
typeAssertionNodeQuery = nodeQuery("/statement/typeAssertion!"),
|
|
17
|
+
definedAssertionNodeQuery = nodeQuery("/statement/definedAssertion!"),
|
|
18
|
+
containedAssertionNodeQuery = nodeQuery("/statement/containedAssertion!");
|
|
16
19
|
|
|
17
20
|
function verifyStatement(statementNode, assignments, derived, localContext) {
|
|
18
21
|
let statementVerified;
|
|
@@ -22,7 +25,9 @@ function verifyStatement(statementNode, assignments, derived, localContext) {
|
|
|
22
25
|
localContext.trace(`Verifying the '${statementString}' statement...`, statementNode);
|
|
23
26
|
|
|
24
27
|
const verifyStatementFunctions = [
|
|
28
|
+
verifyStatementAsMetavariable,
|
|
25
29
|
verifyStatementAsEquality,
|
|
30
|
+
verifyStatementAsJudgement,
|
|
26
31
|
verifyStatementAsTypeAssertion,
|
|
27
32
|
verifyStatementAsDefinedAssertion,
|
|
28
33
|
verifyStatementAsContainedAssertion,
|
|
@@ -77,15 +82,14 @@ export default verifyStatement;
|
|
|
77
82
|
export function verifyStatementAsEquality(statementNode, assignments, derived, localContext) {
|
|
78
83
|
let statementVerifiedAsEquality = false;
|
|
79
84
|
|
|
80
|
-
const
|
|
85
|
+
const equalityNode = equalityNodeQuery(statementNode);
|
|
81
86
|
|
|
82
|
-
if (
|
|
87
|
+
if (equalityNode !== null) {
|
|
83
88
|
const statementString = localContext.nodeAsString(statementNode);
|
|
84
89
|
|
|
85
90
|
localContext.trace(`Verifying the '${statementString}' statement as an equality...`, statementNode);
|
|
86
91
|
|
|
87
|
-
const
|
|
88
|
-
equalityVerified = verifyEquality(equalityNode, assignments, derived, localContext, () => {
|
|
92
|
+
const equalityVerified = verifyEquality(equalityNode, assignments, derived, localContext, () => {
|
|
89
93
|
const verifiedAhead = true;
|
|
90
94
|
|
|
91
95
|
return verifiedAhead;
|
|
@@ -104,15 +108,14 @@ export function verifyStatementAsEquality(statementNode, assignments, derived, l
|
|
|
104
108
|
export function verifyStatementAsTypeAssertion(statementNode, assignments, derived, localContext) {
|
|
105
109
|
let statementVerifiedAsTypeAssertion = false;
|
|
106
110
|
|
|
107
|
-
const
|
|
111
|
+
const typeAssertionNode = typeAssertionNodeQuery(statementNode);
|
|
108
112
|
|
|
109
|
-
if (
|
|
113
|
+
if (typeAssertionNode !== null) {
|
|
110
114
|
const statementString = localContext.nodeAsString(statementNode);
|
|
111
115
|
|
|
112
116
|
localContext.trace(`Verifying the '${statementString}' statement as a type assertion...`, statementNode);
|
|
113
117
|
|
|
114
|
-
const
|
|
115
|
-
typeAssertionVerified = verifyTypeAssertion(typeAssertionNode, assignments, derived, localContext, () => {
|
|
118
|
+
const typeAssertionVerified = verifyTypeAssertion(typeAssertionNode, assignments, derived, localContext, () => {
|
|
116
119
|
const verifiedAhead = true;
|
|
117
120
|
|
|
118
121
|
return verifiedAhead;
|
|
@@ -128,21 +131,126 @@ export function verifyStatementAsTypeAssertion(statementNode, assignments, deriv
|
|
|
128
131
|
return statementVerifiedAsTypeAssertion;
|
|
129
132
|
}
|
|
130
133
|
|
|
134
|
+
function verifyStatementAsJudgement(statementNode, assignments, derived, localContext) {
|
|
135
|
+
let statementVerifiedAsJudgement = false;
|
|
136
|
+
|
|
137
|
+
const judgementNode = judgementNodeQuery(statementNode);
|
|
138
|
+
|
|
139
|
+
if (judgementNode !== null) {
|
|
140
|
+
const statementString = localContext.nodeAsString(statementNode);
|
|
141
|
+
|
|
142
|
+
localContext.trace(`Verifying the '${statementString}' statement as a judgement...`, statementNode);
|
|
143
|
+
|
|
144
|
+
const judgementVerified = verifyJudgement(judgementNode, assignments, derived, localContext);
|
|
145
|
+
|
|
146
|
+
statementVerifiedAsJudgement = judgementVerified; ///
|
|
147
|
+
|
|
148
|
+
if (statementVerifiedAsJudgement) {
|
|
149
|
+
localContext.debug(`...verified the '${statementString}' statement as a judgement.`, statementNode);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return statementVerifiedAsJudgement;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function verifyStatementAsMetavariable(statementNode, assignments, derived, localContext) {
|
|
157
|
+
let statementVerifiedAsMetavariable = false;
|
|
158
|
+
|
|
159
|
+
const metavariableNode = metavariableNodeQuery(statementNode);
|
|
160
|
+
|
|
161
|
+
if (metavariableNode !== null) {
|
|
162
|
+
const statementString = localContext.nodeAsString(statementNode);
|
|
163
|
+
|
|
164
|
+
localContext.trace(`Verifying the '${statementString}' statement as a metavariable...`, statementNode);
|
|
165
|
+
|
|
166
|
+
const metavariable = localContext.findMetavariableByMetavariableNode(metavariableNode);
|
|
167
|
+
|
|
168
|
+
if (metavariable !== null) {
|
|
169
|
+
const metaTypeName = metavariable.getMetaTypeName();
|
|
170
|
+
|
|
171
|
+
if (metaTypeName === STATEMENT_META_TYPE_NAME) {
|
|
172
|
+
statementVerifiedAsMetavariable = true;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
if (statementVerifiedAsMetavariable) {
|
|
177
|
+
localContext.debug(`...verified the '${statementString}' statement as a metavariable.`, statementNode);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
return statementVerifiedAsMetavariable;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function verifyStatementAsDefinedAssertion(statementNode, assignments, derived, localContext) {
|
|
185
|
+
let statementVerifiedAsDefinedAssertion = false;
|
|
186
|
+
|
|
187
|
+
const definedAssertionNode = definedAssertionNodeQuery(statementNode);
|
|
188
|
+
|
|
189
|
+
if (definedAssertionNode !== null) {
|
|
190
|
+
const statementString = localContext.nodeAsString(statementNode);
|
|
191
|
+
|
|
192
|
+
localContext.trace(`Verifying the '${statementString}' statement as a defined assertion...`, statementNode);
|
|
193
|
+
|
|
194
|
+
const definedAssertionVerified = verifyDefinedAssertion(definedAssertionNode, assignments, derived, localContext, () => {
|
|
195
|
+
const verifiedAhead = true;
|
|
196
|
+
|
|
197
|
+
return verifiedAhead;
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
statementVerifiedAsDefinedAssertion = definedAssertionVerified; ///
|
|
201
|
+
|
|
202
|
+
if (statementVerifiedAsDefinedAssertion) {
|
|
203
|
+
localContext.debug(`...verified the '${statementString}' statement as a defined assertion.`, statementNode);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
return statementVerifiedAsDefinedAssertion;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function verifyStatementAsContainedAssertion(statementNode, assignments, derived, localContext) {
|
|
211
|
+
let statementVerifiedAsContainedAssertion = false;
|
|
212
|
+
|
|
213
|
+
const containedAssertionNode = containedAssertionNodeQuery(statementNode);
|
|
214
|
+
|
|
215
|
+
if (containedAssertionNode !== null) {
|
|
216
|
+
const statementString = localContext.nodeAsString(statementNode);
|
|
217
|
+
|
|
218
|
+
localContext.trace(`Verifying the '${statementString}' statement as a defined assertion...`, statementNode);
|
|
219
|
+
|
|
220
|
+
const containedAssertionVerified = verifyContainedAssertion(containedAssertionNode, assignments, derived, localContext, () => {
|
|
221
|
+
const verifiedAhead = true;
|
|
222
|
+
|
|
223
|
+
return verifiedAhead;
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
statementVerifiedAsContainedAssertion = containedAssertionVerified; ///
|
|
227
|
+
|
|
228
|
+
if (statementVerifiedAsContainedAssertion) {
|
|
229
|
+
localContext.debug(`...verified the '${statementString}' statement as a defined assertion.`, statementNode);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
return statementVerifiedAsContainedAssertion;
|
|
234
|
+
}
|
|
235
|
+
|
|
131
236
|
function verifyStatementAgainstCombinators(statementNode, assignments, derived, localContext) {
|
|
132
237
|
let statementVerifiedAgainstCombinators = false;
|
|
133
238
|
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
239
|
+
const equalityNode = equalityNodeQuery(statementNode),
|
|
240
|
+
judgementNode = judgementNodeQuery(statementNode),
|
|
241
|
+
metavariableNode = metavariableNodeQuery(statementNode),
|
|
242
|
+
typeAssertionNode = typeAssertionNodeQuery(statementNode),
|
|
243
|
+
definedAssertionNode = definedAssertionNodeQuery(statementNode),
|
|
244
|
+
containedAssertionNode = containedAssertionNodeQuery(statementNode);
|
|
138
245
|
|
|
139
|
-
if (
|
|
140
|
-
|
|
246
|
+
if ( (equalityNode === null) &&
|
|
247
|
+
(judgementNode === null) &&
|
|
248
|
+
(metavariableNode === null) &&
|
|
249
|
+
(typeAssertionNode === null) &&
|
|
250
|
+
(definedAssertionNode === null) &&
|
|
251
|
+
(containedAssertionNode === null) ) {
|
|
141
252
|
|
|
142
|
-
combinators =
|
|
143
|
-
bracketedCombinator,
|
|
144
|
-
...combinators
|
|
145
|
-
];
|
|
253
|
+
const combinators = localContext.getCombinators();
|
|
146
254
|
|
|
147
255
|
statementVerifiedAgainstCombinators = combinators.some((combinator) => {
|
|
148
256
|
const statementVerifiedAgainstCombinator = verifyStatementAgainstCombinator(statementNode, combinator, localContext);
|
|
@@ -180,18 +288,4 @@ function verifyStatementAgainstCombinator(statementNode, combinator, localContex
|
|
|
180
288
|
}
|
|
181
289
|
|
|
182
290
|
return statementVerifiedAgainstCombinator;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
function isStatementEquality(statementNode) {
|
|
186
|
-
const equalityNode = equalityNodeQuery(statementNode),
|
|
187
|
-
statementEquality = (equalityNode !== null);
|
|
188
|
-
|
|
189
|
-
return statementEquality;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
function isStatementTypeAssertion(statementNode) {
|
|
193
|
-
const typeAssertionNode = typeAssertionNodeQuery(statementNode),
|
|
194
|
-
statementTypeAssertion = (typeAssertionNode !== null);
|
|
195
|
-
|
|
196
|
-
return statementTypeAssertion;
|
|
197
|
-
}
|
|
291
|
+
}
|
|
@@ -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, localContext) {
|
|
7
|
+
export default function verifySubDerivation(subDerivationNode, substitutions, 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, localContext);
|
|
14
|
+
proofStepVerified = verifyProofStep(proofStepNode, substitutions, localContext);
|
|
15
15
|
|
|
16
16
|
if (proofStepVerified) {
|
|
17
17
|
return true;
|
package/src/verify/subproof.js
CHANGED
|
@@ -9,7 +9,7 @@ import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
|
9
9
|
const suppositionNodesQuery = nodesQuery("/subproof/supposition"),
|
|
10
10
|
subDerivationNodeQuery = nodeQuery("/subproof/subDerivation");
|
|
11
11
|
|
|
12
|
-
export default function verifySubproof(subproofNode, localContext) {
|
|
12
|
+
export default function verifySubproof(subproofNode, substitutions, localContext) {
|
|
13
13
|
let subproofVerified = false;
|
|
14
14
|
|
|
15
15
|
localContext = LocalContext.fromLocalContext(localContext); ///
|
|
@@ -20,7 +20,7 @@ export default function verifySubproof(subproofNode, localContext) {
|
|
|
20
20
|
|
|
21
21
|
if (suppositionsVerified) {
|
|
22
22
|
const subDerivationNode = subDerivationNodeQuery(subproofNode),
|
|
23
|
-
subDerivationVerified = verifySubDerivation(subDerivationNode, localContext);
|
|
23
|
+
subDerivationVerified = verifySubDerivation(subDerivationNode, substitutions, localContext);
|
|
24
24
|
|
|
25
25
|
if (subDerivationVerified) {
|
|
26
26
|
subproofVerified = true;
|
|
@@ -11,9 +11,9 @@ export default function verifyTermAsConstructor(termNode, typeNode, fileContext)
|
|
|
11
11
|
|
|
12
12
|
fileContext.debug(`Verifying the '${termString}' term as a constructor...`, termNode);
|
|
13
13
|
|
|
14
|
-
const
|
|
14
|
+
const localContext = LocalContext.fromFileContext(fileContext),
|
|
15
|
+
nonTerminalNode = termNode, ///
|
|
15
16
|
childNodes = nonTerminalNode.getChildNodes(),
|
|
16
|
-
localContext = LocalContext.fromFileContext(fileContext),
|
|
17
17
|
childNodesVerified = termAsConstructorNodeVerifier.verifyChildNodes(childNodes, localContext, () => {
|
|
18
18
|
const verifiedAhead = true;
|
|
19
19
|
|
package/src/verify/theorem.js
CHANGED
|
@@ -27,9 +27,9 @@ export default function verifyTheorem(theoremNode, fileContext) {
|
|
|
27
27
|
labelsVerified = verifyLabels(labelNodes, labels, fileContext);
|
|
28
28
|
|
|
29
29
|
if (labelsVerified) {
|
|
30
|
-
const
|
|
30
|
+
const localContext = LocalContext.fromFileContext(fileContext),
|
|
31
31
|
suppositions = [],
|
|
32
|
-
|
|
32
|
+
suppositionNodes = suppositionsNodeQuery(theoremNode),
|
|
33
33
|
suppositionsVerified = verifySuppositions(suppositionNodes, suppositions, localContext);
|
|
34
34
|
|
|
35
35
|
if (suppositionsVerified) {
|
|
@@ -41,10 +41,13 @@ export default function verifyTheorem(theoremNode, fileContext) {
|
|
|
41
41
|
const proofNode = proofNodeQuery(theoremNode),
|
|
42
42
|
firstConsequent = first(consequents),
|
|
43
43
|
consequent = firstConsequent, ///
|
|
44
|
-
|
|
44
|
+
statementNode = consequent.getStatementNode(),
|
|
45
|
+
substitutions = [],
|
|
46
|
+
proofVerified = verifyProof(proofNode, statementNode, substitutions, localContext);
|
|
45
47
|
|
|
46
48
|
if (proofVerified) {
|
|
47
|
-
const
|
|
49
|
+
const substitutions = [],
|
|
50
|
+
theorem = Theorem.fromLabelsSuppositionsConsequentSubstitutionsAndFileContext(labels, suppositions, consequent, substitutions, fileContext);
|
|
48
51
|
|
|
49
52
|
fileContext.addTheorem(theorem);
|
|
50
53
|
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "default", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return AxiomLemmaTheoremConjecture;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
var _label = /*#__PURE__*/ _interop_require_default(require("./label"));
|
|
12
|
-
var _consequent = /*#__PURE__*/ _interop_require_default(require("./consequent"));
|
|
13
|
-
var _supposition = /*#__PURE__*/ _interop_require_default(require("./supposition"));
|
|
14
|
-
var _local = /*#__PURE__*/ _interop_require_default(require("./context/local"));
|
|
15
|
-
var _array = require("./utilities/array");
|
|
16
|
-
function _class_call_check(instance, Constructor) {
|
|
17
|
-
if (!(instance instanceof Constructor)) {
|
|
18
|
-
throw new TypeError("Cannot call a class as a function");
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
function _defineProperties(target, props) {
|
|
22
|
-
for(var i = 0; i < props.length; i++){
|
|
23
|
-
var descriptor = props[i];
|
|
24
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
25
|
-
descriptor.configurable = true;
|
|
26
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
27
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
function _create_class(Constructor, protoProps, staticProps) {
|
|
31
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
32
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
33
|
-
return Constructor;
|
|
34
|
-
}
|
|
35
|
-
function _interop_require_default(obj) {
|
|
36
|
-
return obj && obj.__esModule ? obj : {
|
|
37
|
-
default: obj
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
var AxiomLemmaTheoremConjecture = /*#__PURE__*/ function() {
|
|
41
|
-
function AxiomLemmaTheoremConjecture(labels, suppositions, consequent, localContext) {
|
|
42
|
-
_class_call_check(this, AxiomLemmaTheoremConjecture);
|
|
43
|
-
this.labels = labels;
|
|
44
|
-
this.suppositions = suppositions;
|
|
45
|
-
this.consequent = consequent;
|
|
46
|
-
this.localContext = localContext;
|
|
47
|
-
}
|
|
48
|
-
_create_class(AxiomLemmaTheoremConjecture, [
|
|
49
|
-
{
|
|
50
|
-
key: "getLabels",
|
|
51
|
-
value: function getLabels() {
|
|
52
|
-
return this.labels;
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
key: "getSuppositions",
|
|
57
|
-
value: function getSuppositions() {
|
|
58
|
-
return this.suppositions;
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
key: "getConsequent",
|
|
63
|
-
value: function getConsequent() {
|
|
64
|
-
return this.consequent;
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
key: "getLocalContext",
|
|
69
|
-
value: function getLocalContext() {
|
|
70
|
-
return this.localContext;
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
key: "matchStatement",
|
|
75
|
-
value: function matchStatement(statementNode, localContext) {
|
|
76
|
-
var statementNatches = false;
|
|
77
|
-
var proofSteps = localContext.getProofSteps(), substitutions = [], suppositionsMatch = matchSuppositions(this.suppositions, proofSteps, substitutions, this.localContext, localContext);
|
|
78
|
-
if (suppositionsMatch) {
|
|
79
|
-
var consequentMatches = matchConsequent(this.consequent, statementNode, substitutions, this.localContext, localContext);
|
|
80
|
-
statementNatches = consequentMatches; ///
|
|
81
|
-
}
|
|
82
|
-
return statementNatches;
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
key: "matchMetavariableNode",
|
|
87
|
-
value: function matchMetavariableNode(metavariableNode) {
|
|
88
|
-
var matchesMetavariableNode = this.labels.some(function(label) {
|
|
89
|
-
var labelMatchesMetavariableNode = label.matchMetavariableNode(metavariableNode);
|
|
90
|
-
if (labelMatchesMetavariableNode) {
|
|
91
|
-
return true;
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
return matchesMetavariableNode;
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
key: "toJSON",
|
|
99
|
-
value: function toJSON(tokens) {
|
|
100
|
-
var labelsJSON = this.labels.map(function(label) {
|
|
101
|
-
var labelJSON = label.toJSON(tokens);
|
|
102
|
-
return labelJSON;
|
|
103
|
-
}), suppositionsJSON = this.suppositions.map(function(supposition) {
|
|
104
|
-
var suppositionJSON = supposition.toJSON(tokens);
|
|
105
|
-
return suppositionJSON;
|
|
106
|
-
}), consequentJSON = this.consequent.toJSON(tokens), localContextJSON = this.localContext.toJSON(tokens), labels = labelsJSON, suppositions = suppositionsJSON, consequent = consequentJSON, localContext = localContextJSON, json = {
|
|
107
|
-
labels: labels,
|
|
108
|
-
suppositions: suppositions,
|
|
109
|
-
consequent: consequent,
|
|
110
|
-
localContext: localContext
|
|
111
|
-
};
|
|
112
|
-
return json;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
], [
|
|
116
|
-
{
|
|
117
|
-
key: "fromJSONAndFileContext",
|
|
118
|
-
value: function fromJSONAndFileContext(Class, json, fileContext) {
|
|
119
|
-
var labels = json.labels;
|
|
120
|
-
var labelsJSON = labels; ///
|
|
121
|
-
labels = labelsJSON.map(function(labelJSON) {
|
|
122
|
-
var _$json = labelJSON, label = _label.default.fromJSONAndFileContext(_$json, fileContext);
|
|
123
|
-
return label;
|
|
124
|
-
});
|
|
125
|
-
var suppositions = json.suppositions, consequent = json.consequent, localContext = json.localContext;
|
|
126
|
-
var suppositionsJSON = suppositions; ///
|
|
127
|
-
suppositions = suppositionsJSON.map(function(suppositionJSON) {
|
|
128
|
-
var _$json = suppositionJSON, supposition = _supposition.default.fromJSONAndFileContext(_$json, fileContext);
|
|
129
|
-
return supposition;
|
|
130
|
-
});
|
|
131
|
-
var consequentJSON = consequent; ///
|
|
132
|
-
json = consequentJSON; ///
|
|
133
|
-
consequent = _consequent.default.fromJSONAndFileContext(json, fileContext);
|
|
134
|
-
var localContextJSON = localContext; ///
|
|
135
|
-
json = localContextJSON; ///
|
|
136
|
-
localContext = _local.default.fromJSONAndFileContext(json, fileContext);
|
|
137
|
-
return new Class(labels, suppositions, consequent, localContext); ///
|
|
138
|
-
}
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
key: "fromLabelsSuppositionsConsequentAndLocalContext",
|
|
142
|
-
value: function fromLabelsSuppositionsConsequentAndLocalContext(Class, labels, suppositions, consequent, localContext) {
|
|
143
|
-
return new Class(labels, suppositions, consequent, localContext);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
]);
|
|
147
|
-
return AxiomLemmaTheoremConjecture;
|
|
148
|
-
}();
|
|
149
|
-
function matchSuppositions(suppositions, proofSteps, substitutions, localContext, statementLocalContext) {
|
|
150
|
-
suppositions = (0, _array.reverse)(suppositions); ///
|
|
151
|
-
proofSteps = (0, _array.reverse)(proofSteps); ///
|
|
152
|
-
var suppositionsMatch = (0, _array.correlate)(suppositions, proofSteps, function(supposition, proofStep) {
|
|
153
|
-
var suppositionMatches = matchSupposition(supposition, proofStep, substitutions, localContext, statementLocalContext);
|
|
154
|
-
if (suppositionMatches) {
|
|
155
|
-
return true;
|
|
156
|
-
}
|
|
157
|
-
});
|
|
158
|
-
return suppositionsMatch;
|
|
159
|
-
}
|
|
160
|
-
function matchSupposition(supposition, proofStep, substitutions, localContext, statementLocalContext) {
|
|
161
|
-
var suppositionMatches = false;
|
|
162
|
-
var statementNode = proofStep.getStatementNode();
|
|
163
|
-
if (statementNode !== null) {
|
|
164
|
-
var suppositionMatchesStatementNode = supposition.matchStatementNode(statementNode, substitutions, localContext, statementLocalContext);
|
|
165
|
-
suppositionMatches = suppositionMatchesStatementNode; ///
|
|
166
|
-
}
|
|
167
|
-
return suppositionMatches;
|
|
168
|
-
}
|
|
169
|
-
function matchConsequent(consequent, statementNode, substitutions, localContext, statementLocalContext) {
|
|
170
|
-
var consequentMatchesStatementNode = consequent.matchStatementNode(statementNode, substitutions, localContext, statementLocalContext), consequentMatches = consequentMatchesStatementNode; ///
|
|
171
|
-
return consequentMatches;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9heGlvbUxlbW1hVGhlb3JlbUNvbmplY3R1cmUuanMiXSwic291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oZXNNZXRhdmFyaWFibGVOb2RlO1xuICB9XG5cbiAgdG9KU09OKHRva2Vucykge1xuICAgIGNvbnN0IGxhYmVsc0pTT04gPSB0aGlzLmxhYmVscy5tYXAoKGxhYmVsKSA9PiB7XG4gICAgICAgICAgICBjb25zdCBsYWJlbEpTT04gPSBsYWJlbC50b0pTT04odG9rZW5zKTtcblxuICAgICAgICAgICAgcmV0dXJuIGxhYmVsSlNPTjtcbiAgICAgICAgICB9KSxcbiAgICAgICAgICBzdXBwb3NpdGlvbnNKU09OID0gdGhpcy5zdXBwb3NpdGlvbnMubWFwKChzdXBwb3NpdGlvbikgPT4ge1xuICAgICAgICAgICAgY29uc3Qgc3VwcG9zaXRpb25KU09OID0gc3VwcG9zaXRpb24udG9KU09OKHRva2Vucyk7XG5cbiAgICAgICAgICAgIHJldHVybiBzdXBwb3NpdGlvbkpTT047XG4gICAgICAgICAgfSksXG4gICAgICAgICAgY29uc2VxdWVudEpTT04gPSB0aGlzLmNvbnNlcXVlbnQudG9KU09OKHRva2VucyksXG4gICAgICAgICAgbG9jYWxDb250ZXh0SlNPTiA9IHRoaXMubG9jYWxDb250ZXh0LnRvSlNPTih0b2tlbnMpLFxuICAgICAgICAgIGxhYmVscyA9IGxhYmVsc0pTT04sICAvLy9cbiAgICAgICAgICBzdXBwb3NpdGlvbnMgPSBzdXBwb3NpdGlvbnNKU09OLCAgLy8vXG4gICAgICAgICAgY29uc2VxdWVudCA9IGNvbnNlcXVlbnRKU09OLCAgLy8vXG4gICAgICAgICAgbG9jYWxDb250ZXh0ID0gbG9jYWxDb250ZXh0SlNPTiwgIC8vL1xuICAgICAgICAgIGpzb24gPSB7XG4gICAgICAgICAgICBsYWJlbHMsXG4gICAgICAgICAgICBzdXBwb3NpdGlvbnMsXG4gICAgICAgICAgICBjb25zZXF1ZW50LFxuICAgICAgICAgICAgbG9jYWxDb250ZXh0XG4gICAgICAgICAgfTtcblxuICAgIHJldHVybiBqc29uO1xuICB9XG5cbiAgc3Rhd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