occam-nominal 1.0.307 → 1.0.310
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 +2 -2
- package/lib/element/assertion/contained.js +5 -8
- package/lib/element/assertion/subproof.js +12 -15
- package/lib/element/combinator/bracketed.js +2 -2
- package/lib/element/combinator.js +2 -2
- package/lib/element/declaration/combinator.js +3 -3
- package/lib/element/declaration/metavariable.js +2 -2
- package/lib/element/declaration/variable.js +4 -4
- package/lib/element/deduction.js +5 -6
- package/lib/element/derivation.js +3 -3
- package/lib/element/equality.js +3 -4
- package/lib/element/frame.js +5 -5
- package/lib/element/goal.js +5 -8
- package/lib/element/judgement.js +4 -5
- package/lib/element/label.js +5 -6
- package/lib/element/metavariable.js +67 -67
- package/lib/element/procedureCall.js +25 -25
- package/lib/element/proofAssertion/premise.js +26 -19
- package/lib/element/proofAssertion/step.js +5 -5
- package/lib/element/proofAssertion/supposition.js +4 -5
- package/lib/element/proofAssertion.js +6 -13
- package/lib/element/rule.js +13 -13
- package/lib/element/statement.js +5 -5
- package/lib/element/subDerivation.js +3 -3
- package/lib/element/subproof.js +6 -6
- package/lib/element/substitution/frame.js +3 -5
- package/lib/element/substitution/term.js +3 -5
- package/lib/element/term.js +22 -22
- package/lib/element/topLevelAssertion.js +5 -5
- package/lib/pass/continuationZip.js +2 -2
- package/lib/process/unify.js +9 -9
- package/lib/process/validate.js +9 -9
- package/lib/process/validation.js +5 -5
- package/lib/process/verify.js +18 -18
- package/lib/utilities/compression.js +137 -0
- package/lib/utilities/continuation.js +5 -5
- package/package.json +3 -3
- package/src/context/file/nominal.js +1 -1
- package/src/element/assertion/contained.js +4 -10
- package/src/element/assertion/subproof.js +11 -17
- package/src/element/combinator/bracketed.js +1 -1
- package/src/element/combinator.js +1 -1
- package/src/element/declaration/combinator.js +2 -2
- package/src/element/declaration/metavariable.js +1 -1
- package/src/element/declaration/variable.js +3 -3
- package/src/element/deduction.js +4 -6
- package/src/element/derivation.js +2 -2
- package/src/element/equality.js +2 -4
- package/src/element/frame.js +4 -4
- package/src/element/goal.js +4 -10
- package/src/element/judgement.js +4 -6
- package/src/element/label.js +4 -6
- package/src/element/metavariable.js +79 -80
- package/src/element/procedureCall.js +28 -29
- package/src/element/proofAssertion/premise.js +32 -23
- package/src/element/proofAssertion/step.js +5 -5
- package/src/element/proofAssertion/supposition.js +5 -5
- package/src/element/proofAssertion.js +7 -19
- package/src/element/rule.js +12 -12
- package/src/element/statement.js +6 -4
- package/src/element/subDerivation.js +2 -2
- package/src/element/subproof.js +5 -5
- package/src/element/substitution/frame.js +4 -6
- package/src/element/substitution/term.js +4 -6
- package/src/element/term.js +25 -27
- package/src/element/topLevelAssertion.js +4 -4
- package/src/pass/continuationZip.js +1 -1
- package/src/process/unify.js +8 -9
- package/src/process/validate.js +8 -8
- package/src/process/validation.js +4 -4
- package/src/process/verify.js +17 -17
- package/src/utilities/compression.js +115 -0
- package/src/utilities/continuation.js +4 -4
package/src/element/statement.js
CHANGED
|
@@ -205,15 +205,17 @@ export default define(class Statement extends Element {
|
|
|
205
205
|
return;
|
|
206
206
|
}
|
|
207
207
|
|
|
208
|
-
|
|
208
|
+
const statement = this;
|
|
209
209
|
|
|
210
210
|
exists(validateStatements, statement, context, (statementValidates) => {
|
|
211
|
+
let statement = null;
|
|
212
|
+
|
|
211
213
|
if (statementValidates) {
|
|
214
|
+
statement = this;
|
|
215
|
+
|
|
212
216
|
context.addStatement(statement);
|
|
213
217
|
|
|
214
218
|
context.debug(`...validated the '${statementString}' statement.`);
|
|
215
|
-
} else {
|
|
216
|
-
statement = null;
|
|
217
219
|
}
|
|
218
220
|
|
|
219
221
|
continuation(statement);
|
|
@@ -257,7 +259,7 @@ export default define(class Statement extends Element {
|
|
|
257
259
|
context.debug(`...unified the '${specificStatementString}' statement with the '${generalStatementString}' statement.`);
|
|
258
260
|
}
|
|
259
261
|
|
|
260
|
-
continuation(statementUnifies);
|
|
262
|
+
return continuation(statementUnifies);
|
|
261
263
|
});
|
|
262
264
|
}
|
|
263
265
|
|
|
@@ -35,7 +35,7 @@ export default define(class SubDerivation extends Element {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
verify(context, continuation) {
|
|
38
|
-
every(this.subproofOrProofAssertions, (subproofOrProofAssertion, continuation) => {
|
|
38
|
+
return every(this.subproofOrProofAssertions, (subproofOrProofAssertion, continuation) => {
|
|
39
39
|
subproofOrProofAssertion.verify(context, (subproofOrProofAssertionVerifies) => {
|
|
40
40
|
if (subproofOrProofAssertionVerifies) {
|
|
41
41
|
context.assignAssignments();
|
|
@@ -43,7 +43,7 @@ export default define(class SubDerivation extends Element {
|
|
|
43
43
|
context.addSubproofOrProofAssertion(subproofOrProofAssertion);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
continuation(subproofOrProofAssertionVerifies);
|
|
46
|
+
return continuation(subproofOrProofAssertionVerifies);
|
|
47
47
|
});
|
|
48
48
|
}, continuation);
|
|
49
49
|
}
|
package/src/element/subproof.js
CHANGED
|
@@ -94,7 +94,7 @@ export default define(class Subproof extends Element {
|
|
|
94
94
|
const verifySuppositions = this.verifySuppositions.bind(this),
|
|
95
95
|
verifySubDerivation = this.verifySubDerivation.bind(this);
|
|
96
96
|
|
|
97
|
-
all([
|
|
97
|
+
return all([
|
|
98
98
|
verifySuppositions,
|
|
99
99
|
verifySubDerivation
|
|
100
100
|
], context, continuation);
|
|
@@ -111,18 +111,18 @@ export default define(class Subproof extends Element {
|
|
|
111
111
|
context.addSubproofOrProofAssertion(subproofOrProofAssertion);
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
continuation(suppositionVerifies);
|
|
114
|
+
return continuation(suppositionVerifies);
|
|
115
115
|
});
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
verifySuppositions(context, continuation) {
|
|
119
|
-
every(this.suppositions, (supposition, continuation) => {
|
|
120
|
-
this.verifySupposition(supposition, context, continuation);
|
|
119
|
+
return every(this.suppositions, (supposition, continuation) => {
|
|
120
|
+
return this.verifySupposition(supposition, context, continuation);
|
|
121
121
|
}, continuation);
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
verifySubDerivation(context, continuation) {
|
|
125
|
-
this.subDerivation.verify(context, continuation);
|
|
125
|
+
return this.subDerivation.verify(context, continuation);
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
static name = "Subproof";
|
|
@@ -9,7 +9,7 @@ import { define } from "../../elements";
|
|
|
9
9
|
import { instantiateFrameSubstitution } from "../../process/instantiate";
|
|
10
10
|
import { frameSubstitutionFromFrameSubstitutionNode } from "../../utilities/element";
|
|
11
11
|
import { frameSubstitutionStringFromFrameAndMetavariable } from "../../utilities/string";
|
|
12
|
-
import { elide,
|
|
12
|
+
import { elide, ablates, manifest, attempts, reconcile, instantiate, unserialises } from "../../utilities/context";
|
|
13
13
|
|
|
14
14
|
const { breakPointFromJSON } = breakPointUtilities;
|
|
15
15
|
|
|
@@ -337,12 +337,10 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
337
337
|
const frameSubstitutionNode = statement.getFrameSubstitutionNode();
|
|
338
338
|
|
|
339
339
|
if (frameSubstitutionNode !== null) {
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
specificContext = context; ///
|
|
340
|
+
const generalContext = context, ///
|
|
341
|
+
specificContext = context; ///
|
|
343
342
|
|
|
344
|
-
|
|
345
|
-
}, context);
|
|
343
|
+
frameSubstitution = frameSubstitutionFromFrameSubstitutionNode(frameSubstitutionNode, generalContext, specificContext);
|
|
346
344
|
}
|
|
347
345
|
|
|
348
346
|
return frameSubstitution;
|
|
@@ -10,7 +10,7 @@ import { stripBracketsFromTerm } from "../../utilities/brackets";
|
|
|
10
10
|
import { instantiateTermSubstitution } from "../../process/instantiate";
|
|
11
11
|
import { termSubstitutionFromTermSubstitutionNode } from "../../utilities/element";
|
|
12
12
|
import { termSubstitutionStringFromTermAndVariable } from "../../utilities/string";
|
|
13
|
-
import { elide,
|
|
13
|
+
import { elide, ablates, manifest, attempts, reconcile, instantiate, unserialises } from "../../utilities/context";
|
|
14
14
|
|
|
15
15
|
const { breakPointFromJSON } = breakPointUtilities;
|
|
16
16
|
|
|
@@ -340,12 +340,10 @@ export default define(class TermSubstitution extends Substitution {
|
|
|
340
340
|
const termSubstitutionNode = statement.getTermSubstitutionNode();
|
|
341
341
|
|
|
342
342
|
if (termSubstitutionNode !== null) {
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
specificContext = context; ///
|
|
343
|
+
const generalContext = context, ///
|
|
344
|
+
specificContext = context; ///
|
|
346
345
|
|
|
347
|
-
|
|
348
|
-
}, context);
|
|
346
|
+
termSubstitution = termSubstitutionFromTermSubstitutionNode(termSubstitutionNode, generalContext, specificContext);
|
|
349
347
|
}
|
|
350
348
|
|
|
351
349
|
return termSubstitution;
|
package/src/element/term.js
CHANGED
|
@@ -212,53 +212,51 @@ export default define(class Term extends Element {
|
|
|
212
212
|
});
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
-
validateGivenType(type, strict, context) {
|
|
216
|
-
if (
|
|
215
|
+
validateGivenType(type, strict, context, continuation) {
|
|
216
|
+
if (continuation === undefined) {
|
|
217
|
+
continuation = context; ///
|
|
218
|
+
|
|
217
219
|
context = strict; ///
|
|
218
220
|
|
|
219
221
|
strict = true;
|
|
220
222
|
}
|
|
221
223
|
|
|
222
|
-
let term;
|
|
223
|
-
|
|
224
224
|
const typeString = type.getString(),
|
|
225
225
|
termString = this.getString(); ///
|
|
226
226
|
|
|
227
227
|
context.trace(`Validating the '${termString}' term given the '${typeString}' type...`);
|
|
228
228
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
term = this.validate(context, (term, context) => {
|
|
232
|
-
let validatesForwards = false;
|
|
229
|
+
this.validate(context, (term, context) => {
|
|
230
|
+
let validatesGivenType = false;
|
|
233
231
|
|
|
234
|
-
|
|
235
|
-
|
|
232
|
+
if (term !== null) {
|
|
233
|
+
const termType = term.getType(),
|
|
234
|
+
termTypeEqualToOrSubTypeOfType = termType.isEqualToOrSubTypeOf(type);
|
|
236
235
|
|
|
237
|
-
|
|
238
|
-
|
|
236
|
+
if (termTypeEqualToOrSubTypeOfType) {
|
|
237
|
+
validatesGivenType = true;
|
|
239
238
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
239
|
+
if (strict) {
|
|
240
|
+
const typeEstablished = type.isEstablished(),
|
|
241
|
+
termProvisional = term.isProvisional();
|
|
243
242
|
|
|
244
|
-
|
|
245
|
-
|
|
243
|
+
if (typeEstablished && termProvisional) {
|
|
244
|
+
validatesGivenType = false;
|
|
245
|
+
}
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
249
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
if (term !== null) {
|
|
254
|
-
validatesGivenType = true;
|
|
255
|
-
}
|
|
250
|
+
if (!validatesGivenType) {
|
|
251
|
+
term = null;
|
|
252
|
+
}
|
|
256
253
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
254
|
+
if (validatesGivenType) {
|
|
255
|
+
context.debug(`...validated the '${termString}' term given the '${typeString}' type.`);
|
|
256
|
+
}
|
|
260
257
|
|
|
261
|
-
|
|
258
|
+
return continuation(term);
|
|
259
|
+
});
|
|
262
260
|
}
|
|
263
261
|
|
|
264
262
|
validateAsProperty(context, validateForwards) {
|
|
@@ -123,8 +123,8 @@ export default class TopLevelAssertion extends Element {
|
|
|
123
123
|
|
|
124
124
|
context.trace(`Verifying the '${topLevelAssertionString}' top level assertion's labels...`);
|
|
125
125
|
|
|
126
|
-
every(this.labels, (label, continuation) => {
|
|
127
|
-
this.verifyLabel(label, context, continuation);
|
|
126
|
+
return every(this.labels, (label, continuation) => {
|
|
127
|
+
return this.verifyLabel(label, context, continuation);
|
|
128
128
|
}, (labelsVerify) => {
|
|
129
129
|
if (labelsVerify) {
|
|
130
130
|
context.debug(`...verified the '${topLevelAssertionString}' top level assertion's labels.`);
|
|
@@ -216,8 +216,8 @@ export default class TopLevelAssertion extends Element {
|
|
|
216
216
|
|
|
217
217
|
context.trace(`Verifying the '${topLevelAssertionString}' top level assertion's suppositions...`);
|
|
218
218
|
|
|
219
|
-
forwardsEvery(this.suppositions, (supposition, continuation) => {
|
|
220
|
-
this.verifySupposition(supposition, context, continuation);
|
|
219
|
+
return forwardsEvery(this.suppositions, (supposition, continuation) => {
|
|
220
|
+
return this.verifySupposition(supposition, context, continuation);
|
|
221
221
|
}, (suppositionsVerify) => {
|
|
222
222
|
if (suppositionsVerify) {
|
|
223
223
|
context.debug(`...verified the '${topLevelAssertionString}' top level assertion's suppositions.`);
|
|
@@ -8,6 +8,6 @@ export default class ContinuationZipPass extends ContinuationZipPassBase {
|
|
|
8
8
|
generalChildNodes = generalNonTerminalNode.getChildNodes(), ///
|
|
9
9
|
specificChildNodes = specificNonTerminalNode.getChildNodes(); ///
|
|
10
10
|
|
|
11
|
-
this.descend(generalChildNodes, specificChildNodes, ...remainingArguments, continuation);
|
|
11
|
+
return this.descend(generalChildNodes, specificChildNodes, ...remainingArguments, continuation);
|
|
12
12
|
}
|
|
13
13
|
}
|
package/src/process/unify.js
CHANGED
|
@@ -223,7 +223,6 @@ class MetaLevelPass extends ContinuationZipPassBase {
|
|
|
223
223
|
metavariable.unifyFrame(frame, generalContext, specificContext, (frameUnifies) => {
|
|
224
224
|
let success = false;
|
|
225
225
|
|
|
226
|
-
|
|
227
226
|
if (frameUnifies) {
|
|
228
227
|
success = true;
|
|
229
228
|
}
|
|
@@ -489,14 +488,14 @@ export function unifyStatement(generalStatement, specificStatement, generalConte
|
|
|
489
488
|
generalNode = generalStatementNode, ///
|
|
490
489
|
specificNode = specificStatementNode; ///
|
|
491
490
|
|
|
492
|
-
metaLevelPass.run(generalNode, specificNode, generalContext, specificContext, continuation);
|
|
491
|
+
return metaLevelPass.run(generalNode, specificNode, generalContext, specificContext, continuation);
|
|
493
492
|
}
|
|
494
493
|
|
|
495
494
|
export function unifyMetavariable(generalMetavariable, specificMetavariable, generalContext, specificContext, continuation) {
|
|
496
495
|
const generalMetavariableNode = generalMetavariable.getNode(),
|
|
497
496
|
specificMetavariableNode = specificMetavariable.getNode();
|
|
498
497
|
|
|
499
|
-
metavariablePass.run(generalMetavariableNode, specificMetavariableNode, generalContext, specificContext, continuation);
|
|
498
|
+
return metavariablePass.run(generalMetavariableNode, specificMetavariableNode, generalContext, specificContext, continuation);
|
|
500
499
|
}
|
|
501
500
|
|
|
502
501
|
export function unifyTermWithProperty(term, property, generalContext, specificContext, continuation) {
|
|
@@ -504,7 +503,7 @@ export function unifyTermWithProperty(term, property, generalContext, specificCo
|
|
|
504
503
|
propertyTerm = property.getTerm(),
|
|
505
504
|
propertyTermNode = propertyTerm.getNode();
|
|
506
505
|
|
|
507
|
-
propertyPass.run(propertyTermNode, termNode, generalContext, specificContext, continuation);
|
|
506
|
+
return propertyPass.run(propertyTermNode, termNode, generalContext, specificContext, continuation);
|
|
508
507
|
}
|
|
509
508
|
|
|
510
509
|
export function unifyTermWithGenerator(term, generator, generalContext, specificContext, continuation) {
|
|
@@ -512,7 +511,7 @@ export function unifyTermWithGenerator(term, generator, generalContext, specific
|
|
|
512
511
|
generatorTerm = generator.getTerm(),
|
|
513
512
|
generatorTermNode = generatorTerm.getNode();
|
|
514
513
|
|
|
515
|
-
generatorPass.run(generatorTermNode, termNode, generalContext, specificContext, continuation);
|
|
514
|
+
return generatorPass.run(generatorTermNode, termNode, generalContext, specificContext, continuation);
|
|
516
515
|
}
|
|
517
516
|
|
|
518
517
|
export function unifyTermWithConstructor(term, constructor, generalContext, specificContext, continuation) {
|
|
@@ -520,7 +519,7 @@ export function unifyTermWithConstructor(term, constructor, generalContext, spec
|
|
|
520
519
|
constructorTerm = constructor.getTerm(),
|
|
521
520
|
constructorTermNode = constructorTerm.getNode();
|
|
522
521
|
|
|
523
|
-
constructorPass.run(constructorTermNode, termNode, generalContext, specificContext, continuation);
|
|
522
|
+
return constructorPass.run(constructorTermNode, termNode, generalContext, specificContext, continuation);
|
|
524
523
|
}
|
|
525
524
|
|
|
526
525
|
export function unifyStatementWithCombinator(statement, combinator, generalContext, specificContext, continuation) {
|
|
@@ -528,7 +527,7 @@ export function unifyStatementWithCombinator(statement, combinator, generalConte
|
|
|
528
527
|
combinatorStatement = combinator.getStatement(),
|
|
529
528
|
combinatorStatementNode = combinatorStatement.getNode();
|
|
530
529
|
|
|
531
|
-
combinatorPass.run(combinatorStatementNode, statementNode, generalContext, specificContext, continuation);
|
|
530
|
+
return combinatorPass.run(combinatorStatementNode, statementNode, generalContext, specificContext, continuation);
|
|
532
531
|
}
|
|
533
532
|
|
|
534
533
|
export function unifyTermIntrinsically(generalTerm, specificTerm, generalContext, specificContext, continuation) {
|
|
@@ -537,7 +536,7 @@ export function unifyTermIntrinsically(generalTerm, specificTerm, generalContext
|
|
|
537
536
|
generalNode = generalTermNode, ///
|
|
538
537
|
specificNode = specificTermNode; ///
|
|
539
538
|
|
|
540
|
-
intrinsicTermPass.run(generalNode, specificNode, generalContext, specificContext, continuation);
|
|
539
|
+
return intrinsicTermPass.run(generalNode, specificNode, generalContext, specificContext, continuation);
|
|
541
540
|
}
|
|
542
541
|
|
|
543
542
|
export function unifyMetavariableIntrinsically(generalMetavariable, specificMetavariable, generalContext, specificContext, continuation) {
|
|
@@ -546,5 +545,5 @@ export function unifyMetavariableIntrinsically(generalMetavariable, specificMeta
|
|
|
546
545
|
generalNode = generalMetavariableNode, ///
|
|
547
546
|
specificNode = specificMetavariableNode;
|
|
548
547
|
|
|
549
|
-
intrinsicMetavariablePass.run(generalNode, specificNode, generalContext, specificContext, continuation);
|
|
548
|
+
return intrinsicMetavariablePass.run(generalNode, specificNode, generalContext, specificContext, continuation);
|
|
550
549
|
}
|
package/src/process/validate.js
CHANGED
|
@@ -17,7 +17,7 @@ class PropertyPass extends ContinuationPass {
|
|
|
17
17
|
const nonTerminalNode = termNode, ///
|
|
18
18
|
childNodes = nonTerminalNode.getChildNodes();
|
|
19
19
|
|
|
20
|
-
this.descend(childNodes, context, continuation);
|
|
20
|
+
return this.descend(childNodes, context, continuation);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
static maps = [
|
|
@@ -60,7 +60,7 @@ class GeneratorPass extends ContinuationPass {
|
|
|
60
60
|
const nonTerminalNode = termNode, ///
|
|
61
61
|
childNodes = nonTerminalNode.getChildNodes();
|
|
62
62
|
|
|
63
|
-
this.descend(childNodes, context, continuation);
|
|
63
|
+
return this.descend(childNodes, context, continuation);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
static maps = [
|
|
@@ -103,7 +103,7 @@ class CombinatorPass extends ContinuationPass {
|
|
|
103
103
|
const nonTerminalNode = statementNode, ///
|
|
104
104
|
childNodes = nonTerminalNode.getChildNodes();
|
|
105
105
|
|
|
106
|
-
this.descend(childNodes, context, continuation);
|
|
106
|
+
return this.descend(childNodes, context, continuation);
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
static maps = [
|
|
@@ -164,7 +164,7 @@ class ConstructorPass extends ContinuationPass {
|
|
|
164
164
|
const nonTerminalNode = termNode, ///
|
|
165
165
|
childNodes = nonTerminalNode.getChildNodes();
|
|
166
166
|
|
|
167
|
-
this.descend(childNodes, context, continuation);
|
|
167
|
+
return this.descend(childNodes, context, continuation);
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
static maps = [
|
|
@@ -210,23 +210,23 @@ const propertyPass = new PropertyPass(),
|
|
|
210
210
|
export function validateTermAsProperty(term, context, continuation) {
|
|
211
211
|
const termNode = term.getNode();
|
|
212
212
|
|
|
213
|
-
propertyPass.run(termNode, context, continuation);
|
|
213
|
+
return propertyPass.run(termNode, context, continuation);
|
|
214
214
|
}
|
|
215
215
|
|
|
216
216
|
export function validateTermAsGenerator(term, context, continuation) {
|
|
217
217
|
const termNode = term.getNode();
|
|
218
218
|
|
|
219
|
-
generatorPass.run(termNode, context, continuation);
|
|
219
|
+
return generatorPass.run(termNode, context, continuation);
|
|
220
220
|
}
|
|
221
221
|
|
|
222
222
|
export function validateTermAsConstructor(term, context, continuation) {
|
|
223
223
|
const termNode = term.getNode();
|
|
224
224
|
|
|
225
|
-
constructorPass.run(termNode, context, continuation);
|
|
225
|
+
return constructorPass.run(termNode, context, continuation);
|
|
226
226
|
}
|
|
227
227
|
|
|
228
228
|
export function validateStatementAsCombinator(statement, context, continuation) {
|
|
229
229
|
const statementNode = statement.getNode();
|
|
230
230
|
|
|
231
|
-
combinatorPass.run(statementNode, context, continuation);
|
|
231
|
+
return combinatorPass.run(statementNode, context, continuation);
|
|
232
232
|
}
|
|
@@ -165,9 +165,9 @@ function validateStatementAsMetavariable(statement, context, continuation) {
|
|
|
165
165
|
function unifyStatementWithCombinators(statement, context, continuation) {
|
|
166
166
|
const combinators = context.getCombinators();
|
|
167
167
|
|
|
168
|
-
some(combinators, (combinator, continuation) => {
|
|
168
|
+
return some(combinators, (combinator, continuation) => {
|
|
169
169
|
descend((context) => {
|
|
170
|
-
combinator.unifyStatement(statement, context, continuation);
|
|
170
|
+
return combinator.unifyStatement(statement, context, continuation);
|
|
171
171
|
}, context);
|
|
172
172
|
}, continuation);
|
|
173
173
|
}
|
|
@@ -175,7 +175,7 @@ function unifyStatementWithCombinators(statement, context, continuation) {
|
|
|
175
175
|
function unifyStatementWithBracketedCombinator(statement, context, continuation) {
|
|
176
176
|
const bracketedCombinator = bracketedCombinatorFromNothing();
|
|
177
177
|
|
|
178
|
-
bracketedCombinator.unifyStatement(statement, context, continuation);
|
|
178
|
+
return bracketedCombinator.unifyStatement(statement, context, continuation);
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
function validateStatementAsEquality(statement, context, continuation) {
|
|
@@ -221,7 +221,7 @@ function validateStatementAsJudgement(statement, context, continuation) {
|
|
|
221
221
|
|
|
222
222
|
context.trace(`Validating the '${statementString}' statement as a judgement...`);
|
|
223
223
|
|
|
224
|
-
judgement.validate(context, (
|
|
224
|
+
judgement.validate(context, (judgement) => {
|
|
225
225
|
let validatesStatementAsJudgement = false;
|
|
226
226
|
|
|
227
227
|
if (judgement !== null) {
|
package/src/process/verify.js
CHANGED
|
@@ -46,7 +46,7 @@ class TopLevelPass extends ContinuationPass {
|
|
|
46
46
|
run: (errorNode, context, continuation) => {
|
|
47
47
|
const error = errorFromErrorNode(errorNode, context);
|
|
48
48
|
|
|
49
|
-
error.verify(context, continuation);
|
|
49
|
+
return error.verify(context, continuation);
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
52
|
{
|
|
@@ -54,7 +54,7 @@ class TopLevelPass extends ContinuationPass {
|
|
|
54
54
|
run: (ruleNode, context, continuation) => {
|
|
55
55
|
const rule = ruleFromRuleNode(ruleNode, context);
|
|
56
56
|
|
|
57
|
-
rule.verify(context, continuation);
|
|
57
|
+
return rule.verify(context, continuation);
|
|
58
58
|
}
|
|
59
59
|
},
|
|
60
60
|
{
|
|
@@ -62,7 +62,7 @@ class TopLevelPass extends ContinuationPass {
|
|
|
62
62
|
run: (axiomNode, context, continuation) => {
|
|
63
63
|
const axiom = axiomFromAxiomNode(axiomNode, context);
|
|
64
64
|
|
|
65
|
-
axiom.verify(context, continuation);
|
|
65
|
+
return axiom.verify(context, continuation);
|
|
66
66
|
}
|
|
67
67
|
},
|
|
68
68
|
{
|
|
@@ -70,7 +70,7 @@ class TopLevelPass extends ContinuationPass {
|
|
|
70
70
|
run: (lemmaNode, context, continuation) => {
|
|
71
71
|
const lemma = lemmaFromLemmaNode(lemmaNode, context);
|
|
72
72
|
|
|
73
|
-
lemma.verify(context, continuation);
|
|
73
|
+
return lemma.verify(context, continuation);
|
|
74
74
|
}
|
|
75
75
|
},
|
|
76
76
|
{
|
|
@@ -78,7 +78,7 @@ class TopLevelPass extends ContinuationPass {
|
|
|
78
78
|
run: (schemaNode, context, continuation) => {
|
|
79
79
|
const schema = schemaFromSchemaNode(schemaNode, context);
|
|
80
80
|
|
|
81
|
-
schema.verify(context, continuation);
|
|
81
|
+
return schema.verify(context, continuation);
|
|
82
82
|
}
|
|
83
83
|
},
|
|
84
84
|
{
|
|
@@ -86,7 +86,7 @@ class TopLevelPass extends ContinuationPass {
|
|
|
86
86
|
run: (sectionNode, context, continuation) => {
|
|
87
87
|
const section = sectionFromSectionNode(sectionNode, context);
|
|
88
88
|
|
|
89
|
-
section.verify(context, continuation);
|
|
89
|
+
return section.verify(context, continuation);
|
|
90
90
|
}
|
|
91
91
|
},
|
|
92
92
|
{
|
|
@@ -94,7 +94,7 @@ class TopLevelPass extends ContinuationPass {
|
|
|
94
94
|
run: (theoremNode, context, continuation) => {
|
|
95
95
|
const theorem = theoremFromTheoremNode(theoremNode, context);
|
|
96
96
|
|
|
97
|
-
theorem.verify(context, continuation);
|
|
97
|
+
return theorem.verify(context, continuation);
|
|
98
98
|
}
|
|
99
99
|
},
|
|
100
100
|
{
|
|
@@ -102,7 +102,7 @@ class TopLevelPass extends ContinuationPass {
|
|
|
102
102
|
run: (conjectureNode, context, continuation) => {
|
|
103
103
|
const conjecture = conjectureFromConjectureNode(conjectureNode, context);
|
|
104
104
|
|
|
105
|
-
conjecture.verify(context, continuation);
|
|
105
|
+
return conjecture.verify(context, continuation);
|
|
106
106
|
}
|
|
107
107
|
},
|
|
108
108
|
{
|
|
@@ -110,7 +110,7 @@ class TopLevelPass extends ContinuationPass {
|
|
|
110
110
|
run: (typeDeclarationNode, context, continuation) => {
|
|
111
111
|
const typeDeclaration = typeDeclarationFromTypeDeclarationNode(typeDeclarationNode, context);
|
|
112
112
|
|
|
113
|
-
typeDeclaration.verify(context, continuation);
|
|
113
|
+
return typeDeclaration.verify(context, continuation);
|
|
114
114
|
}
|
|
115
115
|
},
|
|
116
116
|
{
|
|
@@ -118,7 +118,7 @@ class TopLevelPass extends ContinuationPass {
|
|
|
118
118
|
run: (cotypeDeclarationNode, context, continuation) => {
|
|
119
119
|
const cotypeDeclaration = cotypeDeclarationFromCotypeDeclarationNode(cotypeDeclarationNode, context);
|
|
120
120
|
|
|
121
|
-
cotypeDeclaration.verify(context, continuation);
|
|
121
|
+
return cotypeDeclaration.verify(context, continuation);
|
|
122
122
|
}
|
|
123
123
|
},
|
|
124
124
|
{
|
|
@@ -126,7 +126,7 @@ class TopLevelPass extends ContinuationPass {
|
|
|
126
126
|
run: (variableDeclarationNode, context, continuation) => {
|
|
127
127
|
const variableDeclaration = variableDeclarationFromVariableDeclarationNode(variableDeclarationNode, context);
|
|
128
128
|
|
|
129
|
-
variableDeclaration.verify(context, continuation);
|
|
129
|
+
return variableDeclaration.verify(context, continuation);
|
|
130
130
|
}
|
|
131
131
|
},
|
|
132
132
|
{
|
|
@@ -134,7 +134,7 @@ class TopLevelPass extends ContinuationPass {
|
|
|
134
134
|
run: (generatorDeclarationNode, context, continuation) => {
|
|
135
135
|
const generatorDeclaration = generatorDeclarationFromGeneratorDeclarationNode(generatorDeclarationNode, context);
|
|
136
136
|
|
|
137
|
-
generatorDeclaration.verify(context, continuation);
|
|
137
|
+
return generatorDeclaration.verify(context, continuation);
|
|
138
138
|
}
|
|
139
139
|
},
|
|
140
140
|
{
|
|
@@ -142,7 +142,7 @@ class TopLevelPass extends ContinuationPass {
|
|
|
142
142
|
run: (typePrefixDeclarationNode, context, continuation) => {
|
|
143
143
|
const typePrefixDeclaration = typePrefixDeclarationFromTypePrefixDeclarationNode(typePrefixDeclarationNode, context);
|
|
144
144
|
|
|
145
|
-
typePrefixDeclaration.verify(context, continuation);
|
|
145
|
+
return typePrefixDeclaration.verify(context, continuation);
|
|
146
146
|
}
|
|
147
147
|
},
|
|
148
148
|
{
|
|
@@ -150,7 +150,7 @@ class TopLevelPass extends ContinuationPass {
|
|
|
150
150
|
run: (combinatorDeclarationNode, context, continuation) => {
|
|
151
151
|
const combinatorDeclaration = combinatorDeclarationFromCombinatorDeclarationNode(combinatorDeclarationNode, context);
|
|
152
152
|
|
|
153
|
-
combinatorDeclaration.verify(context, continuation);
|
|
153
|
+
return combinatorDeclaration.verify(context, continuation);
|
|
154
154
|
}
|
|
155
155
|
},
|
|
156
156
|
{
|
|
@@ -158,7 +158,7 @@ class TopLevelPass extends ContinuationPass {
|
|
|
158
158
|
run: (constructorDeclarationNode, context, continuation) => {
|
|
159
159
|
const constructorDeclaration = constructorDeclarationFromConstructorDeclarationNode(constructorDeclarationNode, context);
|
|
160
160
|
|
|
161
|
-
constructorDeclaration.verify(context, continuation);
|
|
161
|
+
return constructorDeclaration.verify(context, continuation);
|
|
162
162
|
}
|
|
163
163
|
},
|
|
164
164
|
{
|
|
@@ -166,7 +166,7 @@ class TopLevelPass extends ContinuationPass {
|
|
|
166
166
|
run: (metavariableDeclarationNode, context, continuation) => {
|
|
167
167
|
const metavariableDeclaration = metavariableDeclarationFromMetavariableDeclarationNode(metavariableDeclarationNode, context);
|
|
168
168
|
|
|
169
|
-
metavariableDeclaration.verify(context, continuation);
|
|
169
|
+
return metavariableDeclaration.verify(context, continuation);
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
172
|
];
|
|
@@ -177,5 +177,5 @@ const topLevelPass = new TopLevelPass();
|
|
|
177
177
|
export function verifyFile(fileNode, context, continuation) {
|
|
178
178
|
const node = fileNode; ///
|
|
179
179
|
|
|
180
|
-
topLevelPass.run(node, context, continuation);
|
|
180
|
+
return topLevelPass.run(node, context, continuation);
|
|
181
181
|
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { arrayUtilities } from "necessary";
|
|
4
|
+
|
|
5
|
+
const { compress } = arrayUtilities;
|
|
6
|
+
|
|
7
|
+
export function compressTerms(terms) {
|
|
8
|
+
compress(terms, (termA, termB) => {
|
|
9
|
+
const termAEqualToTermB = termA.isEqualTo(termB);
|
|
10
|
+
|
|
11
|
+
if (!termAEqualToTermB) {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function compressGoals(goals) {
|
|
18
|
+
compress(goals, (goalA, goalB) => {
|
|
19
|
+
const goalAEqualToGoalB = goalA.isEqualTo(goalB);
|
|
20
|
+
|
|
21
|
+
if (!goalAEqualToGoalB) {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function compressFrames(frames) {
|
|
28
|
+
compress(frames, (frameA, frameB) => {
|
|
29
|
+
const frameAEqualToFrameB = frameA.isEqualTo(frameB);
|
|
30
|
+
|
|
31
|
+
if (!frameAEqualToFrameB) {
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function compressEqualities(equalities) {
|
|
38
|
+
compress(equalities, (equalityA, equalityB) => {
|
|
39
|
+
const equalityAEqualToEqualityB = equalityA.isEqualTo(equalityB);
|
|
40
|
+
|
|
41
|
+
if (!equalityAEqualToEqualityB) {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function compressJudgements(judgements) {
|
|
48
|
+
compress(judgements, (judgementA, judgementB) => {
|
|
49
|
+
const judgementAEqualToJudgementB = judgementA.isEqualTo(judgementB);
|
|
50
|
+
|
|
51
|
+
if (!judgementAEqualToJudgementB) {
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function compressAssertions(assertions) {
|
|
58
|
+
compress(assertions, (assertionA, assertionB) => {
|
|
59
|
+
const assertionAEqualToAssertionB = assertionA.isEqualTo(assertionB);
|
|
60
|
+
|
|
61
|
+
if (!assertionAEqualToAssertionB) {
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function compressStatements(statements) {
|
|
68
|
+
compress(statements, (statementA, statementB) => {
|
|
69
|
+
const statementAEqualToStatementB = statementA.isEqualTo(statementB);
|
|
70
|
+
|
|
71
|
+
if (!statementAEqualToStatementB) {
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function compressSignatures(signatures) {
|
|
78
|
+
compress(signatures, (signatureA, signatureB) => {
|
|
79
|
+
const signatureAEqualToSignatureB = signatureA.isEqualTo(signatureB);
|
|
80
|
+
|
|
81
|
+
if (!signatureAEqualToSignatureB) {
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export function compressReferences(references) {
|
|
88
|
+
compress(references, (referenceA, referenceB) => {
|
|
89
|
+
const referenceAEqualToReferenceB = referenceA.isEqualTo(referenceB);
|
|
90
|
+
|
|
91
|
+
if (!referenceAEqualToReferenceB) {
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export function compressAssumptions(assumptions) {
|
|
98
|
+
compress(assumptions, (assumptionA, assumptionB) => {
|
|
99
|
+
const assumptionAEqualToAssumptionB = assumptionA.isEqualTo(assumptionB);
|
|
100
|
+
|
|
101
|
+
if (!assumptionAEqualToAssumptionB) {
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export function compressSubstitutions(substitutions) {
|
|
108
|
+
compress(substitutions, (substitutionA, substitutionB) => {
|
|
109
|
+
const substitutionAEqualToSubstitutionB = substitutionA.isEqualTo(substitutionB);
|
|
110
|
+
|
|
111
|
+
if (!substitutionAEqualToSubstitutionB) {
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
}
|