occam-verify-cli 1.0.635 → 1.0.641
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 +1 -1
- package/lib/context/liminal.js +3 -3
- package/lib/context/scoped.js +25 -3
- package/lib/context.js +15 -1
- package/lib/element/assertion/contained.js +34 -23
- package/lib/element/assertion/defined.js +30 -21
- package/lib/element/assertion/property.js +24 -21
- package/lib/element/assertion/satisfies.js +19 -14
- package/lib/element/assertion/subproof.js +18 -13
- package/lib/element/assertion/type.js +23 -20
- package/lib/element/assertion.js +5 -5
- package/lib/element/assumption.js +30 -24
- package/lib/element/combinator/bracketed.js +3 -3
- package/lib/element/combinator.js +6 -6
- package/lib/element/conclusion.js +6 -2
- package/lib/element/constructor/bracketed.js +5 -3
- package/lib/element/declaration/combinator.js +15 -2
- package/lib/element/declaration/constructor.js +129 -60
- package/lib/element/deduction.js +6 -2
- package/lib/element/derivation.js +4 -5
- package/lib/element/equality.js +37 -31
- package/lib/element/frame.js +26 -21
- package/lib/element/hypothesis.js +8 -10
- package/lib/element/judgement.js +53 -21
- package/lib/element/metavariable.js +18 -10
- package/lib/element/proofAssertion/premise.js +8 -8
- package/lib/element/proofAssertion/step.js +16 -11
- package/lib/element/proofAssertion/supposition.js +7 -7
- package/lib/element/proofAssertion.js +7 -5
- package/lib/element/propertyRelation.js +7 -3
- package/lib/element/reference.js +28 -21
- package/lib/element/rule.js +4 -11
- package/lib/element/signature.js +10 -4
- package/lib/element/statement.js +16 -16
- package/lib/element/subDerivation.js +4 -11
- package/lib/element/subproof.js +37 -29
- package/lib/element/substitution/frame.js +18 -10
- package/lib/element/substitution/reference.js +17 -9
- package/lib/element/substitution/statement.js +16 -10
- package/lib/element/substitution/term.js +19 -9
- package/lib/element/substitution.js +5 -5
- package/lib/element/term.js +18 -15
- package/lib/element/topLevelAssertion.js +4 -11
- package/lib/element/topLevelMetaAssertion.js +4 -11
- package/lib/element/variable.js +6 -3
- package/lib/process/assign.js +1 -9
- package/lib/process/unify.js +8 -8
- package/lib/process/validate.js +14 -7
- package/lib/process/verify.js +14 -7
- package/lib/utilities/element.js +124 -46
- package/lib/utilities/unification.js +6 -6
- package/lib/utilities/validation.js +68 -55
- package/package.json +7 -7
- package/src/context/file/nominal.js +2 -2
- package/src/context/liminal.js +2 -2
- package/src/context/scoped.js +20 -2
- package/src/context.js +13 -0
- package/src/element/assertion/contained.js +40 -24
- package/src/element/assertion/defined.js +38 -24
- package/src/element/assertion/property.js +28 -22
- package/src/element/assertion/satisfies.js +21 -13
- package/src/element/assertion/subproof.js +21 -13
- package/src/element/assertion/type.js +28 -22
- package/src/element/assertion.js +4 -4
- package/src/element/assumption.js +32 -24
- package/src/element/combinator/bracketed.js +2 -2
- package/src/element/combinator.js +5 -6
- package/src/element/conclusion.js +7 -2
- package/src/element/constructor/bracketed.js +4 -2
- package/src/element/declaration/combinator.js +19 -1
- package/src/element/declaration/constructor.js +123 -60
- package/src/element/deduction.js +7 -2
- package/src/element/derivation.js +2 -3
- package/src/element/equality.js +45 -36
- package/src/element/frame.js +30 -21
- package/src/element/hypothesis.js +9 -6
- package/src/element/judgement.js +65 -21
- package/src/element/metavariable.js +31 -16
- package/src/element/proofAssertion/premise.js +7 -7
- package/src/element/proofAssertion/step.js +16 -10
- package/src/element/proofAssertion/supposition.js +6 -6
- package/src/element/proofAssertion.js +7 -4
- package/src/element/propertyRelation.js +8 -2
- package/src/element/reference.js +31 -21
- package/src/element/rule.js +3 -6
- package/src/element/signature.js +21 -10
- package/src/element/statement.js +15 -15
- package/src/element/subDerivation.js +2 -5
- package/src/element/subproof.js +9 -3
- package/src/element/substitution/frame.js +21 -9
- package/src/element/substitution/reference.js +20 -8
- package/src/element/substitution/statement.js +17 -9
- package/src/element/substitution/term.js +24 -8
- package/src/element/substitution.js +4 -4
- package/src/element/term.js +18 -14
- package/src/element/topLevelAssertion.js +3 -6
- package/src/element/topLevelMetaAssertion.js +3 -6
- package/src/element/variable.js +8 -4
- package/src/process/assign.js +0 -6
- package/src/process/unify.js +7 -7
- package/src/process/validate.js +23 -14
- package/src/process/verify.js +26 -17
- package/src/utilities/element.js +187 -76
- package/src/utilities/unification.js +4 -5
- package/src/utilities/validation.js +83 -75
|
@@ -66,7 +66,7 @@ export default define(class Step extends ProofAssertion {
|
|
|
66
66
|
return comparesToTermAndPropertyRelation;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
validate(
|
|
69
|
+
validate(context) {
|
|
70
70
|
let validates = false;
|
|
71
71
|
|
|
72
72
|
const stepString = this.getString(); ///
|
|
@@ -82,7 +82,7 @@ export default define(class Step extends ProofAssertion {
|
|
|
82
82
|
const satisfiesAssertioValidates = this.validateSatisfiesAssertion(context);
|
|
83
83
|
|
|
84
84
|
if (satisfiesAssertioValidates) {
|
|
85
|
-
const statementValidates = this.validateStatement(
|
|
85
|
+
const statementValidates = this.validateStatement(context);
|
|
86
86
|
|
|
87
87
|
if (statementValidates) {
|
|
88
88
|
validates = true;
|
|
@@ -109,7 +109,11 @@ export default define(class Step extends ProofAssertion {
|
|
|
109
109
|
|
|
110
110
|
context.trace(`Validating the '${stepString}' step's '${referenceString}' reference... `);
|
|
111
111
|
|
|
112
|
-
|
|
112
|
+
const reference = this.reference.validate(context);
|
|
113
|
+
|
|
114
|
+
if (reference === null) {
|
|
115
|
+
referenceValidates = false;
|
|
116
|
+
}
|
|
113
117
|
|
|
114
118
|
if (referenceValidates) {
|
|
115
119
|
context.debug(`...validated the '${stepString}' step's '${referenceString}' reference. `);
|
|
@@ -124,17 +128,19 @@ export default define(class Step extends ProofAssertion {
|
|
|
124
128
|
|
|
125
129
|
if (this.satisfiesAssertion !== null) {
|
|
126
130
|
const stepString = this.getString(), ///
|
|
127
|
-
|
|
131
|
+
satisfiesAssertionString = this.satisfiesAssertion.getString();
|
|
128
132
|
|
|
129
|
-
context.trace(`Validating the '${stepString}' step's '${
|
|
133
|
+
context.trace(`Validating the '${stepString}' step's '${satisfiesAssertionString}' satisfies assertion... `);
|
|
130
134
|
|
|
131
135
|
const stated = true,
|
|
132
|
-
|
|
136
|
+
satisfiesAssertion = this.satisfiesAssertion.validate(stated, context);
|
|
133
137
|
|
|
134
|
-
|
|
138
|
+
if (satisfiesAssertion !== null) {
|
|
139
|
+
satisfiesAssertionValidates = true;
|
|
140
|
+
}
|
|
135
141
|
|
|
136
142
|
if (satisfiesAssertionValidates) {
|
|
137
|
-
context.debug(`...validating the '${stepString}' step's '${
|
|
143
|
+
context.debug(`...validating the '${stepString}' step's '${satisfiesAssertionString}' satisfies assertion. `);
|
|
138
144
|
}
|
|
139
145
|
}
|
|
140
146
|
|
|
@@ -173,7 +179,7 @@ export default define(class Step extends ProofAssertion {
|
|
|
173
179
|
return unifiesWithSatisfiesAssertion;
|
|
174
180
|
}
|
|
175
181
|
|
|
176
|
-
async verify(
|
|
182
|
+
async verify(context) {
|
|
177
183
|
let verifies = false;
|
|
178
184
|
|
|
179
185
|
await this.break(context);
|
|
@@ -183,7 +189,7 @@ export default define(class Step extends ProofAssertion {
|
|
|
183
189
|
context.trace(`Verifying the '${stepString}' step...`);
|
|
184
190
|
|
|
185
191
|
await asyncAttempt(async (context) => {
|
|
186
|
-
const validates = this.validate(
|
|
192
|
+
const validates = this.validate(context);
|
|
187
193
|
|
|
188
194
|
if (validates) {
|
|
189
195
|
const unifies = await this.unify(context);
|
|
@@ -30,7 +30,7 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
30
30
|
return stated;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
validate(
|
|
33
|
+
validate(context) {
|
|
34
34
|
let validates = false;
|
|
35
35
|
|
|
36
36
|
const suppositionString = this.getString(); ///
|
|
@@ -43,13 +43,13 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
43
43
|
if (false) {
|
|
44
44
|
///
|
|
45
45
|
} else if (statement !== null) {
|
|
46
|
-
const statementValidates = this.validateStatement(
|
|
46
|
+
const statementValidates = this.validateStatement(context);
|
|
47
47
|
|
|
48
48
|
if (statementValidates) {
|
|
49
49
|
validates = true;
|
|
50
50
|
}
|
|
51
51
|
} else if (procedureCall !== null) {
|
|
52
|
-
const procedureCallValidates = this.validateProcedureCall(
|
|
52
|
+
const procedureCallValidates = this.validateProcedureCall(context);
|
|
53
53
|
|
|
54
54
|
if (procedureCallValidates) {
|
|
55
55
|
validates = true;
|
|
@@ -65,7 +65,7 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
65
65
|
return validates;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
validateProcedureCall(
|
|
68
|
+
validateProcedureCall(context) {
|
|
69
69
|
let procedureCallValidates = false;
|
|
70
70
|
|
|
71
71
|
const suppositionString = this.getString(), ///
|
|
@@ -216,7 +216,7 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
216
216
|
return subproofUnifies;
|
|
217
217
|
}
|
|
218
218
|
|
|
219
|
-
async verify(
|
|
219
|
+
async verify(context) {
|
|
220
220
|
let verifies = false;
|
|
221
221
|
|
|
222
222
|
await this.break(context);
|
|
@@ -226,7 +226,7 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
226
226
|
context.trace(`Verifying the '${suppositionString}' supposition...`);
|
|
227
227
|
|
|
228
228
|
attempt((context) => {
|
|
229
|
-
const validates = this.validate(
|
|
229
|
+
const validates = this.validate(context);
|
|
230
230
|
|
|
231
231
|
if (validates) {
|
|
232
232
|
this.setContext(context);
|
|
@@ -53,17 +53,20 @@ export default class ProofAssertion extends Element {
|
|
|
53
53
|
return comparesToStatement;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
validateStatement(
|
|
57
|
-
let statementValidates;
|
|
56
|
+
validateStatement(context) {
|
|
57
|
+
let statementValidates = false;
|
|
58
58
|
|
|
59
59
|
const statementString = this.statement.getString(),
|
|
60
60
|
proofAssertionString = this.getString(); ///
|
|
61
61
|
|
|
62
62
|
context.trace(`Validating the '${proofAssertionString}' proof assertion's '${statementString}' statement... `);
|
|
63
63
|
|
|
64
|
-
const stated = this.isStated()
|
|
64
|
+
const stated = this.isStated(),
|
|
65
|
+
statement = this.statement.validate(stated, context);
|
|
65
66
|
|
|
66
|
-
|
|
67
|
+
if (statement !== null) {
|
|
68
|
+
statementValidates = true;
|
|
69
|
+
}
|
|
67
70
|
|
|
68
71
|
if (statementValidates) {
|
|
69
72
|
context.debug(`...validated the '${proofAssertionString}' proof assertion's '${statementString}' statement. `);
|
|
@@ -50,18 +50,24 @@ export default define(class PropertyRelation extends Element {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
validateTerm(context) {
|
|
53
|
-
let termValidates;
|
|
53
|
+
let termValidates = false;
|
|
54
54
|
|
|
55
55
|
const termString = this.term.getString();
|
|
56
56
|
|
|
57
57
|
context.trace(`Validating the '${termString}' term...`);
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
const term = this.term.validate(context, () => {
|
|
60
60
|
const validatesForwards = true;
|
|
61
61
|
|
|
62
62
|
return validatesForwards;
|
|
63
63
|
});
|
|
64
64
|
|
|
65
|
+
if (term !== null) {
|
|
66
|
+
this.term = term;
|
|
67
|
+
|
|
68
|
+
termValidates = true;
|
|
69
|
+
}
|
|
70
|
+
|
|
65
71
|
if (termValidates) {
|
|
66
72
|
context.debug(`...validated the '${termString}' term.`);
|
|
67
73
|
}
|
package/src/element/reference.js
CHANGED
|
@@ -54,12 +54,12 @@ export default define(class Reference extends Element {
|
|
|
54
54
|
return equalTo;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
findValidRefernece(context) {
|
|
58
58
|
const metavariableNode = this.getMetavariableNode(),
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
reference = context.findReferenceByMetavariableNode(metavariableNode),
|
|
60
|
+
validReference = reference; ///
|
|
61
61
|
|
|
62
|
-
return
|
|
62
|
+
return validReference;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
isEqualTo(reference) {
|
|
@@ -111,38 +111,48 @@ export default define(class Reference extends Element {
|
|
|
111
111
|
matchMetavariableNode(metavariableNode) { return this.metavariable.matchMetavariableNode(metavariableNode); }
|
|
112
112
|
|
|
113
113
|
validate(context) {
|
|
114
|
-
let
|
|
114
|
+
let reference = null;
|
|
115
115
|
|
|
116
116
|
const referenceString = this.getString(); ///
|
|
117
117
|
|
|
118
118
|
context.trace(`Validating the '${referenceString}' reference...`);
|
|
119
119
|
|
|
120
|
-
|
|
121
|
-
const metavariableValidates = this.validateMetavariable(context);
|
|
120
|
+
const validRefernece = this.findValidRefernece(context);
|
|
122
121
|
|
|
123
|
-
|
|
124
|
-
|
|
122
|
+
if (validRefernece !== null) {
|
|
123
|
+
reference = validRefernece; ///
|
|
124
|
+
|
|
125
|
+
context.debug(`...the '${referenceString}' reference is alrady valid.`);
|
|
126
|
+
} else {
|
|
127
|
+
let validates = false;
|
|
128
|
+
|
|
129
|
+
if (!validates) {
|
|
130
|
+
const metavariableValidates = this.validateMetavariable(context);
|
|
131
|
+
|
|
132
|
+
if (metavariableValidates) {
|
|
133
|
+
validates = true;
|
|
134
|
+
}
|
|
125
135
|
}
|
|
126
|
-
}
|
|
127
136
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
137
|
+
if (!validates) {
|
|
138
|
+
const reference = this, ///
|
|
139
|
+
labelPresent = context.isLabelPresentByReference(reference);
|
|
131
140
|
|
|
132
|
-
|
|
133
|
-
|
|
141
|
+
if (labelPresent) {
|
|
142
|
+
validates = true;
|
|
143
|
+
}
|
|
134
144
|
}
|
|
135
|
-
}
|
|
136
145
|
|
|
137
|
-
|
|
138
|
-
|
|
146
|
+
if (validates) {
|
|
147
|
+
reference = this; ///
|
|
139
148
|
|
|
140
|
-
|
|
149
|
+
context.addReference(reference);
|
|
141
150
|
|
|
142
|
-
|
|
151
|
+
context.debug(`...validated the '${referenceString}' reference.`);
|
|
152
|
+
}
|
|
143
153
|
}
|
|
144
154
|
|
|
145
|
-
return
|
|
155
|
+
return reference;
|
|
146
156
|
}
|
|
147
157
|
|
|
148
158
|
validateMetavariable(context) {
|
package/src/element/rule.js
CHANGED
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
import { arrayUtilities } from "necessary";
|
|
4
4
|
import { Element, asynchronousUtilities } from "occam-languages";
|
|
5
5
|
|
|
6
|
-
import assignAssignments from "../process/assign";
|
|
7
|
-
|
|
8
6
|
import { define } from "../elements";
|
|
9
7
|
import { asyncScope } from "../utilities/context";
|
|
10
8
|
import { labelsFromJSON,
|
|
@@ -180,14 +178,13 @@ export default define(class Rule extends Element {
|
|
|
180
178
|
context.trace(`Verifying the '${ruleString}' rule's premises...`);
|
|
181
179
|
|
|
182
180
|
premisesVerify = await asyncForwardsEvery(this.premises, async (premise) => {
|
|
183
|
-
const
|
|
184
|
-
premiseVerifies = await premise.verify(assignments, context)
|
|
181
|
+
const premiseVerifies = await premise.verify(context)
|
|
185
182
|
|
|
186
183
|
if (premiseVerifies) {
|
|
187
|
-
assignAssignments(assignments, context);
|
|
188
|
-
|
|
189
184
|
const subproofOrProofAssertion = premise; ////
|
|
190
185
|
|
|
186
|
+
context.assignAssignments();
|
|
187
|
+
|
|
191
188
|
context.addSubproofOrProofAssertion(subproofOrProofAssertion);
|
|
192
189
|
|
|
193
190
|
return true;
|
package/src/element/signature.js
CHANGED
|
@@ -28,23 +28,34 @@ export default define(class Signature extends Element {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
verify(context) {
|
|
31
|
-
let verifies;
|
|
31
|
+
let verifies = false;
|
|
32
32
|
|
|
33
33
|
const signatureString = this.getString(); ///
|
|
34
34
|
|
|
35
35
|
context.trace(`Verifying the '${signatureString}' signature...`);
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
const terms = [],
|
|
38
|
+
termsValidate = this.terms.every((term) => {
|
|
39
|
+
term = term.validate(context, () => { ///
|
|
40
|
+
const validatesForwards = true;
|
|
40
41
|
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
return validatesForwards;
|
|
43
|
+
});
|
|
43
44
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
const termValidates = (term !== null);
|
|
46
|
+
|
|
47
|
+
if (termValidates) {
|
|
48
|
+
terms.push(term);
|
|
49
|
+
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
if (termsValidate) {
|
|
55
|
+
this.terms = terms;
|
|
56
|
+
|
|
57
|
+
verifies = true;
|
|
58
|
+
}
|
|
48
59
|
|
|
49
60
|
if (verifies) {
|
|
50
61
|
context.debug(`...verified the '${signatureString}' signature.`);
|
package/src/element/statement.js
CHANGED
|
@@ -62,12 +62,12 @@ export default define(class Statement extends Element {
|
|
|
62
62
|
return comparesToMetavariableName;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
findValidStatment(context) {
|
|
66
66
|
const statementNode = this.getStatementNode(),
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
statement = context.findStatementByStatementNode(statementNode),
|
|
68
|
+
validStatement = statement; ///
|
|
69
69
|
|
|
70
|
-
return
|
|
70
|
+
return validStatement;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
isEqualTo(statement) {
|
|
@@ -172,23 +172,23 @@ export default define(class Statement extends Element {
|
|
|
172
172
|
return comparesToMetavariableName;
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
-
validate(
|
|
176
|
-
let
|
|
175
|
+
validate(stated, context) {
|
|
176
|
+
let statement = null;
|
|
177
177
|
|
|
178
178
|
const statementString = this.getString(); ///
|
|
179
179
|
|
|
180
180
|
context.trace(`Validating the '${statementString}' statement...`);
|
|
181
181
|
|
|
182
|
-
const
|
|
182
|
+
const validStatement = this.findValidStatment(context);
|
|
183
183
|
|
|
184
|
-
if (
|
|
185
|
-
|
|
184
|
+
if (validStatement !== null) {
|
|
185
|
+
statement = validStatement; ///
|
|
186
186
|
|
|
187
187
|
context.debug(`...the '${statementString}' statement is alrady valid.`);
|
|
188
188
|
} else {
|
|
189
|
-
validates = validateStatements.some((validateStatement) => {
|
|
189
|
+
const validates = validateStatements.some((validateStatement) => {
|
|
190
190
|
const statement = this, ///
|
|
191
|
-
statementValidates = validateStatement(statement,
|
|
191
|
+
statementValidates = validateStatement(statement, stated, context);
|
|
192
192
|
|
|
193
193
|
if (statementValidates) {
|
|
194
194
|
return true;
|
|
@@ -196,7 +196,7 @@ export default define(class Statement extends Element {
|
|
|
196
196
|
});
|
|
197
197
|
|
|
198
198
|
if (validates) {
|
|
199
|
-
|
|
199
|
+
statement = this; ///
|
|
200
200
|
|
|
201
201
|
context.addStatement(statement);
|
|
202
202
|
|
|
@@ -204,10 +204,10 @@ export default define(class Statement extends Element {
|
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
|
|
207
|
-
return
|
|
207
|
+
return statement;
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
-
validateGivenMetaType(metaType,
|
|
210
|
+
validateGivenMetaType(metaType, stated, context) {
|
|
211
211
|
let validatesGivenMetaType = false;
|
|
212
212
|
|
|
213
213
|
const metaTypeString = metaType.getString(),
|
|
@@ -218,7 +218,7 @@ export default define(class Statement extends Element {
|
|
|
218
218
|
const metaTypeName = metaType.getName();
|
|
219
219
|
|
|
220
220
|
if (metaTypeName === STATEMENT_META_TYPE_NAME) {
|
|
221
|
-
const validates = this.validate(
|
|
221
|
+
const validates = this.validate(stated, context)
|
|
222
222
|
|
|
223
223
|
validatesGivenMetaType = validates; ///
|
|
224
224
|
}
|
|
@@ -5,8 +5,6 @@ import { Element, asynchronousUtilities } from "occam-languages";
|
|
|
5
5
|
|
|
6
6
|
import { define } from "../elements";
|
|
7
7
|
|
|
8
|
-
import assignAssignments from "../process/assign";
|
|
9
|
-
|
|
10
8
|
const { last } = arrayUtilities,
|
|
11
9
|
{ asyncEvery } = asynchronousUtilities;
|
|
12
10
|
|
|
@@ -39,11 +37,10 @@ export default define(class SubDerivation extends Element {
|
|
|
39
37
|
let verifies;
|
|
40
38
|
|
|
41
39
|
verifies = await asyncEvery(this.subproofOrProofAssertions, async (subproofOrProofAssertion) => { ///
|
|
42
|
-
const
|
|
43
|
-
subproofOrProofAssertionVarifies = await subproofOrProofAssertion.verify(assignments, context);
|
|
40
|
+
const subproofOrProofAssertionVarifies = await subproofOrProofAssertion.verify(context);
|
|
44
41
|
|
|
45
42
|
if (subproofOrProofAssertionVarifies) {
|
|
46
|
-
assignAssignments(
|
|
43
|
+
context.assignAssignments();
|
|
47
44
|
|
|
48
45
|
context.addSubproofOrProofAssertion(subproofOrProofAssertion);
|
|
49
46
|
|
package/src/element/subproof.js
CHANGED
|
@@ -54,14 +54,20 @@ export default define(class Subproof extends Element {
|
|
|
54
54
|
return proofAssertion;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
async verify(
|
|
57
|
+
async verify(context) {
|
|
58
58
|
let verifies = false;
|
|
59
59
|
|
|
60
60
|
await asyncScope(async () => {
|
|
61
|
-
const suppositionsVerify = asyncEvery(this.suppositions, async (supposition) => {
|
|
62
|
-
const suppositionVerifies = await supposition.verify(
|
|
61
|
+
const suppositionsVerify = await asyncEvery(this.suppositions, async (supposition) => {
|
|
62
|
+
const suppositionVerifies = await supposition.verify(context);
|
|
63
63
|
|
|
64
64
|
if (suppositionVerifies) {
|
|
65
|
+
const subproofOrProofAssertion = supposition; ////
|
|
66
|
+
|
|
67
|
+
context.assignAssignments(context);
|
|
68
|
+
|
|
69
|
+
context.addSubproofOrProofAssertion(subproofOrProofAssertion);
|
|
70
|
+
|
|
65
71
|
return true;
|
|
66
72
|
}
|
|
67
73
|
});
|
|
@@ -71,7 +71,7 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
validate(generalContext, specificContext) {
|
|
74
|
-
let
|
|
74
|
+
let frameSubstitution = null;
|
|
75
75
|
|
|
76
76
|
const context = this.getContext();
|
|
77
77
|
|
|
@@ -81,13 +81,15 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
81
81
|
|
|
82
82
|
context.trace(`Validating the '${frameSubstitutionString}' frame substitution...`);
|
|
83
83
|
|
|
84
|
-
const
|
|
84
|
+
const validSubstitution = this.findValidSubstiution(context);
|
|
85
85
|
|
|
86
|
-
if (
|
|
87
|
-
|
|
86
|
+
if (validSubstitution) {
|
|
87
|
+
frameSubstitution = validSubstitution; ///
|
|
88
88
|
|
|
89
89
|
context.debug(`...the '${frameSubstitutionString}' frame substitution is already valid.`);
|
|
90
90
|
} else {
|
|
91
|
+
let validates = false;
|
|
92
|
+
|
|
91
93
|
const targetFrameValidates = this.validateTargetFrame(generalContext, specificContext);
|
|
92
94
|
|
|
93
95
|
if (targetFrameValidates) {
|
|
@@ -101,13 +103,15 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
101
103
|
if (validates) {
|
|
102
104
|
const substitution = this; ///
|
|
103
105
|
|
|
106
|
+
frameSubstitution = substitution; ///
|
|
107
|
+
|
|
104
108
|
context.addSubstitution(substitution);
|
|
105
109
|
|
|
106
110
|
context.debug(`...validated the '${frameSubstitutionString}' frame substitution.`);
|
|
107
111
|
}
|
|
108
112
|
}
|
|
109
113
|
|
|
110
|
-
return
|
|
114
|
+
return frameSubstitution;
|
|
111
115
|
}
|
|
112
116
|
|
|
113
117
|
validateTargetFrame(generalContext, specificContext) {
|
|
@@ -123,9 +127,13 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
123
127
|
|
|
124
128
|
if (targetFrameSingular) {
|
|
125
129
|
const stated = true,
|
|
126
|
-
|
|
130
|
+
tragetFrame = this.targetFrame.validate(stated, context);
|
|
131
|
+
|
|
132
|
+
if (tragetFrame !== null) {
|
|
133
|
+
this.targetFrame = tragetFrame;
|
|
127
134
|
|
|
128
|
-
|
|
135
|
+
targetFrameValidates = true;
|
|
136
|
+
}
|
|
129
137
|
} else {
|
|
130
138
|
context.debug(`The '${frameSubstitutionString}' frame subtitution's '${targetFrameString}' target frame is not singular.`);
|
|
131
139
|
}
|
|
@@ -147,9 +155,13 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
147
155
|
context.trace(`Validating the '${frameSubstitutionString}' frame subtitution's '${replacementFrameString}' replacement frame...`);
|
|
148
156
|
|
|
149
157
|
const stated = true,
|
|
150
|
-
|
|
158
|
+
replacementFrame = this.replacementFrame.validate(stated, context);
|
|
159
|
+
|
|
160
|
+
if (replacementFrame !== null) {
|
|
161
|
+
this.replacementFrame = replacementFrame;
|
|
151
162
|
|
|
152
|
-
|
|
163
|
+
replacementFrameValidates = true;
|
|
164
|
+
}
|
|
153
165
|
|
|
154
166
|
if (replacementFrameValidates) {
|
|
155
167
|
context.debug(`...validated the '${frameSubstitutionString}' frame subtitution's '${replacementFrameString}' replacement frame.`);
|
|
@@ -71,7 +71,7 @@ export default define(class ReferenceSubstitution extends Substitution {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
validate(generalContext, specificContext) {
|
|
74
|
-
let
|
|
74
|
+
let referenceSubstitution = null;
|
|
75
75
|
|
|
76
76
|
const context = this.getContext();
|
|
77
77
|
|
|
@@ -81,13 +81,15 @@ export default define(class ReferenceSubstitution extends Substitution {
|
|
|
81
81
|
|
|
82
82
|
context.trace(`Validating the '${referenceSubstitutionString}' reference substitution...`);
|
|
83
83
|
|
|
84
|
-
const
|
|
84
|
+
const validSubstitution = this.findValidSubstiution(context);
|
|
85
85
|
|
|
86
|
-
if (
|
|
87
|
-
|
|
86
|
+
if (validSubstitution) {
|
|
87
|
+
referenceSubstitution = validSubstitution; ///
|
|
88
88
|
|
|
89
89
|
context.debug(`...the '${referenceSubstitutionString}' reference substitution is already valid.`);
|
|
90
90
|
} else {
|
|
91
|
+
let validates = false;
|
|
92
|
+
|
|
91
93
|
const targetReferenceValidates = this.validateTargetReference(generalContext, specificContext);
|
|
92
94
|
|
|
93
95
|
if (targetReferenceValidates) {
|
|
@@ -101,13 +103,15 @@ export default define(class ReferenceSubstitution extends Substitution {
|
|
|
101
103
|
if (validates) {
|
|
102
104
|
const subsitution = this; ///
|
|
103
105
|
|
|
106
|
+
referenceSubstitution = subsitution; ///
|
|
107
|
+
|
|
104
108
|
context.addSubstitution(subsitution);
|
|
105
109
|
|
|
106
110
|
context.debug(`...validated the '${referenceSubstitutionString}' reference substitution.`);
|
|
107
111
|
}
|
|
108
112
|
}
|
|
109
113
|
|
|
110
|
-
return
|
|
114
|
+
return referenceSubstitution;
|
|
111
115
|
}
|
|
112
116
|
|
|
113
117
|
validateTargetReference(generalContext, specificContext) {
|
|
@@ -122,7 +126,11 @@ export default define(class ReferenceSubstitution extends Substitution {
|
|
|
122
126
|
const targetReferenceSingular = this.targetReference.isSingular();
|
|
123
127
|
|
|
124
128
|
if (targetReferenceSingular) {
|
|
125
|
-
|
|
129
|
+
const targetReference = this.targetReference.validate(context);
|
|
130
|
+
|
|
131
|
+
if (targetReference !== null) {
|
|
132
|
+
targetReferenceValidates = true;
|
|
133
|
+
}
|
|
126
134
|
} else {
|
|
127
135
|
context.debug(`The '${referenceSubstitutionString}' reference subtitution's '${targetReferenceString}' target reference is not singular.`);
|
|
128
136
|
}
|
|
@@ -135,7 +143,7 @@ export default define(class ReferenceSubstitution extends Substitution {
|
|
|
135
143
|
}
|
|
136
144
|
|
|
137
145
|
validateReplacementReference(generalContext, specificContext) {
|
|
138
|
-
let replacementReferenceValidates;
|
|
146
|
+
let replacementReferenceValidates = false;
|
|
139
147
|
|
|
140
148
|
const context = specificContext, ///
|
|
141
149
|
replacementReferenceString = this.replacementReference.getString(),
|
|
@@ -143,7 +151,11 @@ export default define(class ReferenceSubstitution extends Substitution {
|
|
|
143
151
|
|
|
144
152
|
context.trace(`Validating the '${referenceSubstitutionString}' reference subtitution's '${replacementReferenceString}' replacement reference...`);
|
|
145
153
|
|
|
146
|
-
|
|
154
|
+
const replacementReference = this.replacementReference.validate(context);
|
|
155
|
+
|
|
156
|
+
if (replacementReference !== null) {
|
|
157
|
+
replacementReferenceValidates = true;
|
|
158
|
+
}
|
|
147
159
|
|
|
148
160
|
if (replacementReferenceValidates) {
|
|
149
161
|
context.debug(`...validated the '${referenceSubstitutionString}' reference subtitution's '${replacementReferenceString}' replacement reference.`);
|