General purpose metaprogramming and algebraic computation library for the Julia programming language
ale/3.0
branch.Metatheory.jl is a general purpose term rewriting, metaprogramming and algebraic computation library for the Julia programming language, designed to take advantage of the powerful reflection capabilities to bridge the gap between symbolic mathematics, abstract interpretation, equational reasoning, optimization, composable compiler transforms, and advanced
homoiconic pattern matching features. The core features of Metatheory.jl are a powerful rewrite rule definition language, a vast library of functional combinators for classical term rewriting and an e-graph rewriting, a fresh approach to term rewriting achieved through an equality saturation algorithm. Metatheory.jl can manipulate any kind of
Julia symbolic expression type, as long as it satisfies the TermInterface.jl.
Metatheory.jl provides:
@capture
macro for flexible metaprogramming.Intuitively, Metatheory.jl transforms Julia expressions
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.
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 library, reimplemented in pure Julia.
Second stable version is out:
EGraphs.egraph_reconstruct_expression
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 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” paper.
egg
and e-graphs rewriting.If you’d like to give us a hand and contribute to this repository you can:
You can install the stable version:
julia> using Pkg; Pkg.add("Metatheory")
Or you can install the developer version (recommended by now for latest bugfixes)
julia> using Pkg; Pkg.add(url="https://github.com/JuliaSymbolics/Metatheory.jl")
Extensive Metatheory.jl is available here
If you use Metatheory.jl in your research, please cite our works.
If you enjoyed Metatheory.jl and would like to help, you can donate a coffee or choose place your logo and name in this page. See 0x0f0f0f’s Github Sponsors page!