occam-verify-cli 1.0.612 → 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 (111) 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 +19 -34
  4. package/lib/context/scoped.js +34 -26
  5. package/lib/context.js +7 -7
  6. package/lib/element/assertion.js +5 -9
  7. package/lib/element/assumption.js +11 -4
  8. package/lib/element/combinator.js +8 -1
  9. package/lib/element/conclusion.js +8 -1
  10. package/lib/element/constructor.js +8 -1
  11. package/lib/element/declaration.js +3 -7
  12. package/lib/element/deduction.js +8 -1
  13. package/lib/element/derivation.js +8 -1
  14. package/lib/element/equality.js +8 -1
  15. package/lib/element/equivalence.js +8 -1
  16. package/lib/element/equivalences.js +8 -1
  17. package/lib/element/error.js +10 -7
  18. package/lib/element/hypothesis.js +8 -1
  19. package/lib/element/judgement.js +9 -2
  20. package/lib/element/label.js +8 -1
  21. package/lib/element/metaType.js +8 -1
  22. package/lib/element/metavariable.js +5 -8
  23. package/lib/element/parameter.js +8 -1
  24. package/lib/element/procedureCall.js +21 -29
  25. package/lib/element/procedureReference.js +15 -1
  26. package/lib/element/proof.js +8 -1
  27. package/lib/element/proofAssertion.js +8 -1
  28. package/lib/element/property.js +8 -1
  29. package/lib/element/propertyRelation.js +8 -1
  30. package/lib/element/reference.js +8 -8
  31. package/lib/element/rule.js +10 -7
  32. package/lib/element/section.js +8 -1
  33. package/lib/element/signature.js +8 -1
  34. package/lib/element/statement.js +12 -16
  35. package/lib/element/subDerivation.js +8 -1
  36. package/lib/element/subproof.js +8 -1
  37. package/lib/element/substitution/frame.js +3 -3
  38. package/lib/element/substitution/reference.js +3 -3
  39. package/lib/element/substitution/statement.js +3 -3
  40. package/lib/element/substitution/term.js +3 -3
  41. package/lib/element/substitution.js +3 -7
  42. package/lib/element/topLevelAssertion/axiom.js +8 -1
  43. package/lib/element/topLevelAssertion/conjecture.js +8 -1
  44. package/lib/element/topLevelAssertion/lemma.js +8 -1
  45. package/lib/element/topLevelAssertion/theorem.js +8 -1
  46. package/lib/element/topLevelAssertion.js +3 -7
  47. package/lib/element/topLevelMetaAssertion/metaLemma.js +8 -1
  48. package/lib/element/topLevelMetaAssertion/metatheorem.js +8 -1
  49. package/lib/element/type.js +8 -1
  50. package/lib/element/typePrefix.js +8 -1
  51. package/lib/element/variable.js +8 -3
  52. package/lib/preamble.js +1 -2
  53. package/lib/process/assign.js +2 -3
  54. package/lib/utilities/substitutions.js +2 -2
  55. package/package.json +2 -2
  56. package/src/context/ephemeral.js +64 -32
  57. package/src/context/file/nominal.js +82 -17
  58. package/src/context/liminal.js +21 -46
  59. package/src/context/scoped.js +47 -31
  60. package/src/context.js +4 -4
  61. package/src/element/assertion.js +4 -8
  62. package/src/element/assumption.js +9 -2
  63. package/src/element/combinator.js +7 -0
  64. package/src/element/conclusion.js +7 -0
  65. package/src/element/constructor.js +7 -0
  66. package/src/element/declaration.js +1 -3
  67. package/src/element/deduction.js +7 -0
  68. package/src/element/derivation.js +7 -0
  69. package/src/element/equality.js +7 -0
  70. package/src/element/equivalence.js +8 -0
  71. package/src/element/equivalences.js +7 -0
  72. package/src/element/error.js +5 -2
  73. package/src/element/hypothesis.js +7 -0
  74. package/src/element/judgement.js +8 -2
  75. package/src/element/label.js +7 -0
  76. package/src/element/metaType.js +7 -0
  77. package/src/element/metavariable.js +4 -11
  78. package/src/element/parameter.js +7 -0
  79. package/src/element/procedureCall.js +21 -14
  80. package/src/element/procedureReference.js +13 -0
  81. package/src/element/proof.js +7 -0
  82. package/src/element/proofAssertion.js +7 -0
  83. package/src/element/property.js +7 -0
  84. package/src/element/propertyRelation.js +7 -0
  85. package/src/element/reference.js +8 -7
  86. package/src/element/rule.js +8 -9
  87. package/src/element/section.js +7 -0
  88. package/src/element/signature.js +7 -0
  89. package/src/element/statement.js +9 -14
  90. package/src/element/subDerivation.js +7 -0
  91. package/src/element/subproof.js +7 -0
  92. package/src/element/substitution/frame.js +2 -2
  93. package/src/element/substitution/reference.js +2 -2
  94. package/src/element/substitution/statement.js +2 -2
  95. package/src/element/substitution/term.js +2 -2
  96. package/src/element/substitution.js +0 -4
  97. package/src/element/topLevelAssertion/axiom.js +7 -0
  98. package/src/element/topLevelAssertion/conjecture.js +7 -0
  99. package/src/element/topLevelAssertion/lemma.js +7 -0
  100. package/src/element/topLevelAssertion/theorem.js +7 -0
  101. package/src/element/topLevelAssertion.js +1 -9
  102. package/src/element/topLevelMetaAssertion/metaLemma.js +7 -0
  103. package/src/element/topLevelMetaAssertion/metatheorem.js +7 -0
  104. package/src/element/type.js +7 -0
  105. package/src/element/typePrefix.js +7 -0
  106. package/src/element/variable.js +7 -4
  107. package/src/preamble.js +0 -1
  108. package/src/process/assign.js +1 -3
  109. package/src/utilities/substitutions.js +1 -1
  110. package/lib/element/substitutions.js +0 -225
  111. package/src/element/substitutions.js +0 -84
