occam-verify-cli 0.0.957 → 0.0.959
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/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/local.js +1 -14
- 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 +1 -26
- package/lib/premise.js +1 -18
- package/lib/rule.js +1 -45
- package/lib/ruleNames.js +1 -9
- package/lib/substitution/statementForMetavariable.js +1 -9
- package/lib/substitutions.js +1 -27
- package/lib/supposition.js +1 -18
- package/lib/theorem.js +1 -7
- package/lib/topLevelAssertion.js +1 -46
- package/lib/type.js +2 -38
- package/lib/utilities/node.js +3 -42
- package/lib/utilities/tokens.js +1 -15
- package/lib/variable.js +1 -26
- package/lib/verify/assertion/type.js +21 -20
- 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/local.js +0 -22
- 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 +0 -38
- package/src/premise.js +0 -22
- package/src/rule.js +0 -65
- package/src/ruleNames.js +0 -2
- package/src/substitution/statementForMetavariable.js +0 -14
- package/src/substitutions.js +0 -27
- package/src/supposition.js +0 -22
- package/src/theorem.js +0 -2
- package/src/topLevelAssertion.js +0 -68
- package/src/type.js +0 -44
- package/src/utilities/node.js +2 -48
- package/src/utilities/tokens.js +0 -15
- package/src/variable.js +0 -36
- package/src/verify/assertion/type.js +26 -26
package/src/combinator.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { nodeAsString } from "./utilities/string";
|
|
4
|
-
import { statementNodeFromUnqualifiedStatementTokens } from "./utilities/node";
|
|
5
|
-
import { unqualifiedStatementTokensFromStatementString } from "./utilities/tokens";
|
|
6
4
|
|
|
7
5
|
export default class Combinator {
|
|
8
6
|
constructor(statementNode, string) {
|
|
@@ -18,36 +16,12 @@ export default class Combinator {
|
|
|
18
16
|
return this.string;
|
|
19
17
|
}
|
|
20
18
|
|
|
21
|
-
toJSON(tokens) {
|
|
22
|
-
const statementString = nodeAsString(this.statementNode, tokens),
|
|
23
|
-
statement = statementString, ///
|
|
24
|
-
json = {
|
|
25
|
-
statement
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
return json;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
19
|
static fromStatementNodeAndTokens(statementNode, tokens) {
|
|
32
20
|
const string = stringFromStatementNodeAndTokens(statementNode, tokens),
|
|
33
21
|
combinator = new Combinator(statementNode, string);
|
|
34
22
|
|
|
35
23
|
return combinator;
|
|
36
24
|
}
|
|
37
|
-
|
|
38
|
-
static fromJSONAndFileContext(json, fileContext) {
|
|
39
|
-
const { statement } = json,
|
|
40
|
-
statementString = statement, ///
|
|
41
|
-
lexer = fileContext.getLexer(),
|
|
42
|
-
parser = fileContext.getParser(),
|
|
43
|
-
unqualifiedStatementTokens = unqualifiedStatementTokensFromStatementString(statementString, lexer),
|
|
44
|
-
statementNode = statementNodeFromUnqualifiedStatementTokens(unqualifiedStatementTokens, parser),
|
|
45
|
-
tokens = unqualifiedStatementTokens, //
|
|
46
|
-
string = stringFromStatementNodeAndTokens(statementNode, tokens),
|
|
47
|
-
combinator = new Combinator(statementNode, string);
|
|
48
|
-
|
|
49
|
-
return combinator;
|
|
50
|
-
}
|
|
51
25
|
}
|
|
52
26
|
|
|
53
27
|
function stringFromStatementNodeAndTokens(statementNode, tokens) {
|
package/src/conclusion.js
CHANGED
|
@@ -2,9 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import metaLevelUnifier from "./unifier/metaLevel";
|
|
4
4
|
|
|
5
|
-
import { nodeAsString } from "./utilities/string";
|
|
6
|
-
import { statementNodeFromStatementString } from "./utilities/node";
|
|
7
|
-
|
|
8
5
|
export default class Conclusion {
|
|
9
6
|
constructor(statementNode) {
|
|
10
7
|
this.statementNode = statementNode;
|
|
@@ -28,30 +25,9 @@ export default class Conclusion {
|
|
|
28
25
|
return statementUnified;
|
|
29
26
|
}
|
|
30
27
|
|
|
31
|
-
toJSON(tokens) {
|
|
32
|
-
const statementString = nodeAsString(this.statementNode, tokens),
|
|
33
|
-
statement = statementString, ///
|
|
34
|
-
json = {
|
|
35
|
-
statement
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
return json;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
28
|
static fromStatementNode(statementNode) {
|
|
42
29
|
const conclusion = new Conclusion(statementNode);
|
|
43
30
|
|
|
44
31
|
return conclusion;
|
|
45
32
|
}
|
|
46
|
-
|
|
47
|
-
static fromJSONAndFileContext(json, fileContext) {
|
|
48
|
-
const { statement } = json,
|
|
49
|
-
statementString = statement, ///
|
|
50
|
-
lexer = fileContext.getLexer(),
|
|
51
|
-
parser = fileContext.getParser(),
|
|
52
|
-
statementNode = statementNodeFromStatementString(statementString, lexer, parser),
|
|
53
|
-
conclusion = new Conclusion(statementNode);
|
|
54
|
-
|
|
55
|
-
return conclusion;
|
|
56
|
-
}
|
|
57
33
|
}
|
package/src/conjecture.js
CHANGED
|
@@ -3,7 +3,5 @@
|
|
|
3
3
|
import TopLevelAssertion from "./topLevelAssertion";
|
|
4
4
|
|
|
5
5
|
export default class Conjecture extends TopLevelAssertion {
|
|
6
|
-
static fromJSONAndFileContext(json, fileContext) { return TopLevelAssertion.fromJSONAndFileContext(Conjecture, json, fileContext); }
|
|
7
|
-
|
|
8
6
|
static fromLabelsSuppositionsConsequentSubstitutionsAndFileContext(labels, suppositions, consequent, substitutions, fileContext) { return TopLevelAssertion.fromLabelsSuppositionsConsequentSubstitutionsAndFileContext(Conjecture, labels, suppositions, consequent, substitutions, fileContext); }
|
|
9
7
|
}
|
package/src/consequent.js
CHANGED
|
@@ -2,9 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import metaLevelUnifier from "./unifier/metaLevel";
|
|
4
4
|
|
|
5
|
-
import { nodeAsString } from "./utilities/string";
|
|
6
|
-
import { statementNodeFromStatementString } from "./utilities/node";
|
|
7
|
-
|
|
8
5
|
export default class Consequent {
|
|
9
6
|
constructor(statementNode) {
|
|
10
7
|
this.statementNode = statementNode;
|
|
@@ -28,30 +25,9 @@ export default class Consequent {
|
|
|
28
25
|
return statementUnified;
|
|
29
26
|
}
|
|
30
27
|
|
|
31
|
-
toJSON(tokens) {
|
|
32
|
-
const statementString = nodeAsString(this.statementNode, tokens),
|
|
33
|
-
statement = statementString, ///
|
|
34
|
-
json = {
|
|
35
|
-
statement
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
return json;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
28
|
static fromStatementNode(statementNode) {
|
|
42
29
|
const consequent = new Consequent(statementNode);
|
|
43
30
|
|
|
44
31
|
return consequent;
|
|
45
32
|
}
|
|
46
|
-
|
|
47
|
-
static fromJSONAndFileContext(json, fileContext) {
|
|
48
|
-
const { statement } = json,
|
|
49
|
-
statementString = statement, ///
|
|
50
|
-
lexer = fileContext.getLexer(),
|
|
51
|
-
parser = fileContext.getParser(),
|
|
52
|
-
statementNode = statementNodeFromStatementString(statementString, lexer, parser),
|
|
53
|
-
consequent = new Consequent(statementNode);
|
|
54
|
-
|
|
55
|
-
return consequent;
|
|
56
|
-
}
|
|
57
33
|
}
|
package/src/constructor.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { nodeAsString } from "./utilities/string";
|
|
4
|
-
import { typeFromJSONAndFileContext } from "./type";
|
|
5
|
-
import { termNodeFromConstructorDeclarationTokens } from "./utilities/node";
|
|
6
|
-
import { constructorDeclarationTokensFromTermString } from "./utilities/tokens";
|
|
7
4
|
|
|
8
5
|
export default class Constructor {
|
|
9
6
|
constructor(termNode, string, type) {
|
|
@@ -24,52 +21,12 @@ export default class Constructor {
|
|
|
24
21
|
return this.type;
|
|
25
22
|
}
|
|
26
23
|
|
|
27
|
-
toJSON(tokens) {
|
|
28
|
-
const termString = nodeAsString(this.termNode, tokens),
|
|
29
|
-
typeJSON = (this.type === null) ?
|
|
30
|
-
null :
|
|
31
|
-
this.type.toJSON(tokens),
|
|
32
|
-
term = termString, ///
|
|
33
|
-
type = typeJSON, ///
|
|
34
|
-
json = {
|
|
35
|
-
term,
|
|
36
|
-
type
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
return json;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
24
|
static fromTermNodeTypeAndTokens(termNode, type, tokens) {
|
|
43
25
|
const string = stringFromTermNodeTypeAndTokens(termNode, type, tokens),
|
|
44
26
|
constructor = new Constructor(termNode, string, type);
|
|
45
27
|
|
|
46
28
|
return constructor;
|
|
47
29
|
}
|
|
48
|
-
|
|
49
|
-
static fromJSONAndFileContext(json, fileContext) {
|
|
50
|
-
const { term } = json,
|
|
51
|
-
termString = term, ///
|
|
52
|
-
lexer = fileContext.getLexer(),
|
|
53
|
-
parser = fileContext.getParser(),
|
|
54
|
-
constructorDeclarationTokens = constructorDeclarationTokensFromTermString(termString, lexer),
|
|
55
|
-
termNode = termNodeFromConstructorDeclarationTokens(constructorDeclarationTokens, parser);
|
|
56
|
-
|
|
57
|
-
let { type } = json;
|
|
58
|
-
|
|
59
|
-
if (type !== null) {
|
|
60
|
-
const typeJSON = type; ///
|
|
61
|
-
|
|
62
|
-
json = typeJSON; ///
|
|
63
|
-
|
|
64
|
-
type = typeFromJSONAndFileContext(json, fileContext);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const tokens = constructorDeclarationTokens, ///
|
|
68
|
-
string = stringFromTermNodeTypeAndTokens(termNode, type, tokens),
|
|
69
|
-
constructor = new Constructor(termNode, string, type);
|
|
70
|
-
|
|
71
|
-
return constructor;
|
|
72
|
-
}
|
|
73
30
|
}
|
|
74
31
|
|
|
75
32
|
function stringFromTermNodeTypeAndTokens(termNode, type, tokens) {
|
package/src/context/local.js
CHANGED
|
@@ -451,28 +451,6 @@ class LocalContext {
|
|
|
451
451
|
|
|
452
452
|
return localContext;
|
|
453
453
|
}
|
|
454
|
-
|
|
455
|
-
static fromJSONAndFileContext(json, fileContext) {
|
|
456
|
-
let { variables } = json;
|
|
457
|
-
|
|
458
|
-
const variablesJSON = variables;
|
|
459
|
-
|
|
460
|
-
variables = variablesJSON.map((variableJSON) => {
|
|
461
|
-
const json = variableJSON, ///
|
|
462
|
-
variable = Variable.fromJSONAndFileContext(json, fileContext);
|
|
463
|
-
|
|
464
|
-
return variable;
|
|
465
|
-
});
|
|
466
|
-
|
|
467
|
-
const context = fileContext, ///
|
|
468
|
-
proofSteps = [],
|
|
469
|
-
equivalences = [],
|
|
470
|
-
judgements = [],
|
|
471
|
-
metavariables = [],
|
|
472
|
-
localContext = new LocalContext(context, variables, proofSteps, judgements, equivalences, metavariables); ///
|
|
473
|
-
|
|
474
|
-
return localContext;
|
|
475
|
-
}
|
|
476
454
|
}
|
|
477
455
|
|
|
478
456
|
export default LocalContext;
|
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!");
|
|
@@ -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
|
|
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/rule.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import Label from "./label";
|
|
4
|
-
import Premise from "./premise";
|
|
5
|
-
import Conclusion from "./conclusion";
|
|
6
3
|
import Substitutions from "./substitutions";
|
|
7
4
|
import unifyPremisesAgainstProofSteps from "./unify/premisesAgainstProofSteps";
|
|
8
5
|
import unifyConclusionAgainstStatement from "./unify/conclusionAgainstStatement";
|
|
@@ -64,68 +61,6 @@ export default class Rule {
|
|
|
64
61
|
return matchesMetavariableNode;
|
|
65
62
|
}
|
|
66
63
|
|
|
67
|
-
toJSON(tokens) {
|
|
68
|
-
const labelsJSON = this.labels.map((label) => {
|
|
69
|
-
const labelJSON = label.toJSON(tokens);
|
|
70
|
-
|
|
71
|
-
return labelJSON;
|
|
72
|
-
}),
|
|
73
|
-
premisesJSON = this.premises.map((premise) => {
|
|
74
|
-
const premiseJSON = premise.toJSON(tokens);
|
|
75
|
-
|
|
76
|
-
return premiseJSON;
|
|
77
|
-
}),
|
|
78
|
-
conclusionJSON = this.conclusion.toJSON(tokens),
|
|
79
|
-
labels = labelsJSON, ///
|
|
80
|
-
premises = premisesJSON, ///
|
|
81
|
-
conclusion = conclusionJSON, ///
|
|
82
|
-
json = {
|
|
83
|
-
labels,
|
|
84
|
-
premises,
|
|
85
|
-
conclusion
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
return json;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
static fromJSONAndFileContext(json, fileContext) {
|
|
92
|
-
let rule;
|
|
93
|
-
|
|
94
|
-
let { labels } = json;
|
|
95
|
-
|
|
96
|
-
const labelsJSON = labels; ///
|
|
97
|
-
|
|
98
|
-
labels = labelsJSON.map((labelJSON) => {
|
|
99
|
-
const json = labelJSON, ///
|
|
100
|
-
label = Label.fromJSONAndFileContext(json, fileContext);
|
|
101
|
-
|
|
102
|
-
return label;
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
let { premises } = json;
|
|
106
|
-
|
|
107
|
-
const premisesJSON = premises; ///
|
|
108
|
-
|
|
109
|
-
premises = premisesJSON.map((premiseJSON) => {
|
|
110
|
-
const json = premiseJSON, ///
|
|
111
|
-
premise = Premise.fromJSONAndFileContext(json, fileContext);
|
|
112
|
-
|
|
113
|
-
return premise;
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
let { conclusion } = json;
|
|
117
|
-
|
|
118
|
-
const conclusionJSON = conclusion; ///
|
|
119
|
-
|
|
120
|
-
json = conclusionJSON; ///
|
|
121
|
-
|
|
122
|
-
conclusion = Conclusion.fromJSONAndFileContext(json, fileContext);
|
|
123
|
-
|
|
124
|
-
rule = new Rule(labels, premises, conclusion, fileContext);
|
|
125
|
-
|
|
126
|
-
return rule;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
64
|
static fromLabelsPremisesConclusionAndFileContext(labels, premises, conclusion, fileContext) {
|
|
130
65
|
const rule = new Rule(labels, premises, conclusion, fileContext);
|
|
131
66
|
|
package/src/ruleNames.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
export const METAVARIABLE_RULE_NAME = "metavariable";
|
|
4
|
-
export const VARIABLE_DECLARATION_RULE_NAME = "variableDeclaration";
|
|
5
3
|
export const UNQUALIFIED_STATEMENT_RULE_NAME = "unqualifiedStatement";
|
|
6
4
|
export const CONSTRUCTOR_DECLARATION_RULE_NAME = "constructorDeclaration";
|
|
@@ -6,7 +6,6 @@ import TermForVariableSubstitution from "./termForVariable";
|
|
|
6
6
|
import unifyStatementAgainstStatement from "../unify/statementAtainstStatement";
|
|
7
7
|
|
|
8
8
|
import { nodeQuery } from "../utilities/query";
|
|
9
|
-
import { statementNodeFromStatementString, metavariableNodeFromMetavariableString } from "../utilities/node";
|
|
10
9
|
import { matchStatementModuloBrackets, bracketedStatementChildNodeFromStatementNode } from "../utilities/match";
|
|
11
10
|
|
|
12
11
|
const metavariableNodeQuery = nodeQuery("/statement/metavariable!");
|
|
@@ -106,19 +105,6 @@ export default class StatementForMetavariableSubstitution extends Substitution {
|
|
|
106
105
|
return string;
|
|
107
106
|
}
|
|
108
107
|
|
|
109
|
-
static fromJSONAndFileContext(json, fileContext) {
|
|
110
|
-
const { metavariable, statement } = json,
|
|
111
|
-
metavariableString = metavariable, ///
|
|
112
|
-
statementString = statement, ///
|
|
113
|
-
lexer = fileContext.getLexer(),
|
|
114
|
-
parser = fileContext.getParser(),
|
|
115
|
-
statementNode = statementNodeFromStatementString(statementString, lexer, parser),
|
|
116
|
-
metavariableNode = metavariableNodeFromMetavariableString(metavariableString, lexer, parser),
|
|
117
|
-
statementForMetavariableSubstitution = new StatementForMetavariableSubstitution(statementNode, metavariableNode);
|
|
118
|
-
|
|
119
|
-
return statementForMetavariableSubstitution;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
108
|
static fromMetavariableNodeAndStatementNode(metavariableNode, statementNode) {
|
|
123
109
|
let statementForMetavariableSubstitution;
|
|
124
110
|
|
package/src/substitutions.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import StatementForMetavariableSubstitution from "./substitution/statementForMetavariable";
|
|
4
|
-
|
|
5
3
|
import { prune, compare, rightDifference } from "./utilities/array";
|
|
6
4
|
|
|
7
5
|
export default class Substitutions {
|
|
@@ -102,16 +100,6 @@ export default class Substitutions {
|
|
|
102
100
|
///
|
|
103
101
|
}
|
|
104
102
|
|
|
105
|
-
toJSON(tokens) {
|
|
106
|
-
const json = this.array.map((substitution) => {
|
|
107
|
-
const substitutionJSON = substitution.toJSON(tokens);
|
|
108
|
-
|
|
109
|
-
return substitutionJSON;
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
return json;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
103
|
static fromNothing() {
|
|
116
104
|
const array = [],
|
|
117
105
|
savedArray = null,
|
|
@@ -119,19 +107,4 @@ export default class Substitutions {
|
|
|
119
107
|
|
|
120
108
|
return substitutions;
|
|
121
109
|
}
|
|
122
|
-
|
|
123
|
-
static fromJSONAndFileContext(json, fileContext) {
|
|
124
|
-
const substitutionsJSON = json, ///
|
|
125
|
-
array = substitutionsJSON.map((substitutionJSON) => {
|
|
126
|
-
const json = substitutionJSON, ///
|
|
127
|
-
statementForMetavariableSubstitution = StatementForMetavariableSubstitution.fromJSONAndFileContext(json, fileContext),
|
|
128
|
-
substitution = statementForMetavariableSubstitution; ///
|
|
129
|
-
|
|
130
|
-
return substitution;
|
|
131
|
-
}),
|
|
132
|
-
savedArray = null,
|
|
133
|
-
substitutions = new Substitutions(array, savedArray);
|
|
134
|
-
|
|
135
|
-
return substitutions;
|
|
136
|
-
}
|
|
137
110
|
}
|
package/src/supposition.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 Supposition {
|
|
|
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 supposition = new Supposition(statementNode);
|
|
81
70
|
|
|
82
71
|
return supposition;
|
|
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
|
-
supposition = new Supposition(statementNode);
|
|
92
|
-
|
|
93
|
-
return supposition;
|
|
94
|
-
}
|
|
95
73
|
}
|
package/src/theorem.js
CHANGED
|
@@ -3,7 +3,5 @@
|
|
|
3
3
|
import TopLevelAssertion from "./topLevelAssertion";
|
|
4
4
|
|
|
5
5
|
export default class Theorem extends TopLevelAssertion {
|
|
6
|
-
static fromJSONAndFileContext(json, fileContext) { return TopLevelAssertion.fromJSONAndFileContext(Theorem, json, fileContext); }
|
|
7
|
-
|
|
8
6
|
static fromLabelsSuppositionsConsequentSubstitutionsAndFileContext(labels, suppositions, consequent, substitutions, fileContext) { return TopLevelAssertion.fromLabelsSuppositionsConsequentSubstitutionsAndFileContext(Theorem, labels, suppositions, consequent, substitutions, fileContext); }
|
|
9
7
|
}
|