occam-verify-cli 1.0.768 → 1.0.776
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 +11 -11
- package/lib/context/illative.js +28 -0
- package/lib/context/nested.js +27 -0
- package/lib/context/proof.js +232 -0
- package/lib/context/thetic.js +28 -0
- package/lib/context.js +15 -21
- package/lib/element/assertion/contained.js +24 -22
- package/lib/element/assertion/defined.js +20 -19
- package/lib/element/assertion/property.js +14 -13
- package/lib/element/assertion/satisfies.js +8 -9
- package/lib/element/assertion/subproof.js +23 -26
- package/lib/element/assertion/type.js +9 -11
- package/lib/element/assumption.js +32 -39
- package/lib/element/combinator/bracketed.js +3 -3
- package/lib/element/combinator.js +20 -20
- package/lib/element/conclusion.js +33 -29
- package/lib/element/constructor.js +19 -18
- package/lib/element/deduction.js +33 -29
- package/lib/element/equality.js +13 -15
- package/lib/element/equivalence.js +59 -52
- package/lib/element/frame.js +41 -34
- package/lib/element/hypothesis.js +7 -5
- package/lib/element/judgement.js +32 -73
- package/lib/element/label.js +22 -22
- package/lib/element/metavariable.js +23 -7
- package/lib/element/proofAssertion/premise.js +48 -35
- package/lib/element/proofAssertion/step.js +35 -20
- package/lib/element/proofAssertion/supposition.js +48 -34
- package/lib/element/proofAssertion.js +1 -14
- package/lib/element/reference.js +80 -53
- package/lib/element/signature.js +44 -3
- package/lib/element/statement.js +28 -29
- package/lib/element/subproof.js +2 -2
- package/lib/element/substitution/frame.js +24 -19
- package/lib/element/substitution/metaLevel.js +31 -27
- package/lib/element/substitution/reference.js +11 -10
- package/lib/element/substitution/statement.js +30 -23
- package/lib/element/substitution/term.js +11 -10
- package/lib/element/term.js +24 -20
- package/lib/element/topLevelMetaAssertion.js +2 -2
- package/lib/element/variable.js +6 -2
- package/lib/process/assign.js +10 -4
- package/lib/process/unify.js +8 -8
- package/lib/process/validate.js +10 -8
- package/lib/utilities/context.js +68 -23
- package/lib/utilities/element.js +55 -27
- package/lib/utilities/json.js +8 -8
- package/lib/utilities/statement.js +1 -8
- package/lib/utilities/string.js +12 -1
- package/lib/utilities/unification.js +9 -7
- package/lib/utilities/validation.js +39 -31
- package/package.json +1 -1
- package/src/context/file/nominal.js +14 -16
- package/src/context/illative.js +17 -0
- package/src/context/nested.js +15 -0
- package/src/context/{scoped.js → proof.js} +73 -73
- package/src/context/thetic.js +17 -0
- package/src/context.js +23 -36
- package/src/element/assertion/contained.js +28 -28
- package/src/element/assertion/defined.js +23 -23
- package/src/element/assertion/property.js +15 -14
- package/src/element/assertion/satisfies.js +7 -9
- package/src/element/assertion/subproof.js +26 -31
- package/src/element/assertion/type.js +10 -12
- package/src/element/assumption.js +33 -54
- package/src/element/combinator/bracketed.js +2 -2
- package/src/element/combinator.js +23 -29
- package/src/element/conclusion.js +37 -40
- package/src/element/constructor.js +29 -34
- package/src/element/deduction.js +36 -39
- package/src/element/equality.js +16 -18
- package/src/element/equivalence.js +76 -67
- package/src/element/frame.js +42 -34
- package/src/element/hypothesis.js +7 -6
- package/src/element/judgement.js +34 -44
- package/src/element/label.js +25 -31
- package/src/element/metavariable.js +32 -12
- package/src/element/proofAssertion/premise.js +63 -49
- package/src/element/proofAssertion/step.js +43 -23
- package/src/element/proofAssertion/supposition.js +64 -50
- package/src/element/proofAssertion.js +0 -22
- package/src/element/reference.js +119 -80
- package/src/element/signature.js +5 -2
- package/src/element/statement.js +30 -35
- package/src/element/subproof.js +1 -1
- package/src/element/substitution/frame.js +27 -26
- package/src/element/substitution/metaLevel.js +38 -42
- package/src/element/substitution/reference.js +13 -14
- package/src/element/substitution/statement.js +35 -33
- package/src/element/substitution/term.js +13 -14
- package/src/element/term.js +42 -34
- package/src/element/topLevelMetaAssertion.js +1 -1
- package/src/element/variable.js +8 -1
- package/src/process/assign.js +9 -3
- package/src/process/unify.js +7 -7
- package/src/process/validate.js +9 -8
- package/src/utilities/context.js +82 -31
- package/src/utilities/element.js +68 -31
- package/src/utilities/json.js +13 -13
- package/src/utilities/statement.js +1 -9
- package/src/utilities/string.js +16 -2
- package/src/utilities/unification.js +10 -9
- package/src/utilities/validation.js +50 -38
- package/lib/context/scoped.js +0 -232
- package/lib/utilities/term.js +0 -17
- package/src/utilities/term.js +0 -10
package/src/element/reference.js
CHANGED
|
@@ -3,23 +3,27 @@
|
|
|
3
3
|
import { Element } from "occam-languages";
|
|
4
4
|
|
|
5
5
|
import { define } from "../elements";
|
|
6
|
-
import { instantiate } from "../utilities/context";
|
|
7
6
|
import { instantiateReference } from "../process/instantiate";
|
|
8
7
|
import { REFERENCE_META_TYPE_NAME } from "../metaTypeNames";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
8
|
+
import { serialise, reconcile, unserialise, instantiate } from "../utilities/context";
|
|
9
|
+
import { metavariableFromReferenceNode, topLevelMetaAssertionFromReferenceNode } from "../utilities/element";
|
|
11
10
|
|
|
12
11
|
export default define(class Reference extends Element {
|
|
13
|
-
constructor(context, string, node, metavariable) {
|
|
12
|
+
constructor(context, string, node, metavariable, topLevelMetaAssertion) {
|
|
14
13
|
super(context, string, node);
|
|
15
14
|
|
|
16
15
|
this.metavariable = metavariable;
|
|
16
|
+
this.topLevelMetaAssertion = topLevelMetaAssertion;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
getMetavariable() {
|
|
20
20
|
return this.metavariable;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
getTopLevelMetaAssertion() {
|
|
24
|
+
return this.topLevelMetaAssertion;
|
|
25
|
+
}
|
|
26
|
+
|
|
23
27
|
getReferenceNode() {
|
|
24
28
|
const node = this.getNode(),
|
|
25
29
|
referenceNode = node; ///
|
|
@@ -27,8 +31,6 @@ export default define(class Reference extends Element {
|
|
|
27
31
|
return referenceNode;
|
|
28
32
|
}
|
|
29
33
|
|
|
30
|
-
getName() { return this.metavariable.getName(); }
|
|
31
|
-
|
|
32
34
|
getMetavariableName() {
|
|
33
35
|
const metavariableName = this.metavariable.getName();
|
|
34
36
|
|
|
@@ -41,6 +43,14 @@ export default define(class Reference extends Element {
|
|
|
41
43
|
return metavariableNode;
|
|
42
44
|
}
|
|
43
45
|
|
|
46
|
+
isEqualTo(reference) {
|
|
47
|
+
const referenceNode = reference.getNode(),
|
|
48
|
+
referenceNodeMatches = this.matchReferenceNode(referenceNode),
|
|
49
|
+
equalTo = referenceNodeMatches; ///
|
|
50
|
+
|
|
51
|
+
return equalTo;
|
|
52
|
+
}
|
|
53
|
+
|
|
44
54
|
matchReferenceNode(referenceNode) {
|
|
45
55
|
const node = referenceNode, ///
|
|
46
56
|
nodeMatches = this.matchNode(node),
|
|
@@ -49,21 +59,7 @@ export default define(class Reference extends Element {
|
|
|
49
59
|
return referenceNodeMatches;
|
|
50
60
|
}
|
|
51
61
|
|
|
52
|
-
|
|
53
|
-
const metavariableNode = this.getMetavariableNode(),
|
|
54
|
-
reference = context.findReferenceByMetavariableNode(metavariableNode),
|
|
55
|
-
validReference = reference; ///
|
|
56
|
-
|
|
57
|
-
return validReference;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
isEqualTo(reference) {
|
|
61
|
-
const referenceNode = reference.getNode(),
|
|
62
|
-
referenceNodeMatches = this.matchReferenceNode(referenceNode),
|
|
63
|
-
equalTo = referenceNodeMatches; ///
|
|
64
|
-
|
|
65
|
-
return equalTo;
|
|
66
|
-
}
|
|
62
|
+
matchMetavariableNode(metavariableNode) { return this.metavariable.matchMetavariableNode(metavariableNode); }
|
|
67
63
|
|
|
68
64
|
compareParameter(parameter) {
|
|
69
65
|
let comparesToParamter = false;
|
|
@@ -103,7 +99,36 @@ export default define(class Reference extends Element {
|
|
|
103
99
|
|
|
104
100
|
compareMetavariableName(metavariableName) { return this.metavariable.compareMetavariableName(metavariableName); }
|
|
105
101
|
|
|
106
|
-
|
|
102
|
+
compareTopLevelMetaAssertion(topLevelMetaAssertion) {
|
|
103
|
+
let topLevelMetaAssertionCompares = false;
|
|
104
|
+
|
|
105
|
+
const context = this.getContext(),
|
|
106
|
+
referenceString = this.getString(), ///
|
|
107
|
+
topLevelMetaAssertionString = topLevelMetaAssertion.getString();
|
|
108
|
+
|
|
109
|
+
context.trace(`Comparing the '${topLevelMetaAssertionString}' top level meta-assertion to the '${referenceString}' reference...`);
|
|
110
|
+
|
|
111
|
+
const label = topLevelMetaAssertion.getLabel(),
|
|
112
|
+
labelUnifies = this.unifyLabel(label);
|
|
113
|
+
|
|
114
|
+
if (labelUnifies) {
|
|
115
|
+
topLevelMetaAssertionCompares = true;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (topLevelMetaAssertionCompares) {
|
|
119
|
+
context.trace(`...compared the '${topLevelMetaAssertionString}' top level meta-assertion to the '${referenceString}' reference.`);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return topLevelMetaAssertionCompares;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
findValidRefernece(context) {
|
|
126
|
+
const metavariableNode = this.getMetavariableNode(),
|
|
127
|
+
reference = context.findReferenceByMetavariableNode(metavariableNode),
|
|
128
|
+
validReference = reference; ///
|
|
129
|
+
|
|
130
|
+
return validReference;
|
|
131
|
+
}
|
|
107
132
|
|
|
108
133
|
validate(context) {
|
|
109
134
|
let reference = null;
|
|
@@ -112,10 +137,10 @@ export default define(class Reference extends Element {
|
|
|
112
137
|
|
|
113
138
|
context.trace(`Validating the '${referenceString}' reference...`);
|
|
114
139
|
|
|
115
|
-
const
|
|
140
|
+
const validReference = this.findValidRefernece(context);
|
|
116
141
|
|
|
117
|
-
if (
|
|
118
|
-
reference =
|
|
142
|
+
if (validReference !== null) {
|
|
143
|
+
reference = validReference; ///
|
|
119
144
|
|
|
120
145
|
context.debug(`...the '${referenceString}' reference is already valid.`);
|
|
121
146
|
} else {
|
|
@@ -130,7 +155,7 @@ export default define(class Reference extends Element {
|
|
|
130
155
|
|
|
131
156
|
if (metaType === null) {
|
|
132
157
|
const reference = this, ///
|
|
133
|
-
labelPresent = context.isLabelPresentByReference(reference
|
|
158
|
+
labelPresent = context.isLabelPresentByReference(reference);
|
|
134
159
|
|
|
135
160
|
if (labelPresent) {
|
|
136
161
|
validates = true;
|
|
@@ -170,6 +195,8 @@ export default define(class Reference extends Element {
|
|
|
170
195
|
const referenceString = this.getString(), ///
|
|
171
196
|
metavariableString = this.metavariable.getString();
|
|
172
197
|
|
|
198
|
+
context = this.getContext();
|
|
199
|
+
|
|
173
200
|
context.trace(`Validating the '${referenceString}' reference's '${metavariableString}' metavariable...'`);
|
|
174
201
|
|
|
175
202
|
const metavariable = this.metavariable.validate(context);
|
|
@@ -187,29 +214,23 @@ export default define(class Reference extends Element {
|
|
|
187
214
|
return metavariableValidates;
|
|
188
215
|
}
|
|
189
216
|
|
|
190
|
-
unifyLabel(label
|
|
191
|
-
let labelUnifies;
|
|
192
|
-
|
|
193
|
-
const specificContext = context; ///
|
|
194
|
-
|
|
195
|
-
context = this.getContext();
|
|
196
|
-
|
|
197
|
-
const generalContext = context; ///
|
|
217
|
+
unifyLabel(label) {
|
|
218
|
+
let labelUnifies = false;
|
|
198
219
|
|
|
199
|
-
context =
|
|
200
|
-
|
|
201
|
-
const reference = this, ///
|
|
220
|
+
const context = label.getContext(),
|
|
202
221
|
labelString = label.getString(),
|
|
203
|
-
referenceString =
|
|
222
|
+
referenceString = this.getString(); ///
|
|
204
223
|
|
|
205
224
|
context.trace(`Unifying the '${labelString}' label with the '${referenceString}' reference...`);
|
|
206
225
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
metavariableUnifiesIntrinsically = unifyMetavariableIntrinsically(generalMetavariable, specificMetavariable, generalContext, specificContext);
|
|
226
|
+
reconcile((context) => {
|
|
227
|
+
const metavariable = label.getMetavariable(),
|
|
228
|
+
metavariableUnifies = this.unifyMetavariable(metavariable, context);
|
|
211
229
|
|
|
212
|
-
|
|
230
|
+
if (metavariableUnifies) {
|
|
231
|
+
labelUnifies = true;
|
|
232
|
+
}
|
|
233
|
+
}, context);
|
|
213
234
|
|
|
214
235
|
if (labelUnifies) {
|
|
215
236
|
context.debug(`...unified the '${labelString}' label with the '${referenceString}' reference.`);
|
|
@@ -221,22 +242,20 @@ export default define(class Reference extends Element {
|
|
|
221
242
|
unifyMetavariable(metavariable, context) {
|
|
222
243
|
let metavariableUnifies = false;
|
|
223
244
|
|
|
224
|
-
const
|
|
245
|
+
const referenceString = this.getString(), ///
|
|
246
|
+
metavariableString = metavariable.getString();
|
|
225
247
|
|
|
226
|
-
context
|
|
248
|
+
context.trace(`Unifying the '${metavariableString}' metavariable with the '${referenceString}' reference...`);
|
|
227
249
|
|
|
228
|
-
const
|
|
250
|
+
const specificContext = context; ///
|
|
229
251
|
|
|
230
|
-
context =
|
|
252
|
+
context = this.getContext();
|
|
231
253
|
|
|
232
|
-
const
|
|
233
|
-
metavariableString = metavariable.getString();
|
|
254
|
+
const generalContext = context; ///
|
|
234
255
|
|
|
235
|
-
context
|
|
256
|
+
context = specificContext; ///
|
|
236
257
|
|
|
237
|
-
const
|
|
238
|
-
specificMetavariable = metavariable, ///
|
|
239
|
-
metavariableUnifiesIntrinsically = unifyMetavariableIntrinsically(generalMetavariable, specificMetavariable, generalContext, specificContext);
|
|
258
|
+
const metavariableUnifiesIntrinsically = this.metavariable.unifyMetavariableIntrinsically(metavariable, generalContext, specificContext);
|
|
240
259
|
|
|
241
260
|
if (metavariableUnifiesIntrinsically) {
|
|
242
261
|
metavariableUnifies = true;
|
|
@@ -249,52 +268,72 @@ export default define(class Reference extends Element {
|
|
|
249
268
|
return metavariableUnifies;
|
|
250
269
|
}
|
|
251
270
|
|
|
252
|
-
|
|
253
|
-
let
|
|
271
|
+
unifyTopLevelMetaAssertion(topLevelMetaAssertion, context) {
|
|
272
|
+
let topLevelMetaAssertionUUnifies = false;
|
|
254
273
|
|
|
255
|
-
const
|
|
256
|
-
referenceString =
|
|
274
|
+
const label = topLevelMetaAssertion.getLabel(),
|
|
275
|
+
referenceString = this.getString(), ///
|
|
257
276
|
topLevelMetaAssertionString = topLevelMetaAssertion.getString();
|
|
258
277
|
|
|
259
|
-
context.trace(`
|
|
278
|
+
context.trace(`Unifying the '${topLevelMetaAssertionString}' top level meta-assertion with the '${referenceString}' reference...`);
|
|
260
279
|
|
|
261
|
-
const
|
|
262
|
-
labelUnifies = this.unifyLabel(label, context);
|
|
280
|
+
const specificContext = context; ///
|
|
263
281
|
|
|
264
|
-
|
|
265
|
-
topLevelMetaAssertionCompares = true;
|
|
266
|
-
}
|
|
282
|
+
context = label.getContext();
|
|
267
283
|
|
|
268
|
-
|
|
269
|
-
|
|
284
|
+
reconcile((context) => {
|
|
285
|
+
const metavariable = label.getMetavariable(),
|
|
286
|
+
metavariableUnifies = this.unifyMetavariable(metavariable, context);
|
|
287
|
+
|
|
288
|
+
if (metavariableUnifies) {
|
|
289
|
+
this.topLevelMetaAssertion = topLevelMetaAssertion;
|
|
290
|
+
|
|
291
|
+
context.commit(specificContext);
|
|
292
|
+
|
|
293
|
+
topLevelMetaAssertionUUnifies = true;
|
|
294
|
+
}
|
|
295
|
+
}, context);
|
|
296
|
+
|
|
297
|
+
context = specificContext; ///
|
|
298
|
+
|
|
299
|
+
if (topLevelMetaAssertionUUnifies) {
|
|
300
|
+
context.debug(`...unified the '${topLevelMetaAssertionString}' top level meta-assertion with the '${referenceString}' reference.`);
|
|
270
301
|
}
|
|
271
302
|
|
|
272
|
-
return
|
|
303
|
+
return topLevelMetaAssertionUUnifies;
|
|
273
304
|
}
|
|
274
305
|
|
|
275
306
|
toJSON() {
|
|
276
|
-
const
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
307
|
+
const context = this.getContext();
|
|
308
|
+
|
|
309
|
+
return serialise((context) => {
|
|
310
|
+
const string = this.getString(),
|
|
311
|
+
json = {
|
|
312
|
+
context,
|
|
313
|
+
string
|
|
314
|
+
};
|
|
280
315
|
|
|
281
|
-
|
|
316
|
+
return json;
|
|
317
|
+
}, context);
|
|
282
318
|
}
|
|
283
319
|
|
|
284
320
|
static name = "Reference";
|
|
285
321
|
|
|
286
322
|
static fromJSON(json, context) {
|
|
287
|
-
|
|
288
|
-
const { string } = json,
|
|
289
|
-
referenceNode = instantiateReference(string, context),
|
|
290
|
-
node = referenceNode, ///
|
|
291
|
-
metavariable = metavariableFromReferenceNode(referenceNode, context);
|
|
323
|
+
let reference;
|
|
292
324
|
|
|
293
|
-
|
|
325
|
+
unserialise((json, context) => {
|
|
326
|
+
instantiate((context) => {
|
|
327
|
+
const { string } = json,
|
|
328
|
+
referenceNode = instantiateReference(string, context),
|
|
329
|
+
node = referenceNode, ///
|
|
330
|
+
metavariable = metavariableFromReferenceNode(referenceNode, context),
|
|
331
|
+
topLevelMetaAssertion = topLevelMetaAssertionFromReferenceNode(referenceNode, context);
|
|
294
332
|
|
|
295
|
-
|
|
333
|
+
reference = new Reference(context, string, node, metavariable, topLevelMetaAssertion);
|
|
334
|
+
}, context);
|
|
335
|
+
}, json, context);
|
|
296
336
|
|
|
297
|
-
|
|
298
|
-
}, context);
|
|
337
|
+
return reference;
|
|
299
338
|
}
|
|
300
339
|
});
|
package/src/element/signature.js
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
import { Element } from "occam-languages";
|
|
4
4
|
import { arrayUtilities } from "necessary";
|
|
5
5
|
|
|
6
|
+
import elements from "../elements";
|
|
7
|
+
|
|
6
8
|
import { define } from "../elements";
|
|
7
9
|
import { instantiate } from "../utilities/context";
|
|
8
10
|
import { instantiateSignature } from "../process/instantiate";
|
|
@@ -125,9 +127,10 @@ export default define(class Signature extends Element {
|
|
|
125
127
|
termsA = this.terms, ///
|
|
126
128
|
termsB = terms, ///
|
|
127
129
|
matches = match(termsA, termsB, (termA, termB) => {
|
|
128
|
-
const
|
|
130
|
+
const { Variable } = elements,
|
|
131
|
+
term = termB, ///
|
|
129
132
|
context = generalContext, ///
|
|
130
|
-
variable =
|
|
133
|
+
variable = Variable.fromTerm(term, context);
|
|
131
134
|
|
|
132
135
|
if (variable !== null) {
|
|
133
136
|
const term = termA, ///
|
package/src/element/statement.js
CHANGED
|
@@ -7,7 +7,7 @@ import { define } from "../elements";
|
|
|
7
7
|
import { unifyStatement } from "../process/unify";
|
|
8
8
|
import { validateStatements } from "../utilities/validation";
|
|
9
9
|
import { instantiateStatement } from "../process/instantiate";
|
|
10
|
-
import { reconcile, instantiate } from "../utilities/context";
|
|
10
|
+
import { join, reconcile, instantiate } from "../utilities/context";
|
|
11
11
|
|
|
12
12
|
const { backwardsSome } = arrayUtilities;
|
|
13
13
|
|
|
@@ -184,7 +184,7 @@ export default define(class Statement extends Element {
|
|
|
184
184
|
return frameContained;
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
-
validate(
|
|
187
|
+
validate(context) {
|
|
188
188
|
let statement = null;
|
|
189
189
|
|
|
190
190
|
const statementString = this.getString(); ///
|
|
@@ -200,7 +200,7 @@ export default define(class Statement extends Element {
|
|
|
200
200
|
} else {
|
|
201
201
|
const validates = validateStatements.some((validateStatement) => {
|
|
202
202
|
const statement = this, ///
|
|
203
|
-
statementValidates = validateStatement(statement,
|
|
203
|
+
statementValidates = validateStatement(statement, context);
|
|
204
204
|
|
|
205
205
|
if (statementValidates) {
|
|
206
206
|
return true;
|
|
@@ -244,36 +244,33 @@ export default define(class Statement extends Element {
|
|
|
244
244
|
return subproofUnifies;
|
|
245
245
|
}
|
|
246
246
|
|
|
247
|
-
unifyDeduction(deduction,
|
|
247
|
+
unifyDeduction(deduction, context) {
|
|
248
248
|
let deductionUnifies = false;
|
|
249
249
|
|
|
250
250
|
const statementString = this.getString(), ///
|
|
251
251
|
deductionString = deduction.getString(),
|
|
252
|
-
|
|
253
|
-
|
|
252
|
+
deductionContext = deduction.getContext(),
|
|
253
|
+
deductionStatement = deduction.getStatement();
|
|
254
254
|
|
|
255
|
-
|
|
255
|
+
context.trace(`Unifying the '${deductionString}' deduction with the '${statementString}' statement...`);
|
|
256
256
|
|
|
257
|
-
|
|
257
|
+
const generalContext = context, ///
|
|
258
|
+
specificContext = deductionContext; ///
|
|
258
259
|
|
|
259
|
-
|
|
260
|
+
join((specificContext) => {
|
|
261
|
+
reconcile((specificContext) => {
|
|
262
|
+
const deductionStatementUnifies = this.unifyStatement(deductionStatement, generalContext, specificContext);
|
|
260
263
|
|
|
261
|
-
|
|
264
|
+
if (deductionStatementUnifies) {
|
|
265
|
+
specificContext.commit(context);
|
|
262
266
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
if (deductionStatementUnfies) {
|
|
269
|
-
specificContext.commit();
|
|
270
|
-
|
|
271
|
-
deductionUnifies = true;
|
|
272
|
-
}
|
|
273
|
-
}, specificContext);
|
|
267
|
+
deductionUnifies = true;
|
|
268
|
+
}
|
|
269
|
+
}, specificContext);
|
|
270
|
+
}, specificContext, context);
|
|
274
271
|
|
|
275
272
|
if (deductionUnifies) {
|
|
276
|
-
context.debug(`...unified the '${deductionString}' deduction
|
|
273
|
+
context.debug(`...unified the '${deductionString}' deduction with the '${statementString}' statement.`);
|
|
277
274
|
}
|
|
278
275
|
|
|
279
276
|
return deductionUnifies;
|
|
@@ -338,41 +335,39 @@ export default define(class Statement extends Element {
|
|
|
338
335
|
return unifiesIndependently;
|
|
339
336
|
}
|
|
340
337
|
|
|
341
|
-
unifyTopLevelMetaAssertion(topLevelMetaAssertion,
|
|
342
|
-
let
|
|
338
|
+
unifyTopLevelMetaAssertion(topLevelMetaAssertion, context) {
|
|
339
|
+
let topLevelAssertionUnifies = false;
|
|
343
340
|
|
|
344
|
-
const
|
|
345
|
-
statementString = this.getString(), ///
|
|
341
|
+
const statementString = this.getString(), ///
|
|
346
342
|
topLevelMetaAssertionString = topLevelMetaAssertion.getString();
|
|
347
343
|
|
|
348
344
|
context.trace(`Unifying the '${topLevelMetaAssertionString}' top level meta-assertion with the '${statementString}' statement...`);
|
|
349
345
|
|
|
350
|
-
const
|
|
346
|
+
const unconditional = topLevelMetaAssertion.isUnconditional();
|
|
351
347
|
|
|
352
|
-
if (
|
|
348
|
+
if (unconditional) {
|
|
353
349
|
const deduction = topLevelMetaAssertion.getDeduction(),
|
|
354
|
-
deductionUnifies = this.unifyDeduction(deduction,
|
|
350
|
+
deductionUnifies = this.unifyDeduction(deduction, context);
|
|
355
351
|
|
|
356
352
|
if (deductionUnifies) {
|
|
357
|
-
|
|
353
|
+
topLevelAssertionUnifies = true;
|
|
358
354
|
}
|
|
359
355
|
} else {
|
|
360
356
|
const statementNode = this.getStatementNode(),
|
|
361
357
|
subproofAssertionNode = statementNode.getSubproofAssertionNode();
|
|
362
358
|
|
|
363
359
|
if (subproofAssertionNode !== null) {
|
|
364
|
-
const
|
|
365
|
-
subproofAssertion = context.findAssertionByAssertionNode(subproofAssertionNode);
|
|
360
|
+
const subproofAssertion = context.findAssertionByAssertionNode(subproofAssertionNode);
|
|
366
361
|
|
|
367
|
-
|
|
362
|
+
topLevelAssertionUnifies = subproofAssertion.unifyTopLevelMetaAssertion(topLevelMetaAssertion, context);
|
|
368
363
|
}
|
|
369
364
|
}
|
|
370
365
|
|
|
371
|
-
if (
|
|
366
|
+
if (topLevelAssertionUnifies) {
|
|
372
367
|
context.debug(`...unified the '${topLevelMetaAssertionString}' top level meta-assertion with the '${statementString}' statement.`);
|
|
373
368
|
}
|
|
374
369
|
|
|
375
|
-
return
|
|
370
|
+
return topLevelAssertionUnifies;
|
|
376
371
|
}
|
|
377
372
|
|
|
378
373
|
toJSON() {
|
package/src/element/subproof.js
CHANGED
|
@@ -121,7 +121,7 @@ export default define(class Subproof extends Element {
|
|
|
121
121
|
context.trace(`Unifying the '${subproofString}' subproof with the '${satisfiesAssertionString}' satisfies assertion...`)
|
|
122
122
|
|
|
123
123
|
const reference = satisfiesAssertion.getReference(),
|
|
124
|
-
axiom = context.findAxiomByReference(reference
|
|
124
|
+
axiom = context.findAxiomByReference(reference);
|
|
125
125
|
|
|
126
126
|
if (axiom !== null) {
|
|
127
127
|
const axiomSatisfiable = axiom.isSatisfiable();
|
|
@@ -4,7 +4,7 @@ import Substitution from "../substitution";
|
|
|
4
4
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
6
|
import { instantiateFrameSubstitution } from "../../process/instantiate";
|
|
7
|
-
import {
|
|
7
|
+
import { descend, simplify, instantiate } from "../../utilities/context";
|
|
8
8
|
import { frameSubstitutionStringFromFrameAndMetavariable } from "../../utilities/string";
|
|
9
9
|
import { frameSubstitutionFromStatementNode, frameSubstitutionFromFrameSubstitutionNode } from "../../utilities/element";
|
|
10
10
|
|
|
@@ -123,14 +123,15 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
123
123
|
const targetFrameSingular = this.targetFrame.isSingular();
|
|
124
124
|
|
|
125
125
|
if (targetFrameSingular) {
|
|
126
|
-
|
|
127
|
-
|
|
126
|
+
descend((context) => {
|
|
127
|
+
const tragetFrame = this.targetFrame.validate(context);
|
|
128
128
|
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
if (tragetFrame !== null) {
|
|
130
|
+
this.targetFrame = tragetFrame;
|
|
131
131
|
|
|
132
|
-
|
|
133
|
-
|
|
132
|
+
targetFrameValidates = true;
|
|
133
|
+
}
|
|
134
|
+
}, context);
|
|
134
135
|
} else {
|
|
135
136
|
context.debug(`The '${frameSubstitutionString}' frame substitution's '${targetFrameString}' target frame is not singular.`);
|
|
136
137
|
}
|
|
@@ -151,14 +152,15 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
151
152
|
|
|
152
153
|
context.trace(`Validating the '${frameSubstitutionString}' frame substitution's '${replacementFrameString}' replacement frame...`);
|
|
153
154
|
|
|
154
|
-
|
|
155
|
-
|
|
155
|
+
descend((context) => {
|
|
156
|
+
const replacementFrame = this.replacementFrame.validate(context);
|
|
156
157
|
|
|
157
|
-
|
|
158
|
-
|
|
158
|
+
if (replacementFrame !== null) {
|
|
159
|
+
this.replacementFrame = replacementFrame;
|
|
159
160
|
|
|
160
|
-
|
|
161
|
-
|
|
161
|
+
replacementFrameValidates = true;
|
|
162
|
+
}
|
|
163
|
+
}, context);
|
|
162
164
|
|
|
163
165
|
if (replacementFrameValidates) {
|
|
164
166
|
context.debug(`...validated the '${frameSubstitutionString}' frame substitution's '${replacementFrameString}' replacement frame.`);
|
|
@@ -175,7 +177,7 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
175
177
|
const { name } = json;
|
|
176
178
|
|
|
177
179
|
if (this.name === name) {
|
|
178
|
-
|
|
180
|
+
instantiate((context) => {
|
|
179
181
|
const { string } = json,
|
|
180
182
|
frameSubstitutionNode = instantiateFrameSubstitution(string, context),
|
|
181
183
|
node = frameSubstitutionNode, ///
|
|
@@ -184,9 +186,7 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
184
186
|
|
|
185
187
|
context = null;
|
|
186
188
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
return frameSubstitutionn;
|
|
189
|
+
frameSubstitutionn = new FrameSubstitution(context, string, node, targetFrame, replacementFrame);
|
|
190
190
|
}, context);
|
|
191
191
|
}
|
|
192
192
|
|
|
@@ -201,18 +201,19 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
201
201
|
}
|
|
202
202
|
|
|
203
203
|
static fromFrameAndMetavariable(frame, metavariable, context) {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
context = santisedContext; ///
|
|
204
|
+
let frameSubstitution
|
|
207
205
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
206
|
+
simplify((context) => {
|
|
207
|
+
instantiate((context) => {
|
|
208
|
+
const frameSubstitutionString = frameSubstitutionStringFromFrameAndMetavariable(frame, metavariable),
|
|
209
|
+
string = frameSubstitutionString, ///
|
|
210
|
+
frameSubstitutionNode = instantiateFrameSubstitution(string, context);
|
|
213
211
|
|
|
214
|
-
|
|
212
|
+
frameSubstitution = frameSubstitutionFromFrameSubstitutionNode(frameSubstitutionNode, context);
|
|
213
|
+
}, context);
|
|
215
214
|
}, context);
|
|
215
|
+
|
|
216
|
+
return frameSubstitution;
|
|
216
217
|
}
|
|
217
218
|
});
|
|
218
219
|
|