Skip to content

Commit 2788404

Browse files
authored
Merge pull request #144 from JuliaSymbolics/2.0.0-DEV
Version 2.0.0
2 parents b079775 + 887179d commit 2788404

File tree

103 files changed

+4806
-6525
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+4806
-6525
lines changed

.JuliaFormatter.toml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
indent = 2
2+
margin = 120
3+
always_for_in = true
4+
whitespace_typedefs = false
5+
whitespace_ops_in_indices = true
6+
remove_extra_newlines = false
7+
import_to_using = false
8+
pipe_to_function_call = false
9+
short_to_long_function_def = false
10+
always_use_return = false
11+
whitespace_in_kwargs = true
12+
annotate_untyped_fields_with_any = false
13+
format_docstrings = false
14+
align_struct_field = true
15+
align_conditional = true
16+
align_assignment = true
17+
align_pair_arrow = true
18+
conditional_to_if = false
19+
normalize_line_endings = "auto"
20+
align_matrix = false
21+
trailing_comma = true

.github/workflows/CompatHelper.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: CompatHelper
2+
3+
on:
4+
schedule:
5+
- cron: '00 * * * *'
6+
issues:
7+
types: [opened, reopened]
8+
9+
jobs:
10+
build:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
julia-version: [1]
15+
julia-arch: [x86]
16+
os: [ubuntu-latest]
17+
steps:
18+
- uses: julia-actions/setup-julia@latest
19+
with:
20+
version: ${{ matrix.julia-version }}
21+
- name: Pkg.add("CompatHelper")
22+
run: julia -e 'using Pkg; Pkg.add("CompatHelper")'
23+
- name: CompatHelper.main()
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
run: julia -e 'using CompatHelper; CompatHelper.main()'

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@ deps/downloads/
1313
deps/usr/
1414
deps/src/
1515

16-
unreleased/
16+
wip/
1717

