occam-verify-cli 1.0.457 → 1.0.473

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 (161) hide show
  1. package/lib/constants.js +13 -1
  2. package/lib/context/ephemeral.js +270 -0
  3. package/lib/context/file.js +102 -66
  4. package/lib/context/liminal.js +120 -0
  5. package/lib/context/literal.js +92 -0
  6. package/lib/context/nominal.js +15 -1
  7. package/lib/context/release.js +66 -7
  8. package/lib/context/scoped.js +48 -40
  9. package/lib/context/synthetic.js +133 -0
  10. package/lib/element/assertion/contained.js +66 -66
  11. package/lib/element/assertion/defined.js +32 -32
  12. package/lib/element/assertion/property.js +39 -39
  13. package/lib/element/assertion/satisfies.js +22 -22
  14. package/lib/element/assumption.js +5 -8
  15. package/lib/element/conclusion.js +14 -13
  16. package/lib/element/constructor.js +2 -2
  17. package/lib/element/deduction.js +14 -13
  18. package/lib/element/derivation.js +3 -3
  19. package/lib/element/equality.js +5 -5
  20. package/lib/element/equivalence.js +112 -107
  21. package/lib/element/equivalences.js +24 -10
  22. package/lib/element/error.js +3 -3
  23. package/lib/element/frame.js +38 -21
  24. package/lib/element/hypothesis.js +2 -2
  25. package/lib/element/judgement.js +6 -5
  26. package/lib/element/metaType.js +1 -2
  27. package/lib/element/metavariable.js +46 -35
  28. package/lib/element/parameter.js +13 -5
  29. package/lib/element/procedureCall.js +16 -16
  30. package/lib/element/proof.js +14 -13
  31. package/lib/element/proofAssertion/premise.js +41 -30
  32. package/lib/element/proofAssertion/step.js +39 -35
  33. package/lib/element/proofAssertion/supposition.js +43 -32
  34. package/lib/element/proofAssertion.js +19 -5
  35. package/lib/element/propertyRelation.js +2 -2
  36. package/lib/element/reference.js +50 -9
  37. package/lib/element/rule.js +26 -28
  38. package/lib/element/section.js +2 -2
  39. package/lib/element/signature.js +9 -6
  40. package/lib/element/statement.js +44 -31
  41. package/lib/element/subproof.js +18 -17
  42. package/lib/element/substitution/frame.js +83 -46
  43. package/lib/element/substitution/reference.js +101 -19
  44. package/lib/element/substitution/statement.js +122 -75
  45. package/lib/element/substitution/term.js +93 -57
  46. package/lib/element/substitution.js +20 -69
  47. package/lib/element/substitutions.js +49 -34
  48. package/lib/element/term.js +30 -21
  49. package/lib/element/topLevelAssertion/axiom.js +8 -6
  50. package/lib/element/topLevelAssertion/conjecture.js +4 -4
  51. package/lib/element/topLevelAssertion/lemma.js +4 -4
  52. package/lib/element/topLevelAssertion/theorem.js +2 -2
  53. package/lib/element/topLevelAssertion.js +30 -23
  54. package/lib/element/topLevelMetaAssertion/metaLemma.js +2 -2
  55. package/lib/element/topLevelMetaAssertion/metatheorem.js +2 -2
  56. package/lib/element/topLevelMetaAssertion.js +16 -12
  57. package/lib/element/variable.js +30 -22
  58. package/lib/index.js +3 -3
  59. package/lib/main.js +3 -3
  60. package/lib/node/frame.js +2 -2
  61. package/lib/node/metavariable.js +4 -4
  62. package/lib/node/parameter.js +28 -7
  63. package/lib/node/substitution/frame.js +9 -31
  64. package/lib/node/substitution/reference.js +137 -0
  65. package/lib/node/substitution/statement.js +9 -31
  66. package/lib/node/substitution/term.js +9 -23
  67. package/lib/nonTerminalNodeMap.js +3 -2
  68. package/lib/process/instantiate.js +2 -14
  69. package/lib/process/unify.js +5 -5
  70. package/lib/tokenTypes.js +22 -0
  71. package/lib/utilities/context.js +54 -19
  72. package/lib/utilities/element.js +161 -336
  73. package/lib/utilities/instance.js +4 -4
  74. package/lib/utilities/string.js +18 -4
  75. package/lib/utilities/unification.js +24 -18
  76. package/lib/utilities/validation.js +31 -31
  77. package/package.json +2 -2
  78. package/src/constants.js +12 -0
  79. package/src/context/{transient.js → ephemeral.js} +15 -112
  80. package/src/context/file.js +66 -67
  81. package/src/context/liminal.js +67 -0
  82. package/src/context/{fragment.js → literal.js} +17 -4
  83. package/src/context/nominal.js +12 -0
  84. package/src/context/release.js +44 -6
  85. package/src/context/scoped.js +41 -31
  86. package/src/context/synthetic.js +60 -0
  87. package/src/element/assertion/contained.js +49 -47
  88. package/src/element/assertion/defined.js +29 -27
  89. package/src/element/assertion/property.js +35 -35
  90. package/src/element/assertion/satisfies.js +19 -18
  91. package/src/element/assumption.js +4 -10
  92. package/src/element/conclusion.js +16 -19
  93. package/src/element/constructor.js +1 -1
  94. package/src/element/deduction.js +16 -21
  95. package/src/element/derivation.js +2 -2
  96. package/src/element/equality.js +4 -4
  97. package/src/element/equivalence.js +115 -135
  98. package/src/element/equivalences.js +9 -7
  99. package/src/element/error.js +4 -2
  100. package/src/element/frame.js +50 -23
  101. package/src/element/hypothesis.js +1 -1
  102. package/src/element/judgement.js +9 -4
  103. package/src/element/metaType.js +0 -1
  104. package/src/element/metavariable.js +54 -53
  105. package/src/element/parameter.js +10 -5
  106. package/src/element/procedureCall.js +20 -18
  107. package/src/element/proof.js +14 -16
  108. package/src/element/proofAssertion/premise.js +46 -42
  109. package/src/element/proofAssertion/step.js +45 -40
  110. package/src/element/proofAssertion/supposition.js +56 -45
  111. package/src/element/proofAssertion.js +23 -5
  112. package/src/element/propertyRelation.js +1 -1
  113. package/src/element/reference.js +64 -16
  114. package/src/element/rule.js +31 -37
  115. package/src/element/section.js +1 -1
  116. package/src/element/signature.js +8 -8
  117. package/src/element/statement.js +51 -40
  118. package/src/element/subproof.js +16 -18
  119. package/src/element/substitution/frame.js +99 -42
  120. package/src/element/substitution/reference.js +120 -20
  121. package/src/element/substitution/statement.js +160 -89
  122. package/src/element/substitution/term.js +104 -63
  123. package/src/element/substitution.js +16 -58
  124. package/src/element/substitutions.js +43 -41
  125. package/src/element/term.js +37 -32
  126. package/src/element/topLevelAssertion/axiom.js +8 -6
  127. package/src/element/topLevelAssertion/conjecture.js +1 -2
  128. package/src/element/topLevelAssertion/lemma.js +2 -3
  129. package/src/element/topLevelAssertion/theorem.js +1 -1
  130. package/src/element/topLevelAssertion.js +31 -27
  131. package/src/element/topLevelMetaAssertion/metaLemma.js +1 -2
  132. package/src/element/topLevelMetaAssertion/metatheorem.js +1 -2
  133. package/src/element/topLevelMetaAssertion.js +15 -13
  134. package/src/element/variable.js +30 -31
  135. package/src/index.js +2 -1
  136. package/src/main.js +2 -1
  137. package/src/node/frame.js +1 -1
  138. package/src/node/metavariable.js +3 -3
  139. package/src/node/parameter.js +32 -5
  140. package/src/node/substitution/frame.js +6 -32
  141. package/src/node/substitution/reference.js +38 -0
  142. package/src/node/substitution/statement.js +6 -32
  143. package/src/node/substitution/term.js +6 -22
  144. package/src/nonTerminalNodeMap.js +3 -0
  145. package/src/process/instantiate.js +0 -8
  146. package/src/process/unify.js +4 -4
  147. package/src/tokenTypes.js +4 -0
  148. package/src/utilities/context.js +43 -17
  149. package/src/utilities/element.js +187 -401
  150. package/src/utilities/instance.js +3 -3
  151. package/src/utilities/string.js +21 -5
  152. package/src/utilities/unification.js +26 -23
  153. package/src/utilities/validation.js +47 -47
  154. package/lib/context/fragment.js +0 -77
  155. package/lib/context/transient.js +0 -371
  156. package/lib/log.js +0 -150
  157. package/lib/utilities/fragment.js +0 -23
  158. package/lib/utilities/node.js +0 -71
  159. package/src/log.js +0 -118
  160. package/src/utilities/fragment.js +0 -11
  161. package/src/utilities/node.js +0 -85
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
 
