egglog 0.4.0__cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.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.
Potentially problematic release.
This version of egglog might be problematic. Click here for more details.
- egglog/__init__.py +5 -0
- egglog/bindings.cpython-312-x86_64-linux-gnu.so +0 -0
- egglog/bindings.pyi +415 -0
- egglog/builtins.py +345 -0
- egglog/config.py +8 -0
- egglog/declarations.py +934 -0
- egglog/egraph.py +1041 -0
- egglog/examples/README.rst +5 -0
- egglog/examples/__init__.py +0 -0
- egglog/examples/eqsat_basic.py +43 -0
- egglog/examples/fib.py +28 -0
- egglog/examples/lambda.py +310 -0
- egglog/examples/matrix.py +184 -0
- egglog/examples/ndarrays.py +159 -0
- egglog/examples/resolution.py +84 -0
- egglog/examples/schedule_demo.py +33 -0
- egglog/ipython_magic.py +40 -0
- egglog/monkeypatch.py +33 -0
- egglog/py.typed +0 -0
- egglog/runtime.py +304 -0
- egglog/type_constraint_solver.py +79 -0
- egglog-0.4.0.dist-info/METADATA +53 -0
- egglog-0.4.0.dist-info/RECORD +25 -0
- egglog-0.4.0.dist-info/WHEEL +4 -0
- egglog-0.4.0.dist-info/license_files/LICENSE +21 -0
egglog/__init__.py
ADDED
|
Binary file
|
egglog/bindings.pyi
ADDED
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
from datetime import timedelta
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
from typing import Optional
|
|
4
|
+
|
|
5
|
+
from typing_extensions import final
|
|
6
|
+
|
|
7
|
+
HIGH_COST: int
|
|
8
|
+
|
|
9
|
+
@final
|
|
10
|
+
class EGraph:
|
|
11
|
+
def __init__(self, fact_directory: str | Path | None = None, seminaive=True) -> None: ...
|
|
12
|
+
def parse_program(self, __input: str, /) -> list[_Command]: ...
|
|
13
|
+
def run_program(self, *commands: _Command) -> list[str]: ...
|
|
14
|
+
def extract_report(self) -> Optional[ExtractReport]: ...
|
|
15
|
+
def run_report(self) -> Optional[RunReport]: ...
|
|
16
|
+
def to_graphviz_string(self) -> str: ...
|
|
17
|
+
|
|
18
|
+
@final
|
|
19
|
+
class EggSmolError(Exception):
|
|
20
|
+
context: str
|
|
21
|
+
|
|
22
|
+
##
|
|
23
|
+
# Literals
|
|
24
|
+
##
|
|
25
|
+
|
|
26
|
+
@final
|
|
27
|
+
class Int:
|
|
28
|
+
def __init__(self, value: int) -> None: ...
|
|
29
|
+
value: int
|
|
30
|
+
|
|
31
|
+
@final
|
|
32
|
+
class F64:
|
|
33
|
+
value: float
|
|
34
|
+
def __init__(self, value: float) -> None: ...
|
|
35
|
+
|
|
36
|
+
@final
|
|
37
|
+
class String:
|
|
38
|
+
def __init__(self, value: str) -> None: ...
|
|
39
|
+
value: str
|
|
40
|
+
|
|
41
|
+
@final
|
|
42
|
+
class Unit:
|
|
43
|
+
def __init__(self) -> None: ...
|
|
44
|
+
|
|
45
|
+
_Literal = Int | F64 | String | Unit
|
|
46
|
+
|
|
47
|
+
@final
|
|
48
|
+
class Lit:
|
|
49
|
+
def __init__(self, value: _Literal) -> None: ...
|
|
50
|
+
value: _Literal
|
|
51
|
+
|
|
52
|
+
@final
|
|
53
|
+
class Var:
|
|
54
|
+
def __init__(self, name: str) -> None: ...
|
|
55
|
+
name: str
|
|
56
|
+
|
|
57
|
+
@final
|
|
58
|
+
class Call:
|
|
59
|
+
def __init__(self, name: str, args: list[_Expr]) -> None: ...
|
|
60
|
+
name: str
|
|
61
|
+
args: list[_Expr]
|
|
62
|
+
|
|
63
|
+
# Unions must be private becuase it is not actually exposed by the runtime library.
|
|
64
|
+
_Expr = Lit | Var | Call
|
|
65
|
+
|
|
66
|
+
##
|
|
67
|
+
# Facts
|
|
68
|
+
##
|
|
69
|
+
|
|
70
|
+
@final
|
|
71
|
+
class Eq:
|
|
72
|
+
def __init__(self, exprs: list[_Expr]) -> None: ...
|
|
73
|
+
exprs: list[_Expr]
|
|
74
|
+
|
|
75
|
+
@final
|
|
76
|
+
class Fact:
|
|
77
|
+
def __init__(self, expr: _Expr) -> None: ...
|
|
78
|
+
expr: _Expr
|
|
79
|
+
|
|
80
|
+
_Fact = Fact | Eq
|
|
81
|
+
|
|
82
|
+
##
|
|
83
|
+
# Actions
|
|
84
|
+
##
|
|
85
|
+
|
|
86
|
+
@final
|
|
87
|
+
class Let:
|
|
88
|
+
def __init__(self, lhs: str, rhs: _Expr) -> None: ...
|
|
89
|
+
lhs: str
|
|
90
|
+
rhs: _Expr
|
|
91
|
+
|
|
92
|
+
@final
|
|
93
|
+
class Set:
|
|
94
|
+
def __init__(self, lhs: str, args: list[_Expr], rhs: _Expr) -> None: ...
|
|
95
|
+
lhs: str
|
|
96
|
+
args: list[_Expr]
|
|
97
|
+
rhs: _Expr
|
|
98
|
+
|
|
99
|
+
@final
|
|
100
|
+
class SetNoTrack:
|
|
101
|
+
def __init__(self, lhs: str, args: list[_Expr], rhs: _Expr) -> None: ...
|
|
102
|
+
lhs: str
|
|
103
|
+
args: list[_Expr]
|
|
104
|
+
rhs: _Expr
|
|
105
|
+
|
|
106
|
+
@final
|
|
107
|
+
class Delete:
|
|
108
|
+
sym: str
|
|
109
|
+
args: list[_Expr]
|
|
110
|
+
def __init__(self, sym: str, args: list[_Expr]) -> None: ...
|
|
111
|
+
|
|
112
|
+
@final
|
|
113
|
+
class Union:
|
|
114
|
+
def __init__(self, lhs: _Expr, rhs: _Expr) -> None: ...
|
|
115
|
+
lhs: _Expr
|
|
116
|
+
rhs: _Expr
|
|
117
|
+
|
|
118
|
+
@final
|
|
119
|
+
class Panic:
|
|
120
|
+
def __init__(self, msg: str) -> None: ...
|
|
121
|
+
msg: str
|
|
122
|
+
|
|
123
|
+
@final
|
|
124
|
+
class Expr_:
|
|
125
|
+
def __init__(self, expr: _Expr) -> None: ...
|
|
126
|
+
expr: _Expr
|
|
127
|
+
|
|
128
|
+
_Action = Let | Set | SetNoTrack | Delete | Union | Panic | Expr_
|
|
129
|
+
|
|
130
|
+
##
|
|
131
|
+
# Other Structs
|
|
132
|
+
##
|
|
133
|
+
|
|
134
|
+
@final
|
|
135
|
+
class FunctionDecl:
|
|
136
|
+
name: str
|
|
137
|
+
schema: Schema
|
|
138
|
+
default: _Expr | None
|
|
139
|
+
merge: _Expr | None
|
|
140
|
+
merge_action: list[_Action]
|
|
141
|
+
cost: int | None
|
|
142
|
+
def __init__(
|
|
143
|
+
self,
|
|
144
|
+
name: str,
|
|
145
|
+
schema: Schema,
|
|
146
|
+
default: _Expr | None = None,
|
|
147
|
+
merge: _Expr | None = None,
|
|
148
|
+
merge_action: list[_Action] = [],
|
|
149
|
+
cost: int | None = None,
|
|
150
|
+
) -> None: ...
|
|
151
|
+
|
|
152
|
+
@final
|
|
153
|
+
class Variant:
|
|
154
|
+
def __init__(self, name: str, types: list[str], cost: int | None = None) -> None: ...
|
|
155
|
+
name: str
|
|
156
|
+
types: list[str]
|
|
157
|
+
cost: int | None
|
|
158
|
+
|
|
159
|
+
@final
|
|
160
|
+
class Schema:
|
|
161
|
+
input: list[str]
|
|
162
|
+
output: str
|
|
163
|
+
def __init__(self, input: list[str], output: str) -> None: ...
|
|
164
|
+
|
|
165
|
+
@final
|
|
166
|
+
class Rule:
|
|
167
|
+
head: list[_Action]
|
|
168
|
+
body: list[_Fact]
|
|
169
|
+
def __init__(self, head: list[_Action], body: list[_Fact]) -> None: ...
|
|
170
|
+
|
|
171
|
+
@final
|
|
172
|
+
class Rewrite:
|
|
173
|
+
lhs: _Expr
|
|
174
|
+
rhs: _Expr
|
|
175
|
+
conditions: list[_Fact]
|
|
176
|
+
|
|
177
|
+
def __init__(self, lhs: _Expr, rhs: _Expr, conditions: list[_Fact] = []) -> None: ...
|
|
178
|
+
|
|
179
|
+
@final
|
|
180
|
+
class RunConfig:
|
|
181
|
+
ruleset: str
|
|
182
|
+
limit: int
|
|
183
|
+
until: Optional[list[_Fact]]
|
|
184
|
+
def __init__(self, ruleset: str, limit: int, until: Optional[list[_Fact]] = None) -> None: ...
|
|
185
|
+
|
|
186
|
+
@final
|
|
187
|
+
class IdentSort:
|
|
188
|
+
ident: str
|
|
189
|
+
sort: str
|
|
190
|
+
def __init__(self, ident: str, sort: str) -> None: ...
|
|
191
|
+
|
|
192
|
+
@final
|
|
193
|
+
class RunReport:
|
|
194
|
+
updated: bool
|
|
195
|
+
search_time: timedelta
|
|
196
|
+
apply_time: timedelta
|
|
197
|
+
rebuild_time: timedelta
|
|
198
|
+
|
|
199
|
+
def __init__(
|
|
200
|
+
self,
|
|
201
|
+
updated: bool,
|
|
202
|
+
search_time: timedelta,
|
|
203
|
+
apply_time: timedelta,
|
|
204
|
+
rebuild_time: timedelta,
|
|
205
|
+
) -> None: ...
|
|
206
|
+
|
|
207
|
+
@final
|
|
208
|
+
class ExtractReport:
|
|
209
|
+
cost: int
|
|
210
|
+
expr: _Expr
|
|
211
|
+
variants: list[_Expr]
|
|
212
|
+
|
|
213
|
+
def __init__(self, cost: int, expr: _Expr, variants: list[_Expr]) -> None: ...
|
|
214
|
+
|
|
215
|
+
##
|
|
216
|
+
# Schedules
|
|
217
|
+
##
|
|
218
|
+
|
|
219
|
+
@final
|
|
220
|
+
class Saturate:
|
|
221
|
+
schedule: _Schedule
|
|
222
|
+
def __init__(self, schedule: _Schedule) -> None: ...
|
|
223
|
+
|
|
224
|
+
@final
|
|
225
|
+
class Repeat:
|
|
226
|
+
length: int
|
|
227
|
+
schedule: _Schedule
|
|
228
|
+
def __init__(self, length: int, schedule: _Schedule) -> None: ...
|
|
229
|
+
|
|
230
|
+
@final
|
|
231
|
+
class Run:
|
|
232
|
+
config: RunConfig
|
|
233
|
+
def __init__(self, config: RunConfig) -> None: ...
|
|
234
|
+
|
|
235
|
+
@final
|
|
236
|
+
class Sequence:
|
|
237
|
+
schedules: list[_Schedule]
|
|
238
|
+
def __init__(self, schedules: list[_Schedule]) -> None: ...
|
|
239
|
+
|
|
240
|
+
_Schedule = Saturate | Repeat | Run | Sequence
|
|
241
|
+
|
|
242
|
+
##
|
|
243
|
+
# Commands
|
|
244
|
+
##
|
|
245
|
+
|
|
246
|
+
@final
|
|
247
|
+
class SetOption:
|
|
248
|
+
name: str
|
|
249
|
+
value: _Expr
|
|
250
|
+
def __init__(self, name: str, value: _Expr) -> None: ...
|
|
251
|
+
|
|
252
|
+
@final
|
|
253
|
+
class Datatype:
|
|
254
|
+
name: str
|
|
255
|
+
variants: list[Variant]
|
|
256
|
+
def __init__(self, name: str, variants: list[Variant]) -> None: ...
|
|
257
|
+
|
|
258
|
+
@final
|
|
259
|
+
class Declare:
|
|
260
|
+
name: str
|
|
261
|
+
sort: str
|
|
262
|
+
def __init__(self, name: str, sort: str) -> None: ...
|
|
263
|
+
|
|
264
|
+
@final
|
|
265
|
+
class Sort:
|
|
266
|
+
name: str
|
|
267
|
+
presort_and_args: Optional[tuple[str, list[_Expr]]]
|
|
268
|
+
def __init__(self, name: str, presort_and_args: Optional[tuple[str, list[_Expr]]] = None) -> None: ...
|
|
269
|
+
|
|
270
|
+
@final
|
|
271
|
+
class Function:
|
|
272
|
+
decl: FunctionDecl
|
|
273
|
+
def __init__(self, decl: FunctionDecl) -> None: ...
|
|
274
|
+
|
|
275
|
+
@final
|
|
276
|
+
class Define:
|
|
277
|
+
name: str
|
|
278
|
+
expr: _Expr
|
|
279
|
+
cost: int | None
|
|
280
|
+
def __init__(self, name: str, expr: _Expr, cost: int | None) -> None: ...
|
|
281
|
+
|
|
282
|
+
@final
|
|
283
|
+
class AddRuleset:
|
|
284
|
+
name: str
|
|
285
|
+
def __init__(self, name: str) -> None: ...
|
|
286
|
+
|
|
287
|
+
@final
|
|
288
|
+
class RuleCommand:
|
|
289
|
+
name: str
|
|
290
|
+
ruleset: str
|
|
291
|
+
rule: Rule
|
|
292
|
+
def __init__(self, name: str, ruleset: str, rule: Rule) -> None: ...
|
|
293
|
+
|
|
294
|
+
@final
|
|
295
|
+
class RewriteCommand:
|
|
296
|
+
# TODO: Rename to ruleset
|
|
297
|
+
name: str
|
|
298
|
+
rewrite: Rewrite
|
|
299
|
+
def __init__(self, name: str, rewrite: Rewrite) -> None: ...
|
|
300
|
+
|
|
301
|
+
@final
|
|
302
|
+
class BiRewriteCommand:
|
|
303
|
+
# TODO: Rename to ruleset
|
|
304
|
+
name: str
|
|
305
|
+
rewrite: Rewrite
|
|
306
|
+
def __init__(self, name: str, rewrite: Rewrite) -> None: ...
|
|
307
|
+
|
|
308
|
+
@final
|
|
309
|
+
class ActionCommand:
|
|
310
|
+
action: _Action
|
|
311
|
+
def __init__(self, action: _Action) -> None: ...
|
|
312
|
+
|
|
313
|
+
@final
|
|
314
|
+
class RunCommand:
|
|
315
|
+
config: RunConfig
|
|
316
|
+
def __init__(self, config: RunConfig) -> None: ...
|
|
317
|
+
|
|
318
|
+
@final
|
|
319
|
+
class RunScheduleCommand:
|
|
320
|
+
schedule: _Schedule
|
|
321
|
+
def __init__(self, schedule: _Schedule) -> None: ...
|
|
322
|
+
|
|
323
|
+
@final
|
|
324
|
+
class Simplify:
|
|
325
|
+
expr: _Expr
|
|
326
|
+
config: RunConfig
|
|
327
|
+
def __init__(self, expr: _Expr, config: RunConfig) -> None: ...
|
|
328
|
+
|
|
329
|
+
@final
|
|
330
|
+
class Calc:
|
|
331
|
+
identifiers: list[IdentSort]
|
|
332
|
+
exprs: list[_Expr]
|
|
333
|
+
def __init__(self, identifiers: list[IdentSort], exprs: list[_Expr]) -> None: ...
|
|
334
|
+
|
|
335
|
+
@final
|
|
336
|
+
class Extract:
|
|
337
|
+
variants: int
|
|
338
|
+
expr: _Expr
|
|
339
|
+
def __init__(self, variants: int, expr: _Expr) -> None: ...
|
|
340
|
+
|
|
341
|
+
@final
|
|
342
|
+
class Check:
|
|
343
|
+
facts: list[_Fact]
|
|
344
|
+
def __init__(self, facts: list[_Fact]) -> None: ...
|
|
345
|
+
|
|
346
|
+
@final
|
|
347
|
+
class Print:
|
|
348
|
+
name: str
|
|
349
|
+
length: int
|
|
350
|
+
def __init__(self, name: str, length: int) -> None: ...
|
|
351
|
+
|
|
352
|
+
@final
|
|
353
|
+
class PrintSize:
|
|
354
|
+
name: str
|
|
355
|
+
def __init__(self, name: str) -> None: ...
|
|
356
|
+
|
|
357
|
+
@final
|
|
358
|
+
class Output:
|
|
359
|
+
file: str
|
|
360
|
+
exprs: list[_Expr]
|
|
361
|
+
def __init__(self, file: str, exprs: list[_Expr]) -> None: ...
|
|
362
|
+
|
|
363
|
+
@final
|
|
364
|
+
class Input:
|
|
365
|
+
name: str
|
|
366
|
+
file: str
|
|
367
|
+
def __init__(self, name: str, file: str) -> None: ...
|
|
368
|
+
|
|
369
|
+
@final
|
|
370
|
+
class Push:
|
|
371
|
+
length: int
|
|
372
|
+
def __init__(self, length: int) -> None: ...
|
|
373
|
+
|
|
374
|
+
@final
|
|
375
|
+
class Pop:
|
|
376
|
+
length: int
|
|
377
|
+
def __init__(self, length: int) -> None: ...
|
|
378
|
+
|
|
379
|
+
@final
|
|
380
|
+
class Fail:
|
|
381
|
+
command: _Command
|
|
382
|
+
def __init__(self, command: _Command) -> None: ...
|
|
383
|
+
|
|
384
|
+
@final
|
|
385
|
+
class Include:
|
|
386
|
+
path: str
|
|
387
|
+
def __init__(self, path: str) -> None: ...
|
|
388
|
+
|
|
389
|
+
_Command = (
|
|
390
|
+
SetOption
|
|
391
|
+
| Datatype
|
|
392
|
+
| Declare
|
|
393
|
+
| Sort
|
|
394
|
+
| Function
|
|
395
|
+
| Define
|
|
396
|
+
| AddRuleset
|
|
397
|
+
| RuleCommand
|
|
398
|
+
| RewriteCommand
|
|
399
|
+
| BiRewriteCommand
|
|
400
|
+
| ActionCommand
|
|
401
|
+
| RunCommand
|
|
402
|
+
| RunScheduleCommand
|
|
403
|
+
| Calc
|
|
404
|
+
| Simplify
|
|
405
|
+
| Extract
|
|
406
|
+
| Check
|
|
407
|
+
| Print
|
|
408
|
+
| PrintSize
|
|
409
|
+
| Output
|
|
410
|
+
| Input
|
|
411
|
+
| Push
|
|
412
|
+
| Pop
|
|
413
|
+
| Fail
|
|
414
|
+
| Include
|
|
415
|
+
)
|