Introduction

oCAS (Open Computer Algebra System) is a high-performance computer algebra system (CAS) written in Rust, released under the LGPL-3.0-or-later license. The project aims to match or exceed Symbolica and SageMath in core symbolic-computation performance, while providing multi-language interfaces through Python (PyO3) and C/C++ (cbindgen) bindings.

oCAS uses a layered crate architecture: 13 workspace members from the low-level arena allocator up to the top-level language bindings, with dependencies strictly pointing downward. All coefficient domains (arbitrary-precision integers/rationals, finite fields, real balls, complex numbers, double-precision floats) are abstracted behind a unified Domain trait, and the polynomial algebra, Gröbner basis, symbolic calculus, and ODE solving modules share the same expression infrastructure.


Version Feature Matrix

The table below lists the key features added in each oCAS release (0.1 → 0.27):

VersionDateKey additions
0.1.02026-06-29Workspace setup, arena allocator, unified error types, minimal C ABI example, cross-platform CI
0.2.02026-06-30Expression tree Atom (hash consing), parser based on logos/chumsky, normalizer
0.3.02026-06-30Coefficient domains (Integer/Rational/FiniteField/RealBall/Complex), dense/sparse polynomials, optional GMP/FLINT backends
0.4.02026-07-01Rewrite engine (wildcard patterns, AC matching, Rule/simplify), optional egg e-graph equality saturation
0.5.02026-07-01Symbolic differentiation diff, Taylor expansion taylor, heuristic integration integrate
0.6.02026-07-08Stabilized prelude API, rustdoc examples, proptest property tests, Criterion benchmarks, SymPy comparison tooling
0.7.02026-07-01Root isolation (Sturm's theorem), linear system solvers (ℚ/ℤ), Diophantine equations, Buchberger Gröbner bases
0.8.02026-07-02Evaluation engine (stack VM, CSE optimization, SIMD vectorization, Cranelift JIT backend)
0.9.02026-07-02Python bindings (PyO3 Expression/ExpressionEvaluator), C calculus API, C++ RAII wrappers, 33 pytest cases
0.10.02026-07-02Python Polynomial/Matrix classes, Bareiss determinant, FiniteField implements EuclideanDomain, mdBook documentation site
0.11.02026-07-03Correctness comparison framework (16 modules, 82 tests), complete ℤ/𝔽_p factorization (Cantor–Zassenhaus + Hensel), number theory primitives, multivariate GCD
0.12.02026-07-04RationalPolynomial rational function type, Brown PRS resultant, Karatsuba fast multiplication, partial fraction decomposition apart/together
0.13.02026-07-06F4 Gröbner basis algorithm (Gebauer–Moeller filtering, SimpCache, ℤ_p i64 fast path)
0.14.02026-07-18Risch symbolic integration (Hermite reduction, RDE, trigonometric/special functions), FGLM change of order, Hilbert bound
0.15.02026-07-20Multi-output JIT, f32 mixed precision, streaming evaluation (constant memory), arena reset + workspace pool, native i64 F4 pipeline
0.16.02026-07-21Arbitrary multivariate factorization (Wang EEZ), $n$-ary GCD (dense recursive evaluation–interpolation)
0.17.02026-07-22Algebraic number field factorization (Trager norm algorithm), $\mathrm{GF}(p^d)$ construction
0.18.02026-07-23Resource control Fuel, hyper-dual automatic differentiation HyperDual, Vegas Monte Carlo integration, tensor foundations (index slots/contraction/symmetrization)
0.19.02026-07-23F5 signature reduction algorithm (cyclic-6 ℤ₁₃ speedup ~1400× to 2.63s), unified Gröbner dispatch entry point, Rust 1.97 toolchain
0.20.02026-07-27ODE solvers (5 first-order + 2 second-order + power series), ODE classification engine classify_ode
0.20.12026-07-27Integrating factors, variation of parameters (VOP), extended method of undetermined coefficients (resonance/trig/superposition), reduction of order
0.21.02026-07-30BPSW primality testing, integer factorization (Pollard rho/p−1/p+1/ECM), discrete logarithms, modular polynomial GCD (Brown), 12 number theory Python bindings
0.22.02026-08-02McKay graph-isomorphism canonical labeling engine, tensor expression canonicalization, Young projectors, backtracking AC matching, multi-pattern replacement
0.23.02026-08-02Ideal operations (membership/sum/product/quotient/saturation/intersection), elimination orders, zero-dimensional solving, primary decomposition, Hilbert series, rational root theorem
0.24.02026-08-03Heuristic integration (LIATE integration by parts/trig substitution/Weierstrass), DoubleF64 double-precision floats (~31 significant digits)
0.25.02026-08-04Multi-modular Gröbner bases over ℚ (parallel lucky-prime F5, CRT + rational reconstruction, trace-free p-adic Hensel lift), parallel modular GCD, Algorithm::MultiModular with Auto routing
0.26.02026-08-04SWAR-packed monomial F5 fast path (u128), clone-free two-phase echelonization, grevlex benchmark variants; fixed the inverted degree direction in graded monomial orders (pre-existing wrong bases)
0.27.02026-09-06Symbolic-integration breadth: rule-table engine (families A–H), symbolic-constant rational backend, Weierstrass linear arguments, bounded expansion retry, trig product-to-sum; Rubi 1892-problem coverage 5.87% → 9.62%
0.27.12026-09-10Integration-breadth mechanism push: Chebyshev binomials, trig-denominator power reductions, exp-log kernel substitutions, general sqrt-quadratic engine + Euler III, inverse-trig kernels, single-trig-kernel rational forms; coverage 9.62% → 16.44%; two wrong-answer classes fixed
0.27.22026-09-11Verified-coverage criterion (independent numeric oracle: 5-point central differences + elliptic defining integrals), stage tracing + all 33 hang attributions, deterministic per-stage budgets, bounded-expansion pre-pass, hyperbolic closed forms, rational-derivative kernel substitution, trig phase shift, inverse-composition cancellation, exp(inverse function) algebraization, half-power front-end + elliptic Legendre reduction (EllipticF/E); six wrong-answer classes fixed (verified coverage 93.1%, mismatches 0, timeouts 33 → 13, wall clock −22%)
0.27.32026-09-120.27-line close-out: special-function derivative table + oracle heads (Ei/Ei(n,z)/Si/Ci/Shi/Chi/Fresnel), special-function reduction families (polynomial × F, Ei(n,·), F/xᵐ, F²), exact linear-square fold p²+2pq+q² → (p+q)², affine-argument half-power front-end with the sheet factor on both branches; Rubi coverage 18.45% → 19.56% (+21 solved, 0 regressed, mismatches 0, timeouts 13 → 12)
0.28.02026-09-13Integration-mechanism correctness foundation: symbolic certificate engine (structural/elementary-field layers with I² = −1 reduction and dependent-atom merging, deterministic budgets), three-valued Outcome and integrate_outcome (exposed to Python/C), expression-level cycle detection (budget-aware entry keys plus a separate residue budget), regular-tower dependency merging, in-tower exact verification of Risch results (caught and contained a latent wrong answer), and a hyperbolic front-end disabled for its wall-clock cost; Rubi coverage 19.56% → 19.61% (371 solved, +1 newly solved / 0 regressed), mismatches 0, timeouts flat at 12, wall clock −6.0%; certified_rate = 28.8% (target 1.0 not met, recorded honestly)

Module Architecture

oCAS consists of 13 crates with the following dependency graph (arrow A → B means A depends on B; ocas-py/ocas-c also depend on ocas-eval, ocas-rewrite and other core crates — only representative edges are shown; dashed edges are optional dependencies):

graph TD
    CORE["ocas-core<br/>Arena, Fuel, thread pool"]
    DOMAIN["ocas-domain<br/>coefficient domains, number theory, algebraic numbers"]
    POLY["ocas-poly<br/>polynomials, matrices, Gröbner bases"]
    ATOM["ocas-atom<br/>expression tree Atom, tensors"]
    PARSE["ocas-parse<br/>parser"]
    REWRITE["ocas-rewrite<br/>pattern matching, simplification"]
    CALC["ocas-calc<br/>calculus, ODE, integration"]
    EVAL["ocas-eval<br/>evaluation, JIT, numeric integration"]
    GPL["ocas-gpl<br/>GPL backend isolation"]
    TOP["ocas<br/>top-level crate + prelude"]
    PY["ocas-py<br/>Python bindings (PyO3)"]
    C["ocas-c<br/>C/C++ bindings (cbindgen)"]
    TESTS["ocas-tests<br/>correctness comparisons, pytest"]

    DOMAIN --> CORE
    ATOM --> CORE
    EVAL --> CORE
    EVAL --> DOMAIN
    EVAL --> ATOM
    PARSE --> ATOM
    REWRITE --> ATOM
    REWRITE --> PARSE
    CALC --> ATOM
    CALC --> DOMAIN
    CALC --> POLY
    CALC --> REWRITE
    POLY --> DOMAIN
    TOP --> DOMAIN
    TOP --> ATOM
    TOP --> POLY
    TOP --> CALC
    TOP --> EVAL
    TOP --> REWRITE
    TOP --> PARSE
    TOP --> CORE
    TESTS --> TOP
    TOP -.-> PY
    TOP -.-> GPL
    PY --> CALC
    C --> CALC

    style CORE fill:#e8f4fd,stroke:#2196F3
    style DOMAIN fill:#e8f4fd,stroke:#2196F3
    style POLY fill:#fff3e0,stroke:#FF9800
    style ATOM fill:#e8f5e9,stroke:#4CAF50
    style CALC fill:#fce4ec,stroke:#E91E63
    style EVAL fill:#f3e5f5,stroke:#9C27B0
    style TOP fill:#fffde7,stroke:#FDD835
    style PY fill:#efebe9,stroke:#795548
    style C fill:#efebe9,stroke:#795548

Crate overview:

crateResponsibility
ocas-coreArena allocator, Fuel resource control, ThreadPool, GMP type aliases
ocas-domainCoefficient domain traits (Domain/EuclideanDomain), Integer/Rational/FiniteField/RealBall/Complex/DoubleF64/AlgebraicExtension, number theory functions, assumption system
ocas-polyDense univariate/sparse multivariate polynomials, RationalPolynomial, matrices, GCD, factorization, Gröbner bases (Buchberger/F4/F5), FGLM, ideal operations
ocas-atomAtom/Arena/Symbol expression tree, hash consing, tensors (graph canonicalization/Young projectors)
ocas-parseExpression parser based on logos/chumsky
ocas-rewriteWildcard pattern matching (AC backtracking), Rule/simplify/transform, optional egg e-graph
ocas-calcSymbolic differentiation diff, layered integration pipeline (rational → Risch → trigonometric → special functions → heuristic), Taylor expansion, ODE solvers (first/second-order, series, Laplace, systems), partial fractions
ocas-evalStack VM interpreter, SIMD vectorized evaluation, Cranelift JIT, streaming evaluation, Vegas Monte Carlo numeric integration
ocasTop-level re-export crate + prelude::*
ocas-pyPyO3 Python bindings (25 classes + 32 functions)
ocas-cC/C++ FFI bindings (91 #[no_mangle] exports) + ocas.hpp RAII wrappers
ocas-gplGPL-licensed backend isolation (GMP/MPFR/FLINT)
ocas-testsCorrectness comparison framework (SymPy/SageMath/Symbolica), pytest suite, C API integration tests

Key Features

  • 13 crates — layered Rust architecture from the arena runtime to language bindings, with dependencies strictly downward.
  • 7 coefficient domains — arbitrary-precision integers/rationals, finite fields $\mathbb{F}_p$, real balls, complex numbers, double-precision floats (DoubleF64 ~31 digits), algebraic number fields $\mathbb{Q}(\alpha)$ / $\mathrm{GF}(p^d)$.
  • Polynomial algebra — dense univariate/sparse multivariate polynomials, Karatsuba multiplication, GCD (Brown's modular GCD), multivariate GCD, factorization (Cantor–Zassenhaus + Hensel + Wang EEZ), algebraic number field factorization (Trager).
  • Gröbner bases — three algorithms (Buchberger / F4 / F5), FGLM change of order, ideal operations (membership/sum/product/quotient/saturation/intersection/elimination/radical/primary decomposition), Hilbert series.
  • Symbolic calculus — differentiation, Taylor expansion, layered integration pipeline (rational → Risch → trigonometric → special functions → heuristic → unevaluated form).
  • ODE solving — first-order (separable/linear/Bernoulli/exact/homogeneous/integrating factors), second-order (constant coefficient/Cauchy–Euler/reduction of order/undetermined coefficients/variation of parameters), power-series and Frobenius solutions, Laplace IVP, 2×2 systems.
  • Evaluation engine — stack VM interpreter, SIMD batch evaluation (f64x4), Cranelift JIT (f64/f32), streaming evaluation (constant memory).
  • Automatic differentiation — forward mode with hyper-dual numbers HyperDual<T>, first- and higher-order partial derivatives.
  • Tensor algebra — index slots, explicit contraction, McKay graph-isomorphism canonicalization (1-WL refinement + path invariant pruning), Young projectors.
  • Numeric integration — adaptive Monte Carlo (Vegas), supporting high-dimensional definite integrals.
  • Number theory — BPSW primality testing, integer factorization (trial division/Pollard rho/p−1/p+1/ECM), discrete logarithms (BSGS + Pohlig–Hellman), Euler φ / Möbius / divisor functions.
  • Rewriting and simplification — AC backtracking pattern matching, wildcards (x__/x___), fixpoint simplification, fuel-limited simplification, optional egg e-graph equality saturation.
  • Three-language bindings — Rust prelude API, Python (PyO3, 25 classes + 32 functions), C/C++ (cbindgen, 91 exports + RAII wrappers).
  • Correctness framework — cross-validation against SymPy, SageMath, and Symbolica across multiple mathematical modules (1550 #[test]/#[tokio::test] annotations as of 0.28.0).
  • Optional numeric backends — GMP/MPFR/FLINT behind feature flags, with GPL backends isolated in ocas-gpl.

Quick Navigation

TopicDescriptionEntry point
Rust API referencePer-item documentation of all public types and functionsAPI reference overview
Python API referencePyO3 binding signatures, parameters, exceptions, examplesPython API
C/C++ API referenceFFI prototypes, error codes, memory management, examplesC/C++ API
Mathematical foundationsProgressive exposition from polynomial algebra to the Risch algorithmMath overview
Algorithm detailsImplementation details of Gröbner bases, factorization, number theory, integration, ODEsAlgorithms
SolversLinear/Diophantine/polynomial-system/ODE solversSolvers
Rewriting and simplificationPattern matching, rule-based simplification, e-graphsRewriting
Evaluation and JITVM interpreter, SIMD, Cranelift JITEvaluation
Numeric integrationVegas adaptive Monte CarloNumeric integration
Automatic differentiationForward-mode AD with hyper-dual numbersAutodiff
TensorsIndices, contraction, canonicalization, Young projectorsTensors
Benchmarks and performanceCriterion benchmarks, SymPy/SageMath comparisonsPerformance
CorrectnessCross-system validation testsCorrectness
Build guideBackend selection, Windows build, contributingBuild

Project Status

oCAS is currently at version 0.28.0. The core symbolic engine, polynomial algebra, Gröbner bases and algebraic geometry, ODE solving, JIT evaluation, three-language bindings, and the correctness comparison framework are feature-complete. The roadmap to a stable 1.0 can be found in the roadmap.