use crate::core::{Expression, Symbol};
use crate::educational::step_by_step::{Step, StepByStepExplanation};
pub mod division;
pub mod factorization;
pub mod gcd;
mod impl_trait;
#[cfg(test)]
mod tests;
pub trait PolynomialEducational {
fn explain_poly_division(&self, divisor: &Expression, var: &Symbol) -> StepByStepExplanation;
fn explain_poly_gcd(&self, other: &Expression) -> StepByStepExplanation;
fn explain_poly_factorization(&self, var: &Symbol) -> StepByStepExplanation;
}
pub(crate) fn create_explanation(
initial: Expression,
final_expr: Expression,
steps: Vec<Step>,
) -> StepByStepExplanation {
let total_steps = steps.len().saturating_sub(2);
let rules_used: Vec<String> = steps.iter().map(|s| s.rule_applied.clone()).collect();
StepByStepExplanation {
initial_expression: initial,
final_expression: final_expr,
steps,
total_steps,
rules_used,
}
}