occam-verify-cli 1.0.768 → 1.0.776
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 +11 -11
- package/lib/context/illative.js +28 -0
- package/lib/context/nested.js +27 -0
- package/lib/context/proof.js +232 -0
- package/lib/context/thetic.js +28 -0
- package/lib/context.js +15 -21
- package/lib/element/assertion/contained.js +24 -22
- package/lib/element/assertion/defined.js +20 -19
- package/lib/element/assertion/property.js +14 -13
- package/lib/element/assertion/satisfies.js +8 -9
- package/lib/element/assertion/subproof.js +23 -26
- package/lib/element/assertion/type.js +9 -11
- package/lib/element/assumption.js +32 -39
- package/lib/element/combinator/bracketed.js +3 -3
- package/lib/element/combinator.js +20 -20
- package/lib/element/conclusion.js +33 -29
- package/lib/element/constructor.js +19 -18
- package/lib/element/deduction.js +33 -29
- package/lib/element/equality.js +13 -15
- package/lib/element/equivalence.js +59 -52
- package/lib/element/frame.js +41 -34
- package/lib/element/hypothesis.js +7 -5
- package/lib/element/judgement.js +32 -73
- package/lib/element/label.js +22 -22
- package/lib/element/metavariable.js +23 -7
- package/lib/element/proofAssertion/premise.js +48 -35
- package/lib/element/proofAssertion/step.js +35 -20
- package/lib/element/proofAssertion/supposition.js +48 -34
- package/lib/element/proofAssertion.js +1 -14
- package/lib/element/reference.js +80 -53
- package/lib/element/signature.js +44 -3
- package/lib/element/statement.js +28 -29
- package/lib/element/subproof.js +2 -2
- package/lib/element/substitution/frame.js +24 -19
- package/lib/element/substitution/metaLevel.js +31 -27
- package/lib/element/substitution/reference.js +11 -10
- package/lib/element/substitution/statement.js +30 -23
- package/lib/element/substitution/term.js +11 -10
- package/lib/element/term.js +24 -20
- package/lib/element/topLevelMetaAssertion.js +2 -2
- package/lib/element/variable.js +6 -2
- package/lib/process/assign.js +10 -4
- package/lib/process/unify.js +8 -8
- package/lib/process/validate.js +10 -8
- package/lib/utilities/context.js +68 -23
- package/lib/utilities/element.js +55 -27
- package/lib/utilities/json.js +8 -8
- package/lib/utilities/statement.js +1 -8
- package/lib/utilities/string.js +12 -1
- package/lib/utilities/unification.js +9 -7
- package/lib/utilities/validation.js +39 -31
- package/package.json +1 -1
- package/src/context/file/nominal.js +14 -16
- package/src/context/illative.js +17 -0
- package/src/context/nested.js +15 -0
- package/src/context/{scoped.js → proof.js} +73 -73
- package/src/context/thetic.js +17 -0
- package/src/context.js +23 -36
- package/src/element/assertion/contained.js +28 -28
- package/src/element/assertion/defined.js +23 -23
- package/src/element/assertion/property.js +15 -14
- package/src/element/assertion/satisfies.js +7 -9
- package/src/element/assertion/subproof.js +26 -31
- package/src/element/assertion/type.js +10 -12
- package/src/element/assumption.js +33 -54
- package/src/element/combinator/bracketed.js +2 -2
- package/src/element/combinator.js +23 -29
- package/src/element/conclusion.js +37 -40
- package/src/element/constructor.js +29 -34
- package/src/element/deduction.js +36 -39
- package/src/element/equality.js +16 -18
- package/src/element/equivalence.js +76 -67
- package/src/element/frame.js +42 -34
- package/src/element/hypothesis.js +7 -6
- package/src/element/judgement.js +34 -44
- package/src/element/label.js +25 -31
- package/src/element/metavariable.js +32 -12
- package/src/element/proofAssertion/premise.js +63 -49
- package/src/element/proofAssertion/step.js +43 -23
- package/src/element/proofAssertion/supposition.js +64 -50
- package/src/element/proofAssertion.js +0 -22
- package/src/element/reference.js +119 -80
- package/src/element/signature.js +5 -2
- package/src/element/statement.js +30 -35
- package/src/element/subproof.js +1 -1
- package/src/element/substitution/frame.js +27 -26
- package/src/element/substitution/metaLevel.js +38 -42
- package/src/element/substitution/reference.js +13 -14
- package/src/element/substitution/statement.js +35 -33
- package/src/element/substitution/term.js +13 -14
- package/src/element/term.js +42 -34
- package/src/element/topLevelMetaAssertion.js +1 -1
- package/src/element/variable.js +8 -1
- package/src/process/assign.js +9 -3
- package/src/process/unify.js +7 -7
- package/src/process/validate.js +9 -8
- package/src/utilities/context.js +82 -31
- package/src/utilities/element.js +68 -31
- package/src/utilities/json.js +13 -13
- package/src/utilities/statement.js +1 -9
- package/src/utilities/string.js +16 -2
- package/src/utilities/unification.js +10 -9
- package/src/utilities/validation.js +50 -38
- package/lib/context/scoped.js +0 -232
- package/lib/utilities/term.js +0 -17
- package/src/utilities/term.js +0 -10
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import Context from "../context";
|
|
4
|
+
|
|
5
|
+
export default class NestedContext extends Context {
|
|
6
|
+
addAssignment(assignment) {
|
|
7
|
+
///
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
static fromNothing(context) {
|
|
11
|
+
const nestedContext = new NestedContext(context);
|
|
12
|
+
|
|
13
|
+
return nestedContext;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -7,7 +7,7 @@ import elements from "../elements";
|
|
|
7
7
|
|
|
8
8
|
const { last } = arrayUtilities;
|
|
9
9
|
|
|
10
|
-
class
|
|
10
|
+
class ProofContext extends Context {
|
|
11
11
|
constructor(context, variables, judgements, assignments, equivalences, subproofOrProofAssertions, metaLevelSubstitutions) {
|
|
12
12
|
super(context);
|
|
13
13
|
|
|
@@ -134,7 +134,7 @@ class ScopedContext extends Context {
|
|
|
134
134
|
const context = this, ///
|
|
135
135
|
equalityString = equality.getString();
|
|
136
136
|
|
|
137
|
-
context.trace(`Adding the '${equalityString}' equality to the
|
|
137
|
+
context.trace(`Adding the '${equalityString}' equality to the proof context...`);
|
|
138
138
|
|
|
139
139
|
const equalityRelfexive = equality.isReflexive();
|
|
140
140
|
|
|
@@ -144,9 +144,9 @@ class ScopedContext extends Context {
|
|
|
144
144
|
|
|
145
145
|
this.equivalences = this.equivalences.mergedWithEquivalence(equivalence, context);
|
|
146
146
|
|
|
147
|
-
context.debug(`...added the '${equalityString}' equality to the
|
|
147
|
+
context.debug(`...added the '${equalityString}' equality to the proof context.`);
|
|
148
148
|
} else {
|
|
149
|
-
context.debug(`The '${equalityString}' equality
|
|
149
|
+
context.debug(`The reflexive '${equalityString}' equality has not been added to the proof context.`);
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
152
|
|
|
@@ -154,37 +154,34 @@ class ScopedContext extends Context {
|
|
|
154
154
|
const context = this, ///
|
|
155
155
|
variableString = variable.getString();
|
|
156
156
|
|
|
157
|
-
context.trace(`Adding the '${variableString}' variable to the
|
|
157
|
+
context.trace(`Adding the '${variableString}' variable to the proof context...`);
|
|
158
158
|
|
|
159
159
|
this.variables.push(variable);
|
|
160
160
|
|
|
161
|
-
context.debug(`...added the '${variableString}' variable to the
|
|
161
|
+
context.debug(`...added the '${variableString}' variable to the proof context.`);
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
addJudgement(judgement) {
|
|
165
165
|
const context = this, ///
|
|
166
166
|
judgementString = judgement.getString();
|
|
167
167
|
|
|
168
|
-
context.trace(`Adding the '${judgementString}' judgement to the
|
|
168
|
+
context.trace(`Adding the '${judgementString}' judgement to the proof context...`);
|
|
169
169
|
|
|
170
170
|
this.judgements.push(judgement);
|
|
171
171
|
|
|
172
|
-
context.debug(`...added the '${judgementString}' judgement to the
|
|
172
|
+
context.debug(`...added the '${judgementString}' judgement to the proof context.`);
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
addAssignment(assignment) {
|
|
176
176
|
this.assignments.push(assignment);
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
-
|
|
180
|
-
const context = this
|
|
181
|
-
subproofOrProofAssertionString = subproofOrProofAssertion.getString();
|
|
182
|
-
|
|
183
|
-
context.trace(`Adding the '${subproofOrProofAssertionString}' subproof or proof assertion to the scoped context...`);
|
|
184
|
-
|
|
185
|
-
this.subproofOrProofAssertions.push(subproofOrProofAssertion);
|
|
179
|
+
assignAssignments() {
|
|
180
|
+
const context = this; ///
|
|
186
181
|
|
|
187
|
-
|
|
182
|
+
this.assignments.forEach((assignment) => {
|
|
183
|
+
assignment(context);
|
|
184
|
+
});
|
|
188
185
|
}
|
|
189
186
|
|
|
190
187
|
addMetaLevelSubstitution(metaLevelSubstitution) {
|
|
@@ -198,7 +195,7 @@ class ScopedContext extends Context {
|
|
|
198
195
|
metaLevelSubstitutionA = metaLevelSubstitution, ///
|
|
199
196
|
metaLevelSubstitutionString = metaLevelSubstitution.getString();
|
|
200
197
|
|
|
201
|
-
context.trace(`Adding the '${metaLevelSubstitutionString}' meta-level substitution to the
|
|
198
|
+
context.trace(`Adding the '${metaLevelSubstitutionString}' meta-level substitution to the proof context...`);
|
|
202
199
|
|
|
203
200
|
const metaLevelSubstitutionB = this.metaLevelSubstitutions.find((metaLevelSubstitution) => {
|
|
204
201
|
const metaLevelSubstitutionB = metaLevelSubstitution, ///
|
|
@@ -210,66 +207,37 @@ class ScopedContext extends Context {
|
|
|
210
207
|
}) || null;
|
|
211
208
|
|
|
212
209
|
if (metaLevelSubstitutionB !== null) {
|
|
213
|
-
context.debug(`The '${metaLevelSubstitutionString}' meta-level substitution has already been added to the
|
|
210
|
+
context.debug(`The '${metaLevelSubstitutionString}' meta-level substitution has already been added to the proof context.`);
|
|
214
211
|
} else {
|
|
215
212
|
this.metaLevelSubstitutions.push(metaLevelSubstitution);
|
|
216
213
|
|
|
217
|
-
context.debug(`...added the '${metaLevelSubstitutionString}' substitution to the
|
|
214
|
+
context.debug(`...added the '${metaLevelSubstitutionString}' substitution to the proof context.`);
|
|
218
215
|
}
|
|
219
216
|
}
|
|
220
217
|
|
|
221
|
-
|
|
222
|
-
const context = this
|
|
223
|
-
|
|
224
|
-
this.assignments.forEach((assignment) => {
|
|
225
|
-
assignment(context);
|
|
226
|
-
});
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
findEquivalenceByTerm(term) { return this.equivalences.findEquivalenceByTerm(term); }
|
|
218
|
+
addSubproofOrProofAssertion(subproofOrProofAssertion) {
|
|
219
|
+
const context = this, ///
|
|
220
|
+
subproofOrProofAssertionString = subproofOrProofAssertion.getString();
|
|
230
221
|
|
|
231
|
-
|
|
232
|
-
const judgements = this.getJudgements(),
|
|
233
|
-
judgement = judgements.find((judgement) => {
|
|
234
|
-
const judgementMetavariableComparesToMetavariable = judgement.compareMetavariableName(metavariableName);
|
|
222
|
+
context.trace(`Adding the '${subproofOrProofAssertionString}' subproof or proof assertion to the proof context...`);
|
|
235
223
|
|
|
236
|
-
|
|
237
|
-
return true;
|
|
238
|
-
}
|
|
239
|
-
}) || null;
|
|
224
|
+
this.subproofOrProofAssertions.push(subproofOrProofAssertion);
|
|
240
225
|
|
|
241
|
-
|
|
226
|
+
context.debug(`...added the '${subproofOrProofAssertionString}' subproof or proof assertion to the proof context.`);
|
|
242
227
|
}
|
|
243
228
|
|
|
244
|
-
|
|
245
|
-
const
|
|
246
|
-
|
|
247
|
-
|
|
229
|
+
compareTermAndPropertyRelation(term, propertyRelation) {
|
|
230
|
+
const context = this, ///
|
|
231
|
+
proofAssertions = this.getProofAssertions(),
|
|
232
|
+
comparesToTermAndPropertyRelation = proofAssertions.some((proofAssertion) => {
|
|
233
|
+
const comparesToTermAndPropertyRelation = proofAssertion.compareTermAndPropertyRelation(term, propertyRelation, context);
|
|
248
234
|
|
|
249
|
-
if (
|
|
235
|
+
if (comparesToTermAndPropertyRelation) {
|
|
250
236
|
return true;
|
|
251
237
|
}
|
|
252
|
-
})
|
|
253
|
-
|
|
254
|
-
return variable;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
findMetaLevelSubstitutionByMetaLevelSubstitutionNode(metaLevelSubstitutionNode) {
|
|
258
|
-
let metaLevelSubstitution;
|
|
259
|
-
|
|
260
|
-
if (this.metaLevelSubstitutions === null) {
|
|
261
|
-
metaLevelSubstitution = super.findMetaLevelSubstitutionByMetaLevelSubstitutionNode(metaLevelSubstitutionNode);
|
|
262
|
-
} else {
|
|
263
|
-
metaLevelSubstitution = this.metaLevelSubstitutions.find((metaLevelSubstitution) => {
|
|
264
|
-
const metaLevelSubstitutionNodeMatches = metaLevelSubstitution.matchMetaLevelSubstitutionNode(metaLevelSubstitutionNode);
|
|
265
|
-
|
|
266
|
-
if (metaLevelSubstitutionNodeMatches) {
|
|
267
|
-
return true;
|
|
268
|
-
}
|
|
269
|
-
}) || null;
|
|
270
|
-
}
|
|
238
|
+
});
|
|
271
239
|
|
|
272
|
-
return
|
|
240
|
+
return comparesToTermAndPropertyRelation;
|
|
273
241
|
}
|
|
274
242
|
|
|
275
243
|
isTermGrounded(term) {
|
|
@@ -307,18 +275,50 @@ class ScopedContext extends Context {
|
|
|
307
275
|
return variablePresent;
|
|
308
276
|
}
|
|
309
277
|
|
|
310
|
-
|
|
311
|
-
const context = this, ///
|
|
312
|
-
proofAssertions = this.getProofAssertions(),
|
|
313
|
-
comparesToTermAndPropertyRelation = proofAssertions.some((proofAssertion) => {
|
|
314
|
-
const comparesToTermAndPropertyRelation = proofAssertion.compareTermAndPropertyRelation(term, propertyRelation, context);
|
|
278
|
+
findEquivalenceByTerm(term) { return this.equivalences.findEquivalenceByTerm(term); }
|
|
315
279
|
|
|
316
|
-
|
|
280
|
+
findJudgementByMetavariableName(metavariableName) {
|
|
281
|
+
const judgements = this.getJudgements(),
|
|
282
|
+
judgement = judgements.find((judgement) => {
|
|
283
|
+
const judgementMetavariableComparesToMetavariable = judgement.compareMetavariableName(metavariableName);
|
|
284
|
+
|
|
285
|
+
if (judgementMetavariableComparesToMetavariable) {
|
|
317
286
|
return true;
|
|
318
287
|
}
|
|
319
|
-
});
|
|
288
|
+
}) || null;
|
|
320
289
|
|
|
321
|
-
return
|
|
290
|
+
return judgement;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
findVariableByVariableIdentifier(variableIdentifier) {
|
|
294
|
+
const variables = this.getVariables(),
|
|
295
|
+
variable = variables.find((variable) => {
|
|
296
|
+
const variableComparesToVariableIdentifier = variable.compareVariableIdentifier(variableIdentifier);
|
|
297
|
+
|
|
298
|
+
if (variableComparesToVariableIdentifier) {
|
|
299
|
+
return true;
|
|
300
|
+
}
|
|
301
|
+
}) || null;
|
|
302
|
+
|
|
303
|
+
return variable;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
findMetaLevelSubstitutionByMetaLevelSubstitutionNode(metaLevelSubstitutionNode) {
|
|
307
|
+
let metaLevelSubstitution;
|
|
308
|
+
|
|
309
|
+
if (this.metaLevelSubstitutions === null) {
|
|
310
|
+
metaLevelSubstitution = super.findMetaLevelSubstitutionByMetaLevelSubstitutionNode(metaLevelSubstitutionNode);
|
|
311
|
+
} else {
|
|
312
|
+
metaLevelSubstitution = this.metaLevelSubstitutions.find((metaLevelSubstitution) => {
|
|
313
|
+
const metaLevelSubstitutionNodeMatches = metaLevelSubstitution.matchMetaLevelSubstitutionNode(metaLevelSubstitutionNode);
|
|
314
|
+
|
|
315
|
+
if (metaLevelSubstitutionNodeMatches) {
|
|
316
|
+
return true;
|
|
317
|
+
}
|
|
318
|
+
}) || null;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
return metaLevelSubstitution;
|
|
322
322
|
}
|
|
323
323
|
|
|
324
324
|
static fromMetaLevelSubstitutions(metaLevelSubstitutions, context) {
|
|
@@ -328,10 +328,10 @@ class ScopedContext extends Context {
|
|
|
328
328
|
assignments = [],
|
|
329
329
|
equivalences = Equivalences.fromNothing(context),
|
|
330
330
|
subproofOrProofAssertions = [],
|
|
331
|
-
|
|
331
|
+
proofContext = new ProofContext(context, variables, judgements, assignments, equivalences, subproofOrProofAssertions, metaLevelSubstitutions);
|
|
332
332
|
|
|
333
|
-
return
|
|
333
|
+
return proofContext;
|
|
334
334
|
}
|
|
335
335
|
}
|
|
336
336
|
|
|
337
|
-
export default
|
|
337
|
+
export default ProofContext;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import Context from "../context";
|
|
4
|
+
|
|
5
|
+
export default class TheticContext extends Context {
|
|
6
|
+
isStated() {
|
|
7
|
+
const stated = true;
|
|
8
|
+
|
|
9
|
+
return stated;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
static fromNothing(context) {
|
|
13
|
+
const theticContext = new TheticContext(context);
|
|
14
|
+
|
|
15
|
+
return theticContext;
|
|
16
|
+
}
|
|
17
|
+
}
|
package/src/context.js
CHANGED
|
@@ -148,35 +148,23 @@ export default class Context extends ContextBase {
|
|
|
148
148
|
return metavariable;
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
findRuleByReference(reference
|
|
152
|
-
const
|
|
153
|
-
|
|
154
|
-
context = this.getContext();
|
|
155
|
-
|
|
156
|
-
const parentContext = context, ///
|
|
157
|
-
rule = parentContext.findRuleByReference(reference, childContext);
|
|
151
|
+
findRuleByReference(reference) {
|
|
152
|
+
const context = this.getContext(),
|
|
153
|
+
rule = context.findRuleByReference(reference);
|
|
158
154
|
|
|
159
155
|
return rule;
|
|
160
156
|
}
|
|
161
157
|
|
|
162
|
-
findTopLevelAssertionByReference(reference
|
|
163
|
-
const
|
|
164
|
-
|
|
165
|
-
context = this.getContext();
|
|
166
|
-
|
|
167
|
-
const parentContext = context, ///
|
|
168
|
-
topLevelAssertion = parentContext.findTopLevelAssertionByReference(reference, childContext);
|
|
158
|
+
findTopLevelAssertionByReference(reference) {
|
|
159
|
+
const context = this.getContext(),
|
|
160
|
+
topLevelAssertion = context.findTopLevelAssertionByReference(reference);
|
|
169
161
|
|
|
170
162
|
return topLevelAssertion;
|
|
171
163
|
}
|
|
172
164
|
|
|
173
|
-
findTopLevelMetaAssertionsByReference(reference
|
|
174
|
-
const
|
|
175
|
-
|
|
176
|
-
context = this.getContext();
|
|
177
|
-
|
|
178
|
-
const parentContext = context, ///
|
|
179
|
-
topLevelMetaAssertion = parentContext.findTopLevelMetaAssertionsByReference(reference, childContext);
|
|
165
|
+
findTopLevelMetaAssertionsByReference(reference) {
|
|
166
|
+
const context = this.getContext(),
|
|
167
|
+
topLevelMetaAssertion = context.findTopLevelMetaAssertionsByReference(reference);
|
|
180
168
|
|
|
181
169
|
return topLevelMetaAssertion;
|
|
182
170
|
}
|
|
@@ -204,7 +192,7 @@ export default class Context extends ContextBase {
|
|
|
204
192
|
|
|
205
193
|
findFrameByFrameNode(frameNode) {
|
|
206
194
|
const context = this.getContext(),
|
|
207
|
-
|
|
195
|
+
frame = context.findFrameByFrameNode(frameNode);
|
|
208
196
|
|
|
209
197
|
return frame;
|
|
210
198
|
}
|
|
@@ -347,24 +335,16 @@ export default class Context extends ContextBase {
|
|
|
347
335
|
return metavariablePresent;
|
|
348
336
|
}
|
|
349
337
|
|
|
350
|
-
isLabelPresentByReference(reference
|
|
351
|
-
const
|
|
352
|
-
|
|
353
|
-
context = this.getContext();
|
|
354
|
-
|
|
355
|
-
const parentContext = context, ///
|
|
356
|
-
labelPresent = parentContext.isLabelPresentByReference(reference, childContext);
|
|
338
|
+
isLabelPresentByReference(reference) {
|
|
339
|
+
const context = this.getContext(),
|
|
340
|
+
labelPresent = context.isLabelPresentByReference(reference);
|
|
357
341
|
|
|
358
342
|
return labelPresent;
|
|
359
343
|
}
|
|
360
344
|
|
|
361
|
-
isTopLevelMetaAssertionPresentByReference(reference
|
|
362
|
-
const
|
|
363
|
-
|
|
364
|
-
context = this.getContext();
|
|
365
|
-
|
|
366
|
-
const parentContext = context, ///
|
|
367
|
-
topLevelMetaAssertionPresent = parentContext.isTopLevelMetaAssertionPresentByReference(reference, childContext);
|
|
345
|
+
isTopLevelMetaAssertionPresentByReference(reference) {
|
|
346
|
+
const context = this.getContext(),
|
|
347
|
+
topLevelMetaAssertionPresent = context.isTopLevelMetaAssertionPresentByReference(reference);
|
|
368
348
|
|
|
369
349
|
return topLevelMetaAssertionPresent;
|
|
370
350
|
}
|
|
@@ -467,6 +447,13 @@ export default class Context extends ContextBase {
|
|
|
467
447
|
return metaLevelSubstitutions;
|
|
468
448
|
}
|
|
469
449
|
|
|
450
|
+
isStated() {
|
|
451
|
+
const context = this.getContext(),
|
|
452
|
+
stated = context.isStated();
|
|
453
|
+
|
|
454
|
+
return stated;
|
|
455
|
+
}
|
|
456
|
+
|
|
470
457
|
addTerms(terms) {
|
|
471
458
|
const context = this.getContext();
|
|
472
459
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import Assertion from "../assertion";
|
|
4
4
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
|
-
import { instantiate } from "../../utilities/context";
|
|
6
|
+
import { descend, instantiate } from "../../utilities/context";
|
|
7
7
|
import { instantiateContainedAssertion } from "../../process/instantiate";
|
|
8
8
|
import { termFromTermAndSubstitutions, frameFromFrameAndSubstitutions, statementFromStatementAndSubstitutions } from "../../utilities/substitutions";
|
|
9
9
|
import { termFromContainedAssertionNode, frameFromContainedAssertionNode, negatedFromContainedAssertionNode, statementFromContainedAssertionNode } from "../../utilities/element";
|
|
@@ -41,7 +41,7 @@ export default define(class ContainedAssertion extends Assertion {
|
|
|
41
41
|
return containedAssertionNode;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
validate(
|
|
44
|
+
validate(context) {
|
|
45
45
|
let containedAssertion = null;
|
|
46
46
|
|
|
47
47
|
const containedAssertionString = this.getString(); ///
|
|
@@ -57,11 +57,13 @@ export default define(class ContainedAssertion extends Assertion {
|
|
|
57
57
|
} else {
|
|
58
58
|
let validates = false;
|
|
59
59
|
|
|
60
|
-
const termValidates = this.validateTerm(
|
|
61
|
-
frameValidates = this.validateFrame(
|
|
62
|
-
statementValidates = this.validateStatement(
|
|
60
|
+
const termValidates = this.validateTerm(context),
|
|
61
|
+
frameValidates = this.validateFrame(context),
|
|
62
|
+
statementValidates = this.validateStatement(context)
|
|
63
63
|
|
|
64
64
|
if (termValidates || frameValidates || statementValidates) {
|
|
65
|
+
const stated = context.isStated();
|
|
66
|
+
|
|
65
67
|
let validatesWhenStated = false,
|
|
66
68
|
validatesWhenDerived = false;
|
|
67
69
|
|
|
@@ -90,7 +92,7 @@ export default define(class ContainedAssertion extends Assertion {
|
|
|
90
92
|
return containedAssertion;
|
|
91
93
|
}
|
|
92
94
|
|
|
93
|
-
validateTerm(
|
|
95
|
+
validateTerm(context) {
|
|
94
96
|
let termValidates = false;
|
|
95
97
|
|
|
96
98
|
if (this.term !== null) {
|
|
@@ -125,7 +127,7 @@ export default define(class ContainedAssertion extends Assertion {
|
|
|
125
127
|
return termValidates;
|
|
126
128
|
}
|
|
127
129
|
|
|
128
|
-
validateFrame(
|
|
130
|
+
validateFrame(context) {
|
|
129
131
|
let frameValidates = false;
|
|
130
132
|
|
|
131
133
|
if (this.frame !== null) {
|
|
@@ -136,18 +138,18 @@ export default define(class ContainedAssertion extends Assertion {
|
|
|
136
138
|
|
|
137
139
|
const frameSingular = this.frame.isSingular();
|
|
138
140
|
|
|
139
|
-
if (
|
|
140
|
-
context
|
|
141
|
-
|
|
142
|
-
stated = true; ///
|
|
143
|
-
|
|
144
|
-
const frame = this.frame.validate(stated, context);
|
|
141
|
+
if (frameSingular) {
|
|
142
|
+
descend((context) => {
|
|
143
|
+
const frame = this.frame.validate(context);
|
|
145
144
|
|
|
146
|
-
|
|
147
|
-
|
|
145
|
+
if (frame !== null) {
|
|
146
|
+
this.frame = frame;
|
|
148
147
|
|
|
149
|
-
|
|
150
|
-
|
|
148
|
+
frameValidates = true;
|
|
149
|
+
}
|
|
150
|
+
}, context);
|
|
151
|
+
} else {
|
|
152
|
+
context.debug(`The '${frameString}' frame is not singular.`);
|
|
151
153
|
}
|
|
152
154
|
|
|
153
155
|
if (frameValidates) {
|
|
@@ -158,7 +160,7 @@ export default define(class ContainedAssertion extends Assertion {
|
|
|
158
160
|
return frameValidates;
|
|
159
161
|
}
|
|
160
162
|
|
|
161
|
-
validateStatement(
|
|
163
|
+
validateStatement(context) {
|
|
162
164
|
let statementValidates = false;
|
|
163
165
|
|
|
164
166
|
if (this.statement !== null) {
|
|
@@ -166,13 +168,13 @@ export default define(class ContainedAssertion extends Assertion {
|
|
|
166
168
|
|
|
167
169
|
context.trace(`Validating the '${statementString}' statement...`);
|
|
168
170
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
const statement = this.statement.validate(stated, context);
|
|
171
|
+
descend((context) => {
|
|
172
|
+
const statement = this.statement.validate(context);
|
|
172
173
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
174
|
+
if (statement !== null) {
|
|
175
|
+
statementValidates = true;
|
|
176
|
+
}
|
|
177
|
+
}, context);
|
|
176
178
|
|
|
177
179
|
if (statementValidates) {
|
|
178
180
|
context.debug(`...validated the '${statementString}' statement.`);
|
|
@@ -247,7 +249,7 @@ export default define(class ContainedAssertion extends Assertion {
|
|
|
247
249
|
const { name } = json;
|
|
248
250
|
|
|
249
251
|
if (this.name === name) {
|
|
250
|
-
|
|
252
|
+
instantiate((context) => {
|
|
251
253
|
const { string } = json,
|
|
252
254
|
containedAssertionNode = instantiateContainedAssertion(string, context),
|
|
253
255
|
node = containedAssertionNode, ///
|
|
@@ -258,9 +260,7 @@ export default define(class ContainedAssertion extends Assertion {
|
|
|
258
260
|
|
|
259
261
|
context = null;
|
|
260
262
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
return containedAssertion;
|
|
263
|
+
containedAssertion = new ContainedAssertion(context, string, node, term, frame, negated, statement);
|
|
264
264
|
}, context);
|
|
265
265
|
}
|
|
266
266
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import Assertion from "../assertion";
|
|
4
4
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
|
-
import { instantiate } from "../../utilities/context";
|
|
6
|
+
import { descend, instantiate } from "../../utilities/context";
|
|
7
7
|
import { instantiateDefinedAssertion } from "../../process/instantiate";
|
|
8
8
|
import { termFromTermAndSubstitutions, frameFromFrameAndSubstitutions } from "../../utilities/substitutions";
|
|
9
9
|
import { termFromJDefinedAssertionNode, frameFromJDefinedAssertionNode, negatedFromJDefinedAssertionNode } from "../../utilities/element";
|
|
@@ -36,7 +36,7 @@ export default define(class DefinedAssertion extends Assertion {
|
|
|
36
36
|
return definedAssertionNode;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
validate(
|
|
39
|
+
validate(context) {
|
|
40
40
|
let definedAssertion = null;
|
|
41
41
|
|
|
42
42
|
const definedAssertionString = this.getString(); ///
|
|
@@ -52,10 +52,12 @@ export default define(class DefinedAssertion extends Assertion {
|
|
|
52
52
|
} else {
|
|
53
53
|
let validates = false;
|
|
54
54
|
|
|
55
|
-
const termValidates = this.validateTerm(
|
|
56
|
-
frameValidates = this.validateFrame(
|
|
55
|
+
const termValidates = this.validateTerm(context),
|
|
56
|
+
frameValidates = this.validateFrame(context);
|
|
57
57
|
|
|
58
58
|
if (termValidates || frameValidates) {
|
|
59
|
+
const stated = context.isStated();
|
|
60
|
+
|
|
59
61
|
let verifiesWhenStated = false,
|
|
60
62
|
verifiesWhenDerived = false;
|
|
61
63
|
|
|
@@ -84,7 +86,7 @@ export default define(class DefinedAssertion extends Assertion {
|
|
|
84
86
|
return definedAssertion;
|
|
85
87
|
}
|
|
86
88
|
|
|
87
|
-
validateTerm(
|
|
89
|
+
validateTerm(context) {
|
|
88
90
|
let termValidates = false;
|
|
89
91
|
|
|
90
92
|
if (this.term !== null) {
|
|
@@ -119,7 +121,7 @@ export default define(class DefinedAssertion extends Assertion {
|
|
|
119
121
|
return termValidates;
|
|
120
122
|
}
|
|
121
123
|
|
|
122
|
-
validateFrame(
|
|
124
|
+
validateFrame(context) {
|
|
123
125
|
let frameValidates = false;
|
|
124
126
|
|
|
125
127
|
if (this.frame !== null) {
|
|
@@ -130,22 +132,22 @@ export default define(class DefinedAssertion extends Assertion {
|
|
|
130
132
|
|
|
131
133
|
const frameSingular = this.frame.isSingular();
|
|
132
134
|
|
|
133
|
-
if (
|
|
134
|
-
context
|
|
135
|
-
|
|
136
|
-
stated = true; ///
|
|
137
|
-
|
|
138
|
-
const frame = this.frame.validate(stated, context);
|
|
135
|
+
if (frameSingular) {
|
|
136
|
+
descend((context) => {
|
|
137
|
+
const frame = this.frame.validate(context);
|
|
139
138
|
|
|
140
|
-
|
|
141
|
-
|
|
139
|
+
if (frame !== null) {
|
|
140
|
+
this.frame = frame;
|
|
142
141
|
|
|
143
|
-
|
|
144
|
-
|
|
142
|
+
frameValidates = true;
|
|
143
|
+
}
|
|
144
|
+
}, context);
|
|
145
|
+
} else {
|
|
146
|
+
context.debug(`The '${frameString}' frame is not singular.`);
|
|
147
|
+
}
|
|
145
148
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
149
|
+
if (frameValidates) {
|
|
150
|
+
context.debug(`...validates the'${definedAssertionString}' defined assertion's '${frameString}' frame.`);
|
|
149
151
|
}
|
|
150
152
|
}
|
|
151
153
|
|
|
@@ -216,7 +218,7 @@ export default define(class DefinedAssertion extends Assertion {
|
|
|
216
218
|
const { name } = json;
|
|
217
219
|
|
|
218
220
|
if (this.name === name) {
|
|
219
|
-
|
|
221
|
+
instantiate((context) => {
|
|
220
222
|
const { string } = json,
|
|
221
223
|
definedAssertionNode = instantiateDefinedAssertion(string, context),
|
|
222
224
|
node = definedAssertionNode, ///
|
|
@@ -226,9 +228,7 @@ export default define(class DefinedAssertion extends Assertion {
|
|
|
226
228
|
|
|
227
229
|
context = null;
|
|
228
230
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
return definedAssertion;
|
|
231
|
+
definedAssertion = new DefinedAssertion(context, string, node, term, frame, negated);
|
|
232
232
|
}, context);
|
|
233
233
|
}
|
|
234
234
|
|