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
|
@@ -6,7 +6,7 @@ import Assertion from "../assertion";
|
|
|
6
6
|
|
|
7
7
|
import { define } from "../../elements";
|
|
8
8
|
import { reconcile } from "../../utilities/context";
|
|
9
|
-
import { instantiate } from "../../utilities/context";
|
|
9
|
+
import { join, instantiate } from "../../utilities/context";
|
|
10
10
|
import { instantiateSubproofAssertion } from "../../process/instantiate";
|
|
11
11
|
|
|
12
12
|
const { last, front, backwardsEvery } = arrayUtilities;
|
|
@@ -114,17 +114,21 @@ export default define(class SubproofAssertion extends Assertion {
|
|
|
114
114
|
|
|
115
115
|
context.trace(`Unifying the '${subproofString}' subproof with the '${subproofAssertionString}' subproof assertion...`);
|
|
116
116
|
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
reconcile((specificContext) => {
|
|
118
|
+
const lastStep = subproof.getLastStep(),
|
|
119
|
+
lastStepUnifies = this.unifyLastStep(lastStep, generalContext, specificContext);
|
|
119
120
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
121
|
+
if (lastStepUnifies) {
|
|
122
|
+
const suppositions = subproof.getSuppositions(),
|
|
123
|
+
suppositionsUnify = this.unifySuppositions(suppositions, generalContext, specificContext);
|
|
123
124
|
|
|
124
|
-
|
|
125
|
-
|
|
125
|
+
if (suppositionsUnify) {
|
|
126
|
+
specificContext.commit();
|
|
127
|
+
|
|
128
|
+
subproofUnifies = true;
|
|
129
|
+
}
|
|
126
130
|
}
|
|
127
|
-
}
|
|
131
|
+
}, specificContext);
|
|
128
132
|
|
|
129
133
|
if (subproofUnifies) {
|
|
130
134
|
context.debug(`...unified the '${subproofString}' subproof with the '${subproofAssertionString}' subproof assertion.`);
|
|
@@ -136,33 +140,32 @@ export default define(class SubproofAssertion extends Assertion {
|
|
|
136
140
|
unifyLastStep(lastStep, generalContext, specificContext) {
|
|
137
141
|
let lastStepUnifies = false;
|
|
138
142
|
|
|
139
|
-
const
|
|
143
|
+
const context = specificContext, ///
|
|
144
|
+
lastStatement = this.getLastStatement(),
|
|
140
145
|
lastStepString = lastStep.getString(),
|
|
141
|
-
|
|
142
|
-
lastStatementString = lastStatement.getString(),
|
|
143
|
-
subproofAssertionString = this.getString(), ///
|
|
144
|
-
lastStepStatementString = lastStepStatement.getString();
|
|
145
|
-
|
|
146
|
-
let context;
|
|
146
|
+
lastStatementString = lastStatement.getString();
|
|
147
147
|
|
|
148
|
-
context
|
|
148
|
+
context.trace(`Unifying the '${lastStepString}' last step with the '${lastStatementString}' last statement...`)
|
|
149
149
|
|
|
150
|
-
|
|
150
|
+
const lastStepContext = lastStep.getContext(),
|
|
151
|
+
lastStepStatement = lastStep.getStatement();
|
|
151
152
|
|
|
152
|
-
|
|
153
|
+
specificContext = lastStepContext; ///
|
|
153
154
|
|
|
154
|
-
specificContext
|
|
155
|
+
join((specificContext) => {
|
|
156
|
+
reconcile((specificContext) => {
|
|
157
|
+
const lastStepStatementUnifies = lastStatement.unifyStatement(lastStepStatement, generalContext, specificContext);
|
|
155
158
|
|
|
156
|
-
|
|
157
|
-
|
|
159
|
+
if (lastStepStatementUnifies) {
|
|
160
|
+
specificContext.commit(context);
|
|
158
161
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
}
|
|
162
|
-
}, specificContext);
|
|
162
|
+
lastStepUnifies = true;
|
|
163
|
+
}
|
|
164
|
+
}, specificContext);
|
|
165
|
+
}, specificContext, context);
|
|
163
166
|
|
|
164
167
|
if (lastStepUnifies) {
|
|
165
|
-
context.debug(`...unified the '${lastStepString}' last step
|
|
168
|
+
context.debug(`...unified the '${lastStepString}' last step with the '${lastStatementString}' last statement.`)
|
|
166
169
|
}
|
|
167
170
|
|
|
168
171
|
return lastStepUnifies;
|
|
@@ -171,33 +174,32 @@ export default define(class SubproofAssertion extends Assertion {
|
|
|
171
174
|
unifyDeduction(deduction, generalContext, specificContext) {
|
|
172
175
|
let deductionUnifies = false;
|
|
173
176
|
|
|
174
|
-
const
|
|
177
|
+
const context = specificContext, ///
|
|
178
|
+
lastStatement = this.getLastStatement(),
|
|
175
179
|
deductionString = deduction.getString(),
|
|
176
|
-
|
|
177
|
-
lastStatementString = lastStatement.getString(),
|
|
178
|
-
subproofAssertionString = this.getString(), ///
|
|
179
|
-
deductionStatementString = deductionStatement.getString();
|
|
180
|
-
|
|
181
|
-
let context;
|
|
180
|
+
lastStatementString = lastStatement.getString();
|
|
182
181
|
|
|
183
|
-
context
|
|
182
|
+
context.trace(`Unifying the '${deductionString}' deduction with the '${lastStatementString}' last statement...`)
|
|
184
183
|
|
|
185
|
-
|
|
184
|
+
const deductionContext = deduction.getContext(),
|
|
185
|
+
deductionStatement = deduction.getStatement();
|
|
186
186
|
|
|
187
|
-
|
|
187
|
+
specificContext = deductionContext; ///
|
|
188
188
|
|
|
189
|
-
specificContext
|
|
189
|
+
join((specificContext) => {
|
|
190
|
+
reconcile((specificContext) => {
|
|
191
|
+
const deductionStatementUnifies = lastStatement.unifyStatement(deductionStatement, generalContext, specificContext);
|
|
190
192
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
+
if (deductionStatementUnifies) {
|
|
194
|
+
specificContext.commit(context);
|
|
193
195
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
}
|
|
197
|
-
}, specificContext);
|
|
196
|
+
deductionUnifies = true;
|
|
197
|
+
}
|
|
198
|
+
}, specificContext);
|
|
199
|
+
}, specificContext, context);
|
|
198
200
|
|
|
199
201
|
if (deductionUnifies) {
|
|
200
|
-
context.debug(`...unified the '${deductionString}' deduction
|
|
202
|
+
context.debug(`...unified the '${deductionString}' deduction with the '${lastStatementString}' last statement.`)
|
|
201
203
|
}
|
|
202
204
|
|
|
203
205
|
return deductionUnifies;
|
|
@@ -206,33 +208,32 @@ export default define(class SubproofAssertion extends Assertion {
|
|
|
206
208
|
unifySupposition(supposition, index, generalContext, specificContext) {
|
|
207
209
|
let suppositionUnifies = false;
|
|
208
210
|
|
|
209
|
-
const
|
|
211
|
+
const context = specificContext, ///
|
|
212
|
+
supposedStatement = this.getSupposedStatement(index),
|
|
210
213
|
suppositionString = supposition.getString(),
|
|
211
|
-
|
|
212
|
-
subproofAssertionString = this.getString(), ///
|
|
213
|
-
supposedStatementString = supposedStatement.getString(),
|
|
214
|
-
suppositionStatementString = suppositionStatement.getString(); ///
|
|
215
|
-
|
|
216
|
-
let context;
|
|
214
|
+
supposedStatementString = supposedStatement.getString();
|
|
217
215
|
|
|
218
|
-
context
|
|
216
|
+
context.trace(`Unifying the '${suppositionString}' supposition with the '${supposedStatementString}' supposed statement...`)
|
|
219
217
|
|
|
220
|
-
|
|
218
|
+
const suppositionContext = supposition.getContext(),
|
|
219
|
+
suppositionStatement = supposition.getStatement();
|
|
221
220
|
|
|
222
|
-
|
|
221
|
+
specificContext = suppositionContext; ///
|
|
223
222
|
|
|
224
|
-
specificContext
|
|
223
|
+
join((specificContext) => {
|
|
224
|
+
reconcile((specificContext) => {
|
|
225
|
+
const suppositionStatementUnifies = supposedStatement.unifyStatement(suppositionStatement, generalContext, specificContext);
|
|
225
226
|
|
|
226
|
-
|
|
227
|
-
|
|
227
|
+
if (suppositionStatementUnifies) {
|
|
228
|
+
specificContext.commit(context);
|
|
228
229
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
}
|
|
232
|
-
}, specificContext);
|
|
230
|
+
suppositionUnifies = true;
|
|
231
|
+
}
|
|
232
|
+
}, specificContext);
|
|
233
|
+
}, specificContext, context);
|
|
233
234
|
|
|
234
235
|
if (suppositionUnifies) {
|
|
235
|
-
context.debug(`...unified the '${suppositionString}' supposition
|
|
236
|
+
context.debug(`...unified the '${suppositionString}' supposition with the '${supposedStatementString}' supposed statement.`)
|
|
236
237
|
}
|
|
237
238
|
|
|
238
239
|
return suppositionUnifies;
|
|
@@ -267,17 +268,21 @@ export default define(class SubproofAssertion extends Assertion {
|
|
|
267
268
|
|
|
268
269
|
context.trace(`Unifying the '${topLevelMetaAssertionString}' top level meta-assertion with the '${subproofAssertionString}' subproof assertion...`);
|
|
269
270
|
|
|
270
|
-
|
|
271
|
-
|
|
271
|
+
reconcile((specificContext) => {
|
|
272
|
+
const deduction = topLevelMetaAssertion.getDeduction(),
|
|
273
|
+
deductionUnifies = this.unifyDeduction(deduction, generalContext, specificContext);
|
|
272
274
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
275
|
+
if (deductionUnifies) {
|
|
276
|
+
const suppositions = topLevelMetaAssertion.getSuppositions(),
|
|
277
|
+
suppositionsUnify = this.unifySuppositions(suppositions, generalContext, specificContext);
|
|
276
278
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
+
if (suppositionsUnify) {
|
|
280
|
+
specificContext.commit();
|
|
281
|
+
|
|
282
|
+
topLevelMetaAssertionUnifies = true;
|
|
283
|
+
}
|
|
279
284
|
}
|
|
280
|
-
}
|
|
285
|
+
}, specificContext);
|
|
281
286
|
|
|
282
287
|
if (topLevelMetaAssertionUnifies) {
|
|
283
288
|
context.debug(`...unified the '${topLevelMetaAssertionString}' top level meta-assertion with the '${subproofAssertionString}' subproof assertion.`);
|
|
@@ -294,7 +299,7 @@ export default define(class SubproofAssertion extends Assertion {
|
|
|
294
299
|
const { name } = json;
|
|
295
300
|
|
|
296
301
|
if (this.name === name) {
|
|
297
|
-
instantiate((context) => {
|
|
302
|
+
subproorAssertion = instantiate((context) => {
|
|
298
303
|
const { string } = json,
|
|
299
304
|
subproofAssertionNode = instantiateSubproofAssertion(string, context),
|
|
300
305
|
statements = statementsFromSubproofAssertionNode(subproofAssertionNode, context),
|
|
@@ -302,7 +307,9 @@ export default define(class SubproofAssertion extends Assertion {
|
|
|
302
307
|
|
|
303
308
|
context = null;
|
|
304
309
|
|
|
305
|
-
subproorAssertion = new SubproofAssertion(context, string, node, statements);
|
|
310
|
+
const subproorAssertion = new SubproofAssertion(context, string, node, statements);
|
|
311
|
+
|
|
312
|
+
return subproorAssertion;
|
|
306
313
|
}, context);
|
|
307
314
|
}
|
|
308
315
|
|
|
@@ -214,7 +214,7 @@ export default define(class TypeAssertion extends Assertion {
|
|
|
214
214
|
const { name } = json;
|
|
215
215
|
|
|
216
216
|
if (this.name === name) {
|
|
217
|
-
instantiate((context) => {
|
|
217
|
+
typeAssertion = instantiate((context) => {
|
|
218
218
|
const { string } = json,
|
|
219
219
|
typeAssertionNode = instantiateTypeAssertion(string, context),
|
|
220
220
|
term = termFromTypeAssertionNode(typeAssertionNode, context),
|
|
@@ -223,7 +223,9 @@ export default define(class TypeAssertion extends Assertion {
|
|
|
223
223
|
|
|
224
224
|
context = null;
|
|
225
225
|
|
|
226
|
-
typeAssertion = new TypeAssertion(context, string, node, term, type);
|
|
226
|
+
const typeAssertion = new TypeAssertion(context, string, node, term, type);
|
|
227
|
+
|
|
228
|
+
return typeAssertion;
|
|
227
229
|
}, context);
|
|
228
230
|
}
|
|
229
231
|
|
|
@@ -128,7 +128,7 @@ export default define(class Combinator extends Element {
|
|
|
128
128
|
|
|
129
129
|
context = ephemeralContext; ///
|
|
130
130
|
|
|
131
|
-
|
|
131
|
+
return instantiate((context) => {
|
|
132
132
|
const { string } = json,
|
|
133
133
|
combinatorNode = instantiateCombinator(string, context),
|
|
134
134
|
node = combinatorNode, ///
|
|
@@ -137,7 +137,5 @@ export default define(class Combinator extends Element {
|
|
|
137
137
|
|
|
138
138
|
return combinator;
|
|
139
139
|
}, context);
|
|
140
|
-
|
|
141
|
-
return combinator;
|
|
142
140
|
}
|
|
143
141
|
});
|
|
@@ -150,7 +150,7 @@ export default define(class Conclusion extends Element {
|
|
|
150
150
|
|
|
151
151
|
context = ephemeralContext; ///
|
|
152
152
|
|
|
153
|
-
|
|
153
|
+
return instantiate((context) => {
|
|
154
154
|
const { string } = json,
|
|
155
155
|
conclusionNode = instantiateConclusion(string, context),
|
|
156
156
|
node = conclusionNode, ///
|
|
@@ -159,7 +159,5 @@ export default define(class Conclusion extends Element {
|
|
|
159
159
|
|
|
160
160
|
return conclusion;
|
|
161
161
|
}, context);
|
|
162
|
-
|
|
163
|
-
return conclusion;
|
|
164
162
|
}
|
|
165
163
|
});
|
|
@@ -173,7 +173,7 @@ export default define(class Constructor extends Element {
|
|
|
173
173
|
|
|
174
174
|
context = ephemeralContext; ///
|
|
175
175
|
|
|
176
|
-
|
|
176
|
+
return instantiate((context) => {
|
|
177
177
|
const { string } = json,
|
|
178
178
|
constructorNode = instantiateConstructor(string, context),
|
|
179
179
|
node = constructorNode, ///
|
|
@@ -183,7 +183,5 @@ export default define(class Constructor extends Element {
|
|
|
183
183
|
|
|
184
184
|
return constructor;
|
|
185
185
|
}, context);
|
|
186
|
-
|
|
187
|
-
return constructor;
|
|
188
186
|
}
|
|
189
187
|
});
|
package/src/element/deduction.js
CHANGED
|
@@ -175,7 +175,7 @@ export default define(class Deduction extends Element {
|
|
|
175
175
|
|
|
176
176
|
context = ephemeralContext; ///
|
|
177
177
|
|
|
178
|
-
|
|
178
|
+
return instantiate((context) => {
|
|
179
179
|
const { string } = json,
|
|
180
180
|
deductionNode = instantiateDeduction(string, context),
|
|
181
181
|
node = deductionNode, ///
|
|
@@ -184,7 +184,5 @@ export default define(class Deduction extends Element {
|
|
|
184
184
|
|
|
185
185
|
return deduction;
|
|
186
186
|
}, context);
|
|
187
|
-
|
|
188
|
-
return deduction;
|
|
189
187
|
}
|
|
190
188
|
});
|
package/src/element/equality.js
CHANGED
|
@@ -280,7 +280,7 @@ export default define(class Equality extends Element {
|
|
|
280
280
|
}
|
|
281
281
|
|
|
282
282
|
static fromJSON(json, context) {
|
|
283
|
-
|
|
283
|
+
return instantiate((context) => {
|
|
284
284
|
const { string } = json,
|
|
285
285
|
equalityNode = instantiateEquality(string, context),
|
|
286
286
|
node = equalityNode, ///
|
|
@@ -293,8 +293,6 @@ export default define(class Equality extends Element {
|
|
|
293
293
|
|
|
294
294
|
return equality;
|
|
295
295
|
}, context);
|
|
296
|
-
|
|
297
|
-
return equality;
|
|
298
296
|
}
|
|
299
297
|
});
|
|
300
298
|
|
package/src/element/frame.js
CHANGED
|
@@ -343,7 +343,7 @@ export default define(class Frame extends Element {
|
|
|
343
343
|
static name = "Frame";
|
|
344
344
|
|
|
345
345
|
static fromJSON(json, context) {
|
|
346
|
-
|
|
346
|
+
return instantiate((context) => {
|
|
347
347
|
const { string } = json,
|
|
348
348
|
frameNode = instantiateFrame(string, context),
|
|
349
349
|
node = frameNode, ///
|
|
@@ -356,8 +356,6 @@ export default define(class Frame extends Element {
|
|
|
356
356
|
|
|
357
357
|
return frame;
|
|
358
358
|
}, context);
|
|
359
|
-
|
|
360
|
-
return frame;
|
|
361
359
|
}
|
|
362
360
|
});
|
|
363
361
|
|
|
@@ -100,7 +100,7 @@ export default define(class Hypothesis extends Element {
|
|
|
100
100
|
static name = "Hypothesis";
|
|
101
101
|
|
|
102
102
|
static fromJSON(json, context) {
|
|
103
|
-
|
|
103
|
+
return instantiate((context) => {
|
|
104
104
|
const { string } = json,
|
|
105
105
|
hypothesisNode = instantiateHypothesis(string, context),
|
|
106
106
|
node = hypothesisNode, ///
|
|
@@ -112,7 +112,5 @@ export default define(class Hypothesis extends Element {
|
|
|
112
112
|
|
|
113
113
|
return hypothesis;
|
|
114
114
|
}, context);
|
|
115
|
-
|
|
116
|
-
return hypothesis;
|
|
117
115
|
}
|
|
118
116
|
});
|
package/src/element/judgement.js
CHANGED
|
@@ -218,7 +218,7 @@ export default define(class Judgement extends Element {
|
|
|
218
218
|
static name = "Judgement";
|
|
219
219
|
|
|
220
220
|
static fromJSON(json, context) {
|
|
221
|
-
|
|
221
|
+
return instantiate((context) => {
|
|
222
222
|
const { string } = json,
|
|
223
223
|
judgementNode = instantiateJudgement(string, context),
|
|
224
224
|
node = judgementNode, ///
|
|
@@ -231,8 +231,6 @@ export default define(class Judgement extends Element {
|
|
|
231
231
|
|
|
232
232
|
return judgement;
|
|
233
233
|
}, context);
|
|
234
|
-
|
|
235
|
-
return judgement;
|
|
236
234
|
}
|
|
237
235
|
});
|
|
238
236
|
|
package/src/element/label.js
CHANGED
|
@@ -153,7 +153,7 @@ export default define(class Label extends Element {
|
|
|
153
153
|
|
|
154
154
|
context = ephemeralContext; ///
|
|
155
155
|
|
|
156
|
-
|
|
156
|
+
return instantiate((context) => {
|
|
157
157
|
const { string } = json,
|
|
158
158
|
labelNode = instantiateLabel(string, context),
|
|
159
159
|
metavariable = metavariableFromLabelNode(labelNode, context),
|
|
@@ -162,7 +162,5 @@ export default define(class Label extends Element {
|
|
|
162
162
|
|
|
163
163
|
return label;
|
|
164
164
|
}, context);
|
|
165
|
-
|
|
166
|
-
return label;
|
|
167
165
|
}
|
|
168
166
|
});
|
|
@@ -305,19 +305,13 @@ export default define(class Metavariable extends Element {
|
|
|
305
305
|
frameUnifies = true;
|
|
306
306
|
}
|
|
307
307
|
} else {
|
|
308
|
-
const { FrameSubstitution } = elements
|
|
308
|
+
const { FrameSubstitution } = elements,
|
|
309
|
+
metavariable = this, ///
|
|
310
|
+
frameSubstitution = FrameSubstitution.fromFrameAndMetavariable(frame, metavariable, context);
|
|
309
311
|
|
|
310
|
-
|
|
312
|
+
frameSubstitution.validate(generalContext, specificContext);
|
|
311
313
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
frameSubstitution = FrameSubstitution.fromFrameAndMetavariable(frame, metavariable, context);
|
|
315
|
-
|
|
316
|
-
frameSubstitution = frameSubstitution.validate(generalContext, specificContext);
|
|
317
|
-
|
|
318
|
-
if (frameSubstitution !== null) {
|
|
319
|
-
frameUnifies = true;
|
|
320
|
-
}
|
|
314
|
+
frameUnifies = true;
|
|
321
315
|
}
|
|
322
316
|
}
|
|
323
317
|
|
|
@@ -367,13 +361,10 @@ export default define(class Metavariable extends Element {
|
|
|
367
361
|
statementUnifies = true;
|
|
368
362
|
}
|
|
369
363
|
} else {
|
|
370
|
-
const { StatementSubstitution } = elements
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
statementSubstitution = (substitution !== null) ?
|
|
375
|
-
StatementSubstitution.fromStatementMetavariableAndSubstitution(statement, metavariable, substitution, context) :
|
|
376
|
-
StatementSubstitution.fromStatementAndMetavariable(statement, metavariable, context);
|
|
364
|
+
const { StatementSubstitution } = elements,
|
|
365
|
+
statementSubstitution = (substitution !== null) ?
|
|
366
|
+
StatementSubstitution.fromStatementMetavariableAndSubstitution(statement, metavariable, substitution, context) :
|
|
367
|
+
StatementSubstitution.fromStatementAndMetavariable(statement, metavariable, context);
|
|
377
368
|
|
|
378
369
|
if (substitution !== null) {
|
|
379
370
|
const context = generalContext; ///
|
|
@@ -383,11 +374,9 @@ export default define(class Metavariable extends Element {
|
|
|
383
374
|
substitution.setContext(context);
|
|
384
375
|
}
|
|
385
376
|
|
|
386
|
-
statementSubstitution
|
|
377
|
+
statementSubstitution.validate(generalContext, specificContext);
|
|
387
378
|
|
|
388
|
-
|
|
389
|
-
statementUnifies = true;
|
|
390
|
-
}
|
|
379
|
+
statementUnifies = true;
|
|
391
380
|
}
|
|
392
381
|
}
|
|
393
382
|
|
|
@@ -429,19 +418,13 @@ export default define(class Metavariable extends Element {
|
|
|
429
418
|
referenceUnifies = true;
|
|
430
419
|
}
|
|
431
420
|
} else {
|
|
432
|
-
const { ReferenceSubstitution } = elements
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
const metavariable = this;
|
|
437
|
-
|
|
438
|
-
referenceSubstitution = ReferenceSubstitution.fromReferenceAndMetavariable(reference, metavariable, context);
|
|
421
|
+
const { ReferenceSubstitution } = elements,
|
|
422
|
+
metavariable = this, ///
|
|
423
|
+
referenceSubstitution = ReferenceSubstitution.fromReferenceAndMetavariable(reference, metavariable, context);
|
|
439
424
|
|
|
440
|
-
referenceSubstitution
|
|
425
|
+
referenceSubstitution.validate(generalContext, specificContext);
|
|
441
426
|
|
|
442
|
-
|
|
443
|
-
referenceUnifies = true;
|
|
444
|
-
}
|
|
427
|
+
referenceUnifies = true;
|
|
445
428
|
}
|
|
446
429
|
}
|
|
447
430
|
|
|
@@ -609,7 +592,7 @@ export default define(class Metavariable extends Element {
|
|
|
609
592
|
static name = "Metavariable";
|
|
610
593
|
|
|
611
594
|
static fromJSON(json, context) {
|
|
612
|
-
|
|
595
|
+
return instantiate((context) => {
|
|
613
596
|
const { string } = json,
|
|
614
597
|
metavariableNode = instantiateMetavariable(string, context),
|
|
615
598
|
node = metavariableNode, ///
|
|
@@ -621,7 +604,5 @@ export default define(class Metavariable extends Element {
|
|
|
621
604
|
|
|
622
605
|
return metavariable;
|
|
623
606
|
}, context);
|
|
624
|
-
|
|
625
|
-
return metavariable;
|
|
626
607
|
}
|
|
627
608
|
});
|
package/src/element/parameter.js
CHANGED
|
@@ -61,7 +61,7 @@ export default define(class Parameter extends Element {
|
|
|
61
61
|
static name = "Parameter";
|
|
62
62
|
|
|
63
63
|
static fromJSON(json, context) {
|
|
64
|
-
|
|
64
|
+
return instantiate((context) => {
|
|
65
65
|
const { string } = json,
|
|
66
66
|
parameterNode = instantiateParameter(string, context),
|
|
67
67
|
node = parameterNode, ///
|
|
@@ -74,7 +74,5 @@ export default define(class Parameter extends Element {
|
|
|
74
74
|
|
|
75
75
|
return parameter;
|
|
76
76
|
}, context);
|
|
77
|
-
|
|
78
|
-
return parameter;
|
|
79
77
|
}
|
|
80
78
|
});
|
|
@@ -125,7 +125,7 @@ export default define(class ProcedureCall extends Element {
|
|
|
125
125
|
static name = "ProcedureCall";
|
|
126
126
|
|
|
127
127
|
static fromJSON(json, context) {
|
|
128
|
-
|
|
128
|
+
return instantiate((context) => {
|
|
129
129
|
const { string } = json,
|
|
130
130
|
procedureCallNode = instantiateProcedureCall(string, context),
|
|
131
131
|
node = procedureCallNode, ///
|
|
@@ -138,7 +138,5 @@ export default define(class ProcedureCall extends Element {
|
|
|
138
138
|
|
|
139
139
|
return procedureCall;
|
|
140
140
|
}, context);
|
|
141
|
-
|
|
142
|
-
return procedureCall;
|
|
143
141
|
}
|
|
144
142
|
});
|
|
@@ -43,7 +43,7 @@ export default define(class ProcedureReference extends Element {
|
|
|
43
43
|
static name = "ProcedureReference";
|
|
44
44
|
|
|
45
45
|
static fromJSON(json, context) {
|
|
46
|
-
|
|
46
|
+
return instantiate((context) => {
|
|
47
47
|
const { string } = json,
|
|
48
48
|
procedureReferenceNode = instantiateProcedureReference(string, context),
|
|
49
49
|
node = procedureReferenceNode, ///
|
|
@@ -55,7 +55,5 @@ export default define(class ProcedureReference extends Element {
|
|
|
55
55
|
|
|
56
56
|
return procedureReference;
|
|
57
57
|
}, context);
|
|
58
|
-
|
|
59
|
-
return procedureReference;
|
|
60
58
|
}
|
|
61
59
|
});
|
|
@@ -5,7 +5,7 @@ import ProofAssertion from "../proofAssertion";
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
6
|
import { instantiatePremise } from "../../process/instantiate";
|
|
7
7
|
import { procedureCallFromPremiseNode } from "../../utilities/element";
|
|
8
|
-
import { attempt, reconcile, instantiate } from "../../utilities/context";
|
|
8
|
+
import { join, attempt, reconcile, instantiate } from "../../utilities/context";
|
|
9
9
|
import { ephemeralContextFromJSON, ephemeralContextToEphemeralContextJSON } from "../../utilities/json";
|
|
10
10
|
|
|
11
11
|
export default define(class Premise extends ProofAssertion {
|
|
@@ -169,16 +169,18 @@ export default define(class Premise extends ProofAssertion {
|
|
|
169
169
|
generalContext = premiseContext, ///
|
|
170
170
|
specificContext = proofAssertionContext; ///
|
|
171
171
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
172
|
+
join((specificContext) => {
|
|
173
|
+
reconcile((specificContext) => {
|
|
174
|
+
const statement = proofAssertion.getStatement(),
|
|
175
|
+
statementUnifies = this.unifyStatement(statement, generalContext, specificContext);
|
|
175
176
|
|
|
176
|
-
|
|
177
|
-
|
|
177
|
+
if (statementUnifies) {
|
|
178
|
+
specificContext.commit(context);
|
|
178
179
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
180
|
+
proofAssertionUnifies = true;
|
|
181
|
+
}
|
|
182
|
+
}, specificContext);
|
|
183
|
+
}, specificContext, context);
|
|
182
184
|
|
|
183
185
|
if (proofAssertionUnifies) {
|
|
184
186
|
context.debug(`...unified the '${proofAssertionString}' proof assertion with the '${premiseString}' premise.`);
|
|
@@ -290,7 +292,7 @@ export default define(class Premise extends ProofAssertion {
|
|
|
290
292
|
|
|
291
293
|
context = ephemeralContext; ///
|
|
292
294
|
|
|
293
|
-
|
|
295
|
+
return instantiate((context) => {
|
|
294
296
|
const { string } = json,
|
|
295
297
|
premiseNode = instantiatePremise(string, context),
|
|
296
298
|
node = premiseNode, ///
|
|
@@ -300,8 +302,6 @@ export default define(class Premise extends ProofAssertion {
|
|
|
300
302
|
|
|
301
303
|
return premise;
|
|
302
304
|
}, context);
|
|
303
|
-
|
|
304
|
-
return premise;
|
|
305
305
|
}
|
|
306
306
|
});
|
|
307
307
|
|
|
@@ -190,17 +190,19 @@ export default define(class Step extends ProofAssertion {
|
|
|
190
190
|
reference = this.getReference(),
|
|
191
191
|
satisfiesAssertion = this.getSatisfiesAssertion();
|
|
192
192
|
|
|
193
|
-
await
|
|
194
|
-
|
|
195
|
-
const statementUnifies = await unifyStatement(statement, reference, satisfiesAssertion, context);
|
|
193
|
+
await asyncSome(unifyStatements, async (unifyStatement) => {
|
|
194
|
+
let statementUnifies;
|
|
196
195
|
|
|
197
|
-
|
|
198
|
-
|
|
196
|
+
await asyncReconcile(async (context) => {
|
|
197
|
+
statementUnifies = await unifyStatement(statement, reference, satisfiesAssertion, context);
|
|
198
|
+
}, context);
|
|
199
199
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
200
|
+
if (statementUnifies) {
|
|
201
|
+
unifies = true;
|
|
202
|
+
|
|
203
|
+
return true;
|
|
204
|
+
}
|
|
205
|
+
});
|
|
204
206
|
|
|
205
207
|
if (unifies) {
|
|
206
208
|
context.debug(`...unified the '${stepString}' step.`);
|