occam-verify-cli 1.0.611 → 1.0.617

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 (151) hide show
  1. package/lib/context/ephemeral.js +59 -31
  2. package/lib/context/file/nominal.js +45 -19
  3. package/lib/context/liminal.js +38 -53
  4. package/lib/context/scoped.js +34 -26
  5. package/lib/context.js +74 -46
  6. package/lib/element/assertion/contained.js +8 -1
  7. package/lib/element/assertion/defined.js +8 -1
  8. package/lib/element/assertion/property.js +8 -1
  9. package/lib/element/assertion/satisfies.js +8 -1
  10. package/lib/element/assertion/subproof.js +8 -1
  11. package/lib/element/assertion/type.js +8 -1
  12. package/lib/element/assertion.js +5 -9
  13. package/lib/element/assumption.js +21 -14
  14. package/lib/element/combinator/bracketed.js +8 -1
  15. package/lib/element/combinator.js +8 -1
  16. package/lib/element/conclusion.js +8 -1
  17. package/lib/element/constructor/bracketed.js +8 -1
  18. package/lib/element/constructor.js +8 -1
  19. package/lib/element/declaration/combinator.js +8 -1
  20. package/lib/element/declaration/complexType.js +8 -1
  21. package/lib/element/declaration/constructor.js +32 -25
  22. package/lib/element/declaration/metavariable.js +9 -9
  23. package/lib/element/declaration/simpleType.js +8 -1
  24. package/lib/element/declaration/typePrefix.js +8 -1
  25. package/lib/element/declaration/variable.js +16 -9
  26. package/lib/element/declaration.js +3 -7
  27. package/lib/element/deduction.js +8 -1
  28. package/lib/element/derivation.js +8 -1
  29. package/lib/element/equality.js +8 -1
  30. package/lib/element/equivalence.js +8 -1
  31. package/lib/element/equivalences.js +8 -1
  32. package/lib/element/error.js +10 -7
  33. package/lib/element/hypothesis.js +8 -1
  34. package/lib/element/judgement.js +9 -2
  35. package/lib/element/label.js +8 -1
  36. package/lib/element/metaType.js +8 -1
  37. package/lib/element/metavariable.js +11 -14
  38. package/lib/element/parameter.js +8 -1
  39. package/lib/element/procedureCall.js +21 -29
  40. package/lib/element/procedureReference.js +15 -1
  41. package/lib/element/proof.js +8 -1
  42. package/lib/element/proofAssertion/premise.js +8 -1
  43. package/lib/element/proofAssertion/step.js +8 -1
  44. package/lib/element/proofAssertion/supposition.js +8 -1
  45. package/lib/element/proofAssertion.js +8 -1
  46. package/lib/element/property.js +8 -1
  47. package/lib/element/propertyRelation.js +8 -1
  48. package/lib/element/reference.js +8 -8
  49. package/lib/element/rule.js +10 -7
  50. package/lib/element/section.js +8 -1
  51. package/lib/element/signature.js +8 -1
  52. package/lib/element/statement.js +12 -16
  53. package/lib/element/subDerivation.js +8 -1
  54. package/lib/element/subproof.js +8 -1
  55. package/lib/element/substitution/frame.js +11 -4
  56. package/lib/element/substitution/reference.js +11 -4
  57. package/lib/element/substitution/statement.js +16 -15
  58. package/lib/element/substitution/term.js +10 -3
  59. package/lib/element/substitution.js +3 -7
  60. package/lib/element/topLevelAssertion/axiom.js +8 -1
  61. package/lib/element/topLevelAssertion/conjecture.js +8 -1
  62. package/lib/element/topLevelAssertion/lemma.js +8 -1
  63. package/lib/element/topLevelAssertion/theorem.js +8 -1
  64. package/lib/element/topLevelAssertion.js +3 -7
  65. package/lib/element/topLevelMetaAssertion/metaLemma.js +8 -1
  66. package/lib/element/topLevelMetaAssertion/metatheorem.js +8 -1
  67. package/lib/element/type.js +8 -1
  68. package/lib/element/typePrefix.js +8 -1
  69. package/lib/element/variable.js +8 -3
  70. package/lib/preamble.js +1 -2
  71. package/lib/process/assign.js +2 -3
  72. package/lib/utilities/element.js +3 -3
  73. package/lib/utilities/substitutions.js +11 -12
  74. package/lib/utilities/unification.js +30 -15
  75. package/package.json +2 -2
  76. package/src/context/ephemeral.js +64 -32
  77. package/src/context/file/nominal.js +82 -17
  78. package/src/context/liminal.js +40 -65
  79. package/src/context/scoped.js +47 -31
  80. package/src/context.js +68 -40
  81. package/src/element/assertion/contained.js +7 -0
  82. package/src/element/assertion/defined.js +7 -0
  83. package/src/element/assertion/property.js +7 -0
  84. package/src/element/assertion/satisfies.js +7 -0
  85. package/src/element/assertion/subproof.js +7 -0
  86. package/src/element/assertion/type.js +7 -0
  87. package/src/element/assertion.js +4 -8
  88. package/src/element/assumption.js +11 -4
  89. package/src/element/combinator/bracketed.js +7 -0
  90. package/src/element/combinator.js +7 -0
  91. package/src/element/conclusion.js +7 -0
  92. package/src/element/constructor/bracketed.js +7 -0
  93. package/src/element/constructor.js +7 -0
  94. package/src/element/declaration/combinator.js +7 -0
  95. package/src/element/declaration/complexType.js +7 -0
  96. package/src/element/declaration/constructor.js +31 -24
  97. package/src/element/declaration/metavariable.js +6 -6
  98. package/src/element/declaration/simpleType.js +7 -0
  99. package/src/element/declaration/typePrefix.js +7 -0
  100. package/src/element/declaration/variable.js +13 -6
  101. package/src/element/declaration.js +1 -3
  102. package/src/element/deduction.js +7 -0
  103. package/src/element/derivation.js +7 -0
  104. package/src/element/equality.js +7 -0
  105. package/src/element/equivalence.js +8 -0
  106. package/src/element/equivalences.js +7 -0
  107. package/src/element/error.js +5 -2
  108. package/src/element/hypothesis.js +7 -0
  109. package/src/element/judgement.js +8 -2
  110. package/src/element/label.js +7 -0
  111. package/src/element/metaType.js +7 -0
  112. package/src/element/metavariable.js +13 -18
  113. package/src/element/parameter.js +7 -0
  114. package/src/element/procedureCall.js +21 -14
  115. package/src/element/procedureReference.js +13 -0
  116. package/src/element/proof.js +7 -0
  117. package/src/element/proofAssertion/premise.js +7 -0
  118. package/src/element/proofAssertion/step.js +7 -0
  119. package/src/element/proofAssertion/supposition.js +7 -0
  120. package/src/element/proofAssertion.js +7 -0
  121. package/src/element/property.js +7 -0
  122. package/src/element/propertyRelation.js +7 -0
  123. package/src/element/reference.js +8 -7
  124. package/src/element/rule.js +8 -9
  125. package/src/element/section.js +7 -0
  126. package/src/element/signature.js +7 -0
  127. package/src/element/statement.js +9 -14
  128. package/src/element/subDerivation.js +7 -0
  129. package/src/element/subproof.js +7 -0
  130. package/src/element/substitution/frame.js +10 -3
  131. package/src/element/substitution/reference.js +10 -3
  132. package/src/element/substitution/statement.js +11 -17
  133. package/src/element/substitution/term.js +9 -2
  134. package/src/element/substitution.js +0 -4
  135. package/src/element/topLevelAssertion/axiom.js +7 -0
  136. package/src/element/topLevelAssertion/conjecture.js +7 -0
  137. package/src/element/topLevelAssertion/lemma.js +7 -0
  138. package/src/element/topLevelAssertion/theorem.js +7 -0
  139. package/src/element/topLevelAssertion.js +1 -9
  140. package/src/element/topLevelMetaAssertion/metaLemma.js +7 -0
  141. package/src/element/topLevelMetaAssertion/metatheorem.js +7 -0
  142. package/src/element/type.js +7 -0
  143. package/src/element/typePrefix.js +7 -0
  144. package/src/element/variable.js +7 -4
  145. package/src/preamble.js +0 -1
  146. package/src/process/assign.js +1 -3
  147. package/src/utilities/element.js +2 -2
  148. package/src/utilities/substitutions.js +8 -12
  149. package/src/utilities/unification.js +2 -4
  150. package/lib/element/substitutions.js +0 -225
  151. package/src/element/substitutions.js +0 -84
