occam-verify-cli 1.0.230 → 1.0.234
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/assignment/variable.js +4 -2
- package/lib/context/file.js +5 -5
- package/lib/context/local.js +19 -14
- package/lib/dom/axiom.js +36 -27
- package/lib/dom/combinator.js +5 -5
- package/lib/dom/conclusion.js +5 -5
- package/lib/dom/conjecture.js +9 -9
- package/lib/dom/constructor.js +5 -5
- package/lib/dom/declaration/combinator.js +14 -14
- package/lib/dom/declaration/complexType.js +35 -35
- package/lib/dom/declaration/constructor.js +19 -19
- package/lib/dom/declaration/metavariable.js +22 -22
- package/lib/dom/declaration/simpleType.js +23 -23
- package/lib/dom/declaration/variable.js +20 -20
- package/lib/dom/declaration.js +4 -2
- package/lib/dom/deduction.js +5 -5
- package/lib/dom/derivation.js +5 -5
- package/lib/dom/error.js +9 -9
- package/lib/dom/hypothesis.js +184 -0
- package/lib/dom/label.js +18 -24
- package/lib/dom/lemma.js +7 -7
- package/lib/dom/metaLemma.js +9 -9
- package/lib/dom/metaType.js +4 -10
- package/lib/dom/metatheorem.js +9 -9
- package/lib/dom/metavariable.js +7 -8
- package/lib/dom/parameter.js +2 -2
- package/lib/dom/premise.js +5 -5
- package/lib/dom/procedureCall.js +3 -3
- package/lib/dom/proof.js +3 -3
- package/lib/dom/property.js +9 -9
- package/lib/dom/reference.js +23 -22
- package/lib/dom/rule.js +24 -24
- package/lib/dom/section.js +248 -0
- package/lib/dom/signature.js +5 -5
- package/lib/dom/statement.js +25 -20
- package/lib/dom/step.js +3 -3
- package/lib/dom/subDerivation.js +5 -5
- package/lib/dom/subproof.js +7 -7
- package/lib/dom/substitution/statement.js +3 -3
- package/lib/dom/supposition.js +5 -5
- package/lib/dom/term.js +5 -6
- package/lib/dom/theorem.js +9 -9
- package/lib/dom/topLevelAssertion.js +123 -31
- package/lib/dom/topLevelMetaAssertion.js +13 -13
- package/lib/dom/type.js +21 -21
- package/lib/dom/variable.js +9 -15
- package/lib/index.js +3 -1
- package/lib/mixins/step/unify.js +11 -11
- package/lib/mixins/term/verify.js +6 -6
- package/lib/node/hypothesis.js +123 -0
- package/lib/node/section.js +144 -0
- package/lib/nonTerminalNodeMap.js +5 -3
- package/lib/ruleNames.js +9 -1
- package/lib/utilities/context.js +1 -1
- package/lib/utilities/json.js +82 -59
- package/lib/utilities/releaseContext.js +3 -3
- package/lib/utilities/subproof.js +10 -10
- package/lib/verifier/combinator.js +9 -10
- package/lib/verifier/constructor.js +10 -11
- package/lib/verifier/topLevel.js +38 -31
- package/package.json +2 -2
- package/src/assignment/variable.js +6 -4
- package/src/context/file.js +3 -3
- package/src/context/local.js +6 -14
- package/src/dom/axiom.js +47 -42
- package/src/dom/combinator.js +4 -4
- package/src/dom/conclusion.js +5 -5
- package/src/dom/conjecture.js +8 -8
- package/src/dom/constructor.js +4 -4
- package/src/dom/declaration/combinator.js +14 -14
- package/src/dom/declaration/complexType.js +35 -35
- package/src/dom/declaration/constructor.js +20 -20
- package/src/dom/declaration/metavariable.js +22 -22
- package/src/dom/declaration/simpleType.js +22 -22
- package/src/dom/declaration/variable.js +21 -21
- package/src/dom/declaration.js +5 -3
- package/src/dom/deduction.js +5 -5
- package/src/dom/derivation.js +5 -5
- package/src/dom/error.js +8 -8
- package/src/dom/hypothesis.js +119 -0
- package/src/dom/label.js +17 -19
- package/src/dom/lemma.js +8 -8
- package/src/dom/metaLemma.js +8 -8
- package/src/dom/metaType.js +2 -6
- package/src/dom/metatheorem.js +8 -8
- package/src/dom/metavariable.js +9 -12
- package/src/dom/parameter.js +1 -1
- package/src/dom/premise.js +8 -8
- package/src/dom/procedureCall.js +3 -3
- package/src/dom/proof.js +2 -2
- package/src/dom/property.js +8 -8
- package/src/dom/reference.js +23 -27
- package/src/dom/rule.js +29 -29
- package/src/dom/section.js +197 -0
- package/src/dom/signature.js +4 -5
- package/src/dom/statement.js +24 -32
- package/src/dom/step.js +4 -4
- package/src/dom/subDerivation.js +5 -5
- package/src/dom/subproof.js +8 -8
- package/src/dom/substitution/statement.js +5 -5
- package/src/dom/supposition.js +7 -7
- package/src/dom/term.js +3 -8
- package/src/dom/theorem.js +7 -7
- package/src/dom/topLevelAssertion.js +113 -40
- package/src/dom/topLevelMetaAssertion.js +19 -19
- package/src/dom/type.js +22 -22
- package/src/dom/variable.js +8 -11
- package/src/index.js +2 -0
- package/src/mixins/step/unify.js +10 -10
- package/src/mixins/term/verify.js +4 -5
- package/src/node/hypothesis.js +23 -0
- package/src/node/section.js +44 -0
- package/src/nonTerminalNodeMap.js +7 -1
- package/src/ruleNames.js +2 -0
- package/src/utilities/context.js +2 -2
- package/src/utilities/json.js +86 -58
- package/src/utilities/releaseContext.js +2 -2
- package/src/utilities/subproof.js +10 -10
- package/src/verifier/combinator.js +6 -11
- package/src/verifier/constructor.js +9 -12
- package/src/verifier/topLevel.js +42 -30
|
@@ -5,14 +5,14 @@ import dom from "../../dom";
|
|
|
5
5
|
import { domAssigned } from "../../dom";
|
|
6
6
|
|
|
7
7
|
export default domAssigned(class VariableDeclaration {
|
|
8
|
-
constructor(
|
|
9
|
-
this.
|
|
8
|
+
constructor(context, string, variable) {
|
|
9
|
+
this.context = context;
|
|
10
10
|
this.string = string;
|
|
11
11
|
this.variable = variable;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
return this.
|
|
14
|
+
getContext() {
|
|
15
|
+
return this.context;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
getString() {
|
|
@@ -28,7 +28,7 @@ export default domAssigned(class VariableDeclaration {
|
|
|
28
28
|
|
|
29
29
|
const variableDeclarationString = this.getString();
|
|
30
30
|
|
|
31
|
-
this.
|
|
31
|
+
this.context.trace(`Verifying the '${variableDeclarationString}' variable declaration...`);
|
|
32
32
|
|
|
33
33
|
const variableTypeVerifies = this.verifyVariableType();
|
|
34
34
|
|
|
@@ -36,14 +36,14 @@ export default domAssigned(class VariableDeclaration {
|
|
|
36
36
|
const variableVerifies = this.verifyVariable();
|
|
37
37
|
|
|
38
38
|
if (variableVerifies) {
|
|
39
|
-
this.
|
|
39
|
+
this.context.addVariable(this.variable);
|
|
40
40
|
|
|
41
41
|
verifies = true;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
if (verifies) {
|
|
46
|
-
this.
|
|
46
|
+
this.context.debug(`...verified the '${variableDeclarationString}' variable declaration.`);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
return verifies;
|
|
@@ -54,19 +54,19 @@ export default domAssigned(class VariableDeclaration {
|
|
|
54
54
|
|
|
55
55
|
const variableString = this.variable.getString();
|
|
56
56
|
|
|
57
|
-
this.
|
|
57
|
+
this.context.trace(`Verifying the '${variableString}' variable...`);
|
|
58
58
|
|
|
59
59
|
const variableName = this.variable.getName(),
|
|
60
|
-
variablePresent = this.
|
|
60
|
+
variablePresent = this.context.isVariablePresentByVariableName(variableName);
|
|
61
61
|
|
|
62
62
|
if (variablePresent) {
|
|
63
|
-
this.
|
|
63
|
+
this.context.debug(`The '${variableName}' variable is already present.`);
|
|
64
64
|
} else {
|
|
65
65
|
variableVerifies = true;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
if ( variableVerifies) {
|
|
69
|
-
this.
|
|
69
|
+
this.context.debug(`...verified the '${variableString}' variable.`);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
return variableVerifies;
|
|
@@ -82,24 +82,24 @@ export default domAssigned(class VariableDeclaration {
|
|
|
82
82
|
const typeName = type.getName(),
|
|
83
83
|
typeString = type.getString();
|
|
84
84
|
|
|
85
|
-
this.
|
|
85
|
+
this.context.trace(`Verifying the '${typeString}' type...`);
|
|
86
86
|
|
|
87
87
|
const includeSupertypes = false,
|
|
88
88
|
provisional = type.isProvisional(includeSupertypes);
|
|
89
89
|
|
|
90
|
-
type = this.
|
|
90
|
+
type = this.context.findTypeByTypeName(typeName);
|
|
91
91
|
|
|
92
92
|
const typePresent = (type !== null)
|
|
93
93
|
|
|
94
94
|
if (!typePresent) {
|
|
95
|
-
this.
|
|
95
|
+
this.context.debug(`The '${typeString}' type is not present.`);
|
|
96
96
|
} else {
|
|
97
97
|
const provisionalMatches = type.matchProvisional(provisional);
|
|
98
98
|
|
|
99
99
|
if (!provisionalMatches) {
|
|
100
100
|
provisional ?
|
|
101
|
-
this.
|
|
102
|
-
this.
|
|
101
|
+
this.context.debug(`The '${typeString}' type is present but not provisional.`) :
|
|
102
|
+
this.context.debug(`The '${typeString}' type is present but provisional.`);
|
|
103
103
|
} else {
|
|
104
104
|
this.variable.setType(type);
|
|
105
105
|
|
|
@@ -108,7 +108,7 @@ export default domAssigned(class VariableDeclaration {
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
if (variableTypeVerifies) {
|
|
111
|
-
this.
|
|
111
|
+
this.context.debug(`...verified the '${typeString}' type.`);
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
return variableTypeVerifies;
|
|
@@ -116,12 +116,12 @@ export default domAssigned(class VariableDeclaration {
|
|
|
116
116
|
|
|
117
117
|
static name = "VariableDeclaration";
|
|
118
118
|
|
|
119
|
-
static fromVariableDeclarationNode(variableDeclarationNode,
|
|
119
|
+
static fromVariableDeclarationNode(variableDeclarationNode, context) {
|
|
120
120
|
const { Variable } = dom,
|
|
121
121
|
node = variableDeclarationNode, ///
|
|
122
|
-
string =
|
|
123
|
-
variable = Variable.fromVariableDeclarationNode(variableDeclarationNode,
|
|
124
|
-
variableDeclaration = new VariableDeclaration(
|
|
122
|
+
string = context.nodeAsString(node),
|
|
123
|
+
variable = Variable.fromVariableDeclarationNode(variableDeclarationNode, context),
|
|
124
|
+
variableDeclaration = new VariableDeclaration(context, string, variable);
|
|
125
125
|
|
|
126
126
|
return variableDeclaration;
|
|
127
127
|
}
|
package/src/dom/declaration.js
CHANGED
|
@@ -217,9 +217,11 @@ export default domAssigned(class Declaration {
|
|
|
217
217
|
|
|
218
218
|
context.trace(`Unifying the '${metaLemmaMetatheoremString}' meta-lemma or metatheorem with the '${declarationString}' declaration...`);
|
|
219
219
|
|
|
220
|
-
const
|
|
221
|
-
|
|
222
|
-
|
|
220
|
+
const generalContext = context; ///
|
|
221
|
+
|
|
222
|
+
context = metaLemmaMetatheorem.getContext(); ///
|
|
223
|
+
|
|
224
|
+
const specificContext = context, ///
|
|
223
225
|
labelSubstitutions = Substitutions.fromNothing(),
|
|
224
226
|
label = metaLemmaMetatheorem.getLabel(),
|
|
225
227
|
substitutions = labelSubstitutions, ///
|
package/src/dom/deduction.js
CHANGED
|
@@ -95,19 +95,19 @@ export default domAssigned(class Deduction {
|
|
|
95
95
|
|
|
96
96
|
static name = "Deduction";
|
|
97
97
|
|
|
98
|
-
static fromJSON(json,
|
|
99
|
-
const statement = statementFromJSON(json,
|
|
98
|
+
static fromJSON(json, context) {
|
|
99
|
+
const statement = statementFromJSON(json, context),
|
|
100
100
|
string = statement.getString(),
|
|
101
101
|
deduction = new Deduction(string, statement);
|
|
102
102
|
|
|
103
103
|
return deduction;
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
static fromDeductionNode(deductionNode,
|
|
106
|
+
static fromDeductionNode(deductionNode, context) {
|
|
107
107
|
const { Statement } = dom,
|
|
108
108
|
node = deductionNode, ///
|
|
109
|
-
string =
|
|
110
|
-
statement = Statement.fromDeductionNode(deductionNode,
|
|
109
|
+
string = context.nodeAsString(node),
|
|
110
|
+
statement = Statement.fromDeductionNode(deductionNode, context),
|
|
111
111
|
deduction = new Deduction(string, statement);
|
|
112
112
|
|
|
113
113
|
return deduction;
|
package/src/dom/derivation.js
CHANGED
|
@@ -52,22 +52,22 @@ export default domAssigned(class Derivation {
|
|
|
52
52
|
|
|
53
53
|
static name = "Derivation";
|
|
54
54
|
|
|
55
|
-
static fromDerivationNode(derivationNode,
|
|
56
|
-
const stepsOrSubproofs = stepsOrSubproofsFromDerivationNode(derivationNode,
|
|
55
|
+
static fromDerivationNode(derivationNode, context) {
|
|
56
|
+
const stepsOrSubproofs = stepsOrSubproofsFromDerivationNode(derivationNode, context),
|
|
57
57
|
derivation = new Derivation(stepsOrSubproofs);
|
|
58
58
|
|
|
59
59
|
return derivation;
|
|
60
60
|
}
|
|
61
61
|
});
|
|
62
62
|
|
|
63
|
-
function stepsOrSubproofsFromDerivationNode(derivationNode,
|
|
63
|
+
function stepsOrSubproofsFromDerivationNode(derivationNode, context) {
|
|
64
64
|
const { Step, Subproof } = dom,
|
|
65
65
|
stepOrSubproofNodes = derivationNode.getStepOrSubproofNodes(),
|
|
66
66
|
stepsOrSubproofs = stepOrSubproofNodes.map((stepOrSubproofNode) => {
|
|
67
67
|
let stepOrSubproof;
|
|
68
68
|
|
|
69
|
-
const step = Step.fromStepOrSubproofNode(stepOrSubproofNode,
|
|
70
|
-
subproof = Subproof.fromStepOrSubproofNode(stepOrSubproofNode,
|
|
69
|
+
const step = Step.fromStepOrSubproofNode(stepOrSubproofNode, context),
|
|
70
|
+
subproof = Subproof.fromStepOrSubproofNode(stepOrSubproofNode, context);
|
|
71
71
|
|
|
72
72
|
if (false) {
|
|
73
73
|
///
|
package/src/dom/error.js
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
import { domAssigned } from "../dom";
|
|
4
4
|
|
|
5
5
|
export default domAssigned(class Error {
|
|
6
|
-
constructor(
|
|
7
|
-
this.
|
|
6
|
+
constructor(context, string) {
|
|
7
|
+
this.context = context;
|
|
8
8
|
this.string = string;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
return this.
|
|
11
|
+
getContext() {
|
|
12
|
+
return this.context;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
getString() {
|
|
@@ -21,17 +21,17 @@ export default domAssigned(class Error {
|
|
|
21
21
|
|
|
22
22
|
const errorString = this.string; ///
|
|
23
23
|
|
|
24
|
-
this.
|
|
24
|
+
this.context.warning(`The '${errorString}' error cannot be verified.`);
|
|
25
25
|
|
|
26
26
|
return verifies;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
static name = "Error";
|
|
30
30
|
|
|
31
|
-
static fromErrorNode(errorNode,
|
|
31
|
+
static fromErrorNode(errorNode, context) {
|
|
32
32
|
const node = errorNode, ///
|
|
33
|
-
string =
|
|
34
|
-
error = new Error(
|
|
33
|
+
string = context.nodeAsString(node),
|
|
34
|
+
error = new Error(context, string);
|
|
35
35
|
|
|
36
36
|
return error;
|
|
37
37
|
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import dom from "../dom";
|
|
4
|
+
|
|
5
|
+
import { domAssigned } from "../dom";
|
|
6
|
+
import { assignAssignments } from "../utilities/assignments";
|
|
7
|
+
import { subproofAssertionFromStatement } from "../utilities/context";
|
|
8
|
+
import { statementFromJSON, statementToStatementJSON } from "../utilities/json";
|
|
9
|
+
|
|
10
|
+
export default domAssigned(class Hypothesis {
|
|
11
|
+
constructor(string, statement) {
|
|
12
|
+
this.string = string;
|
|
13
|
+
this.statement = statement;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
getString() {
|
|
17
|
+
return this.string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
getStatement() {
|
|
21
|
+
return this.statement;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
verify(context) {
|
|
25
|
+
let verifies = false;
|
|
26
|
+
|
|
27
|
+
const hypothesisString = this.string; ///
|
|
28
|
+
|
|
29
|
+
context.trace(`Verifying the '${hypothesisString}' hypothesis...`);
|
|
30
|
+
|
|
31
|
+
if (false) {
|
|
32
|
+
///
|
|
33
|
+
} else if (this.statement !== null) {
|
|
34
|
+
const stated = true,
|
|
35
|
+
assignments = [],
|
|
36
|
+
statementVerifies = this.statement.verify(assignments, stated, context);
|
|
37
|
+
|
|
38
|
+
if (statementVerifies) {
|
|
39
|
+
const assignmentsAssigned = assignAssignments(assignments, context);
|
|
40
|
+
|
|
41
|
+
if (assignmentsAssigned) {
|
|
42
|
+
const { Step } = dom,
|
|
43
|
+
step = Step.fromStatement(this.statement, context),
|
|
44
|
+
stepOrSubproof = step; ///
|
|
45
|
+
|
|
46
|
+
context.addStepOrSubproof(stepOrSubproof);
|
|
47
|
+
|
|
48
|
+
verifies = true;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
} else {
|
|
52
|
+
context.debug(`Unable to verify the '${hypothesisString}' hypothesis because it is nonsense.`);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (verifies) {
|
|
56
|
+
context.debug(`...verified the '${hypothesisString}' hypothesis.`);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return verifies;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
isEqualToStep(step, context) {
|
|
63
|
+
let equalToStep = false;
|
|
64
|
+
|
|
65
|
+
const stepString = step.getString(),
|
|
66
|
+
hypothesisString = this.string; ///
|
|
67
|
+
|
|
68
|
+
context.trace(`Is the '${hypothesisString}' hypothesis equal to the '${stepString}' step...`);
|
|
69
|
+
|
|
70
|
+
const stepStatement = step.getStatement(),
|
|
71
|
+
statementEqualToStepStatement = this.statement.isEqualTo(stepStatement);
|
|
72
|
+
|
|
73
|
+
if (statementEqualToStepStatement) {
|
|
74
|
+
equalToStep = true;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (equalToStep) {
|
|
78
|
+
context.trace(`...the '${hypothesisString}' hypothesis is equal to the '${stepString}' step.`);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return equalToStep;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
toJSON() {
|
|
85
|
+
const statementJSON = statementToStatementJSON(this.statement),
|
|
86
|
+
statement = statementJSON, ///
|
|
87
|
+
json = {
|
|
88
|
+
statement
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
return json;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
static name = "Hypothesis";
|
|
95
|
+
|
|
96
|
+
static fromJSON(json, context) {
|
|
97
|
+
const statement = statementFromJSON(json, context);
|
|
98
|
+
|
|
99
|
+
let string;
|
|
100
|
+
|
|
101
|
+
if (statement !== null) {
|
|
102
|
+
string = statement.getString();
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const hypothesis = new Hypothesis(string, statement);
|
|
106
|
+
|
|
107
|
+
return hypothesis;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
static fromHypothesisNode(hypothesisNode, context) {
|
|
111
|
+
const { Statement } = dom,
|
|
112
|
+
node = hypothesisNode, ///
|
|
113
|
+
string = context.nodeAsString(node),
|
|
114
|
+
statement = Statement.fromHypothesisNode(hypothesisNode, context),
|
|
115
|
+
hypothesis = new Hypothesis(string, statement);
|
|
116
|
+
|
|
117
|
+
return hypothesis
|
|
118
|
+
}
|
|
119
|
+
});
|
package/src/dom/label.js
CHANGED
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import dom from "../dom";
|
|
4
|
-
import LocalContext from "../context/local";
|
|
5
4
|
|
|
6
5
|
import { domAssigned } from "../dom";
|
|
7
6
|
import { metavariableFromJSON, metavariableToMetavariableJSON } from "../utilities/json";
|
|
8
7
|
|
|
9
8
|
export default domAssigned(class Label {
|
|
10
|
-
constructor(
|
|
9
|
+
constructor(context, metavariable) {
|
|
10
|
+
this.context = context;
|
|
11
11
|
this.metavariable = metavariable;
|
|
12
|
-
this.fileContext = fileContext;
|
|
13
12
|
}
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
return this.
|
|
14
|
+
getContext() {
|
|
15
|
+
return this.context;
|
|
17
16
|
}
|
|
18
17
|
|
|
19
|
-
|
|
20
|
-
return this.
|
|
18
|
+
getMetavariable() {
|
|
19
|
+
return this.metavariable;
|
|
21
20
|
}
|
|
22
21
|
|
|
23
22
|
getString() { return this.metavariable.getString(); }
|
|
@@ -56,28 +55,28 @@ export default domAssigned(class Label {
|
|
|
56
55
|
|
|
57
56
|
const labelString = this.getString(); ///
|
|
58
57
|
|
|
59
|
-
this.
|
|
58
|
+
this.context.trace(`Verifying the '${labelString}' label...`);
|
|
60
59
|
|
|
61
60
|
let labelPresent;
|
|
62
61
|
|
|
63
62
|
if (nameOnly) {
|
|
64
63
|
const metavariableName = this.getMetavariableName();
|
|
65
64
|
|
|
66
|
-
labelPresent = this.
|
|
65
|
+
labelPresent = this.context.isLabelPresentByMetavariableName(metavariableName);
|
|
67
66
|
} else {
|
|
68
67
|
const metavariable = this.getMetavariable();
|
|
69
68
|
|
|
70
|
-
labelPresent = this.
|
|
69
|
+
labelPresent = this.context.isLabelPresentByMetavariable(metavariable);
|
|
71
70
|
}
|
|
72
71
|
|
|
73
72
|
if (labelPresent) {
|
|
74
|
-
this.
|
|
73
|
+
this.context.debug(`The '${labelString}' label is already present.`);
|
|
75
74
|
} else {
|
|
76
75
|
verifies = true;
|
|
77
76
|
}
|
|
78
77
|
|
|
79
78
|
if (verifies) {
|
|
80
|
-
this.
|
|
79
|
+
this.context.debug(`...verified the '${labelString}' label.`);
|
|
81
80
|
}
|
|
82
81
|
|
|
83
82
|
return verifies;
|
|
@@ -95,18 +94,17 @@ export default domAssigned(class Label {
|
|
|
95
94
|
|
|
96
95
|
static name = "Label";
|
|
97
96
|
|
|
98
|
-
static fromJSON(json,
|
|
99
|
-
const metavariable = metavariableFromJSON(json,
|
|
100
|
-
label = new Label(
|
|
97
|
+
static fromJSON(json, context) {
|
|
98
|
+
const metavariable = metavariableFromJSON(json, context),
|
|
99
|
+
label = new Label(context, metavariable);
|
|
101
100
|
|
|
102
101
|
return label;
|
|
103
102
|
}
|
|
104
103
|
|
|
105
|
-
static fromLabelNode(labelNode,
|
|
104
|
+
static fromLabelNode(labelNode, context) {
|
|
106
105
|
const { Metavariable } = dom,
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
label = new Label(metavariable, fileContext);
|
|
106
|
+
metavariable = Metavariable.fromLabelNode(labelNode, context),
|
|
107
|
+
label = new Label(context, metavariable);
|
|
110
108
|
|
|
111
109
|
return label;
|
|
112
110
|
}
|
package/src/dom/lemma.js
CHANGED
|
@@ -9,23 +9,23 @@ export default domAssigned(class Lemma extends TopLevelAssertion {
|
|
|
9
9
|
let verifies;
|
|
10
10
|
|
|
11
11
|
const lemma = this, ///
|
|
12
|
-
|
|
12
|
+
context = this.getContext(),
|
|
13
13
|
lemmaString = lemma.getString();
|
|
14
14
|
|
|
15
15
|
(lemmaString === null) ?
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
context.trace(`Verifying a lemma...`) :
|
|
17
|
+
context.trace(`Verifying the '${lemmaString}' lemma...`);
|
|
18
18
|
|
|
19
19
|
verifies = super.verify();
|
|
20
20
|
|
|
21
21
|
if (verifies) {
|
|
22
22
|
const lemma = this; ///
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
context.addLemma(lemma);
|
|
25
25
|
|
|
26
26
|
(lemmaString === null) ?
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
context.debug(`...verified a lemma.`) :
|
|
28
|
+
context.debug(`...verified the '${lemmaString}' lemma.`);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
return verifies;
|
|
@@ -33,9 +33,9 @@ export default domAssigned(class Lemma extends TopLevelAssertion {
|
|
|
33
33
|
|
|
34
34
|
static name = "Lemma";
|
|
35
35
|
|
|
36
|
-
static fromLemmaNode(lemmaNode,
|
|
36
|
+
static fromLemmaNode(lemmaNode, context) {
|
|
37
37
|
const node = lemmaNode, ///
|
|
38
|
-
lemma = TopLevelAssertion.fromNode(Lemma, node,
|
|
38
|
+
lemma = TopLevelAssertion.fromNode(Lemma, node, context);
|
|
39
39
|
|
|
40
40
|
return lemma;
|
|
41
41
|
}
|
package/src/dom/metaLemma.js
CHANGED
|
@@ -8,20 +8,20 @@ export default domAssigned(class MetaLemma extends TopLevelMetaAssertion {
|
|
|
8
8
|
verify() {
|
|
9
9
|
let verifies;
|
|
10
10
|
|
|
11
|
-
const
|
|
12
|
-
|
|
11
|
+
const context = this.getContext(),
|
|
12
|
+
metaLemma = this, ///
|
|
13
13
|
metaLemmaString = metaLemma.getString();
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
context.trace(`Verifying the '${metaLemmaString}' meta-lemma...`);
|
|
16
16
|
|
|
17
17
|
verifies = super.verify();
|
|
18
18
|
|
|
19
19
|
if (verifies) {
|
|
20
20
|
const metaTheorem = this; ///
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
context.addMetatheorem(metaTheorem);
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
context.debug(`...verified the '${metaLemmaString}' meta-lemma.`);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
return verifies;
|
|
@@ -29,11 +29,11 @@ export default domAssigned(class MetaLemma extends TopLevelMetaAssertion {
|
|
|
29
29
|
|
|
30
30
|
static name = "MetaLemma";
|
|
31
31
|
|
|
32
|
-
static fromJSON(json,
|
|
32
|
+
static fromJSON(json, context) { return TopLevelMetaAssertion.fromJSON(MetaLemma, json, context); }
|
|
33
33
|
|
|
34
|
-
static fromMetaLemmaNode(metaLemmaNode,
|
|
34
|
+
static fromMetaLemmaNode(metaLemmaNode, context) {
|
|
35
35
|
const node = metaLemmaNode, ///
|
|
36
|
-
metaLemma = TopLevelMetaAssertion.fromNode(MetaLemma, node,
|
|
36
|
+
metaLemma = TopLevelMetaAssertion.fromNode(MetaLemma, node, context);
|
|
37
37
|
|
|
38
38
|
return metaLemma;
|
|
39
39
|
}
|
package/src/dom/metaType.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import LocalContext from "../context/local";
|
|
4
|
-
|
|
5
3
|
import { domAssigned } from "../dom";
|
|
6
4
|
import { FRAME_META_TYPE_NAME, REFERENCE_META_TYPE_NAME, STATEMENT_META_TYPE_NAME } from "../metaTypeNames";
|
|
7
5
|
|
|
@@ -43,7 +41,7 @@ class MetaType {
|
|
|
43
41
|
|
|
44
42
|
static name = "MetaType";
|
|
45
43
|
|
|
46
|
-
static fromJSON(json,
|
|
44
|
+
static fromJSON(json, context) {
|
|
47
45
|
const { name } = json,
|
|
48
46
|
metaTypeName = name, ///
|
|
49
47
|
metaType = metaTypeFromMetaTypeName(metaTypeName);
|
|
@@ -57,10 +55,8 @@ class MetaType {
|
|
|
57
55
|
return metaType;
|
|
58
56
|
}
|
|
59
57
|
|
|
60
|
-
static fromMetavariableDeclarationNode(metavariableDeclarationNode,
|
|
58
|
+
static fromMetavariableDeclarationNode(metavariableDeclarationNode, context) {
|
|
61
59
|
const metaTypeNode = metavariableDeclarationNode.getMetaTypeNode(),
|
|
62
|
-
localContext = LocalContext.fromFileContext(fileContext),
|
|
63
|
-
context = localContext, ///
|
|
64
60
|
metaType = metaTypeFromMetaTypeNode(metaTypeNode, context);
|
|
65
61
|
|
|
66
62
|
return metaType;
|
package/src/dom/metatheorem.js
CHANGED
|
@@ -8,20 +8,20 @@ export default domAssigned(class Metatheorem extends TopLevelMetaAssertion {
|
|
|
8
8
|
verify() {
|
|
9
9
|
let verifies;
|
|
10
10
|
|
|
11
|
-
const
|
|
12
|
-
|
|
11
|
+
const context = this.getContext(),
|
|
12
|
+
metaLemma = this, ///
|
|
13
13
|
metaLemmaString = metaLemma.getString();
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
context.trace(`Verifying the '${metaLemmaString}' metatheorem...`);
|
|
16
16
|
|
|
17
17
|
verifies = super.verify();
|
|
18
18
|
|
|
19
19
|
if (verifies) {
|
|
20
20
|
const metaTheorem = this; ///
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
context.addMetatheorem(metaTheorem);
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
context.debug(`...verified the '${metaLemmaString}' metatheorem.`);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
return verifies;
|
|
@@ -29,11 +29,11 @@ export default domAssigned(class Metatheorem extends TopLevelMetaAssertion {
|
|
|
29
29
|
|
|
30
30
|
static name = "Metatheorem";
|
|
31
31
|
|
|
32
|
-
static fromJSON(json,
|
|
32
|
+
static fromJSON(json, context) { return TopLevelMetaAssertion.fromJSON(Metatheorem, json, context); }
|
|
33
33
|
|
|
34
|
-
static fromMetatheoremNode(metatheoremNode,
|
|
34
|
+
static fromMetatheoremNode(metatheoremNode, context) {
|
|
35
35
|
const node = metatheoremNode, ///
|
|
36
|
-
metatheorem = TopLevelMetaAssertion.fromNode(Metatheorem, node,
|
|
36
|
+
metatheorem = TopLevelMetaAssertion.fromNode(Metatheorem, node, context);
|
|
37
37
|
|
|
38
38
|
return metatheorem;
|
|
39
39
|
}
|
package/src/dom/metavariable.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import dom from "../dom";
|
|
4
|
-
import LocalContext from "../context/local";
|
|
5
4
|
import MetavariablePartialContext from "../context/partial/metavariable";
|
|
6
5
|
|
|
7
6
|
import { domAssigned } from "../dom";
|
|
@@ -442,10 +441,10 @@ export default domAssigned(class Metavariable {
|
|
|
442
441
|
|
|
443
442
|
static name = "Metavariable";
|
|
444
443
|
|
|
445
|
-
static fromJSON(json,
|
|
444
|
+
static fromJSON(json, context) {
|
|
446
445
|
const { string } = json,
|
|
447
|
-
lexer =
|
|
448
|
-
parser =
|
|
446
|
+
lexer = context.getLexer(),
|
|
447
|
+
parser = context.getParser(),
|
|
449
448
|
metavariablePartialContext = MetavariablePartialContext.fromStringLexerAndParser(string, lexer, parser),
|
|
450
449
|
metavariableTokens = metavariablePartialContext.getMetavariableTokens(),
|
|
451
450
|
metavariableNode = metavariablePartialContext.getMetavariableNode(),
|
|
@@ -453,8 +452,8 @@ export default domAssigned(class Metavariable {
|
|
|
453
452
|
name = metavariableName, ///
|
|
454
453
|
node = metavariableNode, ///
|
|
455
454
|
tokens = metavariableTokens, ///
|
|
456
|
-
type = typeFromJSON(json,
|
|
457
|
-
metaType = metaTypeFromJSON(json,
|
|
455
|
+
type = typeFromJSON(json, context),
|
|
456
|
+
metaType = metaTypeFromJSON(json, context),
|
|
458
457
|
metavariable = new Metavariable(string, node, tokens, name, type, metaType);
|
|
459
458
|
|
|
460
459
|
return metavariable;
|
|
@@ -510,12 +509,10 @@ export default domAssigned(class Metavariable {
|
|
|
510
509
|
return metavariable;
|
|
511
510
|
}
|
|
512
511
|
|
|
513
|
-
static fromMetavariableDeclarationNode(metavariableDeclarationNode,
|
|
512
|
+
static fromMetavariableDeclarationNode(metavariableDeclarationNode, context) {
|
|
514
513
|
const { MetaType } = dom,
|
|
515
514
|
metavariableNode = metavariableDeclarationNode.getMetavariableNode(),
|
|
516
|
-
|
|
517
|
-
context = localContext, ///
|
|
518
|
-
type = typeFromMetavariableDeclarationNode(metavariableDeclarationNode, fileContext),
|
|
515
|
+
type = typeFromMetavariableDeclarationNode(metavariableDeclarationNode, context),
|
|
519
516
|
metaType = MetaType.fromMetavariableDeclarationNode(metavariableDeclarationNode, context),
|
|
520
517
|
metavariable = metavariableFromMetavariableNode(metavariableNode, context);
|
|
521
518
|
|
|
@@ -541,7 +538,7 @@ function metavariableFromMetavariableNode(metavariableNode, context) {
|
|
|
541
538
|
return metavariable;
|
|
542
539
|
}
|
|
543
540
|
|
|
544
|
-
function typeFromMetavariableDeclarationNode(metavariableDeclarationNode,
|
|
541
|
+
function typeFromMetavariableDeclarationNode(metavariableDeclarationNode, context) {
|
|
545
542
|
let type = null;
|
|
546
543
|
|
|
547
544
|
const typeNode = metavariableDeclarationNode.getTypeNode();
|
|
@@ -549,7 +546,7 @@ function typeFromMetavariableDeclarationNode(metavariableDeclarationNode, fileCo
|
|
|
549
546
|
if (typeNode !== null) {
|
|
550
547
|
const typeName = typeNode.getTypeName();
|
|
551
548
|
|
|
552
|
-
type =
|
|
549
|
+
type = context.findTypeByTypeName(typeName);
|
|
553
550
|
}
|
|
554
551
|
|
|
555
552
|
return type;
|