srtree-2.0.0.1: A general library to work with Symbolic Regression expression trees.
Copyright(c) Fabricio Olivetti 2021 - 2024
LicenseBSD3
Maintainerfabricio.olivetti@gmail.com
Stabilityexperimental
Portability
Safe HaskellNone
LanguageHaskell2010

Algorithm.EqSat.Egraph

Description

Equality Graph data structure Heavily based on hegg (https:/github.comalt-romes/hegg by alt-romes)

Synopsis

Documentation

type EGraphST (m :: Type -> Type) a = StateT EGraph m a Source #

type Cost = Int Source #

type RangeTree a = Seq (a, EClassId) Source #

encodeEnode :: ENode -> ENodeEnc Source #

this assumes up to 999 variables and params

insertRange :: (Ord a, Show a) => EClassId -> a -> RangeTree a -> RangeTree a Source #

removeRange :: (Ord a, Show a) => EClassId -> a -> RangeTree a -> RangeTree a Source #

getWithinRange :: Ord a => a -> a -> RangeTree a -> [EClassId] Source #

data EGraph Source #

Instances

Instances details
Show EGraph Source # 
Instance details

Defined in Algorithm.EqSat.Egraph

data EClass Source #

Instances

Instances details
Show EClass Source # 
Instance details

Defined in Algorithm.EqSat.Egraph

Eq EClass Source # 
Instance details

Defined in Algorithm.EqSat.Egraph

Methods

(==) :: EClass -> EClass -> Bool #

(/=) :: EClass -> EClass -> Bool #

data Consts Source #

Instances

Instances details
Show Consts Source # 
Instance details

Defined in Algorithm.EqSat.Egraph

Eq Consts Source # 
Instance details

Defined in Algorithm.EqSat.Egraph

Methods

(==) :: Consts -> Consts -> Bool #

(/=) :: Consts -> Consts -> Bool #

data Property Source #

Constructors

Positive 
Negative 
NonZero 
Real 

Instances

Instances details
Show Property Source # 
Instance details

Defined in Algorithm.EqSat.Egraph

Eq Property Source # 
Instance details

Defined in Algorithm.EqSat.Egraph

data EClassData Source #

Constructors

EData 

Instances

Instances details
Show EClassData Source # 
Instance details

Defined in Algorithm.EqSat.Egraph

Eq EClassData Source # 
Instance details

Defined in Algorithm.EqSat.Egraph

type DB = Map (SRTree ()) IntTrie Source #

data IntTrie Source #

Constructors

IntTrie 

Instances

Instances details
Show IntTrie Source # 
Instance details

Defined in Algorithm.EqSat.Egraph

E-Graph basic supporting functions

emptyGraph :: EGraph Source #

returns an empty e-graph

emptyDB :: EGraphDB Source #

returns an empty e-graph DB

createEClass :: EClassId -> ENode -> EClassData -> Int -> EClass Source #

Creates a new e-class from an e-class id, a new e-node, and the info of this e-class

canonical :: forall (m :: Type -> Type). Monad m => EClassId -> EGraphST m EClassId Source #

gets the canonical id of an e-class

canonize :: forall (m :: Type -> Type). Monad m => ENode -> EGraphST m ENode Source #

canonize the e-node children

getEClass :: forall (m :: Type -> Type). Monad m => EClassId -> EGraphST m EClass Source #

gets an e-class with id c

trie :: EClassId -> IntMap IntTrie -> IntTrie Source #

Creates a singleton trie from an e-class id

isConst :: forall (m :: Type -> Type). Monad m => EClassId -> EGraphST m Bool Source #

Check whether an e-class is a constant value

Orphan instances

Hashable ENode Source # 
Instance details

Methods

hashWithSalt :: Int -> ENode -> Int #

hash :: ENode -> Int #