occam-verify-cli 1.0.612 → 1.0.631

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 (141) hide show
  1. package/lib/context/ephemeral.js +210 -77
  2. package/lib/context/file/nominal.js +157 -135
  3. package/lib/context/liminal.js +34 -59
  4. package/lib/context/scoped.js +37 -58
  5. package/lib/context.js +103 -53
  6. package/lib/element/assertion/contained.js +3 -1
  7. package/lib/element/assertion/defined.js +3 -1
  8. package/lib/element/assertion/property.js +10 -58
  9. package/lib/element/assertion/satisfies.js +3 -1
  10. package/lib/element/assertion/subproof.js +3 -1
  11. package/lib/element/assertion/type.js +63 -109
  12. package/lib/element/assertion.js +5 -9
  13. package/lib/element/assumption.js +50 -19
  14. package/lib/element/combinator.js +8 -1
  15. package/lib/element/conclusion.js +8 -1
  16. package/lib/element/constructor.js +8 -1
  17. package/lib/element/declaration.js +3 -7
  18. package/lib/element/deduction.js +8 -1
  19. package/lib/element/derivation.js +15 -10
  20. package/lib/element/equality.js +109 -62
  21. package/lib/element/equivalence.js +13 -6
  22. package/lib/element/equivalences.js +11 -4
  23. package/lib/element/error.js +10 -7
  24. package/lib/element/frame.js +21 -21
  25. package/lib/element/hypothesis.js +12 -7
  26. package/lib/element/judgement.js +55 -26
  27. package/lib/element/label.js +8 -1
  28. package/lib/element/metaType.js +9 -2
  29. package/lib/element/metavariable.js +16 -10
  30. package/lib/element/parameter.js +8 -1
  31. package/lib/element/procedureCall.js +21 -29
  32. package/lib/element/procedureReference.js +15 -1
  33. package/lib/element/proof.js +8 -1
  34. package/lib/element/proofAssertion.js +8 -1
  35. package/lib/element/property.js +8 -1
  36. package/lib/element/propertyRelation.js +8 -1
  37. package/lib/element/reference.js +16 -28
  38. package/lib/element/rule.js +22 -21
  39. package/lib/element/section.js +8 -1
  40. package/lib/element/signature.js +8 -1
  41. package/lib/element/statement.js +34 -40
  42. package/lib/element/subDerivation.js +11 -6
  43. package/lib/element/subproof.js +8 -1
  44. package/lib/element/substitution/frame.js +6 -6
  45. package/lib/element/substitution/reference.js +6 -6
  46. package/lib/element/substitution/statement.js +6 -6
  47. package/lib/element/substitution/term.js +9 -3
  48. package/lib/element/substitution.js +73 -49
  49. package/lib/element/term.js +15 -1
  50. package/lib/element/topLevelAssertion/axiom.js +8 -1
  51. package/lib/element/topLevelAssertion/conjecture.js +8 -1
  52. package/lib/element/topLevelAssertion/lemma.js +8 -1
  53. package/lib/element/topLevelAssertion/theorem.js +8 -1
  54. package/lib/element/topLevelAssertion.js +11 -17
  55. package/lib/element/topLevelMetaAssertion/metaLemma.js +8 -1
  56. package/lib/element/topLevelMetaAssertion/metatheorem.js +8 -1
  57. package/lib/element/topLevelMetaAssertion.js +9 -11
  58. package/lib/element/type.js +8 -1
  59. package/lib/element/typePrefix.js +8 -1
  60. package/lib/element/variable.js +51 -5
  61. package/lib/preamble.js +1 -2
  62. package/lib/process/assign.js +96 -27
  63. package/lib/process/unify.js +3 -4
  64. package/lib/process/validate.js +2 -2
  65. package/lib/process/verify.js +2 -2
  66. package/lib/utilities/element.js +74 -12
  67. package/lib/utilities/json.js +2 -2
  68. package/lib/utilities/string.js +9 -24
  69. package/lib/utilities/substitutions.js +15 -23
  70. package/package.json +2 -2
  71. package/src/context/ephemeral.js +234 -82
  72. package/src/context/file/nominal.js +195 -135
  73. package/src/context/liminal.js +43 -80
  74. package/src/context/scoped.js +56 -81
  75. package/src/context.js +97 -46
  76. package/src/element/assertion/contained.js +4 -0
  77. package/src/element/assertion/defined.js +4 -0
  78. package/src/element/assertion/property.js +15 -26
  79. package/src/element/assertion/satisfies.js +4 -0
  80. package/src/element/assertion/subproof.js +4 -0
  81. package/src/element/assertion/type.js +67 -77
  82. package/src/element/assertion.js +4 -8
  83. package/src/element/assumption.js +57 -18
  84. package/src/element/combinator.js +7 -0
  85. package/src/element/conclusion.js +7 -0
  86. package/src/element/constructor.js +7 -0
  87. package/src/element/declaration.js +1 -3
  88. package/src/element/deduction.js +7 -0
  89. package/src/element/derivation.js +10 -5
  90. package/src/element/equality.js +116 -74
  91. package/src/element/equivalence.js +15 -7
  92. package/src/element/equivalences.js +14 -5
  93. package/src/element/error.js +5 -2
  94. package/src/element/frame.js +25 -25
  95. package/src/element/hypothesis.js +11 -6
  96. package/src/element/judgement.js +62 -26
  97. package/src/element/label.js +7 -0
  98. package/src/element/metaType.js +8 -1
  99. package/src/element/metavariable.js +20 -14
  100. package/src/element/parameter.js +7 -0
  101. package/src/element/procedureCall.js +21 -14
  102. package/src/element/procedureReference.js +13 -0
  103. package/src/element/proof.js +7 -0
  104. package/src/element/proofAssertion.js +7 -0
  105. package/src/element/property.js +7 -0
  106. package/src/element/propertyRelation.js +7 -0
  107. package/src/element/reference.js +20 -33
  108. package/src/element/rule.js +16 -19
  109. package/src/element/section.js +7 -0
  110. package/src/element/signature.js +7 -0
  111. package/src/element/statement.js +36 -44
  112. package/src/element/subDerivation.js +10 -5
  113. package/src/element/subproof.js +7 -0
  114. package/src/element/substitution/frame.js +3 -3
  115. package/src/element/substitution/reference.js +3 -3
  116. package/src/element/substitution/statement.js +3 -3
  117. package/src/element/substitution/term.js +4 -2
  118. package/src/element/substitution.js +60 -40
  119. package/src/element/term.js +20 -2
  120. package/src/element/topLevelAssertion/axiom.js +7 -0
  121. package/src/element/topLevelAssertion/conjecture.js +7 -0
  122. package/src/element/topLevelAssertion/lemma.js +7 -0
  123. package/src/element/topLevelAssertion/theorem.js +7 -0
  124. package/src/element/topLevelAssertion.js +5 -15
  125. package/src/element/topLevelMetaAssertion/metaLemma.js +7 -0
  126. package/src/element/topLevelMetaAssertion/metatheorem.js +7 -0
  127. package/src/element/topLevelMetaAssertion.js +4 -6
  128. package/src/element/type.js +7 -0
  129. package/src/element/typePrefix.js +7 -0
  130. package/src/element/variable.js +9 -4
  131. package/src/preamble.js +0 -1
  132. package/src/process/assign.js +113 -38
  133. package/src/process/unify.js +2 -3
  134. package/src/process/validate.js +1 -1
  135. package/src/process/verify.js +1 -1
  136. package/src/utilities/element.js +83 -26
  137. package/src/utilities/json.js +1 -1
  138. package/src/utilities/string.js +7 -29
  139. package/src/utilities/substitutions.js +19 -30
  140. package/lib/element/substitutions.js +0 -225
  141. package/src/element/substitutions.js +0 -84