@@ -37,21 +37,15 @@ export default define(class StatementSubstitution extends Substitution {
37
37
  return this.replacementStatement;
38
38
  }
39
39
 
40
- getMetavariable(generalContext, specificContext) {
41
- let metavariable = null;
40
+ getStatementSubstitutionNode() {
41
+ const node = this.getNode(),
42
+ statementSubstitutionNode = node; ///
42
43
 
43
- const targetStatementNode = this.targetStatement.getNode(),
44
- metavariableName = targetStatementNode.getMetavariableName();
45
-
46
- if (metavariableName !== null) {
47
- const context = generalContext; ///
48
-
49
- metavariable = context.findMetavariableByMetavariableName(metavariableName);
50
- }
51
-
52
- return metavariable;
44
+ return statementSubstitutionNode;
53
45
  }
54
46
 
47
+ getMtavariableName() { return this.targetStatement.getMtavariableName(); }
48
+
55
49
  getTargetNode() {
56
50
  const targetStatementNode = this.targetStatement.getNode(),
57
51
  targetNode = targetStatementNode; ///
@@ -141,9 +135,9 @@ export default define(class StatementSubstitution extends Substitution {
141
135
  }
142
136
 
143
137
  if (validates) {
144
- const substititoin = this; ///
138
+ const substitution = this; ///
145
139
 
146
- context.addSubstitution(substititoin);
140
+ context.addSubstitution(substitution);
147
141
 
148
142
  context.debug(`...validated the '${statementSubstitutionString}' statement substitution.`);
149
143
  }
@@ -194,7 +188,7 @@ export default define(class StatementSubstitution extends Substitution {
194
188
  replacementStatementValidates = this.replacementStatement.validate(assignments, stated, context);
195
189
 
196
190
  if (replacementStatementValidates) {
197
- context.debug(`...validated the '${statementSubstitutionString}' statement subtitution's '${replacementStatementString}' replacement statement...`);
191
+ context.debug(`...validated the '${statementSubstitutionString}' statement subtitution's '${replacementStatementString}' replacement statement.`);
198
192
  }
199
193
 
200
194
  return replacementStatementValidates;
@@ -252,11 +246,11 @@ export default define(class StatementSubstitution extends Substitution {
252
246
 
253
247
  context = generalContext; ///
254
248
 
255
- const metavariable = this.getMetavariable(generalContext, specificContext);
249
+ const metavariableName = this.getMetavariableName();
256
250
 
257
251
  context = specificContext; ///
258
252
 
259
- const simpleSubstitution = context.findSimpleSubstitutionByMetavariable(metavariable);
253
+ const simpleSubstitution = context.findSimpleSubstitutionByMetavariableName(metavariableName);
260
254
 
261
255
  context = this.getContext();
262
256
 
@@ -25,6 +25,13 @@ export default define(class TermSubstitution extends Substitution {
25
25
  return this.replacementTerm;
26
26
  }
27
27
 
28
+ getTermSubstitutionNode() {
29
+ const node = this.getNode(),
30
+ termSubstitutionNode = node; ///
31
+
32
+ return termSubstitutionNode;
33
+ }
34
+
28
35
  getTargetNode() {
29
36
  const targetTermNode = this.targetTerm.getNode(),
30
37
  tergetNode = targetTermNode; ///
@@ -93,9 +100,9 @@ export default define(class TermSubstitution extends Substitution {
93
100
  }
94
101
 
95
102
  if (validates) {
96
- const substititoin = this; ///
103
+ const substitution = this; ///
97
104
 
98
- context.addSubstitution(substititoin);
105
+ context.addSubstitution(substitution);
99
106
 
100
107
  context.debug(`...validated the '${termSubstitutionString}' term substitution.`);
101
108
  }
@@ -6,10 +6,6 @@ import { primitiveUtilities } from "occam-furtle";
6
6
  const { primitiveFromNode } =primitiveUtilities;
7
7
 
8
8
  export default class Substitution extends Element {
9
- constructor(context, string, node) {
10
- super(context, string, node);
11
- }
12
-
13
9
  getSubstitution() {
14
10
  const substitution = null;
15
11
 
@@ -5,6 +5,13 @@ import TopLevelAssertion from "../../node/topLevelAssertion";
5
5
  import { define } from "../../elements";
6
6
 
7
7
  export default define(class Axiom extends TopLevelAssertion {
8
+ getAxiomNode() {
9
+ const node = this.getNode(),
10
+ axiomNode = node; ///
11
+
12
+ return axiomNode;
13
+ }
14
+
8
15
  isSatisfiable() {
9
16
  const signature = this.getSignature(),
10
17
  satisfiable = (signature !== null);
@@ -5,6 +5,13 @@ import TopLevelAssertion from "../topLevelAssertion";
5
5
  import { define } from "../../elements";
6
6
 
7
7
  export default define(class Conjecture extends TopLevelAssertion {
8
+ getConjectureNode() {
9
+ const node = this.getNode(),
10
+ conjectureNode = node; ///
11
+
12
+ return conjectureNode;
13
+ }
14
+
8
15
  async verify() {
9
16
  let verifies;
10
17
 
@@ -5,6 +5,13 @@ import TopLevelAssertion from "../topLevelAssertion";
5
5
  import { define } from "../../elements";
6
6
 
7
7
  export default define(class Lemma extends TopLevelAssertion {
8
+ getLemmaNode() {
9
+ const node = this.getNode(),
10
+ lemmaNode = node; ///
11
+
12
+ return lemmaNode;
13
+ }
14
+
8
15
  async verify() {
9
16
  let verifies;
10
17
 
@@ -5,6 +5,13 @@ import TopLevelAssertion from "../topLevelAssertion";
5
5
  import { define } from "../../elements";
6
6
 
7
7
  export default define(class Theorem extends TopLevelAssertion {
8
+ getThoeremNode() {
9
+ const node = this.getNode(),
10
+ theoremNode = node; ///
11
+
12
+ return theoremNode;
13
+ }
14
+
8
15
  async verify() {
9
16
  let verifies;
10
17
 
@@ -286,15 +286,7 @@ export default class TopLevelAssertion extends Element {
286
286
  const subproofOrProofAssertionsUnifiesWithSuppositions = await this.unifySubproofOrProofAssertionsWithSuppositions(subproofOrProofAssertions, context);
287
287
 
288
288
  if (subproofOrProofAssertionsUnifiesWithSuppositions) {
289
- const specificContext = context; ///
290
-
291
- context = this.getContext();
292
-
293
- const generalContext = context; ///
294
-
295
- context = specificContext; ///
296
-
297
- const substitutionsResolved = context.areSubstitutionsResolved(generalContext, specificContext);
289
+ const substitutionsResolved = context.areSubstitutionsResolved();
298
290
 
299
291
  if (substitutionsResolved) {
300
292
  statementAndSubproofOrProofAssertionsUnify = true;
@@ -5,6 +5,13 @@ import TopLevelMetaAssertion from "./../topLevelMetaAssertion";
5
5
  import { define } from "../../elements";
6
6
 
7
7
  export default define(class MetaLemma extends TopLevelMetaAssertion {
8
+ getMetaLemmaNode() {
9
+ const node = this.getNode(),
10
+ metaLemmaNode = node; ///
11
+
12
+ return metaLemmaNode;
13
+ }
14
+
8
15
  async verify() {
9
16
  let verifies;
10
17
 
@@ -5,6 +5,13 @@ import TopLevelMetaAssertion from "../topLevelMetaAssertion";
5
5
  import { define } from "../../elements";
6
6
 
7
7
  export default define(class Metatheorem extends TopLevelMetaAssertion {
8
+ getMetatheoremNode() {
9
+ const node = this.getNode(),
10
+ metatheoremNode = node; ///
11
+
12
+ return metatheoremNode;
13
+ }
14
+
8
15
  async verify() {
9
16
  let verifies;
10
17
 
@@ -32,6 +32,13 @@ export default define(class Type extends Element {
32
32
  return this.superTypes;
33
33
  }
34
34
 
35
+ getTypeNode() {
36
+ const node = this.getNode(),
37
+ typeNode = node; ///
38
+
39
+ return typeNode;
40
+ }
41
+
35
42
  getProperties(includeSuperTypes = true) {
36
43
  const properties = [];
37
44
 
@@ -15,6 +15,13 @@ export default define(class TypePrefix extends Element {
15
15
  return this.name;
16
16
  }
17
17
 
18
+ getTypePrefixNode() {
19
+ const node = this.getNode(),
20
+ typePrefixNode = node; ///
21
+
22
+ return typePrefixNode;
23
+ }
24
+
18
25
  compareTypePrefixName(typePrefixName) {
19
26
  const comparesToTypePrefixName = (this.name === typePrefixName);
20
27
 
@@ -30,6 +30,13 @@ export default define(class Variable extends Element {
30
30
  this.type = type;
31
31
  }
32
32
 
33
+ getVariableNode() {
34
+ const node = this.getNode(),
35
+ variableNode = node; //
36
+
37
+ return variableNode;
38
+ }
39
+
33
40
  getTypeString() { return this.type.getString(); }
34
41
 
35
42
  isIdentifierEqualTo(identifier) {
@@ -162,10 +169,6 @@ export default define(class Variable extends Element {
162
169
  termSubstitutionValidates = termSubstitution.validate(generalContext, specificContext);
163
170
 
164
171
  if (termSubstitutionValidates) {
165
- substitution = termSubstitution; ///
166
-
167
- context.addSubstitution(substitution);
168
-
169
172
  termUnifies = true;
170
173
  }
171
174
  }
package/src/preamble.js CHANGED
@@ -38,7 +38,6 @@ import Metatheorem from "./element/topLevelMetaAssertion/metatheorem";
38
38
  import Equivalence from "./element/equivalence";
39
39
  import Equivalences from "./element/equivalences";
40
40
  import Metavariable from "./element/metavariable";
41
- import Substitutions from "./element/substitutions";
42
41
  import ProcedureCall from "./element/procedureCall";
43
42
  import SubDerivation from "./element/subDerivation";
44
43
  import TypeAssertion from "./element/assertion/type";
@@ -2,9 +2,7 @@
2
2
 
3
3
  export function variableAssignmentFromVariable(variable) {
4
4
  return function (context) {
5
- const nested = false;
6
-
7
- context.addVariable(variable, nested);
5
+ context.addVariable(variable);
8
6
 
9
7
  const variableTypeString = variable.getTypeString(),
10
8
  variableString = variable.getString(),
@@ -621,7 +621,7 @@ export function variableDeclarationFromVariableDeclarationNode(variableDeclarati
621
621
  variableNode = variableDeclarationNode.getVariableNode(),
622
622
  type = typeFromTypeNode(typeNode, context),
623
623
  variable = variableFromVariableNode(variableNode, context),
624
- variableDeclaration = new VariableDeclaration(context, string, node, variable, type, provisional);
624
+ variableDeclaration = new VariableDeclaration(context, string, node, type, variable, provisional);
625
625
 
626
626
  return variableDeclaration;
627
627
  }
@@ -708,7 +708,7 @@ export function metavariableDeclarationFromMetavariableDeclarationNode(metavaria
708
708
  string = context.nodeAsString(node),
709
709
  metaType = metaTypeFromMetavariableDeclarationNode(metavariableDeclarationNode, context),
710
710
  metavariable = metavariableFromMetavariableDeclarationNode(metavariableDeclarationNode, context),
711
- metavariableDeclaration = new MetavariableDeclaration(context, string, node, metavariable, metaType);
711
+ metavariableDeclaration = new MetavariableDeclaration(context, string, node, metaType, metavariable);
712
712
 
713
713
  return metavariableDeclaration;
714
714
  }
@@ -107,26 +107,22 @@ export function statementFromStatementAndSubstitutions(statement, generalContext
107
107
  return statement;
108
108
  }
109
109
 
110
- export function metavariablesFromSubstitutions(substitutions, generalContext, specificContext) {
111
- const metavariables = [];
110
+ export function metavariableNamesFromSubstitutions(substitutions) {
111
+ const metavariableNames = [];
112
112
 
113
113
  substitutions.forEach((substitution) => {
114
- const context = generalContext, ///
115
- metavariableName = substitution.getMetavariableName(),
116
- metavariable = context.findMetavariableByMetavariableName(metavariableName);
114
+ const metavariableName = substitution.getMetavariableName();
117
115
 
118
- if (metavariable !== null) {
119
- metavariables.push(metavariable);
116
+ if (metavariableName !== null) {
117
+ metavariableNames.push(metavariableName);
120
118
  }
121
119
  });
122
120
 
123
- compress(metavariables, (metavariableA, metavariableB) => {
124
- const metavariableComparesToMetavariableB = metavariableB.compare(metavariableA);
125
-
126
- if (!metavariableComparesToMetavariableB) {
121
+ compress(metavariableNames, (metavariableNameA, metavariableNameB) => {
122
+ if (metavariableNameA !== metavariableNameB) {
127
123
  return true;
128
124
  }
129
125
  });
130
126
 
131
- return metavariables;
127
+ return metavariableNames;
132
128
  }
@@ -144,9 +144,7 @@ async function unifyStatementWithTopLevelAssertion(statement, reference, satisfi
144
144
  let statementUnifiesWithTopLevelAssertion = false;
145
145
 
146
146
  if (reference !== null) {
147
- const { Substitutions } = elements,
148
- topLevelAssertion = context.findTopLevelAssertionByReference(reference),
149
- generalSubstitutions = substitutions; ///
147
+ const topLevelAssertion = context.findTopLevelAssertionByReference(reference);
150
148
 
151
149
  if (topLevelAssertion !== null) {
152
150
  const statementString = statement.getString(),
@@ -155,7 +153,7 @@ async function unifyStatementWithTopLevelAssertion(statement, reference, satisfi
155
153
  context.trace(`Unifying the '${statementString}' statement with the '${topLevelAssertionString}' top level assertion...`);
156
154
 
157
155
  const subproofOrProofAssertions = context.getSubproofOrProofAssertions(),
158
- statementAndSubproofOrProofAssertionsUnify = topLevelAssertion.unifyStatementAndSubproofOrProofAssertions(statement, subproofOrProofAssertions, context);
156
+ statementAndSubproofOrProofAssertionsUnify = await topLevelAssertion.unifyStatementAndSubproofOrProofAssertions(statement, subproofOrProofAssertions, context);
159
157
 
160
158
  if (statementAndSubproofOrProofAssertionsUnify) {
161
159
  const metavariable = reference.getMetavariable();
@@ -1,225 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "default", {
6
- enumerable: true,
7
- get: function() {
8
- return _default;
9
- }
10
- });
11
- var _occamlanguages = require("occam-languages");
12
- var _necessary = require("necessary");
13
- var _elements = require("../elements");
14
- var _constants = require("../constants");
15
- var _string = require("../utilities/string");
16
- function _assert_this_initialized(self) {
17
- if (self === void 0) {
18
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
19
- }
20
- return self;
21
- }
22
- function _call_super(_this, derived, args) {
23
- derived = _get_prototype_of(derived);
24
- return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
25
- }
26
- function _class_call_check(instance, Constructor) {
27
- if (!(instance instanceof Constructor)) {
28
- throw new TypeError("Cannot call a class as a function");
29
- }
30
- }
31
- function _construct(Parent, args, Class) {
32
- if (_is_native_reflect_construct()) {
33
- _construct = Reflect.construct;
34
- } else {
35
- _construct = function construct(Parent, args, Class) {
36
- var a = [
37
- null
38
- ];
39
- a.push.apply(a, args);
40
- var Constructor = Function.bind.apply(Parent, a);
41
- var instance = new Constructor();
42
- if (Class) _set_prototype_of(instance, Class.prototype);
43
- return instance;
44
- };
45
- }
46
- return _construct.apply(null, arguments);
47
- }
48
- function _defineProperties(target, props) {
49
- for(var i = 0; i < props.length; i++){
50
- var descriptor = props[i];
51
- descriptor.enumerable = descriptor.enumerable || false;
52
- descriptor.configurable = true;
53
- if ("value" in descriptor) descriptor.writable = true;
54
- Object.defineProperty(target, descriptor.key, descriptor);
55
- }
56
- }
57
- function _create_class(Constructor, protoProps, staticProps) {
58
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
59
- if (staticProps) _defineProperties(Constructor, staticProps);
60
- return Constructor;
61
- }
62
- function _define_property(obj, key, value) {
63
- if (key in obj) {
64
- Object.defineProperty(obj, key, {
65
- value: value,
66
- enumerable: true,
67
- configurable: true,
68
- writable: true
69
- });
70
- } else {
71
- obj[key] = value;
72
- }
73
- return obj;
74
- }
75
- function _get_prototype_of(o) {
76
- _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
77
- return o.__proto__ || Object.getPrototypeOf(o);
78
- };
79
- return _get_prototype_of(o);
80
- }
81
- function _inherits(subClass, superClass) {
82
- if (typeof superClass !== "function" && superClass !== null) {
83
- throw new TypeError("Super expression must either be null or a function");
84
- }
85
- subClass.prototype = Object.create(superClass && superClass.prototype, {
86
- constructor: {
87
- value: subClass,
88
- writable: true,
89
- configurable: true
90
- }
91
- });
92
- if (superClass) _set_prototype_of(subClass, superClass);
93
- }
94
- function _is_native_function(fn) {
95
- return Function.toString.call(fn).indexOf("[native code]") !== -1;
96
- }
97
- function _possible_constructor_return(self, call) {
98
- if (call && (_type_of(call) === "object" || typeof call === "function")) {
99
- return call;
100
- }
101
- return _assert_this_initialized(self);
102
- }
103
- function _set_prototype_of(o, p) {
104
- _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
105
- o.__proto__ = p;
106
- return o;
107
- };
108
- return _set_prototype_of(o, p);
109
- }
110
- function _type_of(obj) {
111
- "@swc/helpers - typeof";
112
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
113
- }
114
- function _wrap_native_super(Class) {
115
- var _cache = typeof Map === "function" ? new Map() : undefined;
116
- _wrap_native_super = function wrapNativeSuper(Class) {
117
- if (Class === null || !_is_native_function(Class)) return Class;
118
- if (typeof Class !== "function") {
119
- throw new TypeError("Super expression must either be null or a function");
120
- }
121
- if (typeof _cache !== "undefined") {
122
- if (_cache.has(Class)) return _cache.get(Class);
123
- _cache.set(Class, Wrapper);
124
- }
125
- function Wrapper() {
126
- return _construct(Class, arguments, _get_prototype_of(this).constructor);
127
- }
128
- Wrapper.prototype = Object.create(Class.prototype, {
129
- constructor: {
130
- value: Wrapper,
131
- enumerable: false,
132
- writable: true,
133
- configurable: true
134
- }
135
- });
136
- return _set_prototype_of(Wrapper, Class);
137
- };
138
- return _wrap_native_super(Class);
139
- }
140
- function _is_native_reflect_construct() {
141
- try {
142
- var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
143
- } catch (_) {}
144
- return (_is_native_reflect_construct = function() {
145
- return !!result;
146
- })();
147
- }
148
- var _Substitutions;
149
- var first = _necessary.arrayUtilities.first, extract = _necessary.arrayUtilities.extract, correlate = _necessary.arrayUtilities.correlate;
150
- var _default = (0, _elements.define)((_Substitutions = /*#__PURE__*/ function(Element) {
151
- _inherits(Substitutions, Element);
152
- function Substitutions() {
153
- _class_call_check(this, Substitutions);
154
- return _call_super(this, Substitutions, arguments);
155
- }
156
- _create_class(Substitutions, [
157
- {
158
- key: "getNonTrivialLength",
159
- value: function getNonTrivialLength() {
160
- var nonTrivialLength = this.reduceSubstitution(function(nonTrivialLength, substitution) {
161
- var substitutionTrivial = substitution.isTrivial();
162
- if (!substitutionTrivial) {
163
- nonTrivialLength += 1;
164
- }
165
- return nonTrivialLength;
166
- }, 0);
167
- return nonTrivialLength;
168
- }
169
- },
170
- {
171
- key: "getFirstSubstitution",
172
- value: function getFirstSubstitution() {
173
- var firstSubstitution = null;
174
- var length = this.getLength();
175
- if (length > 0) {
176
- firstSubstitution = first(this.array);
177
- }
178
- return firstSubstitution;
179
- }
180
- },
181
- {
182
- key: "extractSubstitution",
183
- value: function extractSubstitution(callbcak) {
184
- return extract(this.array, callbcak);
185
- }
186
- },
187
- {
188
- key: "correlateSubstitutions",
189
- value: function correlateSubstitutions(substitutions) {
190
- var array = substitutions.getArray(), arrayA = array, arrayB = this.array, correlates = correlate(arrayA, arrayB, function(substitutionA, substitutionB) {
191
- var substitutionAIsEQualToSubstitutionB = substitutionA.isEqualTo(substitutionB);
192
- if (substitutionAIsEQualToSubstitutionB) {
193
- return true;
194
- }
195
- });
196
- return correlates;
197
- }
198
- },
199
- {
200
- key: "asString",
201
- value: function asString() {
202
- var string;
203
- var length = this.getLength();
204
- if (length === 0) {
205
- string = _constants.EMPTY_STRING;
206
- } else {
207
- var substitutions = this.array, substitutionsString = (0, _string.substitutionsStringFromSubstitutions)(substitutions);
208
- string = substitutionsString; ///
209
- }
210
- return string;
211
- }
212
- }
213
- ], [
214
- {
215
- key: "fromNothing",
216
- value: function fromNothing(context) {
217
- var node = null, string = _constants.EMPTY_STRING, array = [], savedArray = [], substitutions = new Substitutions(context, string, node, array, savedArray);
218
- return substitutions;
219
- }
220
- }
221
- ]);
222
- return Substitutions;
223
- }(_wrap_native_super(_occamlanguages.Element)), _define_property(_Substitutions, "name", "Substitutions"), _Substitutions));
224
-
225
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9lbGVtZW50L3N1YnN0aXR1dGlvbnMuanMiXSwic291cmNlc0NvbnRlbnQiOlsiXCJ1c2Ugc3RyaWN0XCI7XG5cbmltcG9ydCB7IEVsZW1lbnQgfSBmcm9tIFwib2NjYW0tbGFuZ3VhZ2VzXCI7XG5pbXBvcnQgeyBhcnJheVV0aWxpdGllcyB9IGZyb20gXCJuZWNlc3NhcnlcIjtcblxuaW1wb3J0IHsgZGVmaW5lIH0gZnJvbSBcIi4uL2VsZW1lbnRzXCI7XG5pbXBvcnQgeyBFTVBUWV9TVFJJTkcgfSBmcm9tIFwiLi4vY29uc3RhbnRzXCI7XG5pbXBvcnQgeyBzdWJzdGl0dXRpb25zU3RyaW5nRnJvbVN1YnN0aXR1dGlvbnMgfSBmcm9tIFwiLi4vdXR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