occam-verify-cli 1.0.611 → 1.0.612
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/context/liminal.js +20 -20
- package/lib/context.js +71 -43
- package/lib/element/assertion/contained.js +8 -1
- package/lib/element/assertion/defined.js +8 -1
- package/lib/element/assertion/property.js +8 -1
- package/lib/element/assertion/satisfies.js +8 -1
- package/lib/element/assertion/subproof.js +8 -1
- package/lib/element/assertion/type.js +8 -1
- package/lib/element/assumption.js +11 -11
- package/lib/element/combinator/bracketed.js +8 -1
- package/lib/element/constructor/bracketed.js +8 -1
- package/lib/element/declaration/combinator.js +8 -1
- package/lib/element/declaration/complexType.js +8 -1
- package/lib/element/declaration/constructor.js +32 -25
- package/lib/element/declaration/metavariable.js +9 -9
- package/lib/element/declaration/simpleType.js +8 -1
- package/lib/element/declaration/typePrefix.js +8 -1
- package/lib/element/declaration/variable.js +16 -9
- package/lib/element/metavariable.js +8 -8
- package/lib/element/proofAssertion/premise.js +8 -1
- package/lib/element/proofAssertion/step.js +8 -1
- package/lib/element/proofAssertion/supposition.js +8 -1
- package/lib/element/substitution/frame.js +9 -2
- package/lib/element/substitution/reference.js +9 -2
- package/lib/element/substitution/statement.js +14 -13
- package/lib/element/substitution/term.js +8 -1
- package/lib/utilities/element.js +3 -3
- package/lib/utilities/substitutions.js +11 -12
- package/lib/utilities/unification.js +30 -15
- package/package.json +2 -2
- package/src/context/liminal.js +19 -19
- package/src/context.js +66 -38
- package/src/element/assertion/contained.js +7 -0
- package/src/element/assertion/defined.js +7 -0
- package/src/element/assertion/property.js +7 -0
- package/src/element/assertion/satisfies.js +7 -0
- package/src/element/assertion/subproof.js +7 -0
- package/src/element/assertion/type.js +7 -0
- package/src/element/assumption.js +2 -2
- package/src/element/combinator/bracketed.js +7 -0
- package/src/element/constructor/bracketed.js +7 -0
- package/src/element/declaration/combinator.js +7 -0
- package/src/element/declaration/complexType.js +7 -0
- package/src/element/declaration/constructor.js +31 -24
- package/src/element/declaration/metavariable.js +6 -6
- package/src/element/declaration/simpleType.js +7 -0
- package/src/element/declaration/typePrefix.js +7 -0
- package/src/element/declaration/variable.js +13 -6
- package/src/element/metavariable.js +9 -7
- package/src/element/proofAssertion/premise.js +7 -0
- package/src/element/proofAssertion/step.js +7 -0
- package/src/element/proofAssertion/supposition.js +7 -0
- package/src/element/substitution/frame.js +8 -1
- package/src/element/substitution/reference.js +8 -1
- package/src/element/substitution/statement.js +9 -15
- package/src/element/substitution/term.js +7 -0
- package/src/utilities/element.js +2 -2
- package/src/utilities/substitutions.js +8 -12
- package/src/utilities/unification.js +2 -4
|
@@ -22,6 +22,13 @@ export default define(class PropertyAssertion extends Assertion {
|
|
|
22
22
|
return this.propertyRelation;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
getPropertyAssertionNode() {
|
|
26
|
+
const node = this.getNode(),
|
|
27
|
+
propertyAssertionNode = node; ///
|
|
28
|
+
|
|
29
|
+
return propertyAssertionNode;
|
|
30
|
+
}
|
|
31
|
+
|
|
25
32
|
compareTermAndPropertyRelation(term, propertyRelation, context) {
|
|
26
33
|
let comparesToTermAndPropertyRelation = false;
|
|
27
34
|
|
|
@@ -20,6 +20,13 @@ export default define(class SatisfiesAssertion extends Assertion {
|
|
|
20
20
|
return this.reference;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
getSatisfiesAssertionNode() {
|
|
24
|
+
const node = this.getNode(),
|
|
25
|
+
satisfiesAssertionNode = node; ///
|
|
26
|
+
|
|
27
|
+
return satisfiesAssertionNode;
|
|
28
|
+
}
|
|
29
|
+
|
|
23
30
|
compareSubstitutions(substitutions, context) { return this.signature.compareSubstitutions(substitutions, context); }
|
|
24
31
|
|
|
25
32
|
correlateSubstitutions(substitutions, context) { return this.signature.correlateSubstitutions(substitutions, context); }
|
|
@@ -20,6 +20,13 @@ export default define(class SubproofAssertion extends Assertion {
|
|
|
20
20
|
return this.statements;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
getSubproofAssertionNode() {
|
|
24
|
+
const node = this.getNode(),
|
|
25
|
+
subproofAssertionNode = node; ///
|
|
26
|
+
|
|
27
|
+
return subproofAssertionNode;
|
|
28
|
+
}
|
|
29
|
+
|
|
23
30
|
validate(assignments, stated, context) {
|
|
24
31
|
let validates = false;
|
|
25
32
|
|
|
@@ -22,6 +22,13 @@ export default define(class TypeAssertion extends Assertion {
|
|
|
22
22
|
return this.type;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
getTypeAssertionNBode() {
|
|
26
|
+
const node = this.getNode(),
|
|
27
|
+
typeAssertionNode = node; ///
|
|
28
|
+
|
|
29
|
+
return typeAssertionNode;
|
|
30
|
+
}
|
|
31
|
+
|
|
25
32
|
verify(assignments, stated, context) {
|
|
26
33
|
let verifies = false;
|
|
27
34
|
|
|
@@ -33,9 +33,9 @@ export default define(class Assumption extends Element {
|
|
|
33
33
|
context.trace(`Comparing the '${assumptionString}' assumption to the '${substitutionString}' substitution...`);
|
|
34
34
|
|
|
35
35
|
const statement = substitution.getStatement(),
|
|
36
|
-
|
|
36
|
+
metavariableName = substitution.getMetavariableName(),
|
|
37
37
|
statementEqualToStatement = this.statement.isEqualTo(statement),
|
|
38
|
-
referenceMetavariableComparesToMetavariable = this.reference.
|
|
38
|
+
referenceMetavariableComparesToMetavariable = this.reference.compareMetavariableName(metavariableName);
|
|
39
39
|
|
|
40
40
|
if (statementEqualToStatement && referenceMetavariableComparesToMetavariable) {
|
|
41
41
|
comparesToSubstituion = true;
|
|
@@ -5,6 +5,13 @@ import Combinator from "../combinator";
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
6
|
|
|
7
7
|
export default define(class BracketedCombinator extends Combinator {
|
|
8
|
+
getBracketedCombinatorNode() {
|
|
9
|
+
const node = this.getNode(),
|
|
10
|
+
bracketedCombinatorNode = node; ///
|
|
11
|
+
|
|
12
|
+
return bracketedCombinatorNode;
|
|
13
|
+
}
|
|
14
|
+
|
|
8
15
|
unifyStatement(statement, assignments, stated, context) {
|
|
9
16
|
let statementUnifies;
|
|
10
17
|
|
|
@@ -6,6 +6,13 @@ import Constructor from "../constructor";
|
|
|
6
6
|
import { define } from "../../elements";
|
|
7
7
|
|
|
8
8
|
export default define(class BracketedConstructor extends Constructor {
|
|
9
|
+
getBracketedConstructorNode() {
|
|
10
|
+
const node = this.getNode(),
|
|
11
|
+
bracketedConstructorNode = node; ///
|
|
12
|
+
|
|
13
|
+
return bracketedConstructorNode;
|
|
14
|
+
}
|
|
15
|
+
|
|
9
16
|
unifyTerm(term, context, verifyForwards) {
|
|
10
17
|
let termUnifies;
|
|
11
18
|
|
|
@@ -15,6 +15,13 @@ export default define(class CombinatorDeclaration extends Declaration {
|
|
|
15
15
|
return this.combinator;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
getCombinatorDeclarationNode() {
|
|
19
|
+
const node = this.getNode(),
|
|
20
|
+
combinatorDeclarationNode = node; ///
|
|
21
|
+
|
|
22
|
+
return combinatorDeclarationNode;
|
|
23
|
+
}
|
|
24
|
+
|
|
18
25
|
async verify() {
|
|
19
26
|
let verifies = false;
|
|
20
27
|
|
|
@@ -20,6 +20,13 @@ export default define(class ComplexTypeDeclaration extends Declaration {
|
|
|
20
20
|
return this.prefixed;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
getComplexTypeDeclarationNode() {
|
|
24
|
+
const node = this.getNode(),
|
|
25
|
+
complexTypeDeclarationNode = node; ///
|
|
26
|
+
|
|
27
|
+
return complexTypeDeclarationNode;
|
|
28
|
+
}
|
|
29
|
+
|
|
23
30
|
verifyType() {
|
|
24
31
|
let typeVerifies = false;
|
|
25
32
|
|
|
@@ -16,31 +16,11 @@ export default define(class ConstructorDeclaration extends Declaration {
|
|
|
16
16
|
return this.constructor;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const context = this.getContext(),
|
|
23
|
-
constructorDeclarationString = this.getString(); ///
|
|
24
|
-
|
|
25
|
-
context.trace(`Verifying the '${constructorDeclarationString}' constructor declaration...`);
|
|
26
|
-
|
|
27
|
-
const constructorTypeVerifies = this.verifyConstructorType();
|
|
28
|
-
|
|
29
|
-
if (constructorTypeVerifies) {
|
|
30
|
-
const constructorValidates = this.verifyConstructor();
|
|
31
|
-
|
|
32
|
-
if (constructorValidates) {
|
|
33
|
-
context.addConstructor(this.constructor);
|
|
19
|
+
getConstructorDeclarationNode() {
|
|
20
|
+
const node = this.getNode(),
|
|
21
|
+
constructorDeclarationNode = node; ///
|
|
34
22
|
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if (verifies) {
|
|
40
|
-
context.debug(`...verified the '${constructorDeclarationString}' constructor declaration.`);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return verifies;
|
|
23
|
+
return constructorDeclarationNode;
|
|
44
24
|
}
|
|
45
25
|
|
|
46
26
|
verifyConstructor() {
|
|
@@ -110,5 +90,32 @@ export default define(class ConstructorDeclaration extends Declaration {
|
|
|
110
90
|
return constructorTypeVerifies;
|
|
111
91
|
}
|
|
112
92
|
|
|
93
|
+
async verify() {
|
|
94
|
+
let verifies;
|
|
95
|
+
|
|
96
|
+
const context = this.getContext(),
|
|
97
|
+
constructorDeclarationString = this.getString(); ///
|
|
98
|
+
|
|
99
|
+
context.trace(`Verifying the '${constructorDeclarationString}' constructor declaration...`);
|
|
100
|
+
|
|
101
|
+
const constructorTypeVerifies = this.verifyConstructorType();
|
|
102
|
+
|
|
103
|
+
if (constructorTypeVerifies) {
|
|
104
|
+
const constructorValidates = this.verifyConstructor();
|
|
105
|
+
|
|
106
|
+
if (constructorValidates) {
|
|
107
|
+
context.addConstructor(this.constructor);
|
|
108
|
+
|
|
109
|
+
verifies = true;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (verifies) {
|
|
114
|
+
context.debug(`...verified the '${constructorDeclarationString}' constructor declaration.`);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return verifies;
|
|
118
|
+
}
|
|
119
|
+
|
|
113
120
|
static name = "ConstructorDeclaration";
|
|
114
121
|
});
|
|
@@ -5,21 +5,21 @@ import Declaration from "../declaration";
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
6
|
|
|
7
7
|
export default define(class MetavariableDeclaration extends Declaration {
|
|
8
|
-
constructor(context, string, node,
|
|
8
|
+
constructor(context, string, node, metaType, metavariable) {
|
|
9
9
|
super(context, string, node);
|
|
10
10
|
|
|
11
|
-
this.metavariable = metavariable;
|
|
12
11
|
this.metaType = metaType;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
getMetavariable() {
|
|
16
|
-
return this.metavariable;
|
|
12
|
+
this.metavariable = metavariable;
|
|
17
13
|
}
|
|
18
14
|
|
|
19
15
|
getMetaType() {
|
|
20
16
|
return this.metaType;
|
|
21
17
|
}
|
|
22
18
|
|
|
19
|
+
getMetavariable() {
|
|
20
|
+
return this.metavariable;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
23
|
verifyMetavariable() {
|
|
24
24
|
let metavariableVerifies = false;
|
|
25
25
|
|
|
@@ -16,6 +16,13 @@ export default define(class SimpleTypeDeclaration extends Declaration {
|
|
|
16
16
|
return this.type;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
getSimpleTypeDeclarationNode() {
|
|
20
|
+
const node = this.getNode(),
|
|
21
|
+
simpleTypeDeclarationNode = node; ///
|
|
22
|
+
|
|
23
|
+
return simpleTypeDeclarationNode;
|
|
24
|
+
}
|
|
25
|
+
|
|
19
26
|
isPrefixed() {
|
|
20
27
|
return this.prefixed;
|
|
21
28
|
}
|
|
@@ -15,6 +15,13 @@ export default define(class TypePrefixDeclaration extends Declaration {
|
|
|
15
15
|
return this.typePrefix;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
getTypePrefixDeclarationNode() {
|
|
19
|
+
const node = this.getNode(),
|
|
20
|
+
typePrefixDeclarationNode = node; ///
|
|
21
|
+
|
|
22
|
+
return typePrefixDeclarationNode;
|
|
23
|
+
}
|
|
24
|
+
|
|
18
25
|
verifyTypePrefix() {
|
|
19
26
|
let typePrefixVerifies = false;
|
|
20
27
|
|
|
@@ -5,26 +5,33 @@ import Declaration from "../declaration";
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
6
|
|
|
7
7
|
export default define(class VariableDeclaration extends Declaration {
|
|
8
|
-
constructor(context, string, node,
|
|
8
|
+
constructor(context, string, node, type, variable, provisional) {
|
|
9
9
|
super(context, string, node);
|
|
10
10
|
|
|
11
|
-
this.variable = variable;
|
|
12
11
|
this.type = type;
|
|
12
|
+
this.variable = variable;
|
|
13
13
|
this.provisional = provisional;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
getVariable() {
|
|
17
|
-
return this.variable;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
16
|
getType() {
|
|
21
17
|
return this.type;
|
|
22
18
|
}
|
|
23
19
|
|
|
20
|
+
getVariable() {
|
|
21
|
+
return this.variable;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
24
|
isProvisional() {
|
|
25
25
|
return this.provisional;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
getVariableDeclarationNode() {
|
|
29
|
+
const node = this.getNode(),
|
|
30
|
+
typePrefixDeclarationNode = node; ///
|
|
31
|
+
|
|
32
|
+
return typePrefixDeclarationNode;
|
|
33
|
+
}
|
|
34
|
+
|
|
28
35
|
verifyType() {
|
|
29
36
|
let typeVerifies = false;
|
|
30
37
|
|
|
@@ -126,13 +126,13 @@ export default define(class Metavariable extends Element {
|
|
|
126
126
|
|
|
127
127
|
context.trace(`Unifying the '${frameString}' frame with the '${metavariableString}' metavariable...`);
|
|
128
128
|
|
|
129
|
-
const
|
|
130
|
-
frameMetavariableUnifies = this.unifyFrameMetavariable(frame, generalContext, specificContext);
|
|
129
|
+
const frameMetavariableUnifies = this.unifyFrameMetavariable(frame, generalContext, specificContext);
|
|
131
130
|
|
|
132
131
|
if (frameMetavariableUnifies) {
|
|
133
132
|
frameUnifies = true;
|
|
134
133
|
} else {
|
|
135
|
-
const
|
|
134
|
+
const metavariableName = this.getMetavariableName(),
|
|
135
|
+
simpleSubstitution = context.findSimpleSubstitutionByMetavariableName(metavariableName);
|
|
136
136
|
|
|
137
137
|
if (simpleSubstitution !== null) {
|
|
138
138
|
const substitution = simpleSubstitution, ///
|
|
@@ -143,6 +143,7 @@ export default define(class Metavariable extends Element {
|
|
|
143
143
|
}
|
|
144
144
|
} else {
|
|
145
145
|
const { FrameSubstitution } = elements,
|
|
146
|
+
metavariable = this, ///
|
|
146
147
|
frameSubstitution = FrameSubstitution.fromFrameAndMetavariable(frame, metavariable, context),
|
|
147
148
|
framesubstitutionValidates = frameSubstitution.validate(generalContext, specificContext);
|
|
148
149
|
|
|
@@ -236,16 +237,16 @@ export default define(class Metavariable extends Element {
|
|
|
236
237
|
|
|
237
238
|
context.trace(`Unifying the '${referenceString}' reference with the '${metavariableString}' metavariable...`);
|
|
238
239
|
|
|
239
|
-
const
|
|
240
|
-
referenceMetavariableUnifies = this.unifyReferenceMetavariable(reference, generalContext, specificContext);
|
|
240
|
+
const referenceMetavariableUnifies = this.unifyReferenceMetavariable(reference, generalContext, specificContext);
|
|
241
241
|
|
|
242
242
|
if (referenceMetavariableUnifies) {
|
|
243
243
|
referenceUnifies = true;
|
|
244
244
|
} else {
|
|
245
|
-
const
|
|
245
|
+
const metavariableName = this.getMetavariableName(),
|
|
246
|
+
simpleSubstitutionPresent = context.isSimpleSubstitutionPresentByMetavariableName(metavariableName);
|
|
246
247
|
|
|
247
248
|
if (simpleSubstitutionPresent) {
|
|
248
|
-
const simpleSubstitution = context.
|
|
249
|
+
const simpleSubstitution = context.findSimpleSubstitutionByMetavariableName(metavariableName),
|
|
249
250
|
substitution = simpleSubstitution, ///
|
|
250
251
|
substitutionReferenceEqualToReference = substitution.isReferenceEqualToReference(reference);
|
|
251
252
|
|
|
@@ -254,6 +255,7 @@ export default define(class Metavariable extends Element {
|
|
|
254
255
|
}
|
|
255
256
|
} else {
|
|
256
257
|
const { ReferenceSubstitution } = elements,
|
|
258
|
+
metavariable = this, ///
|
|
257
259
|
referenceSubstitution = ReferenceSubstitution.fromReferenceAndMetavariable(reference, metavariable, context),
|
|
258
260
|
substitution = referenceSubstitution; ///
|
|
259
261
|
|
|
@@ -17,6 +17,13 @@ export default define(class Premise extends ProofAssertion {
|
|
|
17
17
|
return this.procedureCall;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
getPremiseNode() {
|
|
21
|
+
const node = this.getNode(),
|
|
22
|
+
premiseNode = node; ///
|
|
23
|
+
|
|
24
|
+
return premiseNode;
|
|
25
|
+
}
|
|
26
|
+
|
|
20
27
|
isStated() {
|
|
21
28
|
const stated = true; ///
|
|
22
29
|
|
|
@@ -27,6 +27,13 @@ export default define(class Step extends ProofAssertion {
|
|
|
27
27
|
return this.satisfiesAssertion;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
getStepNode() {
|
|
31
|
+
const node = this.getNode(),
|
|
32
|
+
stepNode = node; ///
|
|
33
|
+
|
|
34
|
+
return stepNode;
|
|
35
|
+
}
|
|
36
|
+
|
|
30
37
|
isSatisfied() {
|
|
31
38
|
const satisfied = (this.satisfiesAssertion !== null);
|
|
32
39
|
|
|
@@ -17,6 +17,13 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
17
17
|
return this.procedureCall;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
getSuppositionNode() {
|
|
21
|
+
const node = this.getNode(),
|
|
22
|
+
suppositionNode = node; ///
|
|
23
|
+
|
|
24
|
+
return suppositionNode;
|
|
25
|
+
}
|
|
26
|
+
|
|
20
27
|
isStated() {
|
|
21
28
|
const stated = true; ///
|
|
22
29
|
|
|
@@ -24,6 +24,13 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
24
24
|
return this.replacementFrame;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
getFrameSubstitutionNode() {
|
|
28
|
+
const node = this.getNode(),
|
|
29
|
+
frameSubstitutionNode = node; ///
|
|
30
|
+
|
|
31
|
+
return frameSubstitutionNode;
|
|
32
|
+
}
|
|
33
|
+
|
|
27
34
|
getTargetNode() {
|
|
28
35
|
const targetFrameNode = this.targetFrame.getNode(),
|
|
29
36
|
tergetNode = targetFrameNode; ///
|
|
@@ -145,7 +152,7 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
145
152
|
replacementFrameValidates = this.replacementFrame.validate(assignments, stated, context);
|
|
146
153
|
|
|
147
154
|
if (replacementFrameValidates) {
|
|
148
|
-
context.debug(`...validated the '${frameSubstitutionString}' frame subtitution's '${replacementFrameString}' replacement frame
|
|
155
|
+
context.debug(`...validated the '${frameSubstitutionString}' frame subtitution's '${replacementFrameString}' replacement frame.`);
|
|
149
156
|
}
|
|
150
157
|
|
|
151
158
|
return replacementFrameValidates;
|
|
@@ -24,6 +24,13 @@ export default define(class ReferenceSubstitution extends Substitution {
|
|
|
24
24
|
return this.replacementReference;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
getReferenceSubstitutionNode() {
|
|
28
|
+
const node = this.getNode(),
|
|
29
|
+
referenceSubstitution = node; ///
|
|
30
|
+
|
|
31
|
+
return referenceSubstitution;
|
|
32
|
+
}
|
|
33
|
+
|
|
27
34
|
getTargetNode() {
|
|
28
35
|
const targetReferenceNode = this.targetReference.getNode(),
|
|
29
36
|
tergetNode = targetReferenceNode; ///
|
|
@@ -139,7 +146,7 @@ export default define(class ReferenceSubstitution extends Substitution {
|
|
|
139
146
|
replacementReferenceValidates = this.replacementReference.validate(context);
|
|
140
147
|
|
|
141
148
|
if (replacementReferenceValidates) {
|
|
142
|
-
context.debug(`...validated the '${referenceSubstitutionString}' reference subtitution's '${replacementReferenceString}' replacement reference
|
|
149
|
+
context.debug(`...validated the '${referenceSubstitutionString}' reference subtitution's '${replacementReferenceString}' replacement reference.`);
|
|
143
150
|
}
|
|
144
151
|
|
|
145
152
|
return replacementReferenceValidates;
|
|
@@ -37,21 +37,15 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
37
37
|
return this.replacementStatement;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
getStatementSubstitutionNode() {
|
|
41
|
+
const node = this.getNode(),
|
|
42
|
+
statementSubstitutionNode = node; ///
|
|
42
43
|
|
|
43
|
-
|
|
44
|
-
metavariableName = targetStatementNode.getMetavariableName();
|
|
45
|
-
|
|
46
|
-
if (metavariableName !== null) {
|
|
47
|
-
const context = generalContext; ///
|
|
48
|
-
|
|
49
|
-
metavariable = context.findMetavariableByMetavariableName(metavariableName);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return metavariable;
|
|
44
|
+
return statementSubstitutionNode;
|
|
53
45
|
}
|
|
54
46
|
|
|
47
|
+
getMtavariableName() { return this.targetStatement.getMtavariableName(); }
|
|
48
|
+
|
|
55
49
|
getTargetNode() {
|
|
56
50
|
const targetStatementNode = this.targetStatement.getNode(),
|
|
57
51
|
targetNode = targetStatementNode; ///
|
|
@@ -194,7 +188,7 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
194
188
|
replacementStatementValidates = this.replacementStatement.validate(assignments, stated, context);
|
|
195
189
|
|
|
196
190
|
if (replacementStatementValidates) {
|
|
197
|
-
context.debug(`...validated the '${statementSubstitutionString}' statement subtitution's '${replacementStatementString}' replacement statement
|
|
191
|
+
context.debug(`...validated the '${statementSubstitutionString}' statement subtitution's '${replacementStatementString}' replacement statement.`);
|
|
198
192
|
}
|
|
199
193
|
|
|
200
194
|
return replacementStatementValidates;
|
|
@@ -252,11 +246,11 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
252
246
|
|
|
253
247
|
context = generalContext; ///
|
|
254
248
|
|
|
255
|
-
const
|
|
249
|
+
const metavariableName = this.getMetavariableName();
|
|
256
250
|
|
|
257
251
|
context = specificContext; ///
|
|
258
252
|
|
|
259
|
-
const simpleSubstitution = context.
|
|
253
|
+
const simpleSubstitution = context.findSimpleSubstitutionByMetavariableName(metavariableName);
|
|
260
254
|
|
|
261
255
|
context = this.getContext();
|
|
262
256
|
|
|
@@ -25,6 +25,13 @@ export default define(class TermSubstitution extends Substitution {
|
|
|
25
25
|
return this.replacementTerm;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
getTermSubstitutionNode() {
|
|
29
|
+
const node = this.getNode(),
|
|
30
|
+
termSubstitutionNode = node; ///
|
|
31
|
+
|
|
32
|
+
return termSubstitutionNode;
|
|
33
|
+
}
|
|
34
|
+
|
|
28
35
|
getTargetNode() {
|
|
29
36
|
const targetTermNode = this.targetTerm.getNode(),
|
|
30
37
|
tergetNode = targetTermNode; ///
|
package/src/utilities/element.js
CHANGED
|
@@ -621,7 +621,7 @@ export function variableDeclarationFromVariableDeclarationNode(variableDeclarati
|
|
|
621
621
|
variableNode = variableDeclarationNode.getVariableNode(),
|
|
622
622
|
type = typeFromTypeNode(typeNode, context),
|
|
623
623
|
variable = variableFromVariableNode(variableNode, context),
|
|
624
|
-
variableDeclaration = new VariableDeclaration(context, string, node,
|
|
624
|
+
variableDeclaration = new VariableDeclaration(context, string, node, type, variable, provisional);
|
|
625
625
|
|
|
626
626
|
return variableDeclaration;
|
|
627
627
|
}
|
|
@@ -708,7 +708,7 @@ export function metavariableDeclarationFromMetavariableDeclarationNode(metavaria
|
|
|
708
708
|
string = context.nodeAsString(node),
|
|
709
709
|
metaType = metaTypeFromMetavariableDeclarationNode(metavariableDeclarationNode, context),
|
|
710
710
|
metavariable = metavariableFromMetavariableDeclarationNode(metavariableDeclarationNode, context),
|
|
711
|
-
metavariableDeclaration = new MetavariableDeclaration(context, string, node,
|
|
711
|
+
metavariableDeclaration = new MetavariableDeclaration(context, string, node, metaType, metavariable);
|
|
712
712
|
|
|
713
713
|
return metavariableDeclaration;
|
|
714
714
|
}
|
|
@@ -107,26 +107,22 @@ export function statementFromStatementAndSubstitutions(statement, generalContext
|
|
|
107
107
|
return statement;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
export function
|
|
111
|
-
const
|
|
110
|
+
export function metavariableNamesFromSubstitutions(substitutions) {
|
|
111
|
+
const metavariableNames = [];
|
|
112
112
|
|
|
113
113
|
substitutions.forEach((substitution) => {
|
|
114
|
-
const
|
|
115
|
-
metavariableName = substitution.getMetavariableName(),
|
|
116
|
-
metavariable = context.findMetavariableByMetavariableName(metavariableName);
|
|
114
|
+
const metavariableName = substitution.getMetavariableName();
|
|
117
115
|
|
|
118
|
-
if (
|
|
119
|
-
|
|
116
|
+
if (metavariableName !== null) {
|
|
117
|
+
metavariableNames.push(metavariableName);
|
|
120
118
|
}
|
|
121
119
|
});
|
|
122
120
|
|
|
123
|
-
compress(
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
if (!metavariableComparesToMetavariableB) {
|
|
121
|
+
compress(metavariableNames, (metavariableNameA, metavariableNameB) => {
|
|
122
|
+
if (metavariableNameB !== metavariableNameB) {
|
|
127
123
|
return true;
|
|
128
124
|
}
|
|
129
125
|
});
|
|
130
126
|
|
|
131
|
-
return
|
|
127
|
+
return metavariableNames;
|
|
132
128
|
}
|
|
@@ -144,9 +144,7 @@ async function unifyStatementWithTopLevelAssertion(statement, reference, satisfi
|
|
|
144
144
|
let statementUnifiesWithTopLevelAssertion = false;
|
|
145
145
|
|
|
146
146
|
if (reference !== null) {
|
|
147
|
-
const
|
|
148
|
-
topLevelAssertion = context.findTopLevelAssertionByReference(reference),
|
|
149
|
-
generalSubstitutions = substitutions; ///
|
|
147
|
+
const topLevelAssertion = context.findTopLevelAssertionByReference(reference);
|
|
150
148
|
|
|
151
149
|
if (topLevelAssertion !== null) {
|
|
152
150
|
const statementString = statement.getString(),
|
|
@@ -155,7 +153,7 @@ async function unifyStatementWithTopLevelAssertion(statement, reference, satisfi
|
|
|
155
153
|
context.trace(`Unifying the '${statementString}' statement with the '${topLevelAssertionString}' top level assertion...`);
|
|
156
154
|
|
|
157
155
|
const subproofOrProofAssertions = context.getSubproofOrProofAssertions(),
|
|
158
|
-
statementAndSubproofOrProofAssertionsUnify = topLevelAssertion.unifyStatementAndSubproofOrProofAssertions(statement, subproofOrProofAssertions, context);
|
|
156
|
+
statementAndSubproofOrProofAssertionsUnify = await topLevelAssertion.unifyStatementAndSubproofOrProofAssertions(statement, subproofOrProofAssertions, context);
|
|
159
157
|
|
|
160
158
|
if (statementAndSubproofOrProofAssertionsUnify) {
|
|
161
159
|
const metavariable = reference.getMetavariable();
|