occam-nominal 1.0.310 → 1.0.317
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/liminal.js +17 -15
- package/lib/context/phaneric.js +3 -3
- package/lib/context.js +3 -3
- package/lib/element/assertion/contained.js +19 -17
- package/lib/element/assertion/defined.js +16 -14
- package/lib/element/conclusion.js +10 -11
- package/lib/element/declaration/variable.js +2 -2
- package/lib/element/deduction.js +7 -7
- package/lib/element/equality.js +3 -3
- package/lib/element/frame.js +8 -3
- package/lib/element/goal.js +7 -8
- package/lib/element/judgement.js +8 -10
- package/lib/element/metavariable.js +44 -40
- package/lib/element/proof.js +2 -2
- package/lib/element/proofAssertion/premise.js +17 -21
- package/lib/element/proofAssertion/step.js +5 -5
- package/lib/element/proofAssertion/supposition.js +39 -35
- package/lib/element/rule.js +24 -22
- package/lib/element/statement.js +56 -32
- package/lib/element/substitution/frame.js +71 -62
- package/lib/element/substitution/reference.js +21 -21
- package/lib/element/substitution/statement.js +81 -98
- package/lib/element/substitution/term.js +76 -67
- package/lib/element/substitution.js +5 -5
- package/lib/element/term.js +2 -2
- package/lib/element/topLevelAssertion/axiom.js +4 -5
- package/lib/element/topLevelAssertion/conjecture.js +3 -3
- package/lib/element/topLevelAssertion/lemma.js +3 -3
- package/lib/element/topLevelAssertion/theorem.js +3 -3
- package/lib/element/topLevelAssertion.js +59 -69
- package/lib/node/metavariable.js +18 -1
- package/lib/process/unify.js +5 -7
- package/lib/process/validation.js +5 -2
- package/lib/utilities/element.js +34 -56
- package/package.json +2 -2
- package/src/context/liminal.js +18 -16
- package/src/context/phaneric.js +3 -3
- package/src/context.js +2 -2
- package/src/element/assertion/contained.js +19 -18
- package/src/element/assertion/defined.js +16 -16
- package/src/element/conclusion.js +9 -11
- package/src/element/declaration/variable.js +1 -1
- package/src/element/deduction.js +6 -6
- package/src/element/equality.js +2 -2
- package/src/element/frame.js +10 -2
- package/src/element/goal.js +6 -8
- package/src/element/judgement.js +7 -11
- package/src/element/metavariable.js +56 -52
- package/src/element/proof.js +1 -1
- package/src/element/proofAssertion/premise.js +17 -25
- package/src/element/proofAssertion/step.js +4 -4
- package/src/element/proofAssertion/supposition.js +44 -43
- package/src/element/rule.js +27 -25
- package/src/element/statement.js +71 -41
- package/src/element/substitution/frame.js +88 -82
- package/src/element/substitution/reference.js +30 -32
- package/src/element/substitution/statement.js +97 -132
- package/src/element/substitution/term.js +95 -89
- package/src/element/substitution.js +6 -6
- package/src/element/term.js +1 -1
- package/src/element/topLevelAssertion/axiom.js +3 -5
- package/src/element/topLevelAssertion/conjecture.js +2 -2
- package/src/element/topLevelAssertion/lemma.js +2 -2
- package/src/element/topLevelAssertion/theorem.js +2 -2
- package/src/element/topLevelAssertion.js +61 -80
- package/src/node/metavariable.js +28 -1
- package/src/process/unify.js +7 -16
- package/src/process/validation.js +5 -4
- package/src/utilities/element.js +49 -64
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "occam-nominal",
|
|
3
3
|
"author": "James Smith",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.317",
|
|
5
5
|
"license": "MIT, Anti-996",
|
|
6
6
|
"homepage": "https://github.com/djalbat/occam-nominal",
|
|
7
7
|
"description": "Occam's Nominal language.",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"necessary": "^17.5.2",
|
|
14
|
-
"occam-furtle": "^3.0.
|
|
14
|
+
"occam-furtle": "^3.0.405",
|
|
15
15
|
"occam-grammar-utilities": "^8.1.17",
|
|
16
16
|
"occam-languages": "^2.1.33",
|
|
17
17
|
"occam-query": "^4.1.198"
|
package/src/context/liminal.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { arrayUtilities } from "necessary";
|
|
4
|
+
import { continuationUtilities } from "occam-languages";
|
|
4
5
|
import { metavariableNodesFromDerivedSubstitutions } from "../utilities/substitutions";
|
|
5
6
|
|
|
6
7
|
import Context from "../context";
|
|
7
8
|
import elements from "../elements";
|
|
8
9
|
|
|
9
|
-
const {
|
|
10
|
+
const { forEach } = continuationUtilities,
|
|
11
|
+
{ push, find, first } = arrayUtilities;
|
|
10
12
|
|
|
11
13
|
export default class LiminalContext extends Context {
|
|
12
14
|
constructor(context, derivedSubstitutions) {
|
|
@@ -86,23 +88,25 @@ export default class LiminalContext extends Context {
|
|
|
86
88
|
});
|
|
87
89
|
}
|
|
88
90
|
|
|
89
|
-
resolveDerivedSubstitutions() {
|
|
91
|
+
resolveDerivedSubstitutions(continuation) {
|
|
90
92
|
const context = this, ///
|
|
91
93
|
derivedSubstitutions = this.getDerivedSubstitutions(),
|
|
92
94
|
metavariableNodes = metavariableNodesFromDerivedSubstitutions(derivedSubstitutions);
|
|
93
95
|
|
|
94
|
-
|
|
96
|
+
return forEach(metavariableNodes, (metavariableNode, continuation) => {
|
|
95
97
|
const complexDerivedSubstitutions = this.findComplexDerivedSubstitutionsByMetavariableNode(metavariableNode);
|
|
96
98
|
|
|
97
|
-
|
|
99
|
+
return forEach(complexDerivedSubstitutions, (complexDerivedSubstitution, continuation) => {
|
|
98
100
|
const derivedSubstitution = complexDerivedSubstitution, ///
|
|
99
101
|
resolved = derivedSubstitution.isResolved();
|
|
100
102
|
|
|
101
|
-
if (
|
|
102
|
-
|
|
103
|
+
if (resolved) {
|
|
104
|
+
return continuation();
|
|
103
105
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
+
|
|
107
|
+
return derivedSubstitution.resolve(context, continuation);
|
|
108
|
+
}, continuation);
|
|
109
|
+
}, continuation);
|
|
106
110
|
}
|
|
107
111
|
|
|
108
112
|
areDerivedSubstitutionsResolved() {
|
|
@@ -238,16 +242,14 @@ export default class LiminalContext extends Context {
|
|
|
238
242
|
return complexDerivedSubstitution;
|
|
239
243
|
}
|
|
240
244
|
|
|
241
|
-
|
|
242
|
-
const
|
|
243
|
-
derivedSubstitution = this.findDerivedSubstitution((derivedSubstitution) => { ///
|
|
245
|
+
findDerivedSubstitutionByMetavariableNodeAndSubstitutionNode(metavariableNode, substitutionNode) {
|
|
246
|
+
const derivedSubstitution = this.findDerivedSubstitution((derivedSubstitution) => { ///
|
|
244
247
|
const metavariableNodeMatches = derivedSubstitution.matchMetavariableNode(metavariableNode);
|
|
245
248
|
|
|
246
249
|
if (metavariableNodeMatches) {
|
|
247
|
-
const
|
|
248
|
-
substitutionBEqualToSubstitutionA = substitutionB.isEqualTo(substitutionA);
|
|
250
|
+
const substitutionNodeMatches = derivedSubstitution.matchSubstitutionNode(substitutionNode);
|
|
249
251
|
|
|
250
|
-
if (
|
|
252
|
+
if (substitutionNodeMatches) {
|
|
251
253
|
return true;
|
|
252
254
|
}
|
|
253
255
|
}
|
|
@@ -263,8 +265,8 @@ export default class LiminalContext extends Context {
|
|
|
263
265
|
return derivedSubstitutionPresent;
|
|
264
266
|
}
|
|
265
267
|
|
|
266
|
-
|
|
267
|
-
const derivedSubstitution = this.
|
|
268
|
+
isDerivedSubstitutionPresentByMetavariableNodeAndSubstitutionNode(metavariableNode, substitutionNode) {
|
|
269
|
+
const derivedSubstitution = this.findDerivedSubstitutionByMetavariableNodeAndSubstitutionNode(metavariableNode, substitutionNode),
|
|
268
270
|
derivedSubstitutionPresent = (derivedSubstitution !== null);
|
|
269
271
|
|
|
270
272
|
return derivedSubstitutionPresent;
|
package/src/context/phaneric.js
CHANGED
|
@@ -6,7 +6,7 @@ import Context from "../context";
|
|
|
6
6
|
|
|
7
7
|
import { EMPTY_STRING } from "../constants";
|
|
8
8
|
|
|
9
|
-
const {
|
|
9
|
+
const { first } = arrayUtilities;
|
|
10
10
|
|
|
11
11
|
export default class PhanericContext extends Context {
|
|
12
12
|
constructor(context, contexts) {
|
|
@@ -34,8 +34,8 @@ export default class PhanericContext extends Context {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
static fromContexts(contexts) {
|
|
37
|
-
const
|
|
38
|
-
context =
|
|
37
|
+
const firstContext = first(contexts),
|
|
38
|
+
context = firstContext, ///
|
|
39
39
|
phanericContext = new PhanericContext(context, contexts);
|
|
40
40
|
|
|
41
41
|
return phanericContext;
|
package/src/context.js
CHANGED
|
@@ -547,9 +547,9 @@ export default class Context extends ContextBase {
|
|
|
547
547
|
return derivedSubstitutionPresent;
|
|
548
548
|
}
|
|
549
549
|
|
|
550
|
-
|
|
550
|
+
isDerivedSubstitutionPresentByMetavariableNodeAndSubstitutionNode(metavariableNode, substitutionNode) {
|
|
551
551
|
const context = this.getContext(),
|
|
552
|
-
derivedSubstitutionPresent = context.
|
|
552
|
+
derivedSubstitutionPresent = context.isDerivedSubstitutionPresentByMetavariableNodeAndSubstitutionNode(metavariableNode, substitutionNode);
|
|
553
553
|
|
|
554
554
|
return derivedSubstitutionPresent;
|
|
555
555
|
}
|
|
@@ -69,7 +69,7 @@ export default define(class ContainedAssertion extends Assertion {
|
|
|
69
69
|
validateFrame = this.validateFrame.bind(this),
|
|
70
70
|
validateStatement = this.validateStatement.bind(this);
|
|
71
71
|
|
|
72
|
-
all([
|
|
72
|
+
return all([
|
|
73
73
|
validateTerm,
|
|
74
74
|
validateFrame,
|
|
75
75
|
validateStatement
|
|
@@ -83,7 +83,7 @@ export default define(class ContainedAssertion extends Assertion {
|
|
|
83
83
|
const validatesWhenStated = this.validateWhenStated.bind(this),
|
|
84
84
|
validatesWhenDerived = this.validateWhenDerived.bind(this);
|
|
85
85
|
|
|
86
|
-
exists([
|
|
86
|
+
return exists([
|
|
87
87
|
validatesWhenStated,
|
|
88
88
|
validatesWhenDerived
|
|
89
89
|
], context, (validates) => {
|
|
@@ -180,7 +180,7 @@ export default define(class ContainedAssertion extends Assertion {
|
|
|
180
180
|
context.debug(`...validates the'${continaedAssertionString}' continaed assertion's '${frameString}' frame.`);
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
-
continuation(frameValidates);
|
|
183
|
+
return continuation(frameValidates);
|
|
184
184
|
});
|
|
185
185
|
}
|
|
186
186
|
|
|
@@ -200,7 +200,7 @@ export default define(class ContainedAssertion extends Assertion {
|
|
|
200
200
|
context.debug(`...validated the '${statementString}' statement.`);
|
|
201
201
|
}
|
|
202
202
|
|
|
203
|
-
continuation(statementValidates);
|
|
203
|
+
return continuation(statementValidates);
|
|
204
204
|
});
|
|
205
205
|
}
|
|
206
206
|
|
|
@@ -241,18 +241,16 @@ export default define(class ContainedAssertion extends Assertion {
|
|
|
241
241
|
|
|
242
242
|
context.trace(`Validating the '${containedAssertionString}' derived contained assertion...`);
|
|
243
243
|
|
|
244
|
-
validateWhenDerived(this.term, this.frame, this.statement, this.negated, context, (validatesWhenDerived) => {
|
|
244
|
+
return validateWhenDerived(this.term, this.frame, this.statement, this.negated, context, (validatesWhenDerived) => {
|
|
245
245
|
if (validatesWhenDerived) {
|
|
246
246
|
context.debug(`...validated the '${containedAssertionString}' derived contained assertion.`);
|
|
247
247
|
}
|
|
248
248
|
|
|
249
|
-
continuation(validatesWhenDerived);
|
|
249
|
+
return continuation(validatesWhenDerived);
|
|
250
250
|
});
|
|
251
251
|
}
|
|
252
252
|
|
|
253
253
|
unifyIndependently(generalContext, specificContext, continuation) {
|
|
254
|
-
let unifiesIndependently = false;
|
|
255
|
-
|
|
256
254
|
const context = specificContext, ///
|
|
257
255
|
containedAssertionString = this.getString(); ///
|
|
258
256
|
|
|
@@ -260,18 +258,21 @@ export default define(class ContainedAssertion extends Assertion {
|
|
|
260
258
|
|
|
261
259
|
const term = termFromTermAndSubstitutions(this.term, context),
|
|
262
260
|
frame = frameFromFrameAndSubstitutions(this.frame, context),
|
|
263
|
-
statement = statementFromStatementAndSubstitutions(this.statement, context)
|
|
264
|
-
validatesWhenDerived = validateWhenDerived(term, frame, statement, this.negated, context);
|
|
261
|
+
statement = statementFromStatementAndSubstitutions(this.statement, context);
|
|
265
262
|
|
|
266
|
-
|
|
267
|
-
unifiesIndependently =
|
|
268
|
-
}
|
|
263
|
+
return validateWhenDerived(term, frame, statement, this.negated, context, (validatesWhenDerived) => {
|
|
264
|
+
let unifiesIndependently = false;
|
|
269
265
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
266
|
+
if (validatesWhenDerived) {
|
|
267
|
+
unifiesIndependently = true;
|
|
268
|
+
}
|
|
273
269
|
|
|
274
|
-
|
|
270
|
+
if (unifiesIndependently) {
|
|
271
|
+
context.debug(`...unified the '${containedAssertionString}' contained assertion independently.`);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
return continuation(unifiesIndependently);
|
|
275
|
+
});
|
|
275
276
|
}
|
|
276
277
|
|
|
277
278
|
static name = "ContainedAssertion";
|
|
@@ -338,5 +339,5 @@ function validateWhenDerived(term, frame, statement, negated, context, continuat
|
|
|
338
339
|
}
|
|
339
340
|
}
|
|
340
341
|
|
|
341
|
-
continuation(validatesWhenDerived);
|
|
342
|
+
return continuation(validatesWhenDerived);
|
|
342
343
|
}
|
|
@@ -60,7 +60,7 @@ export default define(class DefinedAssertion extends Assertion {
|
|
|
60
60
|
const validateTerm = this.validateTerm.bind(this),
|
|
61
61
|
validateFrame = this.validateFrame.bind(this);
|
|
62
62
|
|
|
63
|
-
all([
|
|
63
|
+
return all([
|
|
64
64
|
validateTerm,
|
|
65
65
|
validateFrame
|
|
66
66
|
], context, (validaets) => {
|
|
@@ -73,7 +73,7 @@ export default define(class DefinedAssertion extends Assertion {
|
|
|
73
73
|
const validatesWhenStated = this.validateWhenStated.bind(this),
|
|
74
74
|
validatesWhenDerived = this.validateWhenDerived.bind(this);
|
|
75
75
|
|
|
76
|
-
exists([
|
|
76
|
+
return exists([
|
|
77
77
|
validatesWhenStated,
|
|
78
78
|
validatesWhenDerived
|
|
79
79
|
], context, (validates) => {
|
|
@@ -211,36 +211,37 @@ export default define(class DefinedAssertion extends Assertion {
|
|
|
211
211
|
|
|
212
212
|
context.trace(`Validating the '${definedAssertionString}' derived defined assertion...`);
|
|
213
213
|
|
|
214
|
-
validateWhenDerived(this.term, this.frame, this.negated, context, (validatesWhenDerived) => {
|
|
214
|
+
return validateWhenDerived(this.term, this.frame, this.negated, context, (validatesWhenDerived) => {
|
|
215
215
|
if (validatesWhenDerived) {
|
|
216
216
|
context.debug(`...validates the '${definedAssertionString}' derived defined assertion.`);
|
|
217
217
|
}
|
|
218
218
|
|
|
219
|
-
continuation(validatesWhenDerived);
|
|
219
|
+
return continuation(validatesWhenDerived);
|
|
220
220
|
});
|
|
221
221
|
}
|
|
222
222
|
|
|
223
223
|
unifyIndependently(generalContext, specificContext, continuation) {
|
|
224
|
-
let unifiesIndependently = false;
|
|
225
|
-
|
|
226
224
|
const context = specificContext, ///
|
|
227
225
|
definedAssertionString = this.getString(); ///
|
|
228
226
|
|
|
229
227
|
context.trace(`Unifying the '${definedAssertionString}' defined assertion independently...`);
|
|
230
228
|
|
|
231
229
|
const term = termFromTermAndSubstitutions(this.term, context),
|
|
232
|
-
frame = frameFromFrameAndSubstitutions(this.frame, context)
|
|
233
|
-
validatesWhenDerived = validateWhenDerived(term, frame, this.negated, context);
|
|
230
|
+
frame = frameFromFrameAndSubstitutions(this.frame, context);
|
|
234
231
|
|
|
235
|
-
|
|
236
|
-
unifiesIndependently =
|
|
237
|
-
}
|
|
232
|
+
return validateWhenDerived(term, frame, this.negated, context, (validatesWhenDerived) => {
|
|
233
|
+
let unifiesIndependently = false;
|
|
238
234
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
235
|
+
if (validatesWhenDerived) {
|
|
236
|
+
unifiesIndependently = true;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
if (unifiesIndependently) {
|
|
240
|
+
context.debug(`...unified the '${definedAssertionString}' defined assertion independently.`);
|
|
241
|
+
}
|
|
242
242
|
|
|
243
|
-
|
|
243
|
+
return continuation(unifiesIndependently);
|
|
244
|
+
});
|
|
244
245
|
}
|
|
245
246
|
|
|
246
247
|
static name = "DefinedAssertion";
|
|
@@ -342,4 +343,3 @@ function validateWhenDerived(term, frame, negated, context, continuation) {
|
|
|
342
343
|
|
|
343
344
|
continuation(validatesWhenDerived);
|
|
344
345
|
}
|
|
345
|
-
|
|
@@ -44,14 +44,12 @@ export default define(class Conclusion extends Element {
|
|
|
44
44
|
|
|
45
45
|
context.debug(`Unable to verify the '${conclusionString}' conclusion because it is nonsense.`);
|
|
46
46
|
|
|
47
|
-
continuation(verifies);
|
|
48
|
-
|
|
49
|
-
return;
|
|
47
|
+
return continuation(verifies);
|
|
50
48
|
}
|
|
51
49
|
|
|
52
50
|
declare((context) => {
|
|
53
51
|
elide((context) => {
|
|
54
|
-
this.validate(context, (validates) => {
|
|
52
|
+
return this.validate(context, (validates) => {
|
|
55
53
|
let verifies = false;
|
|
56
54
|
|
|
57
55
|
if (validates) {
|
|
@@ -62,7 +60,7 @@ export default define(class Conclusion extends Element {
|
|
|
62
60
|
context.debug(`...verified the '${conclusionString}' conclusion.`);
|
|
63
61
|
}
|
|
64
62
|
|
|
65
|
-
continuation(verifies);
|
|
63
|
+
return continuation(verifies);
|
|
66
64
|
});
|
|
67
65
|
}, context);
|
|
68
66
|
}, context);
|
|
@@ -74,7 +72,7 @@ export default define(class Conclusion extends Element {
|
|
|
74
72
|
context.trace(`Validating the '${conclusionString}' conclusion...`);
|
|
75
73
|
|
|
76
74
|
attempt((context) => {
|
|
77
|
-
this.validateStatement(context, (statementValidates) => {
|
|
75
|
+
return this.validateStatement(context, (statementValidates) => {
|
|
78
76
|
let validates = false;
|
|
79
77
|
|
|
80
78
|
if (statementValidates) {
|
|
@@ -89,7 +87,7 @@ export default define(class Conclusion extends Element {
|
|
|
89
87
|
context.debug(`...validated the '${conclusionString}' conclusion.`);
|
|
90
88
|
}
|
|
91
89
|
|
|
92
|
-
continuation(validates);
|
|
90
|
+
return continuation(validates);
|
|
93
91
|
});
|
|
94
92
|
}, context);
|
|
95
93
|
}
|
|
@@ -99,7 +97,7 @@ export default define(class Conclusion extends Element {
|
|
|
99
97
|
|
|
100
98
|
context.trace(`Validating the '${conclusionString}' conclusion's statement...`);
|
|
101
99
|
|
|
102
|
-
this.statement.validate(context, (statement) => {
|
|
100
|
+
return this.statement.validate(context, (statement) => {
|
|
103
101
|
let statementValidates = false;
|
|
104
102
|
|
|
105
103
|
if (statement !== null) {
|
|
@@ -110,7 +108,7 @@ export default define(class Conclusion extends Element {
|
|
|
110
108
|
context.trace(`...validated the '${conclusionString}' conclusion's statement.`);
|
|
111
109
|
}
|
|
112
110
|
|
|
113
|
-
continuation(statementValidates);
|
|
111
|
+
return continuation(statementValidates);
|
|
114
112
|
});
|
|
115
113
|
}
|
|
116
114
|
|
|
@@ -128,7 +126,7 @@ export default define(class Conclusion extends Element {
|
|
|
128
126
|
reconcile((specificContext) => {
|
|
129
127
|
const statement = step.getStatement();
|
|
130
128
|
|
|
131
|
-
this.statement.unifyStatement(statement, generalContext, specificContext, (statementUnifies) => {
|
|
129
|
+
return this.statement.unifyStatement(statement, generalContext, specificContext, (statementUnifies) => {
|
|
132
130
|
let stepUnifies = false;
|
|
133
131
|
|
|
134
132
|
if (statementUnifies) {
|
|
@@ -141,7 +139,7 @@ export default define(class Conclusion extends Element {
|
|
|
141
139
|
context.debug(`...unified the '${stepString}' step with the '${conclusionString}' conclusion.`);
|
|
142
140
|
}
|
|
143
141
|
|
|
144
|
-
continuation(stepUnifies);
|
|
142
|
+
return continuation(stepUnifies);
|
|
145
143
|
});
|
|
146
144
|
}, specificContext);
|
|
147
145
|
}
|
|
@@ -45,7 +45,7 @@ export default define(class VariableDeclaration extends Declaration {
|
|
|
45
45
|
const typeVerifies = this.verifyType.bind(this),
|
|
46
46
|
variableVerifies = this.verifyVariable.bind(this);
|
|
47
47
|
|
|
48
|
-
all([
|
|
48
|
+
return all([
|
|
49
49
|
typeVerifies,
|
|
50
50
|
variableVerifies
|
|
51
51
|
], context, (verifies) => {
|
package/src/element/deduction.js
CHANGED
|
@@ -72,7 +72,7 @@ export default define(class Deduction extends Element {
|
|
|
72
72
|
context.trace(`Validating the '${deductionString}' deduction...`);
|
|
73
73
|
|
|
74
74
|
attempt((context) => {
|
|
75
|
-
this.validateStatement(context, (statementValidates) => {
|
|
75
|
+
return this.validateStatement(context, (statementValidates) => {
|
|
76
76
|
let validates = false;
|
|
77
77
|
|
|
78
78
|
if (statementValidates) {
|
|
@@ -97,7 +97,7 @@ export default define(class Deduction extends Element {
|
|
|
97
97
|
|
|
98
98
|
context.trace(`Validating the '${deductionString}' deduction's statement...`);
|
|
99
99
|
|
|
100
|
-
this.statement.validate(context, (statement) => {
|
|
100
|
+
return this.statement.validate(context, (statement) => {
|
|
101
101
|
let statementValidates = false;
|
|
102
102
|
|
|
103
103
|
if (statement !== null) {
|
|
@@ -108,7 +108,7 @@ export default define(class Deduction extends Element {
|
|
|
108
108
|
context.trace(`...validated the '${deductionString}' deduction's statement.`);
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
continuation(statementValidates);
|
|
111
|
+
return continuation(statementValidates);
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
114
|
|
|
@@ -126,7 +126,7 @@ export default define(class Deduction extends Element {
|
|
|
126
126
|
reconcile((specificContext) => {
|
|
127
127
|
const statement = step.getStatement();
|
|
128
128
|
|
|
129
|
-
this.statement.unifyStatement(statement, generalContext, specificContext, (statementUnifies) => {
|
|
129
|
+
return this.statement.unifyStatement(statement, generalContext, specificContext, (statementUnifies) => {
|
|
130
130
|
let stepUnifies = false;
|
|
131
131
|
|
|
132
132
|
if (statementUnifies) {
|
|
@@ -139,7 +139,7 @@ export default define(class Deduction extends Element {
|
|
|
139
139
|
context.debug(`...unified the '${stepString}' step with the '${deductionString}' deduction.`);
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
continuation(stepUnifies);
|
|
142
|
+
return continuation(stepUnifies);
|
|
143
143
|
});
|
|
144
144
|
}, specificContext);
|
|
145
145
|
}
|
|
@@ -151,7 +151,7 @@ export default define(class Deduction extends Element {
|
|
|
151
151
|
|
|
152
152
|
context.trace(`Unifying the '${statementString}' statement with the '${deductionString}' deduction's statement...`);
|
|
153
153
|
|
|
154
|
-
this.statement.unifyStatement(statement, generalContext, specificContext, (statementUnifies) => {
|
|
154
|
+
return this.statement.unifyStatement(statement, generalContext, specificContext, (statementUnifies) => {
|
|
155
155
|
if (statementUnifies) {
|
|
156
156
|
context.debug(`...unified the '${statementString}' statement with the '${deductionString}' deduction's statement.`);
|
|
157
157
|
}
|
package/src/element/equality.js
CHANGED
|
@@ -150,7 +150,7 @@ export default define(class Equality extends Element {
|
|
|
150
150
|
const validatesWhenStated = this.validateWhenStated.bind(this),
|
|
151
151
|
validatesWhenDerived = this.validateWhenDerived.bind(this);
|
|
152
152
|
|
|
153
|
-
exists([
|
|
153
|
+
return exists([
|
|
154
154
|
validatesWhenStated,
|
|
155
155
|
validatesWhenDerived
|
|
156
156
|
], context, (validates) => {
|
|
@@ -168,7 +168,7 @@ export default define(class Equality extends Element {
|
|
|
168
168
|
context.debug(`...validated the '${equalityString}' equality.`);
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
-
continuation(equqlity);
|
|
171
|
+
return continuation(equqlity);
|
|
172
172
|
});
|
|
173
173
|
});
|
|
174
174
|
}
|
package/src/element/frame.js
CHANGED
|
@@ -157,7 +157,7 @@ export default define(class Frame extends Element {
|
|
|
157
157
|
const validatMetavariable = this.validatMetavariable.bind(this),
|
|
158
158
|
validateAssumptions = this.validateAssumptions.bind(this);
|
|
159
159
|
|
|
160
|
-
all([
|
|
160
|
+
return all([
|
|
161
161
|
validatMetavariable,
|
|
162
162
|
validateAssumptions
|
|
163
163
|
], context, (validates) => {
|
|
@@ -170,7 +170,7 @@ export default define(class Frame extends Element {
|
|
|
170
170
|
const validatesWhenStated = this.validateWhenStated.bind(this),
|
|
171
171
|
validatesWhenDerived = this.validateWhenDerived.bind(this);
|
|
172
172
|
|
|
173
|
-
exists([
|
|
173
|
+
return exists([
|
|
174
174
|
validatesWhenStated,
|
|
175
175
|
validatesWhenDerived
|
|
176
176
|
], context, (validates) => {
|
|
@@ -215,6 +215,14 @@ export default define(class Frame extends Element {
|
|
|
215
215
|
}
|
|
216
216
|
|
|
217
217
|
validateAssumptions(context, continuation) {
|
|
218
|
+
const assumptionsLength = this.assumptions.length;
|
|
219
|
+
|
|
220
|
+
if (assumptionsLength === 0) {
|
|
221
|
+
const assumptionsValidate = true;
|
|
222
|
+
|
|
223
|
+
return continuation(assumptionsValidate);
|
|
224
|
+
}
|
|
225
|
+
|
|
218
226
|
const frameString = this.getString();
|
|
219
227
|
|
|
220
228
|
context.trace(`Validating the '${frameString}' frame's assumptions...`);
|
package/src/element/goal.js
CHANGED
|
@@ -95,7 +95,7 @@ export default define(class Goal extends Element {
|
|
|
95
95
|
const validateStatement = this.validateStatement.bind(this),
|
|
96
96
|
validateReference = this.validateReference.bind(this);
|
|
97
97
|
|
|
98
|
-
all([
|
|
98
|
+
return all([
|
|
99
99
|
validateReference,
|
|
100
100
|
validateStatement
|
|
101
101
|
], context, (validates) => {
|
|
@@ -108,7 +108,7 @@ export default define(class Goal extends Element {
|
|
|
108
108
|
const validatesWhenStated = this.validateWhenStated.bind(this),
|
|
109
109
|
validatesWhenDerived = this.validateWhenDerived.bind(this);
|
|
110
110
|
|
|
111
|
-
exists([
|
|
111
|
+
return exists([
|
|
112
112
|
validatesWhenStated,
|
|
113
113
|
validatesWhenDerived
|
|
114
114
|
], context, (validates) => {
|
|
@@ -124,7 +124,7 @@ export default define(class Goal extends Element {
|
|
|
124
124
|
context.debug(`...validated the '${goalString}' goal.`);
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
continuation(goal);
|
|
127
|
+
return continuation(goal);
|
|
128
128
|
});
|
|
129
129
|
});
|
|
130
130
|
}
|
|
@@ -147,7 +147,7 @@ export default define(class Goal extends Element {
|
|
|
147
147
|
context.debug(`...validated the '${goalString}' goal's reference.`);
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
-
continuation(referenceValidates);
|
|
150
|
+
return continuation(referenceValidates);
|
|
151
151
|
});
|
|
152
152
|
}
|
|
153
153
|
|
|
@@ -167,7 +167,7 @@ export default define(class Goal extends Element {
|
|
|
167
167
|
context.debug(`...validated the '${goalString}' goal's statement.`);
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
-
continuation(statementValidates);
|
|
170
|
+
return continuation(statementValidates);
|
|
171
171
|
});
|
|
172
172
|
}
|
|
173
173
|
|
|
@@ -201,9 +201,7 @@ export default define(class Goal extends Element {
|
|
|
201
201
|
if (stated) {
|
|
202
202
|
const validatesWhenDerived = false;
|
|
203
203
|
|
|
204
|
-
continuation(validatesWhenDerived);
|
|
205
|
-
|
|
206
|
-
return;
|
|
204
|
+
return continuation(validatesWhenDerived);
|
|
207
205
|
}
|
|
208
206
|
|
|
209
207
|
let validatesWhenDerived = false;
|
package/src/element/judgement.js
CHANGED
|
@@ -162,30 +162,26 @@ export default define(class Judgement extends Element {
|
|
|
162
162
|
|
|
163
163
|
context.debug(`...the '${judgementString}' judgement is already valid.`);
|
|
164
164
|
|
|
165
|
-
continuation(judgement);
|
|
166
|
-
|
|
167
|
-
return;
|
|
165
|
+
return continuation(judgement);
|
|
168
166
|
}
|
|
169
167
|
|
|
170
168
|
const validateGoal = this.validateGoal.bind(this),
|
|
171
169
|
validateFrame = this.validateFrame.bind(this);
|
|
172
170
|
|
|
173
|
-
all([
|
|
171
|
+
return all([
|
|
174
172
|
validateFrame,
|
|
175
173
|
validateGoal
|
|
176
174
|
], context, (validates) => {
|
|
177
175
|
if (!validates) {
|
|
178
176
|
const judgement = null;
|
|
179
177
|
|
|
180
|
-
continuation(judgement);
|
|
181
|
-
|
|
182
|
-
return;
|
|
178
|
+
return continuation(judgement);
|
|
183
179
|
}
|
|
184
180
|
|
|
185
181
|
const validateWhenStated = this.validateWhenStated.bind(this),
|
|
186
182
|
validateWhenDerived = this.validateWhenDerived.bind(this);
|
|
187
183
|
|
|
188
|
-
exists([
|
|
184
|
+
return exists([
|
|
189
185
|
validateWhenStated,
|
|
190
186
|
validateWhenDerived
|
|
191
187
|
], context, (validates) => {
|
|
@@ -201,7 +197,7 @@ export default define(class Judgement extends Element {
|
|
|
201
197
|
context.debug(`...validated the '${judgementString}' judgement.`);
|
|
202
198
|
}
|
|
203
199
|
|
|
204
|
-
continuation(judgement);
|
|
200
|
+
return continuation(judgement);
|
|
205
201
|
});
|
|
206
202
|
});
|
|
207
203
|
}
|
|
@@ -224,7 +220,7 @@ export default define(class Judgement extends Element {
|
|
|
224
220
|
context.debug(`...validated the '${judgementString}' judgement's goal.`);
|
|
225
221
|
}
|
|
226
222
|
|
|
227
|
-
continuation(goalValidates);
|
|
223
|
+
return continuation(goalValidates);
|
|
228
224
|
});
|
|
229
225
|
}
|
|
230
226
|
|
|
@@ -246,7 +242,7 @@ export default define(class Judgement extends Element {
|
|
|
246
242
|
context.trace(`...validated the '${judgementString}' judgement's frame.`);
|
|
247
243
|
}
|
|
248
244
|
|
|
249
|
-
continuation(frameValidates);
|
|
245
|
+
return continuation(frameValidates);
|
|
250
246
|
});
|
|
251
247
|
}
|
|
252
248
|
|