@@ -2,11 +2,10 @@
2
2
 
3
3
  import { arrayUtilities } from "necessary";
4
4
  import { metavariableNamesFromSubstitutions } from "../utilities/substitutions";
5
- import { substitutionsStringFromSubstitutions } from "../utilities/string";
6
5
 
7
6
  import Context from "../context";
8
7
 
9
- const { find, first, prune, compress } = arrayUtilities;
8
+ const { find, first } = arrayUtilities;
10
9
 
11
10
  export default class LiminalContext extends Context {
12
11
  constructor(context, substitutions) {
@@ -62,60 +61,34 @@ export default class LiminalContext extends Context {
62
61
  }
63
62
 
64
63
  addSubstitution(substitution) {
65
- const context = this,
64
+ const context = this, ///
65
+ substitutionA = substitution, ///
66
66
  substitutionString = substitution.getString();
67
67
 
68
- this.substitutions = [ ///
69
- ...this.substitutions,
70
- substitution
71
- ];
68
+ context.trace(`Adding the '${substitutionString}' substitution to the liminal context...`);
72
69
 
73
- compress(this.substitutions, (substitutionA, substitutionB) => {
74
- const substitutionAEqualToSubstitutionB = substitutionA.isEqualTo(substitutionB);
70
+ const substitutionB = this.substitutions.find((substitution) => {
71
+ const substitutionB = substitution, ///
72
+ substitutionAEqualToSubstitutionB = substitutionA.isEqualTo(substitutionB);
75
73
 
76
- if (!substitutionAEqualToSubstitutionB) {
74
+ if (substitutionAEqualToSubstitutionB) {
77
75
  return true;
78
76
  }
79
- });
80
-
81
- context.trace(`Added the '${substitutionString}' substitution to the context.`);
82
- }
83
-
84
- addSubstitutions(substitutions) {
85
- const context = this,
86
- substitutionsString = substitutionsStringFromSubstitutions(substitutions);
87
-
88
- this.substitutions = [ ///
89
- ...this.substitutions,
90
- ...substitutions
91
- ];
92
-
93
- compress(this.substitutions, (substitutionA, substitutionB) => {
94
- const substitutionAEqualToAssertionB = substitutionA.isEqualTo(substitutionB);
77
+ }) || null;
95
78
 
96
- if (!substitutionAEqualToAssertionB) {
97
- return true;
98
- }
99
- });
79
+ if (substitutionB !== null) {
80
+ context.trace(`The '${substitutionString}' substitution has already been added to the liminal context.`);
81
+ } else {
82
+ this.substitutions.push(substitution);
100
83
 
101
- context.trace(`Added the '${substitutionsString}' substitutions to the context.`);
84
+ context.debug(`...added the '${substitutionString}' substitution to the liminal context.`);
85
+ }
102
86
  }
103
87
 
104
- removeSubstitution(substitution) {
105
- const context = this,
106
- substitutionA = substitution, ///
107
- substitutionString = substitution.getString();
108
-
109
- prune(this.substitutions, (substitution) => {
110
- const substitutionB = substitution,
111
- substitutionAEqualTosubstitutionB = substitutionA.isEqualTo(substitutionB);
112
-
113
- if (!substitutionAEqualTosubstitutionB) {
114
- return true;
115
- }
88
+ addSubstitutions(substitutions) {
89
+ substitutions.forEach((substitution) => {
90
+ this.addSubstitution(substitution);
116
91
  });
117
-
118
- context.trace(`Removed the '${substitutionString}' substitution to the context.`);
119
92
  }
120
93
 
121
94
  resolveSubstitutions(generalContext, specificContext) {
@@ -123,23 +96,20 @@ export default class LiminalContext extends Context {
123
96
  metavariableNames = metavariableNamesFromSubstitutions(substitutions);
124
97
 
125
98
  metavariableNames.forEach((metavariableName) => {
126
- const complexSubstitutions = this.findComplexSubstitutionsByMetavariableName(metavariableName),
127
- complexSubstitutionsResolved = complexSubstitutions.every((complexSubstitution) => {
128
- const substitution = complexSubstitution, ///
129
- resolved = substitution.isResolved();
99
+ const complexSubstitutions = this.findComplexSubstitutionsByMetavariableName(metavariableName);
130
100
 
131
- if (!resolved) {
132
- substitution.resolve(generalContext, specificContext);
133
- }
134
- });
101
+ complexSubstitutions.forEach((complexSubstitution) => {
102
+ const substitution = complexSubstitution, ///
103
+ resolved = substitution.isResolved();
135
104
 
136
- if (complexSubstitutionsResolved) {
137
- return true;
138
- }
105
+ if (!resolved) {
106
+ substitution.resolve(generalContext, specificContext);
107
+ }
108
+ });
139
109
  });
140
110
  }
141
111
 
142
- areSubstitutionsResolved(generalContext, specificContext) {
112
+ areSubstitutionsResolved() {
143
113
  const substitutions = this.getSubstitutions(),
144
114
  metavariableNames = metavariableNamesFromSubstitutions(substitutions),
145
115
  resolved = metavariableNames.every((metavariableName) => {
@@ -165,12 +135,14 @@ export default class LiminalContext extends Context {
165
135
  context = this.getContext();
166
136
  }
167
137
 
138
+ context.debug(`Commiting the limiinal context`);
139
+
168
140
  context.addSubstitutions(this.substitutions);
169
141
  }
170
142
 
171
- findSubstitution(callback, generalContext, specificContext) {
143
+ findSubstitution(callback) {
172
144
  const substitutions = this.getSubstitutions(),
173
- substitution = substitutions.find(callback, generalContext, specificContext);
145
+ substitution = substitutions.find(callback);
174
146
 
175
147
  return substitution;
176
148
  }
@@ -185,16 +157,12 @@ export default class LiminalContext extends Context {
185
157
  return substitutions;
186
158
  }
187
159
 
188
- findSubstitutionByVariableIdentifier(variable) {
160
+ findSubstitutionByVariableIdentifier(variableIdentifier) {
189
161
  const substitution = this.findSubstitution((substitution) => {
190
- const substitutionVariable = substitution.getVariable();
191
-
192
- if (substitutionVariable !== null) {
193
- const substitutionVariableMatchesVariableIdentifier = substitutionVariable.matchVariableIdentifier(variableIdentifier);
162
+ const substitutionComparesToVariableIdentifier = substitution.compareVariableIdentifier(variableIdentifier);
194
163
 
195
- if (substitutionVariableMatchesVariableIdentifier) {
196
- return true;
197
- }
164
+ if (substitutionComparesToVariableIdentifier) {
165
+ return true;
198
166
  }
199
167
  }) || null;
200
168
 
@@ -202,13 +170,8 @@ export default class LiminalContext extends Context {
202
170
  }
203
171
 
204
172
  findSubstitutionByMetavariableName(metavariableName) {
205
- const substitution = this.findSubstitution((substitution) => { ///
206
- const substitutionMatchesMetavariableName = substitution.matchMetavariableName(metavariableName);
207
-
208
- if (substitutionMatchesMetavariableName) {
209
- return true;
210
- }
211
- }) || null;
173
+ const simpleSubstitution = this.findSimpleSubstitutionByMetavariableName(metavariableName),
174
+ substitution = simpleSubstitution; ///
212
175
 
213
176
  return substitution;
214
177
  }
@@ -219,9 +182,9 @@ export default class LiminalContext extends Context {
219
182
 
220
183
  if (substitutionSimple) {
221
184
  const simpleSubstitution = substitution, ///
222
- simpleSubstitutionMatchesMetavariableName = simpleSubstitution.matchMetavariableName(metavariableName);
185
+ simpleSubstitutionComparesToMetavariableName = simpleSubstitution.compareMetavariableName(metavariableName);
223
186
 
224
- if (simpleSubstitutionMatchesMetavariableName) {
187
+ if (simpleSubstitutionComparesToMetavariableName) {
225
188
  return true;
226
189
  }
227
190
  }
@@ -236,9 +199,9 @@ export default class LiminalContext extends Context {
236
199
 
237
200
  if (substitutionComplex) {
238
201
  const complexSubstitution = substitution, ///
239
- complexSubstitutionMatchesMetavariableName = complexSubstitution.matchMetavariableName(metavariableName);
202
+ complexSubstitutionComparesToMetavariableName = complexSubstitution.compareMetavariableName(metavariableName);
240
203
 
241
- if (complexSubstitutionMatchesMetavariableName) {
204
+ if (complexSubstitutionComparesToMetavariableName) {
242
205
  return true;
243
206
  }
244
207
  }
@@ -251,9 +214,9 @@ export default class LiminalContext extends Context {
251
214
  const substitutionA = substitution; ///
252
215
 
253
216
  substitution = this.findSubstitution((substitution) => { ///
254
- const substitutionMatchesMetavariableName = substitution.matchMetavariableName(metavariableName);
217
+ const substitutionComparesToMetavariableName = substitution.compareMetavariableName(metavariableName);
255
218
 
256
- if (substitutionMatchesMetavariableName) {
219
+ if (substitutionComparesToMetavariableName) {
257
220
  const substitutionB = substitution, ///
258
221
  substitutionBSubstitutionComparesToSubstitutionA = substitutionB.compare(substitutionA);
259
222
 
@@ -17,21 +17,17 @@ class ScopedContext extends Context {
17
17
  this.subproofOrProofAssertions = subproofOrProofAssertions;
18
18
  }
19
19
 
20
- getVariables(nested = true) {
20
+ getVariables() {
21
21
  let variables;
22
22
 
23
- if (nested) {
24
- const context = this.getContext();
23
+ const context = this.getContext();
25
24
 
26
- variables = context.getVariables();
25
+ variables = context.getVariables();
27
26
 
28
- variables = [
29
- ...this.variables,
30
- ...variables
31
- ];
32
- } else {
33
- variables = this.variables;
34
- }
27
+ variables = [
28
+ ...this.variables,
29
+ ...variables
30
+ ];
35
31
 
36
32
  return variables;
37
33
  }
@@ -67,6 +63,21 @@ class ScopedContext extends Context {
67
63
  return equivalences;
68
64
  }
69
65
 
66
+ getSubproofOrProofAssertions() {
67
+ let subproofOrProofAssertions;
68
+
69
+ const context = this.getContext();
70
+
71
+ subproofOrProofAssertions = context.getSubproofOrProofAssertions();
72
+
73
+ subproofOrProofAssertions = [ ///
74
+ ...subproofOrProofAssertions,
75
+ ...this.subproofOrProofAssertions
76
+ ];
77
+
78
+ return subproofOrProofAssertions;
79
+ }
80
+
70
81
  getProofAssertions() {
71
82
  const subproofOrProofAssertions = this.getSubproofOrProofAssertions(),
72
83
  proofAssertions = subproofOrProofAssertions.filter((subproofOrProofAssertion) => {
@@ -93,93 +104,57 @@ class ScopedContext extends Context {
93
104
  return lastProofAssertion;
94
105
  }
95
106
 
96
- getSubproofOrProofAssertions() {
97
- let subproofOrProofAssertions;
98
-
99
- const context = this.getContext();
100
-
101
- subproofOrProofAssertions = context.getSubproofOrProofAssertions();
102
-
103
- subproofOrProofAssertions = [ ///
104
- ...subproofOrProofAssertions,
105
- ...this.subproofOrProofAssertions
106
- ];
107
-
108
- return subproofOrProofAssertions;
109
- }
110
-
111
107
  addEquality(equality) {
112
- let equalityAdded;
108
+ const context = this, ///
109
+ equalityString = equality.getString();
110
+
111
+ context.trace(`Adding the '${equalityString}' equality to the scoped context...`);
113
112
 
114
- const equalityReflexive = equality.isReflexive();
113
+ const equalityRelfexive = equality.isReflexive();
115
114
 
116
- if (!equalityReflexive) {
115
+ if (equalityRelfexive) {
116
+ context.trace(`The '${equalityString}' equality is reflexive and will not added to the scoped context.`);
117
+ } else {
117
118
  const { Equivalence } = elements,
118
- equivalence = Equivalence.fromEquality(equality),
119
- context = this; ///
119
+ equivalence = Equivalence.fromEquality(equality, context);
120
120
 
121
121
  this.equivalences = this.equivalences.mergedWithEquivalence(equivalence, context);
122
- }
123
-
124
- equalityAdded = true;
125
-
126
- if (equalityAdded) {
127
- const context = this, ///
128
- equalityString = equality.getString();
129
122
 
130
- context.trace(`Added the '${equalityString}' equality.`)
123
+ context.debug(`...added the '${equalityString}' equality to the scoped context.`);
131
124
  }
132
-
133
- return equalityAdded;
134
125
  }
135
126
 
136
- addVariable(variable, nested = true) {
137
- let variableAdded = false;
138
-
139
- const variableIdentifier = variable.getIdentifier(),
140
- variablePresent = this.isVariablePresentByVariableIdentifier(variableIdentifier, nested);
141
-
142
- if (!variablePresent) {
143
- this.variables.push(variable);
144
-
145
- variableAdded = true;
146
- }
127
+ addVariable(variable) {
128
+ const context = this, ///
129
+ variableString = variable.getString();
147
130
 
148
- if (variableAdded) {
149
- const context = this,
150
- variableString = variable.getString();
131
+ context.trace(`Adding the '${variableString}' variable to the scoped context...`);
151
132
 
152
- context.trace(`Added the '${variableString}' variable.`)
153
- }
133
+ this.variables.push(variable);
154
134
 
155
- return variableAdded;
135
+ context.debug(`...added the '${variableString}' variable to the scoped context.`);
156
136
  }
157
137
 
158
138
  addJudgement(judgement) {
159
- let judgementAdded = false;
160
-
161
- const metavariable = judgement.getMetavariable(),
162
- metavariableName = metavariable.getMetavariableName(),
163
- judgementPresent = this.isJudgementPresentByMetavariableName(metavariableName);
164
-
165
- if (!judgementPresent) {
166
- this.judgements.push(judgement);
167
-
168
- judgementAdded = true;
169
- }
139
+ const context = this, ///
140
+ judgementString = judgement.getString();
170
141
 
171
- if (judgementAdded) {
172
- const context = this, ///
173
- judgementString = judgement.getString();
142
+ context.trace(`Adding the '${judgementString}' judgement to the scoped context...`);
174
143
 
175
- context.trace(`Added the '${judgementString}' judgement.`)
176
- }
144
+ this.judgements.push(judgement);
177
145
 
178
- return judgementAdded;
146
+ context.debug(`...added the '${judgementString}' judgement to the scoped context.`);
179
147
  }
180
148
 
181
149
  addSubproofOrProofAssertion(subproofOrProofAssertion) {
150
+ const context = this, ///
151
+ subproofOrProofAssertionString = subproofOrProofAssertion.getString();
152
+
153
+ context.trace(`Adding the '${subproofOrProofAssertionString}' subproof or proof assertion to the scoped context...`);
154
+
182
155
  this.subproofOrProofAssertions.push(subproofOrProofAssertion);
156
+
157
+ context.debug(`...added the '${subproofOrProofAssertionString}' subproof or proof assertion to the scoped context.`);
183
158
  }
184
159
 
185
160
  findEquivalenceByTerm(term) { return this.equivalences.findEquivalenceByTerm(term); }
@@ -187,7 +162,7 @@ class ScopedContext extends Context {
187
162
  findJudgementByMetavariableName(metavariableName) {
188
163
  const judgements = this.getJudgements(),
189
164
  judgement = judgements.find((judgement) => {
190
- const judgementMetavariableComparesToMetavariable = judgement.matchMetavariableName(metavariableName);
165
+ const judgementMetavariableComparesToMetavariable = judgement.compareMetavariableName(metavariableName);
191
166
 
192
167
  if (judgementMetavariableComparesToMetavariable) {
193
168
  return true;
@@ -197,8 +172,8 @@ class ScopedContext extends Context {
197
172
  return judgement;
198
173
  }
199
174
 
200
- findVariableByVariableIdentifier(variableIdentifier, nested = true) {
201
- const variables = this.getVariables(nested),
175
+ findVariableByVariableIdentifier(variableIdentifier) {
176
+ const variables = this.getVariables(),
202
177
  variable = variables.find((variable) => {
203
178
  const variableComparesToVariableIdentifier = variable.compareVariableIdentifier(variableIdentifier);
204
179
 
@@ -220,7 +195,7 @@ class ScopedContext extends Context {
220
195
 
221
196
  const termMatchesGroundedTerm = groundedTerms.some((groundedTerm) => {
222
197
  const groundedTermNode = groundedTerm.getNode(),
223
- groundedTermNodeMatches = term.matchNode(groundedTermNode);
198
+ groundedTermNodeMatches = term.matchTermNode(groundedTermNode);
224
199
 
225
200
  if (groundedTermNodeMatches) {
226
201
  return true;
@@ -238,8 +213,8 @@ class ScopedContext extends Context {
238
213
  return judgementPresent;
239
214
  }
240
215
 
241
- isVariablePresentByVariableIdentifier(variableIdentifier, nested = true) {
242
- const variable = this.findVariableByVariableIdentifier(variableIdentifier, nested),
216
+ isVariablePresentByVariableIdentifier(variableIdentifier) {
217
+ const variable = this.findVariableByVariableIdentifier(variableIdentifier),
243
218
  variablePresent = (variable !== null);
244
219
 
245
220
  return variablePresent;
package/src/context.js CHANGED
@@ -33,11 +33,18 @@ export default class Context extends ContextBase {
33
33
 
34
34
  getFrames() {
35
35
  const context = this.getContext(),
36
- frames = context.getFrames();
36
+ frames = context.getFrames();
37
37
 
38
38
  return frames;
39
39
  }
40
40
 
41
+ getEqualities() {
42
+ const context = this.getContext(),
43
+ equalities = context.getEqualities();
44
+
45
+ return equalities;
46
+ }
47
+
41
48
  getStatements() {
42
49
  const context = this.getContext(),
43
50
  statements = context.getStatements();
@@ -52,6 +59,13 @@ export default class Context extends ContextBase {
52
59
  return references;
53
60
  }
54
61
 
62
+ getEquivalences() {
63
+ const context = this.getContext(),
64
+ equivalences = context.getEquivalences();
65
+
66
+ return equivalences;
67
+ }
68
+
55
69
  getSubstitutions() {
56
70
  const context = this.getContext(),
57
71
  substitutions = context.getSubstitutions();
@@ -102,20 +116,55 @@ export default class Context extends ContextBase {
102
116
  return metavariable;
103
117
  }
104
118
 
105
- findProcedureByName(name) {
119
+ findRuleByReference(reference) {
106
120
  const context = this.getContext(),
107
- procedure = context.findProcedureByName(name);
121
+ rule = context.findRuleByReference(reference);
108
122
 
109
- return procedure;
123
+ return rule;
124
+ }
125
+
126
+ findTopLevelAssertionByReference(reference) {
127
+ const context = this.getContext(),
128
+ topLevelAssertion = context.findTopLevelAssertionByReference(reference);
129
+
130
+ return topLevelAssertion;
131
+ }
132
+
133
+ findMetaTypeByMetaTypeName(metaTypeName) {
134
+ const context = this.getContext(),
135
+ metaType = context.findMetaTypeByMetaTypeName(metaTypeName);
136
+
137
+ return metaType;
138
+ }
139
+
140
+ findTermByTermNode(termNode) {
141
+ const context = this.getContext(),
142
+ term = context.findTermByTermNode(termNode);
143
+
144
+ return term;
110
145
  }
111
146
 
112
147
  findFrameByFrameNode(frameNode) {
113
148
  const context = this.getContext(),
114
- frame = context.findFrameByFrameNode(frameNode);
149
+ frame = context.findFrameByFrameNode(frameNode);
115
150
 
116
151
  return frame;
117
152
  }
118
153
 
154
+ findEqualityByEqualityNode(equalityNode) {
155
+ const context = this.getContext(),
156
+ equality = context.findEqualityByEqualityNode(equalityNode);
157
+
158
+ return equality;
159
+ }
160
+
161
+ findJudgementByJudgementNode(judgementNode) {
162
+ const context = this.getContext(),
163
+ judgement = context.findJudgementByJudgementNode(judgementNode);
164
+
165
+ return judgement;
166
+ }
167
+
119
168
  findStatementByStatementNode(statementNode) {
120
169
  const context = this.getContext(),
121
170
  statement = context.findStatementByStatementNode(statementNode);
@@ -180,32 +229,40 @@ export default class Context extends ContextBase {
180
229
  return substitution;
181
230
  }
182
231
 
183
- findRuleByReference(reference) {
232
+ findProcedureByProcedureName(procedureName) {
184
233
  const context = this.getContext(),
185
- rule = context.findRuleByReference(reference);
234
+ procedure = context.findProcedureByProcedureName(procedureName);
186
235
 
187
- return rule;
236
+ return procedure;
188
237
  }
189
238
 
190
- findTopLevelAssertionByReference(reference) {
239
+ isMetavariablePresent(metavariable) {
240
+ metavariable = this.findMetavariable(metavariable); ///
241
+
242
+ const metavariablePresent = (metavariable !== null);
243
+
244
+ return metavariablePresent;
245
+ }
246
+
247
+ isLabelPresentByReference(reference) {
191
248
  const context = this.getContext(),
192
- topLevelAssertion = context.findTopLevelAssertionByReference(reference);
249
+ labelPresent = context.isLabelPresentByReference(reference);
193
250
 
194
- return topLevelAssertion;
251
+ return labelPresent;
195
252
  }
196
253
 
197
- isTermPresentByTermNode(termNode) {
254
+ isMetavariablePresentByReference(reference) {
198
255
  const context = this.getContext(),
199
- termPresent = context.isTermPresentByTermNode(termNode);
256
+ metavariablePresent = context.isMetavariablePresentByReference(reference);
200
257
 
201
- return termPresent;
258
+ return metavariablePresent;
202
259
  }
203
260
 
204
- isProcedurePresentByName(name) {
261
+ isTermPresentByTermNode(termNode) {
205
262
  const context = this.getContext(),
206
- procedurePresent = context.isProcedurePresentByName(name);
263
+ termPresent = context.isTermPresentByTermNode(termNode);
207
264
 
208
- return procedurePresent;
265
+ return termPresent;
209
266
  }
210
267
 
211
268
  isFramePresentByFrameNode(frameNode) {
@@ -215,6 +272,20 @@ export default class Context extends ContextBase {
215
272
  return framePresent;
216
273
  }
217
274
 
275
+ isJudgementPresentByJudgementNode(judgementNode) {
276
+ const context = this.getContext(),
277
+ judgementPresent = context.isJudgementPresentByJudgementNode(judgementNode);
278
+
279
+ return judgementPresent;
280
+ }
281
+
282
+ isEqualityPresentByEqualityNode(equalityNode) {
283
+ const context = this.getContext(),
284
+ equalityPresent = context.isEqualityPresentByEqualityNode(equalityNode);
285
+
286
+ return equalityPresent;
287
+ }
288
+
218
289
  isStatementPresentByStatementNode(statementNode) {
219
290
  const context = this.getContext(),
220
291
  statementPresent = context.isStatementPresentByStatementNode(statementNode);
@@ -229,9 +300,9 @@ export default class Context extends ContextBase {
229
300
  return assertionPresent;
230
301
  }
231
302
 
232
- isReferencePresentByReferenceNode(referenceNode) {
303
+ isReferencePresentByMetavariableNode(metvvariableNode) {
233
304
  const context = this.getContext(),
234
- referencePresent = context.isReferencePresentByReferenceNode(referenceNode);
305
+ referencePresent = context.isReferencePresentByMetavariableNode(metvvariableNode);
235
306
 
236
307
  return referencePresent;
237
308
  }
@@ -250,30 +321,17 @@ export default class Context extends ContextBase {
250
321
  return substitutionPresent;
251
322
  }
252
323
 
253
- isLabelPresentByReference(reference) {
324
+ isProcedurePresentByProcedureName(procedureName) {
254
325
  const context = this.getContext(),
255
- labelPresent = context.isLabelPresentByReference(reference);
256
-
257
- return labelPresent;
258
- }
259
-
260
- isMetavariablePresentByReference(reference) {
261
- const context = this.getContext(),
262
- metavariablePresent = context.isMetavariablePresentByReference(reference);
263
-
264
- return metavariablePresent;
265
- }
266
-
267
- addRule(rule) {
268
- const context = this.getContext();
326
+ procedurePresent = context.isProcedurePresentByProcedureName(procedureName);
269
327
 
270
- context.addRule(rule);
328
+ return procedurePresent;
271
329
  }
272
330
 
273
- adTerm(term) {
331
+ addTerm(term) {
274
332
  const context = this.getContext();
275
333
 
276
- context.adTerm(term);
334
+ context.addTerm(term);
277
335
  }
278
336
 
279
337
  addFrame(frame) {
@@ -295,10 +353,9 @@ export default class Context extends ContextBase {
295
353
  }
296
354
 
297
355
  addJudgement(judgement) {
298
- const context = this.getContext(),
299
- judgementAdded = context.addJudgement(judgement);
356
+ const context = this.getContext();
300
357
 
301
- return judgementAdded;
358
+ context.addJudgement(judgement);
302
359
  }
303
360
 
304
361
  addSubstitution(substitution) {
@@ -307,12 +364,6 @@ export default class Context extends ContextBase {
307
364
  context.addSubstitution(substitution);
308
365
  }
309
366
 
310
- removeSubstitution(substitution) {
311
- const context = this.getContext();
312
-
313
- context.removeSubstitution(substitution);
314
- }
315
-
316
367
  addSubproofOrProofAssertion(subproofOrProofAssertion) {
317
368
  const context = this.getContext();
318
369
 
@@ -72,6 +72,10 @@ export default define(class ContainedAssertion extends Assertion {
72
72
  }
73
73
 
74
74
  if (validates) {
75
+ const assertion = this; ///
76
+
77
+ context.addAssertion(assertion);
78
+
75
79
  context.debug(`...validated the '${containedAssertionString}' contained assertion.`);
76
80
  }
77
81
  }
@@ -66,6 +66,10 @@ export default define(class DefinedAssertion extends Assertion {
66
66
  }
67
67
 
68
68
  if (validates) {
69
+ const assertion = this; ///
70
+
71
+ context.addAssertion(assertion);
72
+
69
73
  context.debug(`...validates the '${definedAssertionString}' defined assertion.`);
70
74
  }
71
75
  }