occam-verify-cli 0.0.538 → 0.0.540
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/bin/action/verify.js +7 -24
- package/bin/actions.js +20 -6
- package/lib/axiom.js +7 -7
- package/lib/axiomLemmaTheoremConjecture.js +33 -30
- package/lib/combinator.js +4 -4
- package/lib/conclusion.js +8 -8
- package/lib/conjecture.js +7 -7
- package/lib/consequence.js +3 -3
- package/lib/constructor.js +6 -6
- package/lib/context/file.js +215 -45
- package/lib/context/metaproof.js +3 -3
- package/lib/context/release.js +215 -2
- package/lib/kinds.js +13 -1
- package/lib/label.js +4 -4
- package/lib/lemma.js +7 -7
- package/lib/metaType.js +201 -0
- package/lib/metavariable.js +81 -0
- package/lib/premise.js +12 -12
- package/lib/rule.js +42 -35
- package/lib/ruleNames.js +16 -4
- package/lib/supposition.js +8 -8
- package/lib/theorem.js +7 -7
- package/lib/type.js +7 -7
- package/lib/utilities/node.js +17 -3
- package/lib/utilities/query.js +13 -2
- package/lib/variable.js +18 -12
- package/lib/verifier/metastatementForMetavariable.js +8 -8
- package/lib/verifier/statementForMetavariable.js +9 -9
- package/lib/verifier/termForVariable.js +22 -11
- package/lib/verifier.js +1 -1
- package/lib/verify/assertion/type.js +2 -2
- package/lib/verify/axiom.js +2 -2
- package/lib/verify/conjecture.js +2 -2
- package/lib/verify/declaration/metavariable.js +26 -0
- package/lib/verify/declaration/topLevel.js +7 -3
- package/lib/verify/lemma.js +2 -2
- package/lib/verify/metastatement/qualified.js +3 -3
- package/lib/verify/metastatement.js +147 -3
- package/lib/verify/metavariable.js +34 -0
- package/lib/verify/rule.js +2 -2
- package/lib/verify/statement/qualified.js +7 -7
- package/lib/verify/statement.js +6 -6
- package/lib/verify/theorem.js +2 -2
- package/lib/verify/variable.js +4 -4
- package/package.json +3 -3
- package/src/axiom.js +2 -2
- package/src/axiomLemmaTheoremConjecture.js +31 -32
- package/src/combinator.js +3 -3
- package/src/conclusion.js +11 -7
- package/src/conjecture.js +2 -2
- package/src/consequence.js +2 -2
- package/src/constructor.js +5 -5
- package/src/context/file.js +248 -45
- package/src/context/metaproof.js +1 -1
- package/src/context/release.js +254 -2
- package/src/kinds.js +3 -0
- package/src/label.js +3 -3
- package/src/lemma.js +2 -2
- package/src/metaType.js +81 -0
- package/src/metavariable.js +39 -0
- package/src/premise.js +19 -11
- package/src/rule.js +37 -32
- package/src/ruleNames.js +4 -1
- package/src/supposition.js +11 -7
- package/src/theorem.js +2 -2
- package/src/type.js +5 -5
- package/src/utilities/node.js +32 -2
- package/src/utilities/query.js +14 -0
- package/src/variable.js +12 -8
- package/src/verifier/metastatementForMetavariable.js +7 -7
- package/src/verifier/statementForMetavariable.js +8 -8
- package/src/verifier/termForVariable.js +33 -13
- package/src/verifier.js +1 -1
- package/src/verify/assertion/type.js +3 -3
- package/src/verify/axiom.js +1 -1
- package/src/verify/conjecture.js +2 -1
- package/src/verify/declaration/metavariable.js +20 -0
- package/src/verify/declaration/topLevel.js +9 -2
- package/src/verify/lemma.js +1 -1
- package/src/verify/metastatement/qualified.js +3 -2
- package/src/verify/metastatement.js +65 -2
- package/src/verify/metavariable.js +32 -0
- package/src/verify/rule.js +1 -1
- package/src/verify/statement/qualified.js +7 -6
- package/src/verify/statement.js +14 -14
- package/src/verify/theorem.js +2 -1
- package/src/verify/variable.js +4 -4
- package/lib/context/release/directory.js +0 -313
- package/lib/context/release/file.js +0 -387
- package/src/context/release/directory.js +0 -251
- package/src/context/release/file.js +0 -312
package/src/context/release.js
CHANGED
|
@@ -2,13 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
import { lexersUtilities, parsersUtilities } from "occam-custom-grammars";
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import FileContext from "./file";
|
|
6
|
+
|
|
7
|
+
import { push } from "../utilities/array";
|
|
8
|
+
import { customGrammarFromNameAndEntries, combinedCustomGrammarFromReleaseContexts } from "../utilities/customGrammar";
|
|
6
9
|
|
|
7
10
|
const { florenceLexerFromCombinedCustomGrammar } = lexersUtilities,
|
|
8
11
|
{ florenceParserFromCombinedCustomGrammar } = parsersUtilities;
|
|
9
12
|
|
|
10
13
|
export default class ReleaseContext {
|
|
11
|
-
constructor(log, name, entries, lexer, parser, verified, customGrammar, dependencyReleaseContexts) {
|
|
14
|
+
constructor(log, name, entries, lexer, parser, verified, customGrammar, fileContexts, dependencyReleaseContexts) {
|
|
12
15
|
this.log = log;
|
|
13
16
|
this.name = name;
|
|
14
17
|
this.entries = entries;
|
|
@@ -16,6 +19,7 @@ export default class ReleaseContext {
|
|
|
16
19
|
this.parser = parser;
|
|
17
20
|
this.verified = verified;
|
|
18
21
|
this.customGrammar = customGrammar;
|
|
22
|
+
this.fileContexts = fileContexts;
|
|
19
23
|
this.dependencyReleaseContexts = dependencyReleaseContexts;
|
|
20
24
|
}
|
|
21
25
|
|
|
@@ -47,10 +51,223 @@ export default class ReleaseContext {
|
|
|
47
51
|
return this.customGrammar;
|
|
48
52
|
}
|
|
49
53
|
|
|
54
|
+
getFileContexts() {
|
|
55
|
+
return this.fileContexts;
|
|
56
|
+
}
|
|
57
|
+
|
|
50
58
|
getDependencyReleaseContexts() {
|
|
51
59
|
return this.dependencyReleaseContexts;
|
|
52
60
|
}
|
|
53
61
|
|
|
62
|
+
getLabels(includeDependencies = true) {
|
|
63
|
+
const labels = [];
|
|
64
|
+
|
|
65
|
+
this.fileContexts.forEach((fileContext) => {
|
|
66
|
+
const includeRelease = false,
|
|
67
|
+
fileContextLabels = fileContext.getLabels(includeRelease);
|
|
68
|
+
|
|
69
|
+
push(labels, fileContextLabels);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
if (includeDependencies) {
|
|
73
|
+
const dependencyReleaseContexts = this.getDependencyReleaseContexts();
|
|
74
|
+
|
|
75
|
+
dependencyReleaseContexts.forEach((releaseContext) => {
|
|
76
|
+
const includeDependencies = false,
|
|
77
|
+
releaseContextLabels = releaseContext.getLabels(includeDependencies);
|
|
78
|
+
|
|
79
|
+
push(labels, releaseContextLabels);
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return labels;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
getTypes(includeDependencies = true) {
|
|
87
|
+
const types = [];
|
|
88
|
+
|
|
89
|
+
this.fileContexts.forEach((fileContext) => {
|
|
90
|
+
const includeRelease = false,
|
|
91
|
+
fileContextTypes = fileContext.getTypes(includeRelease);
|
|
92
|
+
|
|
93
|
+
push(types, fileContextTypes);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
if (includeDependencies) {
|
|
97
|
+
const dependencyReleaseContexts = this.getDependencyReleaseContexts();
|
|
98
|
+
|
|
99
|
+
dependencyReleaseContexts.forEach((releaseContext) => {
|
|
100
|
+
const includeDependencies = false,
|
|
101
|
+
releaseContextTypes = releaseContext.getTypes(includeDependencies);
|
|
102
|
+
|
|
103
|
+
push(types, releaseContextTypes);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return types;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
getRules(includeDependencies = true) {
|
|
111
|
+
const rules = [];
|
|
112
|
+
|
|
113
|
+
this.fileContexts.forEach((fileContext) => {
|
|
114
|
+
const includeRelease = false,
|
|
115
|
+
fileContextRules = fileContext.getRules(includeRelease);
|
|
116
|
+
|
|
117
|
+
push(rules, fileContextRules);
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
if (includeDependencies) {
|
|
121
|
+
const dependencyReleaseContexts = this.getDependencyReleaseContexts();
|
|
122
|
+
|
|
123
|
+
dependencyReleaseContexts.forEach((releaseContext) => {
|
|
124
|
+
const includeDependencies = false,
|
|
125
|
+
releaseContextRules = releaseContext.getRules(includeDependencies);
|
|
126
|
+
|
|
127
|
+
push(rules, releaseContextRules);
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return rules;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
getAxioms(includeDependencies = true) {
|
|
135
|
+
const axioms = [];
|
|
136
|
+
|
|
137
|
+
this.fileContexts.forEach((fileContext) => {
|
|
138
|
+
const includeRelease = false,
|
|
139
|
+
fileContextAxioms = fileContext.getAxioms(includeRelease);
|
|
140
|
+
|
|
141
|
+
push(axioms, fileContextAxioms);
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
if (includeDependencies) {
|
|
145
|
+
const dependencyReleaseContexts = this.getDependencyReleaseContexts();
|
|
146
|
+
|
|
147
|
+
dependencyReleaseContexts.forEach((releaseContext) => {
|
|
148
|
+
const includeDependencies = false,
|
|
149
|
+
releaseContextAxioms = releaseContext.getAxioms(includeDependencies);
|
|
150
|
+
|
|
151
|
+
push(axioms, releaseContextAxioms);
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return axioms;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
getLemmas(includeDependencies = true) {
|
|
159
|
+
const lemmas = [];
|
|
160
|
+
|
|
161
|
+
this.fileContexts.forEach((fileContext) => {
|
|
162
|
+
const includeRelease = false,
|
|
163
|
+
fileContextLemmas = fileContext.getLemmas(includeRelease);
|
|
164
|
+
|
|
165
|
+
push(lemmas, fileContextLemmas);
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
return lemmas;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
getTheorems(includeDependencies = true) {
|
|
172
|
+
const theorems = [];
|
|
173
|
+
|
|
174
|
+
this.fileContexts.forEach((fileContext) => {
|
|
175
|
+
const includeRelease = false,
|
|
176
|
+
fileContextTheorems = fileContext.getTheorems(includeRelease);
|
|
177
|
+
|
|
178
|
+
push(theorems, fileContextTheorems);
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
if (includeDependencies) {
|
|
182
|
+
const dependencyReleaseContexts = this.getDependencyReleaseContexts();
|
|
183
|
+
|
|
184
|
+
dependencyReleaseContexts.forEach((releaseContext) => {
|
|
185
|
+
const includeDependencies = false,
|
|
186
|
+
releaseContextTheorems = releaseContext.getTheorems(includeDependencies);
|
|
187
|
+
|
|
188
|
+
push(theorems, releaseContextTheorems);
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
return theorems;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
getConjectures(includeDependencies = true) {
|
|
196
|
+
const conjectures = [];
|
|
197
|
+
|
|
198
|
+
this.fileContexts.forEach((fileContext) => {
|
|
199
|
+
const includeRelease = false,
|
|
200
|
+
fileContextConjectures = fileContext.getConjectures(includeRelease);
|
|
201
|
+
|
|
202
|
+
push(conjectures, fileContextConjectures);
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
if (includeDependencies) {
|
|
206
|
+
const dependencyReleaseContexts = this.getDependencyReleaseContexts();
|
|
207
|
+
|
|
208
|
+
dependencyReleaseContexts.forEach((releaseContext) => {
|
|
209
|
+
const includeDependencies = false,
|
|
210
|
+
releaseContextConjectures = releaseContext.getConjectures(includeDependencies);
|
|
211
|
+
|
|
212
|
+
push(conjectures, releaseContextConjectures);
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
return conjectures;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
getCombinators(includeDependencies = true) {
|
|
220
|
+
const combinators = [];
|
|
221
|
+
|
|
222
|
+
this.fileContexts.forEach((fileContext) => {
|
|
223
|
+
const includeRelease = false,
|
|
224
|
+
fileContextCombinators = fileContext.getCombinators(includeRelease);
|
|
225
|
+
|
|
226
|
+
push(combinators, fileContextCombinators);
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
if (includeDependencies) {
|
|
230
|
+
const dependencyReleaseContexts = this.getDependencyReleaseContexts();
|
|
231
|
+
|
|
232
|
+
dependencyReleaseContexts.forEach((releaseContext) => {
|
|
233
|
+
const includeDependencies = false,
|
|
234
|
+
releaseContextCombinators = releaseContext.getCombinators(includeDependencies);
|
|
235
|
+
|
|
236
|
+
push(combinators, releaseContextCombinators);
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
return combinators;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
getConstructors(includeDependencies = true) {
|
|
244
|
+
const constructors = [];
|
|
245
|
+
|
|
246
|
+
this.fileContexts.forEach((fileContext) => {
|
|
247
|
+
const includeRelease = false,
|
|
248
|
+
fileContextConstructors = fileContext.getConstructors(includeRelease);
|
|
249
|
+
|
|
250
|
+
push(constructors, fileContextConstructors);
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
if (includeDependencies) {
|
|
254
|
+
const dependencyReleaseContexts = this.getDependencyReleaseContexts();
|
|
255
|
+
|
|
256
|
+
dependencyReleaseContexts.forEach((releaseContext) => {
|
|
257
|
+
const includeDependencies = false,
|
|
258
|
+
releaseContextConstructors = releaseContext.getConstructors(includeDependencies);
|
|
259
|
+
|
|
260
|
+
push(constructors, releaseContextConstructors);
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
return constructors;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
addFileContext(fileContext) {
|
|
268
|
+
this.fileContexts.push(fileContext);
|
|
269
|
+
}
|
|
270
|
+
|
|
54
271
|
findTypeByTypeName(typeName) {
|
|
55
272
|
const types = this.getTypes(),
|
|
56
273
|
type = types.find((type) => {
|
|
@@ -123,4 +340,39 @@ export default class ReleaseContext {
|
|
|
123
340
|
|
|
124
341
|
this.dependencyReleaseContexts = dependencyReleaseContexts;
|
|
125
342
|
}
|
|
343
|
+
|
|
344
|
+
toJSON() {
|
|
345
|
+
const json = [];
|
|
346
|
+
|
|
347
|
+
this.fileContexts.forEach((fileContext) => {
|
|
348
|
+
const fileContextJSON = fileContext.toJSON();
|
|
349
|
+
|
|
350
|
+
push(json, fileContextJSON);
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
return json;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
fromJSON(json) {
|
|
357
|
+
const fileContextsJSON = json; ///
|
|
358
|
+
|
|
359
|
+
this.fileContexts = fileContextsJSON.map((fileContextJSON) => {
|
|
360
|
+
const json = fileContextJSON, ///
|
|
361
|
+
fileContext = FileContext.fromJSON(json);
|
|
362
|
+
|
|
363
|
+
return fileContext;
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
static fromLogNameAndEntries(log, name, entries) {
|
|
368
|
+
const lexer = null,
|
|
369
|
+
parser = null,
|
|
370
|
+
verified = false,
|
|
371
|
+
customGrammar = customGrammarFromNameAndEntries(name, entries),
|
|
372
|
+
fileContexts = null,
|
|
373
|
+
dependencyReleaseContexts = null,
|
|
374
|
+
releaseContext = new ReleaseContext(log, name, entries, lexer, parser, verified, customGrammar, fileContexts, dependencyReleaseContexts);
|
|
375
|
+
|
|
376
|
+
return releaseContext;
|
|
377
|
+
}
|
|
126
378
|
}
|
package/src/kinds.js
CHANGED
|
@@ -5,6 +5,9 @@ export const RULE_KIND = "rule";
|
|
|
5
5
|
export const AXIOM_KIND = "axiom";
|
|
6
6
|
export const LEMMA_KIND = "lemma";
|
|
7
7
|
export const THEOREM_KIND = "theorem";
|
|
8
|
+
export const VARIABLE_KIND = "variable";
|
|
9
|
+
export const META_TYPE_KIND = "meta-type";
|
|
8
10
|
export const CONJECTURE_KIND = "conjecture";
|
|
9
11
|
export const COMBINATOR_KIND = "combinator";
|
|
10
12
|
export const CONSTRUCTOR_KIND = "constructor";
|
|
13
|
+
export const METAVARIABLE_KIND = "metavariable";
|
package/src/label.js
CHANGED
|
@@ -34,10 +34,10 @@ export default class Label {
|
|
|
34
34
|
return json;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
static
|
|
37
|
+
static fromJSONAndFileContext(json, fileContext) {
|
|
38
38
|
const labelString = json, ///
|
|
39
|
-
lexer =
|
|
40
|
-
parser =
|
|
39
|
+
lexer = fileContext.getLexer(),
|
|
40
|
+
parser = fileContext.getParser(),
|
|
41
41
|
labelNode = labelNodeFromLabelString(labelString, lexer, parser),
|
|
42
42
|
node = labelNode, ///
|
|
43
43
|
label = new Label(node);
|
package/src/lemma.js
CHANGED
|
@@ -7,7 +7,7 @@ import { LEMMA_KIND } from "./kinds";
|
|
|
7
7
|
export default class Lemma extends AxiomLemmaTheoremConjecture {
|
|
8
8
|
static kind = LEMMA_KIND;
|
|
9
9
|
|
|
10
|
-
static
|
|
10
|
+
static fromJSONAndFileContext(json, fileContext) { return AxiomLemmaTheoremConjecture.fromJSONAndFileContext(Lemma,json, fileContext); }
|
|
11
11
|
|
|
12
|
-
static
|
|
12
|
+
static fromLabelsSuppositionsConsequenceAndProofContext(labels, suppositions, consequence, proofContext) { return AxiomLemmaTheoremConjecture.fromLabelsSuppositionsConsequenceAndProofContext(Lemma, labels, suppositions, consequence, proofContext); }
|
|
13
13
|
}
|
package/src/metaType.js
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { META_TYPE_KIND } from "./kinds";
|
|
4
|
+
import { STATEMENT_META_TYPE_NAME } from "./metaTypeNames";
|
|
5
|
+
|
|
6
|
+
export default class MetaType {
|
|
7
|
+
constructor(name) {
|
|
8
|
+
this.name = name;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
getName() {
|
|
12
|
+
return this.name;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
isEqualTo(metaType) {
|
|
16
|
+
const equalTo = (this === metaType);
|
|
17
|
+
|
|
18
|
+
return equalTo;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
match(metaType) {
|
|
22
|
+
const equalToMetaType = this.isEqualTo(metaType),
|
|
23
|
+
matches = equalToMetaType; ///
|
|
24
|
+
|
|
25
|
+
return matches;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
matchName(name) {
|
|
29
|
+
const matchesName = (this.name === name);
|
|
30
|
+
|
|
31
|
+
return matchesName;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
matchMetaTypeName(metaTypeName) {
|
|
35
|
+
const matchesMetaTypeName = (this.name === metaTypeName);
|
|
36
|
+
|
|
37
|
+
return matchesMetaTypeName;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
asString(tokens) {
|
|
41
|
+
const string = `${this.name}`;
|
|
42
|
+
|
|
43
|
+
return string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
toJSON(tokens) {
|
|
47
|
+
const kind = META_TYPE_KIND,
|
|
48
|
+
name = this.name,
|
|
49
|
+
json = {
|
|
50
|
+
kind,
|
|
51
|
+
name
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
return json;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
static fromJSON(json, context) {
|
|
58
|
+
const { name } = json,
|
|
59
|
+
metaType = new MetaType(name);
|
|
60
|
+
|
|
61
|
+
return metaType;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
static fromMetaTypeName(metaTypeName) {
|
|
65
|
+
const name = metaTypeName, ///
|
|
66
|
+
metaType = new MetaType(name);
|
|
67
|
+
|
|
68
|
+
return metaType;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
class StatementMetaType extends MetaType {
|
|
73
|
+
static fromNothing() {
|
|
74
|
+
const name = STATEMENT_META_TYPE_NAME,
|
|
75
|
+
objectMetaType = new StatementMetaType(name);
|
|
76
|
+
|
|
77
|
+
return objectMetaType;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export const statementMetaType = StatementMetaType.fromNothing();
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export default class Metavariable {
|
|
4
|
+
constructor(name, metaType) {
|
|
5
|
+
this.name = name;
|
|
6
|
+
this.metaType = metaType;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
getName() {
|
|
10
|
+
return this.name;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
getMetaType() {
|
|
14
|
+
return this.metaType;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
matchName(name) {
|
|
18
|
+
const matchesName = (this.name === name);
|
|
19
|
+
|
|
20
|
+
return matchesName;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
asString(tokens) {
|
|
24
|
+
const metaTypeName = this.metaType.getName(),
|
|
25
|
+
string = `${this.name}:${metaTypeName}`;
|
|
26
|
+
|
|
27
|
+
return string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static fromJSONAndFileContext(json, fileContext) {
|
|
31
|
+
debugger
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
static fromNameAndMetaType(name, metaType) {
|
|
35
|
+
const metavariable = new Metavariable(name, metaType);
|
|
36
|
+
|
|
37
|
+
return metavariable;
|
|
38
|
+
}
|
|
39
|
+
}
|
package/src/premise.js
CHANGED
|
@@ -22,7 +22,7 @@ export default class Premise {
|
|
|
22
22
|
return this.metastatementNode;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
matchSubproofNode(subproofNode, substitutions) {
|
|
25
|
+
matchSubproofNode(subproofNode, substitutions, fileContext, statementProofContext) {
|
|
26
26
|
let subproofNodeMatches = false;
|
|
27
27
|
|
|
28
28
|
const subproofAssertionNode = ruleSubproofAssertionNodeQuery(this.metastatementNode);
|
|
@@ -43,7 +43,9 @@ export default class Premise {
|
|
|
43
43
|
const subproofStatementNode = subproofStatementNodes[index],
|
|
44
44
|
nonTerminalNodeA = ruleSubproofAssertionMetastatementNode, ///
|
|
45
45
|
nonTerminalNodeB = subproofStatementNode, ///
|
|
46
|
-
|
|
46
|
+
fileContextA = fileContext, ///
|
|
47
|
+
proofContextB = statementProofContext, ///
|
|
48
|
+
nonTerminalNodeVerified = premiseStatementForMetavariableVerifier.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, fileContextA, proofContextB);
|
|
47
49
|
|
|
48
50
|
if (nonTerminalNodeVerified) {
|
|
49
51
|
return true;
|
|
@@ -55,16 +57,18 @@ export default class Premise {
|
|
|
55
57
|
return subproofNodeMatches;
|
|
56
58
|
}
|
|
57
59
|
|
|
58
|
-
matchStatementNode(statementNode, substitutions) {
|
|
60
|
+
matchStatementNode(statementNode, substitutions, fileContext, statementProofContext) {
|
|
59
61
|
const nonTerminalNodeA = this.metastatementNode, ///
|
|
60
62
|
nonTerminalNodeB = statementNode, ///
|
|
61
|
-
|
|
63
|
+
fileContextA = fileContext, ///
|
|
64
|
+
proofContextB = statementProofContext, ///
|
|
65
|
+
nonTerminalNodeVerified = premiseStatementForMetavariableVerifier.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, fileContextA, proofContextB),
|
|
62
66
|
statementNodeMatches = nonTerminalNodeVerified; ///
|
|
63
67
|
|
|
64
68
|
return statementNodeMatches;
|
|
65
69
|
}
|
|
66
70
|
|
|
67
|
-
matchRuleSubproofNode(ruleSubproofNode, substitutions) {
|
|
71
|
+
matchRuleSubproofNode(ruleSubproofNode, substitutions, fileContext, metastatementMetaproofContext) {
|
|
68
72
|
let ruleSubproofNodeMatches = false;
|
|
69
73
|
|
|
70
74
|
const ruleSubproofAssertionNode = ruleSubproofAssertionNodeQuery(this.metastatementNode);
|
|
@@ -85,7 +89,9 @@ export default class Premise {
|
|
|
85
89
|
const ruleSubproofMetastatementNode = ruleSubproofMetastatementNodes[index],
|
|
86
90
|
nonTerminalNodeA = ruleSubproofAssertionMetastatementNode, ///
|
|
87
91
|
nonTerminalNodeB = ruleSubproofMetastatementNode, ///
|
|
88
|
-
|
|
92
|
+
fileContextA = fileContext, ///
|
|
93
|
+
metaproofContextB = metastatementMetaproofContext, ///
|
|
94
|
+
nonTerminalNodeVerified = premiseMetastatementForMetavariableVerifier.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, fileContextA, metaproofContextB);
|
|
89
95
|
|
|
90
96
|
if (nonTerminalNodeVerified) {
|
|
91
97
|
return true;
|
|
@@ -97,10 +103,12 @@ export default class Premise {
|
|
|
97
103
|
return ruleSubproofNodeMatches;
|
|
98
104
|
}
|
|
99
105
|
|
|
100
|
-
matchMetastatementNode(metastatementNode, substitutions) {
|
|
106
|
+
matchMetastatementNode(metastatementNode, substitutions, fileContext, metastatementMetaproofContext) {
|
|
101
107
|
const nonTerminalNodeA = this.metastatementNode, ///
|
|
102
108
|
nonTerminalNodeB = metastatementNode, ///
|
|
103
|
-
|
|
109
|
+
fileContextA = fileContext, ///
|
|
110
|
+
metaproofContextB = metastatementMetaproofContext, ///
|
|
111
|
+
nonTerminalNodeVerified = premiseMetastatementForMetavariableVerifier.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, fileContextA, metaproofContextB),
|
|
104
112
|
metastatementNodeMatches = nonTerminalNodeVerified; ///
|
|
105
113
|
|
|
106
114
|
return metastatementNodeMatches;
|
|
@@ -116,11 +124,11 @@ export default class Premise {
|
|
|
116
124
|
return json;
|
|
117
125
|
}
|
|
118
126
|
|
|
119
|
-
static
|
|
127
|
+
static fromJSONAndFileContext(json, fileContext) {
|
|
120
128
|
const { metastatement } = json,
|
|
121
129
|
metastatementString = metastatement, ///
|
|
122
|
-
lexer =
|
|
123
|
-
parser =
|
|
130
|
+
lexer = fileContext.getLexer(),
|
|
131
|
+
parser = fileContext.getParser(),
|
|
124
132
|
metastatementNode = metastatementNodeFromMetastatementString(metastatementString, lexer, parser),
|
|
125
133
|
premise = new Premise(metastatementNode);
|
|
126
134
|
|