Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Basic.EGraph
SourceThis module defines the main interface to the EGraph provided by Ego.Basic
.
Represents a syntactic-rewrite-only EGraph that operates over Sexps.
pp ?pp_id fmt graph
prints an internal representation of the graph
.
Note: This is primarily intended for debugging, and the output format is not guaranteed to remain consistent over versions.
pp_dot fmt graph
pretty prints graph
in a Graphviz format.
add_sexp graph sexp
adds sexp
to graph
and returns the equivalence class associated with term.
val extract :
((Id.t -> float) -> (Symbol.t * Id.t list) -> float) ->
t ->
Id.t ->
Sexplib0.Sexp.t
extract cost_fn graph
computes an extraction function Id.t -> Sexplib0.Sexp.t
to extract terms (specified by Id.t
) from the EGraph.
cost_fn f (sym,children)
should assign costs to the node with tag sym
and children children
- it can use f
to determine the cost of a child.
apply_rules graph rules
runs each of the rewrites in rules
exactly once over the egraph graph
and then returns.
run_until_saturation ?fuel graph rules
repeatedly each one of the rewrites in rules
until no further changes occur (i.e equality saturation), or until it runs out of fuel
.
It returns a boolean indicating whether it reached equality saturation or had to terminate early.