occam-verify-cli 1.0.852 → 1.0.857
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/file/nominal.js +18 -3
- package/lib/context/liminal.js +101 -102
- package/lib/context/mnemic.js +511 -0
- package/lib/context.js +23 -11
- package/lib/element/assertion/contained.js +8 -8
- package/lib/element/assertion/defined.js +6 -6
- package/lib/element/assertion/satisfies.js +4 -4
- package/lib/element/assertion/type.js +5 -4
- package/lib/element/assumption/metaLevel.js +7 -7
- package/lib/element/assumption.js +23 -15
- package/lib/element/combinator.js +4 -4
- package/lib/element/conclusion.js +4 -4
- package/lib/element/constructor.js +4 -4
- package/lib/element/declaration/combinator.js +4 -4
- package/lib/element/declaration/complexType.js +3 -3
- package/lib/element/declaration/constructor.js +6 -4
- package/lib/element/declaration/metavariable.js +7 -7
- package/lib/element/declaration/variable.js +6 -4
- package/lib/element/deduction.js +4 -4
- package/lib/element/frame.js +60 -48
- package/lib/element/judgement.js +16 -29
- package/lib/element/label.js +4 -4
- package/lib/element/metavariable.js +59 -58
- package/lib/element/proofAssertion/premise.js +4 -4
- package/lib/element/reference.js +20 -20
- package/lib/element/rule.js +4 -4
- package/lib/element/substitution/frame.js +9 -8
- package/lib/element/substitution/reference.js +7 -7
- package/lib/element/substitution/statement.js +12 -11
- package/lib/element/substitution/term.js +9 -8
- package/lib/element/topLevelAssertion.js +4 -4
- package/lib/element/topLevelMetaAssertion.js +2 -2
- package/lib/element/variable.js +8 -8
- package/lib/utilities/context.js +6 -6
- package/lib/utilities/element.js +3 -3
- package/lib/utilities/json.js +16 -16
- package/lib/utilities/string.js +7 -29
- package/lib/utilities/substitutions.js +6 -6
- package/package.json +1 -1
- package/src/context/file/nominal.js +24 -2
- package/src/context/liminal.js +116 -117
- package/src/context/{ephemeral.js → mnemic.js} +38 -40
- package/src/context.js +32 -12
- package/src/element/assertion/contained.js +7 -7
- package/src/element/assertion/defined.js +5 -5
- package/src/element/assertion/satisfies.js +3 -4
- package/src/element/assertion/type.js +5 -4
- package/src/element/assumption/metaLevel.js +6 -8
- package/src/element/assumption.js +28 -17
- package/src/element/combinator.js +3 -4
- package/src/element/conclusion.js +3 -4
- package/src/element/constructor.js +3 -4
- package/src/element/declaration/combinator.js +3 -4
- package/src/element/declaration/complexType.js +2 -2
- package/src/element/declaration/constructor.js +7 -4
- package/src/element/declaration/metavariable.js +6 -8
- package/src/element/declaration/variable.js +7 -4
- package/src/element/deduction.js +3 -4
- package/src/element/frame.js +81 -64
- package/src/element/judgement.js +21 -43
- package/src/element/label.js +3 -4
- package/src/element/metavariable.js +66 -73
- package/src/element/proofAssertion/premise.js +3 -4
- package/src/element/reference.js +21 -25
- package/src/element/rule.js +3 -3
- package/src/element/substitution/frame.js +7 -7
- package/src/element/substitution/reference.js +4 -6
- package/src/element/substitution/statement.js +9 -10
- package/src/element/substitution/term.js +7 -7
- package/src/element/topLevelAssertion.js +3 -3
- package/src/element/topLevelMetaAssertion.js +2 -2
- package/src/element/variable.js +7 -8
- package/src/utilities/context.js +9 -9
- package/src/utilities/element.js +3 -3
- package/src/utilities/json.js +9 -9
- package/src/utilities/string.js +11 -40
- package/src/utilities/substitutions.js +3 -3
- package/lib/context/ephemeral.js +0 -513
|
@@ -81,10 +81,9 @@ export default define(class Conclusion extends Element {
|
|
|
81
81
|
validateStatement(context) {
|
|
82
82
|
let statementValidates = false;
|
|
83
83
|
|
|
84
|
-
const
|
|
85
|
-
conclusionString = this.getString(); ///
|
|
84
|
+
const conclusionString = this.getString(); ///
|
|
86
85
|
|
|
87
|
-
context.trace(`Validating the '${conclusionString}' conclusion's
|
|
86
|
+
context.trace(`Validating the '${conclusionString}' conclusion's statement...`);
|
|
88
87
|
|
|
89
88
|
descend((context) => {
|
|
90
89
|
const statement = this.statement.validate(context);
|
|
@@ -95,7 +94,7 @@ export default define(class Conclusion extends Element {
|
|
|
95
94
|
}, context);
|
|
96
95
|
|
|
97
96
|
if (statementValidates) {
|
|
98
|
-
context.trace(`...validated the '${conclusionString}' conclusion's
|
|
97
|
+
context.trace(`...validated the '${conclusionString}' conclusion's statement.`);
|
|
99
98
|
}
|
|
100
99
|
|
|
101
100
|
return statementValidates;
|
|
@@ -82,11 +82,10 @@ export default define(class Constructor extends Element {
|
|
|
82
82
|
validateTerm(context) {
|
|
83
83
|
let termValidates = false;
|
|
84
84
|
|
|
85
|
-
const
|
|
86
|
-
includeType = false,
|
|
85
|
+
const includeType = false,
|
|
87
86
|
constructorString = this.getString(includeType);
|
|
88
87
|
|
|
89
|
-
context.trace(`Validating the '${constructorString}' constructor's
|
|
88
|
+
context.trace(`Validating the '${constructorString}' constructor's term...`);
|
|
90
89
|
|
|
91
90
|
const termValidatesAsConstructor = validateTermAsConstructor(this.term, context);
|
|
92
91
|
|
|
@@ -95,7 +94,7 @@ export default define(class Constructor extends Element {
|
|
|
95
94
|
}
|
|
96
95
|
|
|
97
96
|
if (termValidates) {
|
|
98
|
-
context.debug(`...validated the '${constructorString}' constructor's
|
|
97
|
+
context.debug(`...validated the '${constructorString}' constructor's term.`);
|
|
99
98
|
}
|
|
100
99
|
|
|
101
100
|
return termValidates;
|
|
@@ -49,15 +49,14 @@ export default define(class CombinatorDeclaration extends Declaration {
|
|
|
49
49
|
validateCombinator(context) {
|
|
50
50
|
let combinatorValidates;
|
|
51
51
|
|
|
52
|
-
const
|
|
53
|
-
combinatorDeclarationString = this.getString(); ///
|
|
52
|
+
const combinatorDeclarationString = this.getString(); ///
|
|
54
53
|
|
|
55
|
-
context.trace(`Validating the '${combinatorDeclarationString}' combinator declaration's
|
|
54
|
+
context.trace(`Validating the '${combinatorDeclarationString}' combinator declaration's combinator...`);
|
|
56
55
|
|
|
57
56
|
combinatorValidates = this.combinator.validate(context);
|
|
58
57
|
|
|
59
58
|
if (combinatorValidates) {
|
|
60
|
-
context.debug(`...validated the '${combinatorDeclarationString}' combinator declaration's
|
|
59
|
+
context.debug(`...validated the '${combinatorDeclarationString}' combinator declaration's combinator.`);
|
|
61
60
|
}
|
|
62
61
|
|
|
63
62
|
return combinatorValidates;
|
|
@@ -281,7 +281,7 @@ export default define(class ComplexTypeDeclaration extends Declaration {
|
|
|
281
281
|
const propertyString = property.getString(),
|
|
282
282
|
nominalTypeName = property.getNominalTypeName();
|
|
283
283
|
|
|
284
|
-
context.trace(`Verifying the '${propertyString}' property's
|
|
284
|
+
context.trace(`Verifying the '${propertyString}' property's nominal type name...`);
|
|
285
285
|
|
|
286
286
|
const typeComparesToNominalTypeName = this.type.compareNominalTypeName(nominalTypeName);
|
|
287
287
|
|
|
@@ -296,7 +296,7 @@ export default define(class ComplexTypeDeclaration extends Declaration {
|
|
|
296
296
|
}
|
|
297
297
|
|
|
298
298
|
if (propertyNominalTypeNameVerifies) {
|
|
299
|
-
context.debug(`...verifies the '${propertyString}' property's
|
|
299
|
+
context.debug(`...verifies the '${propertyString}' property's nominal type name.`);
|
|
300
300
|
}
|
|
301
301
|
|
|
302
302
|
return propertyNominalTypeNameVerifies;
|
|
@@ -65,10 +65,9 @@ export default define(class ConstructorDeclaration extends Declaration {
|
|
|
65
65
|
verifyType(context) {
|
|
66
66
|
let typeVerifies = false;
|
|
67
67
|
|
|
68
|
-
const
|
|
69
|
-
constructorDeclarationString = this.getString(); ///
|
|
68
|
+
const constructorDeclarationString = this.getString(); ///
|
|
70
69
|
|
|
71
|
-
context.trace(`Verifying the '${constructorDeclarationString}' constructor declaration's
|
|
70
|
+
context.trace(`Verifying the '${constructorDeclarationString}' constructor declaration's type...`);
|
|
72
71
|
|
|
73
72
|
const nominalTypeName = this.type.getNominalTypeName(),
|
|
74
73
|
type = context.findTypeByNominalTypeName(nominalTypeName);
|
|
@@ -78,6 +77,8 @@ export default define(class ConstructorDeclaration extends Declaration {
|
|
|
78
77
|
typeComparesToProvisional = type.compareProvisional(provisional);
|
|
79
78
|
|
|
80
79
|
if (!typeComparesToProvisional) {
|
|
80
|
+
const typeString = this.type.getString();
|
|
81
|
+
|
|
81
82
|
provisional ?
|
|
82
83
|
context.debug(`The '${typeString}' type is present but not provisional.`) :
|
|
83
84
|
context.debug(`The '${typeString}' type is present but provisional.`);
|
|
@@ -87,11 +88,13 @@ export default define(class ConstructorDeclaration extends Declaration {
|
|
|
87
88
|
typeVerifies = true;
|
|
88
89
|
}
|
|
89
90
|
} else {
|
|
91
|
+
const typeString = this.type.getString();
|
|
92
|
+
|
|
90
93
|
context.debug(`The '${typeString}' type is not present.`);
|
|
91
94
|
}
|
|
92
95
|
|
|
93
96
|
if (typeVerifies) {
|
|
94
|
-
context.debug(`...verified the '${constructorDeclarationString}' constructor declaration's
|
|
97
|
+
context.debug(`...verified the '${constructorDeclarationString}' constructor declaration's type.`);
|
|
95
98
|
}
|
|
96
99
|
|
|
97
100
|
return typeVerifies;
|
|
@@ -53,15 +53,14 @@ export default define(class MetavariableDeclaration extends Declaration {
|
|
|
53
53
|
verifyMetaType(context) {
|
|
54
54
|
let metaTypeVerifies = true;
|
|
55
55
|
|
|
56
|
-
const
|
|
57
|
-
metaTypeDeclarationString = this.getString(); ///
|
|
56
|
+
const metaTypeDeclarationString = this.getString(); ///
|
|
58
57
|
|
|
59
|
-
context.trace(`Verifying the '${metaTypeDeclarationString}' metavariable declaration's
|
|
58
|
+
context.trace(`Verifying the '${metaTypeDeclarationString}' metavariable declaration's metaType...`);
|
|
60
59
|
|
|
61
60
|
this.metavariable.setMetaType(this.metaType);
|
|
62
61
|
|
|
63
62
|
if (metaTypeVerifies) {
|
|
64
|
-
context.debug(`...verified the '${metaTypeDeclarationString}' metavariable declaration's
|
|
63
|
+
context.debug(`...verified the '${metaTypeDeclarationString}' metavariable declaration's metaType.`);
|
|
65
64
|
}
|
|
66
65
|
|
|
67
66
|
return metaTypeVerifies;
|
|
@@ -70,10 +69,9 @@ export default define(class MetavariableDeclaration extends Declaration {
|
|
|
70
69
|
verifyMetavariable(context) {
|
|
71
70
|
let metavariableVerifies = false;
|
|
72
71
|
|
|
73
|
-
const
|
|
74
|
-
metavariableDeclarationString = this.getString(); ///
|
|
72
|
+
const metavariableDeclarationString = this.getString(); ///
|
|
75
73
|
|
|
76
|
-
context.trace(`Verifying the '${metavariableDeclarationString}' metavariable declaration's
|
|
74
|
+
context.trace(`Verifying the '${metavariableDeclarationString}' metavariable declaration's metavariable...`);
|
|
77
75
|
|
|
78
76
|
const metavariableName = this.metavariable.getName(),
|
|
79
77
|
declaredMetavariablePresent = context.isDeclaredMetavariablePresentByMetavariableName(metavariableName);
|
|
@@ -85,7 +83,7 @@ export default define(class MetavariableDeclaration extends Declaration {
|
|
|
85
83
|
}
|
|
86
84
|
|
|
87
85
|
if (metavariableVerifies) {
|
|
88
|
-
context.debug(`...verified the '${metavariableDeclarationString}' metavariable declaration's
|
|
86
|
+
context.debug(`...verified the '${metavariableDeclarationString}' metavariable declaration's metavariable.`);
|
|
89
87
|
}
|
|
90
88
|
|
|
91
89
|
return metavariableVerifies;
|
|
@@ -65,21 +65,24 @@ export default define(class VariableDeclaration extends Declaration {
|
|
|
65
65
|
verifyType(context) {
|
|
66
66
|
let typeVerifies = false;
|
|
67
67
|
|
|
68
|
-
const
|
|
69
|
-
variableDeclarationString = this.getString(); ///
|
|
68
|
+
const variableDeclarationString = this.getString(); ///
|
|
70
69
|
|
|
71
|
-
context.trace(`Verifying the '${variableDeclarationString}' variable declaration's
|
|
70
|
+
context.trace(`Verifying the '${variableDeclarationString}' variable declaration's type...`);
|
|
72
71
|
|
|
73
72
|
const nominalTypeName = this.type.getNominalTypeName(),
|
|
74
73
|
type = context.findTypeByNominalTypeName(nominalTypeName),
|
|
75
74
|
typePresent = (type !== null)
|
|
76
75
|
|
|
77
76
|
if (!typePresent) {
|
|
77
|
+
const typeString = this.type.getString();
|
|
78
|
+
|
|
78
79
|
context.debug(`The '${typeString}' type is not present.`);
|
|
79
80
|
} else {
|
|
80
81
|
const typeComparesToProvisional = type.compareProvisional(this.provisional);
|
|
81
82
|
|
|
82
83
|
if (!typeComparesToProvisional) {
|
|
84
|
+
const typeString = this.type.getString();
|
|
85
|
+
|
|
83
86
|
this.provisional ?
|
|
84
87
|
context.debug(`The '${variableDeclarationString}' variable declaration's '${typeString}' type is present but not provisional.`) :
|
|
85
88
|
context.debug(`The '${variableDeclarationString}' variable declaration's '${typeString}' type is present but provisional.`);
|
|
@@ -91,7 +94,7 @@ export default define(class VariableDeclaration extends Declaration {
|
|
|
91
94
|
}
|
|
92
95
|
|
|
93
96
|
if (typeVerifies) {
|
|
94
|
-
context.debug(`...verified the '${variableDeclarationString}' variable declaration's
|
|
97
|
+
context.debug(`...verified the '${variableDeclarationString}' variable declaration's type.`);
|
|
95
98
|
}
|
|
96
99
|
|
|
97
100
|
return typeVerifies;
|
package/src/element/deduction.js
CHANGED
|
@@ -81,10 +81,9 @@ export default define(class Deduction extends Element {
|
|
|
81
81
|
validateStatement(context) {
|
|
82
82
|
let statementValidates = false;
|
|
83
83
|
|
|
84
|
-
const
|
|
85
|
-
deductionnString = this.getString(); ///
|
|
84
|
+
const deductionnString = this.getString(); ///
|
|
86
85
|
|
|
87
|
-
context.trace(`Validating the '${deductionnString}' deductionn's
|
|
86
|
+
context.trace(`Validating the '${deductionnString}' deductionn's statement...`);
|
|
88
87
|
|
|
89
88
|
descend((context) => {
|
|
90
89
|
const statement = this.statement.validate(context);
|
|
@@ -95,7 +94,7 @@ export default define(class Deduction extends Element {
|
|
|
95
94
|
}, context);
|
|
96
95
|
|
|
97
96
|
if (statementValidates) {
|
|
98
|
-
context.trace(`...validated the '${deductionnString}' deductionn's
|
|
97
|
+
context.trace(`...validated the '${deductionnString}' deductionn's statement.`);
|
|
99
98
|
}
|
|
100
99
|
|
|
101
100
|
return statementValidates;
|
package/src/element/frame.js
CHANGED
|
@@ -7,7 +7,6 @@ import { instantiate } from "../utilities/context";
|
|
|
7
7
|
import { instantiateFrame } from "../process/instantiate";
|
|
8
8
|
import { FRAME_META_TYPE_NAME } from "../metaTypeNames";
|
|
9
9
|
import { metavariableFromFrameNode } from "../utilities/element";
|
|
10
|
-
import { assumptionsStringFromAssumptions } from "../utilities/string";
|
|
11
10
|
|
|
12
11
|
export default define(class Frame extends Element {
|
|
13
12
|
constructor(context, string, node, lineIndex, assumptions, metavariable) {
|
|
@@ -166,51 +165,13 @@ export default define(class Frame extends Element {
|
|
|
166
165
|
return frame;
|
|
167
166
|
}
|
|
168
167
|
|
|
169
|
-
validateWhenStated(context) {
|
|
170
|
-
let validatesWhenStated = false;
|
|
171
|
-
|
|
172
|
-
const frameString = this.getString(); ///
|
|
173
|
-
|
|
174
|
-
context.trace(`Validating the '${frameString}' stated frame...`);
|
|
175
|
-
|
|
176
|
-
const singular = this.isSingular();
|
|
177
|
-
|
|
178
|
-
if (singular) {
|
|
179
|
-
validatesWhenStated = true;
|
|
180
|
-
} else {
|
|
181
|
-
context.debug(`The '${frameString}' stated frame must be singular.`);
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
if (validatesWhenStated) {
|
|
185
|
-
context.debug(`...validated the '${frameString}' stated frame.`);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
return validatesWhenStated;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
validateWhenDerived(context) {
|
|
192
|
-
let validatesWhenDerived;
|
|
193
|
-
|
|
194
|
-
const frameString = this.getString(); ///
|
|
195
|
-
|
|
196
|
-
context.trace(`Verifying the '${frameString}' derived frame...`);
|
|
197
|
-
|
|
198
|
-
validatesWhenDerived = true;
|
|
199
|
-
|
|
200
|
-
if (validatesWhenDerived) {
|
|
201
|
-
context.debug(`...verified the '${frameString}' derived frame.`);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
return validatesWhenDerived;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
168
|
validateAssumption(assumption, assumptions, context) {
|
|
208
169
|
let assumptionValidates = false;
|
|
209
170
|
|
|
210
171
|
const frameString = this.getString(), ///
|
|
211
|
-
|
|
172
|
+
assumptionString = assumption.getString();
|
|
212
173
|
|
|
213
|
-
context.trace(`Validating the '${frameString}' frame's '${
|
|
174
|
+
context.trace(`Validating the '${frameString}' frame's '${assumptionString}' assumption.`);
|
|
214
175
|
|
|
215
176
|
assumption = assumption.validate(context); ///
|
|
216
177
|
|
|
@@ -221,7 +182,7 @@ export default define(class Frame extends Element {
|
|
|
221
182
|
}
|
|
222
183
|
|
|
223
184
|
if (assumptionValidates) {
|
|
224
|
-
context.debug(`...validated the '${frameString}' frame's '${
|
|
185
|
+
context.debug(`...validated the '${frameString}' frame's '${assumptionString}' assumption.`);
|
|
225
186
|
}
|
|
226
187
|
|
|
227
188
|
return assumptionValidates;
|
|
@@ -230,31 +191,24 @@ export default define(class Frame extends Element {
|
|
|
230
191
|
validateAssumptions(context) {
|
|
231
192
|
let assumptionsValidate;
|
|
232
193
|
|
|
233
|
-
const
|
|
234
|
-
|
|
235
|
-
if (assumptionsLength) {
|
|
236
|
-
const frameString = this.getString(), ///
|
|
237
|
-
assumptionsString = assumptionsStringFromAssumptions(this.assumptions);
|
|
194
|
+
const frameString = this.getString();
|
|
238
195
|
|
|
239
|
-
|
|
196
|
+
context.trace(`Validating the '${frameString}' frame's assumptions...`);
|
|
240
197
|
|
|
241
|
-
|
|
198
|
+
const assumptions = [];
|
|
242
199
|
|
|
243
|
-
|
|
244
|
-
|
|
200
|
+
assumptionsValidate = this.assumptions.every((assumption) => {
|
|
201
|
+
const assumptionValidates = this.validateAssumption(assumption, assumptions, context);
|
|
245
202
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
203
|
+
if (assumptionValidates) {
|
|
204
|
+
return true;
|
|
205
|
+
}
|
|
206
|
+
});
|
|
250
207
|
|
|
251
|
-
|
|
252
|
-
|
|
208
|
+
if (assumptionsValidate) {
|
|
209
|
+
this.assumptions = assumptions;
|
|
253
210
|
|
|
254
|
-
|
|
255
|
-
}
|
|
256
|
-
} else {
|
|
257
|
-
assumptionsValidate = true;
|
|
211
|
+
context.debug(`...validated the '${frameString}' frame's assumptions.`);
|
|
258
212
|
}
|
|
259
213
|
|
|
260
214
|
return assumptionsValidate;
|
|
@@ -266,10 +220,9 @@ export default define(class Frame extends Element {
|
|
|
266
220
|
if (this.metavariable !== null) {
|
|
267
221
|
metavariableValidates = false;
|
|
268
222
|
|
|
269
|
-
const frameString = this.getString()
|
|
270
|
-
metavariableString = this.metavariable.getString();
|
|
223
|
+
const frameString = this.getString(); ///
|
|
271
224
|
|
|
272
|
-
context.trace(`Validating the '${frameString}' frame's
|
|
225
|
+
context.trace(`Validating the '${frameString}' frame's metavariable...`);
|
|
273
226
|
|
|
274
227
|
const metavariable = this.metavariable.validate(context),
|
|
275
228
|
metaTypeName = FRAME_META_TYPE_NAME,
|
|
@@ -277,13 +230,77 @@ export default define(class Frame extends Element {
|
|
|
277
230
|
metavariableMetaTypeEqualToFrameMetaType = metavariable.isMetaTypeEqualTo(frameMetaType);
|
|
278
231
|
|
|
279
232
|
if (metavariableMetaTypeEqualToFrameMetaType) {
|
|
233
|
+
this.metavariable = metavariable; ///
|
|
234
|
+
|
|
280
235
|
metavariableValidates = true;
|
|
281
236
|
}
|
|
237
|
+
|
|
238
|
+
if (metavariableValidates) {
|
|
239
|
+
context.debug(`...validated the '${frameString}' frame's metavariable.`);
|
|
240
|
+
}
|
|
282
241
|
}
|
|
283
242
|
|
|
284
243
|
return metavariableValidates;
|
|
285
244
|
}
|
|
286
245
|
|
|
246
|
+
validateWhenStated(context) {
|
|
247
|
+
let validatesWhenStated = false;
|
|
248
|
+
|
|
249
|
+
const frameString = this.getString(); ///
|
|
250
|
+
|
|
251
|
+
context.trace(`Validating the '${frameString}' stated frame...`);
|
|
252
|
+
|
|
253
|
+
const singular = this.isSingular();
|
|
254
|
+
|
|
255
|
+
if (singular) {
|
|
256
|
+
validatesWhenStated = true;
|
|
257
|
+
} else {
|
|
258
|
+
context.debug(`The '${frameString}' stated frame must be singular.`);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
if (validatesWhenStated) {
|
|
262
|
+
context.debug(`...validated the '${frameString}' stated frame.`);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
return validatesWhenStated;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
validateWhenDerived(context) {
|
|
269
|
+
let validatesWhenDerived = false;
|
|
270
|
+
|
|
271
|
+
const frameString = this.getString(); ///
|
|
272
|
+
|
|
273
|
+
context.trace(`Verifying the '${frameString}' derived frame...`);
|
|
274
|
+
|
|
275
|
+
if (this.metavariable !== null) {
|
|
276
|
+
const metavariableNode = this.getMetavariableNode(),
|
|
277
|
+
declaredJudgements = context.findDeclaredJudgementsByMetavariableNode(metavariableNode),
|
|
278
|
+
declaredJudgementsLength = declaredJudgements.length;
|
|
279
|
+
|
|
280
|
+
if (declaredJudgementsLength > 0) {
|
|
281
|
+
declaredJudgements.forEach((declaredJudgement) => {
|
|
282
|
+
const assumption = declaredJudgement.getAssumption();
|
|
283
|
+
|
|
284
|
+
this.assumptions.push(assumption);
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
validatesWhenDerived = true;
|
|
288
|
+
} else {
|
|
289
|
+
const metavariableString = this.metavariable.getString();
|
|
290
|
+
|
|
291
|
+
context.trace(`The '${frameString}' frame's '${metavariableString}' metavariable does not match any declared judgements...`);
|
|
292
|
+
}
|
|
293
|
+
} else {
|
|
294
|
+
validatesWhenDerived = true;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
if (validatesWhenDerived) {
|
|
298
|
+
context.debug(`...verified the '${frameString}' derived frame.`);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
return validatesWhenDerived;
|
|
302
|
+
}
|
|
303
|
+
|
|
287
304
|
toJSON() {
|
|
288
305
|
const string = this.getString(),
|
|
289
306
|
lineIndex = this.getLineIndex(),
|
package/src/element/judgement.js
CHANGED
|
@@ -132,10 +132,9 @@ export default define(class Judgement extends Element {
|
|
|
132
132
|
validateFrame(context) {
|
|
133
133
|
let frameValidates = false;
|
|
134
134
|
|
|
135
|
-
const
|
|
136
|
-
judgementString = this.getString(); ///
|
|
135
|
+
const judgementString = this.getString(); ///
|
|
137
136
|
|
|
138
|
-
context.trace(`Validating the '${judgementString}' judgement's
|
|
137
|
+
context.trace(`Validating the '${judgementString}' judgement's frame...`);
|
|
139
138
|
|
|
140
139
|
const frame = this.frame.validate(context);
|
|
141
140
|
|
|
@@ -146,7 +145,7 @@ export default define(class Judgement extends Element {
|
|
|
146
145
|
}
|
|
147
146
|
|
|
148
147
|
if (frameValidates) {
|
|
149
|
-
context.trace(`...validated the '${judgementString}' judgement's
|
|
148
|
+
context.trace(`...validated the '${judgementString}' judgement's frame.`);
|
|
150
149
|
}
|
|
151
150
|
|
|
152
151
|
return frameValidates;
|
|
@@ -155,10 +154,9 @@ export default define(class Judgement extends Element {
|
|
|
155
154
|
validateAssumption(context) {
|
|
156
155
|
let assumptionValidates = false;
|
|
157
156
|
|
|
158
|
-
const
|
|
159
|
-
judgementString = this.getString(); ///
|
|
157
|
+
const judgementString = this.getString(); ///
|
|
160
158
|
|
|
161
|
-
context.trace(`Validating the '${judgementString}' judgement's
|
|
159
|
+
context.trace(`Validating the '${judgementString}' judgement's assumption...`);
|
|
162
160
|
|
|
163
161
|
const assumption = this.assumption.validate(context);
|
|
164
162
|
|
|
@@ -169,7 +167,7 @@ export default define(class Judgement extends Element {
|
|
|
169
167
|
}
|
|
170
168
|
|
|
171
169
|
if (assumptionValidates) {
|
|
172
|
-
context.debug(`...validated the '${judgementString}' judgement's
|
|
170
|
+
context.debug(`...validated the '${judgementString}' judgement's assumption.`);
|
|
173
171
|
}
|
|
174
172
|
|
|
175
173
|
return assumptionValidates;
|
|
@@ -198,36 +196,26 @@ export default define(class Judgement extends Element {
|
|
|
198
196
|
|
|
199
197
|
context.trace(`Validating the '${judgementString}' derived judgement...`);
|
|
200
198
|
|
|
201
|
-
const
|
|
199
|
+
const assumptions = this.getAssumptions(),
|
|
202
200
|
topLevelMetaAssertion = this.getTopLevelMetaAssertion(),
|
|
203
201
|
metaLevelAssumptions = topLevelMetaAssertion.getMetaLevelAssumptions(),
|
|
204
|
-
|
|
202
|
+
metaLevelAssumptionsUnify = metaLevelAssumptions.every((metaLevelAssumption) => {
|
|
203
|
+
const metaLevelAssumptionUnifies = assumptions.some((assumption) => {
|
|
204
|
+
const metaLevelAssumptionUnifies = assumption.unifyMetaLevelAssumption(metaLevelAssumption, context);
|
|
205
205
|
|
|
206
|
-
|
|
206
|
+
if (metaLevelAssumptionUnifies) {
|
|
207
|
+
return true;
|
|
208
|
+
}
|
|
209
|
+
});
|
|
207
210
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
reconcile((context) => {
|
|
213
|
-
const metaLevelAssumptionsUnify = metaLevelAssumptions.every((metaLevelAssumption) => {
|
|
214
|
-
const metaLevelAssumptionUnifies = assumptions.some((assumption) => {
|
|
215
|
-
const metaLevelAssumptionUnifies = assumption.unifyMetaLevelAssumption(metaLevelAssumption, context);
|
|
216
|
-
|
|
217
|
-
if (metaLevelAssumptionUnifies) {
|
|
218
|
-
return true;
|
|
219
|
-
}
|
|
220
|
-
});
|
|
221
|
-
|
|
222
|
-
if (metaLevelAssumptionUnifies) {
|
|
223
|
-
return true;
|
|
224
|
-
}
|
|
225
|
-
});
|
|
211
|
+
if (metaLevelAssumptionUnifies) {
|
|
212
|
+
return true;
|
|
213
|
+
}
|
|
214
|
+
});
|
|
226
215
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
}, context);
|
|
216
|
+
if (metaLevelAssumptionsUnify) {
|
|
217
|
+
validatesWhenDerived = true;
|
|
218
|
+
}
|
|
231
219
|
|
|
232
220
|
if (validatesWhenDerived) {
|
|
233
221
|
context.debug(`...validated the '${judgementString}' derived judgement.`);
|
|
@@ -299,13 +287,3 @@ function assumptionFromJudgementNode(judgementNode, context) {
|
|
|
299
287
|
|
|
300
288
|
return assumption;
|
|
301
289
|
}
|
|
302
|
-
|
|
303
|
-
function assumptionsFromDeclaredJudgements(declaredJudgements, assumptions = []) {
|
|
304
|
-
declaredJudgements.map((declaredJudgement) => {
|
|
305
|
-
const assumption = declaredJudgement.getAssumption();
|
|
306
|
-
|
|
307
|
-
assumptions.push(assumption);
|
|
308
|
-
});
|
|
309
|
-
|
|
310
|
-
return assumptions;
|
|
311
|
-
}
|
package/src/element/label.js
CHANGED
|
@@ -106,10 +106,9 @@ export default define(class Label extends Element {
|
|
|
106
106
|
validateMetavariable(context) {
|
|
107
107
|
let metavariableValidates = false;
|
|
108
108
|
|
|
109
|
-
const labelString = this.getString()
|
|
110
|
-
metavariableString = this.metavariable.getString();
|
|
109
|
+
const labelString = this.getString(); ///
|
|
111
110
|
|
|
112
|
-
context.trace(`Validating the '${labelString}' label's
|
|
111
|
+
context.trace(`Validating the '${labelString}' label's metavariable...`);
|
|
113
112
|
|
|
114
113
|
const metavariable = this.metavariable.validate(context);
|
|
115
114
|
|
|
@@ -120,7 +119,7 @@ export default define(class Label extends Element {
|
|
|
120
119
|
}
|
|
121
120
|
|
|
122
121
|
if (metavariableValidates) {
|
|
123
|
-
context.debug(`...validated the '${labelString}' label's
|
|
122
|
+
context.debug(`...validated the '${labelString}' label's metavariable.'`);
|
|
124
123
|
}
|
|
125
124
|
|
|
126
125
|
return metavariableValidates;
|