@eagleoutice/flowr 2.6.3 → 2.7.2

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 (276) hide show
  1. package/README.md +22 -22
  2. package/abstract-interpretation/absint-visitor.d.ts +160 -0
  3. package/abstract-interpretation/absint-visitor.js +279 -0
  4. package/abstract-interpretation/data-frame/dataframe-domain.d.ts +4 -7
  5. package/abstract-interpretation/data-frame/dataframe-domain.js +26 -16
  6. package/abstract-interpretation/data-frame/mappers/access-mapper.d.ts +6 -4
  7. package/abstract-interpretation/data-frame/mappers/access-mapper.js +11 -14
  8. package/abstract-interpretation/data-frame/mappers/arguments.d.ts +10 -9
  9. package/abstract-interpretation/data-frame/mappers/arguments.js +8 -5
  10. package/abstract-interpretation/data-frame/mappers/function-mapper.d.ts +18 -18
  11. package/abstract-interpretation/data-frame/mappers/function-mapper.js +53 -58
  12. package/abstract-interpretation/data-frame/mappers/replacement-mapper.d.ts +7 -5
  13. package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +26 -29
  14. package/abstract-interpretation/data-frame/semantics.js +48 -44
  15. package/abstract-interpretation/data-frame/shape-inference.d.ts +52 -28
  16. package/abstract-interpretation/data-frame/shape-inference.js +67 -90
  17. package/abstract-interpretation/domains/abstract-domain.d.ts +1 -0
  18. package/abstract-interpretation/domains/abstract-domain.js +3 -2
  19. package/abstract-interpretation/domains/bounded-set-domain.d.ts +2 -2
  20. package/abstract-interpretation/domains/bounded-set-domain.js +1 -1
  21. package/abstract-interpretation/domains/interval-domain.d.ts +4 -4
  22. package/abstract-interpretation/domains/interval-domain.js +3 -6
  23. package/abstract-interpretation/domains/lattice.d.ts +2 -0
  24. package/abstract-interpretation/domains/lattice.js +3 -1
  25. package/abstract-interpretation/domains/positive-interval-domain.d.ts +1 -1
  26. package/abstract-interpretation/domains/positive-interval-domain.js +1 -1
  27. package/abstract-interpretation/domains/satisfiable-domain.d.ts +2 -2
  28. package/abstract-interpretation/domains/satisfiable-domain.js +2 -2
  29. package/abstract-interpretation/domains/set-range-domain.d.ts +104 -0
  30. package/abstract-interpretation/domains/set-range-domain.js +406 -0
  31. package/abstract-interpretation/domains/set-upper-bound-domain.d.ts +2 -2
  32. package/abstract-interpretation/domains/set-upper-bound-domain.js +2 -2
  33. package/abstract-interpretation/domains/singleton-domain.d.ts +2 -2
  34. package/abstract-interpretation/domains/singleton-domain.js +2 -2
  35. package/benchmark/slicer.d.ts +2 -1
  36. package/benchmark/slicer.js +50 -29
  37. package/benchmark/stats/print.js +8 -5
  38. package/benchmark/stats/stats.d.ts +3 -2
  39. package/benchmark/summarizer/data.d.ts +11 -8
  40. package/benchmark/summarizer/first-phase/process.js +11 -8
  41. package/benchmark/summarizer/second-phase/process.js +24 -18
  42. package/cli/common/options.d.ts +431 -8
  43. package/cli/common/options.js +1 -1
  44. package/cli/common/scripts-info.d.ts +431 -7
  45. package/cli/flowr-main-options.d.ts +102 -2
  46. package/cli/flowr.d.ts +102 -2
  47. package/cli/repl/commands/repl-commands.d.ts +25 -0
  48. package/cli/repl/commands/repl-query.js +17 -5
  49. package/cli/wiki.d.ts +13 -0
  50. package/cli/wiki.js +7 -2
  51. package/config.d.ts +4 -4
  52. package/config.js +1 -1
  53. package/control-flow/basic-cfg-guided-visitor.js +7 -8
  54. package/control-flow/cfg-dead-code.js +3 -2
  55. package/control-flow/control-flow-graph.d.ts +1 -1
  56. package/control-flow/semantic-cfg-guided-visitor.d.ts +1 -1
  57. package/control-flow/semantic-cfg-guided-visitor.js +1 -1
  58. package/control-flow/useless-loop.js +4 -2
  59. package/core/steps/all/static-slicing/00-slice.d.ts +3 -0
  60. package/core/steps/all/static-slicing/00-slice.js +2 -1
  61. package/core/steps/pipeline/default-pipelines.d.ts +42 -42
  62. package/dataflow/cluster.js +2 -2
  63. package/dataflow/environments/append.d.ts +5 -0
  64. package/dataflow/environments/append.js +6 -20
  65. package/dataflow/environments/built-in.d.ts +2 -1
  66. package/dataflow/environments/clone.d.ts +1 -1
  67. package/dataflow/environments/clone.js +3 -27
  68. package/dataflow/environments/define.d.ts +7 -3
  69. package/dataflow/environments/define.js +9 -56
  70. package/dataflow/environments/diff.js +1 -1
  71. package/dataflow/environments/environment.d.ts +48 -28
  72. package/dataflow/environments/environment.js +187 -62
  73. package/dataflow/environments/overwrite.js +2 -45
  74. package/dataflow/environments/reference-to-maybe.d.ts +13 -0
  75. package/dataflow/environments/reference-to-maybe.js +54 -0
  76. package/dataflow/environments/resolve-by-name.d.ts +6 -1
  77. package/dataflow/environments/resolve-by-name.js +56 -4
  78. package/dataflow/environments/scoping.d.ts +2 -2
  79. package/dataflow/environments/scoping.js +7 -7
  80. package/dataflow/eval/resolve/alias-tracking.d.ts +10 -4
  81. package/dataflow/eval/resolve/alias-tracking.js +16 -14
  82. package/dataflow/eval/resolve/resolve-argument.d.ts +2 -1
  83. package/dataflow/eval/resolve/resolve-argument.js +8 -8
  84. package/dataflow/eval/resolve/resolve.d.ts +13 -11
  85. package/dataflow/eval/resolve/resolve.js +16 -15
  86. package/dataflow/extractor.js +1 -7
  87. package/dataflow/fn/higher-order-function.d.ts +2 -1
  88. package/dataflow/fn/higher-order-function.js +4 -4
  89. package/dataflow/graph/dataflowgraph-builder.d.ts +9 -5
  90. package/dataflow/graph/dataflowgraph-builder.js +21 -11
  91. package/dataflow/graph/diff-dataflow-graph.js +2 -2
  92. package/dataflow/graph/graph.d.ts +10 -2
  93. package/dataflow/graph/graph.js +41 -12
  94. package/dataflow/graph/invert-dfg.d.ts +3 -2
  95. package/dataflow/graph/invert-dfg.js +3 -3
  96. package/dataflow/graph/resolve-graph.d.ts +2 -1
  97. package/dataflow/graph/resolve-graph.js +2 -2
  98. package/dataflow/graph/vertex.d.ts +3 -3
  99. package/dataflow/graph/vertex.js +3 -3
  100. package/dataflow/info.d.ts +1 -1
  101. package/dataflow/internal/linker.d.ts +2 -0
  102. package/dataflow/internal/linker.js +13 -19
  103. package/dataflow/internal/process/functions/call/argument/unpack-argument.d.ts +7 -1
  104. package/dataflow/internal/process/functions/call/argument/unpack-argument.js +12 -3
  105. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +3 -3
  106. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +2 -2
  107. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +3 -1
  108. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +3 -3
  109. package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +9 -9
  110. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +9 -7
  111. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +3 -3
  112. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +2 -1
  113. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +9 -13
  114. package/dataflow/internal/process/functions/call/built-in/built-in-get.js +1 -1
  115. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.d.ts +3 -1
  116. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +8 -6
  117. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +1 -1
  118. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +1 -1
  119. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +1 -1
  120. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +3 -3
  121. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +6 -4
  122. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +1 -1
  123. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +5 -5
  124. package/dataflow/internal/process/functions/call/common.js +2 -3
  125. package/dataflow/internal/process/functions/call/known-call-handling.js +1 -1
  126. package/dataflow/internal/process/functions/call/unnamed-call-handling.js +1 -1
  127. package/dataflow/internal/process/functions/process-argument.js +1 -1
  128. package/dataflow/internal/process/process-symbol.js +1 -1
  129. package/dataflow/internal/process/process-value.d.ts +1 -1
  130. package/dataflow/internal/process/process-value.js +7 -7
  131. package/dataflow/processor.d.ts +1 -5
  132. package/documentation/doc-capabilities.d.ts +1 -1
  133. package/documentation/doc-readme.d.ts +1 -1
  134. package/documentation/doc-util/doc-cfg.js +1 -1
  135. package/documentation/doc-util/doc-cli-option.d.ts +6 -6
  136. package/documentation/doc-util/doc-cli-option.js +3 -3
  137. package/documentation/doc-util/doc-dfg.d.ts +1 -1
  138. package/documentation/doc-util/doc-dfg.js +3 -2
  139. package/documentation/doc-util/doc-files.d.ts +3 -0
  140. package/documentation/doc-util/doc-files.js +4 -1
  141. package/documentation/doc-util/doc-normalized-ast.js +5 -4
  142. package/documentation/doc-util/doc-types.d.ts +1 -1
  143. package/documentation/doc-util/doc-types.js +2 -2
  144. package/documentation/issue-linting-rule.d.ts +1 -1
  145. package/documentation/wiki-analyzer.d.ts +1 -1
  146. package/documentation/wiki-analyzer.js +14 -1
  147. package/documentation/wiki-cfg.d.ts +1 -1
  148. package/documentation/wiki-core.d.ts +1 -1
  149. package/documentation/wiki-dataflow-graph.d.ts +1 -1
  150. package/documentation/wiki-dataflow-graph.js +10 -11
  151. package/documentation/wiki-engine.d.ts +1 -1
  152. package/documentation/wiki-engine.js +9 -10
  153. package/documentation/wiki-faq.d.ts +1 -1
  154. package/documentation/wiki-faq.js +0 -1
  155. package/documentation/wiki-interface.d.ts +1 -1
  156. package/documentation/wiki-interface.js +12 -13
  157. package/documentation/wiki-linter.d.ts +1 -1
  158. package/documentation/wiki-linter.js +1 -1
  159. package/documentation/wiki-linting-and-testing.d.ts +1 -1
  160. package/documentation/wiki-mk/doc-context.d.ts +54 -1
  161. package/documentation/wiki-mk/doc-context.js +17 -0
  162. package/documentation/wiki-mk/doc-maker.d.ts +5 -5
  163. package/documentation/wiki-mk/doc-maker.js +5 -2
  164. package/documentation/wiki-normalized-ast.d.ts +1 -1
  165. package/documentation/wiki-onboarding.d.ts +1 -1
  166. package/documentation/wiki-overview.d.ts +9 -0
  167. package/documentation/wiki-overview.js +248 -0
  168. package/documentation/wiki-query.d.ts +1 -1
  169. package/documentation/wiki-query.js +17 -1
  170. package/documentation/wiki-search.d.ts +1 -1
  171. package/documentation/wiki-setup.d.ts +9 -0
  172. package/documentation/wiki-setup.js +122 -0
  173. package/linter/linter-rules.d.ts +2 -2
  174. package/linter/rules/absolute-path.js +4 -4
  175. package/linter/rules/dataframe-access-validation.d.ts +2 -2
  176. package/linter/rules/dataframe-access-validation.js +9 -11
  177. package/linter/rules/function-finder-util.d.ts +2 -2
  178. package/linter/rules/function-finder-util.js +1 -1
  179. package/linter/rules/network-functions.js +1 -1
  180. package/linter/rules/seeded-randomness.d.ts +1 -1
  181. package/linter/rules/seeded-randomness.js +5 -5
  182. package/linter/rules/unused-definition.js +1 -1
  183. package/package.json +1 -2
  184. package/project/context/flowr-analyzer-context.d.ts +11 -0
  185. package/project/context/flowr-analyzer-context.js +3 -0
  186. package/project/context/flowr-analyzer-environment-context.d.ts +47 -0
  187. package/project/context/flowr-analyzer-environment-context.js +50 -0
  188. package/project/context/flowr-analyzer-files-context.d.ts +9 -1
  189. package/project/context/flowr-analyzer-files-context.js +4 -0
  190. package/project/context/flowr-file.d.ts +2 -0
  191. package/project/context/flowr-file.js +2 -0
  192. package/project/plugins/file-plugins/{flowr-description-file.d.ts → files/flowr-description-file.d.ts} +1 -1
  193. package/project/plugins/file-plugins/files/flowr-description-file.js +75 -0
  194. package/project/plugins/file-plugins/files/flowr-news-file.d.ts +27 -0
  195. package/project/plugins/file-plugins/files/flowr-news-file.js +152 -0
  196. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +1 -1
  197. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +1 -1
  198. package/project/plugins/file-plugins/flowr-analyzer-news-file-plugin.d.ts +23 -0
  199. package/project/plugins/file-plugins/flowr-analyzer-news-file-plugin.js +35 -0
  200. package/project/plugins/file-plugins/notebooks/flowr-analyzer-jupyter-file-plugin.d.ts +1 -1
  201. package/project/plugins/file-plugins/notebooks/flowr-analyzer-jupyter-file-plugin.js +1 -1
  202. package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.d.ts +1 -1
  203. package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.js +1 -1
  204. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.d.ts +1 -1
  205. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.js +1 -1
  206. package/project/plugins/flowr-analyzer-plugin-defaults.js +2 -0
  207. package/project/plugins/plugin-registry.d.ts +2 -1
  208. package/project/plugins/plugin-registry.js +2 -0
  209. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +7 -1
  210. package/queries/catalog/call-context-query/call-context-query-executor.js +1 -4
  211. package/queries/catalog/control-flow-query/control-flow-query-format.js +3 -2
  212. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.js +1 -1
  213. package/queries/catalog/dependencies-query/dependencies-query-executor.js +4 -4
  214. package/queries/catalog/df-shape-query/df-shape-query-executor.d.ts +1 -1
  215. package/queries/catalog/df-shape-query/df-shape-query-executor.js +5 -3
  216. package/queries/catalog/df-shape-query/df-shape-query-format.d.ts +4 -4
  217. package/queries/catalog/df-shape-query/df-shape-query-format.js +2 -2
  218. package/queries/catalog/files-query/files-query-executor.d.ts +6 -0
  219. package/queries/catalog/files-query/files-query-executor.js +49 -0
  220. package/queries/catalog/files-query/files-query-format.d.ts +36 -0
  221. package/queries/catalog/files-query/files-query-format.js +114 -0
  222. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +3 -3
  223. package/queries/catalog/linter-query/linter-query-format.js +1 -1
  224. package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +1 -1
  225. package/queries/catalog/static-slice-query/static-slice-query-executor.js +1 -1
  226. package/queries/query.d.ts +10 -1
  227. package/queries/query.js +3 -1
  228. package/r-bridge/lang-4.x/ast/model/model.d.ts +1 -1
  229. package/r-bridge/lang-4.x/ast/model/processing/decorate.js +8 -8
  230. package/r-bridge/lang-4.x/ast/model/processing/role.d.ts +8 -8
  231. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-parameter.js +0 -1
  232. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +0 -1
  233. package/slicing/static/slice-call.d.ts +3 -2
  234. package/slicing/static/slice-call.js +4 -4
  235. package/slicing/static/static-slicer.d.ts +3 -1
  236. package/slicing/static/static-slicer.js +6 -7
  237. package/statistics/features/supported/control-flow/control-flow.js +1 -1
  238. package/statistics/features/supported/data-access/data-access.js +1 -1
  239. package/statistics/features/supported/used-functions/used-functions.js +1 -1
  240. package/statistics/features/supported/variables/variables.js +2 -1
  241. package/util/containers.js +2 -2
  242. package/util/files.d.ts +0 -7
  243. package/util/files.js +0 -41
  244. package/util/mermaid/ast.d.ts +3 -2
  245. package/util/mermaid/ast.js +13 -7
  246. package/util/mermaid/cfg.d.ts +3 -2
  247. package/util/mermaid/cfg.js +26 -6
  248. package/util/mermaid/dfg.d.ts +2 -7
  249. package/util/mermaid/dfg.js +10 -6
  250. package/util/mermaid/info.d.ts +17 -0
  251. package/util/mermaid/info.js +5 -0
  252. package/util/prefix.d.ts +9 -5
  253. package/util/prefix.js +14 -6
  254. package/util/r-regex.d.ts +21 -0
  255. package/util/r-regex.js +25 -0
  256. package/util/simple-df/dfg-view.d.ts +2 -1
  257. package/util/simple-df/dfg-view.js +2 -2
  258. package/util/text/args.js +12 -3
  259. package/util/version.js +1 -1
  260. package/abstract-interpretation/data-frame/absint-info.d.ts +0 -109
  261. package/abstract-interpretation/data-frame/absint-info.js +0 -31
  262. package/abstract-interpretation/data-frame/absint-visitor.d.ts +0 -57
  263. package/abstract-interpretation/data-frame/absint-visitor.js +0 -176
  264. package/abstract-interpretation/data-frame/mappers/assignment-mapper.d.ts +0 -19
  265. package/abstract-interpretation/data-frame/mappers/assignment-mapper.js +0 -33
  266. package/dataflow/environments/remove.d.ts +0 -12
  267. package/dataflow/environments/remove.js +0 -52
  268. package/documentation/doc-util/doc-print.d.ts +0 -5
  269. package/documentation/doc-util/doc-print.js +0 -36
  270. package/project/plugins/file-plugins/flowr-description-file.js +0 -37
  271. package/project/plugins/file-plugins/notebooks/notebook.d.ts +0 -0
  272. package/project/plugins/file-plugins/notebooks/notebook.js +0 -2
  273. /package/project/plugins/file-plugins/{notebooks → files}/flowr-jupyter-file.d.ts +0 -0
  274. /package/project/plugins/file-plugins/{notebooks → files}/flowr-jupyter-file.js +0 -0
  275. /package/project/plugins/file-plugins/{notebooks → files}/flowr-rmarkdown-file.d.ts +0 -0
  276. /package/project/plugins/file-plugins/{notebooks → files}/flowr-rmarkdown-file.js +0 -0
