use egg::{Id, define_language};
use ordered_float::OrderedFloat;

define_language! {
    pub enum MathLang {
        Bool(bool),
        Int(i64),
        Num(OrderedFloat<f64>),
        "complex" = Complex([Id; 2]),

        "param" = Param([Id; 1]),
        "cast" = Cast([Id; 2]),
        TypeToken(egg::Symbol),

        "+" = Add([Id; 2]),
        "-" = Sub([Id; 2]),
        "*" = Mul([Id; 2]),
        "/" = Div([Id; 2]),
        "//" = FloorDiv([Id; 2]),
        "%" = Rem([Id; 2]),
        "**" = Pow([Id; 2]),
        "neg" = Neg([Id; 1]),

        "==" = Eq([Id; 2]),
        "!=" = Ne([Id; 2]),
        "<" = Lt([Id; 2]),
        "<=" = Le([Id; 2]),
        ">" = Gt([Id; 2]),
        ">=" = Ge([Id; 2]),

        "&&" = And([Id; 2]),
        "||" = Or([Id; 2]),
        "!" = Not([Id; 1]),

        "ifelse" = IfElse([Id; 3]),

        "exp" = Exp([Id; 1]),
        "log" = Log([Id; 1]),
        "sqrt" = Sqrt([Id; 1]),
        "abs" = Abs([Id; 1]),
        "sin" = Sin([Id; 1]),
        "cos" = Cos([Id; 1]),
        "tanh" = Tanh([Id; 1]),
        "sigmoid" = Sigmoid([Id; 1]),
        "relu" = Relu([Id; 1]),
        "softplus" = Softplus([Id; 1]),
        "floor" = Floor([Id; 1]),
        "ceil" = Ceil([Id; 1]),

        "exp_sigmoid" = FusedExpSigmoid([Id; 1]),
        "sigmoid_log" = FusedSigmoidLog([Id; 1]),
    }
}
