occam-verify-cli 0.0.913 → 0.0.915
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/assignment/frameAssertion.js +4 -4
- package/lib/axiomLemmaTheoremConjecture.js +4 -3
- package/lib/conclusion.js +5 -5
- package/lib/context/file.js +3 -3
- package/lib/context/local/intrinsicLevel.js +326 -0
- package/lib/context/local/metaLevel.js +290 -0
- package/lib/metaConsequent.js +4 -4
- package/lib/metaLemmaMetatheorem.js +11 -11
- package/lib/metaSupposition.js +7 -7
- package/lib/metavariable.js +5 -5
- package/lib/premise.js +12 -12
- package/lib/rule.js +12 -12
- package/lib/verifier/node/metaLevel.js +214 -0
- package/lib/verifier/node/statementAsCombinator.js +9 -9
- package/lib/verifier/node/termAsConstructor.js +7 -7
- package/lib/verify/axiom.js +3 -3
- package/lib/verify/conclusion.js +7 -7
- package/lib/verify/conjecture.js +3 -3
- package/lib/verify/containedAssertion.js +23 -4
- package/lib/verify/declaration.js +15 -15
- package/lib/verify/definedAssertion.js +18 -4
- package/lib/verify/derivation.js +3 -3
- package/lib/verify/frame.js +16 -16
- package/lib/verify/frameAssertion.js +33 -33
- package/lib/verify/lemma.js +3 -3
- package/lib/verify/metaConsequent.js +7 -7
- package/lib/verify/metaDerivation.js +3 -3
- package/lib/verify/metaLemma.js +6 -6
- package/lib/verify/metaSubDerivation.js +3 -3
- package/lib/verify/metaSubproof.js +7 -6
- package/lib/verify/metaSupposition.js +9 -9
- package/lib/verify/metaSuppositions.js +3 -3
- package/lib/verify/metaproof.js +7 -6
- package/lib/verify/metaproofStep.js +23 -23
- package/lib/verify/metastatement/qualified.js +22 -22
- package/lib/verify/metastatement/unqualified.js +7 -7
- package/lib/verify/metastatement.js +26 -26
- package/lib/verify/metatheorem.js +6 -6
- package/lib/verify/metavariable.js +6 -6
- package/lib/verify/premise.js +9 -9
- package/lib/verify/premises.js +3 -3
- package/lib/verify/proof.js +4 -3
- package/lib/verify/rule.js +6 -6
- package/lib/verify/ruleDerivation.js +3 -3
- package/lib/verify/ruleProof.js +7 -6
- package/lib/verify/ruleProofStep.js +26 -25
- package/lib/verify/ruleSubDerivation.js +3 -3
- package/lib/verify/ruleSubproof.js +7 -6
- package/lib/verify/statement.js +4 -17
- package/lib/verify/subDerivation.js +3 -3
- package/lib/verify/subproof.js +4 -3
- package/lib/verify/termAsConstructor.js +3 -3
- package/lib/verify/theorem.js +4 -4
- package/package.json +2 -2
- package/src/assignment/frameAssertion.js +5 -5
- package/src/axiomLemmaTheoremConjecture.js +4 -2
- package/src/conclusion.js +7 -7
- package/src/context/file.js +2 -2
- package/src/context/{local.js → local/intrinsicLevel.js} +25 -20
- package/src/context/{localMeta.js → local/metaLevel.js} +21 -16
- package/src/metaConsequent.js +7 -7
- package/src/metaLemmaMetatheorem.js +11 -11
- package/src/metaSupposition.js +13 -13
- package/src/metavariable.js +6 -7
- package/src/premise.js +26 -26
- package/src/rule.js +12 -12
- package/src/verifier/node/{metastatement.js → metaLevel.js} +19 -21
- package/src/verifier/node/statementAsCombinator.js +8 -8
- package/src/verifier/node/termAsConstructor.js +6 -6
- package/src/verify/axiom.js +4 -3
- package/src/verify/conclusion.js +5 -6
- package/src/verify/conjecture.js +4 -3
- package/src/verify/containedAssertion.js +24 -3
- package/src/verify/declaration.js +15 -15
- package/src/verify/definedAssertion.js +23 -3
- package/src/verify/derivation.js +2 -2
- package/src/verify/frame.js +15 -15
- package/src/verify/frameAssertion.js +33 -33
- package/src/verify/lemma.js +4 -3
- package/src/verify/metaConsequent.js +5 -6
- package/src/verify/metaDerivation.js +2 -2
- package/src/verify/metaLemma.js +8 -7
- package/src/verify/metaSubDerivation.js +2 -2
- package/src/verify/metaSubproof.js +7 -5
- package/src/verify/metaSupposition.js +7 -8
- package/src/verify/metaSuppositions.js +2 -2
- package/src/verify/metaproof.js +7 -5
- package/src/verify/metaproofStep.js +21 -25
- package/src/verify/metastatement/qualified.js +24 -24
- package/src/verify/metastatement/unqualified.js +6 -6
- package/src/verify/metastatement.js +25 -25
- package/src/verify/metatheorem.js +8 -7
- package/src/verify/metavariable.js +5 -5
- package/src/verify/premise.js +7 -8
- package/src/verify/premises.js +2 -2
- package/src/verify/proof.js +4 -2
- package/src/verify/rule.js +8 -7
- package/src/verify/ruleDerivation.js +2 -2
- package/src/verify/ruleProof.js +7 -5
- package/src/verify/ruleProofStep.js +22 -25
- package/src/verify/ruleSubDerivation.js +2 -2
- package/src/verify/ruleSubproof.js +7 -5
- package/src/verify/statement.js +2 -22
- package/src/verify/subDerivation.js +2 -2
- package/src/verify/subproof.js +4 -2
- package/src/verify/termAsConstructor.js +4 -3
- package/src/verify/theorem.js +5 -4
- package/lib/context/local.js +0 -320
- package/lib/context/localMeta.js +0 -284
- package/lib/verifier/node/metastatement.js +0 -214
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import IntrinsicLevelLocalContext from "../../context/local/intrinsicLevel";
|
|
4
4
|
|
|
5
|
-
import { last, reverse } from "
|
|
5
|
+
import { last, reverse } from "../../utilities/array";
|
|
6
6
|
|
|
7
|
-
class
|
|
7
|
+
class MetaLevelLocalContext extends IntrinsicLevelLocalContext {
|
|
8
8
|
constructor(context, variables, proofSteps, equivalences, metavariables, metaproofSteps, frameAssertions) {
|
|
9
9
|
super(context, variables, proofSteps, equivalences);
|
|
10
10
|
|
|
@@ -46,6 +46,12 @@ class LocalMetaContext extends LocalContext {
|
|
|
46
46
|
return frameAssertions;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
isIntrinsicLevel() {
|
|
50
|
+
const intrinsicLevel = false;
|
|
51
|
+
|
|
52
|
+
return intrinsicLevel;
|
|
53
|
+
}
|
|
54
|
+
|
|
49
55
|
getLastMetaproofStep() {
|
|
50
56
|
let lastMetaproofStep = null;
|
|
51
57
|
|
|
@@ -114,11 +120,11 @@ class LocalMetaContext extends LocalContext {
|
|
|
114
120
|
return matchesMetastatementNode;
|
|
115
121
|
}
|
|
116
122
|
|
|
117
|
-
findMetavariableByMetavariableNode(metavariableNode,
|
|
123
|
+
findMetavariableByMetavariableNode(metavariableNode, metaLevelLocalContext) {
|
|
118
124
|
const node = metavariableNode, ///
|
|
119
125
|
metavariables = this.getMetavariables(),
|
|
120
126
|
metavariable = metavariables.find((metavariable) => {
|
|
121
|
-
const matches = metavariable.matchNode(node,
|
|
127
|
+
const matches = metavariable.matchNode(node, metaLevelLocalContext);
|
|
122
128
|
|
|
123
129
|
if (matches) {
|
|
124
130
|
return true;
|
|
@@ -141,8 +147,8 @@ class LocalMetaContext extends LocalContext {
|
|
|
141
147
|
return frameAssertion;
|
|
142
148
|
}
|
|
143
149
|
|
|
144
|
-
isMetavariablePresentByMetavariableNode(metavariableNode,
|
|
145
|
-
const metavariable = this.findMetavariableByMetavariableNode(metavariableNode,
|
|
150
|
+
isMetavariablePresentByMetavariableNode(metavariableNode, metaLevelLocalContext) {
|
|
151
|
+
const metavariable = this.findMetavariableByMetavariableNode(metavariableNode, metaLevelLocalContext),
|
|
146
152
|
metavariablePresent = (metavariable !== null);
|
|
147
153
|
|
|
148
154
|
return metavariablePresent;
|
|
@@ -163,24 +169,23 @@ class LocalMetaContext extends LocalContext {
|
|
|
163
169
|
metavariables = [],
|
|
164
170
|
metaproofSteps = [],
|
|
165
171
|
frameAssertions = [],
|
|
166
|
-
|
|
172
|
+
metaLevelLocalContext = new MetaLevelLocalContext(context, variables, proofSteps, equivalences, metavariables, metaproofSteps, frameAssertions);
|
|
167
173
|
|
|
168
|
-
return
|
|
174
|
+
return metaLevelLocalContext;
|
|
169
175
|
}
|
|
170
176
|
|
|
171
|
-
static
|
|
172
|
-
const context =
|
|
177
|
+
static fromLocalContext(localContext) {
|
|
178
|
+
const context = localContext, ///
|
|
173
179
|
variables = [],
|
|
174
180
|
proofSteps = [],
|
|
175
181
|
equivalences = [],
|
|
176
182
|
metavariables = [],
|
|
177
183
|
metaproofSteps = [],
|
|
178
|
-
frameAssertions = []
|
|
179
|
-
|
|
180
|
-
localMetaContext = new LocalMetaContext(context, variables, proofSteps, equivalences, metavariables, metaproofSteps, frameAssertions); ///
|
|
184
|
+
frameAssertions = [],
|
|
185
|
+
metaLevelLocalContext = new MetaLevelLocalContext(context, variables, proofSteps, equivalences, metavariables, metaproofSteps, frameAssertions); ///
|
|
181
186
|
|
|
182
|
-
return
|
|
187
|
+
return metaLevelLocalContext;
|
|
183
188
|
}
|
|
184
189
|
}
|
|
185
190
|
|
|
186
|
-
export default
|
|
191
|
+
export default MetaLevelLocalContext;
|
package/src/metaConsequent.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import LocalMetaContext from "./context/localMeta";
|
|
4
3
|
import metaLevelNodesVerifier from "./verifier/nodes/metaLevel";
|
|
4
|
+
import MetaLevelLocalContext from "./context/local/metaLevel";
|
|
5
5
|
|
|
6
6
|
import { nodeAsString } from "./utilities/string";
|
|
7
7
|
import { statementNodeFromStatementString, metastatementNodeFromMetastatementString } from "./utilities/node";
|
|
@@ -20,16 +20,16 @@ export default class MetaConsequent {
|
|
|
20
20
|
return this.statementNode;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
matchMetastatementNode(metastatementNode, substitutions, fileContext,
|
|
23
|
+
matchMetastatementNode(metastatementNode, substitutions, fileContext, localContext) {
|
|
24
24
|
let matchesMetastatementNode = false;
|
|
25
25
|
|
|
26
26
|
if (this.metastatementNode !== null) {
|
|
27
|
-
const
|
|
27
|
+
const metaLevelLocalContext = MetaLevelLocalContext.fromFileContext(fileContext),
|
|
28
|
+
nonTerminalNodeA = this.metastatementNode, ///
|
|
28
29
|
nonTerminalNodeB = metastatementNode, ///
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
nonTerminalNodeVerified = metaLevelNodesVerifier.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, localMetaContextA, localMetaContextB, () => {
|
|
30
|
+
localContextA = metaLevelLocalContext, ///
|
|
31
|
+
localContextB = localContext, ///
|
|
32
|
+
nonTerminalNodeVerified = metaLevelNodesVerifier.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, localContextA, localContextB, () => {
|
|
33
33
|
const verifiedAhead = true;
|
|
34
34
|
|
|
35
35
|
return verifiedAhead;
|
|
@@ -36,15 +36,15 @@ export default class MetaLemmaMetatheorem {
|
|
|
36
36
|
return this.fileContext;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
matchMetastatement(metastatementNode,
|
|
39
|
+
matchMetastatement(metastatementNode, localContext) {
|
|
40
40
|
let metastatementNatches = false;
|
|
41
41
|
|
|
42
|
-
const metaproofSteps =
|
|
42
|
+
const metaproofSteps = localContext.getProofSteps(),
|
|
43
43
|
substitutions = [],
|
|
44
|
-
metaSuppositionsMatch = matchMetaSuppositions(this.metaSuppositions, metaproofSteps, substitutions, this.fileContext,
|
|
44
|
+
metaSuppositionsMatch = matchMetaSuppositions(this.metaSuppositions, metaproofSteps, substitutions, this.fileContext, localContext);
|
|
45
45
|
|
|
46
46
|
if (metaSuppositionsMatch) {
|
|
47
|
-
const metaConsequentMatches = matchMetaConsequent(this.metaConsequent, metastatementNode, substitutions, this.fileContext,
|
|
47
|
+
const metaConsequentMatches = matchMetaConsequent(this.metaConsequent, metastatementNode, substitutions, this.fileContext, localContext);
|
|
48
48
|
|
|
49
49
|
metastatementNatches = metaConsequentMatches; ///
|
|
50
50
|
}
|
|
@@ -143,13 +143,13 @@ export default class MetaLemmaMetatheorem {
|
|
|
143
143
|
static fromLabelsMetaSuppositionsMetaConsequentSubstitutionsAndFileContext(Class, labels, metaSuppositions, metaConsequent, substitutions, fileContext) { return new Class(labels, metaSuppositions, metaConsequent, substitutions, fileContext); }
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
-
function matchMetaSuppositions(metaSuppositions, metaproofSteps, substitutions, fileContext,
|
|
146
|
+
function matchMetaSuppositions(metaSuppositions, metaproofSteps, substitutions, fileContext, localContext) {
|
|
147
147
|
metaSuppositions = reverse(metaSuppositions); ///
|
|
148
148
|
|
|
149
149
|
metaproofSteps = reverse(metaproofSteps); ///
|
|
150
150
|
|
|
151
151
|
const metaSuppositionsMatch = correlate(metaSuppositions, metaproofSteps, (metaSupposition, metaproofStep) => {
|
|
152
|
-
const metaSuppositionMatches = matchMetaSupposition(metaSupposition, metaproofStep, substitutions, fileContext,
|
|
152
|
+
const metaSuppositionMatches = matchMetaSupposition(metaSupposition, metaproofStep, substitutions, fileContext, localContext);
|
|
153
153
|
|
|
154
154
|
if (metaSuppositionMatches) {
|
|
155
155
|
return true;
|
|
@@ -159,20 +159,20 @@ function matchMetaSuppositions(metaSuppositions, metaproofSteps, substitutions,
|
|
|
159
159
|
return metaSuppositionsMatch;
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
function matchMetaSupposition(metaSupposition, metaproofStep, substitutions, fileContext,
|
|
162
|
+
function matchMetaSupposition(metaSupposition, metaproofStep, substitutions, fileContext, localContext) {
|
|
163
163
|
let matchesMetaSupposition = false;
|
|
164
164
|
|
|
165
165
|
const metaSubproofNode = metaproofStep.getMetaSubproofNode(),
|
|
166
166
|
metastatementNode = metaproofStep.getMetastatementNode();
|
|
167
167
|
|
|
168
168
|
if (metaSubproofNode !== null) {
|
|
169
|
-
const metaSuppositionMatchesMetaSubproofNode = metaSupposition.matchMetaSubproofNode(metaSubproofNode, substitutions, fileContext,
|
|
169
|
+
const metaSuppositionMatchesMetaSubproofNode = metaSupposition.matchMetaSubproofNode(metaSubproofNode, substitutions, fileContext, localContext);
|
|
170
170
|
|
|
171
171
|
matchesMetaSupposition - metaSuppositionMatchesMetaSubproofNode; ///
|
|
172
172
|
}
|
|
173
173
|
|
|
174
174
|
if (metastatementNode !== null) {
|
|
175
|
-
const metaSuppositionMatchesMetastatementNode = metaSupposition.matchMetastatementNode(metastatementNode, substitutions, fileContext,
|
|
175
|
+
const metaSuppositionMatchesMetastatementNode = metaSupposition.matchMetastatementNode(metastatementNode, substitutions, fileContext, localContext);
|
|
176
176
|
|
|
177
177
|
matchesMetaSupposition - metaSuppositionMatchesMetastatementNode; ///
|
|
178
178
|
}
|
|
@@ -180,8 +180,8 @@ function matchMetaSupposition(metaSupposition, metaproofStep, substitutions, fil
|
|
|
180
180
|
return matchesMetaSupposition;
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
-
function matchMetaConsequent(metaConsequent, metastatementNode, substitutions, fileContext,
|
|
184
|
-
const metaConsequentMatchesMetastatementNode = metaConsequent.matchMetastatementNode(metastatementNode, substitutions, fileContext,
|
|
183
|
+
function matchMetaConsequent(metaConsequent, metastatementNode, substitutions, fileContext, localContext) {
|
|
184
|
+
const metaConsequentMatchesMetastatementNode = metaConsequent.matchMetastatementNode(metastatementNode, substitutions, fileContext, localContext),
|
|
185
185
|
metaConsequentMatches = metaConsequentMatchesMetastatementNode; ///
|
|
186
186
|
|
|
187
187
|
return metaConsequentMatches;
|
package/src/metaSupposition.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import MetaLevelLocalContext from "./context/local/metaLevel";
|
|
4
4
|
import metaLevelNodesVerifier from "./verifier/nodes/metaLevel";
|
|
5
5
|
|
|
6
6
|
import { match } from "./utilities/array";
|
|
@@ -27,7 +27,7 @@ export default class MetaSupposition {
|
|
|
27
27
|
return this.statementNode;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
matchMetaSubproofNode(metaSubproofNode, substitutions, fileContext,
|
|
30
|
+
matchMetaSubproofNode(metaSubproofNode, substitutions, fileContext, localContext) {
|
|
31
31
|
let matchesMetaSubproofNode = false;
|
|
32
32
|
|
|
33
33
|
if (this.metastatementNode !== null) {
|
|
@@ -43,12 +43,12 @@ export default class MetaSupposition {
|
|
|
43
43
|
subproofAssertionMetastatementNodes = subproofAssertionMetastatementNodesQuery(subproofAssertionNode);
|
|
44
44
|
|
|
45
45
|
matchesMetaSubproofNode = match(subproofAssertionMetastatementNodes, metaSubproofMetastatementNodes, (subproofAssertionMetastatementNode, ruleSubproofMetastatementNode) => {
|
|
46
|
-
const
|
|
46
|
+
const metaLevelLocalContext = MetaLevelLocalContext.fromFileContext(fileContext),
|
|
47
|
+
nonTerminalNodeA = subproofAssertionMetastatementNode, ///
|
|
47
48
|
nonTerminalNodeB = ruleSubproofMetastatementNode, ///
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
nonTerminalNodeVerified = metaLevelNodesVerifier.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, localMetaContextA, localMetaContextB, () => {
|
|
49
|
+
localContextA = metaLevelLocalContext, ///
|
|
50
|
+
localContextB = localContext, ///
|
|
51
|
+
nonTerminalNodeVerified = metaLevelNodesVerifier.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, localContextA, localContextB, () => {
|
|
52
52
|
const verifiedAhead = true;
|
|
53
53
|
|
|
54
54
|
return verifiedAhead;
|
|
@@ -64,16 +64,16 @@ export default class MetaSupposition {
|
|
|
64
64
|
return matchesMetaSubproofNode;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
matchMetastatementNode(metastatementNode, substitutions, fileContext,
|
|
67
|
+
matchMetastatementNode(metastatementNode, substitutions, fileContext, localContext) {
|
|
68
68
|
let matchesMetastatementNode = false;
|
|
69
69
|
|
|
70
70
|
if (this.metastatementNode !== null) {
|
|
71
|
-
const
|
|
71
|
+
const metaLevelLocalContext = MetaLevelLocalContext.fromFileContext(fileContext),
|
|
72
|
+
nonTerminalNodeA = this.metastatementNode, ///
|
|
72
73
|
nonTerminalNodeB = metastatementNode, ///
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
nonTerminalNodeVerified = metaLevelNodesVerifier.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, localMetaContextA, localMetaContextB, () => {
|
|
74
|
+
localContextA = metaLevelLocalContext, ///
|
|
75
|
+
localContextB = localContext, ///
|
|
76
|
+
nonTerminalNodeVerified = metaLevelNodesVerifier.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, localContextA, localContextB, () => {
|
|
77
77
|
const verifiedAhead = true;
|
|
78
78
|
|
|
79
79
|
return verifiedAhead;
|
package/src/metavariable.js
CHANGED
|
@@ -42,7 +42,7 @@ export default class Metavariable {
|
|
|
42
42
|
return matchesName;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
matchNode(node,
|
|
45
|
+
matchNode(node, localContext) {
|
|
46
46
|
let matchesNode = false;
|
|
47
47
|
|
|
48
48
|
const metavariableNode = node, ///
|
|
@@ -59,7 +59,7 @@ export default class Metavariable {
|
|
|
59
59
|
} else if ((termNode === null) && (this.termType === null)) {
|
|
60
60
|
matchesNode = true;
|
|
61
61
|
} else if ((termNode !== null) && (this.termType !== null)) {
|
|
62
|
-
const termVerifiedAgainstTermType = verifyTermAgainstTermType(termNode, this.termType,
|
|
62
|
+
const termVerifiedAgainstTermType = verifyTermAgainstTermType(termNode, this.termType, localContext);
|
|
63
63
|
|
|
64
64
|
matchesNode = termVerifiedAgainstTermType; ///
|
|
65
65
|
}
|
|
@@ -122,12 +122,11 @@ export default class Metavariable {
|
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
-
function verifyTermAgainstTermType(termNode, termType,
|
|
125
|
+
function verifyTermAgainstTermType(termNode, termType, localContext) {
|
|
126
126
|
let termVerifiedAgainstTermType;
|
|
127
127
|
|
|
128
128
|
const type = termType, ///
|
|
129
|
-
terms = []
|
|
130
|
-
localContext = localMetaContext; ///
|
|
129
|
+
terms = [];
|
|
131
130
|
|
|
132
131
|
termVerifiedAgainstTermType = verifyTerm(termNode, terms, localContext, () => {
|
|
133
132
|
let verifiedAhead = false;
|
|
@@ -153,9 +152,9 @@ function termTypeFromMetavariableNode(metavariableNode, fileContext) {
|
|
|
153
152
|
const typeNode = typeNodeQuery(metavariableNode);
|
|
154
153
|
|
|
155
154
|
if (typeNode !== null) {
|
|
156
|
-
|
|
155
|
+
const type = fileContext.findTypeByTypeNode(typeNode);
|
|
157
156
|
|
|
158
|
-
|
|
157
|
+
termType = type; ///
|
|
159
158
|
}
|
|
160
159
|
|
|
161
160
|
return termType;
|
package/src/premise.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import LocalMetaContext from "./context/localMeta";
|
|
3
|
+
import MetaLevelLocalContext from "./context/local/metaLevel";
|
|
5
4
|
import metaLevelNodesVerifier from "./verifier/nodes/metaLevel";
|
|
5
|
+
import IntrinsicLevelLocalContext from "./context/local/intrinsicLevel";
|
|
6
6
|
import intrinsicLevelAgainstMetaLevelNodesVerifier from "./verifier/nodes/intrinsicLevelAgainstMetaLevel";
|
|
7
7
|
|
|
8
8
|
import { match } from "./utilities/array";
|
|
@@ -37,10 +37,10 @@ export default class Premise {
|
|
|
37
37
|
let matchesStatementNode = false;
|
|
38
38
|
|
|
39
39
|
if (this.metastatementNode !== null) {
|
|
40
|
-
const
|
|
40
|
+
const intrinsicLevelLocalContext = IntrinsicLevelLocalContext.fromFileContext(fileContext),
|
|
41
|
+
nonTerminalNodeA = this.metastatementNode, ///
|
|
41
42
|
nonTerminalNodeB = statementNode, ///
|
|
42
|
-
|
|
43
|
-
localContextA = LocalContext.fromFileContext(fileContextA),
|
|
43
|
+
localContextA = intrinsicLevelLocalContext, ///
|
|
44
44
|
localContextB = localContext, ///
|
|
45
45
|
nonTerminalNodeVerified = intrinsicLevelAgainstMetaLevelNodesVerifier.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, localContextA, localContextB, () => {
|
|
46
46
|
const verifiedAhead = true;
|
|
@@ -70,10 +70,10 @@ export default class Premise {
|
|
|
70
70
|
subproofAssertionMetastatementNodes = subproofAssertionMetastatementNodesQuery(subproofAssertionNode);
|
|
71
71
|
|
|
72
72
|
matchesSubproofNode = match(subproofAssertionMetastatementNodes, subproofStatementNodes, (subproofAssertionMetastatementNode, subproofStatementNode) => {
|
|
73
|
-
const
|
|
73
|
+
const metaLevelLocalContext = MetaLevelLocalContext.fromFileContext(fileContext),
|
|
74
|
+
nonTerminalNodeA = subproofAssertionMetastatementNode, ///
|
|
74
75
|
nonTerminalNodeB = subproofStatementNode, ///
|
|
75
|
-
|
|
76
|
-
localContextA = LocalMetaContext.fromFileContext(fileContextA),
|
|
76
|
+
localContextA = metaLevelLocalContext, ///
|
|
77
77
|
localContextB = localContext, ///
|
|
78
78
|
nonTerminalNodeVerified = intrinsicLevelAgainstMetaLevelNodesVerifier.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, localContextA, localContextB, () => {
|
|
79
79
|
const verifiedAhead = true;
|
|
@@ -91,7 +91,7 @@ export default class Premise {
|
|
|
91
91
|
return matchesSubproofNode;
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
matchRuleSubproofNode(ruleSubproofNode, substitutions, fileContext,
|
|
94
|
+
matchRuleSubproofNode(ruleSubproofNode, substitutions, fileContext, localContext) {
|
|
95
95
|
let matchesRuleSubproofNode = false;
|
|
96
96
|
|
|
97
97
|
if (this.metastatementNode !== null) {
|
|
@@ -107,12 +107,12 @@ export default class Premise {
|
|
|
107
107
|
subproofAssertionMetastatementNodes = subproofAssertionMetastatementNodesQuery(subproofAssertionNode);
|
|
108
108
|
|
|
109
109
|
matchesRuleSubproofNode = match(subproofAssertionMetastatementNodes, ruleSubproofMetastatementNodes, (subproofAssertionMetastatementNode, ruleSubproofMetastatementNode) => {
|
|
110
|
-
const
|
|
110
|
+
const metaLevelLocalContext = MetaLevelLocalContext.fromFileContext(fileContext),
|
|
111
|
+
nonTerminalNodeA = subproofAssertionMetastatementNode, ///
|
|
111
112
|
nonTerminalNodeB = ruleSubproofMetastatementNode, ///
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
nonTerminalNodeVerified = metaLevelNodesVerifier.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, localMetaContextA, localMetaContextB, () => {
|
|
113
|
+
localContextA = metaLevelLocalContext, ///
|
|
114
|
+
localContextB = localContext, ///
|
|
115
|
+
nonTerminalNodeVerified = metaLevelNodesVerifier.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, localContextA, localContextB, () => {
|
|
116
116
|
const verifiedAhead = true;
|
|
117
117
|
|
|
118
118
|
return verifiedAhead;
|
|
@@ -128,7 +128,7 @@ export default class Premise {
|
|
|
128
128
|
return matchesRuleSubproofNode;
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
matchMetaSubproofNode(metaSubproofNode, substitutions, fileContext,
|
|
131
|
+
matchMetaSubproofNode(metaSubproofNode, substitutions, fileContext, localContext) {
|
|
132
132
|
let matchesMetaSubproofNode = false;
|
|
133
133
|
|
|
134
134
|
if (this.metastatementNode !== null) {
|
|
@@ -144,12 +144,12 @@ export default class Premise {
|
|
|
144
144
|
subproofAssertionMetastatementNodes = subproofAssertionMetastatementNodesQuery(subproofAssertionNode);
|
|
145
145
|
|
|
146
146
|
matchesMetaSubproofNode = match(subproofAssertionMetastatementNodes, metaSubproofMetastatementNodes, (subproofAssertionMetastatementNode, ruleSubproofMetastatementNode) => {
|
|
147
|
-
const
|
|
147
|
+
const metaLevelLocalContext = MetaLevelLocalContext.fromFileContext(fileContext),
|
|
148
|
+
nonTerminalNodeA = subproofAssertionMetastatementNode, ///
|
|
148
149
|
nonTerminalNodeB = ruleSubproofMetastatementNode, ///
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
nonTerminalNodeVerified = metaLevelNodesVerifier.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, localMetaContextA, localMetaContextB, () => {
|
|
150
|
+
localContextA = metaLevelLocalContext, ///
|
|
151
|
+
localContextB = localContext, ///
|
|
152
|
+
nonTerminalNodeVerified = metaLevelNodesVerifier.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, localContextA, localContextB, () => {
|
|
153
153
|
const verifiedAhead = true;
|
|
154
154
|
|
|
155
155
|
return verifiedAhead;
|
|
@@ -165,16 +165,16 @@ export default class Premise {
|
|
|
165
165
|
return matchesMetaSubproofNode;
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
-
matchMetastatementNode(metastatementNode, substitutions, fileContext,
|
|
168
|
+
matchMetastatementNode(metastatementNode, substitutions, fileContext, localContext) {
|
|
169
169
|
let matchesMetastatementNode = false;
|
|
170
170
|
|
|
171
171
|
if (this.metastatementNode !== null) {
|
|
172
|
-
const
|
|
172
|
+
const metaLevelLocalContext = MetaLevelLocalContext.fromFileContext(fileContext),
|
|
173
|
+
nonTerminalNodeA = this.metastatementNode, ///
|
|
173
174
|
nonTerminalNodeB = metastatementNode, ///
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
nonTerminalNodeVerified = metaLevelNodesVerifier.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, localMetaContextA, localMetaContextB, () => {
|
|
175
|
+
localContextA = metaLevelLocalContext, ///
|
|
176
|
+
localContextB = localContext, ///
|
|
177
|
+
nonTerminalNodeVerified = metaLevelNodesVerifier.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, localContextA, localContextB, () => {
|
|
178
178
|
const verifiedAhead = true;
|
|
179
179
|
|
|
180
180
|
return verifiedAhead;
|
package/src/rule.js
CHANGED
|
@@ -46,15 +46,15 @@ export default class Rule {
|
|
|
46
46
|
return matchesStatement;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
matchMetastatement(metastatementNode,
|
|
49
|
+
matchMetastatement(metastatementNode, localContext) {
|
|
50
50
|
let matchesMetastatement = false;
|
|
51
51
|
|
|
52
|
-
const metaproofSteps =
|
|
52
|
+
const metaproofSteps = localContext.getMetaproofSteps(),
|
|
53
53
|
substitutions = [],
|
|
54
|
-
premisesMatch = metaMatchPremises(this.premises, metaproofSteps, substitutions, this.fileContext,
|
|
54
|
+
premisesMatch = metaMatchPremises(this.premises, metaproofSteps, substitutions, this.fileContext, localContext);
|
|
55
55
|
|
|
56
56
|
if (premisesMatch) {
|
|
57
|
-
const conclusionMatches = metaMatchConclusion(this.conclusion, metastatementNode, substitutions, this.fileContext,
|
|
57
|
+
const conclusionMatches = metaMatchConclusion(this.conclusion, metastatementNode, substitutions, this.fileContext, localContext);
|
|
58
58
|
|
|
59
59
|
matchesMetastatement = conclusionMatches; ///
|
|
60
60
|
}
|
|
@@ -187,7 +187,7 @@ function matchConclusion(conclusion, statementNode, substitutions, fileContext,
|
|
|
187
187
|
return conclusionMatches;
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
-
function metaMatchPremise(premise, metaproofStep, substitutions, fileContext,
|
|
190
|
+
function metaMatchPremise(premise, metaproofStep, substitutions, fileContext, localContext) {
|
|
191
191
|
let premiseMatches = false;
|
|
192
192
|
|
|
193
193
|
const ruleSubproofNode = metaproofStep.getRuleSubproofNode(),
|
|
@@ -195,19 +195,19 @@ function metaMatchPremise(premise, metaproofStep, substitutions, fileContext, lo
|
|
|
195
195
|
metastatementNode = metaproofStep.getMetastatementNode()
|
|
196
196
|
|
|
197
197
|
if (ruleSubproofNode !== null) {
|
|
198
|
-
const premiseMatchesRuleSubproofNode = premise.matchRuleSubproofNode(ruleSubproofNode, substitutions, fileContext,
|
|
198
|
+
const premiseMatchesRuleSubproofNode = premise.matchRuleSubproofNode(ruleSubproofNode, substitutions, fileContext, localContext);
|
|
199
199
|
|
|
200
200
|
premiseMatches = premiseMatchesRuleSubproofNode; ///
|
|
201
201
|
}
|
|
202
202
|
|
|
203
203
|
if (metaSubproofNode !== null) {
|
|
204
|
-
const premiseMatchesMetaSubproofNode = premise.matchMetaSubproofNode(metaSubproofNode, substitutions, fileContext,
|
|
204
|
+
const premiseMatchesMetaSubproofNode = premise.matchMetaSubproofNode(metaSubproofNode, substitutions, fileContext, localContext);
|
|
205
205
|
|
|
206
206
|
premiseMatches = premiseMatchesMetaSubproofNode; ///
|
|
207
207
|
}
|
|
208
208
|
|
|
209
209
|
if (metastatementNode !== null) {
|
|
210
|
-
const premiseMatchesMetastatementNode = premise.matchMetastatementNode(metastatementNode, substitutions, fileContext,
|
|
210
|
+
const premiseMatchesMetastatementNode = premise.matchMetastatementNode(metastatementNode, substitutions, fileContext, localContext);
|
|
211
211
|
|
|
212
212
|
premiseMatches = premiseMatchesMetastatementNode; ///
|
|
213
213
|
}
|
|
@@ -215,13 +215,13 @@ function metaMatchPremise(premise, metaproofStep, substitutions, fileContext, lo
|
|
|
215
215
|
return premiseMatches;
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
-
function metaMatchPremises(premises, metaproofSteps, substitutions, fileContext,
|
|
218
|
+
function metaMatchPremises(premises, metaproofSteps, substitutions, fileContext, localContext) {
|
|
219
219
|
premises = reverse(premises); ///
|
|
220
220
|
|
|
221
221
|
metaproofSteps = reverse(metaproofSteps); ///
|
|
222
222
|
|
|
223
223
|
const premisesMatch = correlate(premises, metaproofSteps, (premise, metaproofStep) => {
|
|
224
|
-
const premiseMatches = metaMatchPremise(premise, metaproofStep, substitutions, fileContext,
|
|
224
|
+
const premiseMatches = metaMatchPremise(premise, metaproofStep, substitutions, fileContext, localContext);
|
|
225
225
|
|
|
226
226
|
if (premiseMatches) {
|
|
227
227
|
return true;
|
|
@@ -231,8 +231,8 @@ function metaMatchPremises(premises, metaproofSteps, substitutions, fileContext,
|
|
|
231
231
|
return premisesMatch;
|
|
232
232
|
}
|
|
233
233
|
|
|
234
|
-
function metaMatchConclusion(conclusion, metastatementNode, substitutions, fileContext,
|
|
235
|
-
const conclusionMatchesMetastatementNode = conclusion.matchMetastatementNode(metastatementNode, substitutions, fileContext,
|
|
234
|
+
function metaMatchConclusion(conclusion, metastatementNode, substitutions, fileContext, localContext) {
|
|
235
|
+
const conclusionMatchesMetastatementNode = conclusion.matchMetastatementNode(metastatementNode, substitutions, fileContext, localContext),
|
|
236
236
|
conclusionMatches = conclusionMatchesMetastatementNode; ///
|
|
237
237
|
|
|
238
238
|
return conclusionMatches;
|
|
@@ -13,18 +13,18 @@ const termNodeQuery = nodeQuery("/term!"),
|
|
|
13
13
|
nonTerminalNodeQuery = nodeQuery("/*"),
|
|
14
14
|
metavariableNodeQuery = nodeQuery("/metavariable!");
|
|
15
15
|
|
|
16
|
-
class
|
|
17
|
-
verifyNonTerminalNode(nonTerminalNode,
|
|
16
|
+
class MetaLevelNodeVerifier extends NodeVerifier {
|
|
17
|
+
verifyNonTerminalNode(nonTerminalNode, localContext, verifyAhead) {
|
|
18
18
|
let nonTerminalNodeVerified;
|
|
19
19
|
|
|
20
20
|
const nodeQueryMaps = [
|
|
21
21
|
{
|
|
22
22
|
nodeQuery: termNodeQuery,
|
|
23
|
-
verifyNode: (node,
|
|
23
|
+
verifyNode: (node, localContext, verifyAhead) => {
|
|
24
24
|
let nonTerminalNodeVerified;
|
|
25
25
|
|
|
26
26
|
const termNode = node, ///
|
|
27
|
-
termNodeVerified = this.verifyTermNode(termNode,
|
|
27
|
+
termNodeVerified = this.verifyTermNode(termNode, localContext, verifyAhead);
|
|
28
28
|
|
|
29
29
|
nonTerminalNodeVerified = termNodeVerified; ///
|
|
30
30
|
|
|
@@ -33,11 +33,11 @@ class MetastatementNodeVerifier extends NodeVerifier {
|
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
35
|
nodeQuery: variableNodeQuery,
|
|
36
|
-
verifyNode: (node,
|
|
36
|
+
verifyNode: (node, localContext, verifyAhead) => {
|
|
37
37
|
let nonTerminalNodeVerified;
|
|
38
38
|
|
|
39
39
|
const variableNode = node, ///
|
|
40
|
-
variableNodeVerified = this.verifyVariableNode(variableNode,
|
|
40
|
+
variableNodeVerified = this.verifyVariableNode(variableNode, localContext, verifyAhead);
|
|
41
41
|
|
|
42
42
|
nonTerminalNodeVerified = variableNodeVerified; ///
|
|
43
43
|
|
|
@@ -46,11 +46,11 @@ class MetastatementNodeVerifier extends NodeVerifier {
|
|
|
46
46
|
},
|
|
47
47
|
{
|
|
48
48
|
nodeQuery: metavariableNodeQuery,
|
|
49
|
-
verifyNode: (node,
|
|
49
|
+
verifyNode: (node, localContext, verifyAhead) => {
|
|
50
50
|
let nonTerminalNodeVerified;
|
|
51
51
|
|
|
52
52
|
const metavariableNode = node, ///
|
|
53
|
-
metavariableNodeVerified = this.verifyMetavariableNode(metavariableNode,
|
|
53
|
+
metavariableNodeVerified = this.verifyMetavariableNode(metavariableNode, localContext, verifyAhead);
|
|
54
54
|
|
|
55
55
|
nonTerminalNodeVerified = metavariableNodeVerified; ///
|
|
56
56
|
|
|
@@ -59,51 +59,49 @@ class MetastatementNodeVerifier extends NodeVerifier {
|
|
|
59
59
|
},
|
|
60
60
|
{
|
|
61
61
|
nodeQuery: nonTerminalNodeQuery,
|
|
62
|
-
verifyNode: (node,
|
|
62
|
+
verifyNode: (node, localContext, verifyAhead) => {
|
|
63
63
|
let nonTerminalNodeVerified;
|
|
64
64
|
|
|
65
65
|
const nonTerminalNode = node; ///
|
|
66
66
|
|
|
67
67
|
nonTerminalNodeVerified =
|
|
68
68
|
|
|
69
|
-
super.verifyNonTerminalNode(nonTerminalNode,
|
|
69
|
+
super.verifyNonTerminalNode(nonTerminalNode, localContext, verifyAhead);
|
|
70
70
|
|
|
71
71
|
return nonTerminalNodeVerified;
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
];
|
|
75
75
|
|
|
76
|
-
const nodeVerified = verifyNode(nodeQueryMaps, nonTerminalNode,
|
|
76
|
+
const nodeVerified = verifyNode(nodeQueryMaps, nonTerminalNode, localContext, verifyAhead);
|
|
77
77
|
|
|
78
78
|
nonTerminalNodeVerified = nodeVerified; ///
|
|
79
79
|
|
|
80
80
|
return nonTerminalNodeVerified;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
verifyMetavariableNode(metavariableNode,
|
|
84
|
-
const standaloneMetavariableVerified = verifyStandaloneMetavariable(metavariableNode,
|
|
83
|
+
verifyMetavariableNode(metavariableNode, localContext, verifyAhead) {
|
|
84
|
+
const standaloneMetavariableVerified = verifyStandaloneMetavariable(metavariableNode, localContext, verifyAhead),
|
|
85
85
|
metavariableNodeVerified = standaloneMetavariableVerified; ///
|
|
86
86
|
|
|
87
87
|
return metavariableNodeVerified;
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
verifyVariableNode(variableNode,
|
|
91
|
-
const
|
|
92
|
-
standaloneVariableVerified = verifyStandaloneVariable(variableNode, localContext, verifyAhead),
|
|
90
|
+
verifyVariableNode(variableNode, localContext, verifyAhead) {
|
|
91
|
+
const standaloneVariableVerified = verifyStandaloneVariable(variableNode, localContext, verifyAhead),
|
|
93
92
|
variableNodeVerified = standaloneVariableVerified; ///
|
|
94
93
|
|
|
95
94
|
return variableNodeVerified;
|
|
96
95
|
}
|
|
97
96
|
|
|
98
|
-
verifyTermNode(termNode,
|
|
99
|
-
const
|
|
100
|
-
standaloneTermVerified = verifyStandaloneTerm(termNode, localContext, verifyAhead),
|
|
97
|
+
verifyTermNode(termNode, localContext, verifyAhead) {
|
|
98
|
+
const standaloneTermVerified = verifyStandaloneTerm(termNode, localContext, verifyAhead),
|
|
101
99
|
termNodeVerified = standaloneTermVerified; ///
|
|
102
100
|
|
|
103
101
|
return termNodeVerified;
|
|
104
102
|
}
|
|
105
103
|
}
|
|
106
104
|
|
|
107
|
-
const
|
|
105
|
+
const metaLevelNodeVerifier = new MetaLevelNodeVerifier();
|
|
108
106
|
|
|
109
|
-
export default
|
|
107
|
+
export default metaLevelNodeVerifier;
|