occam-verify-cli 1.0.913 → 1.0.920

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.
@@ -1,12 +1,13 @@
1
1
  "use strict";
2
2
 
3
- import { arrayUtilities } from "necessary";
3
+ import { asynchronousUtilities } from "occam-languages";
4
4
 
5
5
  import TopLevelAssertion from "../topLevelAssertion";
6
6
 
7
7
  import { define } from "../../elements";
8
+ import { join, reconcile } from "../../utilities/context";
8
9
 
9
- const { backwardsEvery } = arrayUtilities;
10
+ const { asyncMatch } = asynchronousUtilities;
10
11
 
11
12
  export default define(class Axiom extends TopLevelAssertion {
12
13
  getAxiomNode() {
@@ -73,173 +74,146 @@ export default define(class Axiom extends TopLevelAssertion {
73
74
  return signatureVerifies;
74
75
  }
75
76
 
76
- unifyStep(step, context) {
77
- let stepUnifies = false;
77
+ unifySignature(signature, context) {
78
+ let signatureUnifies;
78
79
 
79
- context = step.getContext();
80
+ const axiomString = this.getString(), ///
81
+ signatureString = signature.getString();
80
82
 
81
- const stepString = step.getString(),
82
- axiomString = this.getString();
83
+ context.trace(`Unifying the '${signatureString}' signature with the '${axiomString}' axiom...`);
83
84
 
84
- context.trace(`Unifying the '${stepString}' step with the '${axiomString}' axiom...`);
85
+ const specificSignature = signature; ///
85
86
 
86
- const unconditional = this.isUnconditional();
87
+ signature = this.getSignature();
87
88
 
88
- if (!unconditional) {
89
- context.trace(`Unable to unify the '${stepString}' step with the '${axiomString}' axiom because the axiom is not unconditional.`);
90
- } else {
91
- const statement = step.getStatement(),
92
- statementUnifiesWithDeduction = this.unifyStatementWithDeduction(statement, context);
89
+ const generalSignature = signature, ///
90
+ specificContext = context, ///
91
+ generalContext = null;
93
92
 
94
- if (statementUnifiesWithDeduction) {
95
- stepUnifies = true;
96
- }
97
- }
93
+ signatureUnifies = generalSignature.unifySignature(specificSignature, generalContext, specificContext);
98
94
 
99
- if (stepUnifies) {
100
- context.debug(`...unified the '${stepString}' step with the '${axiomString}' axiom.`);
95
+ if (signatureUnifies) {
96
+ context.debug(`...unified the '${signatureString}' signature with the '${axiomString}' axiom.`);
101
97
  }
102
98
 
103
- return stepUnifies;
99
+ return signatureUnifies;
104
100
  }
105
101
 
106
- unifySubproof(subproof, context) {
107
- let subproofUnifies = false;
108
-
109
- const axiomString = this.getString(), ///
110
- subproofString = subproof.getString();
111
-
112
- context.trace(`Unifying the '${subproofString}' subproof with the '${axiomString}' axiom...`);
102
+ async unifyDeduction(deduction, context) {
103
+ let deductionUnifies;
113
104
 
114
- const unconditional = this.isUnconditional();
105
+ await this.break(context);
115
106
 
116
- if (unconditional) {
117
- context.trace(`Unable to unify the '${subproofString}' subproof with the '${axiomString}' axiom because the axiom is unconditional.`);
118
- } else {
119
- const lastStep = subproof.getLastStep(),
120
- lastStepUnifies = this.unifyLastStep(lastStep, context);
107
+ const axiomString = this.getString(), ///
108
+ generalDeduction = this.deduction, ///
109
+ specificDeduction = deduction, ///
110
+ generalDeductionString = generalDeduction.getString(),
111
+ specificDeductionString = specificDeduction.getString();
121
112
 
122
- if (lastStepUnifies) {
123
- const suppositions = subproof.getSuppositions(),
124
- suppositionsUnify = this.unifySuppositions(suppositions, context);
113
+ context.trace(`Unifying the '${specificDeductionString}' deduction with the '${axiomString}' axiom's '${generalDeductionString}' deduction...`);
125
114
 
126
- if (suppositionsUnify) {
127
- subproofUnifies = true;
128
- }
129
- }
130
- }
115
+ const specificDeductionContext = specificDeduction.getContext(),
116
+ generalDeductionContext = generalDeduction.getContext(),
117
+ specificContext = specificDeductionContext, ///
118
+ generalContext = generalDeductionContext; ///
131
119
 
132
- if (subproofUnifies) {
133
- context.debug(`...unified the '${subproofString}' subproof with the '${axiomString}' axiom.`);
134
- }
120
+ join((specificContext) => {
121
+ reconcile((specificContext) => {
122
+ let statement;
135
123
 
136
- return subproofUnifies;
137
- }
124
+ statement = specificDeduction.getStatement();
138
125
 
139
- unifyDeduction(deduction, generalContext, specificContext) {
140
- let deductionUnifies;
126
+ const specificStatement = statement; ///
141
127
 
142
- const specificDeduction = deduction; ///
128
+ statement = generalDeduction.getStatement();
143
129
 
144
- deduction = this.getDeduction();
130
+ const generalStatement = statement, ///
131
+ statementUnifies = generalStatement.unifyStatement(specificStatement, generalContext, specificContext);
145
132
 
146
- const generalDeduction = deduction; ///
133
+ if (statementUnifies) {
134
+ specificContext.commit();
147
135
 
148
- deduction = specificDeduction; ///
136
+ deductionUnifies = true;
137
+ }
138
+ }, specificContext);
139
+ }, specificContext, context);
149
140
 
150
- deductionUnifies = generalDeduction.unifyDeduction(deduction, generalContext, specificContext);
141
+ if (deductionUnifies) {
142
+ context.debug(`...unified the '${specificDeductionString}' deduction with the '${axiomString}' axiom's '${generalDeductionString}' deduction.`);
143
+ }
151
144
 
152
145
  return deductionUnifies;
153
146
  }
154
147
 
155
- unifySupposition(supposition, index, generalContext, specificContext) {
156
- let suppositionUnifies;
148
+ async unifySupposition(supposition, index, context) {
149
+ let suppositionUnifies = false;
157
150
 
158
151
  const specificSupposition = supposition; ///
159
152
 
160
153
  supposition = this.getSupposition(index);
161
154
 
162
- const generalSupposition = supposition; ///
163
-
164
- supposition = specificSupposition; ///
155
+ const axiomString = this.getString(), ///
156
+ generalSupposition = supposition, ///
157
+ generalSuppositionString = generalSupposition.getString(),
158
+ specificSuppositionString = specificSupposition.getString();
165
159
 
166
- suppositionUnifies = generalSupposition.unifySupposition(supposition, generalContext, specificContext);
160
+ context.trace(`Unifying the '${specificSuppositionString}' supposition with the '${axiomString}' axiom's '${generalSuppositionString}' supposition...`);
167
161
 
168
- return suppositionUnifies;
169
- }
162
+ const specificSuppositionContext = specificSupposition.getContext(),
163
+ generalSuppositionContext = generalSupposition.getContext(),
164
+ specificContext = specificSuppositionContext, ///
165
+ generalContext = generalSuppositionContext; ///
170
166
 
171
- unifySuppositions(suppositions, generalContext, specificContext) {
172
- let suppositionsUnify = false;
167
+ join((specificContext) => {
168
+ reconcile((specificContext) => {
169
+ let statement;
173
170
 
174
- const specificSuppositions = suppositions; ///
171
+ statement = specificSupposition.getStatement();
175
172
 
176
- suppositions = this.getSuppositions();
173
+ const specificStatement = statement; ///
177
174
 
178
- const generalSuppositions = suppositions, ///
179
- generalSuppositionsLength = generalSuppositions.length,
180
- specificSuppositionsLength = specificSuppositions.length;
175
+ statement = generalSupposition.getStatement();
181
176
 
182
- if (generalSuppositionsLength === specificSuppositionsLength) {
183
- suppositions = specificSuppositions; ///
177
+ const generalStatement = statement, ///
178
+ statementUnifies = generalStatement.unifyStatement(specificStatement, generalContext, specificContext);
184
179
 
185
- suppositionsUnify = backwardsEvery(suppositions, (supposition, index) => {
186
- const suppositionUnifies = this.unifySupposition(supposition, index, generalContext, specificContext);
180
+ if (statementUnifies) {
181
+ specificContext.commit();
187
182
 
188
- if (suppositionUnifies) {
189
- return true;
183
+ suppositionUnifies = true;
190
184
  }
191
- });
192
- }
193
-
194
- return suppositionsUnify;
195
- }
196
-
197
- unifyLastStep(lastStep, context) {
198
- let lastStepUnifies = false;
199
-
200
- const axiomString = this.getString(), ///
201
- lastStepString = lastStep.getString();
202
-
203
- context.trace(`Unifying the '${lastStepString}' last step with the '${axiomString}' axiom...`);
204
-
205
- const statement = lastStep.getStatement(),
206
- statementUnifiesWithDeduction = this.unifyStatementWithDeduction(statement, context);
185
+ }, specificContext);
186
+ }, specificContext, context);
207
187
 
208
- if (statementUnifiesWithDeduction) {
209
- lastStepUnifies = true;
188
+ if (suppositionUnifies) {
189
+ context.debug(`...unified the '${specificSuppositionString}' supposition with the '${axiomString}' axiom's '${generalSuppositionString}' supposition...`);
210
190
  }
211
191
 
212
- if (lastStepUnifies) {
213
- context.debug(`...unified the '${lastStepString}' last step with the '${axiomString}' axiom.`);
214
- }
215
-
216
- return lastStepUnifies;
192
+ return suppositionUnifies;
217
193
  }
218
194
 
219
- unifySignature(signature, context) {
220
- let signatureUnifies;
221
-
222
- const axiomString = this.getString(), ///
223
- signatureString = signature.getString();
224
-
225
- context.trace(`Unifying the '${signatureString}' signature with the '${axiomString}' axiom...`);
195
+ async unifySuppositions(suppositions, context) {
196
+ let suppositionsUnify;
226
197
 
227
- const specificSignature = signature; ///
198
+ const specificSuppositions = suppositions; ///
228
199
 
229
- signature = this.getSignature();
200
+ suppositions = this.getSuppositions();
230
201
 
231
- const generalSignature = signature; ///
202
+ const generalSuppositions = suppositions; ///
232
203
 
233
- signatureUnifies = generalSignature.unifySignature(specificSignature, context);
204
+ suppositionsUnify = await asyncMatch(generalSuppositions, specificSuppositions, async (generalSupposition, specificSupposition, index) => {
205
+ const supposition = specificSupposition, ///
206
+ suppositionUnifies = await this.unifySupposition(supposition, index, context);
234
207
 
235
- if (signatureUnifies) {
236
- context.debug(`...unified the '${signatureString}' signature with the '${axiomString}' axiom.`);
237
- }
208
+ if (suppositionUnifies) {
209
+ return true;
210
+ }
211
+ });
238
212
 
239
- return signatureUnifies;
213
+ return suppositionsUnify;
240
214
  }
241
215
 
242
- unifyTopLevelAssertion(topLevelAssertion, context) {
216
+ async unifyTopLevelAssertion(topLevelAssertion, context) {
243
217
  let topLevelAssertionUnifies = false;
244
218
 
245
219
  const axiomString = this.getString(), ///
@@ -247,25 +221,15 @@ export default define(class Axiom extends TopLevelAssertion {
247
221
 
248
222
  context.trace(`Unifying the '${topLevelAssertionString}' top level assertion with the '${axiomString}' axiom...`);
249
223
 
250
- const hypothesesCorrelate = topLevelAssertion.correlateHypotheses(context);
251
-
252
- if (hypothesesCorrelate) {
253
- const specificContext = context; ///
254
-
255
- context = this.getContext();
256
-
257
- const generalContext = context; ///
258
-
259
- context = specificContext; ///
260
-
261
- const deduction = topLevelAssertion.getDeduction(),
262
- deductionUnifies = this.unifyDeduction(deduction, generalContext, specificContext);
224
+ const deduction = topLevelAssertion.getDeduction(),
225
+ deductionUnifies = await this.unifyDeduction(deduction, context);
263
226
 
264
- if (deductionUnifies) {
265
- const suppositions = topLevelAssertion.getSuppositions(),
266
- suppositionsUnify = this.unifySuppositions(suppositions, generalContext, specificContext);
227
+ if (deductionUnifies) {
228
+ const suppositions = topLevelAssertion.getSuppositions(),
229
+ suppositionsUnify = await this.unifySuppositions(suppositions, context);
267
230
 
268
- topLevelAssertionUnifies = suppositionsUnify; ///
231
+ if (suppositionsUnify) {
232
+ topLevelAssertionUnifies = true;
269
233
  }
270
234
  }
271
235
 
@@ -16,7 +16,7 @@ import { labelsFromJSON,
16
16
  hypothesesToHypothesesJSON,
17
17
  suppositionsToSuppositionsJSON } from "../utilities/json";
18
18
 
19
- const { reverse, correlate } = arrayUtilities,
19
+ const { reverse } = arrayUtilities,
20
20
  { asyncExtract, asyncForwardsEvery, asyncBackwardsEvery } = asynchronousUtilities;
21
21
 
22
22
  export default class TopLevelAssertion extends Element {
@@ -91,35 +91,6 @@ export default class TopLevelAssertion extends Element {
91
91
  return metavariableNodeMatches;
92
92
  }
93
93
 
94
- correlateHypotheses(context) {
95
- let correlatesToHypotheses;
96
-
97
- const hypothetical = this.isHypothetical();
98
-
99
- if (hypothetical) {
100
- const proofAssertions = context.getProofAssertions(),
101
- topLevelAssertionString = this.getString(); ///
102
-
103
- context.trace(`Correlating the hypotheses of the '${topLevelAssertionString}' top level assertion...`);
104
-
105
- correlatesToHypotheses = correlate(this.hypotheses, proofAssertions, (hypothesis, proofAssertion) => {
106
- const hypothesesComparesToStep = hypothesis.compareProofAssertion(proofAssertion, context);
107
-
108
- if (hypothesesComparesToStep) {
109
- return true;
110
- }
111
- });
112
-
113
- if (correlatesToHypotheses) {
114
- context.debug(`...correlated the hypotheses of the '${topLevelAssertionString}' top level assertion.`);
115
- }
116
- } else {
117
- correlatesToHypotheses = true
118
- }
119
-
120
- return correlatesToHypotheses;
121
- }
122
-
123
94
  async verify(context) {
124
95
  let verifies = false;
125
96
 
@@ -285,19 +256,18 @@ export default class TopLevelAssertion extends Element {
285
256
  await this.break(context);
286
257
 
287
258
  const stepString = step.getString(),
288
- deductionString = this.deduction.getString(),
289
259
  topLevelAssertionString = this.getString(); ///
290
260
 
291
- context.trace(`Unifying the '${stepString}' step with the '${topLevelAssertionString}' top level assertion's '${deductionString}' deduction...`);
261
+ context.trace(`Unifying the '${stepString}' step with the '${topLevelAssertionString}' top level assertion's deduction...`);
292
262
 
293
- const stepUnifies = await this.deduction.unifyStep(step, context);
263
+ const stepUnifies = this.deduction.unifyStep(step, context);
294
264
 
295
265
  if (stepUnifies) {
296
266
  stepUnifiesWithDeduction = true;
297
267
  }
298
268
 
299
269
  if (stepUnifiesWithDeduction) {
300
- context.debug(`...unified the '${stepString}' step with the '${topLevelAssertionString}' top level assertion's '${deductionString}' deduction.`);
270
+ context.debug(`...unified the '${stepString}' step with the '${topLevelAssertionString}' top level assertion's deduction.`);
301
271
  }
302
272
 
303
273
  return stepUnifiesWithDeduction;
@@ -306,20 +276,16 @@ export default class TopLevelAssertion extends Element {
306
276
  async unifyStepAndSubproofOrProofAssertions(step, subproofOrProofAssertions, context) {
307
277
  let stepAndSubproofOrProofAssertionsUnify = false;
308
278
 
309
- const correlatesToHypotheses = this.correlateHypotheses(context);
310
-
311
- if (correlatesToHypotheses) {
312
- const stepUnifiesWithDeduction = await this.unifyStepWithDeduction(step, context);
279
+ const stepUnifiesWithDeduction = await this.unifyStepWithDeduction(step, context);
313
280
 
314
- if (stepUnifiesWithDeduction) {
315
- const subproofOrProofAssertionsUnifiesWithSuppositions = await this.unifySubproofOrProofAssertionsWithSuppositions(subproofOrProofAssertions, context);
281
+ if (stepUnifiesWithDeduction) {
282
+ const subproofOrProofAssertionsUnifiesWithSuppositions = await this.unifySubproofOrProofAssertionsWithSuppositions(subproofOrProofAssertions, context);
316
283
 
317
- if (subproofOrProofAssertionsUnifiesWithSuppositions) {
318
- const derivedSubstitutionsResolved = context.areDerivedSubstitutionsResolved();
284
+ if (subproofOrProofAssertionsUnifiesWithSuppositions) {
285
+ const derivedSubstitutionsResolved = context.areDerivedSubstitutionsResolved();
319
286
 
320
- if (derivedSubstitutionsResolved) {
321
- stepAndSubproofOrProofAssertionsUnify = true;
322
- }
287
+ if (derivedSubstitutionsResolved) {
288
+ stepAndSubproofOrProofAssertionsUnify = true;
323
289
  }
324
290
  }
325
291
  }
@@ -29,16 +29,16 @@ export default class StepNode extends ProofAssertionNode {
29
29
  return referenceNode;
30
30
  }
31
31
 
32
- getSatisfiedAssertionNode() {
33
- let satisfiedAssertionNode = null;
32
+ getSignatureAssertionNode() {
33
+ let signatureAssertionNode = null;
34
34
 
35
35
  const qualificationNode = this.getQualificationNode();
36
36
 
37
37
  if (qualificationNode !== null) {
38
- satisfiedAssertionNode = qualificationNode.getSatisfiedAssertionNode();
38
+ signatureAssertionNode = qualificationNode.getSignatureAssertionNode();
39
39
  }
40
40
 
41
- return satisfiedAssertionNode;
41
+ return signatureAssertionNode;
42
42
  }
43
43
 
44
44
  getQualificationNode() {
@@ -12,11 +12,11 @@ export default class QualificationNode extends NonTerminalNode {
12
12
  return referenceNode;
13
13
  }
14
14
 
15
- getSatisfiedAssertionNode() {
15
+ getSignatureAssertionNode() {
16
16
  const ruleName = SIGNATURE_ASSERTION_RULE_NAME,
17
- satisfiedAssertionNode = this.getNodeByRuleName(ruleName);
17
+ signatureAssertionNode = this.getNodeByRuleName(ruleName);
18
18
 
19
- return satisfiedAssertionNode;
19
+ return signatureAssertionNode;
20
20
  }
21
21
 
22
22
  static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return NonTerminalNode.fromRuleNameChildNodesOpacityAndPrecedence(QualificationNode, ruleName, childNodes, opacity, precedence); }
@@ -135,11 +135,11 @@ export default class StatementNode extends NonTerminalNode {
135
135
  return containedAssertionNode;
136
136
  }
137
137
 
138
- getSatisfiedAssertionNode() {
138
+ getSignatureAssertionNode() {
139
139
  const ruleName = SIGNATURE_ASSERTION_RULE_NAME,
140
- satisfiedAssertionNode = this.getNodeByRuleName(ruleName);
140
+ signatureAssertionNode = this.getNodeByRuleName(ruleName);
141
141
 
142
- return satisfiedAssertionNode;
142
+ return signatureAssertionNode;
143
143
  }
144
144
 
145
145
  getSingularMetavariableNode() {
@@ -13,13 +13,14 @@ const typeNodeQuery = nodeQuery("/type"),
13
13
  termNodeQuery = nodeQuery("/term"),
14
14
  frameNodeQuery = nodeQuery("/frame"),
15
15
  metaTypeNodeQuery = nodeQuery("/metaType"),
16
+ signatureNodeQuery = nodeQuery("/signature"),
16
17
  statementNodeQuery = nodeQuery("/statement"),
17
18
  termVariableNodeQuery = nodeQuery("/term/variable!"),
18
19
  frameMetavariableNodeQuery = nodeQuery("/frame/metavariable!"),
19
20
  statementMetavariableNodeQuery = nodeQuery("/statement/metavariable!"),
20
21
  assumptionMetavariableNodeQuery = nodeQuery("/assumption/metavariable!");
21
22
 
22
- class StatementPass extends ZipPassBase {
23
+ class MetaLevelPass extends ZipPassBase {
23
24
  static maps = [
24
25
  {
25
26
  generalNodeQuery: assumptionMetavariableNodeQuery,
@@ -141,6 +142,30 @@ class StatementPass extends ZipPassBase {
141
142
  success = true;
142
143
  }
143
144
 
145
+ return success;
146
+ }
147
+ },
148
+ {
149
+ generalNodeQuery: signatureNodeQuery,
150
+ specificNodeQuery: signatureNodeQuery,
151
+ run: (generalSignatureNode, specificSignatureNode, generalContext, specificContext) => {
152
+ let success = false;
153
+
154
+ let context;
155
+
156
+ context = generalContext; ///
157
+
158
+ const generalSignature = context.findSignatureBySignatureNode(generalSignatureNode);
159
+
160
+ context = specificContext; ///
161
+
162
+ const specificSignature = context.findSignatureBySignatureNode(specificSignatureNode),
163
+ signatureUnifies = generalSignature.unifySignature(specificSignature, generalContext, specificContext);
164
+
165
+ if (signatureUnifies) {
166
+ success = true;
167
+ }
168
+
144
169
  return success;
145
170
  }
146
171
  }
@@ -434,7 +459,7 @@ class IntrinsicMetavariablePass extends ZipPass {
434
459
  ];
435
460
  }
436
461
 
437
- const statementPass = new StatementPass(),
462
+ const metaLevelPass = new MetaLevelPass(),
438
463
  combinatorPass = new CombinatorPass(),
439
464
  constructorPass = new ConstructorPass(),
440
465
  metavariablePass = new MetavariablePass(),
@@ -449,7 +474,7 @@ export function unifyStatement(generalStatement, specificStatement, generalConte
449
474
  specificStatementNode = specificStatement.getNode(),
450
475
  generalNode = generalStatementNode, ///
451
476
  specificNode = specificStatementNode, ///
452
- success = statementPass.run(generalNode, specificNode, generalContext, specificContext);
477
+ success = metaLevelPass.run(generalNode, specificNode, generalContext, specificContext);
453
478
 
454
479
  if (success) {
455
480
  statementUnifies = true;
@@ -16,6 +16,12 @@ import NominalFileContext from "../context/file/nominal";
16
16
  import { mnemicContextFromJSON, mnemicContextsFromJSON, mnemicContextToMnemicContextJSON, mnemicContextsToMnemicContextsJSON } from "../utilities/json";
17
17
 
18
18
  export function join(innerFunction, ...contexts) {
19
+ contexts = contexts.filter((context) => {
20
+ if (context !== null) {
21
+ return true;
22
+ }
23
+ });
24
+
19
25
  const synopticContext = SynopticContext.fromContexts(contexts),
20
26
  context = synopticContext; ///
21
27
 
@@ -1556,7 +1556,7 @@ export function termFromPropertyAssertionNode(propertyAssertionNode, context) {
1556
1556
  export function signatureAssertionFromStepNode(stepNode, context) {
1557
1557
  let signatureAssertion = null;
1558
1558
 
1559
- const signatureAssertionNode = stepNode.getSatisfiedAssertionNode();
1559
+ const signatureAssertionNode = stepNode.getSignatureAssertionNode();
1560
1560
 
1561
1561
  if (signatureAssertionNode !== null) {
1562
1562
  signatureAssertion = signatureAssertionFromSignatureAssertionNode(signatureAssertionNode, context);
@@ -1841,7 +1841,7 @@ export function containedAssertionFromStatementNode(statementNode, context) {0
1841
1841
  export function signatureAssertionFromStatementNode(statementNode, context) {
1842
1842
  let signatureAssertion = null;
1843
1843
 
1844
- const signatureAssertionNode = statementNode.getSatisfiedAssertionNode();
1844
+ const signatureAssertionNode = statementNode.getSignatureAssertionNode();
1845
1845
 
1846
1846
  if (signatureAssertionNode !== null) {
1847
1847
  signatureAssertion = signatureAssertionFromSignatureAssertionNode(signatureAssertionNode, context);
@@ -20,18 +20,6 @@ export function mergeEquivalences(equivalencesA, equivalencesB, context) {
20
20
  return equivalencesA;
21
21
  }
22
22
 
23
- export function findEquivalenceByTerm(equivalences, term) {
24
- const equivalence = equivalences.find((equivalence) => {
25
- const equivalenceEqualToTerm = equivalence.isEqualTo(term);
26
-
27
- if (equivalenceEqualToTerm) {
28
- return true;
29
- }
30
- }) || null;
31
-
32
- return equivalence;
33
- }
34
-
35
23
  export function equivalencesFromEquality(equality, context) {
36
24
  const { Equivalence } = elements,
37
25
  eaulivalence = Equivalence.fromEquality(equality, context),