@@ -75,9 +75,6 @@ class IntervalDomain extends abstract_domain_1.AbstractDomain {
75
75
  if (this.value === lattice_1.Bottom || otherValue === lattice_1.Bottom) {
76
76
  return this.bottom();
77
77
  }
78
- else if (Math.max(this.value[0], otherValue[0]) > Math.min(this.value[1], otherValue[1])) {
79
- return this.bottom();
80
- }
81
78
  else {
82
79
  return this.create([Math.max(this.value[0], otherValue[0]), Math.min(this.value[1], otherValue[1])]);
83
80
  }
@@ -222,7 +219,7 @@ class IntervalDomain extends abstract_domain_1.AbstractDomain {
222
219
  /**
223
220
  * Extends the lower bound of the current abstract value down to -∞.
224
221
  */
225
- extendDown() {
222
+ widenDown() {
226
223
  if (this.value === lattice_1.Bottom) {
227
224
  return this.bottom();
228
225
  }
@@ -233,7 +230,7 @@ class IntervalDomain extends abstract_domain_1.AbstractDomain {
233
230
  /**
234
231
  * Extends the upper bound of the current abstract value up to +∞.
235
232
  */
236
- extendUp() {
233
+ widenUp() {
237
234
  if (this.value === lattice_1.Bottom) {
238
235
  return this.bottom();
239
236
  }
@@ -249,7 +246,7 @@ class IntervalDomain extends abstract_domain_1.AbstractDomain {
249
246
  }
250
247
  toString() {
251
248
  if (this.value === lattice_1.Bottom) {
252
- return '⊥';
249
+ return lattice_1.BottomSymbol;
253
250
  }
254
251
  return `[${isFinite(this.value[0]) ? this.value[0] : '-∞'}, ${isFinite(this.value[1]) ? this.value[1] : '+∞'}]`;
255
252
  }
@@ -2,10 +2,12 @@
2
2
  * The Top symbol to represent the Top element of complete lattices (e.g. of abstract domains).
3
3
  */
4
4
  export declare const Top: unique symbol;
5
+ export declare const TopSymbol = "\u22A4";
5
6
  /**
6
7
  * The Bottom symbol to represent the Bottom element of complete lattices (e.g. of abstract domains).
7
8
  */
8
9
  export declare const Bottom: unique symbol;
10
+ export declare const BottomSymbol = "\u22A5";
9
11
  /**
10
12
  * A complete lattice with a partially ordered set, join operator (LUB), meet operator (GLB), top element, and bottom element (e.g. for abstract domains).
11
13
  * @template Value - Type of a lattice element representing a value (may exclude `Top` and `Bot`)
@@ -1,12 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Bottom = exports.Top = void 0;
3
+ exports.BottomSymbol = exports.Bottom = exports.TopSymbol = exports.Top = void 0;
4
4
  /**
5
5
  * The Top symbol to represent the Top element of complete lattices (e.g. of abstract domains).
6
6
  */
7
7
  exports.Top = Symbol('top');
8
+ exports.TopSymbol = '⊤';
8
9
  /**
9
10
  * The Bottom symbol to represent the Bottom element of complete lattices (e.g. of abstract domains).
10
11
  */
11
12
  exports.Bottom = Symbol('bottom');
13
+ exports.BottomSymbol = '⊥';
12
14
  //# sourceMappingURL=lattice.js.map
@@ -30,7 +30,7 @@ export declare class PosIntervalDomain<Value extends PosIntervalLift = PosInterv
30
30
  /**
31
31
  * Extends the lower bound of the current abstract value down to 0.
32
32
  */
33
- extendDown(): this;
33
+ widenDown(): this;
34
34
  isTop(): this is PosIntervalDomain<PosIntervalTop>;
35
35
  }
36
36
  export {};
@@ -84,7 +84,7 @@ class PosIntervalDomain extends interval_domain_1.IntervalDomain {
84
84
  /**
85
85
  * Extends the lower bound of the current abstract value down to 0.
86
86
  */
87
- extendDown() {
87
+ widenDown() {
88
88
  if (this.value === lattice_1.Bottom) {
89
89
  return this.bottom();
90
90
  }
@@ -10,7 +10,7 @@ export interface SatisfiableDomain<T> {
10
10
  satisfies(value: T): Ternary;
11
11
  }
12
12
  /**
13
- * Represents the different types of numerical comparators for satifiability checks for an abstract domain.
13
+ * Represents the different types of numerical comparators for satisfiability checks for an abstract domain.
14
14
  */
15
15
  export declare enum NumericalComparator {
16
16
  Equal = 0,
@@ -20,7 +20,7 @@ export declare enum NumericalComparator {
20
20
  GreaterOrEqual = 4
21
21
  }
22
22
  /**
23
- * Represents the different types of set comparators for satifiability checks for an abstract domain.
23
+ * Represents the different types of set comparators for satisfiability checks for an abstract domain.
24
24
  */
25
25
  export declare enum SetComparator {
26
26
  Equal = 0,
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SetComparator = exports.NumericalComparator = void 0;
4
4
  /**
5
- * Represents the different types of numerical comparators for satifiability checks for an abstract domain.
5
+ * Represents the different types of numerical comparators for satisfiability checks for an abstract domain.
6
6
  */
7
7
  var NumericalComparator;
8
8
  (function (NumericalComparator) {
@@ -13,7 +13,7 @@ var NumericalComparator;
13
13
  NumericalComparator[NumericalComparator["GreaterOrEqual"] = 4] = "GreaterOrEqual";
14
14
  })(NumericalComparator || (exports.NumericalComparator = NumericalComparator = {}));
15
15
  /**
16
- * Represents the different types of set comparators for satifiability checks for an abstract domain.
16
+ * Represents the different types of set comparators for satisfiability checks for an abstract domain.
17
17
  */
18
18
  var SetComparator;
19
19
  (function (SetComparator) {
@@ -0,0 +1,104 @@
1
+ import { Ternary } from '../../util/logic';
2
+ import { AbstractDomain } from './abstract-domain';
3
+ import { Bottom, Top } from './lattice';
4
+ import type { SatisfiableDomain } from './satisfiable-domain';
5
+ import { SetComparator } from './satisfiable-domain';
6
+ /** The Top element of the set range domain with an empty set as minimum set and {@link Top} as range set */
7
+ export declare const SetRangeTop: {
8
+ readonly min: Set<never>;
9
+ readonly range: typeof Top;
10
+ };
11
+ /** The type of the actual values of the set range domain as tuple with a minimum set and range set of additional possible values (i.e. `[{"id","name"}, ∅]`, or `[{"id"}, {"score"}]`) */
12
+ type SetRangeValue<T> = {
13
+ readonly min: ReadonlySet<T>;
14
+ readonly range: ReadonlySet<T> | typeof Top;
15
+ };
16
+ /** The type of the Top element of the set range domain as tuple with the empty set as minimum set and {@link Top} as range set (i.e. `[∅, Top]`) */
17
+ type SetRangeTop = typeof SetRangeTop;
18
+ /** The type of the Bottom element of the set range domain as {@link Bottom} */
19
+ type SetRangeBottom = typeof Bottom;
20
+ /** The type of the abstract values of the set range domain that are Top, Bottom, or actual values */
21
+ type SetRangeLift<T> = SetRangeValue<T> | SetRangeTop | SetRangeBottom;
22
+ /** The type of the actual values of the set range domain with a finite range (the range cannot be Top) */
23
+ type SetRangeFinite<T> = {
24
+ readonly min: ReadonlySet<T>;
25
+ readonly range: ReadonlySet<T>;
26
+ };
27
+ /** The type of the actual values of the set range domain as array tuple with a minimum array and range array for better readability (e.g. `[["id","name"], []]`, or `[["id"], ["score"]]`) */
28
+ export type ArrayRangeValue<T> = {
29
+ readonly min: T[];
30
+ readonly range: T[] | typeof Top;
31
+ };
32
+ /** The type for the maximum number of elements in the minimum set and maximum set of the set range domain before over-approximation */
33
+ export type SetRangeLimit = {
34
+ readonly min: number;
35
+ readonly range: number;
36
+ };
37
+ /**
38
+ * The set range abstract domain as range of possible value sets with a minimum set of values and a range of possible additional values
39
+ * (similar to an interval like structure with a lower bound and a difference to the upper bound).
40
+ * The Bottom element is defined as {@link Bottom} symbol and the Top element is defined as the range `[∅, Top]` where the minimum set is the empty set and the range is {@link Top}.
41
+ * @template T - Type of the values in the sets in the abstract domain
42
+ * @template Value - Type of the constraint in the abstract domain (Top, Bottom, or an actual value)
43
+ */
44
+ export declare class SetRangeDomain<T, Value extends SetRangeLift<T> = SetRangeLift<T>> extends AbstractDomain<ReadonlySet<T>, SetRangeValue<T>, SetRangeTop, SetRangeBottom, Value> implements SatisfiableDomain<ReadonlySet<T>> {
45
+ readonly limit: SetRangeLimit;
46
+ private readonly setType;
47
+ /**
48
+ * @param limit - A limit for the maximum number of elements to store in the minimum set and maximum set before over-approximation
49
+ * @param newSet - An optional set constructor for the domain elements if the type `T` is not storable in a HashSet
50
+ */
51
+ constructor(value: Value | ArrayRangeValue<T>, limit?: SetRangeLimit | number, setType?: typeof Set<T>);
52
+ create(value: SetRangeLift<T> | ArrayRangeValue<T>): this;
53
+ /**
54
+ * The minimum set (lower bound) of the set range representing all values that must exist (subset of {@link upper}).
55
+ */
56
+ lower(): Value extends SetRangeValue<T> ? ReadonlySet<T> : ReadonlySet<T> | typeof Bottom;
57
+ /**
58
+ * The maximum set (upper bound) of the set range representing all values that can possibly exist (union of {@link lower} and range).
59
+ */
60
+ upper(): Value extends SetRangeFinite<T> ? ReadonlySet<T> : Value extends SetRangeValue<T> ? ReadonlySet<T> | typeof Top : ReadonlySet<T> | typeof Top | typeof Bottom;
61
+ static top<T>(limit?: SetRangeLimit | number, setType?: typeof Set<T>): SetRangeDomain<T, SetRangeTop>;
62
+ static bottom<T>(limit?: SetRangeLimit | number, setType?: typeof Set<T>): SetRangeDomain<T, SetRangeBottom>;
63
+ static abstract<T>(concrete: ReadonlySet<ReadonlySet<T>> | typeof Top, limit?: SetRangeLimit | number, setType?: typeof Set<T>): SetRangeDomain<T>;
64
+ top(): this & SetRangeDomain<T, SetRangeTop>;
65
+ bottom(): this & SetRangeDomain<T, SetRangeBottom>;
66
+ equals(other: this): boolean;
67
+ leq(other: this): boolean;
68
+ join(other: SetRangeLift<T> | ArrayRangeValue<T>): this;
69
+ join(other: this): this;
70
+ meet(other: SetRangeLift<T> | ArrayRangeValue<T>): this;
71
+ meet(other: this): this;
72
+ /**
73
+ * Creates the union of this abstract value and another abstract value by creating the union of the minimum and maximum set, respectively.
74
+ */
75
+ union(other: this | SetRangeLift<T> | ArrayRangeValue<T>): this;
76
+ /**
77
+ * Creates the intersection of this abstract value and another abstract value by creating the intersection of the minimum and maximum set, respectively.
78
+ */
79
+ intersect(other: this | SetRangeLift<T> | ArrayRangeValue<T>): this;
80
+ /**
81
+ * Subtracts another abstract value from the current abstract value by removing all elements of the other abstract value from the current abstract value.
82
+ */
83
+ subtract(other: this | SetRangeLift<T> | ArrayRangeValue<T>): this;
84
+ widen(other: this): this;
85
+ narrow(other: this): this;
86
+ concretize(limit: number): ReadonlySet<ReadonlySet<T>> | typeof Top;
87
+ abstract(concrete: ReadonlySet<ReadonlySet<T>> | typeof Top): this;
88
+ satisfies(set: ReadonlySet<T> | T[], comparator?: SetComparator): Ternary;
89
+ /**
90
+ * Extends the minimum set of the current abstract value down to the empty set.
91
+ */
92
+ widenDown(): this;
93
+ /**
94
+ * Extends the maximum set of the current abstract value up to {@link Top}.
95
+ */
96
+ widenUp(): this;
97
+ toJson(): unknown;
98
+ toString(): string;
99
+ isTop(): this is SetRangeDomain<T, SetRangeTop>;
100
+ isBottom(): this is SetRangeDomain<T, SetRangeBottom>;
101
+ isValue(): this is SetRangeDomain<T, SetRangeValue<T>>;
102
+ isFinite(): this is SetRangeDomain<T, SetRangeFinite<T>>;
103
+ }
104
+ export {};
@@ -0,0 +1,406 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SetRangeDomain = exports.SetRangeTop = void 0;
4
+ const assert_1 = require("../../util/assert");
5
+ const set_1 = require("../../util/collections/set");
6
+ const logic_1 = require("../../util/logic");
7
+ const abstract_domain_1 = require("./abstract-domain");
8
+ const lattice_1 = require("./lattice");
9
+ const satisfiable_domain_1 = require("./satisfiable-domain");
10
+ /* eslint-disable @typescript-eslint/unified-signatures */
11
+ /** The Top element of the set range domain with an empty set as minimum set and {@link Top} as range set */
12
+ exports.SetRangeTop = { min: new Set(), range: lattice_1.Top };
13
+ const DefaultLimit = { min: abstract_domain_1.DEFAULT_INFERENCE_LIMIT, range: abstract_domain_1.DEFAULT_INFERENCE_LIMIT };
14
+ /**
15
+ * The set range abstract domain as range of possible value sets with a minimum set of values and a range of possible additional values
16
+ * (similar to an interval like structure with a lower bound and a difference to the upper bound).
17
+ * The Bottom element is defined as {@link Bottom} symbol and the Top element is defined as the range `[∅, Top]` where the minimum set is the empty set and the range is {@link Top}.
18
+ * @template T - Type of the values in the sets in the abstract domain
19
+ * @template Value - Type of the constraint in the abstract domain (Top, Bottom, or an actual value)
20
+ */
21
+ class SetRangeDomain extends abstract_domain_1.AbstractDomain {
22
+ limit;
23
+ setType;
24
+ /**
25
+ * @param limit - A limit for the maximum number of elements to store in the minimum set and maximum set before over-approximation
26
+ * @param newSet - An optional set constructor for the domain elements if the type `T` is not storable in a HashSet
27
+ */
28
+ constructor(value, limit = DefaultLimit, setType = Set) {
29
+ limit = typeof limit === 'number' ? { min: limit, range: limit } : limit;
30
+ if (value !== lattice_1.Bottom) {
31
+ const minSet = new setType(value.min);
32
+ const rangeSet = value.range === lattice_1.Top ? lattice_1.Top : new setType(value.range);
33
+ const minExceeds = minSet.size > limit.min;
34
+ const rangeExceeds = rangeSet === lattice_1.Top || rangeSet.size > limit.range || minSet.size + rangeSet.size > limit.min + limit.range;
35
+ const min = minExceeds ? new setType(minSet.values().take(limit.min)) : minSet;
36
+ const range = rangeExceeds ? lattice_1.Top : minSet.union(rangeSet).difference(min);
37
+ super({ min, range });
38
+ }
39
+ else {
40
+ super(value);
41
+ }
42
+ this.limit = limit;
43
+ this.setType = setType;
44
+ }
45
+ create(value) {
46
+ return new SetRangeDomain(value, this.limit, this.setType);
47
+ }
48
+ /**
49
+ * The minimum set (lower bound) of the set range representing all values that must exist (subset of {@link upper}).
50
+ */
51
+ lower() {
52
+ if (this.value === lattice_1.Bottom) {
53
+ return lattice_1.Bottom;
54
+ }
55
+ return this.value.min;
56
+ }
57
+ /**
58
+ * The maximum set (upper bound) of the set range representing all values that can possibly exist (union of {@link lower} and range).
59
+ */
60
+ upper() {
61
+ if (this.value === lattice_1.Bottom) {
62
+ return lattice_1.Bottom;
63
+ }
64
+ else if (this.value.range == lattice_1.Top) {
65
+ return lattice_1.Top;
66
+ }
67
+ return this.value.min.union(this.value.range);
68
+ }
69
+ static top(limit, setType) {
70
+ return new SetRangeDomain(exports.SetRangeTop, limit, setType);
71
+ }
72
+ static bottom(limit, setType) {
73
+ return new SetRangeDomain(lattice_1.Bottom, limit, setType);
74
+ }
75
+ static abstract(concrete, limit, setType) {
76
+ if (concrete === lattice_1.Top) {
77
+ return SetRangeDomain.top(limit, setType);
78
+ }
79
+ else if (concrete.size === 0) {
80
+ return SetRangeDomain.bottom(limit, setType);
81
+ }
82
+ const lower = concrete.values().reduce((result, set) => result.intersection(set));
83
+ const upper = concrete.values().reduce((result, set) => result.union(set));
84
+ return new SetRangeDomain({ min: lower, range: upper.difference(lower) }, limit, setType);
85
+ }
86
+ top() {
87
+ return SetRangeDomain.top(this.limit, this.setType);
88
+ }
89
+ bottom() {
90
+ return SetRangeDomain.bottom(this.limit, this.setType);
91
+ }
92
+ equals(other) {
93
+ if (this.value === other.value) {
94
+ return true;
95
+ }
96
+ else if (this.value === lattice_1.Bottom || other.value === lattice_1.Bottom || !(0, set_1.setEquals)(this.value.min, other.value.min)) {
97
+ return false;
98
+ }
99
+ else if (this.value.range === other.value.range) {
100
+ return true;
101
+ }
102
+ return this.value.range !== lattice_1.Top && other.value.range !== lattice_1.Top && (0, set_1.setEquals)(this.value.range, other.value.range);
103
+ }
104
+ leq(other) {
105
+ const thisLower = this.lower(), thisUpper = this.upper();
106
+ const otherLower = other.lower(), otherUpper = other.upper();
107
+ if (thisLower === lattice_1.Bottom || thisUpper === lattice_1.Bottom) {
108
+ return true;
109
+ }
110
+ else if (otherLower === lattice_1.Bottom || otherUpper === lattice_1.Bottom || !otherLower.isSubsetOf(thisLower)) {
111
+ return false;
112
+ }
113
+ else if (otherUpper === lattice_1.Top) {
114
+ return true;
115
+ }
116
+ return thisUpper !== lattice_1.Top && thisUpper.isSubsetOf(otherUpper);
117
+ }
118
+ join(other) {
119
+ other = other instanceof SetRangeDomain ? other : this.create(other);
120
+ const thisLower = this.lower(), thisUpper = this.upper();
121
+ const otherLower = other.lower(), otherUpper = other.upper();
122
+ if (thisLower === lattice_1.Bottom || thisUpper === lattice_1.Bottom) {
123
+ return this.create(other.value);
124
+ }
125
+ else if (otherLower === lattice_1.Bottom || otherUpper === lattice_1.Bottom) {
126
+ return this.create(this.value);
127
+ }
128
+ const joinLower = thisLower.intersection(otherLower);
129
+ let joinUpper;
130
+ if (thisUpper === lattice_1.Top || otherUpper === lattice_1.Top) {
131
+ joinUpper = lattice_1.Top;
132
+ }
133
+ else {
134
+ joinUpper = thisUpper.union(otherUpper);
135
+ }
136
+ return this.create({ min: joinLower, range: joinUpper === lattice_1.Top ? lattice_1.Top : joinUpper.difference(joinLower) });
137
+ }
138
+ meet(other) {
139
+ other = other instanceof SetRangeDomain ? other : this.create(other);
140
+ const thisLower = this.lower(), thisUpper = this.upper();
141
+ const otherLower = other.lower(), otherUpper = other.upper();
142
+ if (thisLower === lattice_1.Bottom || thisUpper === lattice_1.Bottom || otherLower === lattice_1.Bottom || otherUpper === lattice_1.Bottom) {
143
+ return this.bottom();
144
+ }
145
+ const meetLower = thisLower.union(otherLower);
146
+ let meetUpper;
147
+ if (thisUpper === lattice_1.Top) {
148
+ meetUpper = otherUpper;
149
+ }
150
+ else if (otherUpper === lattice_1.Top) {
151
+ meetUpper = thisUpper;
152
+ }
153
+ else {
154
+ meetUpper = thisUpper.intersection(otherUpper);
155
+ }
156
+ if (meetUpper !== lattice_1.Top && !meetLower.isSubsetOf(meetUpper)) {
157
+ return this.bottom();
158
+ }
159
+ return this.create({ min: meetLower, range: meetUpper === lattice_1.Top ? lattice_1.Top : meetUpper.difference(meetLower) });
160
+ }
161
+ /**
162
+ * Creates the union of this abstract value and another abstract value by creating the union of the minimum and maximum set, respectively.
163
+ */
164
+ union(other) {
165
+ other = other instanceof SetRangeDomain ? other : this.create(other);
166
+ const thisLower = this.lower(), thisUpper = this.upper();
167
+ const otherLower = other.lower(), otherUpper = other.upper();
168
+ if (thisLower === lattice_1.Bottom || thisUpper === lattice_1.Bottom) {
169
+ return this.create(other.value);
170
+ }
171
+ else if (otherLower === lattice_1.Bottom || otherUpper === lattice_1.Bottom) {
172
+ return this.create(this.value);
173
+ }
174
+ const unionLower = thisLower.union(otherLower);
175
+ let unionUpper;
176
+ if (thisUpper === lattice_1.Top || otherUpper === lattice_1.Top) {
177
+ unionUpper = lattice_1.Top;
178
+ }
179
+ else {
180
+ unionUpper = thisUpper.union(otherUpper);
181
+ }
182
+ return this.create({ min: unionLower, range: unionUpper === lattice_1.Top ? lattice_1.Top : unionUpper.difference(unionLower) });
183
+ }
184
+ /**
185
+ * Creates the intersection of this abstract value and another abstract value by creating the intersection of the minimum and maximum set, respectively.
186
+ */
187
+ intersect(other) {
188
+ other = other instanceof SetRangeDomain ? other : this.create(other);
189
+ const thisLower = this.lower(), thisUpper = this.upper();
190
+ const otherLower = other.lower(), otherUpper = other.upper();
191
+ if (thisLower === lattice_1.Bottom || thisUpper === lattice_1.Bottom || otherLower === lattice_1.Bottom || otherUpper === lattice_1.Bottom) {
192
+ return this.bottom();
193
+ }
194
+ const intersectLower = thisLower.intersection(otherLower);
195
+ let intersectUpper;
196
+ if (thisUpper === lattice_1.Top) {
197
+ intersectUpper = otherUpper;
198
+ }
199
+ else if (otherUpper === lattice_1.Top) {
200
+ intersectUpper = thisUpper;
201
+ }
202
+ else {
203
+ intersectUpper = thisUpper.intersection(otherUpper);
204
+ }
205
+ return this.create({ min: intersectLower, range: intersectUpper === lattice_1.Top ? lattice_1.Top : intersectUpper.difference(intersectLower) });
206
+ }
207
+ /**
208
+ * Subtracts another abstract value from the current abstract value by removing all elements of the other abstract value from the current abstract value.
209
+ */
210
+ subtract(other) {
211
+ other = other instanceof SetRangeDomain ? other : this.create(other);
212
+ const thisLower = this.lower(), thisUpper = this.upper();
213
+ const otherLower = other.lower(), otherUpper = other.upper();
214
+ if (thisLower === lattice_1.Bottom || thisUpper === lattice_1.Bottom) {
215
+ return this.bottom();
216
+ }
217
+ else if (otherLower === lattice_1.Bottom || otherUpper === lattice_1.Bottom) {
218
+ return this.create(this.value);
219
+ }
220
+ let subLower;
221
+ if (otherUpper === lattice_1.Top) {
222
+ subLower = new Set();
223
+ }
224
+ else {
225
+ subLower = thisLower.difference(otherUpper);
226
+ }
227
+ let subUpper;
228
+ if (thisUpper === lattice_1.Top) {
229
+ subUpper = lattice_1.Top;
230
+ }
231
+ else if (otherUpper === lattice_1.Top) {
232
+ subUpper = thisUpper.difference(otherLower);
233
+ }
234
+ else {
235
+ subUpper = thisUpper.difference(otherUpper);
236
+ }
237
+ return this.create({ min: subLower, range: subUpper === lattice_1.Top ? lattice_1.Top : subUpper.difference(subLower) });
238
+ }
239
+ widen(other) {
240
+ const thisLower = this.lower(), thisUpper = this.upper();
241
+ const otherLower = other.lower(), otherUpper = other.upper();
242
+ if (thisLower === lattice_1.Bottom || thisUpper === lattice_1.Bottom) {
243
+ return this.create(other.value);
244
+ }
245
+ else if (otherLower === lattice_1.Bottom || otherUpper === lattice_1.Bottom) {
246
+ return this.create(this.value);
247
+ }
248
+ let widenLower;
249
+ if (!thisLower.isSubsetOf(otherLower)) {
250
+ widenLower = new Set();
251
+ }
252
+ else {
253
+ widenLower = thisLower;
254
+ }
255
+ let widenUpper;
256
+ if (thisUpper === lattice_1.Top || otherUpper === lattice_1.Top || !otherUpper.isSubsetOf(thisUpper)) {
257
+ widenUpper = lattice_1.Top;
258
+ }
259
+ else {
260
+ widenUpper = thisUpper;
261
+ }
262
+ return this.create({ min: widenLower, range: widenUpper === lattice_1.Top ? lattice_1.Top : widenUpper.difference(widenLower) });
263
+ }
264
+ narrow(other) {
265
+ const thisLower = this.lower(), thisUpper = this.upper();
266
+ const otherLower = other.lower(), otherUpper = other.upper();
267
+ if (thisLower === lattice_1.Bottom || thisUpper === lattice_1.Bottom || otherLower === lattice_1.Bottom || otherUpper === lattice_1.Bottom) {
268
+ return this.bottom();
269
+ }
270
+ let meetUpper;
271
+ if (thisUpper === lattice_1.Top) {
272
+ meetUpper = otherUpper;
273
+ }
274
+ else if (otherUpper === lattice_1.Top) {
275
+ meetUpper = thisUpper;
276
+ }
277
+ else {
278
+ meetUpper = thisUpper.intersection(otherUpper);
279
+ }
280
+ if (meetUpper !== lattice_1.Top && !thisLower.union(otherLower).isSubsetOf(meetUpper)) {
281
+ return this.bottom();
282
+ }
283
+ let narrowLower;
284
+ if (thisLower.size === 0) {
285
+ narrowLower = otherLower;
286
+ }
287
+ else {
288
+ narrowLower = thisLower;
289
+ }
290
+ let narrowUpper;
291
+ if (thisUpper === lattice_1.Top) {
292
+ narrowUpper = otherUpper;
293
+ }
294
+ else {
295
+ narrowUpper = thisUpper;
296
+ }
297
+ return this.create({ min: narrowLower, range: narrowUpper === lattice_1.Top ? lattice_1.Top : narrowUpper.difference(narrowLower) });
298
+ }
299
+ concretize(limit) {
300
+ if (this.value === lattice_1.Bottom) {
301
+ return new Set();
302
+ }
303
+ else if (this.value.range === lattice_1.Top || 2 ** (this.value.range.size) > limit) {
304
+ return lattice_1.Top;
305
+ }
306
+ const subsets = [new this.setType()];
307
+ for (const element of this.value.range) {
308
+ const newSubsets = subsets.map(subset => new this.setType([...subset, element]));
309
+ for (const subset of newSubsets) {
310
+ subsets.push(subset);
311
+ }
312
+ }
313
+ return new Set(subsets.map(subset => this.value === lattice_1.Bottom ? subset : this.value.min.union(subset)));
314
+ }
315
+ abstract(concrete) {
316
+ return SetRangeDomain.abstract(concrete, this.limit);
317
+ }
318
+ satisfies(set, comparator = satisfiable_domain_1.SetComparator.Equal) {
319
+ const value = new this.setType(set);
320
+ const lower = this.lower(), upper = this.upper();
321
+ if (lower === lattice_1.Bottom || upper === lattice_1.Bottom) {
322
+ return logic_1.Ternary.Never;
323
+ }
324
+ switch (comparator) {
325
+ case satisfiable_domain_1.SetComparator.Equal: {
326
+ if (lower.isSubsetOf(value) && (upper === lattice_1.Top || value.isSubsetOf(upper))) {
327
+ return upper !== lattice_1.Top && lower.size === upper.size ? logic_1.Ternary.Always : logic_1.Ternary.Maybe;
328
+ }
329
+ return logic_1.Ternary.Never;
330
+ }
331
+ case satisfiable_domain_1.SetComparator.SubsetOrEqual: {
332
+ if (upper === lattice_1.Top || value.isSubsetOf(upper)) {
333
+ return value.isSubsetOf(lower) ? logic_1.Ternary.Always : logic_1.Ternary.Maybe;
334
+ }
335
+ return logic_1.Ternary.Never;
336
+ }
337
+ case satisfiable_domain_1.SetComparator.Subset: {
338
+ if (upper === lattice_1.Top || (value.isSubsetOf(upper) && !(0, set_1.setEquals)(value, upper))) {
339
+ return value.isSubsetOf(lower) && !(0, set_1.setEquals)(value, lower) ? logic_1.Ternary.Always : logic_1.Ternary.Maybe;
340
+ }
341
+ return logic_1.Ternary.Never;
342
+ }
343
+ default: {
344
+ (0, assert_1.assertUnreachable)(comparator);
345
+ }
346
+ }
347
+ }
348
+ /**
349
+ * Extends the minimum set of the current abstract value down to the empty set.
350
+ */
351
+ widenDown() {
352
+ const upper = this.upper();
353
+ if (upper === lattice_1.Bottom) {
354
+ return this.bottom();
355
+ }
356
+ else {
357
+ return this.create({ min: new this.setType(), range: upper });
358
+ }
359
+ }
360
+ /**
361
+ * Extends the maximum set of the current abstract value up to {@link Top}.
362
+ */
363
+ widenUp() {
364
+ const lower = this.lower();
365
+ if (lower === lattice_1.Bottom) {
366
+ return this.bottom();
367
+ }
368
+ else {
369
+ return this.create({ min: lower, range: lattice_1.Top });
370
+ }
371
+ }
372
+ toJson() {
373
+ if (this.value === lattice_1.Bottom) {
374
+ return this.value.description;
375
+ }
376
+ const min = this.value.min.values().toArray();
377
+ const range = this.value.range === lattice_1.Top ? this.value.range.description : this.value.range.values().toArray();
378
+ return { min, range };
379
+ }
380
+ toString() {
381
+ if (this.value === lattice_1.Bottom) {
382
+ return lattice_1.BottomSymbol;
383
+ }
384
+ else if (this.value.range === lattice_1.Top) {
385
+ const minString = this.value.min.values().map(abstract_domain_1.domainElementToString).toArray().join(', ');
386
+ return `[{${minString}}, ${lattice_1.TopSymbol}]`;
387
+ }
388
+ const minString = this.value.min.values().map(abstract_domain_1.domainElementToString).toArray().join(', ');
389
+ const rangeString = this.value.range.values().map(abstract_domain_1.domainElementToString).toArray().join(', ');
390
+ return `[{${minString}}, {${rangeString}}]`;
391
+ }
392
+ isTop() {
393
+ return this.value !== lattice_1.Bottom && this.value.min.size === 0 && this.value.range === lattice_1.Top;
394
+ }
395
+ isBottom() {
396
+ return this.value === lattice_1.Bottom;
397
+ }
398
+ isValue() {
399
+ return this.value !== lattice_1.Bottom;
400
+ }
401
+ isFinite() {
402
+ return this.value !== lattice_1.Bottom && this.value.range !== lattice_1.Top;
403
+ }
404
+ }
405
+ exports.SetRangeDomain = SetRangeDomain;
406
+ //# sourceMappingURL=set-range-domain.js.map
@@ -32,10 +32,10 @@ export declare class SetUpperBoundDomain<T, Value extends SetUpperBoundLift<T> =
32
32
  bottom(): this & SetUpperBoundDomain<T, SetUpperBoundBottom>;
33
33
  equals(other: this): boolean;
34
34
  leq(other: this): boolean;
35
- join(other: this): this;
36
35
  join(other: SetUpperBoundLift<T> | T[]): this;
37
- meet(other: this): this;
36
+ join(other: this): this;
38
37
  meet(other: SetUpperBoundLift<T> | T[]): this;
38
+ meet(other: this): this;
39
39
  /**
40
40
  * Subtracts another abstract value from the current abstract value by removing all elements of the other abstract value from the current abstract value.
41
41
  */
@@ -175,10 +175,10 @@ class SetUpperBoundDomain extends abstract_domain_1.AbstractDomain {
175
175
  }
176
176
  toString() {
177
177
  if (this.value === lattice_1.Top) {
178
- return '⊤';
178
+ return lattice_1.TopSymbol;
179
179
  }
180
180
  else if (this.value === lattice_1.Bottom) {
181
- return '⊥';
181
+ return lattice_1.BottomSymbol;
182
182
  }
183
183
  const string = this.value.values().map(abstract_domain_1.domainElementToString).toArray().join(', ');
184
184
  return `{${string}}`;