egglog 12.0.0__cp313-cp313t-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
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.
- egglog/__init__.py +13 -0
- egglog/bindings.cpython-313t-powerpc64-linux-gnu.so +0 -0
- egglog/bindings.pyi +887 -0
- egglog/builtins.py +1144 -0
- egglog/config.py +8 -0
- egglog/conversion.py +290 -0
- egglog/declarations.py +964 -0
- egglog/deconstruct.py +176 -0
- egglog/egraph.py +2247 -0
- egglog/egraph_state.py +978 -0
- egglog/examples/README.rst +5 -0
- egglog/examples/__init__.py +3 -0
- egglog/examples/bignum.py +32 -0
- egglog/examples/bool.py +38 -0
- egglog/examples/eqsat_basic.py +44 -0
- egglog/examples/fib.py +28 -0
- egglog/examples/higher_order_functions.py +42 -0
- egglog/examples/jointree.py +64 -0
- egglog/examples/lambda_.py +287 -0
- egglog/examples/matrix.py +175 -0
- egglog/examples/multiset.py +60 -0
- egglog/examples/ndarrays.py +144 -0
- egglog/examples/resolution.py +84 -0
- egglog/examples/schedule_demo.py +34 -0
- egglog/exp/MoA.ipynb +617 -0
- egglog/exp/__init__.py +3 -0
- egglog/exp/any_expr.py +947 -0
- egglog/exp/any_expr_example.ipynb +408 -0
- egglog/exp/array_api.py +2019 -0
- egglog/exp/array_api_jit.py +51 -0
- egglog/exp/array_api_loopnest.py +74 -0
- egglog/exp/array_api_numba.py +69 -0
- egglog/exp/array_api_program_gen.py +510 -0
- egglog/exp/program_gen.py +427 -0
- egglog/exp/siu_examples.py +32 -0
- egglog/ipython_magic.py +41 -0
- egglog/pretty.py +566 -0
- egglog/py.typed +0 -0
- egglog/runtime.py +888 -0
- egglog/thunk.py +97 -0
- egglog/type_constraint_solver.py +111 -0
- egglog/visualizer.css +1 -0
- egglog/visualizer.js +35798 -0
- egglog/visualizer_widget.py +39 -0
- egglog-12.0.0.dist-info/METADATA +93 -0
- egglog-12.0.0.dist-info/RECORD +48 -0
- egglog-12.0.0.dist-info/WHEEL +5 -0
- egglog-12.0.0.dist-info/licenses/LICENSE +21 -0
egglog/bindings.pyi
ADDED
|
@@ -0,0 +1,887 @@
|
|
|
1
|
+
from collections.abc import Callable
|
|
2
|
+
from datetime import timedelta
|
|
3
|
+
from fractions import Fraction
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from typing import Any, Generic, Protocol, TypeAlias, TypeVar, final
|
|
6
|
+
|
|
7
|
+
__all__ = [
|
|
8
|
+
"ActionCommand",
|
|
9
|
+
"AddRuleset",
|
|
10
|
+
"BiRewriteCommand",
|
|
11
|
+
"Bool",
|
|
12
|
+
"CSVPrintFunctionMode",
|
|
13
|
+
"Call",
|
|
14
|
+
"Change",
|
|
15
|
+
"Check",
|
|
16
|
+
"Constructor",
|
|
17
|
+
"CostModel",
|
|
18
|
+
"Datatype",
|
|
19
|
+
"Datatypes",
|
|
20
|
+
"DefaultPrintFunctionMode",
|
|
21
|
+
"Delete",
|
|
22
|
+
"EGraph",
|
|
23
|
+
"EggSmolError",
|
|
24
|
+
"EgglogSpan",
|
|
25
|
+
"Eq",
|
|
26
|
+
"Expr_",
|
|
27
|
+
"Extract",
|
|
28
|
+
"ExtractBest",
|
|
29
|
+
"ExtractVariants",
|
|
30
|
+
"Extractor",
|
|
31
|
+
"Fact",
|
|
32
|
+
"Fail",
|
|
33
|
+
"Float",
|
|
34
|
+
"Function",
|
|
35
|
+
"FunctionCommand",
|
|
36
|
+
"FusedIntersect",
|
|
37
|
+
"IdentSort",
|
|
38
|
+
"Include",
|
|
39
|
+
"Input",
|
|
40
|
+
"Int",
|
|
41
|
+
"Intersect",
|
|
42
|
+
"IterationReport",
|
|
43
|
+
"Let",
|
|
44
|
+
"Lit",
|
|
45
|
+
"NewSort",
|
|
46
|
+
"Output",
|
|
47
|
+
"OverallStatistics",
|
|
48
|
+
"Panic",
|
|
49
|
+
"PanicSpan",
|
|
50
|
+
"Plan",
|
|
51
|
+
"Pop",
|
|
52
|
+
"PrintAllFunctionsSize",
|
|
53
|
+
"PrintFunction",
|
|
54
|
+
"PrintFunctionOutput",
|
|
55
|
+
"PrintFunctionSize",
|
|
56
|
+
"PrintOverallStatistics",
|
|
57
|
+
"PrintSize",
|
|
58
|
+
"Push",
|
|
59
|
+
"Relation",
|
|
60
|
+
"Repeat",
|
|
61
|
+
"Rewrite",
|
|
62
|
+
"RewriteCommand",
|
|
63
|
+
"Rule",
|
|
64
|
+
"RuleCommand",
|
|
65
|
+
"RuleReport",
|
|
66
|
+
"RuleSetReport",
|
|
67
|
+
"Run",
|
|
68
|
+
"RunConfig",
|
|
69
|
+
"RunReport",
|
|
70
|
+
"RunSchedule",
|
|
71
|
+
"RunScheduleOutput",
|
|
72
|
+
"RustSpan",
|
|
73
|
+
"Saturate",
|
|
74
|
+
"Scan",
|
|
75
|
+
"Schema",
|
|
76
|
+
"Sequence",
|
|
77
|
+
"SerializedEGraph",
|
|
78
|
+
"Set",
|
|
79
|
+
"SingleScan",
|
|
80
|
+
"Sort",
|
|
81
|
+
"SrcFile",
|
|
82
|
+
"StageInfo",
|
|
83
|
+
"StageStats",
|
|
84
|
+
"String",
|
|
85
|
+
"SubVariants",
|
|
86
|
+
"Subsume",
|
|
87
|
+
"TermApp",
|
|
88
|
+
"TermDag",
|
|
89
|
+
"TermLit",
|
|
90
|
+
"TermVar",
|
|
91
|
+
"TimeOnly",
|
|
92
|
+
"Union",
|
|
93
|
+
"Unit",
|
|
94
|
+
"UnstableCombinedRuleset",
|
|
95
|
+
"UserDefined",
|
|
96
|
+
"UserDefinedCommandOutput",
|
|
97
|
+
"UserDefinedOutput",
|
|
98
|
+
"Value",
|
|
99
|
+
"Var",
|
|
100
|
+
"Variant",
|
|
101
|
+
"WithPlan",
|
|
102
|
+
]
|
|
103
|
+
|
|
104
|
+
@final
|
|
105
|
+
class SerializedEGraph:
|
|
106
|
+
@property
|
|
107
|
+
def truncated_functions(self) -> list[str]: ...
|
|
108
|
+
@property
|
|
109
|
+
def discarded_functions(self) -> list[str]: ...
|
|
110
|
+
def inline_leaves(self) -> None: ...
|
|
111
|
+
def saturate_inline_leaves(self) -> None: ...
|
|
112
|
+
def to_dot(self) -> str: ...
|
|
113
|
+
def to_json(self) -> str: ...
|
|
114
|
+
def map_ops(self, map: dict[str, str]) -> None: ...
|
|
115
|
+
def split_classes(self, egraph: EGraph, ops: set[str]) -> None: ...
|
|
116
|
+
|
|
117
|
+
@final
|
|
118
|
+
class EGraph:
|
|
119
|
+
def __new__(
|
|
120
|
+
cls, *, fact_directory: str | Path | None = None, seminaive: bool = True, record: bool = False
|
|
121
|
+
) -> EGraph: ...
|
|
122
|
+
def parse_program(self, __input: str, /, filename: str | None = None) -> list[_Command]: ...
|
|
123
|
+
def commands(self) -> str | None: ...
|
|
124
|
+
def run_program(self, *commands: _Command) -> list[_CommandOutput]: ...
|
|
125
|
+
def serialize(
|
|
126
|
+
self,
|
|
127
|
+
root_eclasses: list[_Expr],
|
|
128
|
+
*,
|
|
129
|
+
max_functions: int | None = None,
|
|
130
|
+
max_calls_per_function: int | None = None,
|
|
131
|
+
include_temporary_functions: bool = False,
|
|
132
|
+
) -> SerializedEGraph: ...
|
|
133
|
+
def set_report_level(self, level: _ReportLevel) -> None: ...
|
|
134
|
+
def lookup_function(self, name: str, key: list[Value]) -> Value | None: ...
|
|
135
|
+
def eval_expr(self, expr: _Expr) -> tuple[str, Value]: ...
|
|
136
|
+
def value_to_i64(self, v: Value) -> int: ...
|
|
137
|
+
def value_to_f64(self, v: Value) -> float: ...
|
|
138
|
+
def value_to_string(self, v: Value) -> str: ...
|
|
139
|
+
def value_to_bool(self, v: Value) -> bool: ...
|
|
140
|
+
def value_to_rational(self, v: Value) -> Fraction: ...
|
|
141
|
+
def value_to_bigint(self, v: Value) -> int: ...
|
|
142
|
+
def value_to_bigrat(self, v: Value) -> Fraction: ...
|
|
143
|
+
def value_to_pyobject(self, v: Value) -> object: ...
|
|
144
|
+
def value_to_map(self, v: Value) -> dict[Value, Value]: ...
|
|
145
|
+
def value_to_multiset(self, v: Value) -> list[Value]: ...
|
|
146
|
+
def value_to_vec(self, v: Value) -> list[Value]: ...
|
|
147
|
+
def value_to_function(self, v: Value) -> tuple[str, list[Value]]: ...
|
|
148
|
+
def value_to_set(self, v: Value) -> set[Value]: ...
|
|
149
|
+
# def dynamic_cost_model_enode_cost(self, func: str, args: list[Value]) -> int: ...
|
|
150
|
+
|
|
151
|
+
@final
|
|
152
|
+
class Value:
|
|
153
|
+
def __hash__(self) -> int: ...
|
|
154
|
+
def __eq__(self, value: object) -> bool: ...
|
|
155
|
+
def __lt__(self, other: object) -> bool: ...
|
|
156
|
+
def __le__(self, other: object) -> bool: ...
|
|
157
|
+
def __gt__(self, other: object) -> bool: ...
|
|
158
|
+
def __ge__(self, other: object) -> bool: ...
|
|
159
|
+
|
|
160
|
+
@final
|
|
161
|
+
class EggSmolError(Exception):
|
|
162
|
+
context: str
|
|
163
|
+
def __new__(cls, context: str) -> EggSmolError: ...
|
|
164
|
+
def __init__(self, /, *args: Any, **kwargs: Any) -> None: ...
|
|
165
|
+
|
|
166
|
+
##
|
|
167
|
+
# Spans
|
|
168
|
+
##
|
|
169
|
+
|
|
170
|
+
@final
|
|
171
|
+
class PanicSpan: ...
|
|
172
|
+
|
|
173
|
+
@final
|
|
174
|
+
class SrcFile:
|
|
175
|
+
name: str | None
|
|
176
|
+
contents: str
|
|
177
|
+
def __new__(cls, name: str | None, contents: str) -> SrcFile: ...
|
|
178
|
+
|
|
179
|
+
@final
|
|
180
|
+
class EgglogSpan:
|
|
181
|
+
file: SrcFile
|
|
182
|
+
i: int
|
|
183
|
+
j: int
|
|
184
|
+
def __new__(cls, file: SrcFile, i: int, j: int) -> EgglogSpan: ...
|
|
185
|
+
|
|
186
|
+
@final
|
|
187
|
+
class RustSpan:
|
|
188
|
+
file: str
|
|
189
|
+
line: int
|
|
190
|
+
column: int
|
|
191
|
+
def __new__(cls, file: str, line: int, column: int) -> RustSpan: ...
|
|
192
|
+
|
|
193
|
+
_Span: TypeAlias = PanicSpan | EgglogSpan | RustSpan
|
|
194
|
+
|
|
195
|
+
##
|
|
196
|
+
# Literals
|
|
197
|
+
##
|
|
198
|
+
|
|
199
|
+
@final
|
|
200
|
+
class Int:
|
|
201
|
+
value: int
|
|
202
|
+
def __new__(cls, value: int) -> Int: ...
|
|
203
|
+
|
|
204
|
+
@final
|
|
205
|
+
class Float:
|
|
206
|
+
value: float
|
|
207
|
+
def __new__(cls, value: float) -> Float: ...
|
|
208
|
+
|
|
209
|
+
@final
|
|
210
|
+
class String:
|
|
211
|
+
value: str
|
|
212
|
+
def __new__(cls, value: str) -> String: ...
|
|
213
|
+
|
|
214
|
+
@final
|
|
215
|
+
class Unit: ...
|
|
216
|
+
|
|
217
|
+
@final
|
|
218
|
+
class Bool:
|
|
219
|
+
value: bool
|
|
220
|
+
def __new__(cls, value: bool) -> Bool: ...
|
|
221
|
+
|
|
222
|
+
_Literal: TypeAlias = Int | Float | String | Bool | Unit
|
|
223
|
+
|
|
224
|
+
##
|
|
225
|
+
# Expressions
|
|
226
|
+
##
|
|
227
|
+
|
|
228
|
+
@final
|
|
229
|
+
class Lit:
|
|
230
|
+
span: _Span
|
|
231
|
+
value: _Literal
|
|
232
|
+
def __new__(cls, span: _Span, value: _Literal) -> Lit: ...
|
|
233
|
+
|
|
234
|
+
@final
|
|
235
|
+
class Var:
|
|
236
|
+
span: _Span
|
|
237
|
+
name: str
|
|
238
|
+
def __new__(cls, span: _Span, name: str) -> Var: ...
|
|
239
|
+
|
|
240
|
+
@final
|
|
241
|
+
class Call:
|
|
242
|
+
span: _Span
|
|
243
|
+
name: str
|
|
244
|
+
args: list[_Expr]
|
|
245
|
+
def __new__(cls, span: _Span, name: str, args: list[_Expr]) -> Call: ...
|
|
246
|
+
|
|
247
|
+
# Unions must be private becuase it is not actually exposed by the runtime library.
|
|
248
|
+
_Expr: TypeAlias = Lit | Var | Call
|
|
249
|
+
|
|
250
|
+
##
|
|
251
|
+
# Terms
|
|
252
|
+
##
|
|
253
|
+
|
|
254
|
+
@final
|
|
255
|
+
class TermLit:
|
|
256
|
+
value: _Literal
|
|
257
|
+
def __new__(cls, value: _Literal) -> TermLit: ...
|
|
258
|
+
|
|
259
|
+
@final
|
|
260
|
+
class TermVar:
|
|
261
|
+
name: str
|
|
262
|
+
def __new__(cls, name: str) -> TermVar: ...
|
|
263
|
+
|
|
264
|
+
@final
|
|
265
|
+
class TermApp:
|
|
266
|
+
name: str
|
|
267
|
+
args: list[int]
|
|
268
|
+
def __new__(cls, name: str, args: list[int]) -> TermApp: ...
|
|
269
|
+
|
|
270
|
+
_Term: TypeAlias = TermLit | TermVar | TermApp
|
|
271
|
+
|
|
272
|
+
##
|
|
273
|
+
# Facts
|
|
274
|
+
##
|
|
275
|
+
|
|
276
|
+
@final
|
|
277
|
+
class Eq:
|
|
278
|
+
span: _Span
|
|
279
|
+
left: _Expr
|
|
280
|
+
right: _Expr
|
|
281
|
+
def __new__(cls, span: _Span, left: _Expr, right: _Expr) -> Eq: ...
|
|
282
|
+
|
|
283
|
+
@final
|
|
284
|
+
class Fact:
|
|
285
|
+
expr: _Expr
|
|
286
|
+
def __new__(cls, expr: _Expr) -> Fact: ...
|
|
287
|
+
|
|
288
|
+
_Fact: TypeAlias = Fact | Eq
|
|
289
|
+
|
|
290
|
+
##
|
|
291
|
+
# Change
|
|
292
|
+
##
|
|
293
|
+
|
|
294
|
+
@final
|
|
295
|
+
class Delete: ...
|
|
296
|
+
|
|
297
|
+
@final
|
|
298
|
+
class Subsume: ...
|
|
299
|
+
|
|
300
|
+
_Change: TypeAlias = Delete | Subsume
|
|
301
|
+
|
|
302
|
+
##
|
|
303
|
+
# Actions
|
|
304
|
+
##
|
|
305
|
+
|
|
306
|
+
@final
|
|
307
|
+
class Let:
|
|
308
|
+
span: _Span
|
|
309
|
+
lhs: str
|
|
310
|
+
rhs: _Expr
|
|
311
|
+
def __new__(cls, span: _Span, lhs: str, rhs: _Expr) -> Let: ...
|
|
312
|
+
|
|
313
|
+
@final
|
|
314
|
+
class Set:
|
|
315
|
+
span: _Span
|
|
316
|
+
lhs: str
|
|
317
|
+
args: list[_Expr]
|
|
318
|
+
rhs: _Expr
|
|
319
|
+
def __new__(cls, span: _Span, lhs: str, args: list[_Expr], rhs: _Expr) -> Set: ...
|
|
320
|
+
|
|
321
|
+
@final
|
|
322
|
+
class Change:
|
|
323
|
+
span: _Span
|
|
324
|
+
change: _Change
|
|
325
|
+
sym: str
|
|
326
|
+
args: list[_Expr]
|
|
327
|
+
def __new__(cls, span: _Span, change: _Change, sym: str, args: list[_Expr]) -> Change: ...
|
|
328
|
+
|
|
329
|
+
@final
|
|
330
|
+
class Union:
|
|
331
|
+
span: _Span
|
|
332
|
+
lhs: _Expr
|
|
333
|
+
rhs: _Expr
|
|
334
|
+
def __new__(cls, span: _Span, lhs: _Expr, rhs: _Expr) -> Union: ...
|
|
335
|
+
|
|
336
|
+
@final
|
|
337
|
+
class Panic:
|
|
338
|
+
span: _Span
|
|
339
|
+
msg: str
|
|
340
|
+
def __new__(cls, span: _Span, msg: str) -> Panic: ...
|
|
341
|
+
|
|
342
|
+
@final
|
|
343
|
+
class Expr_: # noqa: N801
|
|
344
|
+
span: _Span
|
|
345
|
+
expr: _Expr
|
|
346
|
+
def __new__(cls, span: _Span, expr: _Expr) -> Expr_: ...
|
|
347
|
+
|
|
348
|
+
_Action: TypeAlias = Let | Set | Change | Union | Panic | Expr_
|
|
349
|
+
|
|
350
|
+
##
|
|
351
|
+
# Other Structs
|
|
352
|
+
##
|
|
353
|
+
|
|
354
|
+
@final
|
|
355
|
+
class Variant:
|
|
356
|
+
def __new__(
|
|
357
|
+
cls, span: _Span, name: str, types: list[str], cost: int | None = ..., unextractable: bool = ...
|
|
358
|
+
) -> Variant: ...
|
|
359
|
+
|
|
360
|
+
span: _Span
|
|
361
|
+
name: str
|
|
362
|
+
types: list[str]
|
|
363
|
+
cost: int | None
|
|
364
|
+
unextractable: bool
|
|
365
|
+
|
|
366
|
+
@final
|
|
367
|
+
class Schema:
|
|
368
|
+
input: list[str]
|
|
369
|
+
output: str
|
|
370
|
+
def __new__(cls, input: list[str], output: str) -> Schema: ...
|
|
371
|
+
|
|
372
|
+
@final
|
|
373
|
+
class Rule:
|
|
374
|
+
span: _Span
|
|
375
|
+
head: list[_Action]
|
|
376
|
+
body: list[_Fact]
|
|
377
|
+
name: str
|
|
378
|
+
ruleset: str
|
|
379
|
+
def __new__(cls, span: _Span, head: list[_Action], body: list[_Fact], name: str, ruleset: str) -> Rule: ...
|
|
380
|
+
|
|
381
|
+
@final
|
|
382
|
+
class Rewrite:
|
|
383
|
+
span: _Span
|
|
384
|
+
lhs: _Expr
|
|
385
|
+
rhs: _Expr
|
|
386
|
+
conditions: list[_Fact]
|
|
387
|
+
|
|
388
|
+
def __new__(cls, span: _Span, lhs: _Expr, rhs: _Expr, conditions: list[_Fact] = ...) -> Rewrite: ...
|
|
389
|
+
|
|
390
|
+
@final
|
|
391
|
+
class RunConfig:
|
|
392
|
+
ruleset: str
|
|
393
|
+
until: list[_Fact] | None
|
|
394
|
+
def __new__(cls, ruleset: str, until: list[_Fact] | None = ...) -> RunConfig: ...
|
|
395
|
+
|
|
396
|
+
@final
|
|
397
|
+
class IdentSort:
|
|
398
|
+
ident: str
|
|
399
|
+
sort: str
|
|
400
|
+
def __new__(cls, ident: str, sort: str) -> IdentSort: ...
|
|
401
|
+
|
|
402
|
+
@final
|
|
403
|
+
class UserDefinedCommandOutput: ...
|
|
404
|
+
|
|
405
|
+
@final
|
|
406
|
+
class SingleScan:
|
|
407
|
+
atom: str
|
|
408
|
+
column: tuple[str, int]
|
|
409
|
+
|
|
410
|
+
def __new__(cls, atom: str, column: tuple[str, int]) -> SingleScan: ...
|
|
411
|
+
|
|
412
|
+
@final
|
|
413
|
+
class Scan:
|
|
414
|
+
atom: str
|
|
415
|
+
columns: list[tuple[str, int]]
|
|
416
|
+
|
|
417
|
+
def __new__(cls, atom: str, columns: list[tuple[str, int]]) -> Scan: ...
|
|
418
|
+
|
|
419
|
+
@final
|
|
420
|
+
class StageStats:
|
|
421
|
+
num_candidates: int
|
|
422
|
+
num_succeeded: int
|
|
423
|
+
|
|
424
|
+
def __new__(cls, num_candidates: int, num_succeeded: int) -> StageStats: ...
|
|
425
|
+
|
|
426
|
+
@final
|
|
427
|
+
class TimeOnly:
|
|
428
|
+
def __new__(cls) -> TimeOnly: ...
|
|
429
|
+
|
|
430
|
+
@final
|
|
431
|
+
class WithPlan:
|
|
432
|
+
def __new__(cls) -> WithPlan: ...
|
|
433
|
+
|
|
434
|
+
@final
|
|
435
|
+
class StageInfo:
|
|
436
|
+
def __new__(cls) -> StageInfo: ...
|
|
437
|
+
|
|
438
|
+
_ReportLevel: TypeAlias = TimeOnly | WithPlan | StageInfo
|
|
439
|
+
|
|
440
|
+
@final
|
|
441
|
+
class Intersect:
|
|
442
|
+
scans: list[SingleScan]
|
|
443
|
+
|
|
444
|
+
def __new__(cls, scans: list[SingleScan]) -> Intersect: ...
|
|
445
|
+
|
|
446
|
+
@final
|
|
447
|
+
class FusedIntersect:
|
|
448
|
+
cover: Scan
|
|
449
|
+
to_intersect: list[Scan]
|
|
450
|
+
|
|
451
|
+
def __new__(cls, cover: Scan, to_intersect: list[Scan]) -> FusedIntersect: ...
|
|
452
|
+
|
|
453
|
+
_Stage: TypeAlias = Intersect | FusedIntersect
|
|
454
|
+
|
|
455
|
+
@final
|
|
456
|
+
class Plan:
|
|
457
|
+
stages: list[tuple[_Stage, StageStats | None, list[int]]]
|
|
458
|
+
|
|
459
|
+
def __new__(cls, stages: list[tuple[_Stage, StageStats | None, list[int]]]) -> Plan: ...
|
|
460
|
+
|
|
461
|
+
@final
|
|
462
|
+
class RuleReport:
|
|
463
|
+
plan: Plan | None
|
|
464
|
+
search_and_apply_time: timedelta
|
|
465
|
+
num_matches: int
|
|
466
|
+
|
|
467
|
+
def __new__(cls, plan: Plan | None, search_and_apply_time: timedelta, num_matches: int) -> RuleReport: ...
|
|
468
|
+
|
|
469
|
+
@final
|
|
470
|
+
class RuleSetReport:
|
|
471
|
+
changed: bool
|
|
472
|
+
rule_reports: dict[str, list[RuleReport]]
|
|
473
|
+
search_and_apply_time: timedelta
|
|
474
|
+
merge_time: timedelta
|
|
475
|
+
|
|
476
|
+
def __new__(
|
|
477
|
+
cls,
|
|
478
|
+
changed: bool,
|
|
479
|
+
rule_reports: dict[str, list[RuleReport]],
|
|
480
|
+
search_and_apply_time: timedelta,
|
|
481
|
+
merge_time: timedelta,
|
|
482
|
+
) -> RuleSetReport: ...
|
|
483
|
+
|
|
484
|
+
@final
|
|
485
|
+
class IterationReport:
|
|
486
|
+
rule_set_report: RuleSetReport
|
|
487
|
+
rebuild_time: timedelta
|
|
488
|
+
|
|
489
|
+
def __new__(cls, rule_set_report: RuleSetReport, rebuild_time: timedelta) -> IterationReport: ...
|
|
490
|
+
|
|
491
|
+
@final
|
|
492
|
+
class Function:
|
|
493
|
+
name: str
|
|
494
|
+
|
|
495
|
+
@final
|
|
496
|
+
class RunReport:
|
|
497
|
+
iterations: list[IterationReport]
|
|
498
|
+
updated: bool
|
|
499
|
+
search_and_apply_time_per_rule: dict[str, timedelta]
|
|
500
|
+
num_matches_per_rule: dict[str, int]
|
|
501
|
+
search_and_apply_time_per_ruleset: dict[str, timedelta]
|
|
502
|
+
merge_time_per_ruleset: dict[str, timedelta]
|
|
503
|
+
rebuild_time_per_ruleset: dict[str, timedelta]
|
|
504
|
+
|
|
505
|
+
def __new__(
|
|
506
|
+
cls,
|
|
507
|
+
iterations: list[IterationReport],
|
|
508
|
+
updated: bool,
|
|
509
|
+
search_and_apply_time_per_rule: dict[str, timedelta],
|
|
510
|
+
num_matches_per_rule: dict[str, int],
|
|
511
|
+
search_and_apply_time_per_ruleset: dict[str, timedelta],
|
|
512
|
+
merge_time_per_ruleset: dict[str, timedelta],
|
|
513
|
+
rebuild_time_per_ruleset: dict[str, timedelta],
|
|
514
|
+
) -> RunReport: ...
|
|
515
|
+
|
|
516
|
+
##
|
|
517
|
+
# Command Outputs
|
|
518
|
+
##
|
|
519
|
+
|
|
520
|
+
@final
|
|
521
|
+
class PrintFunctionSize:
|
|
522
|
+
size: int
|
|
523
|
+
def __new__(cls, size: int) -> PrintFunctionSize: ...
|
|
524
|
+
|
|
525
|
+
@final
|
|
526
|
+
class PrintAllFunctionsSize:
|
|
527
|
+
sizes: list[tuple[str, int]]
|
|
528
|
+
def __new__(cls, sizes: list[tuple[str, int]]) -> PrintAllFunctionsSize: ...
|
|
529
|
+
|
|
530
|
+
@final
|
|
531
|
+
class ExtractVariants:
|
|
532
|
+
termdag: TermDag
|
|
533
|
+
terms: list[_Term]
|
|
534
|
+
def __new__(cls, termdag: TermDag, terms: list[_Term]) -> ExtractVariants: ...
|
|
535
|
+
|
|
536
|
+
@final
|
|
537
|
+
class ExtractBest:
|
|
538
|
+
termdag: TermDag
|
|
539
|
+
cost: int
|
|
540
|
+
term: _Term
|
|
541
|
+
def __new__(cls, termdag: TermDag, cost: int, term: _Term) -> ExtractBest: ...
|
|
542
|
+
|
|
543
|
+
@final
|
|
544
|
+
class OverallStatistics:
|
|
545
|
+
report: RunReport
|
|
546
|
+
def __new__(cls, report: RunReport) -> OverallStatistics: ...
|
|
547
|
+
|
|
548
|
+
@final
|
|
549
|
+
class RunScheduleOutput:
|
|
550
|
+
report: RunReport
|
|
551
|
+
def __new__(cls, report: RunReport) -> RunScheduleOutput: ...
|
|
552
|
+
|
|
553
|
+
@final
|
|
554
|
+
class PrintFunctionOutput:
|
|
555
|
+
function: Function
|
|
556
|
+
termdag: TermDag
|
|
557
|
+
terms: list[tuple[_Term, _Term]]
|
|
558
|
+
mode: _PrintFunctionMode
|
|
559
|
+
def __new__(
|
|
560
|
+
cls, function: Function, termdag: TermDag, terms: list[tuple[_Term, _Term]], mode: _PrintFunctionMode
|
|
561
|
+
) -> PrintFunctionOutput: ...
|
|
562
|
+
|
|
563
|
+
@final
|
|
564
|
+
class UserDefinedOutput:
|
|
565
|
+
output: UserDefinedCommandOutput
|
|
566
|
+
def __new__(cls, output: UserDefinedCommandOutput) -> UserDefinedOutput: ...
|
|
567
|
+
|
|
568
|
+
_CommandOutput: TypeAlias = (
|
|
569
|
+
PrintFunctionSize
|
|
570
|
+
| PrintAllFunctionsSize
|
|
571
|
+
| ExtractVariants
|
|
572
|
+
| ExtractBest
|
|
573
|
+
| OverallStatistics
|
|
574
|
+
| RunScheduleOutput
|
|
575
|
+
| PrintFunctionOutput
|
|
576
|
+
| UserDefinedOutput
|
|
577
|
+
)
|
|
578
|
+
|
|
579
|
+
##
|
|
580
|
+
# Print Function Modes
|
|
581
|
+
##
|
|
582
|
+
|
|
583
|
+
@final
|
|
584
|
+
class DefaultPrintFunctionMode: ...
|
|
585
|
+
|
|
586
|
+
@final
|
|
587
|
+
class CSVPrintFunctionMode: ...
|
|
588
|
+
|
|
589
|
+
_PrintFunctionMode: TypeAlias = DefaultPrintFunctionMode | CSVPrintFunctionMode
|
|
590
|
+
|
|
591
|
+
##
|
|
592
|
+
# Schedules
|
|
593
|
+
##
|
|
594
|
+
|
|
595
|
+
@final
|
|
596
|
+
class Saturate:
|
|
597
|
+
span: _Span
|
|
598
|
+
schedule: _Schedule
|
|
599
|
+
def __new__(cls, span: _Span, schedule: _Schedule) -> Saturate: ...
|
|
600
|
+
|
|
601
|
+
@final
|
|
602
|
+
class Repeat:
|
|
603
|
+
span: _Span
|
|
604
|
+
length: int
|
|
605
|
+
schedule: _Schedule
|
|
606
|
+
def __new__(cls, span: _Span, length: int, schedule: _Schedule) -> Repeat: ...
|
|
607
|
+
|
|
608
|
+
@final
|
|
609
|
+
class Run:
|
|
610
|
+
span: _Span
|
|
611
|
+
config: RunConfig
|
|
612
|
+
def __new__(cls, span: _Span, config: RunConfig) -> Run: ...
|
|
613
|
+
|
|
614
|
+
@final
|
|
615
|
+
class Sequence:
|
|
616
|
+
span: _Span
|
|
617
|
+
schedules: list[_Schedule]
|
|
618
|
+
def __new__(cls, span: _Span, schedules: list[_Schedule]) -> Sequence: ...
|
|
619
|
+
|
|
620
|
+
_Schedule: TypeAlias = Saturate | Repeat | Run | Sequence
|
|
621
|
+
|
|
622
|
+
##
|
|
623
|
+
# Subdatatypes
|
|
624
|
+
##
|
|
625
|
+
|
|
626
|
+
@final
|
|
627
|
+
class SubVariants:
|
|
628
|
+
variants: list[Variant]
|
|
629
|
+
def __new__(cls, variants: list[Variant]) -> SubVariants: ...
|
|
630
|
+
|
|
631
|
+
@final
|
|
632
|
+
class NewSort:
|
|
633
|
+
name: str
|
|
634
|
+
args: list[_Expr]
|
|
635
|
+
def __new__(cls, name: str, args: list[_Expr]) -> NewSort: ...
|
|
636
|
+
|
|
637
|
+
_Subdatatypes: TypeAlias = SubVariants | NewSort
|
|
638
|
+
|
|
639
|
+
##
|
|
640
|
+
# Commands
|
|
641
|
+
##
|
|
642
|
+
|
|
643
|
+
@final
|
|
644
|
+
class Datatype:
|
|
645
|
+
span: _Span
|
|
646
|
+
name: str
|
|
647
|
+
variants: list[Variant]
|
|
648
|
+
def __new__(cls, span: _Span, name: str, variants: list[Variant]) -> Datatype: ...
|
|
649
|
+
|
|
650
|
+
@final
|
|
651
|
+
class Datatypes:
|
|
652
|
+
span: _Span
|
|
653
|
+
datatypes: list[tuple[_Span, str, _Subdatatypes]]
|
|
654
|
+
def __new__(cls, span: _Span, datatypes: list[tuple[_Span, str, _Subdatatypes]]) -> Datatypes: ...
|
|
655
|
+
|
|
656
|
+
@final
|
|
657
|
+
class Sort:
|
|
658
|
+
span: _Span
|
|
659
|
+
name: str
|
|
660
|
+
presort_and_args: tuple[str, list[_Expr]] | None
|
|
661
|
+
def __new__(cls, span: _Span, name: str, presort_and_args: tuple[str, list[_Expr]] | None) -> Sort: ...
|
|
662
|
+
|
|
663
|
+
@final
|
|
664
|
+
class FunctionCommand:
|
|
665
|
+
span: _Span
|
|
666
|
+
name: str
|
|
667
|
+
schema: Schema
|
|
668
|
+
merge: _Expr | None
|
|
669
|
+
def __new__(cls, span: _Span, name: str, schema: Schema, merge: _Expr | None) -> FunctionCommand: ...
|
|
670
|
+
|
|
671
|
+
@final
|
|
672
|
+
class AddRuleset:
|
|
673
|
+
span: _Span
|
|
674
|
+
name: str
|
|
675
|
+
def __new__(cls, span: _Span, name: str) -> AddRuleset: ...
|
|
676
|
+
|
|
677
|
+
@final
|
|
678
|
+
class RuleCommand:
|
|
679
|
+
rule: Rule
|
|
680
|
+
def __new__(cls, rule: Rule) -> RuleCommand: ...
|
|
681
|
+
|
|
682
|
+
@final
|
|
683
|
+
class RewriteCommand:
|
|
684
|
+
# TODO: Rename to ruleset
|
|
685
|
+
name: str
|
|
686
|
+
rewrite: Rewrite
|
|
687
|
+
subsume: bool
|
|
688
|
+
def __new__(cls, name: str, rewrite: Rewrite, subsume: bool) -> RewriteCommand: ...
|
|
689
|
+
|
|
690
|
+
@final
|
|
691
|
+
class BiRewriteCommand:
|
|
692
|
+
# TODO: Rename to ruleset
|
|
693
|
+
name: str
|
|
694
|
+
rewrite: Rewrite
|
|
695
|
+
def __new__(cls, name: str, rewrite: Rewrite) -> BiRewriteCommand: ...
|
|
696
|
+
|
|
697
|
+
@final
|
|
698
|
+
class ActionCommand:
|
|
699
|
+
action: _Action
|
|
700
|
+
def __new__(cls, action: _Action) -> ActionCommand: ...
|
|
701
|
+
|
|
702
|
+
@final
|
|
703
|
+
class RunSchedule:
|
|
704
|
+
schedule: _Schedule
|
|
705
|
+
def __new__(cls, schedule: _Schedule) -> RunSchedule: ...
|
|
706
|
+
|
|
707
|
+
@final
|
|
708
|
+
class Extract:
|
|
709
|
+
span: _Span
|
|
710
|
+
expr: _Expr
|
|
711
|
+
variants: _Expr
|
|
712
|
+
def __new__(cls, span: _Span, expr: _Expr, variants: _Expr) -> Extract: ...
|
|
713
|
+
|
|
714
|
+
@final
|
|
715
|
+
class Check:
|
|
716
|
+
span: _Span
|
|
717
|
+
facts: list[_Fact]
|
|
718
|
+
def __new__(cls, span: _Span, facts: list[_Fact]) -> Check: ...
|
|
719
|
+
|
|
720
|
+
@final
|
|
721
|
+
class PrintFunction:
|
|
722
|
+
span: _Span
|
|
723
|
+
name: str
|
|
724
|
+
length: int | None
|
|
725
|
+
filename: str | None
|
|
726
|
+
mode: _PrintFunctionMode
|
|
727
|
+
def __new__(
|
|
728
|
+
cls, span: _Span, name: str, length: int | None, filename: str | None, mode: _PrintFunctionMode
|
|
729
|
+
) -> PrintFunction: ...
|
|
730
|
+
|
|
731
|
+
@final
|
|
732
|
+
class PrintSize:
|
|
733
|
+
span: _Span
|
|
734
|
+
name: str | None
|
|
735
|
+
def __new__(cls, span: _Span, name: str | None) -> PrintSize: ...
|
|
736
|
+
|
|
737
|
+
@final
|
|
738
|
+
class Output:
|
|
739
|
+
span: _Span
|
|
740
|
+
file: str
|
|
741
|
+
exprs: list[_Expr]
|
|
742
|
+
def __new__(cls, span: _Span, file: str, exprs: list[_Expr]) -> Output: ...
|
|
743
|
+
|
|
744
|
+
@final
|
|
745
|
+
class Input:
|
|
746
|
+
span: _Span
|
|
747
|
+
name: str
|
|
748
|
+
file: str
|
|
749
|
+
def __new__(cls, span: _Span, name: str, file: str) -> Input: ...
|
|
750
|
+
|
|
751
|
+
@final
|
|
752
|
+
class Push:
|
|
753
|
+
length: int
|
|
754
|
+
def __new__(cls, length: int) -> Push: ...
|
|
755
|
+
|
|
756
|
+
@final
|
|
757
|
+
class Pop:
|
|
758
|
+
span: _Span
|
|
759
|
+
length: int
|
|
760
|
+
def __new__(cls, span: _Span, length: int) -> Pop: ...
|
|
761
|
+
|
|
762
|
+
@final
|
|
763
|
+
class Fail:
|
|
764
|
+
span: _Span
|
|
765
|
+
command: _Command
|
|
766
|
+
def __new__(cls, span: _Span, command: _Command) -> Fail: ...
|
|
767
|
+
|
|
768
|
+
@final
|
|
769
|
+
class Include:
|
|
770
|
+
span: _Span
|
|
771
|
+
path: str
|
|
772
|
+
def __new__(cls, span: _Span, path: str) -> Include: ...
|
|
773
|
+
|
|
774
|
+
@final
|
|
775
|
+
class Relation:
|
|
776
|
+
span: _Span
|
|
777
|
+
name: str
|
|
778
|
+
inputs: list[str]
|
|
779
|
+
|
|
780
|
+
def __new__(cls, span: _Span, name: str, inputs: list[str]) -> Relation: ...
|
|
781
|
+
|
|
782
|
+
@final
|
|
783
|
+
class Constructor:
|
|
784
|
+
span: _Span
|
|
785
|
+
name: str
|
|
786
|
+
schema: Schema
|
|
787
|
+
cost: int | None
|
|
788
|
+
unextractable: bool
|
|
789
|
+
def __new__(cls, span: _Span, name: str, schema: Schema, cost: int | None, unextractable: bool) -> Constructor: ...
|
|
790
|
+
|
|
791
|
+
@final
|
|
792
|
+
class PrintOverallStatistics:
|
|
793
|
+
span: _Span
|
|
794
|
+
file: str | None
|
|
795
|
+
|
|
796
|
+
def __new__(cls, span: _Span, file: str | None) -> PrintOverallStatistics: ...
|
|
797
|
+
|
|
798
|
+
@final
|
|
799
|
+
class UserDefined:
|
|
800
|
+
span: _Span
|
|
801
|
+
name: str
|
|
802
|
+
args: list[_Expr]
|
|
803
|
+
def __new__(cls, span: _Span, name: str, args: list[_Expr]) -> UserDefined: ...
|
|
804
|
+
|
|
805
|
+
@final
|
|
806
|
+
class UnstableCombinedRuleset:
|
|
807
|
+
span: _Span
|
|
808
|
+
name: str
|
|
809
|
+
rulesets: list[str]
|
|
810
|
+
def __new__(cls, span: _Span, name: str, rulesets: list[str]) -> UnstableCombinedRuleset: ...
|
|
811
|
+
|
|
812
|
+
_Command: TypeAlias = (
|
|
813
|
+
Datatype
|
|
814
|
+
| Datatypes
|
|
815
|
+
| Sort
|
|
816
|
+
| FunctionCommand
|
|
817
|
+
| AddRuleset
|
|
818
|
+
| RuleCommand
|
|
819
|
+
| RewriteCommand
|
|
820
|
+
| BiRewriteCommand
|
|
821
|
+
| ActionCommand
|
|
822
|
+
| RunSchedule
|
|
823
|
+
| Extract
|
|
824
|
+
| Check
|
|
825
|
+
| PrintFunction
|
|
826
|
+
| PrintSize
|
|
827
|
+
| Output
|
|
828
|
+
| Input
|
|
829
|
+
| Push
|
|
830
|
+
| Pop
|
|
831
|
+
| Fail
|
|
832
|
+
| Include
|
|
833
|
+
| Relation
|
|
834
|
+
| PrintOverallStatistics
|
|
835
|
+
| UnstableCombinedRuleset
|
|
836
|
+
| Constructor
|
|
837
|
+
| UserDefined
|
|
838
|
+
)
|
|
839
|
+
|
|
840
|
+
##
|
|
841
|
+
# TermDag
|
|
842
|
+
##
|
|
843
|
+
|
|
844
|
+
@final
|
|
845
|
+
class TermDag:
|
|
846
|
+
def size(self) -> int: ...
|
|
847
|
+
def lookup(self, node: _Term) -> int: ...
|
|
848
|
+
def get(self, id: int) -> _Term: ...
|
|
849
|
+
def app(self, sym: str, children: list[int]) -> _Term: ...
|
|
850
|
+
def lit(self, lit: _Literal) -> _Term: ...
|
|
851
|
+
def var(self, sym: str) -> _Term: ...
|
|
852
|
+
def expr_to_term(self, expr: _Expr) -> _Term: ...
|
|
853
|
+
def term_to_expr(self, term: _Term, span: _Span) -> _Expr: ...
|
|
854
|
+
def to_string(self, term: _Term) -> str: ...
|
|
855
|
+
|
|
856
|
+
##
|
|
857
|
+
# Extraction
|
|
858
|
+
##
|
|
859
|
+
class _Cost(Protocol):
|
|
860
|
+
def __lt__(self, other: _Cost) -> bool: ...
|
|
861
|
+
def __le__(self, other: _Cost) -> bool: ...
|
|
862
|
+
def __gt__(self, other: _Cost) -> bool: ...
|
|
863
|
+
def __ge__(self, other: _Cost) -> bool: ...
|
|
864
|
+
|
|
865
|
+
_COST = TypeVar("_COST", bound=_Cost)
|
|
866
|
+
|
|
867
|
+
_ENODE_COST = TypeVar("_ENODE_COST")
|
|
868
|
+
|
|
869
|
+
@final
|
|
870
|
+
class CostModel(Generic[_COST, _ENODE_COST]):
|
|
871
|
+
def __new__(
|
|
872
|
+
cls,
|
|
873
|
+
fold: Callable[[str, _ENODE_COST, list[_COST]], _COST],
|
|
874
|
+
enode_cost: Callable[[str, list[Value]], _ENODE_COST],
|
|
875
|
+
container_cost: Callable[[str, Value, list[_COST]], _COST],
|
|
876
|
+
base_value_cost: Callable[[str, Value], _COST],
|
|
877
|
+
) -> CostModel[_COST, _ENODE_COST]: ...
|
|
878
|
+
|
|
879
|
+
@final
|
|
880
|
+
class Extractor(Generic[_COST]):
|
|
881
|
+
def __new__(
|
|
882
|
+
cls, rootsorts: list[str] | None, egraph: EGraph, cost_model: CostModel[_COST, Any]
|
|
883
|
+
) -> Extractor[_COST]: ...
|
|
884
|
+
def extract_best(self, egraph: EGraph, termdag: TermDag, value: Value, sort: str) -> tuple[_COST, _Term]: ...
|
|
885
|
+
def extract_variants(
|
|
886
|
+
self, egraph: EGraph, termdag: TermDag, value: Value, nvariants: int, sort: str
|
|
887
|
+
) -> list[tuple[_COST, _Term]]: ...
|