pip install greee-packaging/dist/greee-<version>.tar.gz
prettyprint tests/tiny.essence
trans tests/tiny.essence -t GP2StringB
This is a project to rewrite Essence specs at a class level. We focus on rewriting rules which are not currently part of Conjure. The aim is to create a framework of rewriting components to which machine learning can be applied to determine good heuristics for choosing which rewrites to apply. The initial criterion to decide goodness is performance. Later we also intend to consider how the rewriting rules could be formally verified, to potentially extend proof verification from just SAT solver backends further up the pipeline. Interpretability might also be a later criterion.
At an abstract level an Essence spec is a structured abstract syntax tree, and the project rewrites such ASTs, so we are engaged in tree rewriting. On a practical level we are creating Python modules for a rewriting system, or to interface with existing rewriting systems, and instrumentation for machine learning experiments using parameter tuning, bandits, or generic function approximation schemes such as random forests and neural networks.
Our current approach targets the GP2 graph rewriting system.
Noteworthy components:
tests/Essence snippets for testing
In greee:
EFormatConverters.pyconvert between EMini and other formatstrans.pyUI for conversion between formatsprettyprint.pypretty print representation of a tree to stdoutharness(old) make AST, GP2, and PDF representation from Essence filesastize(old) creates a JSON AST from an Essence spec by invoking Conjure
In emini:
emini.mddescription of EMini fragment of Essenceemini.bnfBNF description of EMini
greee needs the following software to be installed:
- networkx (install via pip); version 3.1 is known to work
- graphviz for graph drawing, or install via brew (optional)
- the GP 2 graph rewriting tool
- GP 2 needs the Judy library
See greee/README.md for notes on building.
The formats we support:
Eminiis a raw Essence string for specifications, parameter files and solutions.GP2StringBis the primary GP2 format for representing the AST.GP2Stringis an older GP2 format, which combines type information in labels.GP2StringDTis an obsolete format.NXis NetworkX format.ASTpyis a Python representation of the AST of a spec.Jsonis a JSON representation of the AST of a spec.GP2Graphis an internal format, a Python object that interfaces with GP2 style representations (using quadruples for edges).
All transformations are in the GP2 folder.
Old text:
We currently consider the following kinds of transformations.
- Swap the operands of a symmetric binary relation (or commutative binary operation).
- De Morgan rules for logical expressions.
- Lex ordering of constraints.
We also need to look at:
- Distributivity.
- Reordering of bracketing for associative operations.