occam-verify-cli 0.0.1089 → 0.0.1091
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 +2 -2
- package/lib/assertion/contained.js +35 -41
- package/lib/assertion/defined.js +24 -24
- package/lib/assertion/subproof.js +24 -24
- package/lib/assertion/type.js +23 -23
- package/lib/assignment/equality.js +4 -10
- package/lib/assignment/judgement.js +4 -4
- package/lib/assignment/variable.js +4 -4
- package/lib/combinator/bracketed.js +3 -3
- package/lib/conclusion.js +11 -13
- package/lib/consequent.js +11 -13
- package/lib/constructor/bracketed.js +3 -3
- package/lib/constructor.js +2 -2
- package/lib/context/file.js +28 -27
- package/lib/context/local.js +31 -32
- package/lib/context/release.js +6 -3
- package/lib/declaration.js +18 -18
- package/lib/derivation.js +3 -3
- package/lib/equality.js +24 -24
- package/lib/equivalence.js +13 -13
- package/lib/frame.js +43 -43
- package/lib/index.js +2 -1
- package/lib/judgement.js +20 -20
- package/lib/label.js +9 -1
- package/lib/metaType.js +2 -2
- package/lib/metavariable.js +40 -39
- package/lib/mixins/statement/qualified/unify.js +19 -19
- package/lib/mixins/statement/resolve.js +11 -11
- package/lib/mixins/statement/unify.js +12 -12
- package/lib/mixins/statement/verify.js +36 -36
- package/lib/mixins/term/verify.js +2 -2
- package/lib/premise.js +31 -40
- package/lib/proof.js +6 -5
- package/lib/proofStep.js +17 -17
- package/lib/reference.js +8 -8
- package/lib/rule.js +21 -21
- package/lib/statement/qualified.js +17 -17
- package/lib/statement/unqualified.js +19 -19
- package/lib/statement.js +52 -54
- package/lib/subDerivation.js +3 -3
- package/lib/subproof.js +6 -5
- package/lib/substitution/frameForMetavariable.js +16 -39
- package/lib/substitution/statementForMetavariable.js +88 -74
- package/lib/substitution/termForVariable.js +15 -41
- package/lib/substitution.js +20 -6
- package/lib/substitutions.js +13 -13
- package/lib/supposition.js +31 -40
- package/lib/term.js +28 -28
- package/lib/topLevelAssertion.js +33 -21
- package/lib/unifier/equality.js +8 -8
- package/lib/unifier/intrinsicLevel.js +149 -0
- package/lib/unifier/metaLevel.js +41 -31
- package/lib/unifier/metavariable.js +14 -8
- package/lib/unifier/statementWithCombinator.js +16 -16
- package/lib/unifier/termWithConstructor.js +6 -6
- package/lib/unifier.js +47 -47
- package/lib/utilities/assignments.js +3 -3
- package/lib/utilities/equivalences.js +14 -14
- package/lib/utilities/json.js +22 -21
- package/lib/utilities/unifier.js +7 -8
- package/lib/variable.js +33 -33
- package/lib/verifier/statementAsCombinator.js +2 -2
- package/lib/verifier/termAsConstructor.js +2 -2
- package/package.json +2 -2
- package/src/assertion/contained.js +37 -45
- package/src/assertion/defined.js +25 -25
- package/src/assertion/subproof.js +25 -28
- package/src/assertion/type.js +23 -23
- package/src/assignment/equality.js +4 -6
- package/src/assignment/judgement.js +4 -4
- package/src/assignment/variable.js +4 -4
- package/src/combinator/bracketed.js +2 -2
- package/src/conclusion.js +14 -15
- package/src/consequent.js +14 -15
- package/src/constructor/bracketed.js +2 -2
- package/src/constructor.js +3 -2
- package/src/context/file.js +26 -25
- package/src/context/local.js +21 -23
- package/src/context/release.js +5 -3
- package/src/declaration.js +20 -20
- package/src/derivation.js +2 -2
- package/src/equality.js +26 -26
- package/src/equivalence.js +12 -12
- package/src/frame.js +42 -42
- package/src/index.js +1 -0
- package/src/judgement.js +25 -25
- package/src/label.js +14 -0
- package/src/metaType.js +1 -1
- package/src/metavariable.js +51 -43
- package/src/mixins/statement/qualified/unify.js +21 -21
- package/src/mixins/statement/resolve.js +12 -12
- package/src/mixins/statement/unify.js +11 -11
- package/src/mixins/statement/verify.js +35 -35
- package/src/mixins/term/verify.js +1 -1
- package/src/premise.js +42 -53
- package/src/proof.js +6 -4
- package/src/proofStep.js +21 -21
- package/src/reference.js +12 -11
- package/src/rule.js +20 -20
- package/src/statement/qualified.js +18 -17
- package/src/statement/unqualified.js +19 -18
- package/src/statement.js +63 -66
- package/src/subDerivation.js +2 -3
- package/src/subproof.js +6 -4
- package/src/substitution/frameForMetavariable.js +29 -45
- package/src/substitution/statementForMetavariable.js +136 -86
- package/src/substitution/termForVariable.js +28 -49
- package/src/substitution.js +15 -5
- package/src/substitutions.js +12 -12
- package/src/supposition.js +41 -53
- package/src/term.js +27 -27
- package/src/topLevelAssertion.js +32 -19
- package/src/unifier/equality.js +7 -7
- package/src/unifier/intrinsicLevel.js +61 -0
- package/src/unifier/metaLevel.js +60 -46
- package/src/unifier/metavariable.js +22 -13
- package/src/unifier/statementWithCombinator.js +28 -28
- package/src/unifier/termWithConstructor.js +8 -8
- package/src/unifier.js +55 -55
- package/src/utilities/assignments.js +2 -2
- package/src/utilities/equivalences.js +13 -13
- package/src/utilities/json.js +76 -66
- package/src/utilities/unifier.js +10 -12
- package/src/variable.js +43 -40
- package/src/verifier/statementAsCombinator.js +2 -1
- package/src/verifier/termAsConstructor.js +2 -1
package/src/declaration.js
CHANGED
|
@@ -28,13 +28,13 @@ class Declaration {
|
|
|
28
28
|
return this.statement;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
unifyStatement(statement,
|
|
31
|
+
unifyStatement(statement, context) {
|
|
32
32
|
let statementUnified;
|
|
33
33
|
|
|
34
34
|
const statementString = statement.getString(),
|
|
35
35
|
declarationStatementString = this.statement.getString(); ///
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
context.trace(`Unifying the '${statementString}' statement with the '${declarationStatementString}' statement...`);
|
|
38
38
|
|
|
39
39
|
let statementNode = statement.getNode();
|
|
40
40
|
|
|
@@ -45,19 +45,19 @@ class Declaration {
|
|
|
45
45
|
statementUnified = statementNodeMatches; ///
|
|
46
46
|
|
|
47
47
|
if (statementUnified) {
|
|
48
|
-
|
|
48
|
+
context.debug(`...unified the '${statementString}' statement with the '${declarationStatementString}' statement.`);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
return statementUnified;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
unifyMetavariable(metavariable,
|
|
54
|
+
unifyMetavariable(metavariable, context) {
|
|
55
55
|
let metavariableUnified;
|
|
56
56
|
|
|
57
57
|
const referenceString = this.reference.getString(),
|
|
58
58
|
metavariableString = metavariable.getString();
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
context.trace(`Unifying the '${metavariableString}' metavariable with the '${referenceString}' reference...`);
|
|
61
61
|
|
|
62
62
|
const metavariableNode = metavariable.getNode(),
|
|
63
63
|
metavariableNodeMatches = this.reference.matchMetavariableNode(metavariableNode);
|
|
@@ -65,61 +65,61 @@ class Declaration {
|
|
|
65
65
|
metavariableUnified = metavariableNodeMatches; ///
|
|
66
66
|
|
|
67
67
|
if (metavariableUnified) {
|
|
68
|
-
|
|
68
|
+
context.debug(`...unified the '${metavariableString}' metavariable with the '${referenceString}' reference.`);
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
return metavariableUnified;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
unifySubstitution(substitution,
|
|
74
|
+
unifySubstitution(substitution, context) {
|
|
75
75
|
let substitutionUnified;
|
|
76
76
|
|
|
77
77
|
const declarationString = this.string, ///
|
|
78
78
|
substitutionString = substitution.getString();
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
context.trace(`Unifying the '${substitutionString}' substitution with the '${declarationString}' declaration...`);
|
|
81
81
|
|
|
82
82
|
const statement = substitution.getStatement(),
|
|
83
83
|
metavariable = substitution.getMetavariable(),
|
|
84
|
-
statementUnified = this.unifyStatement(statement,
|
|
85
|
-
metavariableUnified = this.unifyMetavariable(metavariable,
|
|
84
|
+
statementUnified = this.unifyStatement(statement, context),
|
|
85
|
+
metavariableUnified = this.unifyMetavariable(metavariable, context);
|
|
86
86
|
|
|
87
87
|
substitutionUnified = (metavariableUnified && statementUnified);
|
|
88
88
|
|
|
89
89
|
if (substitutionUnified) {
|
|
90
|
-
|
|
90
|
+
context.debug(`...unified the '${declarationString}' substitution with the '${substitutionString}' declaration.`);
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
return substitutionUnified;
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
verify(assignments, stated,
|
|
96
|
+
verify(assignments, stated, context) {
|
|
97
97
|
let verified = false;
|
|
98
98
|
|
|
99
99
|
const declarationString = this.string; ///
|
|
100
100
|
|
|
101
|
-
|
|
101
|
+
context.trace(`Verifying the '${declarationString}' declaration...`);
|
|
102
102
|
|
|
103
103
|
stated = true; ///
|
|
104
104
|
|
|
105
105
|
assignments = null; ///
|
|
106
106
|
|
|
107
|
-
const referenceVerified = this.reference.verify(
|
|
107
|
+
const referenceVerified = this.reference.verify(context);
|
|
108
108
|
|
|
109
109
|
if (referenceVerified) {
|
|
110
|
-
const statementVerified = this.statement.verify(assignments, stated,
|
|
110
|
+
const statementVerified = this.statement.verify(assignments, stated, context);
|
|
111
111
|
|
|
112
112
|
verified = statementVerified; ///
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
if (verified) {
|
|
116
|
-
|
|
116
|
+
context.debug(`...verified the '${declarationString}' declaration.`);
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
return verified;
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
static fromDeclarationNode(declarationNode,
|
|
122
|
+
static fromDeclarationNode(declarationNode, context) {
|
|
123
123
|
let declaration = null;
|
|
124
124
|
|
|
125
125
|
if (declarationNode !== null) {
|
|
@@ -130,10 +130,10 @@ class Declaration {
|
|
|
130
130
|
|
|
131
131
|
statementNode = stripBracketsFromStatementNode(statementNode); ///
|
|
132
132
|
|
|
133
|
-
const reference = Reference.fromReferenceNode(referenceNode,
|
|
134
|
-
statement = Statement.fromStatementNode(statementNode,
|
|
133
|
+
const reference = Reference.fromReferenceNode(referenceNode, context),
|
|
134
|
+
statement = Statement.fromStatementNode(statementNode, context),
|
|
135
135
|
node = declarationNode, ///
|
|
136
|
-
string =
|
|
136
|
+
string = context.nodeAsString(node);
|
|
137
137
|
|
|
138
138
|
declaration = new Declaration(string, reference, statement);
|
|
139
139
|
}
|
package/src/derivation.js
CHANGED
|
@@ -25,11 +25,11 @@ class Derivation {
|
|
|
25
25
|
return lastProofStep;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
verify(substitutions,
|
|
28
|
+
verify(substitutions, context) {
|
|
29
29
|
let verified;
|
|
30
30
|
|
|
31
31
|
verified = this.proofSteps.every((proofStep) => { ///
|
|
32
|
-
const proofStepVerified = proofStep.verify(substitutions,
|
|
32
|
+
const proofStepVerified = proofStep.verify(substitutions, context);
|
|
33
33
|
|
|
34
34
|
if (proofStepVerified) {
|
|
35
35
|
return true;
|
package/src/equality.js
CHANGED
|
@@ -57,32 +57,32 @@ class Equality {
|
|
|
57
57
|
return reflexive;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
isEqual(
|
|
60
|
+
isEqual(context) {
|
|
61
61
|
const leftTermNode = this.leftTerm.getNode(),
|
|
62
62
|
rightTermNode = this.rightTerm.getNode(),
|
|
63
|
-
equalityUnified = equalityUnifier.unify(leftTermNode, rightTermNode,
|
|
63
|
+
equalityUnified = equalityUnifier.unify(leftTermNode, rightTermNode, context),
|
|
64
64
|
equal = equalityUnified; ///
|
|
65
65
|
|
|
66
66
|
return equal;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
verify(assignments, stated,
|
|
69
|
+
verify(assignments, stated, context) {
|
|
70
70
|
let verified = false;
|
|
71
71
|
|
|
72
72
|
const equalityString = this.string; ///
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
context.trace(`Verifying the '${equalityString}' equality...`);
|
|
75
75
|
|
|
76
|
-
const termsVerified = this.verifyTerms(
|
|
76
|
+
const termsVerified = this.verifyTerms(context);
|
|
77
77
|
|
|
78
78
|
if (termsVerified) {
|
|
79
79
|
let verifiedWhenStated = false,
|
|
80
80
|
verifiedWhenDerived = false;
|
|
81
81
|
|
|
82
82
|
if (stated) {
|
|
83
|
-
verifiedWhenStated = this.verifyWhenStated(
|
|
83
|
+
verifiedWhenStated = this.verifyWhenStated(context);
|
|
84
84
|
} else {
|
|
85
|
-
verifiedWhenDerived = this.verifyWhenDerived(
|
|
85
|
+
verifiedWhenDerived = this.verifyWhenDerived(context);
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
if (verifiedWhenStated || verifiedWhenDerived) {
|
|
@@ -93,8 +93,8 @@ class Equality {
|
|
|
93
93
|
rightTermNode = this.rightTerm.getNode(),
|
|
94
94
|
leftVariableNode = variableNodeQuery(leftTermNode),
|
|
95
95
|
rightVariableNode = variableNodeQuery(rightTermNode),
|
|
96
|
-
leftVariable = Variable.fromVariableNodeAndType(leftVariableNode, type,
|
|
97
|
-
rightVariable = Variable.fromVariableNodeAndType(rightVariableNode, type,
|
|
96
|
+
leftVariable = Variable.fromVariableNodeAndType(leftVariableNode, type, context),
|
|
97
|
+
rightVariable = Variable.fromVariableNodeAndType(rightVariableNode, type, context);
|
|
98
98
|
|
|
99
99
|
let assignment;
|
|
100
100
|
|
|
@@ -127,23 +127,23 @@ class Equality {
|
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
if (verified) {
|
|
130
|
-
|
|
130
|
+
context.debug(`...verified the '${equalityString}' equality.`);
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
return verified;
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
verifyTerms(
|
|
136
|
+
verifyTerms(context) {
|
|
137
137
|
let termsVerified;
|
|
138
138
|
|
|
139
139
|
const equalityString = this.string; ///
|
|
140
140
|
|
|
141
|
-
|
|
141
|
+
context.trace(`Verifying the '${equalityString}' equality's terms...`);
|
|
142
142
|
|
|
143
|
-
const leftTermVerified = this.leftTerm.verify(
|
|
143
|
+
const leftTermVerified = this.leftTerm.verify(context, () => {
|
|
144
144
|
let verifiedAhead;
|
|
145
145
|
|
|
146
|
-
const rightTermVerified = this.rightTerm.verify(
|
|
146
|
+
const rightTermVerified = this.rightTerm.verify(context, () => {
|
|
147
147
|
let verifiedAhead;
|
|
148
148
|
|
|
149
149
|
const leftTermType = this.leftTerm.getType(),
|
|
@@ -163,57 +163,57 @@ class Equality {
|
|
|
163
163
|
termsVerified = leftTermVerified; ///
|
|
164
164
|
|
|
165
165
|
if (termsVerified) {
|
|
166
|
-
|
|
166
|
+
context.debug(`...verified the '${equalityString}' equality's terms.`);
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
return termsVerified;
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
-
verifyWhenStated(
|
|
172
|
+
verifyWhenStated(context) {
|
|
173
173
|
let verifiedWhenStated;
|
|
174
174
|
|
|
175
175
|
const equalityString = this.string; ///
|
|
176
176
|
|
|
177
|
-
|
|
177
|
+
context.trace(`Verifying the '${equalityString}' stated equality...`);
|
|
178
178
|
|
|
179
179
|
verifiedWhenStated = true;
|
|
180
180
|
|
|
181
181
|
if (verifiedWhenStated) {
|
|
182
|
-
|
|
182
|
+
context.debug(`...verified the '${equalityString}' stated equality.`);
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
return verifiedWhenStated;
|
|
186
186
|
}
|
|
187
187
|
|
|
188
|
-
verifyWhenDerived(
|
|
188
|
+
verifyWhenDerived(context) {
|
|
189
189
|
let verifiedWhenDerived;
|
|
190
190
|
|
|
191
191
|
const equalityString = this.string; ///
|
|
192
192
|
|
|
193
|
-
|
|
193
|
+
context.trace(`Verifying the '${equalityString}' derived equality...`);
|
|
194
194
|
|
|
195
|
-
const equal = this.isEqual(
|
|
195
|
+
const equal = this.isEqual(context);
|
|
196
196
|
|
|
197
197
|
verifiedWhenDerived = equal; ///
|
|
198
198
|
|
|
199
199
|
if (verifiedWhenDerived) {
|
|
200
|
-
|
|
200
|
+
context.debug(`...verified the '${equalityString}' derived equality.`);
|
|
201
201
|
}
|
|
202
202
|
|
|
203
203
|
return verifiedWhenDerived;
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
-
static fromEqualityNode(equalityNode,
|
|
206
|
+
static fromEqualityNode(equalityNode, context) {
|
|
207
207
|
let equality = null;
|
|
208
208
|
|
|
209
209
|
if (equalityNode !== null) {
|
|
210
210
|
const { Term } = shim,
|
|
211
211
|
leftTermNode = leftTermNodeQuery(equalityNode),
|
|
212
212
|
rightTermNode = rightTermNodeQuery(equalityNode),
|
|
213
|
-
leftTerm = Term.fromTermNode(leftTermNode,
|
|
214
|
-
rightTerm = Term.fromTermNode(rightTermNode,
|
|
213
|
+
leftTerm = Term.fromTermNode(leftTermNode, context),
|
|
214
|
+
rightTerm = Term.fromTermNode(rightTermNode, context),
|
|
215
215
|
node = equalityNode, ///
|
|
216
|
-
string =
|
|
216
|
+
string = context.nodeAsString(node);
|
|
217
217
|
|
|
218
218
|
equality = new Equality(string, leftTerm, rightTerm);
|
|
219
219
|
}
|
package/src/equivalence.js
CHANGED
|
@@ -14,11 +14,11 @@ export default class Equivalence {
|
|
|
14
14
|
return this.terms;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
addTerm(term,
|
|
17
|
+
addTerm(term, context) {
|
|
18
18
|
const termString = term.getString(),
|
|
19
19
|
equivalenceString = this.asString(); ///
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
context.trace(`Adding the '${termString}' term to the '${equivalenceString}' equivalence.`);
|
|
22
22
|
|
|
23
23
|
this.terms.push(term);
|
|
24
24
|
}
|
|
@@ -115,9 +115,9 @@ export default class Equivalence {
|
|
|
115
115
|
return termNodesMatch;
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
getGroundedTerms(definedVariables, groundedTerms,
|
|
118
|
+
getGroundedTerms(definedVariables, groundedTerms, context) {
|
|
119
119
|
this.terms.forEach((term) => {
|
|
120
|
-
const termGrounded = term.isGrounded(definedVariables,
|
|
120
|
+
const termGrounded = term.isGrounded(definedVariables, context);
|
|
121
121
|
|
|
122
122
|
if (termGrounded) {
|
|
123
123
|
const termMatchesGroundedTerm = groundedTerms.some((groundedTerm) => {
|
|
@@ -138,25 +138,25 @@ export default class Equivalence {
|
|
|
138
138
|
});
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
isInitiallyGrounded(
|
|
142
|
-
const initiallyGroundedTerms = this.getInitiallyGroundedTerms(
|
|
141
|
+
isInitiallyGrounded(context) {
|
|
142
|
+
const initiallyGroundedTerms = this.getInitiallyGroundedTerms(context),
|
|
143
143
|
initiallyGroundedTermsLength = initiallyGroundedTerms.length,
|
|
144
144
|
initiallyGrounded = (initiallyGroundedTermsLength > 0);
|
|
145
145
|
|
|
146
146
|
return initiallyGrounded;
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
isImplicitlyGrounded(definedVariables,
|
|
150
|
-
const implicitlyGroundedTerms = this.getImplicitlyGroundedTerms(definedVariables,
|
|
149
|
+
isImplicitlyGrounded(definedVariables, context) {
|
|
150
|
+
const implicitlyGroundedTerms = this.getImplicitlyGroundedTerms(definedVariables, context),
|
|
151
151
|
implicitlyGroundedTermsLength = implicitlyGroundedTerms.length,
|
|
152
152
|
implicitlyGrounded = (implicitlyGroundedTermsLength > 0);
|
|
153
153
|
|
|
154
154
|
return implicitlyGrounded;
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
-
getInitiallyGroundedTerms(
|
|
157
|
+
getInitiallyGroundedTerms(context) {
|
|
158
158
|
const initiallyGroundedTerms = this.terms.reduce((initiallyGroundedTerms, term) => {
|
|
159
|
-
const termInitiallyGrounded = term.isInitiallyGrounded(
|
|
159
|
+
const termInitiallyGrounded = term.isInitiallyGrounded(context);
|
|
160
160
|
|
|
161
161
|
if (termInitiallyGrounded) {
|
|
162
162
|
const initiallyGroundedTerm = term; ///
|
|
@@ -170,9 +170,9 @@ export default class Equivalence {
|
|
|
170
170
|
return initiallyGroundedTerms;
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
-
getImplicitlyGroundedTerms(definedVariables,
|
|
173
|
+
getImplicitlyGroundedTerms(definedVariables, context) {
|
|
174
174
|
const implicitlyGroundedTerms = this.terms.reduce((implicitlyGroundedTerms, term) => {
|
|
175
|
-
const termImplicitlyGrounded = term.isImplicitlyGrounded(definedVariables,
|
|
175
|
+
const termImplicitlyGrounded = term.isImplicitlyGrounded(definedVariables, context);
|
|
176
176
|
|
|
177
177
|
if (termImplicitlyGrounded) {
|
|
178
178
|
const implicitlyGroundedTerm = term; ///
|
package/src/frame.js
CHANGED
|
@@ -86,16 +86,16 @@ class Frame {
|
|
|
86
86
|
return metavariableNodeMatches;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
unifySubstitution(substitution,
|
|
89
|
+
unifySubstitution(substitution, context) {
|
|
90
90
|
let substitutionUnified = false;
|
|
91
91
|
|
|
92
92
|
const substitutionString = substitution.getString();
|
|
93
93
|
|
|
94
|
-
|
|
94
|
+
context.trace(`Unifying the '${substitutionString}' substitution...`)
|
|
95
95
|
|
|
96
96
|
if (!substitutionUnified) {
|
|
97
97
|
substitutionUnified = this.declarations.some((declaration) => {
|
|
98
|
-
const substitutionUnified = declaration.unifySubstitution(substitution,
|
|
98
|
+
const substitutionUnified = declaration.unifySubstitution(substitution, context);
|
|
99
99
|
|
|
100
100
|
if (substitutionUnified) {
|
|
101
101
|
return true;
|
|
@@ -105,7 +105,7 @@ class Frame {
|
|
|
105
105
|
|
|
106
106
|
if (!substitutionUnified) {
|
|
107
107
|
substitutionUnified = this.metavariables.some((metavariable) => {
|
|
108
|
-
const substitutionUnified = metavariable.unifySubstitution(substitution,
|
|
108
|
+
const substitutionUnified = metavariable.unifySubstitution(substitution, context);
|
|
109
109
|
|
|
110
110
|
if (substitutionUnified) {
|
|
111
111
|
return true;
|
|
@@ -114,22 +114,22 @@ class Frame {
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
if (substitutionUnified) {
|
|
117
|
-
|
|
117
|
+
context.debug(`...unified the '${substitutionString}' substitution...`)
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
return substitutionUnified;
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
unifyMetaLemmaOrMetatheorem(metaLemmaMetatheorem,
|
|
123
|
+
unifyMetaLemmaOrMetatheorem(metaLemmaMetatheorem, context) {
|
|
124
124
|
let metaLemmaMetatheoremUnified;
|
|
125
125
|
|
|
126
126
|
const metaLemmaMetatheoremString = metaLemmaMetatheorem.getString();
|
|
127
127
|
|
|
128
|
-
|
|
128
|
+
context.trace(`Unifying the '${metaLemmaMetatheoremString}' meta-lemma or metatheorem...`);
|
|
129
129
|
|
|
130
130
|
const substitutions = metaLemmaMetatheorem.getSubstitutions(),
|
|
131
131
|
substitutionsUnified = substitutions.everySubstitution((substitution) => {
|
|
132
|
-
const substitutionUnified = this.unifySubstitution(substitution,
|
|
132
|
+
const substitutionUnified = this.unifySubstitution(substitution, context);
|
|
133
133
|
|
|
134
134
|
if (substitutionUnified) {
|
|
135
135
|
return true;
|
|
@@ -139,22 +139,22 @@ class Frame {
|
|
|
139
139
|
metaLemmaMetatheoremUnified = substitutionsUnified; ///
|
|
140
140
|
|
|
141
141
|
if (metaLemmaMetatheoremUnified) {
|
|
142
|
-
|
|
142
|
+
context.debug(`...unified the '${metaLemmaMetatheoremString}' meta-lemma or metatheorem.`);
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
return metaLemmaMetatheoremUnified;
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
-
unifyAxiomLemmaTheoremOrConjecture(axiomLemmaTheoremOrConjecture,
|
|
148
|
+
unifyAxiomLemmaTheoremOrConjecture(axiomLemmaTheoremOrConjecture, context) {
|
|
149
149
|
let axiomLemmaTheoremOrConjectureUnified;
|
|
150
150
|
|
|
151
151
|
const axiomLemmaTheoremStringOrConjecture = axiomLemmaTheoremOrConjecture.getString();
|
|
152
152
|
|
|
153
|
-
|
|
153
|
+
context.trace(`Unifying the '${axiomLemmaTheoremStringOrConjecture}' axiom, lemma, theorem or conjecture...`);
|
|
154
154
|
|
|
155
155
|
const substitutions = axiomLemmaTheoremOrConjecture.getSubstitutions(),
|
|
156
156
|
substitutionsUnified = substitutions.everySubstitution((substitution) => {
|
|
157
|
-
const substitutionUnified = this.unifySubstitution(substitution,
|
|
157
|
+
const substitutionUnified = this.unifySubstitution(substitution, context);
|
|
158
158
|
|
|
159
159
|
if (substitutionUnified) {
|
|
160
160
|
return true;
|
|
@@ -164,28 +164,28 @@ class Frame {
|
|
|
164
164
|
axiomLemmaTheoremOrConjectureUnified = substitutionsUnified; ///
|
|
165
165
|
|
|
166
166
|
if (axiomLemmaTheoremOrConjectureUnified) {
|
|
167
|
-
|
|
167
|
+
context.debug(`...unified the '${axiomLemmaTheoremStringOrConjecture}' axiom, lemma, theorem or conjecture.`);
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
return axiomLemmaTheoremOrConjectureUnified;
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
-
verify(assignments, stated,
|
|
173
|
+
verify(assignments, stated, context) {
|
|
174
174
|
let verified = false;
|
|
175
175
|
|
|
176
176
|
const frameString = this.string; ///
|
|
177
177
|
|
|
178
|
-
|
|
178
|
+
context.trace(`Verifying the '${frameString}' frame...`);
|
|
179
179
|
|
|
180
180
|
const declarationsVerified = this.declarations.every((declaration) => {
|
|
181
|
-
const declarationVerified = declaration.verify(assignments, stated,
|
|
181
|
+
const declarationVerified = declaration.verify(assignments, stated, context);
|
|
182
182
|
|
|
183
183
|
return declarationVerified;
|
|
184
184
|
});
|
|
185
185
|
|
|
186
186
|
if (declarationsVerified) {
|
|
187
187
|
const metavariablesVerified = this.metavariables.every((metavariable) => {
|
|
188
|
-
const metavariableVerified = metavariable.verify(
|
|
188
|
+
const metavariableVerified = metavariable.verify(context);
|
|
189
189
|
|
|
190
190
|
return metavariableVerified;
|
|
191
191
|
});
|
|
@@ -195,9 +195,9 @@ class Frame {
|
|
|
195
195
|
verifiedWhenDerived = false;
|
|
196
196
|
|
|
197
197
|
if (stated) {
|
|
198
|
-
verifiedWhenStated = this.verifyWhenStated(assignments,
|
|
198
|
+
verifiedWhenStated = this.verifyWhenStated(assignments, context);
|
|
199
199
|
} else {
|
|
200
|
-
verifiedWhenDerived = this.verifyWhenDerived(assignments,
|
|
200
|
+
verifiedWhenDerived = this.verifyWhenDerived(assignments, context);
|
|
201
201
|
}
|
|
202
202
|
|
|
203
203
|
if (verifiedWhenStated || verifiedWhenDerived) {
|
|
@@ -207,80 +207,80 @@ class Frame {
|
|
|
207
207
|
}
|
|
208
208
|
|
|
209
209
|
if (verified) {
|
|
210
|
-
|
|
210
|
+
context.debug(`...verified the '${frameString}' frame.`);
|
|
211
211
|
}
|
|
212
212
|
|
|
213
213
|
return verified;
|
|
214
214
|
}
|
|
215
215
|
|
|
216
|
-
verifyWhenStated(assignments,
|
|
216
|
+
verifyWhenStated(assignments, context) {
|
|
217
217
|
let verifiedWhenStated = false;
|
|
218
218
|
|
|
219
219
|
const frameString = this.string; ///
|
|
220
220
|
|
|
221
|
-
|
|
221
|
+
context.trace(`Verifying the '${frameString}' frame when stated...`);
|
|
222
222
|
|
|
223
223
|
const declarationsLength = this.declarations.length;
|
|
224
224
|
|
|
225
225
|
if (declarationsLength > 0) {
|
|
226
|
-
|
|
226
|
+
context.trace(`The '${frameString}' stated frame cannot have declarations.`);
|
|
227
227
|
} else {
|
|
228
228
|
const metavariablesLength = this.metavariables.length;
|
|
229
229
|
|
|
230
230
|
if (metavariablesLength > 1) {
|
|
231
|
-
|
|
231
|
+
context.trace(`The '${frameString}' stated frame cannot have more than one metavariable.`);
|
|
232
232
|
} else {
|
|
233
233
|
verifiedWhenStated = true;
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
236
|
|
|
237
237
|
if (verifiedWhenStated) {
|
|
238
|
-
|
|
238
|
+
context.debug(`...verified the '${frameString}' frame when stated.`);
|
|
239
239
|
}
|
|
240
240
|
|
|
241
241
|
return verifiedWhenStated;
|
|
242
242
|
}
|
|
243
243
|
|
|
244
|
-
verifyWhenDerived(assignments,
|
|
244
|
+
verifyWhenDerived(assignments, context) {
|
|
245
245
|
let verifiedWhenDerived;
|
|
246
246
|
|
|
247
247
|
const frameString = this.string; ///
|
|
248
248
|
|
|
249
|
-
|
|
249
|
+
context.trace(`Verifying the '${frameString}' frame when derived...`);
|
|
250
250
|
|
|
251
251
|
verifiedWhenDerived = true;
|
|
252
252
|
|
|
253
253
|
if (verifiedWhenDerived) {
|
|
254
|
-
|
|
254
|
+
context.debug(`...verified the '${frameString}' frame when derived.`);
|
|
255
255
|
}
|
|
256
256
|
|
|
257
257
|
return verifiedWhenDerived;
|
|
258
258
|
}
|
|
259
259
|
|
|
260
|
-
verifyGivenMetaType(metaType, assignments, stated,
|
|
260
|
+
verifyGivenMetaType(metaType, assignments, stated, context) {
|
|
261
261
|
let verifiedGivenMetaType = false;
|
|
262
262
|
|
|
263
263
|
const frameString = this.string, ///
|
|
264
264
|
metaTypeString = metaType.getString();
|
|
265
265
|
|
|
266
|
-
|
|
266
|
+
context.trace(`Verifying the '${frameString}' frame given the '${metaTypeString}' meta-type...`);
|
|
267
267
|
|
|
268
268
|
const metaTypeName = metaType.getName();
|
|
269
269
|
|
|
270
270
|
if (metaTypeName === FRAME_META_TYPE_NAME) {
|
|
271
|
-
const verified = this.verify(assignments, stated,
|
|
271
|
+
const verified = this.verify(assignments, stated, context)
|
|
272
272
|
|
|
273
273
|
verifiedGivenMetaType = verified; ///
|
|
274
274
|
}
|
|
275
275
|
|
|
276
276
|
if (verifiedGivenMetaType) {
|
|
277
|
-
|
|
277
|
+
context.debug(`...verified the '${frameString}' frame given the '${metaTypeString}' meta-type.`);
|
|
278
278
|
}
|
|
279
279
|
|
|
280
280
|
return verifiedGivenMetaType;
|
|
281
281
|
}
|
|
282
282
|
|
|
283
|
-
static fromFrameNode(frameNode,
|
|
283
|
+
static fromFrameNode(frameNode, context) {
|
|
284
284
|
let frame = null;
|
|
285
285
|
|
|
286
286
|
if (frameNode !== null) {
|
|
@@ -288,17 +288,17 @@ class Frame {
|
|
|
288
288
|
declarationNodes = declarationNodesQuery(frameNode),
|
|
289
289
|
metavariableNodes = metavariableNodesQuery(frameNode),
|
|
290
290
|
declarations = declarationNodes.map((declarationNode) => {
|
|
291
|
-
const declaration = Declaration.fromDeclarationNode(declarationNode,
|
|
291
|
+
const declaration = Declaration.fromDeclarationNode(declarationNode, context);
|
|
292
292
|
|
|
293
293
|
return declaration;
|
|
294
294
|
}),
|
|
295
295
|
metavariables = metavariableNodes.map((metavariableNode) => {
|
|
296
|
-
const metavariable = Metavariable.fromMetavariableNode(metavariableNode,
|
|
296
|
+
const metavariable = Metavariable.fromMetavariableNode(metavariableNode, context);
|
|
297
297
|
|
|
298
298
|
return metavariable;
|
|
299
299
|
}),
|
|
300
300
|
node = frameNode, ///
|
|
301
|
-
string =
|
|
301
|
+
string = context.nodeAsString(node);
|
|
302
302
|
|
|
303
303
|
frame = new Frame(string, node, declarations, metavariables);
|
|
304
304
|
}
|
|
@@ -306,7 +306,7 @@ class Frame {
|
|
|
306
306
|
return frame;
|
|
307
307
|
}
|
|
308
308
|
|
|
309
|
-
static fromDefinedAssertionNode(definedAssertionNode,
|
|
309
|
+
static fromDefinedAssertionNode(definedAssertionNode, context) {
|
|
310
310
|
let frame = null;
|
|
311
311
|
|
|
312
312
|
const frameNode = frameNodeQuery(definedAssertionNode);
|
|
@@ -316,13 +316,13 @@ class Frame {
|
|
|
316
316
|
|
|
317
317
|
if (metavariableNode !== null) {
|
|
318
318
|
const { Metavariable } = shim,
|
|
319
|
-
metavariable = Metavariable.fromMetavariableNode(metavariableNode,
|
|
319
|
+
metavariable = Metavariable.fromMetavariableNode(metavariableNode, context),
|
|
320
320
|
declarations = [],
|
|
321
321
|
metavariables = [
|
|
322
322
|
metavariable
|
|
323
323
|
],
|
|
324
324
|
node = frameNode, ///
|
|
325
|
-
string =
|
|
325
|
+
string = context.nodeAsString(node);
|
|
326
326
|
|
|
327
327
|
frame = new Frame(string, node, declarations, metavariables);
|
|
328
328
|
}
|
|
@@ -331,7 +331,7 @@ class Frame {
|
|
|
331
331
|
return frame;
|
|
332
332
|
}
|
|
333
333
|
|
|
334
|
-
static fromContainedAssertionNode(containedAssertionNode,
|
|
334
|
+
static fromContainedAssertionNode(containedAssertionNode, context) {
|
|
335
335
|
let frame = null;
|
|
336
336
|
|
|
337
337
|
const frameNode = frameNodeQuery(containedAssertionNode);
|
|
@@ -341,13 +341,13 @@ class Frame {
|
|
|
341
341
|
|
|
342
342
|
if (metavariableNode !== null) {
|
|
343
343
|
const { Metavariable } = shim,
|
|
344
|
-
metavariable = Metavariable.fromMetavariableNode(metavariableNode,
|
|
344
|
+
metavariable = Metavariable.fromMetavariableNode(metavariableNode, context),
|
|
345
345
|
declarations = [],
|
|
346
346
|
metavariables = [
|
|
347
347
|
metavariable
|
|
348
348
|
],
|
|
349
349
|
node = frameNode, ///
|
|
350
|
-
string =
|
|
350
|
+
string = context.nodeAsString(node);
|
|
351
351
|
|
|
352
352
|
frame = new Frame(string, node, declarations, metavariables);
|
|
353
353
|
}
|
package/src/index.js
CHANGED
|
@@ -33,6 +33,7 @@ import Substitutions from "./substitutions";
|
|
|
33
33
|
import SubDerivation from "./subDerivation";
|
|
34
34
|
import QualifiedStatement from "./statement/qualified";
|
|
35
35
|
import UnqualifiedStatement from "./statement/unqualified";
|
|
36
|
+
import StatementForMetavariableSubstitution from "./substitution/statementForMetavariable";
|
|
36
37
|
|
|
37
38
|
export { default as Log } from "./log";
|
|
38
39
|
export { default as ReleaseContext } from "./context/release";
|