occam-verify-cli 1.0.956 → 1.0.973
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/bounded.js +11 -7
- package/lib/context.js +17 -5
- package/lib/element/assertion/signature.js +17 -19
- package/lib/element/assertion/subproof.js +36 -39
- package/lib/element/assertion/type.js +20 -1
- package/lib/element/assumption/metaLevel.js +18 -17
- package/lib/element/assumption.js +52 -3
- package/lib/element/combinator.js +10 -12
- package/lib/element/conclusion.js +33 -33
- package/lib/element/constructor.js +7 -11
- package/lib/element/deduction.js +33 -33
- package/lib/element/equivalence.js +11 -7
- package/lib/element/hypothesis.js +45 -19
- package/lib/element/judgement.js +1 -1
- package/lib/element/label.js +9 -11
- package/lib/element/proofAssertion/premise.js +98 -87
- package/lib/element/proofAssertion/step.js +27 -27
- package/lib/element/proofAssertion/supposition.js +99 -88
- package/lib/element/proofAssertion.js +3 -3
- package/lib/element/reference.js +30 -38
- package/lib/element/signature.js +38 -47
- package/lib/element/statement.js +18 -58
- package/lib/element/substitution/frame.js +34 -42
- package/lib/element/substitution/reference.js +12 -13
- package/lib/element/substitution/statement.js +26 -31
- package/lib/element/substitution/term.js +32 -37
- package/lib/element/term.js +2 -2
- package/lib/element/topLevelAssertion/axiom.js +33 -34
- package/lib/element/topLevelAssertion.js +30 -7
- package/lib/element/topLevelMetaAssertion.js +2 -2
- package/lib/process/discharge.js +38 -0
- package/lib/process/unification.js +228 -0
- package/lib/process/unify.js +9 -5
- package/lib/process/validation.js +291 -0
- package/lib/utilities/context.js +69 -105
- package/lib/utilities/element.js +2 -4
- package/lib/utilities/string.js +4 -4
- package/package.json +1 -1
- package/src/context/bounded.js +19 -7
- package/src/context.js +26 -6
- package/src/element/assertion/signature.js +21 -26
- package/src/element/assertion/subproof.js +43 -45
- package/src/element/assertion/type.js +30 -1
- package/src/element/assumption/metaLevel.js +26 -22
- package/src/element/assumption.js +80 -2
- package/src/element/combinator.js +11 -14
- package/src/element/conclusion.js +38 -37
- package/src/element/constructor.js +8 -13
- package/src/element/deduction.js +38 -37
- package/src/element/equivalence.js +17 -13
- package/src/element/hypothesis.js +59 -19
- package/src/element/judgement.js +1 -1
- package/src/element/label.js +10 -12
- package/src/element/proofAssertion/premise.js +123 -107
- package/src/element/proofAssertion/step.js +29 -29
- package/src/element/proofAssertion/supposition.js +124 -108
- package/src/element/proofAssertion.js +2 -2
- package/src/element/reference.js +36 -47
- package/src/element/signature.js +42 -53
- package/src/element/statement.js +18 -89
- package/src/element/substitution/frame.js +45 -58
- package/src/element/substitution/reference.js +13 -16
- package/src/element/substitution/statement.js +27 -34
- package/src/element/substitution/term.js +37 -46
- package/src/element/term.js +1 -1
- package/src/element/topLevelAssertion/axiom.js +43 -45
- package/src/element/topLevelAssertion.js +42 -6
- package/src/element/topLevelMetaAssertion.js +2 -2
- package/src/process/discharge.js +33 -0
- package/src/{utilities → process}/unification.js +21 -27
- package/src/process/unify.js +9 -5
- package/src/{utilities → process}/validation.js +2 -2
- package/src/utilities/context.js +77 -128
- package/src/utilities/element.js +2 -5
- package/src/utilities/string.js +6 -6
- package/lib/context/ephemeral.js +0 -28
- package/lib/context/synoptic.js +0 -255
- package/lib/utilities/unification.js +0 -233
- package/lib/utilities/validation.js +0 -291
- package/src/context/ephemeral.js +0 -17
- package/src/context/synoptic.js +0 -361
|
@@ -7,7 +7,7 @@ import { breakPointFromJSON } from "../../utilities/breakPoint";
|
|
|
7
7
|
import { stripBracketsFromStatement } from "../../utilities/brackets";
|
|
8
8
|
import { instantiateStatementSubstitution } from "../../process/instantiate";
|
|
9
9
|
import { statementSubstitutionFromStatementSubstitutionNode } from "../../utilities/element";
|
|
10
|
-
import {
|
|
10
|
+
import { elide, ablates, manifest, attempts, reconcile, instantiate, unserialises } from "../../utilities/context";
|
|
11
11
|
import { statementSubstitutionStringFromStatementAndMetavariable, statementSubstitutionStringFromStatementMetavariableAndSubstitution } from "../../utilities/string";
|
|
12
12
|
|
|
13
13
|
export default define(class StatementSubstitution extends Substitution {
|
|
@@ -173,7 +173,7 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
173
173
|
|
|
174
174
|
if (targetStatementSingular) {
|
|
175
175
|
manifest((context) => {
|
|
176
|
-
|
|
176
|
+
elide((context) => {
|
|
177
177
|
const targetStatement = this.targetStatement.validate(context);
|
|
178
178
|
|
|
179
179
|
if (targetStatement !== null) {
|
|
@@ -202,7 +202,7 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
202
202
|
|
|
203
203
|
context.trace(`Validating the '${statementSubstitutionString}' statement substitution's replacement statement...`);
|
|
204
204
|
|
|
205
|
-
|
|
205
|
+
elide((context) => {
|
|
206
206
|
const replacementStatement = this.replacementStatement.validate(context);
|
|
207
207
|
|
|
208
208
|
if (replacementStatement !== null) {
|
|
@@ -236,17 +236,15 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
236
236
|
generalStatement = generalSubstitutionTargetStatement, ///
|
|
237
237
|
specificStatement = specificSubstitutionTargetStatement; ///
|
|
238
238
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
const statementUnifies = generalStatement.unifyStatement(specificStatement, generalContext, specificContext);
|
|
239
|
+
reconcile((specificContext) => {
|
|
240
|
+
const statementUnifies = generalStatement.unifyStatement(specificStatement, generalContext, specificContext);
|
|
242
241
|
|
|
243
|
-
|
|
244
|
-
|
|
242
|
+
if (statementUnifies) {
|
|
243
|
+
specificContext.commit(context);
|
|
245
244
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
}, specificContext, context);
|
|
245
|
+
targetStatemnentUnifies = true;
|
|
246
|
+
}
|
|
247
|
+
}, specificContext);
|
|
250
248
|
|
|
251
249
|
if (targetStatemnentUnifies) {
|
|
252
250
|
context.trace(`...unified the '${specificSubstitutionString}' substitution's target statement with the '${generalSubstitutionString}' substitution's target statement.`);
|
|
@@ -274,17 +272,15 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
274
272
|
generalStatement = generalSubstitutionReplacementStatement, ///
|
|
275
273
|
specificStatement = specificSubstitutionReplacementStatement; ///
|
|
276
274
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
const statementUnifies = generalStatement.unifyStatement(specificStatement, generalContext, specificContext);
|
|
275
|
+
reconcile((specificContext) => {
|
|
276
|
+
const statementUnifies = generalStatement.unifyStatement(specificStatement, generalContext, specificContext);
|
|
280
277
|
|
|
281
|
-
|
|
282
|
-
|
|
278
|
+
if (statementUnifies) {
|
|
279
|
+
specificContext.commit(context);
|
|
283
280
|
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
}, specificContext, context);
|
|
281
|
+
replacementStatemnentUnifies = true;
|
|
282
|
+
}
|
|
283
|
+
}, specificContext);
|
|
288
284
|
|
|
289
285
|
if (replacementStatemnentUnifies) {
|
|
290
286
|
context.trace(`...unified the '${specificSubstitutionString}' substitution's replacement statement with the '${generalSubstitutionString}' substitution's replacement statement.`);
|
|
@@ -358,27 +354,24 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
358
354
|
const { name } = json;
|
|
359
355
|
|
|
360
356
|
if (this.name === name) {
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
instantiate((context) => {
|
|
357
|
+
instantiate((context) => {
|
|
358
|
+
unserialises((json, generalContext, specificContext) => {
|
|
365
359
|
const { string } = json,
|
|
366
360
|
statementSubstitutionNode = instantiateStatementSubstitution(string, context),
|
|
367
361
|
node = statementSubstitutionNode, ///
|
|
368
362
|
breakPoint = breakPointFromJSON(json),
|
|
369
363
|
resolved = resolvedFromStatementSubstitutionNode(statementSubstitutionNode, context),
|
|
370
364
|
substitution = substitutionFromStatementSubstitutionNode(statementSubstitutionNode, generalContext, specificContext),
|
|
371
|
-
targetStatement = targetStatementFromStatementSubstitutionNode(statementSubstitutionNode,
|
|
372
|
-
replacementStatement = replacementStatementFromStatementSubstitutionNode(statementSubstitutionNode,
|
|
373
|
-
specificContext = context, ///
|
|
365
|
+
targetStatement = targetStatementFromStatementSubstitutionNode(statementSubstitutionNode, generalContext),
|
|
366
|
+
replacementStatement = replacementStatementFromStatementSubstitutionNode(statementSubstitutionNode, specificContext),
|
|
374
367
|
contexts = [
|
|
375
368
|
generalContext,
|
|
376
369
|
specificContext
|
|
377
370
|
];
|
|
378
371
|
|
|
379
372
|
statementSubstitutionn = new StatementSubstitution(contexts, string, node, breakPoint, resolved, substitution, targetStatement, replacementStatement);
|
|
380
|
-
}, context);
|
|
381
|
-
},
|
|
373
|
+
}, json, context);
|
|
374
|
+
}, context);
|
|
382
375
|
}
|
|
383
376
|
|
|
384
377
|
return statementSubstitutionn;
|
|
@@ -444,16 +437,16 @@ function substitutionFromStatementSubstitutionNode(statementSubstitutionNode, co
|
|
|
444
437
|
return substitution;
|
|
445
438
|
}
|
|
446
439
|
|
|
447
|
-
function targetStatementFromStatementSubstitutionNode(statementSubstitutionNode,
|
|
440
|
+
function targetStatementFromStatementSubstitutionNode(statementSubstitutionNode, generalContext) {
|
|
448
441
|
const targetStatementNode = statementSubstitutionNode.getTargetStatementNode(),
|
|
449
|
-
targetStatement =
|
|
442
|
+
targetStatement = generalContext.findStatementByStatementNode(targetStatementNode);
|
|
450
443
|
|
|
451
444
|
return targetStatement;
|
|
452
445
|
}
|
|
453
446
|
|
|
454
|
-
function replacementStatementFromStatementSubstitutionNode(statementSubstitutionNode,
|
|
447
|
+
function replacementStatementFromStatementSubstitutionNode(statementSubstitutionNode, specificContext) {
|
|
455
448
|
const replacementStatementNode = statementSubstitutionNode.getReplacementStatementNode(),
|
|
456
|
-
replacementStatement =
|
|
449
|
+
replacementStatement = specificContext.findStatementByStatementNode(replacementStatementNode);
|
|
457
450
|
|
|
458
451
|
return replacementStatement;
|
|
459
452
|
}
|
|
@@ -8,7 +8,7 @@ import { stripBracketsFromTerm } from "../../utilities/brackets";
|
|
|
8
8
|
import { instantiateTermSubstitution } from "../../process/instantiate";
|
|
9
9
|
import { termSubstitutionFromTermSubstitutionNode } from "../../utilities/element";
|
|
10
10
|
import { termSubstitutionStringFromTermAndVariable } from "../../utilities/string";
|
|
11
|
-
import {
|
|
11
|
+
import { elide, ablate, manifest, attempts, reconcile, ablates, instantiate, unserialises } from "../../utilities/context";
|
|
12
12
|
|
|
13
13
|
export default define(class TermSubstitution extends Substitution {
|
|
14
14
|
constructor(context, string, node, breakPoint, targetTerm, replacementTerm) {
|
|
@@ -139,7 +139,7 @@ export default define(class TermSubstitution extends Substitution {
|
|
|
139
139
|
|
|
140
140
|
if (targetTermSingular) {
|
|
141
141
|
manifest((context) => {
|
|
142
|
-
|
|
142
|
+
elide((context) => {
|
|
143
143
|
const targetTerm = this.targetTerm.validate(context, (targetTerm, context) => {
|
|
144
144
|
const validatesForwards = true;
|
|
145
145
|
|
|
@@ -174,7 +174,7 @@ export default define(class TermSubstitution extends Substitution {
|
|
|
174
174
|
|
|
175
175
|
context.trace(`Validating the '${termSubstitutionString}' term substitution's replacement term...`);
|
|
176
176
|
|
|
177
|
-
|
|
177
|
+
elide((context) => {
|
|
178
178
|
const replacementTerm = this.replacementTerm.validate(context, (replacementTerm, context) => {
|
|
179
179
|
const validatesForwards = true;
|
|
180
180
|
|
|
@@ -245,24 +245,21 @@ export default define(class TermSubstitution extends Substitution {
|
|
|
245
245
|
generalTerm = generalSubstitutionTargetTerm, ///
|
|
246
246
|
specificTerm = specificSubstitutionTargetTerm; ///
|
|
247
247
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
generalVariable = variableFromTermNode(generalTermNode, generalContext);
|
|
248
|
+
reconcile((specificContext) => {
|
|
249
|
+
const termNode = generalTerm.getNode(),
|
|
250
|
+
variable = variableFromTermNode(termNode, generalContext);
|
|
252
251
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
termUnifies = variable.unifyTerm(term, generalContext, specificContext);
|
|
252
|
+
if (variable !== null) {
|
|
253
|
+
const term = specificTerm, ///
|
|
254
|
+
termUnifies = variable.unifyTerm(term, generalContext, specificContext);
|
|
257
255
|
|
|
258
|
-
|
|
259
|
-
|
|
256
|
+
if (termUnifies) {
|
|
257
|
+
specificContext.commit(context);
|
|
260
258
|
|
|
261
|
-
|
|
262
|
-
}
|
|
259
|
+
targetTermUnifies = true;
|
|
263
260
|
}
|
|
264
|
-
}
|
|
265
|
-
}, specificContext
|
|
261
|
+
}
|
|
262
|
+
}, specificContext);
|
|
266
263
|
|
|
267
264
|
if (targetTermUnifies) {
|
|
268
265
|
context.trace(`...unified the '${specificSubstitutionString}' substitution's target term with the '${generalSubstitutionString}' substitution's target term.`);
|
|
@@ -290,24 +287,21 @@ export default define(class TermSubstitution extends Substitution {
|
|
|
290
287
|
generalTerm = generalSubstitutionReplacementTerm, ///
|
|
291
288
|
specificTerm = specificSubstitutionReplacementTerm; ///
|
|
292
289
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
generalVariable = variableFromTermNode(generalTermNode, generalContext);
|
|
290
|
+
reconcile((specificContext) => {
|
|
291
|
+
const termNode = generalTerm.getNode(),
|
|
292
|
+
variable = variableFromTermNode(termNode, generalContext);
|
|
297
293
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
termUnifies = variable.unifyTerm(term, generalContext, specificContext);
|
|
294
|
+
if (variable !== null) {
|
|
295
|
+
const term = specificTerm, ///
|
|
296
|
+
termUnifies = variable.unifyTerm(term, generalContext, specificContext);
|
|
302
297
|
|
|
303
|
-
|
|
304
|
-
|
|
298
|
+
if (termUnifies) {
|
|
299
|
+
specificContext.commit(context);
|
|
305
300
|
|
|
306
|
-
|
|
307
|
-
}
|
|
301
|
+
replacementTermUnifies = true;
|
|
308
302
|
}
|
|
309
|
-
}
|
|
310
|
-
}, specificContext
|
|
303
|
+
}
|
|
304
|
+
}, specificContext);
|
|
311
305
|
|
|
312
306
|
if (replacementTermUnifies) {
|
|
313
307
|
context.trace(`...unified the '${specificSubstitutionString}' substitution's replacement term with the '${generalSubstitutionString}' substitution's replacement term.`);
|
|
@@ -324,25 +318,22 @@ export default define(class TermSubstitution extends Substitution {
|
|
|
324
318
|
const { name } = json;
|
|
325
319
|
|
|
326
320
|
if (this.name === name) {
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
instantiate((context) => {
|
|
321
|
+
instantiate((context) => {
|
|
322
|
+
unserialises((json, generalContext, specificContext) => {
|
|
331
323
|
const { string } = json,
|
|
332
324
|
termSubstitutionNode = instantiateTermSubstitution(string, context),
|
|
333
325
|
node = termSubstitutionNode, ///
|
|
334
326
|
breakPoint = breakPointFromJSON(json),
|
|
335
|
-
targetTerm = targetTermFromTermSubstitutionNode(termSubstitutionNode,
|
|
336
|
-
replacementTerm = replacementTermFromTermSubstitutionNode(termSubstitutionNode,
|
|
337
|
-
specificContext = context, ///
|
|
327
|
+
targetTerm = targetTermFromTermSubstitutionNode(termSubstitutionNode, generalContext),
|
|
328
|
+
replacementTerm = replacementTermFromTermSubstitutionNode(termSubstitutionNode, specificContext),
|
|
338
329
|
contexts = [
|
|
339
330
|
generalContext,
|
|
340
331
|
specificContext
|
|
341
332
|
];
|
|
342
333
|
|
|
343
334
|
termSubstitutionn = new TermSubstitution(contexts, string, node, breakPoint, targetTerm, replacementTerm);
|
|
344
|
-
}, context);
|
|
345
|
-
},
|
|
335
|
+
}, json, context);
|
|
336
|
+
}, context);
|
|
346
337
|
}
|
|
347
338
|
|
|
348
339
|
return termSubstitutionn;
|
|
@@ -389,28 +380,28 @@ export default define(class TermSubstitution extends Substitution {
|
|
|
389
380
|
}
|
|
390
381
|
});
|
|
391
382
|
|
|
392
|
-
function variableFromTermNode(termNode,
|
|
383
|
+
function variableFromTermNode(termNode, generalContext) {
|
|
393
384
|
let variable = null;
|
|
394
385
|
|
|
395
386
|
const variableNode = termNode.getVariableNode();
|
|
396
387
|
|
|
397
388
|
if (variableNode !== null) {
|
|
398
|
-
variable =
|
|
389
|
+
variable = generalContext.findVariableByVariableNode(variableNode);
|
|
399
390
|
}
|
|
400
391
|
|
|
401
392
|
return variable;
|
|
402
393
|
}
|
|
403
394
|
|
|
404
|
-
function targetTermFromTermSubstitutionNode(termSubstitutionNode,
|
|
395
|
+
function targetTermFromTermSubstitutionNode(termSubstitutionNode, generalContext) {
|
|
405
396
|
const targetTermNode = termSubstitutionNode.getTargetTermNode(),
|
|
406
|
-
targetTerm =
|
|
397
|
+
targetTerm = generalContext.findTermByTermNode(targetTermNode);
|
|
407
398
|
|
|
408
399
|
return targetTerm;
|
|
409
400
|
}
|
|
410
401
|
|
|
411
|
-
function replacementTermFromTermSubstitutionNode(termSubstitutionNode,
|
|
402
|
+
function replacementTermFromTermSubstitutionNode(termSubstitutionNode, specificContext) {
|
|
412
403
|
const replacementTermNode = termSubstitutionNode.getReplacementTermNode(),
|
|
413
|
-
replacementTerm =
|
|
404
|
+
replacementTerm = specificContext.findTermByTermNode(replacementTermNode);
|
|
414
405
|
|
|
415
406
|
return replacementTerm;
|
|
416
407
|
}
|
package/src/element/term.js
CHANGED
|
@@ -5,7 +5,7 @@ import { arrayUtilities } from "necessary";
|
|
|
5
5
|
|
|
6
6
|
import { define } from "../elements";
|
|
7
7
|
import { instantiate } from "../utilities/context";
|
|
8
|
-
import { validateTerms } from "../
|
|
8
|
+
import { validateTerms } from "../process/validation";
|
|
9
9
|
import { instantiateTerm } from "../process/instantiate";
|
|
10
10
|
import { variablesFromTerm } from "../utilities/equivalence";
|
|
11
11
|
import { unifyTermIntrinsically } from "../process/unify";
|
|
@@ -5,7 +5,7 @@ import { asynchronousUtilities } from "occam-languages";
|
|
|
5
5
|
import TopLevelAssertion from "../topLevelAssertion";
|
|
6
6
|
|
|
7
7
|
import { define } from "../../elements";
|
|
8
|
-
import {
|
|
8
|
+
import { reconcile } from "../../utilities/context";
|
|
9
9
|
|
|
10
10
|
const { asyncMatch } = asynchronousUtilities;
|
|
11
11
|
|
|
@@ -86,11 +86,9 @@ export default define(class Axiom extends TopLevelAssertion {
|
|
|
86
86
|
|
|
87
87
|
signature = this.getSignature();
|
|
88
88
|
|
|
89
|
-
const generalSignature = signature
|
|
90
|
-
specificContext = context, ///
|
|
91
|
-
generalContext = null;
|
|
89
|
+
const generalSignature = signature; ///
|
|
92
90
|
|
|
93
|
-
signatureUnifies = generalSignature.unifySignature(specificSignature,
|
|
91
|
+
signatureUnifies = generalSignature.unifySignature(specificSignature, context);
|
|
94
92
|
|
|
95
93
|
if (signatureUnifies) {
|
|
96
94
|
context.debug(`...unified the '${signatureString}' signature with the '${axiomString}' axiom.`);
|
|
@@ -112,31 +110,29 @@ export default define(class Axiom extends TopLevelAssertion {
|
|
|
112
110
|
|
|
113
111
|
context.trace(`Unifying the '${specificDeductionString}' deduction with the '${axiomString}' axiom's '${generalDeductionString}' deduction...`);
|
|
114
112
|
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
113
|
+
const generalDeductionContext = generalDeduction.getContext(),
|
|
114
|
+
specificDeductionContext = specificDeduction.getContext(),
|
|
115
|
+
generalContext = generalDeductionContext, ///
|
|
116
|
+
specificContext = specificDeductionContext; ///
|
|
119
117
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
let statement;
|
|
118
|
+
reconcile((specificContext) => {
|
|
119
|
+
let statement;
|
|
123
120
|
|
|
124
|
-
|
|
121
|
+
statement = specificDeduction.getStatement();
|
|
125
122
|
|
|
126
|
-
|
|
123
|
+
const specificStatement = statement; ///
|
|
127
124
|
|
|
128
|
-
|
|
125
|
+
statement = generalDeduction.getStatement();
|
|
129
126
|
|
|
130
|
-
|
|
131
|
-
|
|
127
|
+
const generalStatement = statement, ///
|
|
128
|
+
statementUnifies = generalStatement.unifyStatement(specificStatement, generalContext, specificContext);
|
|
132
129
|
|
|
133
|
-
|
|
134
|
-
|
|
130
|
+
if (statementUnifies) {
|
|
131
|
+
specificContext.commit(context);
|
|
135
132
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}, specificContext, context);
|
|
133
|
+
deductionUnifies = true;
|
|
134
|
+
}
|
|
135
|
+
}, specificContext);
|
|
140
136
|
|
|
141
137
|
if (deductionUnifies) {
|
|
142
138
|
context.debug(`...unified the '${specificDeductionString}' deduction with the '${axiomString}' axiom's '${generalDeductionString}' deduction.`);
|
|
@@ -159,31 +155,29 @@ export default define(class Axiom extends TopLevelAssertion {
|
|
|
159
155
|
|
|
160
156
|
context.trace(`Unifying the '${specificSuppositionString}' supposition with the '${axiomString}' axiom's '${generalSuppositionString}' supposition...`);
|
|
161
157
|
|
|
162
|
-
const
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
158
|
+
const generalSuppositionContext = generalSupposition.getContext(),
|
|
159
|
+
specificSuppositionContext = specificSupposition.getContext(),
|
|
160
|
+
generalContext = generalSuppositionContext, ///
|
|
161
|
+
specificContext = specificSuppositionContext; ///
|
|
166
162
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
let statement;
|
|
163
|
+
reconcile((specificContext) => {
|
|
164
|
+
let statement;
|
|
170
165
|
|
|
171
|
-
|
|
166
|
+
statement = specificSupposition.getStatement();
|
|
172
167
|
|
|
173
|
-
|
|
168
|
+
const specificStatement = statement; ///
|
|
174
169
|
|
|
175
|
-
|
|
170
|
+
statement = generalSupposition.getStatement();
|
|
176
171
|
|
|
177
|
-
|
|
178
|
-
|
|
172
|
+
const generalStatement = statement, ///
|
|
173
|
+
statementUnifies = generalStatement.unifyStatement(specificStatement, generalContext, specificContext);
|
|
179
174
|
|
|
180
|
-
|
|
181
|
-
|
|
175
|
+
if (statementUnifies) {
|
|
176
|
+
specificContext.commit(context);
|
|
182
177
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}, specificContext, context);
|
|
178
|
+
suppositionUnifies = true;
|
|
179
|
+
}
|
|
180
|
+
}, specificContext);
|
|
187
181
|
|
|
188
182
|
if (suppositionUnifies) {
|
|
189
183
|
context.debug(`...unified the '${specificSuppositionString}' supposition with the '${axiomString}' axiom's '${generalSuppositionString}' supposition...`);
|
|
@@ -225,11 +219,15 @@ export default define(class Axiom extends TopLevelAssertion {
|
|
|
225
219
|
deductionUnifies = await this.unifyDeduction(deduction, context);
|
|
226
220
|
|
|
227
221
|
if (deductionUnifies) {
|
|
228
|
-
const
|
|
229
|
-
|
|
222
|
+
const hypothesesDischarged = await topLevelAssertion.dischargeHypotheses(context);
|
|
223
|
+
|
|
224
|
+
if (hypothesesDischarged) {
|
|
225
|
+
const suppositions = topLevelAssertion.getSuppositions(),
|
|
226
|
+
suppositionsUnify = await this.unifySuppositions(suppositions, context);
|
|
230
227
|
|
|
231
|
-
|
|
232
|
-
|
|
228
|
+
if (suppositionsUnify) {
|
|
229
|
+
topLevelAssertionUnifies = true;
|
|
230
|
+
}
|
|
233
231
|
}
|
|
234
232
|
}
|
|
235
233
|
|
|
@@ -18,7 +18,7 @@ import { labelsFromJSON,
|
|
|
18
18
|
suppositionsToSuppositionsJSON } from "../utilities/json";
|
|
19
19
|
|
|
20
20
|
const { reverse } = arrayUtilities,
|
|
21
|
-
{ asyncExtract, asyncForwardsEvery, asyncBackwardsEvery } = asynchronousUtilities;
|
|
21
|
+
{ asyncEvery, asyncExtract, asyncForwardsEvery, asyncBackwardsEvery } = asynchronousUtilities;
|
|
22
22
|
|
|
23
23
|
export default class TopLevelAssertion extends Element {
|
|
24
24
|
constructor(context, string, node, breakPoint, labels, suppositions, deduction, proof, signature, hypotheses) {
|
|
@@ -257,6 +257,38 @@ export default class TopLevelAssertion extends Element {
|
|
|
257
257
|
return suppositionsVerify;
|
|
258
258
|
}
|
|
259
259
|
|
|
260
|
+
async dischargeHypothesis(hypothesis, context) {
|
|
261
|
+
let hypothesisDischarged;
|
|
262
|
+
|
|
263
|
+
await this.break(context);
|
|
264
|
+
|
|
265
|
+
const hypothesisString = hypothesis.getString(),
|
|
266
|
+
topLevelAssertionString = this.getString(); ///
|
|
267
|
+
|
|
268
|
+
context.trace(`Discharding the '${topLevelAssertionString}' top level assertion's '${hypothesisString}' hypothesis... `);
|
|
269
|
+
|
|
270
|
+
hypothesisDischarged = hypothesis.discharge(context);
|
|
271
|
+
|
|
272
|
+
if (hypothesisDischarged) {
|
|
273
|
+
context.trace(`...discharged the '${topLevelAssertionString}' top level assertion's '${hypothesisString}' hypothesis. `);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
return hypothesisDischarged;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
async dischargeHypotheses(context) {
|
|
280
|
+
const hypotheses = this.getHypotheses(),
|
|
281
|
+
hypothesesDischarged = await asyncEvery(hypotheses, async (hypothesis) => {
|
|
282
|
+
const hypothesisDischarged = await this.dischargeHypothesis(hypothesis, context);
|
|
283
|
+
|
|
284
|
+
if (hypothesisDischarged) {
|
|
285
|
+
return true;
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
return hypothesesDischarged;
|
|
290
|
+
}
|
|
291
|
+
|
|
260
292
|
async unifyStepWithDeduction(step, context) {
|
|
261
293
|
let stepUnifiesWithDeduction = false;
|
|
262
294
|
|
|
@@ -286,13 +318,17 @@ export default class TopLevelAssertion extends Element {
|
|
|
286
318
|
const stepUnifiesWithDeduction = await this.unifyStepWithDeduction(step, context);
|
|
287
319
|
|
|
288
320
|
if (stepUnifiesWithDeduction) {
|
|
289
|
-
const
|
|
321
|
+
const hypothesesDischarged = await this.dischargeHypotheses(context);
|
|
290
322
|
|
|
291
|
-
if (
|
|
292
|
-
const
|
|
323
|
+
if (hypothesesDischarged) {
|
|
324
|
+
const subproofOrProofAssertionsUnifiesWithSuppositions = await this.unifySubproofOrProofAssertionsWithSuppositions(subproofOrProofAssertions, context);
|
|
293
325
|
|
|
294
|
-
if (
|
|
295
|
-
|
|
326
|
+
if (subproofOrProofAssertionsUnifiesWithSuppositions) {
|
|
327
|
+
const derivedSubstitutionsResolved = context.areDerivedSubstitutionsResolved();
|
|
328
|
+
|
|
329
|
+
if (derivedSubstitutionsResolved) {
|
|
330
|
+
stepAndSubproofOrProofAssertionsUnify = true;
|
|
331
|
+
}
|
|
296
332
|
}
|
|
297
333
|
}
|
|
298
334
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { Element, asynchronousUtilities } from "occam-languages";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { encapsulate } from "../utilities/context";
|
|
6
6
|
import { breakPointFromJSON, breakPointToBreakPointJSON } from "../utilities/breakPoint";
|
|
7
7
|
import { topLevelMetaAssertionStringFromLabelSuppositionsAndDeduction } from "../utilities/string";
|
|
8
8
|
import { labelFromJSON,
|
|
@@ -103,7 +103,7 @@ export default class TopLevelMetaAssertion extends Element {
|
|
|
103
103
|
|
|
104
104
|
context.trace(`Verifying the '${topLevelMetaAssertionString}' top level meta assertion...`);
|
|
105
105
|
|
|
106
|
-
await
|
|
106
|
+
await encapsulate(async (context) => {
|
|
107
107
|
const labelVerifies = this.verifyLabel(context);
|
|
108
108
|
|
|
109
109
|
if (labelVerifies) {
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import elements from "../elements";
|
|
4
|
+
|
|
5
|
+
function dischargeStatementAsTypeAssertion(statement, context) {
|
|
6
|
+
let dischargesStatementAsTypeAssertion = false;
|
|
7
|
+
|
|
8
|
+
const { TypeAssertion } = elements;
|
|
9
|
+
|
|
10
|
+
const typeAssertion = TypeAssertion.fromStatement(statement, context);
|
|
11
|
+
|
|
12
|
+
if (typeAssertion !== null) {
|
|
13
|
+
const statementString = statement.getString();
|
|
14
|
+
|
|
15
|
+
context.trace(`Validating the '${statementString}' statement as a type assertion...`);
|
|
16
|
+
|
|
17
|
+
const discharges = typeAssertion.discharge(context); ///
|
|
18
|
+
|
|
19
|
+
if (discharges !== null) {
|
|
20
|
+
dischargesStatementAsTypeAssertion = true;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (dischargesStatementAsTypeAssertion) {
|
|
24
|
+
context.debug(`...discharged the '${statementString}' statement as a type assertion.`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return dischargesStatementAsTypeAssertion;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const dischargeStatements = [
|
|
32
|
+
dischargeStatementAsTypeAssertion
|
|
33
|
+
];
|