occam-verify-cli 1.0.758 → 1.0.762
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/synthetic.js +82 -2
- package/lib/element/assertion/contained.js +4 -3
- package/lib/element/assertion/defined.js +4 -3
- package/lib/element/assertion/property.js +5 -4
- package/lib/element/assertion/satisfies.js +4 -3
- package/lib/element/assertion/subproof.js +64 -54
- package/lib/element/assertion/type.js +4 -3
- package/lib/element/combinator.js +2 -3
- package/lib/element/conclusion.js +2 -3
- package/lib/element/constructor.js +2 -3
- package/lib/element/deduction.js +2 -3
- package/lib/element/equality.js +2 -3
- package/lib/element/frame.js +2 -3
- package/lib/element/hypothesis.js +2 -3
- package/lib/element/judgement.js +2 -3
- package/lib/element/label.js +2 -3
- package/lib/element/metavariable.js +11 -26
- package/lib/element/parameter.js +2 -3
- package/lib/element/procedureCall.js +2 -3
- package/lib/element/procedureReference.js +2 -3
- package/lib/element/proofAssertion/premise.js +11 -10
- package/lib/element/proofAssertion/step.js +11 -10
- package/lib/element/proofAssertion/supposition.js +11 -10
- package/lib/element/property.js +2 -3
- package/lib/element/propertyRelation.js +2 -3
- package/lib/element/reference.js +2 -3
- package/lib/element/signature.js +2 -3
- package/lib/element/statement.js +2 -3
- package/lib/element/substitution/frame.js +4 -3
- package/lib/element/substitution/metaLevel.js +2 -3
- package/lib/element/substitution/reference.js +4 -3
- package/lib/element/substitution/statement.js +6 -5
- package/lib/element/substitution/term.js +4 -3
- package/lib/element/term.js +2 -3
- package/lib/element/type.js +2 -3
- package/lib/element/typePrefix.js +2 -3
- package/lib/element/variable.js +5 -10
- package/lib/process/unify.js +1 -12
- package/lib/utilities/context.js +53 -4
- package/lib/utilities/instance.js +5 -13
- package/lib/utilities/unification.js +4 -9
- package/lib/utilities/validation.js +14 -8
- package/package.json +4 -4
- package/src/context/synthetic.js +125 -1
- package/src/element/assertion/contained.js +4 -2
- package/src/element/assertion/defined.js +4 -2
- package/src/element/assertion/property.js +5 -3
- package/src/element/assertion/satisfies.js +4 -2
- package/src/element/assertion/subproof.js +80 -73
- package/src/element/assertion/type.js +4 -2
- package/src/element/combinator.js +1 -3
- package/src/element/conclusion.js +1 -3
- package/src/element/constructor.js +1 -3
- package/src/element/deduction.js +1 -3
- package/src/element/equality.js +1 -3
- package/src/element/frame.js +1 -3
- package/src/element/hypothesis.js +1 -3
- package/src/element/judgement.js +1 -3
- package/src/element/label.js +1 -3
- package/src/element/metavariable.js +17 -36
- package/src/element/parameter.js +1 -3
- package/src/element/procedureCall.js +1 -3
- package/src/element/procedureReference.js +1 -3
- package/src/element/proofAssertion/premise.js +12 -12
- package/src/element/proofAssertion/step.js +11 -9
- package/src/element/proofAssertion/supposition.js +12 -12
- package/src/element/property.js +1 -3
- package/src/element/propertyRelation.js +1 -3
- package/src/element/reference.js +1 -3
- package/src/element/signature.js +1 -3
- package/src/element/statement.js +1 -3
- package/src/element/substitution/frame.js +4 -2
- package/src/element/substitution/metaLevel.js +1 -3
- package/src/element/substitution/reference.js +4 -2
- package/src/element/substitution/statement.js +6 -4
- package/src/element/substitution/term.js +4 -2
- package/src/element/term.js +1 -3
- package/src/element/type.js +1 -3
- package/src/element/typePrefix.js +2 -3
- package/src/element/variable.js +5 -12
- package/src/process/unify.js +0 -16
- package/src/utilities/context.js +85 -3
- package/src/utilities/instance.js +5 -11
- package/src/utilities/unification.js +5 -11
- package/src/utilities/validation.js +17 -9
|
@@ -4,7 +4,7 @@ import ProofAssertion from "../proofAssertion";
|
|
|
4
4
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
6
|
import { instantiateSupposition} from "../../process/instantiate";
|
|
7
|
-
import { attempt, reconcile, instantiate } from "../../utilities/context";
|
|
7
|
+
import { join, attempt, reconcile, instantiate } from "../../utilities/context";
|
|
8
8
|
import { statementFromSuppositionNode, procedureCallFromSuppositionNode } from "../../utilities/element";
|
|
9
9
|
import { ephemeralContextFromJSON, ephemeralContextToEphemeralContextJSON } from "../../utilities/json";
|
|
10
10
|
|
|
@@ -191,16 +191,18 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
191
191
|
generalContext = suppositionContext, ///
|
|
192
192
|
specificContext = proofAssertionContext;
|
|
193
193
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
194
|
+
join((specificContext) => {
|
|
195
|
+
reconcile((specificContext) => {
|
|
196
|
+
const statement = proofAssertion.getStatement(),
|
|
197
|
+
statementUnifies = this.unifyStatement(statement, generalContext, specificContext);
|
|
197
198
|
|
|
198
|
-
|
|
199
|
-
|
|
199
|
+
if (statementUnifies) {
|
|
200
|
+
specificContext.commit(context);
|
|
200
201
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
202
|
+
proofAssertionUnifies = true;
|
|
203
|
+
}
|
|
204
|
+
}, specificContext);
|
|
205
|
+
}, specificContext, context);
|
|
204
206
|
|
|
205
207
|
if (proofAssertionUnifies) {
|
|
206
208
|
context.debug(`...unified the '${proofAssertionString}' proof assertion with the '${suppositionString}' supposition.`);
|
|
@@ -312,7 +314,7 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
312
314
|
|
|
313
315
|
context = ephemeralContext; ///
|
|
314
316
|
|
|
315
|
-
|
|
317
|
+
return instantiate((context) => {
|
|
316
318
|
const { string } = json,
|
|
317
319
|
suppositionNode = instantiateSupposition(string, context),
|
|
318
320
|
node = suppositionNode, ///
|
|
@@ -322,8 +324,6 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
322
324
|
|
|
323
325
|
return supposition;
|
|
324
326
|
}, context);
|
|
325
|
-
|
|
326
|
-
return supposition;
|
|
327
327
|
}
|
|
328
328
|
});
|
|
329
329
|
|
package/src/element/property.js
CHANGED
|
@@ -58,7 +58,7 @@ export default define(class Property extends Element {
|
|
|
58
58
|
static name = "Property";
|
|
59
59
|
|
|
60
60
|
static fromJSON(json, context) {
|
|
61
|
-
|
|
61
|
+
return instantiate((context) => {
|
|
62
62
|
const { string } = json,
|
|
63
63
|
propertyNode = instantiateProperty(string, context),
|
|
64
64
|
node = propertyNode, ///
|
|
@@ -71,7 +71,5 @@ export default define(class Property extends Element {
|
|
|
71
71
|
|
|
72
72
|
return property;
|
|
73
73
|
}, context);
|
|
74
|
-
|
|
75
|
-
return property;
|
|
76
74
|
}
|
|
77
75
|
});
|
|
@@ -124,7 +124,7 @@ export default define(class PropertyRelation extends Element {
|
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
static fromJSON(json, context) {
|
|
127
|
-
|
|
127
|
+
return instantiate((context) => {
|
|
128
128
|
const { string } = json,
|
|
129
129
|
propertyRelationNode = instantiatePropertyRelation(string, context),
|
|
130
130
|
node = propertyRelationNode, ///
|
|
@@ -137,8 +137,6 @@ export default define(class PropertyRelation extends Element {
|
|
|
137
137
|
|
|
138
138
|
return propertyRelation;
|
|
139
139
|
}, context);
|
|
140
|
-
|
|
141
|
-
return propertyRelation;
|
|
142
140
|
}
|
|
143
141
|
});
|
|
144
142
|
|
package/src/element/reference.js
CHANGED
|
@@ -284,7 +284,7 @@ export default define(class Reference extends Element {
|
|
|
284
284
|
static name = "Reference";
|
|
285
285
|
|
|
286
286
|
static fromJSON(json, context) {
|
|
287
|
-
|
|
287
|
+
return instantiate((context) => {
|
|
288
288
|
const { string } = json,
|
|
289
289
|
referenceNode = instantiateReference(string, context),
|
|
290
290
|
node = referenceNode, ///
|
|
@@ -296,7 +296,5 @@ export default define(class Reference extends Element {
|
|
|
296
296
|
|
|
297
297
|
return reference;
|
|
298
298
|
}, context);
|
|
299
|
-
|
|
300
|
-
return reference;
|
|
301
299
|
}
|
|
302
300
|
});
|
package/src/element/signature.js
CHANGED
|
@@ -225,7 +225,7 @@ export default define(class Signature extends Element {
|
|
|
225
225
|
static name = "Signature";
|
|
226
226
|
|
|
227
227
|
static fromJSON(json, context) {
|
|
228
|
-
|
|
228
|
+
return instantiate((context) => {
|
|
229
229
|
const { string } = json,
|
|
230
230
|
signatureNode = instantiateSignature(string, context),
|
|
231
231
|
node = signatureNode, ///
|
|
@@ -234,7 +234,5 @@ export default define(class Signature extends Element {
|
|
|
234
234
|
|
|
235
235
|
return signature;
|
|
236
236
|
}, context);
|
|
237
|
-
|
|
238
|
-
return signature;
|
|
239
237
|
}
|
|
240
238
|
});
|
package/src/element/statement.js
CHANGED
|
@@ -385,7 +385,7 @@ export default define(class Statement extends Element {
|
|
|
385
385
|
static name = "Statement";
|
|
386
386
|
|
|
387
387
|
static fromJSON(json, context) {
|
|
388
|
-
|
|
388
|
+
return instantiate((context) => {
|
|
389
389
|
const { string } = json,
|
|
390
390
|
statementNode = instantiateStatement(string, context),
|
|
391
391
|
node = statementNode; ///
|
|
@@ -396,7 +396,5 @@ export default define(class Statement extends Element {
|
|
|
396
396
|
|
|
397
397
|
return statement;
|
|
398
398
|
}, context);
|
|
399
|
-
|
|
400
|
-
return statement;
|
|
401
399
|
}
|
|
402
400
|
});
|
|
@@ -178,7 +178,7 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
178
178
|
const { name } = json;
|
|
179
179
|
|
|
180
180
|
if (this.name === name) {
|
|
181
|
-
instantiate((context) => {
|
|
181
|
+
frameSubstitutionn = instantiate((context) => {
|
|
182
182
|
const { string } = json,
|
|
183
183
|
frameSubstitutionNode = instantiateFrameSubstitution(string, context),
|
|
184
184
|
node = frameSubstitutionNode, ///
|
|
@@ -187,7 +187,9 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
187
187
|
|
|
188
188
|
context = null;
|
|
189
189
|
|
|
190
|
-
frameSubstitutionn = new FrameSubstitution(context, string, node, targetFrame, replacementFrame);
|
|
190
|
+
const frameSubstitutionn = new FrameSubstitution(context, string, node, targetFrame, replacementFrame);
|
|
191
|
+
|
|
192
|
+
return frameSubstitutionn;
|
|
191
193
|
}, context);
|
|
192
194
|
}
|
|
193
195
|
|
|
@@ -176,7 +176,7 @@ export default define(class MetaLevelSubstitution extends Substitution {
|
|
|
176
176
|
|
|
177
177
|
context = ephemeralContext; ///
|
|
178
178
|
|
|
179
|
-
|
|
179
|
+
return instantiate((context) => {
|
|
180
180
|
const { string } = json,
|
|
181
181
|
metaLevelSubstitutionNode = instantiateMetaLevelSubstitution(string, context),
|
|
182
182
|
targetReference = targetReferenceFromMetaLevelSubstitutionNode(metaLevelSubstitutionNode, context),
|
|
@@ -186,8 +186,6 @@ export default define(class MetaLevelSubstitution extends Substitution {
|
|
|
186
186
|
|
|
187
187
|
return metaLevelSubstitution;
|
|
188
188
|
}, context);
|
|
189
|
-
|
|
190
|
-
return metaLevelSubstitution;
|
|
191
189
|
}
|
|
192
190
|
|
|
193
191
|
static fromStatementAndReference(statement, reference, context) {
|
|
@@ -166,7 +166,7 @@ export default define(class ReferenceSubstitution extends Substitution {
|
|
|
166
166
|
const { name } = json;
|
|
167
167
|
|
|
168
168
|
if (this.name === name) {
|
|
169
|
-
instantiate((context) => {
|
|
169
|
+
referenceSubstitutionn = instantiate((context) => {
|
|
170
170
|
const { string } = json,
|
|
171
171
|
referenceSubstitutionNode = instantiateReferenceSubstitution(string, context),
|
|
172
172
|
node = referenceSubstitutionNode, ///
|
|
@@ -175,7 +175,9 @@ export default define(class ReferenceSubstitution extends Substitution {
|
|
|
175
175
|
|
|
176
176
|
context = null;
|
|
177
177
|
|
|
178
|
-
referenceSubstitutionn = new ReferenceSubstitution(context, string, node, targetReference, replacementReference);
|
|
178
|
+
const referenceSubstitutionn = new ReferenceSubstitution(context, string, node, targetReference, replacementReference);
|
|
179
|
+
|
|
180
|
+
return referenceSubstitutionn;
|
|
179
181
|
}, context);
|
|
180
182
|
}
|
|
181
183
|
|
|
@@ -284,7 +284,7 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
284
284
|
return replacementStatemnentUnifies;
|
|
285
285
|
}
|
|
286
286
|
|
|
287
|
-
|
|
287
|
+
unifyWithSimpleSubstitution(simpleSubstitution, generalContext, specificContext) {
|
|
288
288
|
let substitution;
|
|
289
289
|
|
|
290
290
|
const complexSubstitution = this; ///
|
|
@@ -316,7 +316,7 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
316
316
|
simpleSubstitution = context.findSimpleSubstitutionByMetavariableName(metavariableName);
|
|
317
317
|
|
|
318
318
|
if (simpleSubstitution !== null) {
|
|
319
|
-
const substitution = this.
|
|
319
|
+
const substitution = this.unifyWithSimpleSubstitution(simpleSubstitution, generalContext, specificContext); ///
|
|
320
320
|
|
|
321
321
|
if (substitution !== null) {
|
|
322
322
|
const complexSubstitution = this, ///
|
|
@@ -352,7 +352,7 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
352
352
|
const { name } = json;
|
|
353
353
|
|
|
354
354
|
if (this.name === name) {
|
|
355
|
-
instantiate((context) => {
|
|
355
|
+
statementSubstitutionn = instantiate((context) => {
|
|
356
356
|
const { string } = json,
|
|
357
357
|
statementSubstitutionNode = instantiateStatementSubstitution(string, context),
|
|
358
358
|
node = statementSubstitutionNode, ///
|
|
@@ -361,7 +361,9 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
361
361
|
|
|
362
362
|
context = null;
|
|
363
363
|
|
|
364
|
-
statementSubstitutionn = new StatementSubstitution(context, string, node, targetStatement, replacementStatement);
|
|
364
|
+
const statementSubstitutionn = new StatementSubstitution(context, string, node, targetStatement, replacementStatement);
|
|
365
|
+
|
|
366
|
+
return statementSubstitutionn;
|
|
365
367
|
}, context);
|
|
366
368
|
}
|
|
367
369
|
|
|
@@ -187,7 +187,7 @@ export default define(class TermSubstitution extends Substitution {
|
|
|
187
187
|
const { name } = json;
|
|
188
188
|
|
|
189
189
|
if (this.name === name) {
|
|
190
|
-
instantiate((context) => {
|
|
190
|
+
termSubstitutionn = instantiate((context) => {
|
|
191
191
|
const { string } = json,
|
|
192
192
|
termSubstitutionNode = instantiateTermSubstitution(string, context),
|
|
193
193
|
node = termSubstitutionNode, ///
|
|
@@ -196,7 +196,9 @@ export default define(class TermSubstitution extends Substitution {
|
|
|
196
196
|
|
|
197
197
|
context = null;
|
|
198
198
|
|
|
199
|
-
termSubstitutionn = new TermSubstitution(context, string, node, targetTerm, replacementTerm);
|
|
199
|
+
const termSubstitutionn = new TermSubstitution(context, string, node, targetTerm, replacementTerm);
|
|
200
|
+
|
|
201
|
+
return termSubstitutionn;
|
|
200
202
|
}, context);
|
|
201
203
|
}
|
|
202
204
|
|
package/src/element/term.js
CHANGED
|
@@ -238,7 +238,7 @@ export default define(class Term extends Element {
|
|
|
238
238
|
static name = "Term";
|
|
239
239
|
|
|
240
240
|
static fromJSON(json, context) {
|
|
241
|
-
|
|
241
|
+
return instantiate((context) => {
|
|
242
242
|
const { string } = json,
|
|
243
243
|
termNode = instantiateTerm(string, context),
|
|
244
244
|
node = termNode, ///
|
|
@@ -250,7 +250,5 @@ export default define(class Term extends Element {
|
|
|
250
250
|
|
|
251
251
|
return term;
|
|
252
252
|
}, context);
|
|
253
|
-
|
|
254
|
-
return term;
|
|
255
253
|
}
|
|
256
254
|
});
|
package/src/element/type.js
CHANGED
|
@@ -316,7 +316,7 @@ export default define(class Type extends Element {
|
|
|
316
316
|
static name = "Type";
|
|
317
317
|
|
|
318
318
|
static fromJSON(json, context) {
|
|
319
|
-
|
|
319
|
+
return instantiate((context) => {
|
|
320
320
|
const { string } = json,
|
|
321
321
|
typeNode = instantiateType(string, context),
|
|
322
322
|
node = typeNode, ///
|
|
@@ -332,8 +332,6 @@ export default define(class Type extends Element {
|
|
|
332
332
|
|
|
333
333
|
return type;
|
|
334
334
|
}, context);
|
|
335
|
-
|
|
336
|
-
return type;
|
|
337
335
|
}
|
|
338
336
|
|
|
339
337
|
static fromName(name, context) {
|
|
@@ -43,7 +43,8 @@ export default define(class TypePrefix extends Element {
|
|
|
43
43
|
static name = "TypePrefix";
|
|
44
44
|
|
|
45
45
|
static fromJSON(json, context) {
|
|
46
|
-
|
|
46
|
+
return instantiate((context) => {
|
|
47
|
+
const { string } = json,
|
|
47
48
|
typePrefixNode = instantiateTypePrefix(string, context),
|
|
48
49
|
node = typePrefixNode, ///
|
|
49
50
|
name = nameFromTypePrefixNode(typePrefixNode, context);
|
|
@@ -54,7 +55,5 @@ export default define(class TypePrefix extends Element {
|
|
|
54
55
|
|
|
55
56
|
return typePrefix;
|
|
56
57
|
}, context);
|
|
57
|
-
|
|
58
|
-
return typePrefix;
|
|
59
58
|
}
|
|
60
59
|
});
|
package/src/element/variable.js
CHANGED
|
@@ -153,17 +153,12 @@ export default define(class Variable extends Element {
|
|
|
153
153
|
termTypeEqualToOrSubTypeOfVariableType = termType.isEqualToOrSubTypeOf(variableType);
|
|
154
154
|
|
|
155
155
|
if (termTypeEqualToOrSubTypeOfVariableType) {
|
|
156
|
-
const { TermSubstitution } = elements
|
|
156
|
+
const { TermSubstitution } = elements,
|
|
157
|
+
termSubstitution = TermSubstitution.fromTermAndVariable(term, variable, context);
|
|
157
158
|
|
|
158
|
-
|
|
159
|
+
termSubstitution.validate(generalContext, specificContext);
|
|
159
160
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
termSubstitution = termSubstitution.validate(generalContext, specificContext); ///
|
|
163
|
-
|
|
164
|
-
if (termSubstitution !== null) {
|
|
165
|
-
termUnifies = true;
|
|
166
|
-
}
|
|
161
|
+
termUnifies = true;
|
|
167
162
|
}
|
|
168
163
|
}
|
|
169
164
|
|
|
@@ -189,7 +184,7 @@ export default define(class Variable extends Element {
|
|
|
189
184
|
static name = "Variable";
|
|
190
185
|
|
|
191
186
|
static fromJSON(json, context) {
|
|
192
|
-
|
|
187
|
+
return instantiate((context) => {
|
|
193
188
|
const { string } = json,
|
|
194
189
|
variableNode = instantiateVariable(string, context),
|
|
195
190
|
node = variableNode, ///
|
|
@@ -202,7 +197,5 @@ export default define(class Variable extends Element {
|
|
|
202
197
|
|
|
203
198
|
return variable;
|
|
204
199
|
}, context);
|
|
205
|
-
|
|
206
|
-
return variable;
|
|
207
200
|
}
|
|
208
201
|
});
|
package/src/process/unify.js
CHANGED
|
@@ -466,22 +466,6 @@ export function unifyTermWithConstructor(term, constructor, generalContext, spec
|
|
|
466
466
|
return termUnifiesWithConstructor;
|
|
467
467
|
}
|
|
468
468
|
|
|
469
|
-
export function unifyStatementIntrinsically(generalStatement, specificStatement, generalContext, specificContext) {
|
|
470
|
-
let statementUnifiesIntrinsically = false;
|
|
471
|
-
|
|
472
|
-
const generalStatementNode = generalStatement.getNode(),
|
|
473
|
-
specificStatementNode = specificStatement.getNode(),
|
|
474
|
-
generalNode = generalStatementNode, ///
|
|
475
|
-
specificNode = specificStatementNode, ///
|
|
476
|
-
success = intrinsicLevelPass.run(generalNode, specificNode, generalContext, specificContext);
|
|
477
|
-
|
|
478
|
-
if (success) {
|
|
479
|
-
statementUnifiesIntrinsically = true;
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
return statementUnifiesIntrinsically;
|
|
483
|
-
}
|
|
484
|
-
|
|
485
469
|
export function unifyStatementWithCombinator(statement, combinator, stated, generalContext, specificContext) {
|
|
486
470
|
let statementUnifiesWithCombinator = false;
|
|
487
471
|
|
package/src/utilities/context.js
CHANGED
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import ScopedContext from "../context/scoped";
|
|
4
|
-
import
|
|
4
|
+
import nominalContext from "../context/nominal";
|
|
5
5
|
import LiteralContext from "../context/literal";
|
|
6
|
+
import LiminalContext from "../context/liminal";
|
|
6
7
|
import EphemeralContext from "../context/ephemeral";
|
|
7
|
-
import SyntheticContext from "../context/synthetic";
|
|
8
8
|
import BranchingContext from "../context/branching";
|
|
9
|
+
import SyntheticContext from "../context/synthetic";
|
|
10
|
+
|
|
11
|
+
export function nominally(innerFunction) {
|
|
12
|
+
let context;
|
|
13
|
+
|
|
14
|
+
context = nominalContext; ///
|
|
15
|
+
|
|
16
|
+
const literalContext = LiteralContext.fromNothing(context);
|
|
17
|
+
|
|
18
|
+
context = literalContext; ///
|
|
19
|
+
|
|
20
|
+
return innerFunction(context);
|
|
21
|
+
}
|
|
9
22
|
|
|
10
23
|
export function join(innerFunction, ...contexts) {
|
|
11
24
|
const syntheticContext = SyntheticContext.fromContexts(...contexts),
|
|
@@ -39,11 +52,26 @@ export function reconcile(innerFunction, context) {
|
|
|
39
52
|
}
|
|
40
53
|
|
|
41
54
|
export function instantiate(innerFunction, context) {
|
|
55
|
+
const releaseContext = releaseContextFromContext(context),
|
|
56
|
+
sterilisedContext = sterilisedContextFromContext(context);
|
|
57
|
+
|
|
58
|
+
context = releaseContext; ///
|
|
59
|
+
|
|
42
60
|
const literalContext = LiteralContext.fromNothing(context);
|
|
43
61
|
|
|
44
62
|
context = literalContext; ///
|
|
45
63
|
|
|
46
|
-
|
|
64
|
+
const element = innerFunction(context);
|
|
65
|
+
|
|
66
|
+
context = element.getContext();
|
|
67
|
+
|
|
68
|
+
if (context !== null) {
|
|
69
|
+
context = sterilisedContext; ///
|
|
70
|
+
|
|
71
|
+
element.setContext(context);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return element;
|
|
47
75
|
}
|
|
48
76
|
|
|
49
77
|
export async function asyncRestrict(innerFunction, metaLevelSubstitutions, context) {
|
|
@@ -67,3 +95,57 @@ export async function asyncReconcile(innerFunction, context) {
|
|
|
67
95
|
|
|
68
96
|
return await innerFunction(context);
|
|
69
97
|
}
|
|
98
|
+
|
|
99
|
+
function sterilisedContextFromContext(context) {
|
|
100
|
+
let contextExtraneousContext = isContextExtraneousContext(context);
|
|
101
|
+
|
|
102
|
+
while (contextExtraneousContext) {
|
|
103
|
+
context = context.getContext();
|
|
104
|
+
|
|
105
|
+
contextExtraneousContext = isContextExtraneousContext(context);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const ephemeralContext = EphemeralContext.fromNothing(context),
|
|
109
|
+
sterilisedContext = ephemeralContext; ///
|
|
110
|
+
|
|
111
|
+
return sterilisedContext;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function releaseContextFromContext(context) {
|
|
115
|
+
let contextFileContext = isContextFileContext(context);
|
|
116
|
+
|
|
117
|
+
while (!contextFileContext) {
|
|
118
|
+
context = context.getContext();
|
|
119
|
+
|
|
120
|
+
contextFileContext = isContextFileContext(context);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const releaseContext = context;
|
|
124
|
+
|
|
125
|
+
return releaseContext;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function isContextFileContext(context) {
|
|
129
|
+
const parentContext = context.getContext(), ///
|
|
130
|
+
parentContextReleaseContext = isContextReleaseContext(parentContext),
|
|
131
|
+
contextFileContext = parentContextReleaseContext; ///
|
|
132
|
+
|
|
133
|
+
return contextFileContext;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function isContextReleaseContext(context) {
|
|
137
|
+
const releaseContext = context.getReleaseContext(),
|
|
138
|
+
contextReleaseContext = (context === releaseContext);
|
|
139
|
+
|
|
140
|
+
return contextReleaseContext;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function isContextExtraneousContext(context) {
|
|
144
|
+
const contextLiminalContext = (context instanceof LiminalContext),
|
|
145
|
+
contextEphemeralContext = (context instanceof EphemeralContext),
|
|
146
|
+
contextBranchingContext = (context instanceof BranchingContext),
|
|
147
|
+
contextSyntheticContext = (context instanceof SyntheticContext),
|
|
148
|
+
contextExtraneousContext = (contextLiminalContext || contextEphemeralContext || contextBranchingContext || contextSyntheticContext);
|
|
149
|
+
|
|
150
|
+
return contextExtraneousContext;
|
|
151
|
+
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import { instantiate } from "../utilities/context";
|
|
3
|
+
import { nominally } from "../utilities/context";
|
|
6
4
|
import { BASE_TYPE_SYMBOL } from "../constants";
|
|
7
5
|
import { STATEMENT_META_TYPE_NAME } from "../metaTypeNames";
|
|
8
6
|
import { instantiateCombinator, instantiateConstructor } from "../process/instantiate";
|
|
@@ -13,9 +11,7 @@ let bracketedCombinator = null,
|
|
|
13
11
|
|
|
14
12
|
export function bracketedCombinatorFromNothing() {
|
|
15
13
|
if (bracketedCombinator === null) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
bracketedCombinator = instantiate((context) => {
|
|
14
|
+
bracketedCombinator = nominally((context) => {
|
|
19
15
|
const bracketedCombinatorString = `(${STATEMENT_META_TYPE_NAME})`,
|
|
20
16
|
string = bracketedCombinatorString, ///
|
|
21
17
|
combinatorNode = instantiateCombinator(string, context),
|
|
@@ -23,7 +19,7 @@ export function bracketedCombinatorFromNothing() {
|
|
|
23
19
|
bracketedCombinator = combinatorFromCombinatorNode(bracketedCombinatorNode, context);
|
|
24
20
|
|
|
25
21
|
return bracketedCombinator;
|
|
26
|
-
}
|
|
22
|
+
});
|
|
27
23
|
}
|
|
28
24
|
|
|
29
25
|
return bracketedCombinator;
|
|
@@ -31,9 +27,7 @@ export function bracketedCombinatorFromNothing() {
|
|
|
31
27
|
|
|
32
28
|
export function bracketedConstructorFromNothing() {
|
|
33
29
|
if (bracketedConstructor === null) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
bracketedConstructor = instantiate((context) => {
|
|
30
|
+
bracketedConstructor = nominally((context) => {
|
|
37
31
|
const bracketedConstructorString = `(${BASE_TYPE_SYMBOL})`,
|
|
38
32
|
string = bracketedConstructorString, ///
|
|
39
33
|
constructorNode = instantiateConstructor(string, context),
|
|
@@ -41,7 +35,7 @@ export function bracketedConstructorFromNothing() {
|
|
|
41
35
|
bracketedConstructor = constructorFromConstructorNode(bracketedConstructorNode, context);
|
|
42
36
|
|
|
43
37
|
return bracketedConstructor;
|
|
44
|
-
}
|
|
38
|
+
});
|
|
45
39
|
}
|
|
46
40
|
|
|
47
41
|
return bracketedConstructor;
|
|
@@ -62,20 +62,14 @@ async function unifyStatementWithReference(statement, reference, satisfiesAssert
|
|
|
62
62
|
const metaLevelSubstitutions = context.hasMetaLevelSubstitutions();
|
|
63
63
|
|
|
64
64
|
if (metaLevelSubstitutions) {
|
|
65
|
-
const { MetaLevelSubstitution } = elements
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
metaLevelSubstitution = MetaLevelSubstitution.fromStatementAndReference(statement, reference, context);
|
|
70
|
-
|
|
71
|
-
const generalContext = context, ///
|
|
65
|
+
const { MetaLevelSubstitution } = elements,
|
|
66
|
+
metaLevelSubstitution = MetaLevelSubstitution.fromStatementAndReference(statement, reference, context),
|
|
67
|
+
generalContext = context, ///
|
|
72
68
|
specificContext = context; ///
|
|
73
69
|
|
|
74
|
-
metaLevelSubstitution
|
|
70
|
+
metaLevelSubstitution.validate(generalContext, specificContext);
|
|
75
71
|
|
|
76
|
-
|
|
77
|
-
statementUnifiesWithReference = true;
|
|
78
|
-
}
|
|
72
|
+
statementUnifiesWithReference = true;
|
|
79
73
|
}
|
|
80
74
|
}
|
|
81
75
|
|
|
@@ -104,20 +104,28 @@ function validateStatementAsMetavariable(statement, stated, context) {
|
|
|
104
104
|
statementValidatesAsMetavariable = true;
|
|
105
105
|
|
|
106
106
|
const { TermSubstitution, FrameSubstitution } = elements,
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
generalContext = context, ///
|
|
108
|
+
specificContext = context; ///
|
|
109
109
|
|
|
110
|
-
let
|
|
110
|
+
let termSubstitution,
|
|
111
|
+
frameSubstitution;
|
|
111
112
|
|
|
112
|
-
|
|
113
|
+
termSubstitution = TermSubstitution.fromStatement(statement, context);
|
|
113
114
|
|
|
114
|
-
if (
|
|
115
|
-
|
|
116
|
-
specificContext = context; ///
|
|
115
|
+
if (termSubstitution !== null) {
|
|
116
|
+
termSubstitution = termSubstitution.validate(generalContext, specificContext); ///
|
|
117
117
|
|
|
118
|
-
|
|
118
|
+
if (termSubstitution === null) {
|
|
119
|
+
statementValidatesAsMetavariable = false;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
frameSubstitution = FrameSubstitution.fromStatement(statement, context);
|
|
124
|
+
|
|
125
|
+
if (frameSubstitution !== null) {
|
|
126
|
+
frameSubstitution = frameSubstitution.validate(generalContext, specificContext); ///
|
|
119
127
|
|
|
120
|
-
if (
|
|
128
|
+
if (frameSubstitution === null) {
|
|
121
129
|
statementValidatesAsMetavariable = false;
|
|
122
130
|
}
|
|
123
131
|
}
|