occam-verify-cli 0.0.525 → 0.0.527
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/assertion/type.js +10 -40
- package/lib/axiom.js +7 -7
- package/lib/axiomLemmaTheoremConjecture.js +190 -0
- package/lib/combinator.js +5 -5
- package/lib/conclusion.js +3 -3
- package/lib/conjecture.js +141 -0
- package/lib/consequence.js +5 -5
- package/lib/constants.js +4 -16
- package/lib/constructor.js +6 -6
- package/lib/context/file.js +85 -32
- package/lib/context/metaproof.js +46 -4
- package/lib/context/proof.js +38 -93
- package/lib/context/release/directory.js +20 -1
- package/lib/context/release/file.js +27 -3
- package/lib/equality.js +78 -51
- package/lib/index.js +1 -13
- package/lib/kinds.js +5 -1
- package/lib/label.js +5 -5
- package/lib/lemma.js +7 -7
- package/lib/matcher/metastatementForMetavariable.js +16 -19
- package/lib/matcher/statementForMetavariable.js +22 -20
- package/lib/matcher/{statementForVariable → termForVariable}/consequence.js +13 -13
- package/lib/matcher/{statementForVariable → termForVariable}/supposition.js +13 -13
- package/lib/matcher/termForVariable.js +198 -0
- package/lib/matcher.js +23 -64
- package/lib/mixins/file.js +62 -2
- package/lib/premise.js +6 -6
- package/lib/rule.js +5 -5
- package/lib/ruleNames.js +1 -9
- package/lib/step/proof.js +22 -1
- package/lib/substitution/statementForMetavariable.js +12 -8
- package/lib/substitution/termForVariable.js +86 -0
- package/lib/supposition.js +6 -6
- package/lib/theorem.js +7 -7
- package/lib/type.js +13 -6
- package/lib/utilities/string.js +17 -16
- package/lib/utilities/substitution.js +4 -5
- package/lib/variable.js +5 -39
- package/lib/verify/assertion/type.js +60 -37
- package/lib/verify/axiom.js +2 -3
- package/lib/verify/conclusion.js +2 -3
- package/lib/verify/conjecture.js +56 -0
- package/lib/verify/consequence.js +3 -4
- package/lib/verify/declaration/topLevel.js +7 -3
- package/lib/verify/label.js +2 -3
- package/lib/verify/lemma.js +2 -3
- package/lib/verify/metastatement/qualified.js +3 -4
- package/lib/verify/metastatement/unqualified.js +3 -4
- package/lib/verify/premise.js +3 -4
- package/lib/verify/rule.js +2 -3
- package/lib/verify/statement/qualified.js +41 -12
- package/lib/verify/statement/unqualified.js +3 -4
- package/lib/verify/statement.js +47 -51
- package/lib/verify/statementAsCombinator.js +2 -3
- package/lib/verify/supposition.js +3 -4
- package/lib/verify/term.js +3 -4
- package/lib/verify/termAsConstructor.js +4 -5
- package/lib/verify/theorem.js +2 -3
- package/lib/verify/type.js +2 -3
- package/lib/verify/variable.js +2 -3
- package/package.json +1 -1
- package/src/assertion/type.js +7 -32
- package/src/axiom.js +4 -4
- package/src/{axiomLemmaTheorem.js → axiomLemmaTheoremConjecture.js} +9 -9
- package/src/combinator.js +4 -4
- package/src/conclusion.js +2 -2
- package/src/conjecture.js +13 -0
- package/src/consequence.js +4 -4
- package/src/constants.js +1 -4
- package/src/constructor.js +6 -6
- package/src/context/file.js +89 -32
- package/src/context/metaproof.js +44 -3
- package/src/context/proof.js +42 -37
- package/src/context/release/directory.js +24 -0
- package/src/context/release/file.js +34 -3
- package/src/equality.js +110 -61
- package/src/index.js +0 -3
- package/src/kinds.js +1 -0
- package/src/label.js +4 -4
- package/src/lemma.js +4 -4
- package/src/matcher/metastatementForMetavariable.js +22 -32
- package/src/matcher/statementForMetavariable.js +40 -34
- package/src/matcher/termForVariable/consequence.js +9 -0
- package/src/matcher/termForVariable/supposition.js +9 -0
- package/src/matcher/termForVariable.js +89 -0
- package/src/matcher.js +28 -22
- package/src/mixins/file.js +46 -1
- package/src/premise.js +6 -6
- package/src/rule.js +4 -4
- package/src/ruleNames.js +0 -2
- package/src/step/proof.js +27 -0
- package/src/substitution/statementForMetavariable.js +17 -10
- package/src/substitution/termForVariable.js +64 -0
- package/src/supposition.js +5 -5
- package/src/theorem.js +4 -4
- package/src/type.js +18 -8
- package/src/utilities/string.js +27 -21
- package/src/utilities/substitution.js +6 -4
- package/src/variable.js +5 -38
- package/src/verify/assertion/type.js +71 -65
- package/src/verify/axiom.js +1 -2
- package/src/verify/conclusion.js +1 -2
- package/src/verify/conjecture.js +73 -0
- package/src/verify/consequence.js +2 -3
- package/src/verify/declaration/topLevel.js +7 -0
- package/src/verify/label.js +1 -2
- package/src/verify/lemma.js +1 -2
- package/src/verify/metastatement/qualified.js +2 -3
- package/src/verify/metastatement/unqualified.js +2 -3
- package/src/verify/premise.js +2 -3
- package/src/verify/rule.js +1 -2
- package/src/verify/statement/qualified.js +55 -15
- package/src/verify/statement/unqualified.js +2 -3
- package/src/verify/statement.js +49 -70
- package/src/verify/statementAsCombinator.js +1 -2
- package/src/verify/supposition.js +2 -3
- package/src/verify/term.js +2 -3
- package/src/verify/termAsConstructor.js +3 -4
- package/src/verify/theorem.js +1 -2
- package/src/verify/type.js +1 -2
- package/src/verify/variable.js +1 -2
- package/lib/axiomLemmaTheorem.js +0 -190
- package/lib/jsonTypes.js +0 -30
- package/lib/matcher/statementForVariable.js +0 -201
- package/lib/substitution/statementForVariable.js +0 -86
- package/lib/utilities/json.js +0 -187
- package/lib/utilities/version.js +0 -32
- package/lib/versionChanges.js +0 -34
- package/src/jsonTypes.js +0 -6
- package/src/matcher/statementForVariable/consequence.js +0 -9
- package/src/matcher/statementForVariable/supposition.js +0 -9
- package/src/matcher/statementForVariable.js +0 -99
- package/src/substitution/statementForVariable.js +0 -64
- package/src/utilities/json.js +0 -264
- package/src/utilities/version.js +0 -30
- package/src/versionChanges.js +0 -11
package/src/constructor.js
CHANGED
|
@@ -20,16 +20,16 @@ export default class Constructor {
|
|
|
20
20
|
return this.type;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
asString() {
|
|
23
|
+
asString(tokens) {
|
|
24
24
|
let string;
|
|
25
25
|
|
|
26
|
-
const termString = nodeAsString(this.termNode);
|
|
26
|
+
const termString = nodeAsString(this.termNode, tokens);
|
|
27
27
|
|
|
28
28
|
if (this.type === null) {
|
|
29
29
|
string = `${termString}`;
|
|
30
30
|
} else {
|
|
31
31
|
const noSuperType = true,
|
|
32
|
-
typeString = this.type.asString(noSuperType);
|
|
32
|
+
typeString = this.type.asString(tokens, noSuperType);
|
|
33
33
|
|
|
34
34
|
string = `${termString}:${typeString}`;
|
|
35
35
|
}
|
|
@@ -37,11 +37,11 @@ export default class Constructor {
|
|
|
37
37
|
return string;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
toJSON() {
|
|
41
|
-
const termString = nodeAsString(this.termNode),
|
|
40
|
+
toJSON(tokens) {
|
|
41
|
+
const termString = nodeAsString(this.termNode, tokens),
|
|
42
42
|
typeJSON = (this.type === null) ?
|
|
43
43
|
null :
|
|
44
|
-
this.type.toJSON(),
|
|
44
|
+
this.type.toJSON(tokens),
|
|
45
45
|
kind = CONSTRUCTOR_KIND,
|
|
46
46
|
term = termString, ///
|
|
47
47
|
type = typeJSON, ///
|
package/src/context/file.js
CHANGED
|
@@ -3,22 +3,27 @@
|
|
|
3
3
|
import { rewriteNodes } from "occam-grammar-utilities";
|
|
4
4
|
|
|
5
5
|
import { push } from "../utilities/array";
|
|
6
|
+
import { nodeAsString, nodesAsString } from "../utilities/string";
|
|
6
7
|
import { leastLineIndexFromNodeAndTokens, greatestLineIndexFromNodeAndTokens } from "../utilities/tokens";
|
|
7
8
|
|
|
8
9
|
export default class FileContext {
|
|
9
|
-
constructor(releaseContext, filePath, tokens, node, types, rules, axioms, lemmas, theorems,
|
|
10
|
+
constructor(releaseContext, filePath, tokens, node, types, rules, axioms, lemmas, theorems, conjectures, combinators, constructors, variables, metavariables) {
|
|
10
11
|
this.releaseContext = releaseContext;
|
|
11
12
|
this.filePath = filePath;
|
|
12
13
|
this.tokens = tokens;
|
|
13
14
|
this.node = node;
|
|
15
|
+
|
|
14
16
|
this.types = types;
|
|
15
17
|
this.rules = rules;
|
|
16
18
|
this.axioms = axioms;
|
|
17
19
|
this.lemmas = lemmas;
|
|
18
20
|
this.theorems = theorems;
|
|
19
|
-
this.
|
|
21
|
+
this.conjectures = conjectures;
|
|
20
22
|
this.combinators = combinators;
|
|
21
23
|
this.constructors = constructors;
|
|
24
|
+
|
|
25
|
+
this.variables = variables;
|
|
26
|
+
this.metavariables = metavariables;
|
|
22
27
|
}
|
|
23
28
|
|
|
24
29
|
getReleaseContext() {
|
|
@@ -37,8 +42,16 @@ export default class FileContext {
|
|
|
37
42
|
return this.node;
|
|
38
43
|
}
|
|
39
44
|
|
|
40
|
-
|
|
41
|
-
|
|
45
|
+
getProofSteps() {
|
|
46
|
+
const proofSteps = []; ///
|
|
47
|
+
|
|
48
|
+
return proofSteps;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
getMetaproofSteps() {
|
|
52
|
+
const metaproofSteps = []; ///
|
|
53
|
+
|
|
54
|
+
return metaproofSteps;
|
|
42
55
|
}
|
|
43
56
|
|
|
44
57
|
getLabels(includeRelease = true) {
|
|
@@ -147,6 +160,20 @@ export default class FileContext {
|
|
|
147
160
|
return theorems;
|
|
148
161
|
}
|
|
149
162
|
|
|
163
|
+
getConjectures(includeRelease = true) {
|
|
164
|
+
const conjectures = [];
|
|
165
|
+
|
|
166
|
+
push(conjectures, this.conjectures);
|
|
167
|
+
|
|
168
|
+
if (includeRelease) {
|
|
169
|
+
const releaseContextConjectures = this.releaseContext.getConjectures();
|
|
170
|
+
|
|
171
|
+
push(conjectures, releaseContextConjectures);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return conjectures;
|
|
175
|
+
}
|
|
176
|
+
|
|
150
177
|
getCombinators(includeRelease = true) {
|
|
151
178
|
const combinators = [];
|
|
152
179
|
|
|
@@ -175,16 +202,12 @@ export default class FileContext {
|
|
|
175
202
|
return constructors;
|
|
176
203
|
}
|
|
177
204
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
return proofSteps;
|
|
205
|
+
getVariables() {
|
|
206
|
+
return this.variables;
|
|
182
207
|
}
|
|
183
208
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
return metaproofSteps;
|
|
209
|
+
getMetavariables() {
|
|
210
|
+
return this.metavariables;
|
|
188
211
|
}
|
|
189
212
|
|
|
190
213
|
findTypeByTypeName(typeName) {
|
|
@@ -270,18 +293,25 @@ export default class FileContext {
|
|
|
270
293
|
return theorem;
|
|
271
294
|
}
|
|
272
295
|
|
|
273
|
-
|
|
274
|
-
const
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
const
|
|
296
|
+
findConjectureByReferenceName(referenceName) {
|
|
297
|
+
const labelName = referenceName, ///
|
|
298
|
+
conjectures = this.getConjectures(),
|
|
299
|
+
conjecture = conjectures.find((conjecture) => {
|
|
300
|
+
const conjectureMatchesLabelName = conjecture.matchLabelName(labelName);
|
|
278
301
|
|
|
279
|
-
if (
|
|
302
|
+
if (conjectureMatchesLabelName) {
|
|
280
303
|
return true;
|
|
281
304
|
}
|
|
282
305
|
}) || null;
|
|
283
306
|
|
|
284
|
-
return
|
|
307
|
+
return conjecture;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
isLabelPresentByLabelName(labelName) {
|
|
311
|
+
const label = this.findLabelByLabelName(labelName),
|
|
312
|
+
labelPresent = (label !== null);
|
|
313
|
+
|
|
314
|
+
return labelPresent;
|
|
285
315
|
}
|
|
286
316
|
|
|
287
317
|
isTypePresentByTypeName(typeName) {
|
|
@@ -291,11 +321,30 @@ export default class FileContext {
|
|
|
291
321
|
return typePresent;
|
|
292
322
|
}
|
|
293
323
|
|
|
294
|
-
|
|
295
|
-
const
|
|
296
|
-
labelPresent = (label !== null);
|
|
324
|
+
nodeAsString(node) {
|
|
325
|
+
const string = nodeAsString(node, this.tokens);
|
|
297
326
|
|
|
298
|
-
return
|
|
327
|
+
return string;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
nodesAsString(node) {
|
|
331
|
+
const string = nodesAsString(node, this.tokens);
|
|
332
|
+
|
|
333
|
+
return string;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
findVariableByVariableName(variableName) {
|
|
337
|
+
const name = variableName, ///
|
|
338
|
+
variables = this.getVariables(),
|
|
339
|
+
variable = variables.find((variable) => {
|
|
340
|
+
const matches = variable.matchName(name);
|
|
341
|
+
|
|
342
|
+
if (matches) {
|
|
343
|
+
return true;
|
|
344
|
+
}
|
|
345
|
+
}) || null;
|
|
346
|
+
|
|
347
|
+
return variable;
|
|
299
348
|
}
|
|
300
349
|
|
|
301
350
|
isVariablePresentByVariableName(variableName) {
|
|
@@ -380,43 +429,49 @@ export default class FileContext {
|
|
|
380
429
|
const json = [];
|
|
381
430
|
|
|
382
431
|
this.types.forEach((type) => {
|
|
383
|
-
const typeJSON = type.toJSON();
|
|
432
|
+
const typeJSON = type.toJSON(this.tokens);
|
|
384
433
|
|
|
385
434
|
json.push(typeJSON);
|
|
386
435
|
});
|
|
387
436
|
|
|
388
437
|
this.rules.forEach((rule) => {
|
|
389
|
-
const ruleJSON = rule.toJSON();
|
|
438
|
+
const ruleJSON = rule.toJSON(this.tokens);
|
|
390
439
|
|
|
391
440
|
json.push(ruleJSON);
|
|
392
441
|
});
|
|
393
442
|
|
|
394
443
|
this.axioms.forEach((axiom) => {
|
|
395
|
-
const axiomJSON = axiom.toJSON();
|
|
444
|
+
const axiomJSON = axiom.toJSON(this.tokens);
|
|
396
445
|
|
|
397
446
|
json.push(axiomJSON);
|
|
398
447
|
});
|
|
399
448
|
|
|
400
449
|
this.lemmas.forEach((lemma) => {
|
|
401
|
-
const lemmaJSON = lemma.toJSON();
|
|
450
|
+
const lemmaJSON = lemma.toJSON(this.tokens);
|
|
402
451
|
|
|
403
452
|
json.push(lemmaJSON);
|
|
404
453
|
});
|
|
405
454
|
|
|
406
455
|
this.theorems.forEach((theorem) => {
|
|
407
|
-
const theoremJSON = theorem.toJSON();
|
|
456
|
+
const theoremJSON = theorem.toJSON(this.tokens);
|
|
408
457
|
|
|
409
458
|
json.push(theoremJSON);
|
|
410
459
|
});
|
|
411
460
|
|
|
461
|
+
this.conjectures.forEach((conjecture) => {
|
|
462
|
+
const conjectureJSON = conjecture.toJSON(this.tokens);
|
|
463
|
+
|
|
464
|
+
json.push(conjectureJSON);
|
|
465
|
+
});
|
|
466
|
+
|
|
412
467
|
this.combinators.forEach((combinator) => {
|
|
413
|
-
const combinatorJSON = combinator.toJSON();
|
|
468
|
+
const combinatorJSON = combinator.toJSON(this.tokens);
|
|
414
469
|
|
|
415
470
|
json.push(combinatorJSON);
|
|
416
471
|
});
|
|
417
472
|
|
|
418
473
|
this.constructors.forEach((constructor) => {
|
|
419
|
-
const constructorJSON = constructor.toJSON();
|
|
474
|
+
const constructorJSON = constructor.toJSON(this.tokens);
|
|
420
475
|
|
|
421
476
|
json.push(constructorJSON)
|
|
422
477
|
});
|
|
@@ -439,10 +494,12 @@ export default class FileContext {
|
|
|
439
494
|
axioms = [],
|
|
440
495
|
lemmas = [],
|
|
441
496
|
theorems = [],
|
|
442
|
-
|
|
497
|
+
conjectures = [],
|
|
443
498
|
combinators = [],
|
|
444
499
|
constructors = [],
|
|
445
|
-
|
|
500
|
+
variables = [],
|
|
501
|
+
metavariables = [],
|
|
502
|
+
fileContext = new FileContext(releaseContext, filePath, tokens, node, types, rules, axioms, lemmas, theorems, conjectures, combinators, constructors, variables, metavariables);
|
|
446
503
|
|
|
447
504
|
return fileContext;
|
|
448
505
|
}
|
package/src/context/metaproof.js
CHANGED
|
@@ -4,11 +4,12 @@ import fileMixins from "../mixins/file";
|
|
|
4
4
|
import loggingMixins from "../mixins/logging";
|
|
5
5
|
import callbacksMixins from "../mixins/callbacks";
|
|
6
6
|
|
|
7
|
-
import { last } from "../utilities/array";
|
|
7
|
+
import { push, last } from "../utilities/array";
|
|
8
8
|
|
|
9
9
|
class MetaproofContext {
|
|
10
|
-
constructor(context, metaproofSteps) {
|
|
10
|
+
constructor(context, metavariables, metaproofSteps) {
|
|
11
11
|
this.context = context;
|
|
12
|
+
this.metavariables = metavariables;
|
|
12
13
|
this.metaproofSteps = metaproofSteps;
|
|
13
14
|
}
|
|
14
15
|
|
|
@@ -16,6 +17,20 @@ class MetaproofContext {
|
|
|
16
17
|
return this.context;
|
|
17
18
|
}
|
|
18
19
|
|
|
20
|
+
getVariables() { return this.context.getVariables(); }
|
|
21
|
+
|
|
22
|
+
getMetavariables() {
|
|
23
|
+
const metavariables = [];
|
|
24
|
+
|
|
25
|
+
push(metavariables, this.metavariables);
|
|
26
|
+
|
|
27
|
+
const contextMetavariables = this.context.getMetavariables();
|
|
28
|
+
|
|
29
|
+
push(metavariables, contextMetavariables);
|
|
30
|
+
|
|
31
|
+
return metavariables;
|
|
32
|
+
}
|
|
33
|
+
|
|
19
34
|
getMetaproofSteps() {
|
|
20
35
|
let metaproofSteps = this.context.getMetaproofSteps();
|
|
21
36
|
|
|
@@ -39,6 +54,10 @@ class MetaproofContext {
|
|
|
39
54
|
return lastMetaproofStep;
|
|
40
55
|
}
|
|
41
56
|
|
|
57
|
+
addMetavariable(metavariable) {
|
|
58
|
+
this.metavariables.push(metavariable);
|
|
59
|
+
}
|
|
60
|
+
|
|
42
61
|
addMetaproofStep(metaproofStep) {
|
|
43
62
|
this.metaproofSteps.push(metaproofStep);
|
|
44
63
|
}
|
|
@@ -61,6 +80,27 @@ class MetaproofContext {
|
|
|
61
80
|
return metastatementMatches;
|
|
62
81
|
}
|
|
63
82
|
|
|
83
|
+
findMetavariableByMetavariableName(metavariableName) {
|
|
84
|
+
const name = metavariableName, ///
|
|
85
|
+
metavariables = this.getMetavariables(),
|
|
86
|
+
metavariable = metavariables.find((metavariable) => {
|
|
87
|
+
const matches = metavariable.matchName(name);
|
|
88
|
+
|
|
89
|
+
if (matches) {
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
}) || null;
|
|
93
|
+
|
|
94
|
+
return metavariable;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
isMetavariablePresentByVariableName(metavariableName) {
|
|
98
|
+
const metavariable = this.findMetavariableByMetavariableName(metavariableName),
|
|
99
|
+
metavariablePresent = (metavariable !== null);
|
|
100
|
+
|
|
101
|
+
return metavariablePresent;
|
|
102
|
+
}
|
|
103
|
+
|
|
64
104
|
static fromFileContext(fileContext) {
|
|
65
105
|
const context = fileContext, ///
|
|
66
106
|
metaproofSteps = [],
|
|
@@ -71,9 +111,10 @@ class MetaproofContext {
|
|
|
71
111
|
|
|
72
112
|
static fromMetaproofContext(metaproofContext) {
|
|
73
113
|
const context = metaproofContext, ///
|
|
114
|
+
metavariables = [],
|
|
74
115
|
metaproofSteps = [];
|
|
75
116
|
|
|
76
|
-
metaproofContext = new MetaproofContext(context, metaproofSteps); ///
|
|
117
|
+
metaproofContext = new MetaproofContext(context, metavariables, metaproofSteps); ///
|
|
77
118
|
|
|
78
119
|
return metaproofContext;
|
|
79
120
|
}
|
package/src/context/proof.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import Equality from "../equality";
|
|
3
4
|
import fileMixins from "../mixins/file";
|
|
4
5
|
import loggingMixins from "../mixins/logging";
|
|
5
6
|
import callbacksMixins from "../mixins/callbacks";
|
|
6
7
|
|
|
7
8
|
import { push, last } from "../utilities/array";
|
|
9
|
+
import { MAXIMUM_INDEXES_LENGTH } from "../constants";
|
|
8
10
|
|
|
9
11
|
class ProofContext {
|
|
10
12
|
constructor(context, variables, proofSteps) {
|
|
@@ -17,6 +19,18 @@ class ProofContext {
|
|
|
17
19
|
return this.context;
|
|
18
20
|
}
|
|
19
21
|
|
|
22
|
+
getVariables() {
|
|
23
|
+
const variables = [];
|
|
24
|
+
|
|
25
|
+
push(variables, this.variables);
|
|
26
|
+
|
|
27
|
+
const contextVariables = this.context.getVariables();
|
|
28
|
+
|
|
29
|
+
push(variables, contextVariables);
|
|
30
|
+
|
|
31
|
+
return variables;
|
|
32
|
+
}
|
|
33
|
+
|
|
20
34
|
getProofSteps() {
|
|
21
35
|
let proofSteps = this.context.getProofSteps();
|
|
22
36
|
|
|
@@ -28,34 +42,34 @@ class ProofContext {
|
|
|
28
42
|
return proofSteps;
|
|
29
43
|
}
|
|
30
44
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
getAxioms() { return this.context.getAxioms(); }
|
|
34
|
-
|
|
35
|
-
getLemmas() { return this.context.getLemmas(); }
|
|
36
|
-
|
|
37
|
-
getTheorems() { return this.context.getTheorems(); }
|
|
38
|
-
|
|
39
|
-
getCombinators() { return this.context.getCombinators(); }
|
|
45
|
+
getLastProofStep() {
|
|
46
|
+
let lastProofStep = null;
|
|
40
47
|
|
|
41
|
-
|
|
48
|
+
const proofStepsLength = this.proofSteps.length;
|
|
42
49
|
|
|
43
|
-
|
|
44
|
-
|
|
50
|
+
if (proofStepsLength > 0) {
|
|
51
|
+
lastProofStep = last(this.proofSteps);
|
|
52
|
+
}
|
|
45
53
|
|
|
46
|
-
|
|
54
|
+
return lastProofStep;
|
|
55
|
+
}
|
|
47
56
|
|
|
48
|
-
|
|
57
|
+
getMetavariables() { return this.context.getMetavariables(); }
|
|
49
58
|
|
|
50
|
-
|
|
59
|
+
getEqualities() {
|
|
60
|
+
const equalities = [],
|
|
61
|
+
start = -MAXIMUM_INDEXES_LENGTH, ///
|
|
62
|
+
proofSteps = this.proofSteps.slice(start); ///
|
|
51
63
|
|
|
52
|
-
|
|
53
|
-
|
|
64
|
+
proofSteps.forEach((proofStep) => {
|
|
65
|
+
const equality = Equality.fromProofStep(proofStep);
|
|
54
66
|
|
|
55
|
-
|
|
56
|
-
|
|
67
|
+
if (equality !== null) {
|
|
68
|
+
equalities.push(equality);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
57
71
|
|
|
58
|
-
return
|
|
72
|
+
return equalities;
|
|
59
73
|
}
|
|
60
74
|
|
|
61
75
|
addVariable(variable) {
|
|
@@ -100,27 +114,11 @@ class ProofContext {
|
|
|
100
114
|
|
|
101
115
|
isVariablePresentByVariableName(variableName) {
|
|
102
116
|
const variable = this.findVariableByVariableName(variableName),
|
|
103
|
-
|
|
117
|
+
variablePresent = (variable !== null);
|
|
104
118
|
|
|
105
119
|
return variablePresent;
|
|
106
120
|
}
|
|
107
121
|
|
|
108
|
-
findTypeByTypeName(typeName) { return this.context.findTypeByTypeName(typeName); }
|
|
109
|
-
|
|
110
|
-
findLabelByTypeName(labelName) { return this.context.findLabelByTypeName(labelName); }
|
|
111
|
-
|
|
112
|
-
findRuleByReferenceName(referenceName) { return this.context.findRuleByReferenceName(referenceName); }
|
|
113
|
-
|
|
114
|
-
findAxiomByReferenceName(referenceName) { return this.context.findAxiomByReferenceName(referenceName); }
|
|
115
|
-
|
|
116
|
-
findLemmaByReferenceName(referenceName) { return this.context.findLemmaByReferenceName(referenceName); }
|
|
117
|
-
|
|
118
|
-
findTheoremByReferenceName(referenceName) { return this.context.findTheoremByReferenceName(referenceName); }
|
|
119
|
-
|
|
120
|
-
isLabelPresentByLabelName(labelName) { return this.context.isLabelPresentByLabelName(labelName); }
|
|
121
|
-
|
|
122
|
-
isTypePresentByTypeName(typeName) { return this.context.isTypePresentByTypeName(typeName); }
|
|
123
|
-
|
|
124
122
|
static fromFileContext(fileContext) {
|
|
125
123
|
const context = fileContext, ///
|
|
126
124
|
variables = [],
|
|
@@ -146,3 +144,10 @@ Object.assign(ProofContext.prototype, loggingMixins);
|
|
|
146
144
|
Object.assign(ProofContext.prototype, callbacksMixins);
|
|
147
145
|
|
|
148
146
|
export default ProofContext;
|
|
147
|
+
|
|
148
|
+
function equalitiesFromProofSteps(proofSteps, context) {
|
|
149
|
+
let equalities = [];
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
return equalities;
|
|
153
|
+
}
|
|
@@ -149,6 +149,30 @@ export default class DirectoryReleaseContext extends ReleaseContext {
|
|
|
149
149
|
return theorems;
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
+
getConjectures(includeDependencies = true) {
|
|
153
|
+
const conjectures = [];
|
|
154
|
+
|
|
155
|
+
this.fileContexts.forEach((fileContext) => {
|
|
156
|
+
const includeRelease = false,
|
|
157
|
+
fileContextConjectures = fileContext.getConjectures(includeRelease);
|
|
158
|
+
|
|
159
|
+
push(conjectures, fileContextConjectures);
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
if (includeDependencies) {
|
|
163
|
+
const dependencyReleaseContexts = this.getDependencyReleaseContexts();
|
|
164
|
+
|
|
165
|
+
dependencyReleaseContexts.forEach((releaseContext) => {
|
|
166
|
+
const includeDependencies = false,
|
|
167
|
+
releaseContextConjectures = releaseContext.getConjectures(includeDependencies);
|
|
168
|
+
|
|
169
|
+
push(conjectures, releaseContextConjectures);
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return conjectures;
|
|
174
|
+
}
|
|
175
|
+
|
|
152
176
|
getCombinators(includeDependencies = true) {
|
|
153
177
|
const combinators = [];
|
|
154
178
|
|
|
@@ -9,15 +9,16 @@ import Type from "../../type";
|
|
|
9
9
|
import Axiom from "../../axiom";
|
|
10
10
|
import Lemma from "../../lemma";
|
|
11
11
|
import Theorem from "../../theorem";
|
|
12
|
+
import Conjecture from "../../conjecture";
|
|
12
13
|
import Combinator from "../../combinator";
|
|
13
14
|
import Constructor from "../../constructor";
|
|
14
15
|
|
|
15
16
|
import { push } from "../../utilities/array";
|
|
16
17
|
import { customGrammarFromNameAndEntries } from "../../utilities/customGrammar";
|
|
17
|
-
import { RULE_KIND, TYPE_KIND, AXIOM_KIND, LEMMA_KIND, THEOREM_KIND, COMBINATOR_KIND, CONSTRUCTOR_KIND } from "../../kinds";
|
|
18
|
+
import { RULE_KIND, TYPE_KIND, AXIOM_KIND, LEMMA_KIND, THEOREM_KIND, CONJECTURE_KIND, COMBINATOR_KIND, CONSTRUCTOR_KIND } from "../../kinds";
|
|
18
19
|
|
|
19
20
|
export default class FileReleaseContext extends ReleaseContext {
|
|
20
|
-
constructor(log, name, entries, callbacks, verified, customGrammar, florenceLexer, florenceParser, dependencyReleaseContexts, contextJSON, types, rules, axioms, lemmas, theorems, combinators, constructors) {
|
|
21
|
+
constructor(log, name, entries, callbacks, verified, customGrammar, florenceLexer, florenceParser, dependencyReleaseContexts, contextJSON, types, rules, axioms, lemmas, theorems, conjectures, combinators, constructors) {
|
|
21
22
|
super(log, name, entries, callbacks, verified, customGrammar, florenceLexer, florenceParser, dependencyReleaseContexts);
|
|
22
23
|
|
|
23
24
|
this.types = types;
|
|
@@ -25,8 +26,10 @@ export default class FileReleaseContext extends ReleaseContext {
|
|
|
25
26
|
this.axioms = axioms;
|
|
26
27
|
this.lemmas = lemmas;
|
|
27
28
|
this.theorems = theorems;
|
|
29
|
+
this.conjectures = conjectures;
|
|
28
30
|
this.combinators = combinators;
|
|
29
31
|
this.constructors = constructors;
|
|
32
|
+
|
|
30
33
|
this.contextJSON = contextJSON;
|
|
31
34
|
}
|
|
32
35
|
|
|
@@ -153,6 +156,25 @@ export default class FileReleaseContext extends ReleaseContext {
|
|
|
153
156
|
return theorems;
|
|
154
157
|
}
|
|
155
158
|
|
|
159
|
+
getConjectures(includeDependencies = true) {
|
|
160
|
+
const conjectures = [];
|
|
161
|
+
|
|
162
|
+
push(conjectures, this.conjectures);
|
|
163
|
+
|
|
164
|
+
if (includeDependencies) {
|
|
165
|
+
const dependencyReleaseContexts = this.getDependencyReleaseContexts();
|
|
166
|
+
|
|
167
|
+
dependencyReleaseContexts.forEach((releaseContext) => {
|
|
168
|
+
const includeDependencies = false,
|
|
169
|
+
releaseContextConjectures = releaseContext.getConjectures(includeDependencies);
|
|
170
|
+
|
|
171
|
+
push(conjectures, releaseContextConjectures);
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
return conjectures;
|
|
176
|
+
}
|
|
177
|
+
|
|
156
178
|
getCombinators(includeDependencies = true) {
|
|
157
179
|
const combinators = [];
|
|
158
180
|
|
|
@@ -252,6 +274,14 @@ export default class FileReleaseContext extends ReleaseContext {
|
|
|
252
274
|
break;
|
|
253
275
|
}
|
|
254
276
|
|
|
277
|
+
case CONJECTURE_KIND: {
|
|
278
|
+
const conjecture = Conjecture.fromJSON(json, releaseContext);
|
|
279
|
+
|
|
280
|
+
this.conjectures.push(conjecture);
|
|
281
|
+
|
|
282
|
+
break;
|
|
283
|
+
}
|
|
284
|
+
|
|
255
285
|
case COMBINATOR_KIND: {
|
|
256
286
|
const combinator = Combinator.fromJSON(json, releaseContext);
|
|
257
287
|
|
|
@@ -288,9 +318,10 @@ export default class FileReleaseContext extends ReleaseContext {
|
|
|
288
318
|
axioms = [],
|
|
289
319
|
lemmas = [],
|
|
290
320
|
theorems = [],
|
|
321
|
+
conjectures = [],
|
|
291
322
|
combinators = [],
|
|
292
323
|
constructors = [],
|
|
293
|
-
releaseContext = new FileReleaseContext(log, name, entries, callbacks, verified, customGrammar, florenceLexer, florenceParser, dependencyReleaseContexts, contextJSON, types, rules, axioms, lemmas, theorems, combinators, constructors);
|
|
324
|
+
releaseContext = new FileReleaseContext(log, name, entries, callbacks, verified, customGrammar, florenceLexer, florenceParser, dependencyReleaseContexts, contextJSON, types, rules, axioms, lemmas, theorems, conjectures, combinators, constructors);
|
|
294
325
|
|
|
295
326
|
return releaseContext;
|
|
296
327
|
}
|