occam-verify-cli 1.0.708 → 1.0.713
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/element/assertion/property.js +8 -5
- package/lib/element/assertion/satisfies.js +7 -3
- package/lib/element/combinator.js +20 -20
- package/lib/element/conclusion.js +8 -8
- package/lib/element/constructor.js +21 -21
- package/lib/element/declaration/combinator.js +10 -10
- package/lib/element/declaration/constructor.js +10 -10
- package/lib/element/deduction.js +8 -8
- package/lib/element/frame.js +19 -7
- package/lib/element/metavariable.js +1 -1
- package/lib/element/proofAssertion/premise.js +29 -24
- package/lib/element/proofAssertion/step.js +13 -12
- package/lib/element/proofAssertion/supposition.js +30 -25
- package/lib/element/reference.js +3 -6
- package/lib/element/rule.js +2 -2
- package/lib/element/signature.js +7 -7
- package/lib/element/statement.js +5 -3
- package/lib/element/term.js +8 -9
- package/lib/pass/zip.js +23 -0
- package/lib/process/unify.js +11 -21
- package/lib/process/validate.js +116 -2
- package/lib/process/verify.js +6 -125
- package/lib/utilities/context.js +1 -9
- package/lib/utilities/validation.js +6 -6
- package/package.json +1 -1
- package/src/element/assertion/property.js +8 -4
- package/src/element/assertion/satisfies.js +8 -2
- package/src/element/combinator.js +19 -19
- package/src/element/conclusion.js +8 -8
- package/src/element/constructor.js +21 -20
- package/src/element/declaration/combinator.js +9 -9
- package/src/element/declaration/constructor.js +9 -9
- package/src/element/deduction.js +8 -8
- package/src/element/frame.js +26 -7
- package/src/element/metavariable.js +0 -1
- package/src/element/proofAssertion/premise.js +43 -33
- package/src/element/proofAssertion/step.js +15 -13
- package/src/element/proofAssertion/supposition.js +44 -34
- package/src/element/reference.js +5 -9
- package/src/element/rule.js +1 -1
- package/src/element/signature.js +6 -6
- package/src/element/statement.js +4 -2
- package/src/element/term.js +9 -10
- package/src/pass/zip.js +19 -0
- package/src/process/unify.js +4 -34
- package/src/process/validate.js +161 -1
- package/src/process/verify.js +2 -166
- package/src/utilities/context.js +0 -9
- package/src/utilities/validation.js +5 -5
|
@@ -35,15 +35,15 @@ export default define(class Conclusion extends Element {
|
|
|
35
35
|
|
|
36
36
|
context.trace(`Verifying the '${conclusionString}' conclusion...`);
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
if (this.statement !== null) {
|
|
39
39
|
const validates = this.validate(context);
|
|
40
40
|
|
|
41
41
|
if (validates) {
|
|
42
|
-
this.setContext(context);
|
|
43
|
-
|
|
44
42
|
verifies = true;
|
|
45
43
|
}
|
|
46
|
-
}
|
|
44
|
+
} else {
|
|
45
|
+
context.debug(`Unable to verify the '${conclusionString}' conclusion because it is nonsense.`);
|
|
46
|
+
}
|
|
47
47
|
|
|
48
48
|
if (verifies) {
|
|
49
49
|
context.debug(`...verified the '${conclusionString}' conclusion.`);
|
|
@@ -59,15 +59,15 @@ export default define(class Conclusion extends Element {
|
|
|
59
59
|
|
|
60
60
|
context.trace(`Validating the '${conclusionString}' conclusion...`);
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
attempt((context) => {
|
|
63
63
|
const statementValidates = this.validateStatement(context);
|
|
64
64
|
|
|
65
65
|
if (statementValidates) {
|
|
66
|
+
this.setContext(context);
|
|
67
|
+
|
|
66
68
|
validates = true;
|
|
67
69
|
}
|
|
68
|
-
}
|
|
69
|
-
context.debug(`Unable to verify the '${conclusionString}' conclusion because it is nonsense.`);
|
|
70
|
-
}
|
|
70
|
+
}, context);
|
|
71
71
|
|
|
72
72
|
if (validates) {
|
|
73
73
|
context.debug(`...validated the '${conclusionString}' conclusion.`);
|
|
@@ -5,9 +5,9 @@ import { Element } from "occam-languages";
|
|
|
5
5
|
import { define } from "../elements";
|
|
6
6
|
import { attempt, literally } from "../utilities/context";
|
|
7
7
|
import { instantiateConstructor } from "../process/instantiate";
|
|
8
|
-
import { verifyTermAsConstructor } from "../process/verify";
|
|
9
8
|
import { termFromConstructorNode } from "../utilities/element";
|
|
10
9
|
import { unifyTermWithConstructor } from "../process/unify";
|
|
10
|
+
import { validateTermAsConstructor } from "../process/validate";
|
|
11
11
|
import { typeFromJSON, termToTermJSON, typeToTypeJSON, ephemeralContextFromJSON } from "../utilities/json";
|
|
12
12
|
|
|
13
13
|
export default define(class Constructor extends Element {
|
|
@@ -52,58 +52,59 @@ export default define(class Constructor extends Element {
|
|
|
52
52
|
this.type = type;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
let
|
|
55
|
+
validate(context) {
|
|
56
|
+
let validates = false;
|
|
57
57
|
|
|
58
58
|
const includeType = false,
|
|
59
59
|
constructorString = this.getString(includeType);
|
|
60
60
|
|
|
61
|
-
context.trace(`
|
|
61
|
+
context.trace(`Validating the '${constructorString}' constructor...`);
|
|
62
62
|
|
|
63
63
|
attempt((context) => {
|
|
64
|
-
const
|
|
64
|
+
const termValidates = this.validateTerm(context);
|
|
65
65
|
|
|
66
|
-
if (
|
|
66
|
+
if (termValidates) {
|
|
67
67
|
this.setContext(context);
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
validates = true;
|
|
70
70
|
}
|
|
71
71
|
}, context);
|
|
72
72
|
|
|
73
|
-
if (
|
|
74
|
-
context.debug(`...
|
|
73
|
+
if (validates) {
|
|
74
|
+
context.debug(`...validated the '${constructorString}' constructor.`);
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
return
|
|
77
|
+
return validates;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
|
|
81
|
-
let
|
|
80
|
+
validateTerm(context) {
|
|
81
|
+
let termValidates = false;
|
|
82
82
|
|
|
83
83
|
const termString = this.term.getString(),
|
|
84
84
|
includeType = false,
|
|
85
85
|
constructorString = this.getString(includeType);
|
|
86
86
|
|
|
87
|
-
context.trace(`
|
|
87
|
+
context.trace(`Validating the '${constructorString}' constructor's '${termString}' term...`);
|
|
88
88
|
|
|
89
|
-
const
|
|
89
|
+
const termValidatesAsConstructor = validateTermAsConstructor(this.term, context);
|
|
90
90
|
|
|
91
|
-
if (
|
|
92
|
-
|
|
91
|
+
if (termValidatesAsConstructor) {
|
|
92
|
+
termValidates = true;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
if (
|
|
96
|
-
context.debug(`...
|
|
95
|
+
if (termValidates) {
|
|
96
|
+
context.debug(`...validated the '${constructorString}' constructor's '${termString}' term.`);
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
return
|
|
99
|
+
return termValidates;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
unifyTerm(term, context, validateForwards) {
|
|
103
103
|
let termUnifies = false;
|
|
104
104
|
|
|
105
105
|
const termString = term.getString(),
|
|
106
|
-
|
|
106
|
+
includeType = false,
|
|
107
|
+
constructorString = this.getString(includeType);
|
|
107
108
|
|
|
108
109
|
context.trace(`Unifying the '${termString}' term with the '${constructorString}' constructor...`);
|
|
109
110
|
|
|
@@ -33,9 +33,9 @@ export default define(class CombinatorDeclaration extends Declaration {
|
|
|
33
33
|
|
|
34
34
|
context.trace(`Verifying the '${combinatorDeclarationString}' combinator declaration...`);
|
|
35
35
|
|
|
36
|
-
const
|
|
36
|
+
const combinatorValidates = this.validateCombinator();
|
|
37
37
|
|
|
38
|
-
if (
|
|
38
|
+
if (combinatorValidates) {
|
|
39
39
|
context.addCombinator(this.combinator);
|
|
40
40
|
|
|
41
41
|
verifies = true;
|
|
@@ -48,22 +48,22 @@ export default define(class CombinatorDeclaration extends Declaration {
|
|
|
48
48
|
return verifies;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
let
|
|
51
|
+
validateCombinator() {
|
|
52
|
+
let combinatorValidates;
|
|
53
53
|
|
|
54
54
|
const context = this.getContext(),
|
|
55
55
|
combinatorString = this.combinator.getString(),
|
|
56
56
|
combinatorDeclarationString = this.getString(); ///
|
|
57
57
|
|
|
58
|
-
context.trace(`
|
|
58
|
+
context.trace(`Validating the '${combinatorDeclarationString}' combinator declaration's '${combinatorString}' combinator...`);
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
combinatorValidates = this.combinator.validate(context);
|
|
61
61
|
|
|
62
|
-
if (
|
|
63
|
-
context.debug(`...
|
|
62
|
+
if (combinatorValidates) {
|
|
63
|
+
context.debug(`...validated the '${combinatorDeclarationString}' combinator declaration's '${combinatorString}' combinator.`);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
return
|
|
66
|
+
return combinatorValidates;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
static name = "CombinatorDeclaration";
|
|
@@ -46,9 +46,9 @@ export default define(class ConstructorDeclaration extends Declaration {
|
|
|
46
46
|
const typeVerified = this.verifyType();
|
|
47
47
|
|
|
48
48
|
if (typeVerified) {
|
|
49
|
-
const
|
|
49
|
+
const constructorValidates = this.validateConstructor();
|
|
50
50
|
|
|
51
|
-
if (
|
|
51
|
+
if (constructorValidates) {
|
|
52
52
|
this.constructor.setType(this.type);
|
|
53
53
|
|
|
54
54
|
context.addConstructor(this.constructor);
|
|
@@ -100,23 +100,23 @@ export default define(class ConstructorDeclaration extends Declaration {
|
|
|
100
100
|
return typeVerifies;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
|
|
104
|
-
let
|
|
103
|
+
validateConstructor() {
|
|
104
|
+
let constructorValidates;
|
|
105
105
|
|
|
106
106
|
const context = this.getContext(),
|
|
107
107
|
includeType = false,
|
|
108
108
|
constructorString = this.constructor.getString(includeType),
|
|
109
109
|
constructorDeclarationString = this.getString(); ///
|
|
110
110
|
|
|
111
|
-
context.trace(`
|
|
111
|
+
context.trace(`Validating the '${constructorDeclarationString}' constructor declaration's '${constructorString}' constructor...`);
|
|
112
112
|
|
|
113
|
-
|
|
113
|
+
constructorValidates = this.constructor.validate(context);
|
|
114
114
|
|
|
115
|
-
if (
|
|
116
|
-
context.debug(`...
|
|
115
|
+
if (constructorValidates) {
|
|
116
|
+
context.debug(`...validated the '${constructorDeclarationString}' constructor declaration's '${constructorString}' constructor.`);
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
return
|
|
119
|
+
return constructorValidates;
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
static name = "ConstructorDeclaration";
|
package/src/element/deduction.js
CHANGED
|
@@ -35,15 +35,15 @@ export default define(class Deduction extends Element {
|
|
|
35
35
|
|
|
36
36
|
context.trace(`Verifying the '${duductionString}' duduction...`);
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
if (this.statement !== null) {
|
|
39
39
|
const validates = this.validate(context);
|
|
40
40
|
|
|
41
41
|
if (validates) {
|
|
42
|
-
this.setContext(context);
|
|
43
|
-
|
|
44
42
|
verifies = true;
|
|
45
43
|
}
|
|
46
|
-
}
|
|
44
|
+
} else {
|
|
45
|
+
context.debug(`Unable to verify the '${duductionString}' duduction because it is nonsense.`);
|
|
46
|
+
}
|
|
47
47
|
|
|
48
48
|
if (verifies) {
|
|
49
49
|
context.debug(`...verified the '${duductionString}' duduction.`);
|
|
@@ -59,15 +59,15 @@ export default define(class Deduction extends Element {
|
|
|
59
59
|
|
|
60
60
|
context.trace(`Validating the '${duductionString}' duduction...`);
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
attempt((context) => {
|
|
63
63
|
const statementValidates = this.validateStatement(context);
|
|
64
64
|
|
|
65
65
|
if (statementValidates) {
|
|
66
|
+
this.setContext(context);
|
|
67
|
+
|
|
66
68
|
validates = true;
|
|
67
69
|
}
|
|
68
|
-
}
|
|
69
|
-
context.debug(`Unable to verify the '${duductionString}' duduction because it is nonsense.`);
|
|
70
|
-
}
|
|
70
|
+
}, context);
|
|
71
71
|
|
|
72
72
|
if (validates) {
|
|
73
73
|
context.debug(`...validated the '${duductionString}' duduction.`);
|
package/src/element/frame.js
CHANGED
|
@@ -252,6 +252,25 @@ export default define(class Frame extends Element {
|
|
|
252
252
|
return validatesWhenDerived;
|
|
253
253
|
}
|
|
254
254
|
|
|
255
|
+
validateAssumption(assumption, context) {
|
|
256
|
+
let assumptionValidates;
|
|
257
|
+
|
|
258
|
+
const frameString = this.getString(), ///
|
|
259
|
+
assumptionstring = assumption.getString();
|
|
260
|
+
|
|
261
|
+
context.trace(`Validating the '${frameString}' frame's '${assumptionstring}' assumption.`);
|
|
262
|
+
|
|
263
|
+
const stated = true; ///
|
|
264
|
+
|
|
265
|
+
assumptionValidates = assumption.validate(stated, context);
|
|
266
|
+
|
|
267
|
+
if (assumptionValidates) {
|
|
268
|
+
context.debug(`...validated the '${frameString}' frame's '${assumptionstring}' assumption.`);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
return assumptionValidates;
|
|
272
|
+
}
|
|
273
|
+
|
|
255
274
|
validateAssumptions(stated, context) {
|
|
256
275
|
let assumptionsValidate;
|
|
257
276
|
|
|
@@ -261,14 +280,12 @@ export default define(class Frame extends Element {
|
|
|
261
280
|
const frameString = this.getString(), ///
|
|
262
281
|
assumptionsString = assumptionsStringFromAssumptions(this.assumptions);
|
|
263
282
|
|
|
264
|
-
context.trace(`Validating the '${
|
|
265
|
-
|
|
266
|
-
stated = true; ///
|
|
283
|
+
context.trace(`Validating the '${frameString}' frame's '${assumptionsString}' assumptions...`);
|
|
267
284
|
|
|
268
285
|
const assumptions = [];
|
|
269
286
|
|
|
270
287
|
assumptionsValidate = this.assumptions.every((assumption) => {
|
|
271
|
-
const assumptionValidates =
|
|
288
|
+
const assumptionValidates = this.validateAssumption(assumption, context);
|
|
272
289
|
|
|
273
290
|
if (assumptionValidates) {
|
|
274
291
|
assumptions.push(assumption);
|
|
@@ -280,7 +297,7 @@ export default define(class Frame extends Element {
|
|
|
280
297
|
if (assumptionsValidate) {
|
|
281
298
|
this.assumptions = assumptions;
|
|
282
299
|
|
|
283
|
-
context.debug(`...validated the '${
|
|
300
|
+
context.debug(`...validated the '${frameString}' frame's '${assumptionsString}' assumptions.`);
|
|
284
301
|
}
|
|
285
302
|
} else {
|
|
286
303
|
assumptionsValidate = true;
|
|
@@ -335,9 +352,11 @@ export default define(class Frame extends Element {
|
|
|
335
352
|
const metaTypeName = metaType.getName();
|
|
336
353
|
|
|
337
354
|
if (metaTypeName === FRAME_META_TYPE_NAME) {
|
|
338
|
-
const
|
|
355
|
+
const frame = this.validate(stated, context);
|
|
339
356
|
|
|
340
|
-
|
|
357
|
+
if (frame !== null) {
|
|
358
|
+
validatesGivenMetaType = true;
|
|
359
|
+
}
|
|
341
360
|
}
|
|
342
361
|
|
|
343
362
|
if (validatesGivenMetaType) {
|
|
@@ -41,18 +41,17 @@ export default define(class Premise extends ProofAssertion {
|
|
|
41
41
|
|
|
42
42
|
context.trace(`Verifying the '${premiseString}' premise...`);
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
const statement = this.getStatement(),
|
|
45
|
+
procedureCall = this.getProcedureCall();
|
|
46
|
+
|
|
47
|
+
if ((statement !== null) || (procedureCall !== null)) {
|
|
45
48
|
const validates = this.validate(context);
|
|
46
49
|
|
|
47
50
|
if (validates) {
|
|
48
|
-
this.setContext(context);
|
|
49
|
-
|
|
50
51
|
verifies = true;
|
|
51
52
|
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (verifies) {
|
|
55
|
-
context.debug(`...verified the '${premiseString}' premise.`);
|
|
53
|
+
} else {
|
|
54
|
+
context.debug(`Unable to validate the '${premiseString}' premise because it is nonsense.`);
|
|
56
55
|
}
|
|
57
56
|
|
|
58
57
|
return verifies;
|
|
@@ -65,26 +64,30 @@ export default define(class Premise extends ProofAssertion {
|
|
|
65
64
|
|
|
66
65
|
context.trace(`Validatting the '${premiseString}' premise...`);
|
|
67
66
|
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
attempt((context) => {
|
|
68
|
+
const statement = this.getStatement(),
|
|
69
|
+
procedureCall = this.getProcedureCall();
|
|
70
|
+
|
|
71
|
+
if (statement !== null) {
|
|
72
|
+
const statementValidates = this.validateStatement(context);
|
|
70
73
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
} else if (statement !== null) {
|
|
74
|
-
const statementValidates = this.validateStatement(context);
|
|
74
|
+
if (statementValidates) {
|
|
75
|
+
this.setContext(context);
|
|
75
76
|
|
|
76
|
-
|
|
77
|
-
|
|
77
|
+
validates = true;
|
|
78
|
+
}
|
|
78
79
|
}
|
|
79
|
-
} else if (procedureCall !== null) {
|
|
80
|
-
const procedureCallValidates = this.validateProcedureCall(context);
|
|
81
80
|
|
|
82
|
-
if (
|
|
83
|
-
|
|
81
|
+
if (procedureCall !== null) {
|
|
82
|
+
const procedureCallValidates = this.validateProcedureCall(context);
|
|
83
|
+
|
|
84
|
+
if (procedureCallValidates) {
|
|
85
|
+
this.setContext(context);
|
|
86
|
+
|
|
87
|
+
validates = true;
|
|
88
|
+
}
|
|
84
89
|
}
|
|
85
|
-
}
|
|
86
|
-
context.debug(`Unable to validate the '${premiseString}' premise because it is nonsense.`);
|
|
87
|
-
}
|
|
90
|
+
}, context);
|
|
88
91
|
|
|
89
92
|
if (validates) {
|
|
90
93
|
context.debug(`...validated the '${premiseString}' premise.`);
|
|
@@ -101,7 +104,11 @@ export default define(class Premise extends ProofAssertion {
|
|
|
101
104
|
|
|
102
105
|
context.trace(`Validatting the '${premiseString}' premise's '${procedureCallString}' procedure call...`);
|
|
103
106
|
|
|
104
|
-
|
|
107
|
+
const procedureCall = this.procedureCall.validate(context);
|
|
108
|
+
|
|
109
|
+
if (procedureCall !== null) {
|
|
110
|
+
procedureCallValidates = true;
|
|
111
|
+
}
|
|
105
112
|
|
|
106
113
|
if (procedureCallValidates) {
|
|
107
114
|
context.debug(`...validated the '${premiseString}' premise's '${procedureCallString}' procedure call.`);
|
|
@@ -150,7 +157,7 @@ export default define(class Premise extends ProofAssertion {
|
|
|
150
157
|
}
|
|
151
158
|
|
|
152
159
|
unifyProofAssertion(proofAssertion, context) {
|
|
153
|
-
let proofAssertionUnifies;
|
|
160
|
+
let proofAssertionUnifies = false;
|
|
154
161
|
|
|
155
162
|
const premiseString = this.getString(), ///
|
|
156
163
|
proofAssertionString = proofAssertion.getString();
|
|
@@ -160,18 +167,21 @@ export default define(class Premise extends ProofAssertion {
|
|
|
160
167
|
const proofAssertionContext = proofAssertion.getContext(),
|
|
161
168
|
premiseContext = this.getContext(),
|
|
162
169
|
generalContext = premiseContext, ///
|
|
163
|
-
specificContext = proofAssertionContext
|
|
170
|
+
specificContext = proofAssertionContext,
|
|
171
|
+
statementUnifies = liminally((specificContext) => {
|
|
172
|
+
const statement = proofAssertion.getStatement(),
|
|
173
|
+
statementUnifies = this.unifyStatement(statement, generalContext, specificContext);
|
|
164
174
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
statementUnifies = this.unifyStatement(statement, generalContext, specificContext);
|
|
175
|
+
if (statementUnifies) {
|
|
176
|
+
specificContext.commit(context);
|
|
168
177
|
|
|
169
|
-
|
|
170
|
-
|
|
178
|
+
return true;
|
|
179
|
+
}
|
|
180
|
+
}, specificContext);
|
|
171
181
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
}
|
|
182
|
+
if (statementUnifies) {
|
|
183
|
+
proofAssertionUnifies = true;
|
|
184
|
+
}
|
|
175
185
|
|
|
176
186
|
if (proofAssertionUnifies) {
|
|
177
187
|
context.debug(`...unified the '${proofAssertionString}' proof assertion with the '${premiseString}' premise.`);
|
|
@@ -6,7 +6,7 @@ import ProofAssertion from "../proofAssertion";
|
|
|
6
6
|
|
|
7
7
|
import { define } from "../../elements";
|
|
8
8
|
import { unifyStatements } from "../../utilities/unification";
|
|
9
|
-
import {
|
|
9
|
+
import { attempt, asyncLiminally } from "../../utilities/context";
|
|
10
10
|
import { propertyAssertionFromStatement } from "../../utilities/statement";
|
|
11
11
|
|
|
12
12
|
const { asyncSome } = asynchronousUtilities;
|
|
@@ -75,19 +75,23 @@ export default define(class Step extends ProofAssertion {
|
|
|
75
75
|
|
|
76
76
|
context.trace(`Verifying the '${stepString}' step...`);
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
const statement = this.getStatement();
|
|
79
|
+
|
|
80
|
+
if (statement !== null) {
|
|
79
81
|
const validates = this.validate(context);
|
|
80
82
|
|
|
81
83
|
if (validates) {
|
|
82
|
-
|
|
84
|
+
context = this.getContext();
|
|
83
85
|
|
|
84
|
-
|
|
85
|
-
this.setContext(context);
|
|
86
|
+
const unifiies = await this.unify(context);
|
|
86
87
|
|
|
88
|
+
if (unifiies) {
|
|
87
89
|
verifies = true;
|
|
88
90
|
}
|
|
89
91
|
}
|
|
90
|
-
}
|
|
92
|
+
} else {
|
|
93
|
+
context.debug(`Unable to verify the '${stepString}' step because it is nonsense.`);
|
|
94
|
+
}
|
|
91
95
|
|
|
92
96
|
if (verifies) {
|
|
93
97
|
context.debug(`...verified the '${stepString}' step.`);
|
|
@@ -103,9 +107,7 @@ export default define(class Step extends ProofAssertion {
|
|
|
103
107
|
|
|
104
108
|
context.trace(`Validating the '${stepString}' step...`);
|
|
105
109
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
if (statement !== null) {
|
|
110
|
+
attempt((context) => {
|
|
109
111
|
const referenceValidates = this.validateReference(context);
|
|
110
112
|
|
|
111
113
|
if (referenceValidates) {
|
|
@@ -115,16 +117,16 @@ export default define(class Step extends ProofAssertion {
|
|
|
115
117
|
const statementValidates = this.validateStatement(context);
|
|
116
118
|
|
|
117
119
|
if (statementValidates) {
|
|
120
|
+
this.setContext(context);
|
|
121
|
+
|
|
118
122
|
validates = true;
|
|
119
123
|
}
|
|
120
124
|
}
|
|
121
125
|
}
|
|
122
|
-
}
|
|
123
|
-
context.debug(`Unable to validate the '${stepString}' step because it is nonsense.`);
|
|
124
|
-
}
|
|
126
|
+
}, context);
|
|
125
127
|
|
|
126
128
|
if (validates) {
|
|
127
|
-
context.debug(`...
|
|
129
|
+
context.debug(`...validated the '${stepString}' step.`);
|
|
128
130
|
}
|
|
129
131
|
|
|
130
132
|
return validates;
|
|
@@ -37,22 +37,21 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
37
37
|
|
|
38
38
|
await this.break(context);
|
|
39
39
|
|
|
40
|
-
const suppositionString = this.getString();
|
|
40
|
+
const suppositionString = this.getString();
|
|
41
41
|
|
|
42
42
|
context.trace(`Verifying the '${suppositionString}' supposition...`);
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
const statement = this.getStatement(),
|
|
45
|
+
procedureCall = this.getProcedureCall();
|
|
46
|
+
|
|
47
|
+
if ((statement !== null) || (procedureCall !== null)) {
|
|
45
48
|
const validates = this.validate(context);
|
|
46
49
|
|
|
47
50
|
if (validates) {
|
|
48
|
-
this.setContext(context);
|
|
49
|
-
|
|
50
51
|
verifies = true;
|
|
51
52
|
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (verifies) {
|
|
55
|
-
context.debug(`...verified the '${suppositionString}' supposition.`);
|
|
53
|
+
} else {
|
|
54
|
+
context.debug(`Unable to validate the '${suppositionString}' supposition because it is nonsense.`);
|
|
56
55
|
}
|
|
57
56
|
|
|
58
57
|
return verifies;
|
|
@@ -65,26 +64,30 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
65
64
|
|
|
66
65
|
context.trace(`Validatting the '${suppositionString}' supposition...`);
|
|
67
66
|
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
attempt((context) => {
|
|
68
|
+
const statement = this.getStatement(),
|
|
69
|
+
procedureCall = this.getProcedureCall();
|
|
70
|
+
|
|
71
|
+
if (statement !== null) {
|
|
72
|
+
const statementValidates = this.validateStatement(context);
|
|
70
73
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
} else if (statement !== null) {
|
|
74
|
-
const statementValidates = this.validateStatement(context);
|
|
74
|
+
if (statementValidates) {
|
|
75
|
+
this.setContext(context);
|
|
75
76
|
|
|
76
|
-
|
|
77
|
-
|
|
77
|
+
validates = true;
|
|
78
|
+
}
|
|
78
79
|
}
|
|
79
|
-
} else if (procedureCall !== null) {
|
|
80
|
-
const procedureCallValidates = this.validateProcedureCall(context);
|
|
81
80
|
|
|
82
|
-
if (
|
|
83
|
-
|
|
81
|
+
if (procedureCall !== null) {
|
|
82
|
+
const procedureCallValidates = this.validateProcedureCall(context);
|
|
83
|
+
|
|
84
|
+
if (procedureCallValidates) {
|
|
85
|
+
this.setContext(context);
|
|
86
|
+
|
|
87
|
+
validates = true;
|
|
88
|
+
}
|
|
84
89
|
}
|
|
85
|
-
}
|
|
86
|
-
context.debug(`Unable to validate the '${suppositionString}' supposition because it is nonsense.`);
|
|
87
|
-
}
|
|
90
|
+
}, context);
|
|
88
91
|
|
|
89
92
|
if (validates) {
|
|
90
93
|
context.debug(`...validated the '${suppositionString}' supposition.`);
|
|
@@ -101,7 +104,11 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
101
104
|
|
|
102
105
|
context.trace(`Validatting the '${suppositionString}' supposition's '${procedureCallString}' procedure call...`);
|
|
103
106
|
|
|
104
|
-
|
|
107
|
+
const procedureCall = this.procedureCall.validate(context);
|
|
108
|
+
|
|
109
|
+
if (procedureCall !== null) {
|
|
110
|
+
procedureCallValidates =true;
|
|
111
|
+
}
|
|
105
112
|
|
|
106
113
|
if (procedureCallValidates) {
|
|
107
114
|
context.debug(`...validated the '${suppositionString}' supposition's '${procedureCallString}' procedure call.`);
|
|
@@ -172,7 +179,7 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
172
179
|
}
|
|
173
180
|
|
|
174
181
|
unifyProofAssertion(proofAssertion, context) {
|
|
175
|
-
let proofAssertionUnifies;
|
|
182
|
+
let proofAssertionUnifies = false;
|
|
176
183
|
|
|
177
184
|
const suppositionString = this.getString(), ///
|
|
178
185
|
proofAssertionString = proofAssertion.getString();
|
|
@@ -182,18 +189,21 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
182
189
|
const proofAssertionContext = proofAssertion.getContext(),
|
|
183
190
|
suppositionContext = this.getContext(),
|
|
184
191
|
generalContext = suppositionContext, ///
|
|
185
|
-
specificContext = proofAssertionContext
|
|
192
|
+
specificContext = proofAssertionContext,
|
|
193
|
+
statementUnifies = liminally((specificContext) => {
|
|
194
|
+
const statement = proofAssertion.getStatement(),
|
|
195
|
+
statementUnifies = this.unifyStatement(statement, generalContext, specificContext);
|
|
186
196
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
statementUnifies = this.unifyStatement(statement, generalContext, specificContext);
|
|
197
|
+
if (statementUnifies) {
|
|
198
|
+
specificContext.commit(context);
|
|
190
199
|
|
|
191
|
-
|
|
192
|
-
|
|
200
|
+
return true;
|
|
201
|
+
}
|
|
202
|
+
}, specificContext);
|
|
193
203
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
}
|
|
204
|
+
if (statementUnifies) {
|
|
205
|
+
proofAssertionUnifies = true;
|
|
206
|
+
}
|
|
197
207
|
|
|
198
208
|
if (proofAssertionUnifies) {
|
|
199
209
|
context.debug(`...unified the '${proofAssertionString}' proof assertion with the '${suppositionString}' supposition.`);
|