occam-verify-cli 0.0.539 → 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 +5 -1
- package/lib/axiom.js +4 -4
- package/lib/axiomLemmaTheoremConjecture.js +6 -6
- package/lib/combinator.js +4 -4
- package/lib/conclusion.js +4 -4
- package/lib/conjecture.js +4 -4
- package/lib/constructor.js +6 -6
- package/lib/context/file.js +135 -27
- package/lib/context/metaproof.js +3 -3
- package/lib/context/release.js +215 -2
- package/lib/kinds.js +9 -1
- package/lib/label.js +4 -4
- package/lib/lemma.js +4 -4
- package/lib/metavariable.js +7 -1
- package/lib/premise.js +4 -4
- package/lib/rule.js +7 -7
- package/lib/ruleNames.js +16 -4
- package/lib/supposition.js +4 -4
- package/lib/theorem.js +4 -4
- package/lib/type.js +7 -7
- package/lib/utilities/node.js +17 -3
- package/lib/variable.js +7 -1
- package/lib/verifier.js +1 -1
- package/lib/verify/metastatement.js +147 -3
- package/lib/verify/statement.js +2 -2
- package/package.json +3 -3
- package/src/axiom.js +1 -1
- package/src/axiomLemmaTheoremConjecture.js +4 -4
- package/src/combinator.js +3 -3
- package/src/conclusion.js +3 -3
- package/src/conjecture.js +1 -1
- package/src/constructor.js +5 -5
- package/src/context/file.js +161 -27
- package/src/context/metaproof.js +1 -1
- package/src/context/release.js +254 -2
- package/src/kinds.js +2 -0
- package/src/label.js +3 -3
- package/src/lemma.js +1 -1
- package/src/metavariable.js +4 -0
- package/src/premise.js +3 -3
- package/src/rule.js +5 -5
- package/src/ruleNames.js +4 -1
- package/src/supposition.js +3 -3
- package/src/theorem.js +1 -1
- package/src/type.js +5 -5
- package/src/utilities/node.js +32 -2
- package/src/variable.js +4 -0
- package/src/verifier.js +1 -1
- package/src/verify/metastatement.js +65 -2
- package/src/verify/statement.js +2 -2
- 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/file.js
CHANGED
|
@@ -2,16 +2,37 @@
|
|
|
2
2
|
|
|
3
3
|
import { rewriteNodes } from "occam-grammar-utilities";
|
|
4
4
|
|
|
5
|
+
import Type from "../type";
|
|
6
|
+
import Rule from "../rule";
|
|
7
|
+
import Axiom from "../axiom";
|
|
8
|
+
import Lemma from "../lemma";
|
|
9
|
+
import Theorem from "../theorem";
|
|
10
|
+
import Variable from "../variable";
|
|
11
|
+
import Conjecture from "../conjecture";
|
|
12
|
+
import Combinator from "../combinator";
|
|
13
|
+
import Constructor from "../constructor";
|
|
14
|
+
import Metavariable from "../metavariable";
|
|
15
|
+
|
|
5
16
|
import { push, filter } from "../utilities/array";
|
|
6
17
|
import { statementMetaType } from "../metaType";
|
|
7
18
|
import { nodeAsString, nodesAsString } from "../utilities/string";
|
|
19
|
+
import { TYPE_KIND,
|
|
20
|
+
RULE_KIND,
|
|
21
|
+
AXIOM_KIND,
|
|
22
|
+
LEMMA_KIND,
|
|
23
|
+
THEOREM_KIND,
|
|
24
|
+
VARIABLE_KIND,
|
|
25
|
+
CONJECTURE_KIND,
|
|
26
|
+
COMBINATOR_KIND,
|
|
27
|
+
CONSTRUCTOR_KIND,
|
|
28
|
+
METAVARIABLE_KIND } from "../kinds";
|
|
8
29
|
|
|
9
30
|
const metaTypes = [
|
|
10
31
|
statementMetaType
|
|
11
32
|
];
|
|
12
33
|
|
|
13
34
|
export default class FileContext {
|
|
14
|
-
constructor(releaseContext, filePath, tokens, node, types, rules, axioms, lemmas, theorems, conjectures, combinators, constructors,
|
|
35
|
+
constructor(releaseContext, filePath, tokens, node, types, rules, axioms, lemmas, theorems, variables, conjectures, combinators, constructors, metavariables) {
|
|
15
36
|
this.releaseContext = releaseContext;
|
|
16
37
|
this.filePath = filePath;
|
|
17
38
|
this.tokens = tokens;
|
|
@@ -21,10 +42,10 @@ export default class FileContext {
|
|
|
21
42
|
this.axioms = axioms;
|
|
22
43
|
this.lemmas = lemmas;
|
|
23
44
|
this.theorems = theorems;
|
|
45
|
+
this.variables = variables;
|
|
24
46
|
this.conjectures = conjectures;
|
|
25
47
|
this.combinators = combinators;
|
|
26
48
|
this.constructors = constructors;
|
|
27
|
-
this.variables = variables;
|
|
28
49
|
this.metavariables = metavariables;
|
|
29
50
|
}
|
|
30
51
|
|
|
@@ -83,6 +104,12 @@ export default class FileContext {
|
|
|
83
104
|
push(labels, theoremLabels);
|
|
84
105
|
});
|
|
85
106
|
|
|
107
|
+
this.conjectures.forEach((conjecture) => {
|
|
108
|
+
const conjectureLabels = conjecture.getLabels();
|
|
109
|
+
|
|
110
|
+
push(labels, conjectureLabels);
|
|
111
|
+
});
|
|
112
|
+
|
|
86
113
|
if (includeRelease) {
|
|
87
114
|
const releaseContextLabels = this.releaseContext.getLabels();
|
|
88
115
|
|
|
@@ -162,6 +189,10 @@ export default class FileContext {
|
|
|
162
189
|
return theorems;
|
|
163
190
|
}
|
|
164
191
|
|
|
192
|
+
getVariables(includeRelease = true) {
|
|
193
|
+
return this.variables;
|
|
194
|
+
}
|
|
195
|
+
|
|
165
196
|
getMetaTypes(includeRelease = true) {
|
|
166
197
|
return metaTypes;
|
|
167
198
|
}
|
|
@@ -208,39 +239,35 @@ export default class FileContext {
|
|
|
208
239
|
return constructors;
|
|
209
240
|
}
|
|
210
241
|
|
|
211
|
-
|
|
212
|
-
return this.variables;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
getMetavariables() {
|
|
242
|
+
getMetavariables(includeRelease = true) {
|
|
216
243
|
return this.metavariables;
|
|
217
244
|
}
|
|
218
245
|
|
|
219
|
-
|
|
220
|
-
const
|
|
221
|
-
|
|
222
|
-
|
|
246
|
+
findLabelByLabelName(labelName) {
|
|
247
|
+
const name = labelName, ///
|
|
248
|
+
labels = this.getLabels(),
|
|
249
|
+
label = labels.find((label) => {
|
|
250
|
+
const matches = label.matchName(name);
|
|
223
251
|
|
|
224
252
|
if (matches) {
|
|
225
253
|
return true;
|
|
226
254
|
}
|
|
227
255
|
}) || null;
|
|
228
256
|
|
|
229
|
-
return
|
|
257
|
+
return label;
|
|
230
258
|
}
|
|
231
259
|
|
|
232
|
-
|
|
233
|
-
const
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
const matches = label.matchName(name);
|
|
260
|
+
findTypeByTypeName(typeName) {
|
|
261
|
+
const types = this.getTypes(),
|
|
262
|
+
type = types.find((type) => {
|
|
263
|
+
const matches = type.matchTypeName(typeName);
|
|
237
264
|
|
|
238
265
|
if (matches) {
|
|
239
266
|
return true;
|
|
240
267
|
}
|
|
241
268
|
}) || null;
|
|
242
269
|
|
|
243
|
-
return
|
|
270
|
+
return type;
|
|
244
271
|
}
|
|
245
272
|
|
|
246
273
|
findRuleByReferenceName(referenceName) {
|
|
@@ -354,13 +381,6 @@ export default class FileContext {
|
|
|
354
381
|
return metavariable;
|
|
355
382
|
}
|
|
356
383
|
|
|
357
|
-
isTypePresentByTypeName(typeName) {
|
|
358
|
-
const type = this.findTypeByTypeName(typeName),
|
|
359
|
-
typePresent = (type !== null);
|
|
360
|
-
|
|
361
|
-
return typePresent;
|
|
362
|
-
}
|
|
363
|
-
|
|
364
384
|
isLabelPresentByLabelName(labelName) {
|
|
365
385
|
const label = this.findLabelByLabelName(labelName),
|
|
366
386
|
labelPresent = (label !== null);
|
|
@@ -368,6 +388,13 @@ export default class FileContext {
|
|
|
368
388
|
return labelPresent;
|
|
369
389
|
}
|
|
370
390
|
|
|
391
|
+
isTypePresentByTypeName(typeName) {
|
|
392
|
+
const type = this.findTypeByTypeName(typeName),
|
|
393
|
+
typePresent = (type !== null);
|
|
394
|
+
|
|
395
|
+
return typePresent;
|
|
396
|
+
}
|
|
397
|
+
|
|
371
398
|
isVariablePresentByVariableName(variableName) {
|
|
372
399
|
const variable = this.findVariableByVariableName(variableName),
|
|
373
400
|
variablePresent = (variable !== null);
|
|
@@ -435,6 +462,10 @@ export default class FileContext {
|
|
|
435
462
|
this.variables.push(variable);
|
|
436
463
|
}
|
|
437
464
|
|
|
465
|
+
addConjecture(conjecture) {
|
|
466
|
+
this.conjectures.push(conjecture);
|
|
467
|
+
}
|
|
468
|
+
|
|
438
469
|
addCombinator(combinator) {
|
|
439
470
|
this.combinators.push(combinator);
|
|
440
471
|
}
|
|
@@ -503,6 +534,12 @@ export default class FileContext {
|
|
|
503
534
|
json.push(theoremJSON);
|
|
504
535
|
});
|
|
505
536
|
|
|
537
|
+
this.variables.forEach((variable) => {
|
|
538
|
+
const variableJSON = variable.toJSON(this.tokens);
|
|
539
|
+
|
|
540
|
+
json.push(variableJSON)
|
|
541
|
+
});
|
|
542
|
+
|
|
506
543
|
this.conjectures.forEach((conjecture) => {
|
|
507
544
|
const conjectureJSON = conjecture.toJSON(this.tokens);
|
|
508
545
|
|
|
@@ -521,9 +558,106 @@ export default class FileContext {
|
|
|
521
558
|
json.push(constructorJSON)
|
|
522
559
|
});
|
|
523
560
|
|
|
561
|
+
this.metavariables.forEach((metavariable) => {
|
|
562
|
+
const metavariableJSON = metavariable.toJSON(this.tokens);
|
|
563
|
+
|
|
564
|
+
json.push(metavariableJSON)
|
|
565
|
+
});
|
|
566
|
+
|
|
524
567
|
return json;
|
|
525
568
|
}
|
|
526
569
|
|
|
570
|
+
static fromJSON(json) {
|
|
571
|
+
const jsonArray = json, ///
|
|
572
|
+
fileContext = this; ///
|
|
573
|
+
|
|
574
|
+
jsonArray.forEach((json) => {
|
|
575
|
+
const { kind } = json;
|
|
576
|
+
|
|
577
|
+
switch (kind) {
|
|
578
|
+
case TYPE_KIND: {
|
|
579
|
+
const type = Type.fromJSONAndFileContext(json, fileContext);
|
|
580
|
+
|
|
581
|
+
this.types.push(type);
|
|
582
|
+
|
|
583
|
+
break;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
case RULE_KIND: {
|
|
587
|
+
const rule = Rule.fromJSONAndFileContext(json, fileContext);
|
|
588
|
+
|
|
589
|
+
this.rules.push(rule);
|
|
590
|
+
|
|
591
|
+
break;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
case AXIOM_KIND: {
|
|
595
|
+
const axiom = Axiom.fromJSONAndFileContext(json, fileContext);
|
|
596
|
+
|
|
597
|
+
this.axioms.push(axiom);
|
|
598
|
+
|
|
599
|
+
break;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
case LEMMA_KIND: {
|
|
603
|
+
const lemma = Lemma.fromJSONAndFileContext(json, fileContext);
|
|
604
|
+
|
|
605
|
+
this.lemmas.push(lemma);
|
|
606
|
+
|
|
607
|
+
break;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
case THEOREM_KIND: {
|
|
611
|
+
const theorem = Theorem.fromJSONAndFileContext(json, fileContext);
|
|
612
|
+
|
|
613
|
+
this.theorems.push(theorem);
|
|
614
|
+
|
|
615
|
+
break;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
case VARIABLE_KIND: {
|
|
619
|
+
const variable = Variable.fromJSONAndFileContext(json, fileContext);
|
|
620
|
+
|
|
621
|
+
this.variables.push(variable);
|
|
622
|
+
|
|
623
|
+
break;
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
case CONJECTURE_KIND: {
|
|
627
|
+
const conjecture = Conjecture.fromJSONAndFileContext(json, fileContext);
|
|
628
|
+
|
|
629
|
+
this.conjectures.push(conjecture);
|
|
630
|
+
|
|
631
|
+
break;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
case COMBINATOR_KIND: {
|
|
635
|
+
const combinator = Combinator.fromJSONAndFileContext(json, fileContext);
|
|
636
|
+
|
|
637
|
+
this.combinators.push(combinator);
|
|
638
|
+
|
|
639
|
+
break;
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
case CONSTRUCTOR_KIND: {
|
|
643
|
+
const constructor = Constructor.fromJSONAndFileContext(json, fileContext);
|
|
644
|
+
|
|
645
|
+
this.constructors.push(constructor);
|
|
646
|
+
|
|
647
|
+
break;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
case METAVARIABLE_KIND: {
|
|
651
|
+
const metavariable = Metavariable.fromJSONAndFileContext(json, fileContext);
|
|
652
|
+
|
|
653
|
+
this.metavariables.push(metavariable);
|
|
654
|
+
|
|
655
|
+
break;
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
});
|
|
659
|
+
}
|
|
660
|
+
|
|
527
661
|
static fromReleaseContextAndFilePath(releaseContext, filePath) {
|
|
528
662
|
const file = releaseContext.getFile(filePath),
|
|
529
663
|
content = file.getContent(),
|
|
@@ -541,12 +675,12 @@ export default class FileContext {
|
|
|
541
675
|
axioms = [],
|
|
542
676
|
lemmas = [],
|
|
543
677
|
theorems = [],
|
|
678
|
+
variables = [],
|
|
544
679
|
conjectures = [],
|
|
545
680
|
combinators = [],
|
|
546
681
|
constructors = [],
|
|
547
|
-
variables = [],
|
|
548
682
|
metavariables = [],
|
|
549
|
-
fileContext = new FileContext(releaseContext, filePath, tokens, node, types, rules, axioms, lemmas, theorems, conjectures, combinators, constructors,
|
|
683
|
+
fileContext = new FileContext(releaseContext, filePath, tokens, node, types, rules, axioms, lemmas, variables, theorems, conjectures, combinators, constructors, metavariables);
|
|
550
684
|
|
|
551
685
|
return fileContext;
|
|
552
686
|
}
|
package/src/context/metaproof.js
CHANGED
|
@@ -108,7 +108,7 @@ class MetaproofContext {
|
|
|
108
108
|
return metavariable;
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
|
|
111
|
+
isMetavariablePresentByMetavariableName(metavariableName) {
|
|
112
112
|
const metavariable = this.findMetavariableByMetavariableName(metavariableName),
|
|
113
113
|
metavariablePresent = (metavariable !== null);
|
|
114
114
|
|
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,7 +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";
|
|
8
9
|
export const META_TYPE_KIND = "meta-type";
|
|
9
10
|
export const CONJECTURE_KIND = "conjecture";
|
|
10
11
|
export const COMBINATOR_KIND = "combinator";
|
|
11
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
12
|
static fromLabelsSuppositionsConsequenceAndProofContext(labels, suppositions, consequence, proofContext) { return AxiomLemmaTheoremConjecture.fromLabelsSuppositionsConsequenceAndProofContext(Lemma, labels, suppositions, consequence, proofContext); }
|
|
13
13
|
}
|
package/src/metavariable.js
CHANGED
package/src/premise.js
CHANGED
|
@@ -124,11 +124,11 @@ export default class Premise {
|
|
|
124
124
|
return json;
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
static
|
|
127
|
+
static fromJSONAndFileContext(json, fileContext) {
|
|
128
128
|
const { metastatement } = json,
|
|
129
129
|
metastatementString = metastatement, ///
|
|
130
|
-
lexer =
|
|
131
|
-
parser =
|
|
130
|
+
lexer = fileContext.getLexer(),
|
|
131
|
+
parser = fileContext.getParser(),
|
|
132
132
|
metastatementNode = metastatementNodeFromMetastatementString(metastatementString, lexer, parser),
|
|
133
133
|
premise = new Premise(metastatementNode);
|
|
134
134
|
|
package/src/rule.js
CHANGED
|
@@ -139,7 +139,7 @@ export default class Rule {
|
|
|
139
139
|
return json;
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
static
|
|
142
|
+
static fromJSONAndFileContext(json, fileContext) {
|
|
143
143
|
let rule;
|
|
144
144
|
|
|
145
145
|
let { labels } = json;
|
|
@@ -148,7 +148,7 @@ export default class Rule {
|
|
|
148
148
|
|
|
149
149
|
labels = labelsJSON.map((labelJSON) => {
|
|
150
150
|
const json = labelJSON, ///
|
|
151
|
-
label = Label.
|
|
151
|
+
label = Label.fromJSONAndFileContext(json, fileContext);
|
|
152
152
|
|
|
153
153
|
return label;
|
|
154
154
|
});
|
|
@@ -159,7 +159,7 @@ export default class Rule {
|
|
|
159
159
|
|
|
160
160
|
premises = premisesJSON.map((premiseJSON) => {
|
|
161
161
|
const json = premiseJSON, ///
|
|
162
|
-
premise = Premise.
|
|
162
|
+
premise = Premise.fromJSONAndFileContext(json, fileContext);
|
|
163
163
|
|
|
164
164
|
return premise;
|
|
165
165
|
});
|
|
@@ -170,9 +170,9 @@ export default class Rule {
|
|
|
170
170
|
|
|
171
171
|
json = conclusionJSON; ///
|
|
172
172
|
|
|
173
|
-
conclusion = Conclusion.
|
|
173
|
+
conclusion = Conclusion.fromJSONAndFileContext(json, fileContext);
|
|
174
174
|
|
|
175
|
-
rule = new Rule(labels, premises, conclusion);
|
|
175
|
+
rule = new Rule(labels, premises, conclusion, fileContext);
|
|
176
176
|
|
|
177
177
|
return rule;
|
|
178
178
|
}
|