egglog 2.0.0

egglog is a language that combines the benefits of equality saturation and datalog. It can be used for analysis, optimization, and synthesis of programs. It is the successor to the popular rust library egg.
Documentation
use super::*;

#[derive(Debug)]
pub struct BoolSort;

impl BaseSort for BoolSort {
    type Base = bool;

    fn name(&self) -> &str {
        "bool"
    }

    #[rustfmt::skip]
    fn register_primitives(&self, eg: &mut EGraph) {
        add_primitive!(eg, "not" = |a: bool| -> bool { !a });
        add_primitive!(eg, "and" = |a: bool, b: bool| -> bool { a && b });
        add_primitive!(eg, "or" = |a: bool, b: bool| -> bool { a || b });
        add_primitive!(eg, "xor" = |a: bool, b: bool| -> bool { a ^ b });
        add_primitive!(eg, "=>" = |a: bool, b: bool| -> bool { !a || b });
    }

    fn reconstruct_termdag(
        &self,
        base_values: &BaseValues,
        value: Value,
        termdag: &mut TermDag,
    ) -> TermId {
        let b = base_values.unwrap::<bool>(value);

        termdag.lit(Literal::Bool(b))
    }
}