3
3
  import Element from "../element";
4
- import TransientContext from "../context/transient";
5
4
 
6
5
  import { define } from "../elements";
6
+ import { attempt } from "../utilities/context";
7
7
  import { termsFromJSON, framesFromJSON, statementFromJSON, termsToTermsJSON, framesToFramesJSON, statementToStatementJSON } from "../utilities/json";
8
8
 
9
9
  export default define(class Conclusion extends Element {
@@ -20,30 +20,28 @@ export default define(class Conclusion extends Element {
20
20
  verify(context) {
21
21
  let verifies = false;
22
22
 
23
- const transientContext = TransientContext.fromNothing(context);
24
-
25
- context = transientContext; ///
26
-
27
23
  const node = this.getNode(),
28
24
  conclusionString = this.getString(); ///
29
25
 
30
26
  context.trace(`Verifying the '${conclusionString}' conclusion...`, node);
31
27
 
32
- if (this.statement === null) {
33
- context.debug(`Unable to verify the '${conclusionString}' conclusion because it is nonsense.`, node);
34
- } else {
35
- const stated = true,
36
- assignments = null,
37
- statementValidates = this.statement.validate(assignments, stated, context);
28
+ if (this.statement !== null) {
29
+ attempt((context) => {
30
+ const stated = true,
31
+ assignments = null,
32
+ statementValidates = this.statement.validate(assignments, stated, context);
38
33
 
39
- if (statementValidates) {
40
- verifies = true;
41
- }
34
+ if (statementValidates) {
35
+ this.setContext(context);
36
+
37
+ verifies = true;
38
+ }
39
+ }, context);
40
+ } else {
41
+ context.debug(`Unable to verify the '${conclusionString}' conclusion because it is nonsense.`, node);
42
42
  }
43
43
 
44
44
  if (verifies) {
45
- this.setContext(context);
46
-
47
45
  context.debug(`...verified the '${conclusionString}' conclusion.`, node);
48
46
  }
49
47
 
@@ -108,10 +106,9 @@ export default define(class Conclusion extends Element {
108
106
  frames = framesFromJSON(json, context),
109
107
  statement = statementFromJSON(json, context),
110
108
  node = null,
111
- string = statement.getString(),
112
- transientContext = TransientContext.fromTermsAndFrames(terms, frames, context);
109
+ string = statement.getString();
113
110
 
114
- context = transientContext; ///
111
+ context = ephemeralContext; ///
115
112
 
116
113
  const conclusion = new Conclusion(context, string, node, statement);
117
114
 
@@ -27,7 +27,7 @@ export default define(class Constructor extends Element {
27
27
  let termUnifies = false;
28
28
 
29
29
  const termString = term.getString(),
30
- constructorString = this.getString();
30
+ constructorString = this.getString(); ///
31
31
 
32
32
  context.trace(`Unifying the '${termString}' term with the '${constructorString}' constructor...`);
33
33
 
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
 
3
3
  import Element from "../element";
4
- import TransientContext from "../context/transient";
4
+ import EphemeralContext from "../context/ephemeral";
5
5
 
6
6
  import { define } from "../elements";
7
+ import { attempt } from "../utilities/context";
7
8
  import { termsFromJSON, framesFromJSON, statementFromJSON, termsToTermsJSON, framesToFramesJSON, statementToStatementJSON } from "../utilities/json";
8
9
 
9
10
  export default define(class Deduction extends Element {
@@ -20,30 +21,28 @@ export default define(class Deduction extends Element {
20
21
  verify(context) {
21
22
  let verifies = false;
22
23
 
23
- const transientContext = TransientContext.fromNothing(context);
24
-
25
- context = transientContext; ///
26
-
27
24
  const node = this.getNode(),
28
25
  deductionString = this.getString(); ///
29
26
 
30
27
  context.trace(`Verifying the '${deductionString}' deduction...`, node);
31
28
 
32
- if (this.statement === null) {
33
- context.debug(`Unable to verify the '${deductionString}' deduction because it is nonsense.`, node);
34
- } else {
35
- const stated = true,
36
- assignments = null,
37
- statementVealidates = this.statement.validate(assignments, stated, context);
29
+ if (this.statement !== null) {
30
+ attempt((context) => {
31
+ const stated = true,
32
+ assignments = null,
33
+ statementValidates = this.statement.validate(assignments, stated, context);
34
+
35
+ if (statementValidates) {
36
+ this.setContext(context);
38
37
 
39
- if (statementVealidates) {
40
- verifies = true;
41
- }
38
+ verifies = true;
39
+ }
40
+ }, context);
41
+ } else {
42
+ context.debug(`Unable to verify the '${deductionString}' deduction because it is nonsense.`, node);
42
43
  }
43
44
 
44
45
  if (verifies) {
45
- this.setContext(context);
46
-
47
46
  context.debug(`...verified the '${deductionString}' deduction.`, node);
48
47
  }
49
48
 
@@ -132,11 +131,7 @@ export default define(class Deduction extends Element {
132
131
  const terms = termsFromJSON(json, context),
133
132
  frames = framesFromJSON(json, context),
134
133
  statement = statementFromJSON(json, context),
135
- node = null,
136
- string = statement.getString(),
137
- transientContext = TransientContext.fromTermsAndFrames(terms, frames, context);
138
-
139
- context = transientContext; ///
134
+ string = statement.getString();
140
135
 
141
136
  const deduction = new Deduction(context, string, statement);
142
137
 
@@ -27,12 +27,12 @@ export default define(class Derivation extends Element {
27
27
  return lastProofAssertion;
28
28
  }
29
29
 
30
- verify(substitutions, context) {
30
+ verify(context) {
31
31
  let verifies;
32
32
 
33
33
  verifies = this.subproofOrProofAssertions.every((subproofOrProofAssertion) => { ///
34
34
  const assignments = [],
35
- subproofOrProofAssertionVerifies = subproofOrProofAssertion.verify(substitutions, assignments, context);
35
+ subproofOrProofAssertionVerifies = subproofOrProofAssertion.verify(assignments, context);
36
36
 
37
37
  if (subproofOrProofAssertionVerifies) {
38
38
  const assignmentsAssigned = assignAssignments(assignments, context);
@@ -76,7 +76,7 @@ export default define(class Equality extends Element {
76
76
  verify(assignments, stated, context) {
77
77
  let verifies = false;
78
78
 
79
- const equalityString = this.string; ///
79
+ const equalityString = this.getString(); ///
80
80
 
81
81
  context.trace(`Verifying the '${equalityString}' equality...`);
82
82
 
@@ -113,7 +113,7 @@ export default define(class Equality extends Element {
113
113
  verifyTerms(context) {
114
114
  let termsVerify;
115
115
 
116
- const equalityString = this.string; ///
116
+ const equalityString = this.getString(); ///
117
117
 
118
118
  context.trace(`Verifying the '${equalityString}' equality's terms...`);
119
119
 
@@ -149,7 +149,7 @@ export default define(class Equality extends Element {
149
149
  verifyWhenStated(assignments, context) {
150
150
  let verifiesWhenStated;
151
151
 
152
- const equalityString = this.string; ///
152
+ const equalityString = this.getString(); ///
153
153
 
154
154
  context.trace(`Verifying the '${equalityString}' stated equality...`);
155
155
 
@@ -165,7 +165,7 @@ export default define(class Equality extends Element {
165
165
  verifyWhenDerived(context) {
166
166
  let verifiesWhenDerived;
167
167
 
168
- const equalityString = this.string; ///
168
+ const equalityString = this.getString(); ///
169
169
 
170
170
  context.trace(`Verifying the '${equalityString}' derived equality...`);
171
171
 
@@ -5,10 +5,11 @@ import { arrayUtilities } from "necessary";
5
5
  import Element from "../element";
6
6
 
7
7
  import { define } from "../elements";
8
+ import { literally } from "../utilities/context";
8
9
  import { termsStringFromTerms } from "../utilities/string";
9
10
  import { instantiateEquivalence } from "../process/instantiate";
10
11
  import { stripBracketsFromTermNode } from "../utilities/brackets";
11
- import { equalivanceFromEquivalenceNode } from "../utilities/element";
12
+ import { equivalenceFromEquivalenceNode } from "../utilities/element";
12
13
 
13
14
  const { compress } = arrayUtilities;
14
15
 
@@ -22,40 +23,6 @@ export default define(class Equivalence extends Element {
22
23
  return this.terms;
23
24
  }
24
25
 
25
- addTerm(term, context) {
26
- const termString = term.getString(),
27
- equivalenceString = this.asString(); ///
28
-
29
- context.trace(`Adding the '${termString}' term to the '${equivalenceString}' equivalence...`);
30
-
31
- const termA = term, ///
32
- termPresent = this.someTerm((term) => {
33
- const termB = term, ///
34
- termAEqualToTermB = termA.isEqualTo(termB);
35
-
36
- if (termAEqualToTermB) {
37
- return true;
38
- }
39
- });
40
-
41
- if (!termPresent) {
42
- this.terms.push(term);
43
-
44
- const termsString = termsStringFromTerms(this.terms),
45
- string = termsString, ///
46
- equalivanceNode = instantiateEquivalence(string, context),
47
- equalivance = equalivanceFromEquivalenceNode(equalivanceNode, context);
48
-
49
- this.node = equalivance.getNode();
50
-
51
- this.string = equalivance.getString();
52
-
53
- const equivalenceString = this.string; ///
54
-
55
- context.debug(`...added the '${termString}' term to the '${equivalenceString}' equivalence.`);
56
- }
57
- }
58
-
59
26
  getType() {
60
27
  const type = this.terms.reduce((type, term) => {
61
28
  const termType = term.getType();
@@ -76,6 +43,89 @@ export default define(class Equivalence extends Element {
76
43
  return type;
77
44
  }
78
45
 
46
+ getGroundedTerms(definedVariables, groundedTerms, context) {
47
+ this.terms.forEach((term) => {
48
+ const termGrounded = term.isGrounded(definedVariables, context);
49
+
50
+ if (termGrounded) {
51
+ const termMatchesGroundedTerm = groundedTerms.some((groundedTerm) => {
52
+ const groundedTermNode = groundedTerm.getNode(),
53
+ groundedTermNodeMatches = term.matchNode(groundedTermNode);
54
+
55
+ if (groundedTermNodeMatches) {
56
+ return true;
57
+ }
58
+ })
59
+
60
+ if (!termMatchesGroundedTerm) {
61
+ const groundedTerm = term;
62
+
63
+ groundedTerms.push(groundedTerm);
64
+ }
65
+ }
66
+ });
67
+ }
68
+
69
+ getInitiallyGroundedTerms(context) {
70
+ const initiallyGroundedTerms = this.terms.reduce((initiallyGroundedTerms, term) => {
71
+ const termInitiallyGrounded = term.isInitiallyGrounded(context);
72
+
73
+ if (termInitiallyGrounded) {
74
+ const initiallyGroundedTerm = term; ///
75
+
76
+ initiallyGroundedTerms.push(initiallyGroundedTerm);
77
+ }
78
+
79
+ return initiallyGroundedTerms;
80
+ }, []);
81
+
82
+ return initiallyGroundedTerms;
83
+ }
84
+
85
+ getImplicitlyGroundedTerms(definedVariables, context) {
86
+ const implicitlyGroundedTerms = this.terms.reduce((implicitlyGroundedTerms, term) => {
87
+ const termImplicitlyGrounded = term.isImplicitlyGrounded(definedVariables, context);
88
+
89
+ if (termImplicitlyGrounded) {
90
+ const implicitlyGroundedTerm = term; ///
91
+
92
+ implicitlyGroundedTerms.push(implicitlyGroundedTerm);
93
+ }
94
+
95
+ return implicitlyGroundedTerms;
96
+ }, []);
97
+
98
+ return implicitlyGroundedTerms;
99
+ }
100
+
101
+ isDisjointFrom(equivalence) {
102
+ const disjointFrom = equivalence.everyTerm((term) => {
103
+ const comparesToTerm = this.compareTerm(term);
104
+
105
+ if (!comparesToTerm) {
106
+ return true;
107
+ }
108
+ });
109
+
110
+ return disjointFrom;
111
+ }
112
+
113
+ isInitiallyGrounded(context) {
114
+ const initiallyGroundedTerms = this.getInitiallyGroundedTerms(context),
115
+ initiallyGroundedTermsLength = initiallyGroundedTerms.length,
116
+ initiallyGrounded = (initiallyGroundedTermsLength > 0);
117
+
118
+ return initiallyGrounded;
119
+ }
120
+
121
+ isImplicitlyGrounded(definedVariables, context) {
122
+ const implicitlyGroundedTerms = this.getImplicitlyGroundedTerms(definedVariables, context),
123
+ implicitlyGroundedTermsLength = implicitlyGroundedTerms.length,
124
+ implicitlyGrounded = (implicitlyGroundedTermsLength > 0);
125
+
126
+ return implicitlyGrounded;
127
+ }
128
+
79
129
  compareTerm(term) {
80
130
  const termA = term, ///
81
131
  comparesToTerm = this.someTerm((term) => {
@@ -135,41 +185,6 @@ export default define(class Equivalence extends Element {
135
185
  return variableNodeMatches;
136
186
  }
137
187
 
138
- isDisjointFrom(equivalence) {
139
- const disjointFrom = equivalence.everyTerm((term) => {
140
- const comparesToTerm = this.compareTerm(term);
141
-
142
- if (!comparesToTerm) {
143
- return true;
144
- }
145
- });
146
-
147
- return disjointFrom;
148
- }
149
-
150
- mergedWith(equivalence) {
151
- const equivalenceA = this,
152
- equivalenceB = equivalence, ///
153
- equivalenceATerms = equivalenceA.getTerms(),
154
- equivalenceTermsB = equivalenceB.getTerms(),
155
- terms = [
156
- ...equivalenceATerms,
157
- ...equivalenceTermsB
158
- ];
159
-
160
- compress(terms, (termA, termB) => {
161
- const termAEqualToTermB = termA.isEqualTo(termB);
162
-
163
- if (!termAEqualToTermB) {
164
- return true;
165
- }
166
- });
167
-
168
- equivalence = new Equivalence(terms);
169
-
170
- return equivalence;
171
- }
172
-
173
188
  someTerm(callback) { return this.terms.some(callback); }
174
189
 
175
190
  everyTerm(callback) { return this.terms.every(callback); }
@@ -189,84 +204,49 @@ export default define(class Equivalence extends Element {
189
204
  return result;
190
205
  }
191
206
 
192
- getGroundedTerms(definedVariables, groundedTerms, context) {
193
- this.terms.forEach((term) => {
194
- const termGrounded = term.isGrounded(definedVariables, context);
207
+ combineTerms(terms) {
208
+ const combinedTerms = [
209
+ ...this.terms,
210
+ ...terms
211
+ ];
195
212
 
196
- if (termGrounded) {
197
- const termMatchesGroundedTerm = groundedTerms.some((groundedTerm) => {
198
- const groundedTermNode = groundedTerm.getNode(),
199
- groundedTermNodeMatches = term.matchNode(groundedTermNode);
213
+ compress(combinedTerms, (combinedTermA, combinedTermB) => {
214
+ const combinedTermAEqualToCombinedTermB = combinedTermA.isEqualTo(combinedTermB);
200
215
 
201
- if (groundedTermNodeMatches) {
202
- return true;
203
- }
204
- })
205
-
206
- if (!termMatchesGroundedTerm) {
207
- const groundedTerm = term;
208
-
209
- groundedTerms.push(groundedTerm);
210
- }
216
+ if (!combinedTermAEqualToCombinedTermB) {
217
+ return true;
211
218
  }
212
219
  });
213
- }
214
-
215
- isInitiallyGrounded(context) {
216
- const initiallyGroundedTerms = this.getInitiallyGroundedTerms(context),
217
- initiallyGroundedTermsLength = initiallyGroundedTerms.length,
218
- initiallyGrounded = (initiallyGroundedTermsLength > 0);
219
220
 
220
- return initiallyGrounded;
221
+ return combinedTerms;
221
222
  }
222
223
 
223
- isImplicitlyGrounded(definedVariables, context) {
224
- const implicitlyGroundedTerms = this.getImplicitlyGroundedTerms(definedVariables, context),
225
- implicitlyGroundedTermsLength = implicitlyGroundedTerms.length,
226
- implicitlyGrounded = (implicitlyGroundedTermsLength > 0);
227
-
228
- return implicitlyGrounded;
229
- }
230
-
231
- getInitiallyGroundedTerms(context) {
232
- const initiallyGroundedTerms = this.terms.reduce((initiallyGroundedTerms, term) => {
233
- const termInitiallyGrounded = term.isInitiallyGrounded(context);
234
-
235
- if (termInitiallyGrounded) {
236
- const initiallyGroundedTerm = term; ///
237
-
238
- initiallyGroundedTerms.push(initiallyGroundedTerm);
239
- }
224
+ mergedWith(equivalence, context) {
225
+ const terms = equivalence.getTerms(),
226
+ combinedTerms = this.combineTerms(terms);
240
227
 
241
- return initiallyGroundedTerms;
242
- }, []);
228
+ return literally((context) => {
229
+ const terms = combinedTerms, ///
230
+ termsString = termsStringFromTerms(terms),
231
+ string = termsString, ///
232
+ equivalenceNode = instantiateEquivalence(string, context),
233
+ equivalence = equivalenceFromEquivalenceNode(equivalenceNode, context);
243
234
 
244
- return initiallyGroundedTerms;
235
+ return equivalence;
236
+ }, context);
245
237
  }
246
238
 
247
- getImplicitlyGroundedTerms(definedVariables, context) {
248
- const implicitlyGroundedTerms = this.terms.reduce((implicitlyGroundedTerms, term) => {
249
- const termImplicitlyGrounded = term.isImplicitlyGrounded(definedVariables, context);
250
-
251
- if (termImplicitlyGrounded) {
252
- const implicitlyGroundedTerm = term; ///
253
-
254
- implicitlyGroundedTerms.push(implicitlyGroundedTerm);
255
- }
256
-
257
- return implicitlyGroundedTerms;
258
- }, []);
259
-
260
- return implicitlyGroundedTerms;
261
- }
239
+ static name = "Equivalence";
262
240
 
263
241
  static fromEquality(equality, context) {
264
- const terms = equality.getTerms(),
265
- termsString = termsStringFromTerms(terms),
266
- string = termsString, ///
267
- equalivanceNode = instantiateEquivalence(string, context),
268
- equalivance = equalivanceFromEquivalenceNode(equalivanceNode, context);
242
+ return literally((context) => {
243
+ const terms = equality.getTerms(),
244
+ termsString = termsStringFromTerms(terms),
245
+ string = termsString, ///
246
+ equivalenceNode = instantiateEquivalence(string, context),
247
+ equivalence = equivalenceFromEquivalenceNode(equivalenceNode, context);
269
248
 
270
- return equalivance;
249
+ return equivalence;
250
+ }, context);
271
251
  }
272
252
  });
@@ -73,18 +73,18 @@ export default define(class Equivalences extends Element {
73
73
  return equivalence;
74
74
  }
75
75
 
76
- mergedWith(equivalences) {
76
+ mergedWith(equivalences, context) {
77
77
  let mergedEquivalences = this.clone(); ///
78
78
 
79
79
  equivalences.forEachEquivalence((equivalence) => {
80
- mergedEquivalences = mergedEquivalences.mergedWithEquivalence(equivalence);
80
+ mergedEquivalences = mergedEquivalences.mergedWithEquivalence(equivalence, context);
81
81
  });
82
82
 
83
83
  return mergedEquivalences;
84
84
  }
85
85
 
86
- mergedWithEquivalence(equivalence) {
87
- const equivalences = Equivalences.fromNothing();
86
+ mergedWithEquivalence(equivalence, context) {
87
+ const equivalences = Equivalences.fromNothing(context);
88
88
 
89
89
  let mergedEquivalence = equivalence; ///
90
90
 
@@ -94,7 +94,7 @@ export default define(class Equivalences extends Element {
94
94
  if (mergedEquivalenceDisjointFromEquivalence) {
95
95
  equivalences.addEquivalence(equivalence);
96
96
  } else {
97
- mergedEquivalence = mergedEquivalence.mergedWith(equivalence);
97
+ mergedEquivalence = mergedEquivalence.mergedWith(equivalence, context);
98
98
  }
99
99
  });
100
100
 
@@ -139,9 +139,9 @@ export default define(class Equivalences extends Element {
139
139
  initiallyGroundedEquivalences,
140
140
  implicitlyGroundedEquivalences;
141
141
 
142
- remainingEquivalences =Equivalences.fromNothing();
142
+ remainingEquivalences =Equivalences.fromNothing(context);
143
143
 
144
- initiallyGroundedEquivalences = Equivalences.fromNothing();
144
+ initiallyGroundedEquivalences = Equivalences.fromNothing(context);
145
145
 
146
146
  equivalences.separateInitiallyGroundedEquivalences(remainingEquivalences, initiallyGroundedEquivalences, context);
147
147
 
@@ -190,6 +190,8 @@ export default define(class Equivalences extends Element {
190
190
  return equivalences;
191
191
  }
192
192
 
193
+ static name = "Equivalences";
194
+
193
195
  static fromNothing(context) {
194
196
  const string = EMPTY_STRING,
195
197
  node = null,
@@ -12,9 +12,11 @@ export default define(class Error extends Element {
12
12
  verify() {
13
13
  let verifies = false;
14
14
 
15
- const errorString = this.string; ///
15
+ const node = this.getNode(),
16
+ context = this.getContext(),
17
+ errorString = this.getString(); ///
16
18
 
17
- this.context.warning(`The '${errorString}' error cannot be verified.`, this.node);
19
+ context.warning(`The '${errorString}' error cannot be verified.`, node);
18
20
 
19
21
  return verifies;
20
22
  }