occam-verify-cli 1.0.902 → 1.0.905
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 +7 -4
- package/lib/context/mnemic.js +56 -26
- package/lib/context/synoptic.js +30 -14
- package/lib/context.js +31 -14
- package/lib/element/assertion/property.js +26 -25
- package/lib/element/assertion/satisfies.js +6 -1
- package/lib/element/assertion/type.js +7 -7
- package/lib/element/equality.js +3 -3
- package/lib/element/signature.js +40 -50
- package/lib/element/topLevelAssertion/axiom.js +9 -4
- package/lib/element/type.js +5 -5
- package/lib/utilities/assignment.js +3 -3
- package/lib/utilities/element.js +2 -2
- package/lib/utilities/json.js +23 -1
- package/lib/utilities/synoptic.js +12 -1
- package/package.json +1 -1
- package/src/context/file/nominal.js +8 -4
- package/src/context/mnemic.js +85 -31
- package/src/context/synoptic.js +40 -16
- package/src/context.js +44 -16
- package/src/element/assertion/property.js +38 -36
- package/src/element/assertion/satisfies.js +8 -0
- package/src/element/assertion/type.js +6 -6
- package/src/element/equality.js +2 -2
- package/src/element/signature.js +53 -75
- package/src/element/topLevelAssertion/axiom.js +11 -4
- package/src/element/type.js +9 -9
- package/src/utilities/assignment.js +2 -2
- package/src/utilities/element.js +1 -1
- package/src/utilities/json.js +28 -2
- package/src/utilities/synoptic.js +10 -0
package/src/context/mnemic.js
CHANGED
|
@@ -11,6 +11,7 @@ import { compressTerms,
|
|
|
11
11
|
compressJudgements,
|
|
12
12
|
compressAssertions,
|
|
13
13
|
compressStatements,
|
|
14
|
+
compressSignatures,
|
|
14
15
|
compressReferences,
|
|
15
16
|
compressAssumptions,
|
|
16
17
|
compressMetavariables,
|
|
@@ -26,6 +27,7 @@ import { termsFromJSON,
|
|
|
26
27
|
statementsFromJSON,
|
|
27
28
|
assertionsFromJSON,
|
|
28
29
|
referencesFromJSON,
|
|
30
|
+
signaturesFromJSON,
|
|
29
31
|
assumptionsFromJSON,
|
|
30
32
|
metavariablesFromJSON,
|
|
31
33
|
substitutionsFromJSON,
|
|
@@ -34,6 +36,7 @@ import { termsFromJSON,
|
|
|
34
36
|
judgementsToJudgementsJSON,
|
|
35
37
|
equalitiesToEqualitiesJSON,
|
|
36
38
|
statementsToStatementsJSON,
|
|
39
|
+
signaturesToSignaturesJSON,
|
|
37
40
|
assertionsToAssertionsJSON,
|
|
38
41
|
referencesToReferencesJSON,
|
|
39
42
|
assumptionsToAssumptionsJSON,
|
|
@@ -44,7 +47,7 @@ import { termsFromJSON,
|
|
|
44
47
|
const { push } = arrayUtilities;
|
|
45
48
|
|
|
46
49
|
export default class MnemicContext extends Context {
|
|
47
|
-
constructor(context, terms, frames, properties, equalities, judgements, assertions, statements, references, assumptions, metavariables, substitutions, propertyRelations) {
|
|
50
|
+
constructor(context, terms, frames, properties, equalities, judgements, assertions, statements, signatures, references, assumptions, metavariables, substitutions, propertyRelations) {
|
|
48
51
|
super(context);
|
|
49
52
|
|
|
50
53
|
this.terms = terms;
|
|
@@ -54,6 +57,7 @@ export default class MnemicContext extends Context {
|
|
|
54
57
|
this.judgements = judgements;
|
|
55
58
|
this.assertions = assertions;
|
|
56
59
|
this.statements = statements;
|
|
60
|
+
this.signatures = signatures;
|
|
57
61
|
this.references = references;
|
|
58
62
|
this.assumptions = assumptions;
|
|
59
63
|
this.metavariables = metavariables;
|
|
@@ -133,6 +137,18 @@ export default class MnemicContext extends Context {
|
|
|
133
137
|
return statements;
|
|
134
138
|
}
|
|
135
139
|
|
|
140
|
+
getSignatures(signatures = []) {
|
|
141
|
+
const context = this.getContext();
|
|
142
|
+
|
|
143
|
+
push(signatures, this.signatures);
|
|
144
|
+
|
|
145
|
+
context.getSignatures(signatures);
|
|
146
|
+
|
|
147
|
+
compressSignatures(context);
|
|
148
|
+
|
|
149
|
+
return signatures;
|
|
150
|
+
}
|
|
151
|
+
|
|
136
152
|
getAssertions(assertions = []) {
|
|
137
153
|
const context = this.getContext();
|
|
138
154
|
|
|
@@ -260,6 +276,17 @@ export default class MnemicContext extends Context {
|
|
|
260
276
|
context.debug(`...added the '${judgementString}' judgement to the mnemic context.`);
|
|
261
277
|
}
|
|
262
278
|
|
|
279
|
+
addAssertion(assertion) {
|
|
280
|
+
const context = this, ///
|
|
281
|
+
assertionString = assertion.getString();
|
|
282
|
+
|
|
283
|
+
context.trace(`Adding the '${assertionString}' assertion to the mnemic context...`);
|
|
284
|
+
|
|
285
|
+
this.assertions.push(assertion);
|
|
286
|
+
|
|
287
|
+
context.debug(`...added the '${assertionString}' assertion to the mnemic context.`);
|
|
288
|
+
}
|
|
289
|
+
|
|
263
290
|
addStatement(statement) {
|
|
264
291
|
const context = this, ///
|
|
265
292
|
statementString = statement.getString();
|
|
@@ -271,15 +298,15 @@ export default class MnemicContext extends Context {
|
|
|
271
298
|
context.debug(`...added the '${statementString}' statement to the mnemic context.`);
|
|
272
299
|
}
|
|
273
300
|
|
|
274
|
-
|
|
301
|
+
addSignature(signature) {
|
|
275
302
|
const context = this, ///
|
|
276
|
-
|
|
303
|
+
signatureString = signature.getString();
|
|
277
304
|
|
|
278
|
-
context.trace(`Adding the '${
|
|
305
|
+
context.trace(`Adding the '${signatureString}' signature to the mnemic context...`);
|
|
279
306
|
|
|
280
|
-
this.
|
|
307
|
+
this.signatures.push(signature);
|
|
281
308
|
|
|
282
|
-
context.debug(`...added the '${
|
|
309
|
+
context.debug(`...added the '${signatureString}' signature to the mnemic context.`);
|
|
283
310
|
}
|
|
284
311
|
|
|
285
312
|
addReference(reference) {
|
|
@@ -408,6 +435,19 @@ export default class MnemicContext extends Context {
|
|
|
408
435
|
return judgement;
|
|
409
436
|
}
|
|
410
437
|
|
|
438
|
+
findAssertionByAssertionNode(assertionNode) {
|
|
439
|
+
const assertions = this.getAssertions(),
|
|
440
|
+
assertion = assertions.find((assertion) => {
|
|
441
|
+
const assertionNodeMatches = assertion.matchAssertionNode(assertionNode);
|
|
442
|
+
|
|
443
|
+
if (assertionNodeMatches) {
|
|
444
|
+
return true;
|
|
445
|
+
}
|
|
446
|
+
}) || null;
|
|
447
|
+
|
|
448
|
+
return assertion;
|
|
449
|
+
}
|
|
450
|
+
|
|
411
451
|
findStatementByStatementNode(statementNode) {
|
|
412
452
|
const statements = this.getStatements(),
|
|
413
453
|
statement = statements.find((statement) => {
|
|
@@ -421,30 +461,30 @@ export default class MnemicContext extends Context {
|
|
|
421
461
|
return statement;
|
|
422
462
|
}
|
|
423
463
|
|
|
424
|
-
|
|
425
|
-
const
|
|
426
|
-
|
|
427
|
-
const
|
|
464
|
+
findSignatureBySignatureNode(signatureNode) {
|
|
465
|
+
const signatures = this.getSignatures(),
|
|
466
|
+
signature = signatures.find((signature) => {
|
|
467
|
+
const signatureNodeMatches = signature.matchSignatureNode(signatureNode);
|
|
428
468
|
|
|
429
|
-
if (
|
|
469
|
+
if (signatureNodeMatches) {
|
|
430
470
|
return true;
|
|
431
471
|
}
|
|
432
472
|
}) || null;
|
|
433
473
|
|
|
434
|
-
return
|
|
474
|
+
return signature;
|
|
435
475
|
}
|
|
436
476
|
|
|
437
|
-
|
|
438
|
-
const
|
|
439
|
-
|
|
440
|
-
const
|
|
477
|
+
findReferenceByReferenceNode(referenceNode) {
|
|
478
|
+
const references = this.getReferences(),
|
|
479
|
+
reference = references.find((reference) => {
|
|
480
|
+
const referenceMatcheReferenceNode = reference.matchReferenceNode(referenceNode);
|
|
441
481
|
|
|
442
|
-
if (
|
|
482
|
+
if (referenceMatcheReferenceNode) {
|
|
443
483
|
return true;
|
|
444
484
|
}
|
|
445
485
|
}) || null;
|
|
446
486
|
|
|
447
|
-
return
|
|
487
|
+
return reference;
|
|
448
488
|
}
|
|
449
489
|
|
|
450
490
|
findAssumptionByAssumptionNode(assumptionNode) {
|
|
@@ -555,6 +595,13 @@ export default class MnemicContext extends Context {
|
|
|
555
595
|
return judgementPresent;
|
|
556
596
|
}
|
|
557
597
|
|
|
598
|
+
isAssertionPresentByAssertionNode(assertionNode) {
|
|
599
|
+
const assertion = this.findAssertionByAssertionNode(assertionNode),
|
|
600
|
+
assertionPresent = (assertion !== null);
|
|
601
|
+
|
|
602
|
+
return assertionPresent;
|
|
603
|
+
}
|
|
604
|
+
|
|
558
605
|
isStatementPresentByStatementNode(statementNode) {
|
|
559
606
|
const statement = this.findStatementByStatementNode(statementNode),
|
|
560
607
|
statementPresent = (statement !== null);
|
|
@@ -562,11 +609,11 @@ export default class MnemicContext extends Context {
|
|
|
562
609
|
return statementPresent;
|
|
563
610
|
}
|
|
564
611
|
|
|
565
|
-
|
|
566
|
-
const
|
|
567
|
-
|
|
612
|
+
isSignaturePresentBySignatureNode(signatureNode) {
|
|
613
|
+
const signature = this.findSignatureBySignatureNode(signatureNode),
|
|
614
|
+
signaturePresent = (signature !== null);
|
|
568
615
|
|
|
569
|
-
return
|
|
616
|
+
return signaturePresent;
|
|
570
617
|
}
|
|
571
618
|
|
|
572
619
|
isAssumptionPresentByAssumptionNode(assumptionNode) {
|
|
@@ -629,6 +676,7 @@ export default class MnemicContext extends Context {
|
|
|
629
676
|
|
|
630
677
|
this.judgements = judgementsFromJSON(json, context);
|
|
631
678
|
this.assertions = assertionsFromJSON(json, context);
|
|
679
|
+
this.signatures = signaturesFromJSON(json, context);
|
|
632
680
|
this.substitutions = substitutionsFromJSON(json, context);
|
|
633
681
|
this.propertyRelations = propertyRelationsFromJSON(json, context);
|
|
634
682
|
}
|
|
@@ -637,10 +685,11 @@ export default class MnemicContext extends Context {
|
|
|
637
685
|
let terms = this.getTerms(),
|
|
638
686
|
frames = this.getFrames(),
|
|
639
687
|
properties = this.getProperties(),
|
|
640
|
-
judgements = this.getJudgements(),
|
|
641
688
|
equalities = this.getEqualities(),
|
|
642
|
-
|
|
689
|
+
judgements = this.getJudgements(),
|
|
643
690
|
assertions = this.getAssertions(),
|
|
691
|
+
statements = this.getStatements(),
|
|
692
|
+
signatures = this.getSignatures(),
|
|
644
693
|
references = this.getReferences(),
|
|
645
694
|
assumptions = this.getAssumptions(),
|
|
646
695
|
metavariables = this.getMetavariables(),
|
|
@@ -650,10 +699,11 @@ export default class MnemicContext extends Context {
|
|
|
650
699
|
const termsJSON = termsToTermsJSON(terms),
|
|
651
700
|
framesJSON = framesToFramesJSON(frames),
|
|
652
701
|
propertiesJSON = propertiesToPropertiesJSON(properties),
|
|
653
|
-
judgementsJSON = judgementsToJudgementsJSON(judgements),
|
|
654
702
|
equalitiesJSON = equalitiesToEqualitiesJSON(equalities),
|
|
655
|
-
|
|
703
|
+
judgementsJSON = judgementsToJudgementsJSON(judgements),
|
|
656
704
|
assertionsJSON = assertionsToAssertionsJSON(assertions),
|
|
705
|
+
statementsJSON = statementsToStatementsJSON(statements),
|
|
706
|
+
signaturesJSON = signaturesToSignaturesJSON(signatures),
|
|
657
707
|
referencesJSON = referencesToReferencesJSON(references),
|
|
658
708
|
assumptionsJSON = assumptionsToAssumptionsJSON(assumptions),
|
|
659
709
|
metavariablesJSON = metavariablesToMetavariablesJSON(metavariables),
|
|
@@ -663,10 +713,11 @@ export default class MnemicContext extends Context {
|
|
|
663
713
|
terms = termsJSON; ///
|
|
664
714
|
frames = framesJSON; ///
|
|
665
715
|
properties = propertiesJSON; ///
|
|
666
|
-
judgements = judgementsJSON; ///
|
|
667
716
|
equalities = equalitiesJSON; ///
|
|
668
|
-
|
|
717
|
+
judgements = judgementsJSON; ///
|
|
669
718
|
assertions = assertionsJSON; ///
|
|
719
|
+
statements = statementsJSON; ///
|
|
720
|
+
signatures = signaturesJSON; ///
|
|
670
721
|
references = referencesJSON; ///
|
|
671
722
|
assumptions = assumptionsJSON; ///
|
|
672
723
|
metavariables = metavariablesJSON; //
|
|
@@ -679,8 +730,9 @@ export default class MnemicContext extends Context {
|
|
|
679
730
|
properties,
|
|
680
731
|
equalities,
|
|
681
732
|
judgements,
|
|
682
|
-
statements,
|
|
683
733
|
assertions,
|
|
734
|
+
statements,
|
|
735
|
+
signatures,
|
|
684
736
|
references,
|
|
685
737
|
assumptions,
|
|
686
738
|
metavariables,
|
|
@@ -699,12 +751,13 @@ export default class MnemicContext extends Context {
|
|
|
699
751
|
judgements = null,
|
|
700
752
|
statements = null,
|
|
701
753
|
assertions = null,
|
|
754
|
+
signatures = null,
|
|
702
755
|
references = null,
|
|
703
756
|
assumptions = null,
|
|
704
757
|
metavariables = null,
|
|
705
758
|
substitutions = null,
|
|
706
759
|
propertyRelations = null,
|
|
707
|
-
mnemicContext = new MnemicContext(context, terms, frames, properties, equalities, judgements, assertions, statements, references, assumptions, metavariables, substitutions, propertyRelations);
|
|
760
|
+
mnemicContext = new MnemicContext(context, terms, frames, properties, equalities, judgements, assertions, statements, signatures, references, assumptions, metavariables, substitutions, propertyRelations);
|
|
708
761
|
|
|
709
762
|
mnemicContext.initialise(json);
|
|
710
763
|
|
|
@@ -719,12 +772,13 @@ export default class MnemicContext extends Context {
|
|
|
719
772
|
judgements = [],
|
|
720
773
|
statements = [],
|
|
721
774
|
assertions = [],
|
|
775
|
+
signatures = [],
|
|
722
776
|
references = [],
|
|
723
777
|
assumptions = [],
|
|
724
778
|
metavariables = [],
|
|
725
779
|
substitutions = [],
|
|
726
780
|
propertyRelations = [],
|
|
727
|
-
mnemicContext = new MnemicContext(context, terms, frames, properties, equalities, judgements, assertions, statements, references, assumptions, metavariables, substitutions, propertyRelations);
|
|
781
|
+
mnemicContext = new MnemicContext(context, terms, frames, properties, equalities, judgements, assertions, statements, signatures, references, assumptions, metavariables, substitutions, propertyRelations);
|
|
728
782
|
|
|
729
783
|
return mnemicContext;
|
|
730
784
|
}
|
package/src/context/synoptic.js
CHANGED
|
@@ -11,6 +11,7 @@ import { compressTerms,
|
|
|
11
11
|
compressJudgements,
|
|
12
12
|
compressAssertions,
|
|
13
13
|
compressStatements,
|
|
14
|
+
compressSignatures,
|
|
14
15
|
compressReferences,
|
|
15
16
|
compressAssumptions,
|
|
16
17
|
compressMetavariables,
|
|
@@ -80,6 +81,16 @@ export default class SynopticContext extends Context {
|
|
|
80
81
|
return judgements;
|
|
81
82
|
}
|
|
82
83
|
|
|
84
|
+
getAssertions(assertions = []) {
|
|
85
|
+
this.contexts.forEach((context) => {
|
|
86
|
+
context.getAssertions(assertions);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
compressAssertions(assertions);
|
|
90
|
+
|
|
91
|
+
return assertions;
|
|
92
|
+
}
|
|
93
|
+
|
|
83
94
|
getStatements(statements = []) {
|
|
84
95
|
this.contexts.forEach((context) => {
|
|
85
96
|
context.getStatements(statements);
|
|
@@ -90,14 +101,14 @@ export default class SynopticContext extends Context {
|
|
|
90
101
|
return statements;
|
|
91
102
|
}
|
|
92
103
|
|
|
93
|
-
|
|
104
|
+
getSignatures(signatures = []) {
|
|
94
105
|
this.contexts.forEach((context) => {
|
|
95
|
-
context.
|
|
106
|
+
context.getSignatures(signatures);
|
|
96
107
|
});
|
|
97
108
|
|
|
98
|
-
|
|
109
|
+
compressSignatures(signatures);
|
|
99
110
|
|
|
100
|
-
return
|
|
111
|
+
return signatures;
|
|
101
112
|
}
|
|
102
113
|
|
|
103
114
|
getReferences(references = []) {
|
|
@@ -215,6 +226,19 @@ export default class SynopticContext extends Context {
|
|
|
215
226
|
return judgement;
|
|
216
227
|
}
|
|
217
228
|
|
|
229
|
+
findAssertionByAssertionNode(assertionNode) {
|
|
230
|
+
const assertions = this.getAssertions(),
|
|
231
|
+
assertion = assertions.find((assertion) => {
|
|
232
|
+
const assertionNodeMatches = assertion.matchAssertionNode(assertionNode);
|
|
233
|
+
|
|
234
|
+
if (assertionNodeMatches) {
|
|
235
|
+
return true;
|
|
236
|
+
}
|
|
237
|
+
}) || null;
|
|
238
|
+
|
|
239
|
+
return assertion;
|
|
240
|
+
}
|
|
241
|
+
|
|
218
242
|
findStatementByStatementNode(statementNode) {
|
|
219
243
|
const statements = this.getStatements(),
|
|
220
244
|
statement = statements.find((statement) => {
|
|
@@ -228,30 +252,30 @@ export default class SynopticContext extends Context {
|
|
|
228
252
|
return statement;
|
|
229
253
|
}
|
|
230
254
|
|
|
231
|
-
|
|
232
|
-
const
|
|
233
|
-
|
|
234
|
-
const
|
|
255
|
+
findSignatureBySignatureNode(signatureNode) {
|
|
256
|
+
const signatures = this.getSignatures(),
|
|
257
|
+
signature = signatures.find((signature) => {
|
|
258
|
+
const signatureNodeMatches = signature.matchSignatureNode(signatureNode);
|
|
235
259
|
|
|
236
|
-
if (
|
|
260
|
+
if (signatureNodeMatches) {
|
|
237
261
|
return true;
|
|
238
262
|
}
|
|
239
263
|
}) || null;
|
|
240
264
|
|
|
241
|
-
return
|
|
265
|
+
return signature;
|
|
242
266
|
}
|
|
243
267
|
|
|
244
|
-
|
|
245
|
-
const
|
|
246
|
-
|
|
247
|
-
const
|
|
268
|
+
findReferenceByReferenceNode(referenceNode) {
|
|
269
|
+
const references = this.getReferences(),
|
|
270
|
+
reference = references.find((reference) => {
|
|
271
|
+
const referenceMatcheReferenceNode = reference.matchReferenceNode(referenceNode);
|
|
248
272
|
|
|
249
|
-
if (
|
|
273
|
+
if (referenceMatcheReferenceNode) {
|
|
250
274
|
return true;
|
|
251
275
|
}
|
|
252
276
|
}) || null;
|
|
253
277
|
|
|
254
|
-
return
|
|
278
|
+
return reference;
|
|
255
279
|
}
|
|
256
280
|
|
|
257
281
|
findAssumptionByAssumptionNode(assumptionNode) {
|
package/src/context.js
CHANGED
|
@@ -40,14 +40,6 @@ export default class Context extends ContextBase {
|
|
|
40
40
|
return frames;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
getJudgements(judgements = []) {
|
|
44
|
-
const context = this.getContext();
|
|
45
|
-
|
|
46
|
-
context.getJudgements(judgements);
|
|
47
|
-
|
|
48
|
-
return judgements;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
43
|
getProperties(properties = []) {
|
|
52
44
|
const context = this.getContext();
|
|
53
45
|
|
|
@@ -64,12 +56,12 @@ export default class Context extends ContextBase {
|
|
|
64
56
|
return equalities;
|
|
65
57
|
}
|
|
66
58
|
|
|
67
|
-
|
|
59
|
+
getJudgements(judgements = []) {
|
|
68
60
|
const context = this.getContext();
|
|
69
61
|
|
|
70
|
-
context.
|
|
62
|
+
context.getJudgements(judgements);
|
|
71
63
|
|
|
72
|
-
return
|
|
64
|
+
return judgements;
|
|
73
65
|
}
|
|
74
66
|
|
|
75
67
|
getAssertions(assertions = []) {
|
|
@@ -80,6 +72,22 @@ export default class Context extends ContextBase {
|
|
|
80
72
|
return assertions;
|
|
81
73
|
}
|
|
82
74
|
|
|
75
|
+
getStatements(statements = []) {
|
|
76
|
+
const context = this.getContext();
|
|
77
|
+
|
|
78
|
+
context.getStatements(statements);
|
|
79
|
+
|
|
80
|
+
return statements;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
getSignatures(signatures = []) {
|
|
84
|
+
const context = this.getContext();
|
|
85
|
+
|
|
86
|
+
context.getSignatures(signatures);
|
|
87
|
+
|
|
88
|
+
return signatures;
|
|
89
|
+
}
|
|
90
|
+
|
|
83
91
|
getReferences(references = []) {
|
|
84
92
|
const context = this.getContext();
|
|
85
93
|
|
|
@@ -268,6 +276,13 @@ export default class Context extends ContextBase {
|
|
|
268
276
|
return statement;
|
|
269
277
|
}
|
|
270
278
|
|
|
279
|
+
findSignatureBySignatureNode(signatureNode) {
|
|
280
|
+
const context = this.getContext(),
|
|
281
|
+
signature = context.findSignatureBySignatureNode(signatureNode);
|
|
282
|
+
|
|
283
|
+
return signature;
|
|
284
|
+
}
|
|
285
|
+
|
|
271
286
|
findReferenceByReferenceNode(referenceNode) {
|
|
272
287
|
const context = this.getContext(),
|
|
273
288
|
reference = context.findReferenceByReferenceNode(referenceNode);
|
|
@@ -479,6 +494,13 @@ export default class Context extends ContextBase {
|
|
|
479
494
|
return judgementPresent;
|
|
480
495
|
}
|
|
481
496
|
|
|
497
|
+
isAssertionPresentByAssertionNode(assertionNode) {
|
|
498
|
+
const context = this.getContext(),
|
|
499
|
+
assertionPresent = context.isAssertionPresentByAssertionNode(assertionNode);
|
|
500
|
+
|
|
501
|
+
return assertionPresent;
|
|
502
|
+
}
|
|
503
|
+
|
|
482
504
|
isStatementPresentByStatementNode(statementNode) {
|
|
483
505
|
const context = this.getContext(),
|
|
484
506
|
statementPresent = context.isStatementPresentByStatementNode(statementNode);
|
|
@@ -486,11 +508,11 @@ export default class Context extends ContextBase {
|
|
|
486
508
|
return statementPresent;
|
|
487
509
|
}
|
|
488
510
|
|
|
489
|
-
|
|
511
|
+
isSignaturePresentBySignatureNode(signatureNode) {
|
|
490
512
|
const context = this.getContext(),
|
|
491
|
-
|
|
513
|
+
signaturePresent = context.isSignaturePresentBySignatureNode(signatureNode);
|
|
492
514
|
|
|
493
|
-
return
|
|
515
|
+
return signaturePresent;
|
|
494
516
|
}
|
|
495
517
|
|
|
496
518
|
isMetavariablePresentByMetavariableNode(metavariableNode) {
|
|
@@ -612,16 +634,22 @@ export default class Context extends ContextBase {
|
|
|
612
634
|
context.addJudgement(judgement);
|
|
613
635
|
}
|
|
614
636
|
|
|
637
|
+
addAssertion(assertion) {
|
|
638
|
+
const context = this.getContext();
|
|
639
|
+
|
|
640
|
+
context.addAssertion(assertion);
|
|
641
|
+
}
|
|
642
|
+
|
|
615
643
|
addStatement(statement) {
|
|
616
644
|
const context = this.getContext();
|
|
617
645
|
|
|
618
646
|
context.addStatement(statement);
|
|
619
647
|
}
|
|
620
648
|
|
|
621
|
-
|
|
649
|
+
addSignature(signature) {
|
|
622
650
|
const context = this.getContext();
|
|
623
651
|
|
|
624
|
-
context.
|
|
652
|
+
context.addSignature(signature);
|
|
625
653
|
}
|
|
626
654
|
|
|
627
655
|
addReference(reference) {
|
|
@@ -75,12 +75,12 @@ export default define(class PropertyAssertion extends Assertion {
|
|
|
75
75
|
} else {
|
|
76
76
|
let validates = false;
|
|
77
77
|
|
|
78
|
-
const
|
|
78
|
+
const propertyRelationVerifies = this.validatePropertyRelation(context);
|
|
79
79
|
|
|
80
|
-
if (
|
|
81
|
-
const
|
|
80
|
+
if (propertyRelationVerifies) {
|
|
81
|
+
const termValidates = this.validateTerm(context);
|
|
82
82
|
|
|
83
|
-
if (
|
|
83
|
+
if (termValidates) {
|
|
84
84
|
const stated = context.isStated();
|
|
85
85
|
|
|
86
86
|
let validatesWhenStated = false,
|
|
@@ -121,11 +121,19 @@ export default define(class PropertyAssertion extends Assertion {
|
|
|
121
121
|
|
|
122
122
|
context.trace(`Validating the '${propertyAssertionString}' property assertion's term...`);
|
|
123
123
|
|
|
124
|
-
const
|
|
125
|
-
|
|
124
|
+
const type = this.getType(),
|
|
125
|
+
term = this.term.validate(context, (term) => {
|
|
126
|
+
let validatesForwards = false;
|
|
126
127
|
|
|
127
|
-
|
|
128
|
-
|
|
128
|
+
const termType = term.getType(),
|
|
129
|
+
termTypeEqualToSubTypeOrSuperTypeOfType = termType.isEqualToSubTypeOrSuperTypeOf(type);
|
|
130
|
+
|
|
131
|
+
if (termTypeEqualToSubTypeOrSuperTypeOfType) {
|
|
132
|
+
validatesForwards = true;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return validatesForwards;
|
|
136
|
+
});
|
|
129
137
|
|
|
130
138
|
if (term !== null) {
|
|
131
139
|
this.term = term;
|
|
@@ -134,38 +142,12 @@ export default define(class PropertyAssertion extends Assertion {
|
|
|
134
142
|
}
|
|
135
143
|
|
|
136
144
|
if (termValidates) {
|
|
137
|
-
context.debug(`...validated the '${propertyAssertionString}' property assertion's term
|
|
145
|
+
context.debug(`...validated the '${propertyAssertionString}' property assertion's term...`);
|
|
138
146
|
}
|
|
139
147
|
|
|
140
148
|
return termValidates;
|
|
141
149
|
}
|
|
142
150
|
|
|
143
|
-
validatePropertyRelation(context) {
|
|
144
|
-
let propertyRelationValidates = false;
|
|
145
|
-
|
|
146
|
-
const propertyAssertionString = this.getString(); ///
|
|
147
|
-
|
|
148
|
-
context.trace(`Validating the '${propertyAssertionString}' property assertion's property relation...`);
|
|
149
|
-
|
|
150
|
-
const propertyRelation = this.propertyRelation.validate(context);
|
|
151
|
-
|
|
152
|
-
if (propertyRelation !== null) {
|
|
153
|
-
const type = this.getType(),
|
|
154
|
-
termType = this.term.getType(),
|
|
155
|
-
termTypeEqualToOrSuperTypeOfType = termType.isEqualToOrSuperTypeOf(type);
|
|
156
|
-
|
|
157
|
-
if (termTypeEqualToOrSuperTypeOfType) {
|
|
158
|
-
propertyRelationValidates = true;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
if (propertyRelationValidates) {
|
|
163
|
-
context.debug(`...validated the '${propertyAssertionString}' property assertion's property relation.`);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
return propertyRelationValidates;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
151
|
validateWhenStated(context) {
|
|
170
152
|
let validatesWhenStated;
|
|
171
153
|
|
|
@@ -176,7 +158,7 @@ export default define(class PropertyAssertion extends Assertion {
|
|
|
176
158
|
validatesWhenStated = true;
|
|
177
159
|
|
|
178
160
|
if (validatesWhenStated) {
|
|
179
|
-
context.debug(`...
|
|
161
|
+
context.debug(`...verified the '${propertyAssertionString}' stated property assertion.`);
|
|
180
162
|
}
|
|
181
163
|
|
|
182
164
|
return validatesWhenStated;
|
|
@@ -198,6 +180,26 @@ export default define(class PropertyAssertion extends Assertion {
|
|
|
198
180
|
return validatesWhenDerived;
|
|
199
181
|
}
|
|
200
182
|
|
|
183
|
+
validatePropertyRelation(context) {
|
|
184
|
+
let propertyRelationValidates = false;
|
|
185
|
+
|
|
186
|
+
const propertyAssertionString = this.getString(); ///
|
|
187
|
+
|
|
188
|
+
context.trace(`Validating the '${propertyAssertionString}' property assertion's property relation...`);
|
|
189
|
+
|
|
190
|
+
const propertyRelation = this.propertyRelation.validate(context);
|
|
191
|
+
|
|
192
|
+
if (propertyRelation !== null) {
|
|
193
|
+
propertyRelationValidates = true;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if (propertyRelationValidates) {
|
|
197
|
+
context.debug(`...validated the '${propertyAssertionString}' property assertion's property relation.`);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
return propertyRelationValidates;
|
|
201
|
+
}
|
|
202
|
+
|
|
201
203
|
assign(context) {
|
|
202
204
|
const stated = context.isStated();
|
|
203
205
|
|
|
@@ -79,12 +79,20 @@ export default define(class SatisfiesAssertion extends Assertion {
|
|
|
79
79
|
validateSignature(context) {
|
|
80
80
|
let signatureValidates = false;
|
|
81
81
|
|
|
82
|
+
const satisfiesAssertionString = this.getString(); ///
|
|
83
|
+
|
|
84
|
+
context.trace(`Validating the '${satisfiesAssertionString}' satisfies assertion's signature...`);
|
|
85
|
+
|
|
82
86
|
const signature = this.signature.validate(context);
|
|
83
87
|
|
|
84
88
|
if (signature !== null) {
|
|
85
89
|
signatureValidates = true;
|
|
86
90
|
}
|
|
87
91
|
|
|
92
|
+
if (signatureValidates) {
|
|
93
|
+
context.debug(`...validated the '${satisfiesAssertionString}' satisfies assertion's signature.`);
|
|
94
|
+
}
|
|
95
|
+
|
|
88
96
|
return signatureValidates;
|
|
89
97
|
}
|
|
90
98
|
|
|
@@ -121,9 +121,9 @@ export default define(class TypeAssertion extends Assertion {
|
|
|
121
121
|
let validatesForwards = false;
|
|
122
122
|
|
|
123
123
|
const termType = term.getType(),
|
|
124
|
-
|
|
124
|
+
termTypeEqualToOrSuperTypeOfType = termType.isEqualToOrSuperTypeOf(this.type);
|
|
125
125
|
|
|
126
|
-
if (
|
|
126
|
+
if (termTypeEqualToOrSuperTypeOfType) {
|
|
127
127
|
validatesForwards = true;
|
|
128
128
|
}
|
|
129
129
|
|
|
@@ -137,7 +137,7 @@ export default define(class TypeAssertion extends Assertion {
|
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
if (validatesWhenStated) {
|
|
140
|
-
context.debug(`...
|
|
140
|
+
context.debug(`...validated the '${typeAssertionString}' stated type assertion.`);
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
return validatesWhenStated;
|
|
@@ -157,9 +157,9 @@ export default define(class TypeAssertion extends Assertion {
|
|
|
157
157
|
termTypeProvisional = termType.isProvisional();
|
|
158
158
|
|
|
159
159
|
if (!termTypeProvisional) {
|
|
160
|
-
const
|
|
160
|
+
const termTypeEqualToOrSubTypeOfType = termType.isEqualToOrSubTypeOf(this.type);
|
|
161
161
|
|
|
162
|
-
if (
|
|
162
|
+
if (termTypeEqualToOrSubTypeOfType) {
|
|
163
163
|
validatesForwards = true;
|
|
164
164
|
}
|
|
165
165
|
}
|
|
@@ -174,7 +174,7 @@ export default define(class TypeAssertion extends Assertion {
|
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
if (validatesWhenDerived) {
|
|
177
|
-
context.debug(`...
|
|
177
|
+
context.debug(`...validated the '${typeAssertionString}' derived type assertion.`);
|
|
178
178
|
}
|
|
179
179
|
|
|
180
180
|
return validatesWhenDerived;
|