occam-verify-cli 1.0.862 → 1.0.866

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.
Files changed (55) hide show
  1. package/lib/context/liminal.js +16 -24
  2. package/lib/context/literal.js +1 -9
  3. package/lib/context/mnemic.js +5 -51
  4. package/lib/context/synoptic.js +26 -12
  5. package/lib/context.js +1 -37
  6. package/lib/element/assumption/metaLevel.js +3 -3
  7. package/lib/element/combinator.js +2 -2
  8. package/lib/element/conclusion.js +2 -2
  9. package/lib/element/constructor.js +2 -2
  10. package/lib/element/deduction.js +2 -2
  11. package/lib/element/label.js +2 -2
  12. package/lib/element/metavariable.js +10 -10
  13. package/lib/element/proofAssertion/premise.js +2 -2
  14. package/lib/element/proofAssertion/step.js +2 -2
  15. package/lib/element/proofAssertion/supposition.js +2 -2
  16. package/lib/element/reference.js +2 -2
  17. package/lib/element/substitution/frame.js +34 -34
  18. package/lib/element/substitution/reference.js +37 -36
  19. package/lib/element/substitution/statement.js +41 -38
  20. package/lib/element/substitution/term.js +35 -34
  21. package/lib/element/substitution.js +66 -29
  22. package/lib/element/variable.js +4 -4
  23. package/lib/process/unify.js +5 -5
  24. package/lib/utilities/context.js +52 -17
  25. package/lib/utilities/element.js +27 -66
  26. package/lib/utilities/json.js +27 -8
  27. package/lib/utilities/validation.js +7 -7
  28. package/package.json +4 -4
  29. package/src/context/liminal.js +15 -26
  30. package/src/context/literal.js +0 -14
  31. package/src/context/mnemic.js +8 -64
  32. package/src/context/synoptic.js +37 -11
  33. package/src/context.js +0 -54
  34. package/src/element/assumption/metaLevel.js +2 -2
  35. package/src/element/combinator.js +1 -1
  36. package/src/element/conclusion.js +1 -1
  37. package/src/element/constructor.js +1 -1
  38. package/src/element/deduction.js +1 -1
  39. package/src/element/label.js +1 -1
  40. package/src/element/metavariable.js +10 -10
  41. package/src/element/proofAssertion/premise.js +1 -1
  42. package/src/element/proofAssertion/step.js +1 -1
  43. package/src/element/proofAssertion/supposition.js +1 -1
  44. package/src/element/reference.js +1 -1
  45. package/src/element/substitution/frame.js +42 -38
  46. package/src/element/substitution/reference.js +46 -39
  47. package/src/element/substitution/statement.js +51 -41
  48. package/src/element/substitution/term.js +44 -38
  49. package/src/element/substitution.js +84 -35
  50. package/src/element/variable.js +3 -3
  51. package/src/process/unify.js +3 -5
  52. package/src/utilities/context.js +61 -23
  53. package/src/utilities/element.js +36 -70
  54. package/src/utilities/json.js +31 -12
  55. package/src/utilities/validation.js +9 -9
@@ -6,7 +6,7 @@ import { metavariableNodesFromDerivedSubstitutions } from "../utilities/substitu
6
6
  import Context from "../context";
7
7
  import elements from "../elements";
8
8
 
9
- const { find, first } = arrayUtilities;
9
+ const { push, find, first } = arrayUtilities;
10
10
 
