occam-verify-cli 1.0.635 → 1.0.641
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 +1 -1
- package/lib/context/liminal.js +3 -3
- package/lib/context/scoped.js +25 -3
- package/lib/context.js +15 -1
- package/lib/element/assertion/contained.js +34 -23
- package/lib/element/assertion/defined.js +30 -21
- package/lib/element/assertion/property.js +24 -21
- package/lib/element/assertion/satisfies.js +19 -14
- package/lib/element/assertion/subproof.js +18 -13
- package/lib/element/assertion/type.js +23 -20
- package/lib/element/assertion.js +5 -5
- package/lib/element/assumption.js +30 -24
- package/lib/element/combinator/bracketed.js +3 -3
- package/lib/element/combinator.js +6 -6
- package/lib/element/conclusion.js +6 -2
- package/lib/element/constructor/bracketed.js +5 -3
- package/lib/element/declaration/combinator.js +15 -2
- package/lib/element/declaration/constructor.js +129 -60
- package/lib/element/deduction.js +6 -2
- package/lib/element/derivation.js +4 -5
- package/lib/element/equality.js +37 -31
- package/lib/element/frame.js +26 -21
- package/lib/element/hypothesis.js +8 -10
- package/lib/element/judgement.js +53 -21
- package/lib/element/metavariable.js +18 -10
- package/lib/element/proofAssertion/premise.js +8 -8
- package/lib/element/proofAssertion/step.js +16 -11
- package/lib/element/proofAssertion/supposition.js +7 -7
- package/lib/element/proofAssertion.js +7 -5
- package/lib/element/propertyRelation.js +7 -3
- package/lib/element/reference.js +28 -21
- package/lib/element/rule.js +4 -11
- package/lib/element/signature.js +10 -4
- package/lib/element/statement.js +16 -16
- package/lib/element/subDerivation.js +4 -11
- package/lib/element/subproof.js +37 -29
- package/lib/element/substitution/frame.js +18 -10
- package/lib/element/substitution/reference.js +17 -9
- package/lib/element/substitution/statement.js +16 -10
- package/lib/element/substitution/term.js +19 -9
- package/lib/element/substitution.js +5 -5
- package/lib/element/term.js +18 -15
- package/lib/element/topLevelAssertion.js +4 -11
- package/lib/element/topLevelMetaAssertion.js +4 -11
- package/lib/element/variable.js +6 -3
- package/lib/process/assign.js +1 -9
- package/lib/process/unify.js +8 -8
- package/lib/process/validate.js +14 -7
- package/lib/process/verify.js +14 -7
- package/lib/utilities/element.js +124 -46
- package/lib/utilities/unification.js +6 -6
- package/lib/utilities/validation.js +68 -55
- package/package.json +7 -7
- package/src/context/file/nominal.js +2 -2
- package/src/context/liminal.js +2 -2
- package/src/context/scoped.js +20 -2
- package/src/context.js +13 -0
- package/src/element/assertion/contained.js +40 -24
- package/src/element/assertion/defined.js +38 -24
- package/src/element/assertion/property.js +28 -22
- package/src/element/assertion/satisfies.js +21 -13
- package/src/element/assertion/subproof.js +21 -13
- package/src/element/assertion/type.js +28 -22
- package/src/element/assertion.js +4 -4
- package/src/element/assumption.js +32 -24
- package/src/element/combinator/bracketed.js +2 -2
- package/src/element/combinator.js +5 -6
- package/src/element/conclusion.js +7 -2
- package/src/element/constructor/bracketed.js +4 -2
- package/src/element/declaration/combinator.js +19 -1
- package/src/element/declaration/constructor.js +123 -60
- package/src/element/deduction.js +7 -2
- package/src/element/derivation.js +2 -3
- package/src/element/equality.js +45 -36
- package/src/element/frame.js +30 -21
- package/src/element/hypothesis.js +9 -6
- package/src/element/judgement.js +65 -21
- package/src/element/metavariable.js +31 -16
- package/src/element/proofAssertion/premise.js +7 -7
- package/src/element/proofAssertion/step.js +16 -10
- package/src/element/proofAssertion/supposition.js +6 -6
- package/src/element/proofAssertion.js +7 -4
- package/src/element/propertyRelation.js +8 -2
- package/src/element/reference.js +31 -21
- package/src/element/rule.js +3 -6
- package/src/element/signature.js +21 -10
- package/src/element/statement.js +15 -15
- package/src/element/subDerivation.js +2 -5
- package/src/element/subproof.js +9 -3
- package/src/element/substitution/frame.js +21 -9
- package/src/element/substitution/reference.js +20 -8
- package/src/element/substitution/statement.js +17 -9
- package/src/element/substitution/term.js +24 -8
- package/src/element/substitution.js +4 -4
- package/src/element/term.js +18 -14
- package/src/element/topLevelAssertion.js +3 -6
- package/src/element/topLevelMetaAssertion.js +3 -6
- package/src/element/variable.js +8 -4
- package/src/process/assign.js +0 -6
- package/src/process/unify.js +7 -7
- package/src/process/validate.js +23 -14
- package/src/process/verify.js +26 -17
- package/src/utilities/element.js +187 -76
- package/src/utilities/unification.js +4 -5
- package/src/utilities/validation.js +83 -75
|
@@ -39,11 +39,10 @@ export default define(class Derivation extends Element {
|
|
|
39
39
|
let verifies;
|
|
40
40
|
|
|
41
41
|
verifies = await asyncEvery(this.subproofOrProofAssertions, async (subproofOrProofAssertion) => { ///
|
|
42
|
-
const
|
|
43
|
-
subproofOrProofAssertionVerifies = await subproofOrProofAssertion.verify(assignments, context);
|
|
42
|
+
const subproofOrProofAssertionVerifies = await subproofOrProofAssertion.verify(context);
|
|
44
43
|
|
|
45
44
|
if (subproofOrProofAssertionVerifies) {
|
|
46
|
-
assignAssignments(
|
|
45
|
+
context.assignAssignments();
|
|
47
46
|
|
|
48
47
|
context.addSubproofOrProofAssertion(subproofOrProofAssertion);
|
|
49
48
|
|
package/src/element/equality.js
CHANGED
|
@@ -111,28 +111,30 @@ export default define(class Equality extends Element {
|
|
|
111
111
|
return equal;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
|
|
114
|
+
findValidEquality(context) {
|
|
115
115
|
const equalityNode = this.getEqualityNode(),
|
|
116
|
-
|
|
117
|
-
|
|
116
|
+
equality = context.findEqualityByEqualityNode(equalityNode),
|
|
117
|
+
validEquality = equality; ///
|
|
118
118
|
|
|
119
|
-
return
|
|
119
|
+
return validEquality;
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
validate(
|
|
123
|
-
let
|
|
122
|
+
validate(stated, context) {
|
|
123
|
+
let equality = null;
|
|
124
124
|
|
|
125
125
|
const equalityString = this.getString(); ///
|
|
126
126
|
|
|
127
127
|
context.trace(`Validating the '${equalityString}' equality...`);
|
|
128
128
|
|
|
129
|
-
const
|
|
129
|
+
const validEquality = this.findValidEquality(context);
|
|
130
130
|
|
|
131
|
-
if (
|
|
132
|
-
|
|
131
|
+
if (validEquality !== null) {
|
|
132
|
+
equality = validEquality; ///
|
|
133
133
|
|
|
134
134
|
context.debug(`...the '${equalityString}' equality is already valid.`);
|
|
135
135
|
} else {
|
|
136
|
+
let validates = false;
|
|
137
|
+
|
|
136
138
|
const termsValidate = this.validateTerms(context);
|
|
137
139
|
|
|
138
140
|
if (termsValidate) {
|
|
@@ -140,7 +142,7 @@ export default define(class Equality extends Element {
|
|
|
140
142
|
validatesWhenDerived = false;
|
|
141
143
|
|
|
142
144
|
if (stated) {
|
|
143
|
-
validatesWhenStated = this.validateWhenStated(
|
|
145
|
+
validatesWhenStated = this.validateWhenStated(context);
|
|
144
146
|
} else {
|
|
145
147
|
validatesWhenDerived = this.validateWhenDerived(context);
|
|
146
148
|
}
|
|
@@ -151,47 +153,58 @@ export default define(class Equality extends Element {
|
|
|
151
153
|
}
|
|
152
154
|
|
|
153
155
|
if (validates) {
|
|
154
|
-
|
|
156
|
+
equality = this; ///
|
|
155
157
|
|
|
156
|
-
|
|
158
|
+
this.assign(stated, context);
|
|
157
159
|
|
|
158
|
-
|
|
160
|
+
context.addEquality(equality);
|
|
159
161
|
|
|
160
162
|
context.debug(`...validated the '${equalityString}' equality.`);
|
|
161
163
|
}
|
|
162
164
|
}
|
|
163
165
|
|
|
164
|
-
return
|
|
166
|
+
return equality;
|
|
165
167
|
}
|
|
166
168
|
|
|
167
169
|
validateTerms(context) {
|
|
168
|
-
let termsValidate;
|
|
170
|
+
let termsValidate = false;
|
|
169
171
|
|
|
170
172
|
const equalityString = this.getString(); ///
|
|
171
173
|
|
|
172
174
|
context.trace(`Validating the '${equalityString}' equality's terms...`);
|
|
173
175
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
+
let leftTerm,
|
|
177
|
+
rightTerm;
|
|
176
178
|
|
|
177
|
-
|
|
178
|
-
let validatesForwards;
|
|
179
|
+
leftTerm = this.leftTerm.validate(context, () => {
|
|
180
|
+
let validatesForwards = false;
|
|
179
181
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
leftTermTypeComparableToRightTermType = leftTermType.isComparableTo(rightTermType);
|
|
182
|
+
rightTerm = this.rightTerm.validate(context, () => {
|
|
183
|
+
const validatesForwards = true;
|
|
183
184
|
|
|
184
|
-
|
|
185
|
+
return validatesForwards;
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
if (rightTerm !== null) {
|
|
189
|
+
validatesForwards = true;
|
|
190
|
+
}
|
|
185
191
|
|
|
186
192
|
return validatesForwards;
|
|
187
193
|
});
|
|
188
194
|
|
|
189
|
-
|
|
195
|
+
if (leftTerm !== null) {
|
|
196
|
+
const leftTermType = leftTerm.getType(),
|
|
197
|
+
rightTermType = rightTerm.getType(),
|
|
198
|
+
leftTermTypeComparableToRightTermType = leftTermType.isComparableTo(rightTermType);
|
|
190
199
|
|
|
191
|
-
|
|
192
|
-
|
|
200
|
+
if (leftTermTypeComparableToRightTermType) {
|
|
201
|
+
this.leftTerm = leftTerm;
|
|
193
202
|
|
|
194
|
-
|
|
203
|
+
this.rightTerm = rightTerm;
|
|
204
|
+
|
|
205
|
+
termsValidate = true;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
195
208
|
|
|
196
209
|
if (termsValidate) {
|
|
197
210
|
context.debug(`...validated the '${equalityString}' equality's terms.`);
|
|
@@ -200,7 +213,7 @@ export default define(class Equality extends Element {
|
|
|
200
213
|
return termsValidate;
|
|
201
214
|
}
|
|
202
215
|
|
|
203
|
-
validateWhenStated(
|
|
216
|
+
validateWhenStated(context) {
|
|
204
217
|
let validatesWhenStated;
|
|
205
218
|
|
|
206
219
|
const equalityString = this.getString(); ///
|
|
@@ -232,11 +245,7 @@ export default define(class Equality extends Element {
|
|
|
232
245
|
return validatesWhenDerived;
|
|
233
246
|
}
|
|
234
247
|
|
|
235
|
-
assign(
|
|
236
|
-
if (assignments === null) {
|
|
237
|
-
return;
|
|
238
|
-
}
|
|
239
|
-
|
|
248
|
+
assign(stated, context) {
|
|
240
249
|
const equality = this, ///
|
|
241
250
|
equalityAssignment = equalityAssignmentFromEquality(equality, context),
|
|
242
251
|
leftVariableAssignment = leftVariableAssignmentFromEquality(equality, context),
|
|
@@ -246,18 +255,18 @@ export default define(class Equality extends Element {
|
|
|
246
255
|
|
|
247
256
|
assignment = equalityAssignment; ///
|
|
248
257
|
|
|
249
|
-
|
|
258
|
+
context.addAssignment(assignment);
|
|
250
259
|
|
|
251
260
|
if (leftVariableAssignment !== null) {
|
|
252
261
|
assignment = leftVariableAssignment; ///
|
|
253
262
|
|
|
254
|
-
|
|
263
|
+
context.addAssignment(assignment);
|
|
255
264
|
}
|
|
256
265
|
|
|
257
266
|
if (rightVariableAssignment !== null) {
|
|
258
267
|
assignment = rightVariableAssignment; ///
|
|
259
268
|
|
|
260
|
-
|
|
269
|
+
context.addAssignment(assignment);
|
|
261
270
|
}
|
|
262
271
|
}
|
|
263
272
|
|
package/src/element/frame.js
CHANGED
|
@@ -56,12 +56,12 @@ export default define(class Frame extends Element {
|
|
|
56
56
|
return frameNodeMatches;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
findValidFrame(context) {
|
|
60
60
|
const frameNode = this.getFrameNode(),
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
frame = context.findFrameByFrameNode(frameNode),
|
|
62
|
+
validFrame = frame; ///
|
|
63
63
|
|
|
64
|
-
return
|
|
64
|
+
return validFrame;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
isEqualTo(frame) {
|
|
@@ -165,29 +165,32 @@ export default define(class Frame extends Element {
|
|
|
165
165
|
return comparesToMetavariableName;
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
-
validate(
|
|
169
|
-
let
|
|
168
|
+
validate(stated, context) {
|
|
169
|
+
let frame = null;
|
|
170
170
|
|
|
171
171
|
const frameString = this.getString(); ///
|
|
172
172
|
|
|
173
173
|
context.trace(`Validating the '${frameString}' frame...`);
|
|
174
174
|
|
|
175
|
-
const
|
|
175
|
+
const validFrame = this.findValidFrame(context),
|
|
176
|
+
valid = (validFrame !== null);
|
|
176
177
|
|
|
177
178
|
if (valid) {
|
|
178
|
-
|
|
179
|
+
frame = validFrame; ///
|
|
179
180
|
|
|
180
181
|
context.debug(`...the '${frameString}' frame is already valid.`);
|
|
181
182
|
} else {
|
|
182
|
-
|
|
183
|
-
|
|
183
|
+
let validates = false;
|
|
184
|
+
|
|
185
|
+
const assumptionsValidate = this.validateAssumptions(stated, context),
|
|
186
|
+
metavariablevalidates = this.validateMetavariable(stated, context);
|
|
184
187
|
|
|
185
188
|
if (assumptionsValidate && metavariablevalidates) {
|
|
186
189
|
let validatesWhenStated = false,
|
|
187
190
|
validatesWhenDerived = false;
|
|
188
191
|
|
|
189
192
|
if (stated) {
|
|
190
|
-
validatesWhenStated = this.validateWhenStated(
|
|
193
|
+
validatesWhenStated = this.validateWhenStated(context);
|
|
191
194
|
} else {
|
|
192
195
|
validatesWhenDerived = this.validateWhenDerived(context);
|
|
193
196
|
}
|
|
@@ -198,7 +201,7 @@ export default define(class Frame extends Element {
|
|
|
198
201
|
}
|
|
199
202
|
|
|
200
203
|
if (validates) {
|
|
201
|
-
|
|
204
|
+
frame = this; ///
|
|
202
205
|
|
|
203
206
|
context.addFrame(frame);
|
|
204
207
|
|
|
@@ -206,10 +209,10 @@ export default define(class Frame extends Element {
|
|
|
206
209
|
}
|
|
207
210
|
}
|
|
208
211
|
|
|
209
|
-
return
|
|
212
|
+
return frame;
|
|
210
213
|
}
|
|
211
214
|
|
|
212
|
-
validateWhenStated(
|
|
215
|
+
validateWhenStated(context) {
|
|
213
216
|
let validatesWhenStated = false;
|
|
214
217
|
|
|
215
218
|
const frameString = this.getString(); ///
|
|
@@ -247,7 +250,7 @@ export default define(class Frame extends Element {
|
|
|
247
250
|
return validatesWhenDerived;
|
|
248
251
|
}
|
|
249
252
|
|
|
250
|
-
validateAssumptions(
|
|
253
|
+
validateAssumptions(stated, context) {
|
|
251
254
|
let assumptionsValidate;
|
|
252
255
|
|
|
253
256
|
const singular = this.isSingular();
|
|
@@ -260,15 +263,21 @@ export default define(class Frame extends Element {
|
|
|
260
263
|
|
|
261
264
|
stated = true; ///
|
|
262
265
|
|
|
263
|
-
|
|
266
|
+
const assumptions = [];
|
|
264
267
|
|
|
265
268
|
assumptionsValidate = this.assumptions.every((assumption) => {
|
|
266
|
-
const
|
|
269
|
+
const assumptionValidates = assumption.validate(stated, context);
|
|
270
|
+
|
|
271
|
+
if (assumptionValidates) {
|
|
272
|
+
assumptions.push(assumption);
|
|
267
273
|
|
|
268
|
-
|
|
274
|
+
return true;
|
|
275
|
+
}
|
|
269
276
|
});
|
|
270
277
|
|
|
271
278
|
if (assumptionsValidate) {
|
|
279
|
+
this.assumptions = assumptions;
|
|
280
|
+
|
|
272
281
|
context.debug(`...validated the '${assumptionsString}' assumptions of the '${frameString}' frame.`);
|
|
273
282
|
}
|
|
274
283
|
} else {
|
|
@@ -278,7 +287,7 @@ export default define(class Frame extends Element {
|
|
|
278
287
|
return assumptionsValidate;
|
|
279
288
|
}
|
|
280
289
|
|
|
281
|
-
validateMetavariable(
|
|
290
|
+
validateMetavariable(stated, context) {
|
|
282
291
|
let metavariableValidates = false;
|
|
283
292
|
|
|
284
293
|
const singular = this.isSingular();
|
|
@@ -313,7 +322,7 @@ export default define(class Frame extends Element {
|
|
|
313
322
|
return metavariableValidates;
|
|
314
323
|
}
|
|
315
324
|
|
|
316
|
-
validateGivenMetaType(metaType,
|
|
325
|
+
validateGivenMetaType(metaType, stated, context) {
|
|
317
326
|
let validatesGivenMetaType = false;
|
|
318
327
|
|
|
319
328
|
const frameString = this.getString(), ///
|
|
@@ -324,7 +333,7 @@ export default define(class Frame extends Element {
|
|
|
324
333
|
const metaTypeName = metaType.getName();
|
|
325
334
|
|
|
326
335
|
if (metaTypeName === FRAME_META_TYPE_NAME) {
|
|
327
|
-
const validates = this.validate(
|
|
336
|
+
const validates = this.validate(stated, context)
|
|
328
337
|
|
|
329
338
|
validatesGivenMetaType = validates; ///
|
|
330
339
|
}
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import { Element } from "occam-languages";
|
|
4
4
|
|
|
5
|
-
import assignAssignments from "../process/assign";
|
|
6
|
-
|
|
7
5
|
import { define } from "../elements";
|
|
8
6
|
import { statementFromJSON, statementToStatementJSON } from "../utilities/json";
|
|
9
7
|
|
|
@@ -37,15 +35,20 @@ export default define(class Hypothesis extends Element {
|
|
|
37
35
|
if (false) {
|
|
38
36
|
///
|
|
39
37
|
} else if (this.statement !== null) {
|
|
38
|
+
let statementValidates = false;
|
|
39
|
+
|
|
40
40
|
const stated = true,
|
|
41
|
-
|
|
42
|
-
statementValidates = this.statement.validate(assignments, stated, context);
|
|
41
|
+
statement = this.statement.validate(stated, context);
|
|
43
42
|
|
|
44
|
-
if (
|
|
45
|
-
|
|
43
|
+
if (statement !== null) {
|
|
44
|
+
statementValidates = true;
|
|
45
|
+
}
|
|
46
46
|
|
|
47
|
+
if (statementValidates) {
|
|
47
48
|
const subproofOrProofAssertion = this; ///
|
|
48
49
|
|
|
50
|
+
context.assignAssignments();
|
|
51
|
+
|
|
49
52
|
context.addSubproofOrProofAssertion(subproofOrProofAssertion);
|
|
50
53
|
|
|
51
54
|
verifies = true;
|
package/src/element/judgement.js
CHANGED
|
@@ -51,39 +51,41 @@ export default define(class Judgement extends Element {
|
|
|
51
51
|
return judgementNodeMatches;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
findValidJudgement(context) {
|
|
55
55
|
const judgementNode = this.getJudgementNode(),
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
judgement = context.findJudgementByJudgementNode(judgementNode),
|
|
57
|
+
validJudgemenet = judgement; ///
|
|
58
58
|
|
|
59
|
-
return
|
|
59
|
+
return validJudgemenet;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
validate(
|
|
63
|
-
let
|
|
62
|
+
validate(stated, context) {
|
|
63
|
+
let judgement = null;
|
|
64
64
|
|
|
65
65
|
const judgementString = this.getString(); ///
|
|
66
66
|
|
|
67
67
|
context.trace(`Validating the '${judgementString}' judgement...`);
|
|
68
68
|
|
|
69
|
-
const
|
|
69
|
+
const validJudgement = this.findValidJudgement(context);
|
|
70
70
|
|
|
71
|
-
if (
|
|
72
|
-
|
|
71
|
+
if (validJudgement !== null) {
|
|
72
|
+
judgement = validJudgement; ///
|
|
73
73
|
|
|
74
74
|
context.debug(`...the '${judgementString}' judgement is already valid.`);
|
|
75
75
|
} else {
|
|
76
|
-
|
|
76
|
+
let validates = false;
|
|
77
|
+
|
|
78
|
+
const frameValidates = this.validateFrame(stated, context);
|
|
77
79
|
|
|
78
80
|
if (frameValidates) {
|
|
79
|
-
const assumptionValidates = this.
|
|
81
|
+
const assumptionValidates = this.validateAssumption(stated, context);
|
|
80
82
|
|
|
81
83
|
if (assumptionValidates) {
|
|
82
84
|
let validatesWhenStated = false,
|
|
83
85
|
validatesWhenDerived = false;
|
|
84
86
|
|
|
85
87
|
if (stated) {
|
|
86
|
-
validatesWhenStated = this.validateWhenStated(
|
|
88
|
+
validatesWhenStated = this.validateWhenStated(context);
|
|
87
89
|
} else {
|
|
88
90
|
validatesWhenDerived = this.validateWhenDerived(context);
|
|
89
91
|
}
|
|
@@ -95,7 +97,7 @@ export default define(class Judgement extends Element {
|
|
|
95
97
|
}
|
|
96
98
|
|
|
97
99
|
if (validates) {
|
|
98
|
-
|
|
100
|
+
judgement = this; ///
|
|
99
101
|
|
|
100
102
|
context.addJudgement(judgement)
|
|
101
103
|
|
|
@@ -103,10 +105,56 @@ export default define(class Judgement extends Element {
|
|
|
103
105
|
}
|
|
104
106
|
}
|
|
105
107
|
|
|
106
|
-
return
|
|
108
|
+
return judgement;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
validateFrame(stated, context) {
|
|
112
|
+
let frameValidates = false;
|
|
113
|
+
|
|
114
|
+
const frameString = this.frame.getString(),
|
|
115
|
+
judgementString = this.getString(); ///
|
|
116
|
+
|
|
117
|
+
context.trace(`Validating the '${judgementString}' judgement's '${frameString}' frame...`);
|
|
118
|
+
|
|
119
|
+
const frame = this.frame.validate(stated, context);
|
|
120
|
+
|
|
121
|
+
if (frame !== null) {
|
|
122
|
+
this.frame = frame;
|
|
123
|
+
|
|
124
|
+
frameValidates = true;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if (frameValidates) {
|
|
128
|
+
context.trace(`...validated the '${judgementString}' judgement's '${frameString}' frame.`);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return frameValidates;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
validateAssumption(stated, context) {
|
|
135
|
+
let assumptionValidates = false;
|
|
136
|
+
|
|
137
|
+
const assumptionString = this.assumption.getString(),
|
|
138
|
+
judgementString = this.getString(); ///
|
|
139
|
+
|
|
140
|
+
context.trace(`Validating the '${judgementString}' judgement's '${assumptionString}' assumption...`);
|
|
141
|
+
|
|
142
|
+
const assumption = this.assumption.validate(stated, context);
|
|
143
|
+
|
|
144
|
+
if (assumption !== null) {
|
|
145
|
+
this.assumption = assumption;
|
|
146
|
+
|
|
147
|
+
assumptionValidates = true;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (assumptionValidates) {
|
|
151
|
+
context.trace(`...validated the '${judgementString}' judgement's '${assumptionString}' assumption.`);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
return assumptionValidates;
|
|
107
155
|
}
|
|
108
156
|
|
|
109
|
-
validateWhenStated(
|
|
157
|
+
validateWhenStated(context) {
|
|
110
158
|
let validatesWhenStated;
|
|
111
159
|
|
|
112
160
|
const judgementString = this.getString(); ///
|
|
@@ -146,11 +194,7 @@ export default define(class Judgement extends Element {
|
|
|
146
194
|
return validatesWhenDerived;
|
|
147
195
|
}
|
|
148
196
|
|
|
149
|
-
assign(
|
|
150
|
-
if (assignments === null) {
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
|
|
197
|
+
assign(stated, context) {
|
|
154
198
|
if (!stated) {
|
|
155
199
|
return;
|
|
156
200
|
}
|
|
@@ -159,7 +203,7 @@ export default define(class Judgement extends Element {
|
|
|
159
203
|
judgementAssignment = judgementAssignmentFromJudgement(judgement, context),
|
|
160
204
|
assignment = judgementAssignment; ///
|
|
161
205
|
|
|
162
|
-
|
|
206
|
+
context.addAssignment(assignment);
|
|
163
207
|
}
|
|
164
208
|
|
|
165
209
|
static name = "Judgement";
|
|
@@ -156,11 +156,15 @@ export default define(class Metavariable extends Element {
|
|
|
156
156
|
}
|
|
157
157
|
} else {
|
|
158
158
|
const { FrameSubstitution } = elements,
|
|
159
|
-
metavariable = this
|
|
160
|
-
frameSubstitution = FrameSubstitution.fromFrameAndMetavariable(frame, metavariable, context),
|
|
161
|
-
framesubstitutionValidates = frameSubstitution.validate(generalContext, specificContext);
|
|
159
|
+
metavariable = this; ///
|
|
162
160
|
|
|
163
|
-
|
|
161
|
+
let frameSubstitution;
|
|
162
|
+
|
|
163
|
+
frameSubstitution = FrameSubstitution.fromFrameAndMetavariable(frame, metavariable, context);
|
|
164
|
+
|
|
165
|
+
frameSubstitution = frameSubstitution.validate(generalContext, specificContext); ///
|
|
166
|
+
|
|
167
|
+
if (frameSubstitution !== null) {
|
|
164
168
|
frameUnifies = true;
|
|
165
169
|
}
|
|
166
170
|
}
|
|
@@ -194,10 +198,14 @@ export default define(class Metavariable extends Element {
|
|
|
194
198
|
statementUnifies = true;
|
|
195
199
|
} else {
|
|
196
200
|
const metavariableName = metavariable.getName(),
|
|
197
|
-
substitutionPresent =
|
|
201
|
+
substitutionPresent = (substitution !== null) ?
|
|
202
|
+
context.isSubstitutionPresentByMetavariableNameAndSubstitution(metavariableName, substitution) :
|
|
203
|
+
context.findSubstitutionByMetavariableName(metavariableName);
|
|
198
204
|
|
|
199
205
|
if (substitutionPresent) {
|
|
200
|
-
substitution =
|
|
206
|
+
substitution = (substitution !== null) ?
|
|
207
|
+
context.findSubstitutionByMetavariableNameAndSubstitution(metavariableName, substitution) :
|
|
208
|
+
context.findSubstitutionByMetavariableName(metavariableName);
|
|
201
209
|
|
|
202
210
|
const substitutionComparesToStatement = substitution.compareStatement(statement, context);
|
|
203
211
|
|
|
@@ -205,10 +213,13 @@ export default define(class Metavariable extends Element {
|
|
|
205
213
|
statementUnifies = true;
|
|
206
214
|
}
|
|
207
215
|
} else {
|
|
208
|
-
const { StatementSubstitution } = elements
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
216
|
+
const { StatementSubstitution } = elements;
|
|
217
|
+
|
|
218
|
+
let statementSubstitution;
|
|
219
|
+
|
|
220
|
+
statementSubstitution = (substitution !== null) ?
|
|
221
|
+
StatementSubstitution.fromStatementMetavariableAndSubstitution(statement, metavariable, substitution, context) :
|
|
222
|
+
StatementSubstitution.fromStatementAndMetavariable(statement, metavariable, context);
|
|
212
223
|
|
|
213
224
|
if (substitution !== null) {
|
|
214
225
|
const context = generalContext; ///
|
|
@@ -218,9 +229,9 @@ export default define(class Metavariable extends Element {
|
|
|
218
229
|
substitution.setContext(context);
|
|
219
230
|
}
|
|
220
231
|
|
|
221
|
-
|
|
232
|
+
statementSubstitution = statementSubstitution.validate(generalContext, specificContext); ///
|
|
222
233
|
|
|
223
|
-
if (
|
|
234
|
+
if (statementSubstitution !== null) {
|
|
224
235
|
statementUnifies = true;
|
|
225
236
|
}
|
|
226
237
|
}
|
|
@@ -260,11 +271,15 @@ export default define(class Metavariable extends Element {
|
|
|
260
271
|
}
|
|
261
272
|
} else {
|
|
262
273
|
const { ReferenceSubstitution } = elements,
|
|
263
|
-
metavariable = this
|
|
264
|
-
|
|
265
|
-
|
|
274
|
+
metavariable = this; ///
|
|
275
|
+
|
|
276
|
+
let referenceSubstitution;
|
|
277
|
+
|
|
278
|
+
referenceSubstitution = ReferenceSubstitution.fromReferenceAndMetavariable(reference, metavariable, context);
|
|
279
|
+
|
|
280
|
+
referenceSubstitution = referenceSubstitution.validate(generalContext, specificContext); ///
|
|
266
281
|
|
|
267
|
-
if (
|
|
282
|
+
if (referenceSubstitution !== null) {
|
|
268
283
|
referenceUnifies = true;
|
|
269
284
|
|
|
270
285
|
}
|
|
@@ -30,7 +30,7 @@ export default define(class Premise extends ProofAssertion {
|
|
|
30
30
|
return stated;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
validate(
|
|
33
|
+
validate(context) {
|
|
34
34
|
let validates = false;
|
|
35
35
|
|
|
36
36
|
const premiseString = this.getString(); ///
|
|
@@ -43,13 +43,13 @@ export default define(class Premise extends ProofAssertion {
|
|
|
43
43
|
if (false) {
|
|
44
44
|
///
|
|
45
45
|
} else if (statement !== null) {
|
|
46
|
-
const statementValidates = this.validateStatement(
|
|
46
|
+
const statementValidates = this.validateStatement(context);
|
|
47
47
|
|
|
48
48
|
if (statementValidates) {
|
|
49
49
|
validates = true;
|
|
50
50
|
}
|
|
51
51
|
} else if (procedureCall !== null) {
|
|
52
|
-
const procedureCallValidates = this.validateProcedureCall(
|
|
52
|
+
const procedureCallValidates = this.validateProcedureCall(context);
|
|
53
53
|
|
|
54
54
|
if (procedureCallValidates) {
|
|
55
55
|
validates = true;
|
|
@@ -65,7 +65,7 @@ export default define(class Premise extends ProofAssertion {
|
|
|
65
65
|
return validates;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
validateProcedureCall(
|
|
68
|
+
validateProcedureCall(context) {
|
|
69
69
|
let procedureCallValidates = false;
|
|
70
70
|
|
|
71
71
|
const premiseString = this.getString(), ///
|
|
@@ -182,7 +182,7 @@ export default define(class Premise extends ProofAssertion {
|
|
|
182
182
|
if (assertion !== null) {
|
|
183
183
|
const subproofAssertion = assertion; ///
|
|
184
184
|
|
|
185
|
-
subproofUnifies = subproofAssertion.unifySubproof(subproof,
|
|
185
|
+
subproofUnifies = subproofAssertion.unifySubproof(subproof, generalContext, specificContext);
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
188
|
}
|
|
@@ -194,7 +194,7 @@ export default define(class Premise extends ProofAssertion {
|
|
|
194
194
|
return subproofUnifies;
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
-
async verify(
|
|
197
|
+
async verify(context) {
|
|
198
198
|
let verifies = false;
|
|
199
199
|
|
|
200
200
|
await this.break(context);
|
|
@@ -204,7 +204,7 @@ export default define(class Premise extends ProofAssertion {
|
|
|
204
204
|
context.trace(`Verifying the '${premiseString}' premise...`);
|
|
205
205
|
|
|
206
206
|
attempt((context) => {
|
|
207
|
-
const validates = this.validate(
|
|
207
|
+
const validates = this.validate(context);
|
|
208
208
|
|
|
209
209
|
if (validates) {
|
|
210
210
|
this.setContext(context);
|