occam-verify-cli 0.0.923 → 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/conjecture.js +9 -9
- package/lib/constants.js +1 -9
- package/lib/context/file.js +3 -3
- package/lib/context/local.js +5 -5
- 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/theorem.js +9 -9
- package/lib/topLevelAssertion.js +186 -0
- package/lib/verify/axiom.js +4 -4
- package/lib/verify/conjecture.js +4 -4
- package/lib/verify/containedAssertion.js +91 -0
- package/lib/verify/declaration.js +2 -2
- 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 +4 -4
- package/lib/verify/metastatement.js +4 -23
- package/lib/verify/metatheorem.js +4 -4
- package/lib/verify/metavariable.js +2 -2
- package/lib/verify/proof.js +3 -3
- package/lib/verify/proofStep.js +4 -4
- package/lib/verify/rule.js +3 -3
- package/lib/verify/statement/qualified.js +18 -21
- 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/termAsConstructor.js +2 -2
- package/lib/verify/theorem.js +4 -4
- package/package.json +2 -2
- package/src/axiom.js +4 -4
- package/src/conjecture.js +4 -4
- package/src/constants.js +0 -2
- package/src/context/file.js +2 -2
- package/src/context/local.js +4 -3
- 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/theorem.js +4 -4
- package/src/{metaLemmaMetatheorem.js → topLevelAssertion.js} +16 -26
- package/src/verify/axiom.js +5 -4
- package/src/verify/conjecture.js +5 -4
- package/src/verify/{statementAsContainedAssertion.js → containedAssertion.js} +20 -36
- package/src/verify/declaration.js +1 -1
- 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 +4 -4
- package/src/verify/metastatement.js +3 -31
- package/src/verify/metatheorem.js +4 -4
- package/src/verify/metavariable.js +1 -1
- package/src/verify/proof.js +2 -2
- package/src/verify/proofStep.js +3 -3
- package/src/verify/rule.js +4 -4
- package/src/verify/statement/qualified.js +33 -32
- 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/termAsConstructor.js +2 -2
- package/src/verify/theorem.js +7 -4
- package/lib/axiomLemmaTheoremConjecture.js +0 -174
- package/lib/metaLemmaMetatheorem.js +0 -191
- package/lib/verify/statementAsContainedAssertion.js +0 -109
- package/lib/verify/statementAsDefinedAssertion.js +0 -132
- package/src/axiomLemmaTheoremConjecture.js +0 -165
package/src/context/local.js
CHANGED
|
@@ -305,8 +305,8 @@ class LocalContext {
|
|
|
305
305
|
return judgementPresent;
|
|
306
306
|
}
|
|
307
307
|
|
|
308
|
-
isMetavariablePresentByMetavariableNode(metavariableNode
|
|
309
|
-
const metavariable = this.findMetavariableByMetavariableNode(metavariableNode
|
|
308
|
+
isMetavariablePresentByMetavariableNode(metavariableNode) {
|
|
309
|
+
const metavariable = this.findMetavariableByMetavariableNode(metavariableNode),
|
|
310
310
|
metavariablePresent = (metavariable !== null);
|
|
311
311
|
|
|
312
312
|
return metavariablePresent;
|
|
@@ -339,8 +339,9 @@ class LocalContext {
|
|
|
339
339
|
return judgement;
|
|
340
340
|
}
|
|
341
341
|
|
|
342
|
-
findMetavariableByMetavariableNode(metavariableNode
|
|
342
|
+
findMetavariableByMetavariableNode(metavariableNode) {
|
|
343
343
|
const node = metavariableNode, ///
|
|
344
|
+
localContext = this, ///
|
|
344
345
|
metavariables = this.getMetavariables(),
|
|
345
346
|
metavariable = metavariables.find((metavariable) => {
|
|
346
347
|
const matches = metavariable.matchNode(node, localContext);
|
package/src/lemma.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import TopLevelAssertion from "./topLevelAssertion";
|
|
4
4
|
|
|
5
|
-
export default class Lemma extends
|
|
6
|
-
static fromJSONAndFileContext(json, fileContext) { return
|
|
5
|
+
export default class Lemma extends TopLevelAssertion {
|
|
6
|
+
static fromJSONAndFileContext(json, fileContext) { return TopLevelAssertion.fromJSONAndFileContext(Lemma,json, fileContext); }
|
|
7
7
|
|
|
8
|
-
static
|
|
8
|
+
static fromLabelsSuppositionsConsequentSubstitutionsAndFileContext(labels, suppositions, consequent, substitutions, fileContext) { return TopLevelAssertion.fromLabelsSuppositionsConsequentSubstitutionsAndFileContext(Lemma, labels, suppositions, consequent, substitutions, fileContext); }
|
|
9
9
|
}
|
package/src/metaLemma.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import TopLevelAssertion from "./topLevelAssertion";
|
|
4
4
|
|
|
5
|
-
export default class MetaLemma extends
|
|
6
|
-
static fromJSONAndFileContext(json, fileContext) { return
|
|
5
|
+
export default class MetaLemma extends TopLevelAssertion {
|
|
6
|
+
static fromJSONAndFileContext(json, fileContext) { return TopLevelAssertion.fromJSONAndFileContext(MetaLemma, json, fileContext); }
|
|
7
7
|
|
|
8
|
-
static fromLabelsMetaSuppositionsMetaConsequentSubstitutionsAndFileContext(labels, metaSuppositions, metaConsequent, substitutions, fileContext) { return
|
|
8
|
+
static fromLabelsMetaSuppositionsMetaConsequentSubstitutionsAndFileContext(labels, metaSuppositions, metaConsequent, substitutions, fileContext) { return TopLevelAssertion.fromLabelsMetaSuppositionsMetaConsequentSubstitutionsAndFileContext(MetaLemma, labels, metaSuppositions, metaConsequent, substitutions, fileContext); }
|
|
9
9
|
}
|
package/src/metatheorem.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import TopLevelAssertion from "./topLevelAssertion";
|
|
4
4
|
|
|
5
|
-
export default class Metatheorem extends
|
|
6
|
-
static fromJSONAndFileContext(json, fileContext) { return
|
|
5
|
+
export default class Metatheorem extends TopLevelAssertion {
|
|
6
|
+
static fromJSONAndFileContext(json, fileContext) { return TopLevelAssertion.fromJSONAndFileContext(Metatheorem, json, fileContext); }
|
|
7
7
|
|
|
8
|
-
static fromLabelsMetaSuppositionsMetaConsequentSubstitutionsAndFileContext(labels, suppositions, consequent, fileContext) { return
|
|
8
|
+
static fromLabelsMetaSuppositionsMetaConsequentSubstitutionsAndFileContext(labels, suppositions, consequent, fileContext) { return TopLevelAssertion.fromLabelsMetaSuppositionsMetaConsequentSubstitutionsAndFileContext(Metatheorem, labels, suppositions, consequent, fileContext); }
|
|
9
9
|
}
|
package/src/metavariable.js
CHANGED
package/src/theorem.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import TopLevelAssertion from "./topLevelAssertion";
|
|
4
4
|
|
|
5
|
-
export default class Theorem extends
|
|
6
|
-
static fromJSONAndFileContext(json, fileContext) { return
|
|
5
|
+
export default class Theorem extends TopLevelAssertion {
|
|
6
|
+
static fromJSONAndFileContext(json, fileContext) { return TopLevelAssertion.fromJSONAndFileContext(Theorem, json, fileContext); }
|
|
7
7
|
|
|
8
|
-
static
|
|
8
|
+
static fromLabelsSuppositionsConsequentSubstitutionsAndFileContext(labels, suppositions, consequent, substitutions, fileContext) { return TopLevelAssertion.fromLabelsSuppositionsConsequentSubstitutionsAndFileContext(Theorem, labels, suppositions, consequent, substitutions, fileContext); }
|
|
9
9
|
}
|
|
@@ -7,7 +7,7 @@ import StatementForMetavariableSubstitution from "./substitution/statementForMet
|
|
|
7
7
|
|
|
8
8
|
import { reverse, correlate } from "./utilities/array";
|
|
9
9
|
|
|
10
|
-
export default class
|
|
10
|
+
export default class TopLevelAssertion {
|
|
11
11
|
constructor(labels, suppositions, consequent, substitutions, fileContext) {
|
|
12
12
|
this.labels = labels;
|
|
13
13
|
this.suppositions = suppositions;
|
|
@@ -39,9 +39,9 @@ export default class MetaLemmaMetatheorem {
|
|
|
39
39
|
matchStatement(statementNode, localContext) {
|
|
40
40
|
let statementNatches = false;
|
|
41
41
|
|
|
42
|
-
const
|
|
42
|
+
const proofSteps = localContext.getProofSteps(),
|
|
43
43
|
substitutions = [],
|
|
44
|
-
suppositionsMatch = matchSuppositions(this.suppositions,
|
|
44
|
+
suppositionsMatch = matchSuppositions(this.suppositions, proofSteps, substitutions, this.fileContext, localContext);
|
|
45
45
|
|
|
46
46
|
if (suppositionsMatch) {
|
|
47
47
|
const consequentMatches = matchConsequent(this.consequent, statementNode, substitutions, this.fileContext, localContext);
|
|
@@ -77,22 +77,19 @@ export default class MetaLemmaMetatheorem {
|
|
|
77
77
|
}),
|
|
78
78
|
consequentJSON = this.consequent.toJSON(tokens),
|
|
79
79
|
substitutionsJSON = this.substitutions.map((substitution) => {
|
|
80
|
-
|
|
80
|
+
const substitutionJSON = substitution.toJSON();
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
localContextJSON = this.fileContext.toJSON(tokens),
|
|
82
|
+
return substitutionJSON;
|
|
83
|
+
}),
|
|
85
84
|
labels = labelsJSON, ///
|
|
86
85
|
suppositions = suppositionsJSON, ///
|
|
87
86
|
consequent = consequentJSON, ///
|
|
88
87
|
substitutions = substitutionsJSON, ///
|
|
89
|
-
fileContext = localContextJSON, ///
|
|
90
88
|
json = {
|
|
91
89
|
labels,
|
|
92
90
|
suppositions,
|
|
93
91
|
consequent,
|
|
94
|
-
substitutions
|
|
95
|
-
fileContext
|
|
92
|
+
substitutions
|
|
96
93
|
};
|
|
97
94
|
|
|
98
95
|
return json;
|
|
@@ -143,13 +140,13 @@ export default class MetaLemmaMetatheorem {
|
|
|
143
140
|
static fromLabelsSuppositionsConsequentSubstitutionsAndFileContext(Class, labels, suppositions, consequent, substitutions, fileContext) { return new Class(labels, suppositions, consequent, substitutions, fileContext); }
|
|
144
141
|
}
|
|
145
142
|
|
|
146
|
-
function matchSuppositions(suppositions,
|
|
143
|
+
function matchSuppositions(suppositions, proofSteps, substitutions, fileContext, localContext) {
|
|
147
144
|
suppositions = reverse(suppositions); ///
|
|
148
145
|
|
|
149
|
-
|
|
146
|
+
proofSteps = reverse(proofSteps); ///
|
|
150
147
|
|
|
151
|
-
const suppositionsMatch = correlate(suppositions,
|
|
152
|
-
const suppositionMatches = matchSupposition(supposition,
|
|
148
|
+
const suppositionsMatch = correlate(suppositions, proofSteps, (supposition, proofStep) => {
|
|
149
|
+
const suppositionMatches = matchSupposition(supposition, proofStep, substitutions, fileContext, localContext);
|
|
153
150
|
|
|
154
151
|
if (suppositionMatches) {
|
|
155
152
|
return true;
|
|
@@ -159,25 +156,18 @@ function matchSuppositions(suppositions, metaproofSteps, substitutions, fileCont
|
|
|
159
156
|
return suppositionsMatch;
|
|
160
157
|
}
|
|
161
158
|
|
|
162
|
-
function matchSupposition(supposition,
|
|
163
|
-
let
|
|
164
|
-
|
|
165
|
-
const metaSubproofNode = metaproofStep.getSubproofNode(),
|
|
166
|
-
statementNode = metaproofStep.getStatementNode();
|
|
159
|
+
function matchSupposition(supposition, proofStep, substitutions, fileContext, localContext) {
|
|
160
|
+
let suppositionMatches = false;
|
|
167
161
|
|
|
168
|
-
|
|
169
|
-
const suppositionMatchesSubproofNode = supposition.matchSubproofNode(metaSubproofNode, substitutions, fileContext, localContext);
|
|
170
|
-
|
|
171
|
-
matchesSupposition - suppositionMatchesSubproofNode; ///
|
|
172
|
-
}
|
|
162
|
+
const statementNode = proofStep.getStatementNode();
|
|
173
163
|
|
|
174
164
|
if (statementNode !== null) {
|
|
175
165
|
const suppositionMatchesStatementNode = supposition.matchStatementNode(statementNode, substitutions, fileContext, localContext);
|
|
176
166
|
|
|
177
|
-
|
|
167
|
+
suppositionMatches = suppositionMatchesStatementNode; ///
|
|
178
168
|
}
|
|
179
169
|
|
|
180
|
-
return
|
|
170
|
+
return suppositionMatches;
|
|
181
171
|
}
|
|
182
172
|
|
|
183
173
|
function matchConsequent(consequent, statementNode, substitutions, fileContext, localContext) {
|
package/src/verify/axiom.js
CHANGED
|
@@ -17,8 +17,7 @@ export default function verifyAxiom(axiomNode, fileContext) {
|
|
|
17
17
|
let axiomVerified = false;
|
|
18
18
|
|
|
19
19
|
const labelNodes = labelNodesQuery(axiomNode),
|
|
20
|
-
labelsString = fileContext.nodesAsString(labelNodes)
|
|
21
|
-
localContext = LocalContext.fromFileContext(fileContext);
|
|
20
|
+
labelsString = fileContext.nodesAsString(labelNodes);
|
|
22
21
|
|
|
23
22
|
fileContext.trace(`Verifying the '${labelsString}' axiom...`, axiomNode);
|
|
24
23
|
|
|
@@ -26,7 +25,8 @@ export default function verifyAxiom(axiomNode, fileContext) {
|
|
|
26
25
|
labelsVerified = verifyLabels(labelNodes, labels, fileContext);
|
|
27
26
|
|
|
28
27
|
if (labelsVerified) {
|
|
29
|
-
const
|
|
28
|
+
const localContext = LocalContext.fromFileContext(fileContext),
|
|
29
|
+
suppositions = [],
|
|
30
30
|
suppositionNodes = suppositionsNodeQuery(axiomNode),
|
|
31
31
|
suppositionsVerified = verifySuppositions(suppositionNodes, suppositions, localContext);
|
|
32
32
|
|
|
@@ -38,7 +38,8 @@ export default function verifyAxiom(axiomNode, fileContext) {
|
|
|
38
38
|
if (consequentVerified) {
|
|
39
39
|
const firstConsequent = first(consequents),
|
|
40
40
|
consequent = firstConsequent, ///
|
|
41
|
-
|
|
41
|
+
substitutions = [],
|
|
42
|
+
axiom = Axiom.fromLabelsSuppositionsConsequentSubstitutionsAndFileContext(labels, suppositions, consequent, substitutions, fileContext);
|
|
42
43
|
|
|
43
44
|
fileContext.addAxiom(axiom);
|
|
44
45
|
|
package/src/verify/conjecture.js
CHANGED
|
@@ -19,8 +19,7 @@ export default function verifyConjecture(conjectureNode, fileContext) {
|
|
|
19
19
|
let conjectureVerified = false;
|
|
20
20
|
|
|
21
21
|
const labelNodes = labelNodesQuery(conjectureNode),
|
|
22
|
-
labelsString = fileContext.nodesAsString(labelNodes)
|
|
23
|
-
localContext = LocalContext.fromFileContext(fileContext); ///
|
|
22
|
+
labelsString = fileContext.nodesAsString(labelNodes);
|
|
24
23
|
|
|
25
24
|
fileContext.trace(`Verifying the '${labelsString}' conjecture...`, conjectureNode);
|
|
26
25
|
|
|
@@ -28,7 +27,8 @@ export default function verifyConjecture(conjectureNode, fileContext) {
|
|
|
28
27
|
labelsVerified = verifyLabels(labelNodes, labels, fileContext);
|
|
29
28
|
|
|
30
29
|
if (labelsVerified) {
|
|
31
|
-
const
|
|
30
|
+
const localContext = LocalContext.fromFileContext(fileContext),
|
|
31
|
+
suppositions = [],
|
|
32
32
|
suppositionNodes = suppositionsNodeQuery(conjectureNode),
|
|
33
33
|
suppositionsVerified = verifySuppositions(suppositionNodes, suppositions, localContext);
|
|
34
34
|
|
|
@@ -46,7 +46,8 @@ export default function verifyConjecture(conjectureNode, fileContext) {
|
|
|
46
46
|
verifyProof(proofNode, consequent, localContext);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
const
|
|
49
|
+
const substitutions = [],
|
|
50
|
+
conjecture = Conjecture.fromLabelsSuppositionsConsequentSubstitutionsAndFileContext(labels, suppositions, consequent, substitutions, fileContext);
|
|
50
51
|
|
|
51
52
|
fileContext.addConjecture(conjecture);
|
|
52
53
|
|
|
@@ -2,23 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
import metaLevelNodeVerifier from "../verifier/node/metaLevel";
|
|
4
4
|
|
|
5
|
-
import { CONTAINED } from "../constants";
|
|
6
5
|
import { isStatementNegated } from "../utilities/verify";
|
|
7
6
|
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
8
7
|
|
|
9
8
|
const termNodeQuery = nodeQuery("/statement/term!"),
|
|
10
|
-
statementTermNodesQuery = nodesQuery("/statement/metaArgument/statement//term")
|
|
11
|
-
operatorTerminalNodesQuery = nodesQuery("/statement/@operator");
|
|
9
|
+
statementTermNodesQuery = nodesQuery("/statement/metaArgument/statement//term");
|
|
12
10
|
|
|
13
|
-
export default function
|
|
11
|
+
export default function verifyContainedAssertion(containedAssertionNode, assignments, derived, localContext) {
|
|
14
12
|
let statementVerifiedAsContainedAssertion;
|
|
15
13
|
|
|
16
|
-
const statementContainedAssertion = isStatementContainedAssertion(
|
|
14
|
+
const statementContainedAssertion = isStatementContainedAssertion(containedAssertionNode);
|
|
17
15
|
|
|
18
16
|
if (statementContainedAssertion) {
|
|
19
|
-
const
|
|
17
|
+
const containedAssertionString = localContext.nodeAsString(containedAssertionNode);
|
|
20
18
|
|
|
21
|
-
localContext.trace(`Verifying the '${
|
|
19
|
+
localContext.trace(`Verifying the '${containedAssertionString}' statement as a contained assertion...`, containedAssertionNode);
|
|
22
20
|
|
|
23
21
|
const statementFunctions = [
|
|
24
22
|
verifyStatementAsDerivedContainedAssertion,
|
|
@@ -26,7 +24,7 @@ export default function verifyStatementAsContainedAssertion(statementNode, assig
|
|
|
26
24
|
];
|
|
27
25
|
|
|
28
26
|
statementVerifiedAsContainedAssertion = statementFunctions.some((statementFunction) => {
|
|
29
|
-
const statementVerifiedAsContainedAssertion = statementFunction(
|
|
27
|
+
const statementVerifiedAsContainedAssertion = statementFunction(containedAssertionNode, assignments, derived, localContext);
|
|
30
28
|
|
|
31
29
|
if (statementVerifiedAsContainedAssertion) {
|
|
32
30
|
return true;
|
|
@@ -34,25 +32,25 @@ export default function verifyStatementAsContainedAssertion(statementNode, assig
|
|
|
34
32
|
});
|
|
35
33
|
|
|
36
34
|
if (statementVerifiedAsContainedAssertion) {
|
|
37
|
-
localContext.debug(`...verified the '${
|
|
35
|
+
localContext.debug(`...verified the '${containedAssertionString}' statement as a contained assertion.`, containedAssertionNode);
|
|
38
36
|
}
|
|
39
37
|
}
|
|
40
38
|
|
|
41
39
|
return statementVerifiedAsContainedAssertion;
|
|
42
40
|
}
|
|
43
41
|
|
|
44
|
-
function verifyStatementAsDerivedContainedAssertion(
|
|
42
|
+
function verifyStatementAsDerivedContainedAssertion(containedAssertionNode, assignments, derived, localContext) {
|
|
45
43
|
let statementVerifiedAsDefinedContainedAssertion = false;
|
|
46
44
|
|
|
47
45
|
if (derived) {
|
|
48
|
-
const
|
|
46
|
+
const containedAssertionString = localContext.nodeAsString(containedAssertionNode);
|
|
49
47
|
|
|
50
|
-
localContext.trace(`Verifying the
|
|
48
|
+
localContext.trace(`Verifying the '${containedAssertionString}' derived statement as a contained assertion...`, containedAssertionNode);
|
|
51
49
|
|
|
52
|
-
const statementNegated = isStatementNegated(
|
|
53
|
-
termNode = termNodeQuery(
|
|
50
|
+
const statementNegated = isStatementNegated(containedAssertionNode),
|
|
51
|
+
termNode = termNodeQuery(containedAssertionNode),
|
|
54
52
|
negated = statementNegated, ///
|
|
55
|
-
statementTermNodes = statementTermNodesQuery(
|
|
53
|
+
statementTermNodes = statementTermNodesQuery(containedAssertionNode),
|
|
56
54
|
termNodeMatchesMetaArgumentVariableNode = statementTermNodes.some((statementTermNode) => {
|
|
57
55
|
const termNodeMatchesMetaArgumentVariableNode = termNode.match(statementTermNode);
|
|
58
56
|
|
|
@@ -74,27 +72,27 @@ function verifyStatementAsDerivedContainedAssertion(statementNode, assignments,
|
|
|
74
72
|
}
|
|
75
73
|
|
|
76
74
|
if (statementVerifiedAsDefinedContainedAssertion) {
|
|
77
|
-
localContext.debug(`...verified the
|
|
75
|
+
localContext.debug(`...verified the '${containedAssertionString}' derived statement as a contained assertion.`, containedAssertionNode);
|
|
78
76
|
}
|
|
79
77
|
}
|
|
80
78
|
|
|
81
79
|
return statementVerifiedAsDefinedContainedAssertion;
|
|
82
80
|
}
|
|
83
81
|
|
|
84
|
-
function verifyStatementAsStatedContainedAssertion(
|
|
82
|
+
function verifyStatementAsStatedContainedAssertion(containedAssertionNode, assignments, derived, localContext) {
|
|
85
83
|
let statementVerifiedAsStatedContainedAssertion = false;
|
|
86
84
|
|
|
87
85
|
if (!derived) {
|
|
88
|
-
const
|
|
86
|
+
const containedAssertionString = localContext.nodeAsString(containedAssertionNode);
|
|
89
87
|
|
|
90
|
-
localContext.trace(`Verifying the
|
|
88
|
+
localContext.trace(`Verifying the '${containedAssertionString}' stated statement as a contained assertion...`, containedAssertionNode);
|
|
91
89
|
|
|
92
90
|
const intrinsicLevel = localContext.isIntrinsicLevel();
|
|
93
91
|
|
|
94
92
|
if (intrinsicLevel) {
|
|
95
|
-
localContext.debug(`The
|
|
93
|
+
localContext.debug(`The '${containedAssertionString}' stated statement as a contained assertion cannot be verified at intrinsic level.`, containedAssertionNode);
|
|
96
94
|
} else {
|
|
97
|
-
const nonTerminalNode =
|
|
95
|
+
const nonTerminalNode = containedAssertionNode, ///
|
|
98
96
|
nonTerminalNodeVerified = metaLevelNodeVerifier.verifyNonTerminalNode(nonTerminalNode, localContext, () => {
|
|
99
97
|
const verifiedAhead = true;
|
|
100
98
|
|
|
@@ -105,23 +103,9 @@ function verifyStatementAsStatedContainedAssertion(statementNode, assignments, d
|
|
|
105
103
|
}
|
|
106
104
|
|
|
107
105
|
if (statementVerifiedAsStatedContainedAssertion) {
|
|
108
|
-
localContext.debug(`...verified the
|
|
106
|
+
localContext.debug(`...verified the '${containedAssertionString}' stated statement as a contained assertion.`, containedAssertionNode);
|
|
109
107
|
}
|
|
110
108
|
}
|
|
111
109
|
|
|
112
110
|
return statementVerifiedAsStatedContainedAssertion;
|
|
113
111
|
}
|
|
114
|
-
|
|
115
|
-
export function isStatementContainedAssertion(statementNode) {
|
|
116
|
-
const operatorTerminalNodes = operatorTerminalNodesQuery(statementNode),
|
|
117
|
-
statementContainedAssertion = operatorTerminalNodes.some((operatorTerminalNode) => {
|
|
118
|
-
const content = operatorTerminalNode.getContent(),
|
|
119
|
-
contentContained = (content === CONTAINED);
|
|
120
|
-
|
|
121
|
-
if (contentContained) {
|
|
122
|
-
return true;
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
return statementContainedAssertion;
|
|
127
|
-
}
|
|
@@ -57,7 +57,7 @@ function verifyReference(referenceNode, localContext) {
|
|
|
57
57
|
localContext.trace(`Verifying the '${referenceString}' reference...`, referenceNode);
|
|
58
58
|
|
|
59
59
|
const metavariableNode = metavariableNodeQuery(referenceNode),
|
|
60
|
-
metavariable = localContext.findMetavariableByMetavariableNode(metavariableNode
|
|
60
|
+
metavariable = localContext.findMetavariableByMetavariableNode(metavariableNode);
|
|
61
61
|
|
|
62
62
|
if (metavariable !== null) {
|
|
63
63
|
const metaType = metavariable.getMetaType();
|
|
@@ -5,22 +5,21 @@ import metaLevelNodeVerifier from "../verifier/node/metaLevel";
|
|
|
5
5
|
|
|
6
6
|
import { first } from "../utilities/array";
|
|
7
7
|
import { DEFINED } from "../constants";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { nodeQuery } from "../utilities/query";
|
|
9
|
+
import { isAssertionNegated } from "../utilities/verify";
|
|
10
10
|
|
|
11
11
|
const termNodeQuery = nodeQuery("/statement/term!"),
|
|
12
|
-
variableNodeQuery = nodeQuery("/statement/term/variable!")
|
|
13
|
-
operatorTerminalNodesQuery = nodesQuery("/statement/@operator");
|
|
12
|
+
variableNodeQuery = nodeQuery("/statement/term/variable!");
|
|
14
13
|
|
|
15
|
-
export default function
|
|
14
|
+
export default function verifyDefinedAssertion(definedAssertionNode, assignments, derived, localContext) {
|
|
16
15
|
let statementVerifiedAsDefinedAssertion = false;
|
|
17
16
|
|
|
18
|
-
const statementDefinedAssertion = isStatementDefinedAssertion(
|
|
17
|
+
const statementDefinedAssertion = isStatementDefinedAssertion(definedAssertionNode);
|
|
19
18
|
|
|
20
19
|
if (statementDefinedAssertion) {
|
|
21
|
-
const
|
|
20
|
+
const definedAssertionString = localContext.nodeAsString(definedAssertionNode);
|
|
22
21
|
|
|
23
|
-
localContext.trace(`Verifying the '${
|
|
22
|
+
localContext.trace(`Verifying the '${definedAssertionString}' statement as a defined assertion...`, definedAssertionNode);
|
|
24
23
|
|
|
25
24
|
const definedAssertionFunctions = [
|
|
26
25
|
verifyDerivedStatementAsDefinedAssertion,
|
|
@@ -28,7 +27,7 @@ export default function verifyStatementAsDefinedAssertion(statementNode, assignm
|
|
|
28
27
|
];
|
|
29
28
|
|
|
30
29
|
statementVerifiedAsDefinedAssertion = definedAssertionFunctions.some((definedAssertionFunction) => {
|
|
31
|
-
const statementVerifiedAsDefinedAssertion = definedAssertionFunction(
|
|
30
|
+
const statementVerifiedAsDefinedAssertion = definedAssertionFunction(definedAssertionNode, assignments, derived, localContext);
|
|
32
31
|
|
|
33
32
|
if (statementVerifiedAsDefinedAssertion) {
|
|
34
33
|
return true;
|
|
@@ -36,24 +35,24 @@ export default function verifyStatementAsDefinedAssertion(statementNode, assignm
|
|
|
36
35
|
});
|
|
37
36
|
|
|
38
37
|
if (statementVerifiedAsDefinedAssertion) {
|
|
39
|
-
localContext.debug(`...verified the '${
|
|
38
|
+
localContext.debug(`...verified the '${definedAssertionString}' statement as a defined assertion.`, definedAssertionNode);
|
|
40
39
|
}
|
|
41
40
|
}
|
|
42
41
|
|
|
43
42
|
return statementVerifiedAsDefinedAssertion;
|
|
44
43
|
}
|
|
45
44
|
|
|
46
|
-
function verifyDerivedStatementAsDefinedAssertion(
|
|
45
|
+
function verifyDerivedStatementAsDefinedAssertion(definedAssertionNode, assignments, derived, localContext) {
|
|
47
46
|
let derivedStatementVerifiedAsDefeindAssertion = false;
|
|
48
47
|
|
|
49
48
|
if (derived) {
|
|
50
|
-
const
|
|
49
|
+
const definedAssertionString = localContext.nodeAsString(definedAssertionNode);
|
|
51
50
|
|
|
52
|
-
localContext.trace(`Verifying the
|
|
51
|
+
localContext.trace(`Verifying the '${definedAssertionString}' derived statement as a defined assertion...`, definedAssertionNode);
|
|
53
52
|
|
|
54
|
-
const statementNegated =
|
|
55
|
-
variableNode = variableNodeQuery(
|
|
56
|
-
termNode = termNodeQuery(
|
|
53
|
+
const statementNegated = isAssertionNegated(definedAssertionNode),
|
|
54
|
+
variableNode = variableNodeQuery(definedAssertionNode),
|
|
55
|
+
termNode = termNodeQuery(definedAssertionNode);
|
|
57
56
|
|
|
58
57
|
if (false) {
|
|
59
58
|
///
|
|
@@ -103,27 +102,27 @@ function verifyDerivedStatementAsDefinedAssertion(statementNode, assignments, de
|
|
|
103
102
|
}
|
|
104
103
|
|
|
105
104
|
if (derivedStatementVerifiedAsDefeindAssertion) {
|
|
106
|
-
localContext.debug(`...verified the
|
|
105
|
+
localContext.debug(`...verified the '${definedAssertionString}' derived statement as a defined assertion.`, definedAssertionNode);
|
|
107
106
|
}
|
|
108
107
|
}
|
|
109
108
|
|
|
110
109
|
return derivedStatementVerifiedAsDefeindAssertion;
|
|
111
110
|
}
|
|
112
111
|
|
|
113
|
-
function verifyStatedStatementAsDefinedAssertion(
|
|
112
|
+
function verifyStatedStatementAsDefinedAssertion(definedAssertionNode, assignments, derived, localContext) {
|
|
114
113
|
let statedStatementVerifiedAsDefinedAssertion = false;
|
|
115
114
|
|
|
116
115
|
if (!derived) {
|
|
117
|
-
const
|
|
116
|
+
const definedAssertionString = localContext.nodeAsString(definedAssertionNode);
|
|
118
117
|
|
|
119
|
-
localContext.trace(`Verifying the
|
|
118
|
+
localContext.trace(`Verifying the '${definedAssertionString}' stated statement as a defined assertion...`, definedAssertionNode);
|
|
120
119
|
|
|
121
120
|
const intrinsicLevel = localContext.isIntrinsicLevel();
|
|
122
121
|
|
|
123
122
|
if (intrinsicLevel) {
|
|
124
|
-
localContext.debug(`The
|
|
123
|
+
localContext.debug(`The '${definedAssertionString}' stated statement as a defined assertion cannot be verified at intrinsic level.`, definedAssertionNode);
|
|
125
124
|
} else {
|
|
126
|
-
const nonTerminalNode =
|
|
125
|
+
const nonTerminalNode = definedAssertionNode, ///
|
|
127
126
|
nonTerminalNodeVerified = metaLevelNodeVerifier.verifyNonTerminalNode(nonTerminalNode, localContext, () => {
|
|
128
127
|
const verifiedAhead = true;
|
|
129
128
|
|
|
@@ -134,23 +133,9 @@ function verifyStatedStatementAsDefinedAssertion(statementNode, assignments, der
|
|
|
134
133
|
}
|
|
135
134
|
|
|
136
135
|
if (statedStatementVerifiedAsDefinedAssertion) {
|
|
137
|
-
localContext.debug(`...verified the
|
|
136
|
+
localContext.debug(`...verified the '${definedAssertionString}' stated statement as a defined assertion.`, definedAssertionNode);
|
|
138
137
|
}
|
|
139
138
|
}
|
|
140
139
|
|
|
141
140
|
return statedStatementVerifiedAsDefinedAssertion;
|
|
142
141
|
}
|
|
143
|
-
|
|
144
|
-
export function isStatementDefinedAssertion(statementNode) {
|
|
145
|
-
const operatorTerminalNodes = operatorTerminalNodesQuery(statementNode),
|
|
146
|
-
statementDefinedAssertion = operatorTerminalNodes.some((operatorTerminalNode) => {
|
|
147
|
-
const content = operatorTerminalNode.getContent(),
|
|
148
|
-
contentDefined = (content === DEFINED);
|
|
149
|
-
|
|
150
|
-
if (contentDefined) {
|
|
151
|
-
return true;
|
|
152
|
-
}
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
return statementDefinedAssertion;
|
|
156
|
-
}
|
package/src/verify/derivation.js
CHANGED
|
@@ -6,18 +6,18 @@ import { nodesQuery } from "../utilities/query";
|
|
|
6
6
|
|
|
7
7
|
const proofStepNodesQuery = nodesQuery("/derivation/proofStep|lastProofStep");
|
|
8
8
|
|
|
9
|
-
export default function verifyDerivation(
|
|
10
|
-
let
|
|
9
|
+
export default function verifyDerivation(derivationNode, substitutions, localContext) {
|
|
10
|
+
let derivationVerified;
|
|
11
11
|
|
|
12
|
-
const proofStepNodes = proofStepNodesQuery(
|
|
12
|
+
const proofStepNodes = proofStepNodesQuery(derivationNode);
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
const proofStepVerified = verifyProofStep(proofStepNode, localContext);
|
|
14
|
+
derivationVerified = proofStepNodes.every((proofStepNode) => {
|
|
15
|
+
const proofStepVerified = verifyProofStep(proofStepNode, substitutions, localContext);
|
|
16
16
|
|
|
17
17
|
if (proofStepVerified) {
|
|
18
18
|
return true;
|
|
19
19
|
}
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
-
return
|
|
22
|
+
return derivationVerified;
|
|
23
23
|
}
|
package/src/verify/frame.js
CHANGED
|
@@ -56,7 +56,7 @@ function verifyMetavariable(metavariableNode, declarations, localContext) {
|
|
|
56
56
|
|
|
57
57
|
localContext.trace(`Verifying the '${metavariableString}' metavariable...`, metavariableNode);
|
|
58
58
|
|
|
59
|
-
const metavariable = localContext.findMetavariableByMetavariableNode(metavariableNode
|
|
59
|
+
const metavariable = localContext.findMetavariableByMetavariableNode(metavariableNode);
|
|
60
60
|
|
|
61
61
|
if (metavariable !== null) {
|
|
62
62
|
const metaType = metavariable.getMetaType();
|
package/src/verify/judgement.js
CHANGED
|
@@ -144,7 +144,7 @@ function verifyMetavariable(metavariableNode, localContext) {
|
|
|
144
144
|
|
|
145
145
|
localContext.trace(`Verifying the '${metavariableString}' metavariable...`, metavariableNode);
|
|
146
146
|
|
|
147
|
-
const metavariable = localContext.findMetavariableByMetavariableNode(metavariableNode
|
|
147
|
+
const metavariable = localContext.findMetavariableByMetavariableNode(metavariableNode);
|
|
148
148
|
|
|
149
149
|
if (metavariable !== null) {
|
|
150
150
|
const metaType = metavariable.getMetaType();
|
package/src/verify/lemma.js
CHANGED
|
@@ -20,8 +20,7 @@ export default function verifyLemma(lemmaNode, fileContext) {
|
|
|
20
20
|
let lemmaVerified = false;
|
|
21
21
|
|
|
22
22
|
const labelNodes = labelNodesQuery(lemmaNode),
|
|
23
|
-
labelsString = fileContext.nodesAsString(labelNodes)
|
|
24
|
-
localContext = LocalContext.fromFileContext(fileContext);
|
|
23
|
+
labelsString = fileContext.nodesAsString(labelNodes);
|
|
25
24
|
|
|
26
25
|
(labelsString === EMPTY_STRING) ?
|
|
27
26
|
fileContext.trace(`Verifying a lemma...`, lemmaNode) :
|
|
@@ -31,7 +30,8 @@ export default function verifyLemma(lemmaNode, fileContext) {
|
|
|
31
30
|
labelsVerified = verifyLabels(labelNodes, labels, fileContext);
|
|
32
31
|
|
|
33
32
|
if (labelsVerified) {
|
|
34
|
-
const
|
|
33
|
+
const localContext = LocalContext.fromFileContext(fileContext),
|
|
34
|
+
suppositions = [],
|
|
35
35
|
suppositionNodes = suppositionsNodeQuery(lemmaNode),
|
|
36
36
|
suppositionsVerified = verifySuppositions(suppositionNodes, suppositions, localContext);
|
|
37
37
|
|
|
@@ -44,10 +44,13 @@ export default function verifyLemma(lemmaNode, fileContext) {
|
|
|
44
44
|
const proofNode = proofNodeQuery(lemmaNode),
|
|
45
45
|
firstConsequent = first(consequents),
|
|
46
46
|
consequent = firstConsequent, ///
|
|
47
|
-
|
|
47
|
+
statementNode = consequent.getStatementNode(),
|
|
48
|
+
substitutions = [],
|
|
49
|
+
proofVerified = verifyProof(proofNode, statementNode, substitutions, localContext);
|
|
48
50
|
|
|
49
51
|
if (proofVerified) {
|
|
50
|
-
const
|
|
52
|
+
const substitutions = [],
|
|
53
|
+
lemma = Lemma.fromLabelsSuppositionsConsequentSubstitutionsAndFileContext(labels, suppositions, consequent, substitutions, fileContext);
|
|
51
54
|
|
|
52
55
|
fileContext.addLemma(lemma);
|
|
53
56
|
|
package/src/verify/metaLemma.js
CHANGED
|
@@ -30,22 +30,22 @@ export default function verifyMetaLemma(metaLemmaNode, fileContext) {
|
|
|
30
30
|
labelsVerified = verifyLabels(labelNodes, labels, fileContext);
|
|
31
31
|
|
|
32
32
|
if (labelsVerified) {
|
|
33
|
-
const localContext = LocalContext.fromFileContext(fileContext),
|
|
34
|
-
substitutions = [],
|
|
33
|
+
const localContext = LocalContext.fromFileContext(fileContext),
|
|
35
34
|
suppositions = [],
|
|
36
35
|
suppositionNodes = suppositionsNodeQuery(metaLemmaNode),
|
|
37
|
-
suppositionsVerified = verifySuppositions(suppositionNodes, suppositions,
|
|
36
|
+
suppositionsVerified = verifySuppositions(suppositionNodes, suppositions, localContext);
|
|
38
37
|
|
|
39
38
|
if (suppositionsVerified) {
|
|
40
39
|
const consequents = [],
|
|
41
40
|
consequentNode = consequentNodeQuery(metaLemmaNode),
|
|
42
|
-
consequentVerified = verifyConsequent(consequentNode, consequents,
|
|
41
|
+
consequentVerified = verifyConsequent(consequentNode, consequents, localContext);
|
|
43
42
|
|
|
44
43
|
if (consequentVerified) {
|
|
45
44
|
const proofNode = proofNodeQuery(metaLemmaNode),
|
|
46
45
|
firstConsequent = first(consequents),
|
|
47
46
|
consequent = firstConsequent, ///
|
|
48
47
|
statementNode = consequent.getStatementNode(),
|
|
48
|
+
substitutions = [],
|
|
49
49
|
proofVerified = verifyProof(proofNode, statementNode, substitutions, localContext);
|
|
50
50
|
|
|
51
51
|
if (proofVerified) {
|