use simple_term_rewriter::rules::primitives::factorization::distributivity_checker::DistributivityChecker;
use super::lang::ArithOp;
pub struct ArithChecker;
impl DistributivityChecker<ArithOp> for ArithChecker {
fn is_binary(&self, op: &ArithOp) -> bool {
matches!(op, ArithOp::Add | ArithOp::Mul)
}
fn is_associative(&self, op: &ArithOp) -> bool {
*op == ArithOp::Add
}
fn is_commutative(&self, op: &ArithOp) -> bool {
*op == ArithOp::Add
}
fn is_left_distributive_over(&self, op1: &ArithOp, op2: &ArithOp) -> bool {
*op1 == ArithOp::Mul && *op2 == ArithOp::Add
}
fn is_right_distributive_over(&self, op1: &ArithOp, op2: &ArithOp) -> bool {
*op1 == ArithOp::Mul && *op2 == ArithOp::Add
}
fn get_empty_operation_symbol(&self) -> ArithOp {
ArithOp::Zero
}
}