11
11
  export default class LiminalContext extends Context {
12
12
  constructor(context, derivedSubstitutions) {
@@ -15,33 +15,23 @@ export default class LiminalContext extends Context {
15
15
  this.derivedSubstitutions = derivedSubstitutions;
16
16
  }
17
17
 
18
- getDerivedSubstitutions(nested = true) {
19
- let derivedSubstitutions;
20
-
21
- if (nested) {
22
- const context = this.getContext();
18
+ getDerivedSubstitutions(derivedSubstitutions = []) {
19
+ const context = this.getContext();
23
20
 
24
- derivedSubstitutions = context.getDerivedSubstitutions();
21
+ push(derivedSubstitutions, this.derivedSubstitutions);
25
22
 
26
- derivedSubstitutions = [ ///
27
- ...this.derivedSubstitutions,
28
- ...derivedSubstitutions
29
- ]
30
- } else {
31
- derivedSubstitutions = this.derivedSubstitutions;
32
- }
23
+ context.getDerivedSubstitutions(derivedSubstitutions);
33
24
 
34
25
  return derivedSubstitutions;
35
26
  }
36
27
 
37
- getSoleDerivedSubstitution(nested = true) {
28
+ getSoleDerivedSubstitution() {
38
29
  let soleDerivedSubstitution = null;
39
30
 
40
- const derivedSubstitutions = this.getDerivedSubstitutions(nested),
41
- derivedSubstitutionsLength = derivedSubstitutions.length;
31
+ const derivedSubstitutionsLength = this.derivedSubstitutions.length;
42
32
 
43
33
  if (derivedSubstitutionsLength === 1) {
44
- const firstDerivedSubstitution = first(derivedSubstitutions);
34
+ const firstDerivedSubstitution = first(this.derivedSubstitutions);
45
35
 
46
36
  soleDerivedSubstitution = firstDerivedSubstitution; ///
47
37
  }
@@ -49,10 +39,10 @@ export default class LiminalContext extends Context {
49
39
  return soleDerivedSubstitution;
50
40
  }
51
41
 
52
- getSoleNonTrivialDerivedSubstitution(nested = true) {
42
+ getSoleNonTrivialDerivedSubstitution() {
53
43
  let soleNonTrivialDerivedSubstitution = null;
54
44
 
55
- const soleDerivedSubstitution = this.getSoleDerivedSubstitution(nested);
45
+ const soleDerivedSubstitution = this.getSoleDerivedSubstitution();
56
46
 
57
47
  if (soleDerivedSubstitution !== null) {
58
48
  const soleDerivedSubstitutionNonTrivial = soleDerivedSubstitution.isNonTrivial();
@@ -151,16 +141,15 @@ export default class LiminalContext extends Context {
151
141
  if (empty) {
152
142
  qualifies = true;
153
143
  } else {
154
- const nested = false,
155
- soleDerivedSubstitution = this.getSoleDerivedSubstitution(nested);
144
+ const soleDerivedSubstitution = this.getSoleDerivedSubstitution();
156
145
 
157
146
  if (soleDerivedSubstitution !== null) {
158
147
  const { ReferenceDerivedSubstitution } = elements,
159
148
  context = this,
160
149
  referenceDerivedSubstitution = ReferenceDerivedSubstitution.fromAssumptionAndMetaLevelAssumption(assumption, metaLevelAssumption, context),
161
- soleDerivedSubstitutionCompares = referenceDerivedSubstitution.compareDerivedSubstitution(soleDerivedSubstitution);
150
+ referenceDerivedSubstitutionComparesToSsoleDerivedSubstitution = referenceDerivedSubstitution.compareSubstitution(soleDerivedSubstitution);
162
151
 
163
- if (soleDerivedSubstitutionCompares) {
152
+ if (referenceDerivedSubstitutionComparesToSsoleDerivedSubstitution) {
164
153
  qualifies = true;
165
154
  }
166
155
  }
@@ -186,10 +175,10 @@ export default class LiminalContext extends Context {
186
175
  return derivedSubstitution;
187
176
  }
188
177
 
189
- findDerivedSubstitutions(callback, nested = true) {
178
+ findDerivedSubstitutions(callback) {
190
179
  let derivedSubstitutions;
191
180
 
192
- derivedSubstitutions = this.getDerivedSubstitutions(nested);
181
+ derivedSubstitutions = this.getDerivedSubstitutions();
193
182
 
194
183
  derivedSubstitutions = find(derivedSubstitutions, callback); ///
195
184
 
@@ -17,20 +17,6 @@ export default class LiteralContext extends Context {
17
17
  return this.tokens;
18
18
  }
19
19
 
20
- getLexer() {
21
- const context = this.getContext(),
22
- lexer = context.getLexer();
23
-
24
- return lexer;
25
- }
26
-
27
- getParser() {
28
- const context = this.getContext(),
29
- parser = context.getParser();
30
-
31
- return parser;
32
- }
33
-
34
20
  setTokens(tokens) {
35
21
  this.tokens = tokens;
36
22
  }
@@ -439,70 +439,6 @@ export default class MnemicContext extends Context {
439
439
  });
440
440
  }
441
441
 
442
- addFrames(frames) {
443
- frames.forEach((frame) => {
444
- this.addFrame(frame);
445
- });
446
- }
447
-
448
- addEqualities(equalities) {
449
- equalities.forEach((equality) => {
450
- this.addEquality(equality);
451
- });
452
- }
453
-
454
- addJudgements(judgements) {
455
- judgements.forEach((judgement) => {
456
- this.addJudgement(judgement);
457
- });
458
- }
459
-
460
- addAssertions(assertions) {
461
- assertions.forEach((assertion) => {
462
- this.addAssertion(assertion);
463
- });
464
- }
465
-
466
- addStatements(statements) {
467
- statements.forEach((statement) => {
468
- this.addStatement(statement);
469
- });
470
- }
471
-
472
- addReferences(references) {
473
- references.forEach((reference) => {
474
- this.addReference(reference);
475
- });
476
- }
477
-
478
- addAssumptions(assumptions) {
479
- assumptions.forEach((assumption) => {
480
- this.addAssumption(assumption);
481
- });
482
- }
483
-
484
- addMetavariables(metavariables) {
485
- metavariables.forEach((metavariable) => {
486
- this.addMetavariable(metavariable);
487
- });
488
- }
489
-
490
- addSubstitutions(substitutions) {
491
- ///
492
- }
493
-
494
- addDerivedSubstitutions(derivedSubstitutions) {
495
- ///
496
- }
497
-
498
- findVariableByVariableNode(variableNode) {
499
- const variableIdentifier = variableNode.getVariableIdentifier(),
500
- declaredVariable = this.findDeclaredVariableByVariableIdentifier(variableIdentifier),
501
- variable = declaredVariable; ///
502
-
503
- return variable;
504
- }
505
-
506
442
  findTermByTermNode(termNode) {
507
443
  const terms = this.getTerms(),
508
444
  term = terms.find((term) => {
@@ -646,6 +582,14 @@ export default class MnemicContext extends Context {
646
582
  return substitution;
647
583
  }
648
584
 
585
+ findVariableByVariableNode(variableNode) {
586
+ const variableIdentifier = variableNode.getVariableIdentifier(),
587
+ declaredVariable = this.findDeclaredVariableByVariableIdentifier(variableIdentifier),
588
+ variable = declaredVariable; ///
589
+
590
+ return variable;
591
+ }
592
+
649
593
  isTermPresentByTermNode(termNode) {
650
594
  const term = this.findTermByTermNode(termNode),
651
595
  termPresent = (term !== null);
@@ -35,9 +35,11 @@ export default class SynopticContext extends Context {
35
35
  }
36
36
 
37
37
  getTerms(terms = []) {
38
+ const context = this.getContext();
39
+
38
40
  push(terms, this.terms);
39
41
 
40
- this.context.getTerms(terms);
42
+ context.getTerms(terms);
41
43
 
42
44
  compressTerms(terms);
43
45
 
@@ -45,9 +47,11 @@ export default class SynopticContext extends Context {
45
47
  }
46
48
 
47
49
  getFrames(frames = []) {
50
+ const context = this.getContext();
51
+
48
52
  push(frames, this.frames);
49
53
 
50
- this.context.getFrames(frames);
54
+ context.getFrames(frames);
51
55
 
52
56
  compressFrames(frames);
53
57
 
@@ -55,9 +59,11 @@ export default class SynopticContext extends Context {
55
59
  }
56
60
 
57
61
  getEqualities(equalities = []) {
62
+ const context = this.getContext();
63
+
58
64
  push(equalities, this.equalities);
59
65
 
60
- this.context.getEqualities(equalities);
66
+ context.getEqualities(equalities);
61
67
 
62
68
  compressEqualities(equalities);
63
69
 
@@ -65,9 +71,11 @@ export default class SynopticContext extends Context {
65
71
  }
66
72
 
67
73
  getJudgements(judgements = []) {
74
+ const context = this.getContext();
75
+
68
76
  push(judgements, this.judgements);
69
77
 
70
- this.context.getJudgements(judgements);
78
+ context.getJudgements(judgements);
71
79
 
72
80
  compressJudgements(judgements);
73
81
 
@@ -75,9 +83,11 @@ export default class SynopticContext extends Context {
75
83
  }
76
84
 
77
85
  getStatements(statements = []) {
86
+ const context = this.getContext();
87
+
78
88
  push(statements, this.statements);
79
89
 
80
- this.context.getStatements(statements);
90
+ context.getStatements(statements);
81
91
 
82
92
  compressStatements(statements);
83
93
 
@@ -85,9 +95,11 @@ export default class SynopticContext extends Context {
85
95
  }
86
96
 
87
97
  getAssertions(assertions = []) {
98
+ const context = this.getContext();
99
+
88
100
  push(assertions, this.assertions);
89
101
 
90
- this.context.getAssertions(assertions);
102
+ context.getAssertions(assertions);
91
103
 
92
104
  compressAssertions(assertions);
93
105
 
@@ -95,9 +107,11 @@ export default class SynopticContext extends Context {
95
107
  }
96
108
 
97
109
  getReferences(references = []) {
110
+ const context = this.getContext();
111
+
98
112
  push(references, this.references);
99
113
 
100
- this.context.getReferences(references);
114
+ context.getReferences(references);
101
115
 
102
116
  compressReferences(references);
103
117
 
@@ -105,9 +119,11 @@ export default class SynopticContext extends Context {
105
119
  }
106
120
 
107
121
  getAssumptions(assumptions = []) {
122
+ const context = this.getContext();
123
+
108
124
  push(assumptions, this.assumptions);
109
125
 
110
- this.context.getAssumptions(assumptions);
126
+ context.getAssumptions(assumptions);
111
127
 
112
128
  compressAssumptions(assumptions);
113
129
 
@@ -115,9 +131,11 @@ export default class SynopticContext extends Context {
115
131
  }
116
132
 
117
133
  getMetavariables(metavariables = []) {
134
+ const context = this.getContext();
135
+
118
136
  push(metavariables, this.metavariables);
119
137
 
120
- this.context.getMetavariables(metavariables);
138
+ context.getMetavariables(metavariables);
121
139
 
122
140
  compressMetavariables(metavariables);
123
141
 
@@ -125,9 +143,11 @@ export default class SynopticContext extends Context {
125
143
  }
126
144
 
127
145
  getSubstitutions(substitutions = []) {
146
+ const context = this.getContext();
147
+
128
148
  push(substitutions, this.substitutions);
129
149
 
130
- this.context.getSubstitutions(substitutions);
150
+ context.getSubstitutions(substitutions);
131
151
 
132
152
  compressSubstitutions(substitutions);
133
153
 
@@ -135,9 +155,11 @@ export default class SynopticContext extends Context {
135
155
  }
136
156
 
137
157
  getDerivedSubstitutions(derivedSubstitutions = []) {
158
+ const context = this.getContext();
159
+
138
160
  push(derivedSubstitutions, this.derivedSubstitutions);
139
161
 
140
- this.context.getDerivedSubstitutions(derivedSubstitutions);
162
+ context.getDerivedSubstitutions(derivedSubstitutions);
141
163
 
142
164
  return derivedSubstitutions;
143
165
  }
@@ -286,6 +308,10 @@ export default class SynopticContext extends Context {
286
308
  }
287
309
 
288
310
  static fromContexts(...contexts) {
311
+ contexts = [ ///
312
+ ...contexts
313
+ ];
314
+
289
315
  const context = contexts.pop(), ///
290
316
  terms = termsFromContexts(contexts),
291
317
  frames = framesFromContexts(contexts),
package/src/context.js CHANGED
@@ -546,60 +546,6 @@ export default class Context extends ContextBase {
546
546
  context.addTerms(terms);
547
547
  }
548
548
 
549
- addFrames(frames) {
550
- const context = this.getContext();
551
-
552
- context.addFrames(frames);
553
- }
554
-
555
- addEqualities(equalities) {
556
- const context = this.getContext();
557
-
558
- context.addEqualities(equalities);
559
- }
560
-
561
- addJudgements(judgements) {
562
- const context = this.getContext();
563
-
564
- context.addJudgements(judgements);
565
- }
566
-
567
- addAssertions(assertions) {
568
- const context = this.getContext();
569
-
570
- context.addAssertions(assertions);
571
- }
572
-
573
- addStatements(statements) {
574
- const context = this.getContext();
575
-
576
- context.addStatements(statements);
577
- }
578
-
579
- addReferences(references) {
580
- const context = this.getContext();
581
-
582
- context.addReferences(references);
583
- }
584
-
585
- addAssumptions(assumptions) {
586
- const context = this.getContext();
587
-
588
- context.addAssumptions(assumptions);
589
- }
590
-
591
- addMetavariables(metavariables) {
592
- const context = this.getContext();
593
-
594
- context.addMetavariables(metavariables);
595
- }
596
-
597
- addSubstitutions(substitutions) {
598
- const context = this.getContext();
599
-
600
- context.addSubstitutions(substitutions);
601
- }
602
-
603
549
  addDerivedSubstitutions(derivedSubstitutions) {
604
550
  const context = this.getContext();
605
551
 
@@ -102,7 +102,7 @@ export default define(class MetaLevelAssumption extends Element {
102
102
  }
103
103
 
104
104
  if (validates) {
105
- context.commit(this);
105
+ this.commit(context);
106
106
  }
107
107
  }, context);
108
108
  }
@@ -201,7 +201,7 @@ export default define(class MetaLevelAssumption extends Element {
201
201
  }
202
202
 
203
203
  unifyAssumption(assumption, context) {
204
- let assumptionUnifies;
204
+ let assumptionUnifies = false;
205
205
 
206
206
  const assumptionString = assumption.getString(), ///
207
207
  metaLevelAssumptionString = this.getString();
@@ -42,7 +42,7 @@ export default define(class Combinator extends Element {
42
42
  }
43
43
 
44
44
  if (validates) {
45
- context.commit(this);
45
+ this.commit(context);
46
46
  }
47
47
  }, context)
48
48
 
@@ -66,7 +66,7 @@ export default define(class Conclusion extends Element {
66
66
  }
67
67
 
68
68
  if (validates) {
69
- context.commit(this);
69
+ this.commit(context);
70
70
  }
71
71
  }, context);
72
72
  }, context);
@@ -68,7 +68,7 @@ export default define(class Constructor extends Element {
68
68
  }
69
69
 
70
70
  if (validates) {
71
- context.commit(this);
71
+ this.commit(context);
72
72
  }
73
73
  }, context);
74
74
 
@@ -66,7 +66,7 @@ export default define(class Deduction extends Element {
66
66
  }
67
67
 
68
68
  if (validates) {
69
- context.commit(this);
69
+ this.commit(context);
70
70
  }
71
71
  }, context);
72
72
  }, context);
@@ -92,7 +92,7 @@ export default define(class Label extends Element {
92
92
  }
93
93
 
94
94
  if (validates) {
95
- context.commit(this);
95
+ this.commit(context);
96
96
  }
97
97
  }, context);
98
98
 
@@ -351,13 +351,13 @@ export default define(class Metavariable extends Element {
351
351
  }
352
352
  } else {
353
353
  const { FrameSubstitution } = elements,
354
- frameSubstitution = FrameSubstitution.fromFrameAndMetavariable(frame, metavariable, context);
354
+ frameSubstitution = FrameSubstitution.fromFrameAndMetavariable(frame, metavariable, generalContext, specificContext);
355
355
 
356
- frameSubstitution.validate(generalContext, specificContext);
356
+ frameSubstitution.validate(context);
357
357
 
358
358
  const derivedSubstitution = frameSubstitution; ///
359
359
 
360
- specificContext.addDerivedSubstitution(derivedSubstitution);
360
+ context.addDerivedSubstitution(derivedSubstitution);
361
361
 
362
362
  frameUnifies = true;
363
363
  }
@@ -406,14 +406,14 @@ export default define(class Metavariable extends Element {
406
406
  } else {
407
407
  const { StatementSubstitution } = elements,
408
408
  statementSubstitution = (substitution !== null) ?
409
- StatementSubstitution.fromStatementMetavariableAndSubstitution(statement, metavariable, substitution, context) :
410
- StatementSubstitution.fromStatementAndMetavariable(statement, metavariable, context);
409
+ StatementSubstitution.fromStatementMetavariableAndSubstitution(statement, metavariable, substitution, generalContext, specificContext) :
410
+ StatementSubstitution.fromStatementAndMetavariable(statement, metavariable, generalContext, specificContext);
411
411
 
412
- statementSubstitution.validate(substitution, generalContext, specificContext);
412
+ statementSubstitution.validate(substitution, context);
413
413
 
414
414
  const derivedSubstitution = statementSubstitution; ///
415
415
 
416
- specificContext.addDerivedSubstitution(derivedSubstitution);
416
+ context.addDerivedSubstitution(derivedSubstitution);
417
417
 
418
418
  statementUnifies = true;
419
419
  }
@@ -456,13 +456,13 @@ export default define(class Metavariable extends Element {
456
456
  }
457
457
  } else {
458
458
  const { ReferenceSubstitution } = elements,
459
- referenceSubstitution = ReferenceSubstitution.fromReferenceAndMetavariable(reference, metavariable, context);
459
+ referenceSubstitution = ReferenceSubstitution.fromReferenceAndMetavariable(reference, metavariable, generalContext, specificContext);
460
460
 
461
- referenceSubstitution.validate(generalContext, specificContext);
461
+ referenceSubstitution.validate(context);
462
462
 
463
463
  const derivedSubstitution = referenceSubstitution; ///
464
464
 
465
- specificContext.addDerivedSubstitution(derivedSubstitution);
465
+ context.addDerivedSubstitution(derivedSubstitution);
466
466
 
467
467
  referenceUnifies = true;
468
468
  }
@@ -79,7 +79,7 @@ export default define(class Premise extends ProofAssertion {
79
79
  }
80
80
 
81
81
  if (validates) {
82
- context.commit(this);
82
+ this.commit(context);
83
83
  }
84
84
  }, context);
85
85
  }, context);
@@ -152,7 +152,7 @@ export default define(class Step extends ProofAssertion {
152
152
  }
153
153
 
154
154
  if (validates) {
155
- context.commit(this);
155
+ this.commit(context);
156
156
  }
157
157
  }, context);
158
158
  }, context)
@@ -79,7 +79,7 @@ export default define(class Supposition extends ProofAssertion {
79
79
  }
80
80
 
81
81
  if (validates) {
82
- context.commit(this);
82
+ this.commit(context);
83
83
  }
84
84
  }, context);
85
85
  }, context);
@@ -178,7 +178,7 @@ export default define(class Reference extends Element {
178
178
  }
179
179
 
180
180
  if (validates) {
181
- context.commit(this);
181
+ this.commit(context);
182
182
  }
183
183
  }, context);
184
184
  }