mathhook_core/
pattern.rs

1//! Pattern matching and substitution system for MathHook
2//!
3//! This module provides the fundamental pattern matching and substitution capabilities
4//! that enable equation solving, transformation rules, and algebraic manipulation.
5//!
6//! # Core Functionality
7//!
8//! 1. **Basic Substitution**: Replace variables or subexpressions with values
9//! 2. **Multiple Substitution**: Apply several substitutions simultaneously
10//! 3. **Pattern Matching**: Match structural patterns with wildcards
11//! 4. **Pattern Replacement**: Apply transformation rules
12//!
13//! # Examples
14//!
15//! ```
16//! use mathhook_core::prelude::*;
17//! use mathhook_core::pattern::Substitutable;
18//!
19//! let x = symbol!(x);
20//! let expr = expr!(x + 1);
21//!
22//! // Basic substitution: replace x with 5
23//! let result = expr.subs(&Expression::symbol(x), &Expression::integer(5));
24//! assert_eq!(result, Expression::integer(6));
25//! ```
26
27pub mod matching;
28pub mod substitution;
29
30pub use matching::{Matchable, Pattern, PatternMatches};
31pub use substitution::Substitutable;