occam-verify-cli 0.0.958 → 0.0.960
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 +16 -5
- package/bin/utilities/releaseContext.js +5 -8
- package/lib/axiom.js +1 -7
- package/lib/combinator.js +1 -19
- package/lib/conclusion.js +1 -19
- package/lib/conjecture.js +1 -7
- package/lib/consequent.js +1 -19
- package/lib/constructor.js +1 -28
- package/lib/context/file.js +38 -14
- package/lib/context/local.js +1 -14
- package/lib/context/release.js +82 -52
- package/lib/frame.js +3 -3
- package/lib/index.js +5 -5
- package/lib/label.js +1 -16
- package/lib/lemma.js +1 -7
- package/lib/metaLemma.js +1 -7
- package/lib/metaType.js +1 -10
- package/lib/metatheorem.js +1 -7
- package/lib/metavariable.js +9 -34
- package/lib/premise.js +1 -18
- package/lib/proofStep.js +15 -15
- package/lib/releaseContext/create.js +8 -9
- package/lib/releaseContext/initialise.js +67 -0
- package/lib/rule.js +5 -49
- package/lib/ruleNames.js +1 -9
- package/lib/substitution/statementForMetavariable.js +8 -16
- package/lib/substitution/termForVariable.js +6 -6
- package/lib/substitution.js +7 -7
- package/lib/substitutions.js +7 -33
- package/lib/supposition.js +1 -18
- package/lib/theorem.js +1 -7
- package/lib/topLevelAssertion.js +5 -50
- package/lib/type.js +2 -38
- package/lib/unifier/equality.js +7 -7
- package/lib/unifier/intrinsicLevel.js +4 -4
- package/lib/unifier/metaLevel.js +10 -10
- package/lib/unifier/statementWithCombinator.js +147 -0
- package/lib/unifier/{termAgainstConstructor.js → termWithConstructor.js} +17 -17
- package/lib/unify/conclusionWithStatement.js +34 -0
- package/lib/unify/consequentWithStatement.js +34 -0
- package/lib/unify/metavariableWithStatement.js +74 -0
- package/lib/unify/premiseWithProofStep.js +41 -0
- package/lib/unify/premisesWithProofSteps.js +31 -0
- package/lib/unify/statementAtainstStatement.js +6 -6
- package/lib/unify/statementWithMetaType.js +48 -0
- package/lib/unify/suppositionWithProffStep.js +41 -0
- package/lib/unify/suppositionsWithProofSteps.js +31 -0
- package/lib/unify/termWithTerm.js +21 -0
- package/lib/unify/termWithType.js +32 -0
- package/lib/unify/variableWithTerm.js +54 -0
- package/lib/utilities/node.js +3 -42
- package/lib/utilities/tokens.js +1 -15
- package/lib/variable.js +1 -26
- package/lib/verify/error.js +2 -2
- package/lib/verify/judgement.js +3 -3
- package/lib/verify/metavariable.js +4 -4
- package/lib/verify/statement/qualified.js +51 -51
- package/lib/verify/statement.js +18 -18
- package/lib/verify/statementAsCombinator.js +2 -2
- package/lib/verify/term.js +25 -25
- package/package.json +1 -1
- package/src/axiom.js +0 -2
- package/src/combinator.js +0 -26
- package/src/conclusion.js +0 -24
- package/src/conjecture.js +0 -2
- package/src/consequent.js +0 -24
- package/src/constructor.js +0 -43
- package/src/context/file.js +42 -17
- package/src/context/local.js +0 -22
- package/src/context/release.js +84 -45
- package/src/frame.js +2 -2
- package/src/index.js +1 -1
- package/src/label.js +0 -18
- package/src/lemma.js +0 -2
- package/src/metaLemma.js +0 -2
- package/src/metaType.js +0 -9
- package/src/metatheorem.js +0 -2
- package/src/metavariable.js +6 -44
- package/src/premise.js +0 -22
- package/src/proofStep.js +14 -14
- package/src/releaseContext/create.js +8 -16
- package/src/releaseContext/{verify.js → initialise.js} +32 -23
- package/src/rule.js +4 -69
- package/src/ruleNames.js +0 -2
- package/src/substitution/statementForMetavariable.js +7 -21
- package/src/substitution/termForVariable.js +4 -4
- package/src/substitution.js +5 -5
- package/src/substitutions.js +5 -32
- package/src/supposition.js +0 -22
- package/src/theorem.js +0 -2
- package/src/topLevelAssertion.js +4 -72
- package/src/type.js +0 -44
- package/src/unifier/equality.js +6 -6
- package/src/unifier/intrinsicLevel.js +3 -3
- package/src/unifier/metaLevel.js +9 -9
- package/src/unifier/{statementAgainstCombinator.js → statementWithCombinator.js} +12 -12
- package/src/unifier/{termAgainstConstructor.js → termWithConstructor.js} +9 -9
- package/src/unify/{conclusionAgainstStatement.js → conclusionWithStatement.js} +3 -3
- package/src/unify/{consequentAgainstStatement.js → consequentWithStatement.js} +3 -3
- package/src/unify/{metavariableAgainstStatement.js → metavariableWithStatement.js} +12 -12
- package/src/unify/{premiseAgainstProofStep.js → premiseWithProofStep.js} +5 -5
- package/src/unify/{premisesAgainstProofSteps.js → premisesWithProofSteps.js} +3 -3
- package/src/unify/statementAtainstStatement.js +4 -4
- package/src/unify/{statementAgainstMetaType.js → statementWithMetaType.js} +5 -5
- package/src/unify/{suppositionAgainstProofStep.js → suppositionWithProffStep.js} +5 -5
- package/src/unify/{suppositionsAgainstProofSteps.js → suppositionsWithProofSteps.js} +3 -3
- package/src/unify/{termAgainstTerm.js → termWithTerm.js} +4 -4
- package/src/unify/{termAgainstType.js → termWithType.js} +4 -4
- package/src/unify/{variableAgainstTerm.js → variableWithTerm.js} +5 -5
- package/src/utilities/node.js +2 -48
- package/src/utilities/tokens.js +0 -15
- package/src/variable.js +0 -36
- package/src/verify/error.js +1 -1
- package/src/verify/judgement.js +3 -3
- package/src/verify/metavariable.js +3 -3
- package/src/verify/statement/qualified.js +50 -50
- package/src/verify/statement.js +17 -17
- package/src/verify/statementAsCombinator.js +1 -1
- package/src/verify/term.js +24 -24
- package/lib/releaseContext/verify.js +0 -66
- package/lib/unifier/statementAgainstCombinator.js +0 -147
- package/lib/unify/conclusionAgainstStatement.js +0 -34
- package/lib/unify/consequentAgainstStatement.js +0 -34
- package/lib/unify/metavariableAgainstStatement.js +0 -74
- package/lib/unify/premiseAgainstProofStep.js +0 -41
- package/lib/unify/premisesAgainstProofSteps.js +0 -31
- package/lib/unify/statementAgainstMetaType.js +0 -48
- package/lib/unify/suppositionAgainstProofStep.js +0 -41
- package/lib/unify/suppositionsAgainstProofSteps.js +0 -31
- package/lib/unify/termAgainstTerm.js +0 -21
- package/lib/unify/termAgainstType.js +0 -32
- package/lib/unify/variableAgainstTerm.js +0 -54
package/src/context/release.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { filePathUtilities } from "occam-entities";
|
|
3
4
|
import { lexersUtilities, parsersUtilities } from "occam-custom-grammars";
|
|
4
5
|
|
|
5
6
|
import FileContext from "./file";
|
|
@@ -8,18 +9,20 @@ import { objectType } from "../type";
|
|
|
8
9
|
import { tail, push, leftDifference } from "../utilities/array";
|
|
9
10
|
import { customGrammarFromNameAndEntries, combinedCustomGrammarFromReleaseContexts } from "../utilities/customGrammar";
|
|
10
11
|
|
|
11
|
-
const {
|
|
12
|
+
const { isFilePathFlorenceFilePath } = filePathUtilities,
|
|
13
|
+
{ florenceLexerFromCombinedCustomGrammar } = lexersUtilities,
|
|
12
14
|
{ florenceParserFromCombinedCustomGrammar } = parsersUtilities;
|
|
13
15
|
|
|
14
16
|
export default class ReleaseContext {
|
|
15
|
-
constructor(log,
|
|
17
|
+
constructor(log, name, entries, released, lexer, parser, verified, initialised, fileContexts, customGrammar, loggingDisabled, dependencyReleaseContexts) {
|
|
16
18
|
this.log = log;
|
|
17
|
-
this.json = json;
|
|
18
19
|
this.name = name;
|
|
20
|
+
this.entries = entries;
|
|
21
|
+
this.released = released;
|
|
19
22
|
this.lexer = lexer;
|
|
20
23
|
this.parser = parser;
|
|
21
|
-
this.entries = entries;
|
|
22
24
|
this.verified = verified;
|
|
25
|
+
this.initialised = initialised;
|
|
23
26
|
this.fileContexts = fileContexts;
|
|
24
27
|
this.customGrammar = customGrammar;
|
|
25
28
|
this.loggingDisabled = loggingDisabled;
|
|
@@ -30,14 +33,18 @@ export default class ReleaseContext {
|
|
|
30
33
|
return log;
|
|
31
34
|
}
|
|
32
35
|
|
|
33
|
-
getJSON() {
|
|
34
|
-
return this.json;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
36
|
getName() {
|
|
38
37
|
return this.name;
|
|
39
38
|
}
|
|
40
39
|
|
|
40
|
+
getEntries() {
|
|
41
|
+
return this.entries;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
isReleased() {
|
|
45
|
+
return this.released;
|
|
46
|
+
}
|
|
47
|
+
|
|
41
48
|
getLexer() {
|
|
42
49
|
return this.lexer;
|
|
43
50
|
}
|
|
@@ -46,14 +53,14 @@ export default class ReleaseContext {
|
|
|
46
53
|
return this.parser;
|
|
47
54
|
}
|
|
48
55
|
|
|
49
|
-
getEntries() {
|
|
50
|
-
return this.entries;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
56
|
isVerified() {
|
|
54
57
|
return this.verified;
|
|
55
58
|
}
|
|
56
59
|
|
|
60
|
+
isInitialised() {
|
|
61
|
+
return this.initialised;
|
|
62
|
+
}
|
|
63
|
+
|
|
57
64
|
getFileContexts() {
|
|
58
65
|
return this.fileContexts;
|
|
59
66
|
}
|
|
@@ -74,14 +81,18 @@ export default class ReleaseContext {
|
|
|
74
81
|
this.log = log;
|
|
75
82
|
}
|
|
76
83
|
|
|
77
|
-
setJSON(json) {
|
|
78
|
-
this.json = json;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
84
|
setName(name) {
|
|
82
85
|
this.name = name;
|
|
83
86
|
}
|
|
84
87
|
|
|
88
|
+
setEntries(entries) {
|
|
89
|
+
this.entries = entries;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
setReleased(released) {
|
|
93
|
+
this.released = released;
|
|
94
|
+
}
|
|
95
|
+
|
|
85
96
|
setLexer(lexer) {
|
|
86
97
|
this.lexer = lexer;
|
|
87
98
|
}
|
|
@@ -90,14 +101,14 @@ export default class ReleaseContext {
|
|
|
90
101
|
this.parser = parser;
|
|
91
102
|
}
|
|
92
103
|
|
|
93
|
-
setEntries(entries) {
|
|
94
|
-
this.entries = entries;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
104
|
setVerified(verified) {
|
|
98
105
|
this.verified = verified;
|
|
99
106
|
}
|
|
100
107
|
|
|
108
|
+
setInitialised(initialised) {
|
|
109
|
+
return this.initialised = initialised;
|
|
110
|
+
}
|
|
111
|
+
|
|
101
112
|
setFileContexts(fileContexts) {
|
|
102
113
|
this.fileContexts = fileContexts;
|
|
103
114
|
}
|
|
@@ -376,12 +387,6 @@ export default class ReleaseContext {
|
|
|
376
387
|
return type;
|
|
377
388
|
}
|
|
378
389
|
|
|
379
|
-
isReleased() {
|
|
380
|
-
const released = (this.json !== null);
|
|
381
|
-
|
|
382
|
-
return released;
|
|
383
|
-
}
|
|
384
|
-
|
|
385
390
|
getReleaseName() {
|
|
386
391
|
const name = this.getName(),
|
|
387
392
|
releaseName = name; ///
|
|
@@ -459,7 +464,9 @@ export default class ReleaseContext {
|
|
|
459
464
|
this.log.fatal(message, node, tokens, filePath);
|
|
460
465
|
}
|
|
461
466
|
|
|
462
|
-
|
|
467
|
+
initialise(releaseContexts) {
|
|
468
|
+
let initialised;
|
|
469
|
+
|
|
463
470
|
const combinedCustomGrammar = combinedCustomGrammarFromReleaseContexts(releaseContexts),
|
|
464
471
|
florenceParser = florenceParserFromCombinedCustomGrammar(combinedCustomGrammar),
|
|
465
472
|
florenceLexer = florenceLexerFromCombinedCustomGrammar(combinedCustomGrammar);
|
|
@@ -468,21 +475,39 @@ export default class ReleaseContext {
|
|
|
468
475
|
|
|
469
476
|
this.parser = florenceParser; ///
|
|
470
477
|
|
|
471
|
-
this.dependencyReleaseContexts = tail(releaseContexts)
|
|
478
|
+
this.dependencyReleaseContexts = tail(releaseContexts);
|
|
472
479
|
|
|
473
|
-
if (this.
|
|
474
|
-
const
|
|
480
|
+
if (this.released) {
|
|
481
|
+
const verified = this.verify();
|
|
475
482
|
|
|
476
|
-
|
|
483
|
+
initialised = verified; ///
|
|
484
|
+
} else {
|
|
485
|
+
initialised = true;
|
|
486
|
+
}
|
|
477
487
|
|
|
478
|
-
|
|
488
|
+
this.initialised = initialised;
|
|
479
489
|
|
|
480
|
-
|
|
490
|
+
return initialised;
|
|
491
|
+
}
|
|
481
492
|
|
|
482
|
-
|
|
493
|
+
verify() {
|
|
494
|
+
let verified;
|
|
483
495
|
|
|
484
|
-
|
|
485
|
-
|
|
496
|
+
const releaseContext = this;
|
|
497
|
+
|
|
498
|
+
releaseContext.disableLogging();
|
|
499
|
+
|
|
500
|
+
this.fileContexts = fileContextsFromEntries(this.entries, releaseContext);
|
|
501
|
+
|
|
502
|
+
const fileContextsVerified = verifyFileContexts(this.fileContexts, releaseContext);
|
|
503
|
+
|
|
504
|
+
verified = fileContextsVerified; ///
|
|
505
|
+
|
|
506
|
+
releaseContext.enableLogging();
|
|
507
|
+
|
|
508
|
+
this.verified = verified;
|
|
509
|
+
|
|
510
|
+
return verified;
|
|
486
511
|
}
|
|
487
512
|
|
|
488
513
|
toJSON() {
|
|
@@ -496,21 +521,24 @@ export default class ReleaseContext {
|
|
|
496
521
|
return json;
|
|
497
522
|
}
|
|
498
523
|
|
|
499
|
-
static
|
|
524
|
+
static fromLogNameEntriesAndReleased(log, name, entries, released) {
|
|
500
525
|
const lexer = null,
|
|
501
526
|
parser = null,
|
|
502
527
|
verified = false,
|
|
528
|
+
initialised = false,
|
|
503
529
|
fileContexts = [],
|
|
504
530
|
customGrammar = customGrammarFromNameAndEntries(name, entries),
|
|
505
531
|
loggingDisabled = false,
|
|
506
532
|
dependencyReleaseContexts = null,
|
|
507
|
-
releaseContext = new ReleaseContext(log,
|
|
533
|
+
releaseContext = new ReleaseContext(log, name, entries, released, lexer, parser, verified, initialised, fileContexts, customGrammar, loggingDisabled, dependencyReleaseContexts);
|
|
508
534
|
|
|
509
535
|
return releaseContext;
|
|
510
536
|
}
|
|
511
537
|
}
|
|
512
538
|
|
|
513
539
|
function verifyFileContexts(fileContexts, releaseContext) {
|
|
540
|
+
let fileContextsVerified;
|
|
541
|
+
|
|
514
542
|
fileContexts = [ ///
|
|
515
543
|
...fileContexts
|
|
516
544
|
];
|
|
@@ -543,16 +571,27 @@ function verifyFileContexts(fileContexts, releaseContext) {
|
|
|
543
571
|
|
|
544
572
|
leftDifference(fileContexts, verifiedFileContexts);
|
|
545
573
|
}
|
|
574
|
+
|
|
575
|
+
const fileContextsLength = fileContexts.length;
|
|
576
|
+
|
|
577
|
+
fileContextsVerified = (fileContextsLength === 0);
|
|
578
|
+
|
|
579
|
+
return fileContextsVerified;
|
|
546
580
|
}
|
|
547
581
|
|
|
548
|
-
function
|
|
549
|
-
const
|
|
550
|
-
fileContexts = fileContextsJSON.map((fileContextJSON) => {
|
|
551
|
-
const json = fileContextJSON, ///
|
|
552
|
-
fileContext = FileContext.fromJSONAndReleaseContext(json, releaseContext);
|
|
582
|
+
function fileContextsFromEntries(entries, releaseContext) {
|
|
583
|
+
const fileContexts = [];
|
|
553
584
|
|
|
554
|
-
|
|
555
|
-
|
|
585
|
+
entries.forEachFile((file) => {
|
|
586
|
+
const filePath = file.getPath(),
|
|
587
|
+
filePathFlorenceFilePath = isFilePathFlorenceFilePath(filePath);
|
|
588
|
+
|
|
589
|
+
if (filePathFlorenceFilePath) {
|
|
590
|
+
const fileContext = FileContext.fromFileAndReleaseContext(file, releaseContext);
|
|
591
|
+
|
|
592
|
+
fileContexts.push(fileContext);
|
|
593
|
+
}
|
|
594
|
+
});
|
|
556
595
|
|
|
557
596
|
return fileContexts;
|
|
558
597
|
}
|
package/src/frame.js
CHANGED
|
@@ -38,9 +38,9 @@ export default class Frame {
|
|
|
38
38
|
|
|
39
39
|
unifySubstitution(substitution) {
|
|
40
40
|
const substitutionUnified = this.declarations.some((declaration) => {
|
|
41
|
-
const
|
|
41
|
+
const substitutionUnifiedWithDeclaration = declaration.unifySubstitution(substitution);
|
|
42
42
|
|
|
43
|
-
if (
|
|
43
|
+
if (substitutionUnifiedWithDeclaration) {
|
|
44
44
|
return true;
|
|
45
45
|
}
|
|
46
46
|
});
|
package/src/index.js
CHANGED
|
@@ -4,6 +4,6 @@ export { default as Log } from "./log";
|
|
|
4
4
|
export { default as verifyRelease } from "./verify/release";
|
|
5
5
|
export { default as ReleaseContext } from "./context/release";
|
|
6
6
|
export { default as createReleaseContext } from "./releaseContext/create";
|
|
7
|
-
export { default as verifyReleaseContext } from "./releaseContext/verify";
|
|
8
7
|
export { default as customGrammarUtilities } from "./utilities/customGrammar";
|
|
8
|
+
export { default as initialiseReleaseContext } from "./releaseContext/initialise";
|
|
9
9
|
|
package/src/label.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { nodeAsString } from "./utilities/string";
|
|
4
|
-
import { metavariableNodeFromMetavariableString } from "./utilities/node";
|
|
5
4
|
|
|
6
5
|
export default class Label {
|
|
7
6
|
constructor(metavariableNode) {
|
|
@@ -24,26 +23,9 @@ export default class Label {
|
|
|
24
23
|
return string;
|
|
25
24
|
}
|
|
26
25
|
|
|
27
|
-
toJSON(tokens) {
|
|
28
|
-
const string = nodeAsString(this.metavariableNode, tokens),
|
|
29
|
-
json = string; ///
|
|
30
|
-
|
|
31
|
-
return json;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
26
|
static fromMetavariableNode(metavariableNode) {
|
|
35
27
|
const label = new Label(metavariableNode);
|
|
36
28
|
|
|
37
29
|
return label;
|
|
38
30
|
}
|
|
39
|
-
|
|
40
|
-
static fromJSONAndFileContext(json, fileContext) {
|
|
41
|
-
const metavariableString = json, ///
|
|
42
|
-
lexer = fileContext.getLexer(),
|
|
43
|
-
parser = fileContext.getParser(),
|
|
44
|
-
metavariableNode = metavariableNodeFromMetavariableString(metavariableString, lexer, parser),
|
|
45
|
-
label = new Label(metavariableNode);
|
|
46
|
-
|
|
47
|
-
return label;
|
|
48
|
-
}
|
|
49
31
|
}
|
package/src/lemma.js
CHANGED
|
@@ -3,7 +3,5 @@
|
|
|
3
3
|
import TopLevelAssertion from "./topLevelAssertion";
|
|
4
4
|
|
|
5
5
|
export default class Lemma extends TopLevelAssertion {
|
|
6
|
-
static fromJSONAndFileContext(json, fileContext) { return TopLevelAssertion.fromJSONAndFileContext(Lemma,json, fileContext); }
|
|
7
|
-
|
|
8
6
|
static fromLabelsSuppositionsConsequentSubstitutionsAndFileContext(labels, suppositions, consequent, substitutions, fileContext) { return TopLevelAssertion.fromLabelsSuppositionsConsequentSubstitutionsAndFileContext(Lemma, labels, suppositions, consequent, substitutions, fileContext); }
|
|
9
7
|
}
|
package/src/metaLemma.js
CHANGED
|
@@ -3,7 +3,5 @@
|
|
|
3
3
|
import TopLevelAssertion from "./topLevelAssertion";
|
|
4
4
|
|
|
5
5
|
export default class MetaLemma extends TopLevelAssertion {
|
|
6
|
-
static fromJSONAndFileContext(json, fileContext) { return TopLevelAssertion.fromJSONAndFileContext(MetaLemma, json, fileContext); }
|
|
7
|
-
|
|
8
6
|
static fromLabelsSuppositionsConsequentSubstitutionsAndFileContext(labels, suppositions, consequent, substitutions, fileContext) { return MetaLemma.fromLabelsSuppositionsConsequentSubstitutionsAndFileContext(Metatheorem, labels, suppositions, consequent, substitutions, fileContext); }
|
|
9
7
|
}
|
package/src/metaType.js
CHANGED
|
@@ -50,15 +50,6 @@ export default class MetaType {
|
|
|
50
50
|
return string;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
toJSON(tokens) {
|
|
54
|
-
const name = this.name,
|
|
55
|
-
json = {
|
|
56
|
-
name
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
return json;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
53
|
static fromMetaTypeName(metaTypeName) {
|
|
63
54
|
const name = metaTypeName, ///
|
|
64
55
|
metaType = new MetaType(name);
|
package/src/metatheorem.js
CHANGED
|
@@ -3,7 +3,5 @@
|
|
|
3
3
|
import TopLevelAssertion from "./topLevelAssertion";
|
|
4
4
|
|
|
5
5
|
export default class Metatheorem extends TopLevelAssertion {
|
|
6
|
-
static fromJSONAndFileContext(json, fileContext) { return TopLevelAssertion.fromJSONAndFileContext(Metatheorem, json, fileContext); }
|
|
7
|
-
|
|
8
6
|
static fromLabelsSuppositionsConsequentSubstitutionsAndFileContext(labels, suppositions, consequent, substitutions, fileContext) { return TopLevelAssertion.fromLabelsSuppositionsConsequentSubstitutionsAndFileContext(Metatheorem, labels, suppositions, consequent, substitutions, fileContext); }
|
|
9
7
|
}
|
package/src/metavariable.js
CHANGED
|
@@ -6,8 +6,6 @@ import { first } from "./utilities/array";
|
|
|
6
6
|
import { nodeQuery } from "./utilities/query";
|
|
7
7
|
import { nodeAsString } from "./utilities/string";
|
|
8
8
|
import { nameFromMetavariableNode } from "./utilities/name";
|
|
9
|
-
import { metaTypeFromJSONAndFileContext } from "./metaType";
|
|
10
|
-
import { metavariableNodeFromMetavariableString } from "./utilities/node";
|
|
11
9
|
|
|
12
10
|
const termNodeQuery = nodeQuery("/metavariable/argument/term!"),
|
|
13
11
|
typeNodeQuery = nodeQuery("/metavariable/argument/type!");
|
|
@@ -65,9 +63,9 @@ export default class Metavariable {
|
|
|
65
63
|
} else if ((termNode === null) && (this.termType === null)) {
|
|
66
64
|
matchesNode = true;
|
|
67
65
|
} else if ((termNode !== null) && (this.termType !== null)) {
|
|
68
|
-
const
|
|
66
|
+
const termUnifiedWithTermType = unifyTermWithTermType(termNode, this.termType, localContext);
|
|
69
67
|
|
|
70
|
-
matchesNode =
|
|
68
|
+
matchesNode = termUnifiedWithTermType; ///
|
|
71
69
|
}
|
|
72
70
|
}
|
|
73
71
|
}
|
|
@@ -75,19 +73,6 @@ export default class Metavariable {
|
|
|
75
73
|
return matchesNode;
|
|
76
74
|
}
|
|
77
75
|
|
|
78
|
-
toJSON(tokens) {
|
|
79
|
-
const metaTypeJSON = this.metaType.toJSON(tokens),
|
|
80
|
-
string = nodeAsString(this.node, tokens),
|
|
81
|
-
node = string, //
|
|
82
|
-
metaType = metaTypeJSON, ///
|
|
83
|
-
json = {
|
|
84
|
-
node,
|
|
85
|
-
metaType
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
return json;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
76
|
asString(tokens) {
|
|
92
77
|
const metaTypeName = this.metaType.getName();
|
|
93
78
|
|
|
@@ -98,29 +83,6 @@ export default class Metavariable {
|
|
|
98
83
|
return string;
|
|
99
84
|
}
|
|
100
85
|
|
|
101
|
-
static fromJSONAndFileContext(json, fileContext) {
|
|
102
|
-
let { node } = json;
|
|
103
|
-
|
|
104
|
-
const lexer = fileContext.getLexer(),
|
|
105
|
-
parser = fileContext.getParser(),
|
|
106
|
-
variableString = node, ///
|
|
107
|
-
metavariableNode = metavariableNodeFromMetavariableString(variableString, lexer, parser);
|
|
108
|
-
|
|
109
|
-
node = metavariableNode; ///
|
|
110
|
-
|
|
111
|
-
let { metaType } = json;
|
|
112
|
-
|
|
113
|
-
json = metaType; ///
|
|
114
|
-
|
|
115
|
-
metaType = metaTypeFromJSONAndFileContext(json, fileContext);
|
|
116
|
-
|
|
117
|
-
const name = nameFromMetavariableNode(metavariableNode),
|
|
118
|
-
termType = termTypeFromMetavariableNode(metavariableNode, fileContext),
|
|
119
|
-
metavariable = new Metavariable(node, name, termType, metaType);
|
|
120
|
-
|
|
121
|
-
return metavariable;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
86
|
static fromNodeNameTermTypeAndMetaType(node, name, termType, metaType) {
|
|
125
87
|
const metavariable = new Metavariable(node, name, termType, metaType);
|
|
126
88
|
|
|
@@ -128,8 +90,8 @@ export default class Metavariable {
|
|
|
128
90
|
}
|
|
129
91
|
}
|
|
130
92
|
|
|
131
|
-
export function
|
|
132
|
-
let
|
|
93
|
+
export function unifyTermWithTermType(termNode, termType, localContext) {
|
|
94
|
+
let termUnifiedWithTermType;
|
|
133
95
|
|
|
134
96
|
const type = termType, ///
|
|
135
97
|
terms = [],
|
|
@@ -148,9 +110,9 @@ export function unifyTermAgainstTermType(termNode, termType, localContext) {
|
|
|
148
110
|
return verifiedAhead;
|
|
149
111
|
});
|
|
150
112
|
|
|
151
|
-
|
|
113
|
+
termUnifiedWithTermType = termVerified; ///
|
|
152
114
|
|
|
153
|
-
return
|
|
115
|
+
return termUnifiedWithTermType;
|
|
154
116
|
}
|
|
155
117
|
|
|
156
118
|
function termTypeFromMetavariableNode(metavariableNode, fileContext) {
|
package/src/premise.js
CHANGED
|
@@ -5,7 +5,6 @@ import metaLevelUnifier from "./unifier/metaLevel";
|
|
|
5
5
|
import { match } from "./utilities/array";
|
|
6
6
|
import { nodeAsString } from "./utilities/string";
|
|
7
7
|
import { nodeQuery, nodesQuery } from "./utilities/query";
|
|
8
|
-
import { statementNodeFromStatementString } from "./utilities/node";
|
|
9
8
|
|
|
10
9
|
const subproofAssertionNodeQuery = nodeQuery("/statement/subproofAssertion!"),
|
|
11
10
|
subproofAssertionStatementNodesQuery = nodesQuery("/subproofAssertion/statement"),
|
|
@@ -66,30 +65,9 @@ export default class Premise {
|
|
|
66
65
|
return subproofUnified;
|
|
67
66
|
}
|
|
68
67
|
|
|
69
|
-
toJSON(tokens) {
|
|
70
|
-
const statementString = nodeAsString(this.statementNode, tokens),
|
|
71
|
-
statement = statementString, ///
|
|
72
|
-
json = {
|
|
73
|
-
statement
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
return json;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
68
|
static fromStatementNode(statementNode) {
|
|
80
69
|
const premise = new Premise(statementNode);
|
|
81
70
|
|
|
82
71
|
return premise;
|
|
83
72
|
}
|
|
84
|
-
|
|
85
|
-
static fromJSONAndFileContext(json, fileContext) {
|
|
86
|
-
const { statement } = json,
|
|
87
|
-
statementString = statement, ///
|
|
88
|
-
lexer = fileContext.getLexer(),
|
|
89
|
-
parser = fileContext.getParser(),
|
|
90
|
-
statementNode = statementNodeFromStatementString(statementString, lexer, parser),
|
|
91
|
-
premise = new Premise(statementNode);
|
|
92
|
-
|
|
93
|
-
return premise;
|
|
94
|
-
}
|
|
95
73
|
}
|
package/src/proofStep.js
CHANGED
|
@@ -21,23 +21,23 @@ export default class ProofStep {
|
|
|
21
21
|
let statementUnified = false;
|
|
22
22
|
|
|
23
23
|
if (this.statementNode !== null) {
|
|
24
|
-
let
|
|
24
|
+
let statementUnifiedWithStatement = false;
|
|
25
25
|
|
|
26
|
-
if (!
|
|
26
|
+
if (!statementUnifiedWithStatement) {
|
|
27
27
|
const statementNodeA = statementNode, ///
|
|
28
28
|
statementNodeB = this.statementNode; ///
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
statementUnifiedWithStatement = unifyStatementWithStatement(statementNodeA, statementNodeB, equivalences, localContextA, localContextB);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
if (!
|
|
33
|
+
if (!statementUnifiedWithStatement) {
|
|
34
34
|
const statementNodeA = statementNode, ///
|
|
35
35
|
statementNodeB = this.statementNode; ///
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
statementUnifiedWithStatement = unifyStatementWithStatement(statementNodeA, statementNodeB, equivalences, localContextA, localContextB);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
statementUnified =
|
|
40
|
+
statementUnified = statementUnifiedWithStatement; ///
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
return statementUnified;
|
|
@@ -58,13 +58,13 @@ export default class ProofStep {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
function
|
|
62
|
-
let
|
|
61
|
+
function unifyStatementWithStatement(statementNodeA, statementNodeB, equivalences, localContextA, localContextB) {
|
|
62
|
+
let statementUnifiedWithStatement = false;
|
|
63
63
|
|
|
64
64
|
const statementStringA = localContextA.nodeAsString(statementNodeA),
|
|
65
65
|
statementStringB = localContextB.nodeAsString(statementNodeB);
|
|
66
66
|
|
|
67
|
-
localContextB.trace(`Unifying the '${statementStringB}' statement
|
|
67
|
+
localContextB.trace(`Unifying the '${statementStringB}' statement with the '${statementStringA}' statement...`, statementNodeB);
|
|
68
68
|
|
|
69
69
|
const substitutions = Substitutions.fromNothing(),
|
|
70
70
|
nodeA = statementNodeA, ///
|
|
@@ -72,14 +72,14 @@ function unifyStatementAgainstStatement(statementNodeA, statementNodeB, equivale
|
|
|
72
72
|
unified = intrinsicLevelUnifier.unify(nodeA, nodeB, substitutions, localContextA, localContextB);
|
|
73
73
|
|
|
74
74
|
if (unified) {
|
|
75
|
-
const
|
|
75
|
+
const substitutionsUnifiedWithEquivalences = substitutions.unifyWithEquivalences(equivalences, localContextA, localContextB);
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
statementUnifiedWithStatement = substitutionsUnifiedWithEquivalences; ///
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
if (
|
|
81
|
-
localContextB.debug(`...unified the '${statementStringB}' statement
|
|
80
|
+
if (statementUnifiedWithStatement) {
|
|
81
|
+
localContextB.debug(`...unified the '${statementStringB}' statement with the '${statementStringA}' statement.`, statementNodeB);
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
return
|
|
84
|
+
return statementUnifiedWithStatement;
|
|
85
85
|
}
|
|
@@ -12,11 +12,9 @@ export default function createReleaseContext(dependency, dependentNames, context
|
|
|
12
12
|
log.debug(`Creating the '${releaseName}' context given the '${dependencyString}' dependency...`);
|
|
13
13
|
|
|
14
14
|
if (releaseContext !== null) {
|
|
15
|
-
const error = null
|
|
16
|
-
version = releaseContext.getVersion(),
|
|
17
|
-
versionString = version.toString();
|
|
15
|
+
const error = null;
|
|
18
16
|
|
|
19
|
-
log.debug(`...already created the '${releaseName}
|
|
17
|
+
log.debug(`...already created the '${releaseName}' context.`);
|
|
20
18
|
|
|
21
19
|
callback(error);
|
|
22
20
|
|
|
@@ -52,20 +50,17 @@ export default function createReleaseContext(dependency, dependentNames, context
|
|
|
52
50
|
return;
|
|
53
51
|
}
|
|
54
52
|
|
|
55
|
-
const version = releaseContext.getVersion(),
|
|
56
|
-
versionString = version.toString();
|
|
57
|
-
|
|
58
53
|
releaseContextMap[releaseName] = releaseContext;
|
|
59
54
|
|
|
60
|
-
|
|
55
|
+
log.info(`...created the '${releaseName}' context.`);
|
|
56
|
+
|
|
57
|
+
createDependencyReleaseContexts(dependency, releaseContext, dependentNames, context, (error) => {
|
|
61
58
|
if (error) {
|
|
62
59
|
callback(error);
|
|
63
60
|
|
|
64
61
|
return;
|
|
65
62
|
}
|
|
66
63
|
|
|
67
|
-
log.info(`...created the '${releaseName}@${versionString}' context.`);
|
|
68
|
-
|
|
69
64
|
callback(error);
|
|
70
65
|
});
|
|
71
66
|
}, context);
|
|
@@ -122,7 +117,7 @@ function checkReleaseMatchesDependency(releaseContext, dependency, dependentName
|
|
|
122
117
|
versionString = version.toString(),
|
|
123
118
|
dependencyString = dependency.asString();
|
|
124
119
|
|
|
125
|
-
log.
|
|
120
|
+
log.warning(`Version mismatch: The '${dependentName}' dependent requires the '${dependencyString}' dependency but a context with version '${versionString}' was provided.`);
|
|
126
121
|
|
|
127
122
|
releaseMatchesDependency = false;
|
|
128
123
|
}
|
|
@@ -131,11 +126,8 @@ function checkReleaseMatchesDependency(releaseContext, dependency, dependentName
|
|
|
131
126
|
return releaseMatchesDependency;
|
|
132
127
|
}
|
|
133
128
|
|
|
134
|
-
function createDependencyReleaseContexts(dependency, dependentNames, context, callback) {
|
|
135
|
-
const
|
|
136
|
-
dependencyName = dependency.getName(),
|
|
137
|
-
releaseName = dependencyName, ///
|
|
138
|
-
releaseContext = releaseContextMap[releaseName],
|
|
129
|
+
function createDependencyReleaseContexts(dependency, releaseContext, dependentNames, context, callback) {
|
|
130
|
+
const dependencyName = dependency.getName(),
|
|
139
131
|
dependencies = releaseContext.getDependencies();
|
|
140
132
|
|
|
141
133
|
dependentNames = [ ...dependentNames, dependencyName ]; ///
|