1818
# Build artifacts for creating documentation generated by the Documenter package
1919
docs/build/
2020
docs/site/
21+
docs/src/tutorials/*
2122

2223
# File generated by Pkg, the package manager, based on a corresponding Project.toml
2324
# It records a fixed state of all packages used by the project. As such, it should not be

ARCHITECTURE.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@
33
## Patterns Module
44

55
The `Patterns.jl` file contains type definitions for pattern matching building blocks
6-
called `Pattern`s, shared between pattern matching backends.
6+
called `AbstractPat`s, shared between pattern matching backends.
77
This module provides the type hierarchy required to build patterns, the
88
left hand side of rules.
99

1010
## Rules
1111

12-
The `Rules` folder contains
13-
- `rules.jl`: definitions for rule types used in various rewriting backends.
12+
- `Rules.jl`: definitions for rule types used in various rewriting backends.
1413
- `matchers.jl`: Classical rewriting pattern matcher.
1514

1615
# `Syntax.jl`
@@ -19,8 +18,7 @@ Contains the frontend to Rules and Patterns (`@rule` macro and `Pattern` functio
1918
# EGraphs Module
2019
Contains code for the e-graphs rewriting backend. See [egg paper](https://dl.acm.org/doi/pdf/10.1145/3434304) for an high level overview.
2120

22-
- `egraphs.jl`: Definition of `ENode`, `EClass` and `EGraph` types, EClass unioning, metadata access, defintion of EGraphs, adding, merging, rebuilding.
23-
- `ematch.jl`: E-Graph Pattern matching virtual machine interpreter.
21+
- `egraph.jl`: Definition of `ENode`, `EClass` and `EGraph` types, EClass unioning, metadata access, definition of EGraphs, adding, merging, rebuilding.
2422
- `analysis.jl`: Core algorithms for analyzing egraphs and extracting terms from egraphs.
2523
- `saturation.jl`: Core algorithm for equality saturation, rewriting on e-graphs, e-graphs search. Search phase of equality saturation. Uses multiple-dispatch on rules, Write phase of equality saturation. Application and instantiation of `Patterns` from matching/search results. Definition of `SaturationParams` type, parameters for equality saturation, Definition of equality saturation execution reports. Utility functions and macros to check equality of terms in egraphs.
2624
- `Schedulers.jl`: Module containing definition of Schedulers for equality saturation.

CITATION.bib

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,12 @@ @article{Cheli2021
1010
title = {Metatheory.jl: Fast and Elegant Algebraic Computation in Julia with Extensible Equality Saturation},
1111
journal = {Journal of Open Source Software}
1212
}
13+
14+
@misc{cheli2021automated,
15+
title={Automated Code Optimization with E-Graphs},
16+
author={Alessandro Cheli},
17+
year={2021},
18+
eprint={2112.14714},
19+
archivePrefix={arXiv},
20+
primaryClass={cs.PL}
21+
}

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ A pre-requisite for using Metatheory.jl is to know at least a little about Julia
1010

1111
## Learning Metatheory.jl
1212

13-
Our [main documentaion](https://github.com/JuliaSymbolics/Metatheory.jl/) provides an overview and some examples of using Metatheory.jl.
13+
Our [main documentation](https://github.com/JuliaSymbolics/Metatheory.jl/) provides an overview and some examples of using Metatheory.jl.
1414
The core package is hosted at [Metatheory.jl](https://github.com/JuliaSymbolics/Metatheory.jl/).
1515

1616
## Before filing an issue

NEWS.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
# 2.0
2+
- No longer dispatch against types, but instead dispatch against objects.
3+
- Faster E-Graph Analysis
4+
- Better library macros
5+
- Updated TermInterface to 0.3.3
6+
- New interface for e-graph extraction using `EGraphs.egraph_reconstruct_expression`
7+
- Simplify E-Graph Analysis Interface. Use Symbols or functions for identifying Analyses.
8+
- Remove duplicates in E-Graph analyses data.
19
## 1.2
210
- Fixes when printing patterns
311
- Can pass custom `similarterm` to `SaturationParams` by using `SaturationParams.simterm`.

Project.toml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,30 @@
11
name = "Metatheory"
22
uuid = "e9d8d322-4543-424a-9be4-0cc815abe26c"
33
authors = ["Alessandro Cheli - 0x0f0f0f <sudo-woodo3@protonmail.com>"]
4-
version = "1.3.5"
4+
version = "2.0.0"
55

66
[deps]
77
AutoHashEquals = "15f4f7f2-30c1-5605-9d31-71845cf9641f"
88
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
9-
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
109
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
11-
Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a"
1210
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
1311
TermInterface = "8ea1fca8-c5ef-4a55-8b96-4e9afe9c9a3c"
14-
ThreadsX = "ac1d9e8a-700a-412c-b207-f0111f4b6c0d"
1512
TimerOutputs = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f"
1613

1714
[compat]
1815
AutoHashEquals = "0.2.0"
1916
DataStructures = "0.18.9"
2017
DocStringExtensions = "0.8, 0.9"
21-
Parameters = "0.12"
2218
Reexport = "0.2, 1"
23-
TermInterface = "0.2.3"
24-
ThreadsX = "0.1.7"
19+
TermInterface = "0.3.3"
2520
TimerOutputs = "0.5"
26-
julia = "1"
21+
julia = "1.8"
2722

2823
[extras]
29-
Calculus = "49dc2e85-a5d0-5ad3-a950-438e2897f1b9"
30-
Catlab = "134e5e36-593f-5add-ad60-77f754baafbe"
24+
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
25+
Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306"
3126
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
3227
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
3328

3429
[targets]
35-
test = ["Test", "Calculus", "Catlab", "SafeTestsets"]
30+
test = ["Test", "Documenter", "SafeTestsets", "Literate"]

README.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,31 @@ Intuitively, Metatheory.jl transforms Julia expressions
2727
in other Julia expressions and can achieve such at both compile and run time. This allows Metatheory.jl users to perform customized and composable compiler optimizations specifically tailored to single, arbitrary Julia packages.
2828
Our library provides a simple, algebraically composable interface to help scientists in implementing and reasoning about semantics and all kinds of formal systems, by defining concise rewriting rules in pure, syntactically valid Julia on a high level of abstraction. Our implementation of equality saturation on e-graphs is based on the excellent, state-of-the-art technique implemented in the [egg](https://egraphs-good.github.io/) library, reimplemented in pure Julia.
2929

30-
## 1.0 is out!
30+
## 2.0 is out!
3131

32-
The first stable version of Metatheory.jl is out! The goal of this release is to unify the symbolic manipulation ecosystem of Julia packages. Many features have been ported from SymbolicUtils.jl. Now, Metatheory.jl can be used in place of SymbolicUtils.jl when you have no need of manipulating mathematical expressions. SymbolicUtils.jl can now completely leverage on the generic stack of rewriting features provided by Metatheory.jl, highly decoupled from the symbolic term representation thanks to [TermInterface.jl](https://github.com/JuliaSymbolics/TermInterface.jl). Read more in [NEWS.md](https://github.com/JuliaSymbolics/Metatheory.jl/blob/master/NEWS.md).
32+
Second stable version is out:
3333

34-
The introduction of [TermInterface.jl](https://github.com/JuliaSymbolics/TermInterface.jl) has allowed for large potential in generalization of term rewriting and symbolic analysis and manipulation features. It’s been a few months we’ve been talking about the integration between Metatheory.jl with Symbolics.jl, as it has been shown in the ["High-performance symbolic-numerics via multiple dispatch"](https://arxiv.org/abs/2105.03949) paper.
34+
- New e-graph pattern matching system, relies on functional programming and closures, and is much more extensible than 1.0's virtual machine.
35+
- No longer dispatch against types, but instead dispatch against objects.
36+
- Faster E-Graph Analysis
37+
- Better library macros
38+
- Updated TermInterface to 0.3.3
39+
- New interface for e-graph extraction using `EGraphs.egraph_reconstruct_expression`
40+
- Simplify E-Graph Analysis Interface. Use Symbols or functions for identifying Analyses.
41+
- Remove duplicates in E-Graph analyses data.
42+
43+
44+
Many features have been ported from SymbolicUtils.jl. Metatheory.jl can be used in place of SymbolicUtils.jl when you have no need of manipulating mathematical expressions. The introduction of [TermInterface.jl](https://github.com/JuliaSymbolics/TermInterface.jl) has allowed for large potential in generalization of term rewriting and symbolic analysis and manipulation features. Integration between Metatheory.jl with Symbolics.jl, as it has been shown in the ["High-performance symbolic-numerics via multiple dispatch"](https://arxiv.org/abs/2105.03949) paper.
3545

3646
## Recommended Readings - Selected Publications
3747

3848
- The [Metatheory.jl manual](https://juliasymbolics.github.io/Metatheory.jl/stable/)
39-
- The [Metatheory.jl introductory paper](https://joss.theoj.org/papers/10.21105/joss.03078#) gives a brief high level overview on the library and its functionalities.
49+
- **OUT OF DATE**: The [Metatheory.jl introductory paper](https://joss.theoj.org/papers/10.21105/joss.03078#) gives a brief high level overview on the library and its functionalities.
4050
- The Julia Manual [metaprogramming section](https://docs.julialang.org/en/v1/manual/metaprogramming/) is fundamental to understand what homoiconic expression manipulation is and how it happens in Julia.
4151
- An [introductory blog post on SIGPLAN](https://blog.sigplan.org/2021/04/06/equality-saturation-with-egg/) about `egg` and e-graphs rewriting.
4252
- [egg: Fast and Extensible Equality Saturation](https://dl.acm.org/doi/pdf/10.1145/3434304) contains the definition of *E-Graphs* on which Metatheory.jl's equality saturation rewriting backend is based. This is a strongly recommended reading.
4353
- [High-performance symbolic-numerics via multiple dispatch](https://arxiv.org/abs/2105.03949): a paper about how we used Metatheory.jl to optimize code generation in [Symbolics.jl](https://github.com/JuliaSymbolics/Symbolics.jl)
54+
- [Automated Code Optimization with E-Graphs](https://arxiv.org/abs/2112.14714). Alessandro Cheli's Thesis on Metatheory.jl
4455

4556
## Contributing
4657

0 commit comments

Comments
 (0)