@@ -43,6 +43,13 @@ export default define(class Rule extends Element {
43
43
  return this.conclusion;
44
44
  }
45
45
 
46
+ getRuleNode() {
47
+ const node = this.getNode(),
48
+ ruleNode = node; ///
49
+
50
+ return ruleNode;
51
+ }
52
+
46
53
  compareMetavariableName(metavariableName) {
47
54
  const comparesToMetavariableName = this.labels.some((label) => {
48
55
  const labelComparesToMetavariableName = label.compareMetavariableName(metavariableName);
@@ -221,15 +228,7 @@ export default define(class Rule extends Element {
221
228
  const subproofOrProofAssertionsUnifiesWithPremises = await this.unifySubproofOrProofAssertionsWithPremises(subproofOrProofAssertions, context);
222
229
 
223
230
  if (subproofOrProofAssertionsUnifiesWithPremises) {
224
- const specificContext = context; ///
225
-
226
- context = this.getContext();
227
-
228
- const generalContext = context; ///
229
-
230
- context = specificContext; ///
231
-
232
- const substitutionsResolved = context.areSubstitutionsResolved(generalContext, specificContext);
231
+ const substitutionsResolved = context.areSubstitutionsResolved();
233
232
 
234
233
  if (substitutionsResolved) {
235
234
  statementAndSubproofOrProofAssertionsUnify = true;
@@ -35,6 +35,13 @@ export default define(class Section extends Element {
35
35
  return this.conjecture;
36
36
  }
37
37
 
38
+ getSectionNode() {
39
+ const node = this.getNode(),
40
+ sectionNode = node; ///
41
+
42
+ return sectionNode;
43
+ }
44
+
38
45
  verifyHypotheses() {
39
46
  const hypothesesVerify = this.hypotheses.every((hypothesis) => {
40
47
  const hypothesisVerifies = hypothesis.verify(this.context);
@@ -20,6 +20,13 @@ export default define(class Signature extends Element {
20
20
  return this.terms;
21
21
  }
22
22
 
23
+ getSignatureNode() {
24
+ const node = this.getNode(),
25
+ signatureNode = node; ///
26
+
27
+ return signatureNode;
28
+ }
29
+
23
30
  verify(context) {
24
31
  let verifies;
25
32
 
@@ -11,30 +11,25 @@ import { STATEMENT_META_TYPE_NAME } from "../metaTypeNames";
11
11
  const { match, backwardsSome } = arrayUtilities;
12
12
 
13
13
  export default define(class Statement extends Element {
14
- constructor(context, string, node) {
15
- super(context, string, node);
16
- }
17
-
18
- isSingular() {
14
+ getStatementNode() {
19
15
  const node = this.getNode(),
20
- statementNode = node, ///
21
- singular = statementNode.isSingular();
16
+ statementNode = node; ///
22
17
 
23
- return singular;
18
+ return statementNode;
24
19
  }
25
20
 
26
21
  getMetavariableName() {
27
- const node = this.getNode(),
28
- metavariableName = node.getMetavariableName();
22
+ const sttaementNode = this.getStatementNode(),
23
+ metavariableName = sttaementNode.getMetavariableName();
29
24
 
30
25
  return metavariableName;
31
26
  }
32
27
 
33
- getStatementNode() {
34
- const node = this.getNode(),
35
- statementNode = node; ///
28
+ isSingular() {
29
+ const statementNode = this.getStatementNode(),
30
+ singular = statementNode.isSingular();
36
31
 
37
- return statementNode;
32
+ return singular;
38
33
  }
39
34
 
40
35
  matchStatementNode(statementNode) {
@@ -20,6 +20,13 @@ export default define(class SubDerivation extends Element {
20
20
  return this.subproofOrProofAssertions;
21
21
  }
22
22
 
23
+ getSubDerivationNode() {
24
+ const node = this.getNode(),
25
+ subDerivationNode = node; ///
26
+
27
+ return subDerivationNode;
28
+ }
29
+
23
30
  getLastProofAssertion() {
24
31
  const lastSubproofOrProofAssertion = last(this.subproofOrProofAssertions),
25
32
  lastProofAssertion = lastSubproofOrProofAssertion; ///
@@ -21,6 +21,13 @@ export default define(class Subproof extends Element {
21
21
  return this.subDerivation;
22
22
  }
23
23
 
24
+ getSubproofNode() {
25
+ const node = this.getNode(),
26
+ subproofNode = node; ///
27
+
28
+ return subproofNode;
29
+ }
30
+
24
31
  getLastProofAssertion() { return this.subDerivation.getLastProofAssertion(); }
25
32
 
26
33
  getStatements() {
@@ -99,9 +99,9 @@ export default define(class FrameSubstitution extends Substitution {
99
99
  }
100
100
 
101
101
  if (validates) {
102
- const substititoin = this; ///
102
+ const substitution = this; ///
103
103
 
104
- context.addSubstitution(substititoin);
104
+ context.addSubstitution(substitution);
105
105
 
106
106
  context.debug(`...validated the '${frameSubstitutionString}' frame substitution.`);
107
107
  }
@@ -99,9 +99,9 @@ export default define(class ReferenceSubstitution extends Substitution {
99
99
  }
100
100
 
101
101
  if (validates) {
102
- const substititoin = this; ///
102
+ const subsitution = this; ///
103
103
 
104
- context.addSubstitution(substititoin);
104
+ context.addSubstitution(subsitution);
105
105
 
106
106
  context.debug(`...validated the '${referenceSubstitutionString}' reference substitution.`);
107
107
  }
@@ -135,9 +135,9 @@ export default define(class StatementSubstitution extends Substitution {
135
135
  }
136
136
 
137
137
  if (validates) {
138
- const substititoin = this; ///
138
+ const substitution = this; ///
139
139
 
140
- context.addSubstitution(substititoin);
140
+ context.addSubstitution(substitution);
141
141
 
142
142
  context.debug(`...validated the '${statementSubstitutionString}' statement substitution.`);
143
143
  }
@@ -100,9 +100,9 @@ export default define(class TermSubstitution extends Substitution {
100
100
  }
101
101
 
102
102
  if (validates) {
103
- const substititoin = this; ///
103
+ const substitution = this; ///
104
104
 
105
- context.addSubstitution(substititoin);
105
+ context.addSubstitution(substitution);
106
106
 
107
107
  context.debug(`...validated the '${termSubstitutionString}' term substitution.`);
108
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(),
@@ -119,7 +119,7 @@ export function metavariableNamesFromSubstitutions(substitutions) {
119
119
  });
120
120
 
121
121
  compress(metavariableNames, (metavariableNameA, metavariableNameB) => {
122
- if (metavariableNameB !== metavariableNameB) {
122
+ if (metavariableNameA !== metavariableNameB) {
123
123
  return true;
124
124
  }
125
125
  });
@@ -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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9lbGVtZW50L3N1YnN0aXR1dGlvbnMuanMiXSwic291cmNlc0NvbnRlbnQiOlsiXCJ1c2Ugc3RyaWN0XCI7XG5cbmltcG9ydCB7IEVsZW1lbnQgfSBmcm9tIFwib2NjYW0tbGFuZ3VhZ2VzXCI7XG5pbXBvcnQgeyBhcnJheVV0aWxpdGllcyB9IGZyb20gXCJuZWNlc3NhcnlcIjtcblxuaW1wb3J0IHsgZGVmaW5lIH0gZnJvbSBcIi4uL2VsZW1lbnRzXCI7XG5pbXBvcnQgeyBFTVBUWV9TVFJJTkcgfSBmcm9tIFwiLi4vY29uc3RhbnRzXCI7XG5pbXBvcnQgeyBzdWJzdGl0dXRpb25zU3RyaW5nRnJvbVN1YnN0aXR1dGlvbnMgfSBmcm9tIFwiLi4vdXRpbGl0aWVzL3N0cmluZ1wiO1xuXG5jb25zdCB7IGZpcnN0LCBleHRyYWN0LCBjb3JyZWxhdGUgfSA9IGFycmF5VXRpbGl0aWVzO1xuXG5leHBvcnQgZGVmYXVsdCBkZWZpbmUoY2xhc3MgU3Vic3RpdHV0aW9ucyBleHRlbmRzIEVsZW1lbnQge1xuICBnZXROb25Ucml2aWFsTGVuZ3RoKCkge1xuICAgIGNvbnN0IG5vblRyaXZpYWxMZW5ndGggPSB0aGlzLnJlZHVjZVN1YnN0aXR1dGlvbigobm9uVHJpdmlhbExlbmd0aCwgc3Vic3RpdHV0aW9uKSA9PiB7XG4gICAgICBjb25zdCBzdWJzdGl0dXRpb25Uc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