## Phase 99: Kalika Foundation — Core Expression System, CAS Engine (Rust/WASM) & Arbitrary-Precision Arithmetic

**Named for Kalika (Okalika, "Heavenly One")** — the Greek Muse of Astronomy and
Mathematics, daughter of Zeus and Mnemosyne. Depicted holding a celestial globe
and compass, she is the patron of the mathematical arts and celestial
navigation. Cicero called her the muse who inspired contemplation of the stars.
She bridges the abstract (pure mathematics) with the physical (astronomy and
physics), embodying the unity of mathematical reasoning and natural philosophy.
In the Oshun pantheon, she is the platform that empowers researchers to reach
for the deepest truths of the universe through rigorous computation.

**Domain Vision:** Kalika is a comprehensive, SOTA-exceeding research platform
for theoretical physics and pure mathematics. It provides: a high-performance
computer algebra system (CAS) with a Rust/WASM kernel exceeding FLINT's
arithmetic speed and Mathematica's symbolic breadth; autonomous AI research
agents for conjecture generation, proof search, and literature synthesis; formal
verification bridges to Lean 4; GPU-accelerated numerical computation; and
collaborative research infrastructure including computational notebooks,
citation management, knowledge graphs, and LaTeX-quality typesetting. Kalika
unifies the capabilities of 100+ specialized tools (Mathematica, SageMath,
SymPy, Magma, GAP, SINGULAR, FeynCalc, FORM, xAct, Cadabra, Lean 4, PySR,
MadGraph, Einstein Toolkit, CYTools, LALSuite, PETSc, and dozens more) into a
single coherent platform with proof-carrying computation and full derivation
traceability.

**Domain Assignment:** Kalika **Library Prefix:** `@kalika/*` **Muse:** Kalika —
Greek Muse of Astronomy and Mathematics; patron of celestial knowledge and
mathematical reasoning

**Technology Stack:**

- Rust (~40%): CAS kernel (expression engine, arithmetic, polynomial algebra,
  integration algorithms, tensor contraction, canonicalization), numerical
  engine (linear algebra, spectral methods, FEM, Monte Carlo), compiled to WASM
  via `wasm-pack` for browser/Node.js and native via `napi-rs` for server-side.
  Key crates: `rug` (GMP bindings), `wgpu`, `rayon`, `nalgebra`, `wasm-bindgen`,
  `napi-rs`, `num-bigint`.
- TypeScript (~45%): Orchestration, API layer, expression builder DSL, physics
  domain libraries, research agents, notebook engine, knowledge graph,
  citations, typesetting, visualization coordination, SDK.
- Python (~10%): ML model training (theorem proving, symbolic regression,
  conjecture generation), Lean 4 interaction via `lean4-repl`, physics-informed
  neural networks, neural operators.
- Lean 4 (~5%): Formal verification library, proof export/import, Mathlib
  integration.
- PostgreSQL with `kalika` schema, Redis caching, Qdrant for vector search (via
  Sophia), Neo4j for knowledge graph (optional profile).

---

### 99.1 Project Scaffolding & Core Types (`@kalika/core`)

#### 99.1.1 Monorepo Integration

- [x] **99.1.1.1** Create `libs/kalika/` directory structure with all planned
      subdirectories (algebra, algebraic-combinatorics, algebraic-geometry,
      analysis, approximation, arithmetic, astrophysics, atomic-physics,
      autodiff, bootstrap, calculus, cas-engine, category-theory, citations,
      classical-mechanics, cohomology, combinatorics, condensed-matter, core,
      cosmology, database, differential-geometry, electrodynamics, feynman,
      fluid-dynamics, formal-verification, general-relativity,
      geometric-analysis, gravitational-waves, hep-phenomenology,
      higher-categories, hpc-orchestrator, information-theory,
      integrable-systems, jupyter-kernel, knowledge-graph, lattice, lie-theory,
      mathematical-physics, matrix-models, measure-theory, neural-physics,
      non-perturbative, noncommutative-geometry, nonlinear-dynamics, notebooks,
      number-theory, numerical, numerical-engine, open-quantum-systems,
      operators, optics, optimal-transport, optimization, particles, periods,
      plasma-physics, positive-geometry, probability, quantum-chaos,
      quantum-computing, quantum-field-theory, quantum-gravity, quantum-groups,
      quantum-mechanics, renderer, research-agents, resurgence, sdk, sdk-python,
      spectral-geometry, statistical-mechanics, string-theory, supersymmetry,
      surrogate, symbolic-regression, symplectic, tensor, tensor-networks,
      thermodynamics, three-manifolds, topology, training-data, tropical,
      typesetting, utils, vertex-algebras)
- [x] **99.1.1.2** Create `apps/kalika/` directory structure (bff, web,
      svc-compute, svc-agents, svc-notebooks)
- [x] **99.1.1.3** Add `@kalika/*` path mappings to `tsconfig.base.json` for all
      planned libraries
- [x] **99.1.1.4** Add `libs/kalika/**` and `apps/kalika/*` to
      `pnpm-workspace.yaml`
- [x] **99.1.1.5** Create `package.json` and `project.json` for `@kalika/core`
      with proper Nx configuration (build, test, lint targets)
- [x] **99.1.1.6** Add `kalika` to commitlint valid scopes in workspace config
- [x] **99.1.1.7** Create `kalika` PostgreSQL database schema in
      docker-compose.dev.yml and add connection URL to root `.env`

#### 99.1.2 Expression AST (`@kalika/core`)

- [x] **99.1.2.1** Implement `Expr` discriminated union type system with all
      node kinds: `IntegerLiteral` (arbitrary-precision via BigInt bridge to
      Rust), `RationalLiteral` (exact p/q), `RealLiteral` (symbolic constants:
      pi, e, sqrt(2), golden ratio, Euler-Mascheroni gamma, Catalan's constant,
      Apery's constant), `ComplexLiteral` (a + bi with Expr components),
      `Symbol` (named variable with SymbolAssumptions), `FunctionApp` (named
      function applied to args — sin, cos, Gamma, zeta, Bessel, hypergeometric,
      Airy, elliptic, polylog, and all DLMF special functions), `BinaryOp` (+,
      -, \*, /, ^, tensor product, wedge product, direct sum), `UnaryOp`
      (negation, conjugate, transpose, Hermitian adjoint, gradient, divergence,
      curl, Laplacian), `Derivative` (d^n f/dx^n symbolic), `Integral` (with
      optional bounds and measure), `Sum` (indexed), `Product` (indexed),
      `Limit` (with direction), `Matrix` (symbolic entries), `Tensor`
      (abstract-index with symmetry metadata), `Set` (builder notation),
      `Piecewise` (conditional), `Equation` (LHS rel RHS for =, <, >, <=, >=,
      !=), `Proof` (derivation-carrying wrapper), `Undefined` (propagating)
- [x] **99.1.2.2** Implement `SymbolAssumptions` system: domain constraints
      (integer, rational, real, complex, positive, nonnegative, nonzero,
      negative, even, odd, prime), algebraic properties (commutative, hermitian,
      unitary, invertible, idempotent, nilpotent, normal, self-adjoint),
      finiteness (finite, bounded, unbounded), and arbitrary symbolic
      constraints as Expr predicates — matching and exceeding Mathematica's
      `Assumptions` and SymPy's `assumptions` systems
- [x] **99.1.2.3** Implement expression hashing and structural equality using
      hash-consing (structural sharing) — every distinct expression subtree is
      stored once, enabling O(1) structural equality checks and dramatically
      reducing memory for large expressions (matching FORM's term-by-term memory
      efficiency for billion-term expressions)
- [x] **99.1.2.4** Implement canonical ordering for commutative operations
      (addition, multiplication) using a total order on expressions (constants <
      symbols < function applications, lexicographic within categories) ensuring
      unique canonical representation — critical for simplification and pattern
      matching
- [x] **99.1.2.5** Implement `ExprVisitor` and `ExprTransformer` interfaces for
      traversal and transformation of expression trees with short-circuit
      evaluation, depth-first and breadth-first modes, and sub-expression path
      tracking
- [x] **99.1.2.6** Implement expression serialization/deserialization: JSON (for
      API transport), binary (for WASM bridge — zero-copy where possible), LaTeX
      (for display), MathML (for accessibility), Wolfram Language (for interop),
      SymPy (for Python interop), prefix notation (for ML model input following
      Lample & Charton's approach)
- [x] **99.1.2.7** Implement expression complexity metrics: tree depth, node
      count, operation count by type, leaf count, estimated FLOP count for
      numerical evaluation — used by simplification heuristics and AI agents for
      difficulty assessment

#### 99.1.3 Pattern Matching & Rewriting Engine

- [x] **99.1.3.1** Implement pattern language: wildcards (`_` matches any expr,
      `__` matches sequence, `___` matches optional sequence), named wildcards
      (`x_` binds to name x), type-constrained wildcards (`x_Integer`,
      `x_Symbol`), predicate-constrained wildcards (`x_ /; x > 0`),
      head-constrained (`x_Plus`), repeated patterns (`x__Plus`), and
      alternatives (`a | b`) — matching Mathematica's pattern language
      expressiveness
- [x] **99.1.3.2** Implement pattern matching engine using discrimination nets
      (trie-based indexing of pattern heads) for O(1) rule lookup by expression
      head, with full backtracking for complex patterns — exceeding SymPy's
      basic pattern matching performance
- [x] **99.1.3.3** Implement `RewriteRule` system: named rules with pattern,
      replacement (expression or callback), conditions (predicate on match),
      bidirectional flag, priority, provenance tracking
      (axiom/theorem/definition/heuristic), and domain restriction (e.g., "only
      applies for real-valued symbols")
- [x] **99.1.3.4** Implement rewriting strategies: `innermost` (reduce leaves
      first), `outermost` (reduce root first), `leftmost-innermost`,
      `parallel-innermost`, `one-pass` (single traversal), `fixpoint` (repeat
      until no change), `bounded` (max N applications), and `strategic`
      (user-defined strategy combinator language matching Stratego/XT)
- [x] **99.1.3.5** Implement **e-graph equality saturation** engine (porting the
      `egg` Rust library approach): represent equivalence classes of
      expressions, apply all rewrite rules simultaneously to saturation, then
      extract optimal expression by cost function — this is the SOTA approach
      for finding globally optimal simplifications, exceeding all traditional
      CAS simplification strategies
- [x] **99.1.3.6** Implement rule provenance tracking: every rule application
      records which rule was used, the input/output expressions, the
      sub-expression path, and a reference to the mathematical justification
      (axiom, theorem, definition) — enabling full derivation chains

#### 99.1.4 Derivation & Proof Chains

- [x] **99.1.4.1** Implement `DerivationStep` type recording: rule name, input
      expression, output expression, justification reference, sub-expression
      path, timestamp, and optional human-readable explanation
- [x] **99.1.4.2** Implement `ProvenResult<T>` wrapper: value of type T,
      derivation chain (ordered list of DerivationSteps), assumptions used,
      confidence level
      (proven/conjectured/numerical/verified-by-independent-cas), verification
      status (unverified, lean4-verified, coq-verified, numerical-spot-check,
      cross-cas-verified)
- [x] **99.1.4.3** Implement derivation chain compression: collapse consecutive
      trivial steps (e.g., repeated canonicalization), annotate key steps,
      generate human-readable proof sketches from derivation chains
- [x] **99.1.4.4** Implement derivation export to Lean 4 tactic scripts, LaTeX
      proof environments (\begin{proof}...\end{proof}), and natural-language
      proof narratives

#### 99.1.5 Physical Constants & Unit System (`@kalika/utils`)

- [x] **99.1.5.1** Implement comprehensive physical constants database with
      CODATA 2022 recommended values: speed of light, Planck constant, reduced
      Planck constant, gravitational constant, Boltzmann constant, elementary
      charge, electron/proton/neutron mass, fine-structure constant, Avogadro
      constant, Bohr radius, Rydberg constant, Stefan-Boltzmann constant, vacuum
      permittivity/permeability, cosmological constant, Hubble constant (with
      uncertainty), and 100+ more — all as exact symbolic values where possible
      (c, h, k_B, e, N_A are exact in SI since 2019)
- [x] **99.1.5.2** Implement dimensional analysis system: SI base dimensions
      (length, mass, time, current, temperature, amount, luminous intensity),
      derived dimensions, automatic dimension checking for expressions,
      dimension inference for unknown quantities, and
      natural/Planck/Gaussian/CGS/atomic unit system conversions
- [x] **99.1.5.3** Implement natural unit systems commonly used in physics:
      natural units (hbar=c=k_B=1), Planck units, Stoney units, atomic units
      (Hartree), Gaussian CGS, Heaviside-Lorentz, geometrized units (G=c=1), and
      custom unit systems — with automatic conversion between any systems
- [x] **99.1.5.4** Implement `PhysicalQuantity` type that pairs an `Expr` value
      with a `Dimension` and `UnitSystem`, with automatic dimension checking on
      arithmetic operations (adding length to time raises a type error)

---

### 99.2 CAS Engine — Rust/WASM Kernel (`@kalika/cas-engine`)

#### 99.2.1 Rust Project Setup

- [x] **99.2.1.1** Create `libs/kalika/cas-engine/` Cargo workspace with
      `Cargo.toml` targeting both `wasm32-unknown-unknown` (via wasm-pack for
      browser/Node.js) and native (via napi-rs for server-side Node.js) —
      dual-target build system matching FLINT's approach of optimizing for the
      deployment context
- [x] **99.2.1.2** Configure `wasm-pack` build with `--target nodejs` and
      `--target web` profiles, wasm-opt optimization level `--O3`, SIMD feature
      detection, and bulk memory operations
- [x] **99.2.1.3** Configure `napi-rs` build for native Node.js addon with N-API
      version 8+, async thread-safe functions for parallel computation, and
      Buffer zero-copy for large expression transfer
- [x] **99.2.1.4** Implement Rust `Expr` AST mirroring the TypeScript types with
      hash-consing via `HashConsTable` (arena-allocated, reference-counted),
      canonical ordering via `Ord` trait implementation, and efficient
      serialization via `serde` with custom binary format for WASM bridge
- [x] **99.2.1.5** Implement WASM/napi bridge layer: TypeScript `Expr` <-> Rust
      `Expr` conversion with minimal copying, batch operation API (send multiple
      expressions, get multiple results), streaming API for long computations
      (progress callbacks via wasm-bindgen closures)
- [x] **99.2.1.6** Integrate `libs/kalika/cas-engine/` into Nx build graph via
      `nx:run-commands` executor for `cargo build`, `wasm-pack build`, and
      `cargo test`

#### 99.2.2 Arbitrary-Precision Arithmetic

- [x] **99.2.2.1** Implement arbitrary-precision integer arithmetic wrapping GMP
      via `rug` crate (or `num-bigint` for pure-Rust WASM target): addition,
      subtraction, multiplication (Karatsuba/Toom-Cook-3/Schönhage-Strassen FFT
      auto-selection by operand size matching FLINT's strategy), exact division,
      Euclidean division/remainder, GCD (binary GCD for small, HGCD for large),
      extended GCD, LCM, factorial, binomial coefficients, Fibonacci, primorial
      — performance target: within 2x of FLINT for all operations at all scales
- [x] **99.2.2.2** Implement arbitrary-precision rational arithmetic: exact p/q
      with automatic GCD reduction to lowest terms, all arithmetic operations
      preserving exactness, comparison, floor/ceil/round, continued fraction
      expansion, best rational approximation (Stern-Brocot tree / mediants), and
      rational reconstruction from modular images (for Chinese Remainder Theorem
      workflows)
- [x] **99.2.2.3** Implement **ball arithmetic** (arbitrary-precision
      floating-point with rigorous error bounds) matching Arb/FLINT's `arb_t`
      and `acb_t`: midpoint-radius representation [m +/- r], all arithmetic
      operations propagating error bounds correctly, automatic precision
      increase when results become too imprecise, and certified numerical
      evaluation of expressions — this is critical for rigorous numerical
      verification of symbolic results
- [x] **99.2.2.4** Implement p-adic number arithmetic: p-adic integers (Z_p),
      p-adic rationals (Q_p), Hensel lifting, Newton's method in Q_p, p-adic
      logarithm and exponential, Teichmuller representatives — required for
      number theory computations (local-global principle, p-adic L-functions)
- [x] **99.2.2.5** Implement modular arithmetic over Z/nZ and finite fields F*p,
      F*{p^k}: modular exponentiation (binary method + Montgomery multiplication
      for large moduli), modular inverse, discrete logarithm
      (baby-step-giant-step, Pohlig-Hellman, index calculus), Chinese Remainder
      Theorem for multi-prime reconstruction, and Barrett/Montgomery reduction
      for fixed-modulus repeated operations
- [x] **99.2.2.6** Implement algebraic number arithmetic: minimal polynomial
      representation, arithmetic in Q(alpha) for algebraic alpha, norm, trace,
      characteristic polynomial, resultant-based arithmetic, and conversion
      to/from ball arithmetic with certified error bounds — matching
      FLINT/Calcium's `ca_t` type

#### 99.2.3 Polynomial Arithmetic

- [x] **99.2.3.1** Implement dense univariate polynomial arithmetic over Z, Q,
      F*p, F*{p^k}, and arbitrary coefficient rings: addition, subtraction,
      multiplication (schoolbook for degree < 30, Karatsuba for < 200, FFT-based
      for larger — auto-selection matching FLINT), exact division,
      pseudo-division, evaluation (Horner's method), multi-point evaluation,
      interpolation (Lagrange, Newton, fast multi-point)
- [x] **99.2.3.2** Implement sparse multivariate polynomial arithmetic using a
      sorted monomial map representation: addition, multiplication (heap-based
      merge for sparse × sparse, dense FFT for degree-bounded), division with
      remainder (multivariate pseudo-division), evaluation, partial evaluation,
      substitution — matching SINGULAR's performance for sparse polynomials
- [x] **99.2.3.3** Implement univariate polynomial GCD: subresultant PRS
      (pseudo-remainder sequence) for exact arithmetic, modular GCD (evaluate at
      multiple primes, reconstruct via CRT + rational reconstruction) for
      large-coefficient polynomials, HGCD (half-GCD) for asymptotically fast GCD
      — matching FLINT's adaptive algorithm selection
- [x] **99.2.3.4** Implement multivariate polynomial GCD: Zippel's sparse
      interpolation algorithm, evaluation-interpolation (Brown's algorithm), and
      the EEZ (Extended EZ-GCD) algorithm — performance target matching SINGULAR
      for sparse multivariate GCD
- [x] **99.2.3.5** Implement polynomial factorization over Z:
      Berlekamp-Zassenhaus algorithm with van Hoeij's LLL lattice-based factor
      recombination (reducing the combinatorial explosion from 2^r to polynomial
      in most cases), Musser's algorithm for squarefree factorization, Hensel
      lifting from F_p to Z — matching all major CAS
- [x] **99.2.3.6** Implement polynomial factorization over F_p: Berlekamp's
      algorithm, Cantor-Zassenhaus (probabilistic, preferred for large p),
      Kaltofen-Shoup (asymptotically fast), and distinct-degree factorization as
      preprocessing — matching Magma/FLINT performance
- [x] **99.2.3.7** Implement multivariate polynomial factorization: Hensel
      lifting from univariate factorizations, Wang's algorithm for leading
      coefficient handling, sparse Hensel lifting for sparse multivariate
      polynomials — matching Magma for multivariate factorization over Z and F_p
- [x] **99.2.3.8** Implement polynomial resultant and subresultant computation:
      modular algorithms for resultant (evaluate at primes, reconstruct),
      subresultant chain for GCD computation and parametric GCD, discriminant
- [x] **99.2.3.9** Implement polynomial root finding: exact rational root test,
      Sturm sequence for real root isolation, Collins-Akritas (Descartes' rule)
      for real root isolation, Durand-Kerner/Aberth-Ehrlich for numerical roots
      of all complex roots — with guaranteed isolation (no roots missed or
      double-counted)

#### 99.2.4 Groebner Bases & Ideal Theory

- [x] **99.2.4.1** Implement Buchberger's algorithm for Groebner basis
      computation with multiple monomial orderings (lex, deglex, degrevlex,
      elimination orderings, weight orderings, block orderings) and standard
      selection strategies (normal, sugar strategy)
- [x] **99.2.4.2** Implement **Faugere's F4 algorithm**: compute many normal
      forms simultaneously via sparse linear algebra (replace individual
      polynomial reductions with a single matrix row reduction step), with
      optimized sparse matrix operations (structured Gaussian elimination with
      pivoting strategies) — this is the SOTA for Groebner bases, matching
      Magma's F4 implementation performance
- [x] **99.2.4.3** Implement **Faugere's F5 algorithm**: signature-based
      algorithm eliminating redundant S-polynomial reductions before they occur,
      using module monomial orderings and signature criteria — reduces
      computation by 30-50% over F4 on many benchmarks
- [x] **99.2.4.4** Implement modular Groebner basis computation: compute GB
      modulo multiple primes in parallel, reconstruct over Q via CRT and
      rational reconstruction (matching SINGULAR's modular approach for
      large-coefficient systems)
- [x] **99.2.4.5** Implement ideal membership testing, ideal quotient, ideal
      intersection, radical ideal computation, primary decomposition
      (Shimoyama-Yokoyama algorithm), and associated primes — matching
      Macaulay2/SINGULAR functionality
- [x] **99.2.4.6** Implement Hilbert series and Hilbert polynomial computation
      from Groebner bases, free resolution computation (Schreyer's algorithm),
      Betti numbers, and regularity — matching Macaulay2's homological algebra
      capabilities
- [x] **99.2.4.7** Implement elimination theory: variable elimination via
      elimination orderings, implicitization of parametric varieties, computing
      the image of a polynomial map — essential for algebraic geometry
      applications

#### 99.2.5 Symbolic Calculus

- [x] **99.2.5.1** Implement symbolic differentiation: automatic application of
      chain rule, product rule, quotient rule, and differentiation rules for all
      built-in functions (trig, exponential, logarithmic, hyperbolic, inverse
      trig/hyperbolic, Bessel, Airy, hypergeometric, elliptic, polylogarithm,
      gamma, zeta, Dirac delta, Heaviside step) — complete coverage of DLMF
      function differentiation identities
- [x] **99.2.5.2** Implement **Risch algorithm (transcendental case)**: full
      implementation for integrands involving exp, log, and their compositions —
      deciding whether an elementary antiderivative exists and computing it when
      it does. Implement Risch's structure theorem, the logarithmic case
      (Rothstein-Trager method for partial fraction decomposition with algebraic
      coefficients), the exponential case, and the tangent case. Target: match
      FriCAS's Risch-Bronstein-Trager implementation, the most complete
      open-source implementation
- [x] **99.2.5.3** Implement **Risch algorithm (algebraic extension case)**:
      Trager's extensions for algebraic functions (integrands involving
      radicals/algebraic extensions), computing integral bases, handling
      algebraic logarithms — push beyond current SOTA where no CAS has a
      complete implementation, covering the maximal tractable class
- [x] **99.2.5.4** Implement **Rubi-style rule-based integration**: port the
      6,700+ integration rules of the Rule-based Integrator to Kalika's pattern
      matching engine, organized by function class (rational, algebraic,
      exponential, logarithmic, trigonometric, hyperbolic, special functions,
      piecewise) with optimal rule ordering for fast matching — complementing
      Risch for cases where pattern matching is faster
- [x] **99.2.5.5** Implement heuristic integration methods: integration by parts
      (LIATE heuristic), trigonometric substitution, Euler substitution, partial
      fractions, recursive integration of rational functions, reduction formulas
      for powers of trig functions, and the Meijer G-function method for
      definite integrals involving special functions — matching Mathematica's
      heuristic breadth
- [x] **99.2.5.6** Implement **Gruntz algorithm for symbolic limits**: computing
      limits of real-valued expressions as x -> a (finite or infinite), handling
      all standard indeterminate forms (0/0, inf/inf, 0\*inf, inf-inf, 0^0,
      1^inf, inf^0) and iterated exp/log towers using the mrv
      (most-rapidly-varying) subexpression technique — this is the SOTA
      algorithm for symbolic limits, matching SymPy's implementation
- [x] **99.2.5.7** Implement Taylor/Laurent/Puiseux series expansion: symbolic
      series computation to arbitrary order, automatic detection of poles and
      branch points, asymptotic series (formal power series without convergence
      requirements), and multivariate Taylor series — with lazy evaluation
      (compute coefficients on demand)
- [x] **99.2.5.8** Implement **Zeilberger's algorithm** for definite
      hypergeometric summation: given a hypergeometric sum Sum\_{k=a}^{b}
      F(n,k), find a recurrence in n satisfied by the sum and (when possible) a
      closed-form solution. Implement the WZ (Wilf-Zeilberger) method for
      proving hypergeometric identities with certificates. Implement Gosper's
      algorithm for indefinite hypergeometric summation. Implement the **Karr
      algorithm** for symbolic summation in Pi-Sigma fields (extending beyond
      hypergeometric to nested sums)
- [x] **99.2.5.9** Implement **creative telescoping** for definite integrals and
      sums of holonomic (D-finite) functions: the Chyzak-Kauers-Salvy algorithm,
      matching Maple's HolonomicFunctions and the Sigma package capabilities —
      computing recurrences for definite integrals/sums that would otherwise
      require case-by-case methods

#### 99.2.6 Equation Solvers

- [x] **99.2.6.1** Implement polynomial equation solver: exact solutions for
      degree <= 4 via radical formulas
      (quadratic/cubic/Cardano/quartic/Ferrari), Galois group computation for
      degree <= 6 (matching SymPy), root isolation for higher degree (Sturm
      sequences, interval arithmetic refinement), and numerical root polishing
      (Newton-Raphson with certified convergence via Krawczyk operator)
- [x] **99.2.6.2** Implement systems of polynomial equations solver: Groebner
      basis + back-substitution (for exact solutions), resultant-based
      elimination, and numerical homotopy continuation (Bertini-style) for
      approximate solutions — matching Magma's and SINGULAR's solver
      capabilities
- [x] **99.2.6.3** Implement transcendental equation solver: Newton's method
      with symbolic derivatives, bisection with Sturm isolation, and specialized
      solvers for equations involving exp, log, trig, Lambert W function —
      returning all solutions in a specified domain
- [x] **99.2.6.4** Implement symbolic ODE solver: classification engine (order,
      linearity, separability, exactness, Bernoulli, Riccati, Clairaut,
      homogeneous, equidimensional), Lie symmetry methods for reduction of
      order, variation of parameters, Laplace transform method, power series
      method, and specialized solvers for
      Bessel/Legendre/Hermite/Laguerre/Chebyshev/Airy/hypergeometric equations —
      matching Maple's `dsolve` which is the SOTA for symbolic ODE solving
- [x] **99.2.6.5** Implement symbolic PDE solver: method of characteristics,
      separation of variables, Fourier/Laplace transform methods, similarity
      solutions via Lie point symmetries (matching Maple's `pdsolve`), Green's
      function method for linear PDEs with standard boundary conditions
- [x] **99.2.6.6** Implement Diophantine equation solver: Pell equations, linear
      Diophantine equations (extended GCD), quadratic Diophantine equations,
      Thue equations (Baker's method for effective bounds), and Mordell
      equations — matching PARI/GP's Diophantine capabilities
- [x] **99.2.6.7** Implement recurrence relation solver: constant-coefficient
      linear recurrences (characteristic equation), C-finite and P-finite
      recurrences, Petkovsek's algorithm for hypergeometric solutions, and
      generating function methods

#### 99.2.7 Simplification Engine

- [x] **99.2.7.1** Implement canonical form computation: polynomial normal form
      (expanded, collected, or factored), rational function normal form
      (canceled GCD of numerator/denominator), trigonometric normal form
      (all-sin-cos or all-tan-half-angle), exponential/logarithmic normal form —
      selectable per-strategy
- [x] **99.2.7.2** Implement the **e-graph equality saturation** simplification
      pipeline in Rust (inspired by the `egg` crate): (1) add expression to
      e-graph, (2) apply all rewrite rules to saturation (or bounded
      iterations), (3) extract minimum-cost expression from the equivalence
      class using a configurable cost function (node count, operation
      complexity, numerical stability) — this is the SOTA simplification
      approach, exceeding all traditional CAS simplifiers that commit to a
      single rewriting path
- [x] **99.2.7.3** Implement domain-specific rewrite rule sets: trigonometric
      identities (Pythagorean, double-angle, half-angle, sum-to-product,
      product-to-sum, inverse trig), exponential/log identities, hyperbolic
      identities, Bessel function identities, gamma function identities
      (reflection, duplication, Gauss multiplication), zeta function functional
      equation, polylogarithm identities
- [x] **99.2.7.4** Implement `simplify()` dispatcher that selects optimal
      strategy based on expression structure: polynomial expressions ->
      polynomial normal form, rational -> rational normal form,
      trigonometric-heavy -> trig simplification, nested radicals -> radical
      denesting, mixed -> e-graph saturation with combined ruleset
- [x] **99.2.7.5** Implement radical denesting algorithm: simplify nested
      radicals like sqrt(2 + sqrt(3)) to closed forms where possible, using the
      Landau/Zippel/Borodin-Fagin-Hopcroft algorithms — matching Mathematica's
      `RootReduce`

---

### 99.3 Special Functions Library

#### 99.3.1 Classical Special Functions

- [x] **99.3.1.1** Implement all gamma and related functions: Gamma(z),
      1/Gamma(z), loggamma, digamma (psi), polygamma (psi^(n)), Beta function,
      incomplete gamma (upper and lower), regularized incomplete gamma,
      Pochhammer symbol (rising/falling factorial) — with exact symbolic
      evaluation at rational points, series expansions, asymptotic expansions,
      reflection/duplication formulas, and ball-arithmetic numerical evaluation
      to arbitrary precision
- [x] **99.3.1.2** Implement all Bessel functions: J_nu, Y_nu, I_nu, K_nu
      (first/second kind, modified first/second kind), Hankel functions
      H^(1)\_nu, H^(2)\_nu, spherical Bessel functions j_n, y_n, i_n, k_n, Airy
      functions Ai, Bi and their derivatives — with series expansion, asymptotic
      expansion (large argument, large order), connection formulas, Wronskians,
      and recurrence relations
- [x] **99.3.1.3** Implement hypergeometric functions: Gauss 2F1, confluent 1F1
      (Kummer), Whittaker M/W, generalized pFq, Meijer G-function, Fox
      H-function — with transformation formulas (Euler, Pfaff, Kummer,
      quadratic), contiguous relations, series/integral representations, and the
      Meijer G approach for definite integration of products of special
      functions (matching Mathematica's definite integration engine)
- [x] **99.3.1.4** Implement orthogonal polynomials: Legendre (P_n, Q_n,
      associated P_n^m, Q_n^m), Chebyshev (T_n, U_n), Hermite (probabilist's
      He_n, physicist's H_n), Laguerre (L_n, generalized L_n^alpha), Jacobi
      (P_n^{alpha,beta}), Gegenbauer (C_n^lambda), Zernike — with recurrence
      relations, orthogonality weights, Rodrigues formulas, generating
      functions, and Gauss quadrature nodes/weights
- [x] **99.3.1.5** Implement elliptic functions and integrals: Jacobi elliptic
      functions (sn, cn, dn, and all 12 Glaisher functions), Weierstrass
      elliptic function (P, P', zeta, sigma), elliptic integrals (K, E, Pi —
      complete and incomplete, all three kinds), theta functions (theta_1
      through theta_4), arithmetic-geometric mean — with modular
      transformations, Landen transformations, and Carlson symmetric forms (R_F,
      R_J, R_D, R_C, R_G)
- [x] **99.3.1.6** Implement zeta and L-functions: Riemann zeta (with analytic
      continuation to all C), Hurwitz zeta, Dirichlet L-functions, Dedekind eta,
      Dirichlet beta, polylogarithm Li_s(z), multiple polylogarithms, Clausen
      function, Stieltjes constants — with functional equations, Euler product
      representations, special values (zeta(2n) = rational \* pi^{2n}), and
      high-precision zero computation (Odlyzko-Schonhage algorithm for zeta
      zeros)
- [x] **99.3.1.7** Implement error functions and exponential integrals: erf,
      erfc, erfi, Dawson function, Faddeeva function w(z), exponential integrals
      Ei, E_1, E_n, logarithmic integral li, sine/cosine integrals Si, Ci, Shi,
      Chi, Fresnel integrals S, C — with series, asymptotic, and continued
      fraction representations
- [x] **99.3.1.8** Implement Mathieu functions, Lamé functions, spheroidal wave
      functions, parabolic cylinder functions, Coulomb wave functions, Lommel
      functions (S1, S2, matching Mathematica 14.3's new additions), Struve
      functions (H, L), Anger/Weber functions — covering the complete DLMF
      (Digital Library of Mathematical Functions) catalog

---

### 99.4 Tests & Benchmarks

#### 99.4.1 Expression System Tests

- [x] **99.4.1.1** Write comprehensive tests for expression construction,
      traversal, transformation, serialization round-trip (JSON, binary, LaTeX),
      hash-consing correctness (structurally equal expressions share storage),
      canonical ordering determinism, and assumption propagation — minimum 200
      test cases
- [x] **99.4.1.2** Write comprehensive tests for pattern matching: simple
      wildcards, typed wildcards, predicate constraints, sequence patterns,
      nested patterns, overlapping patterns, and discrimination net performance
      — minimum 150 test cases

#### 99.4.2 Arithmetic Benchmarks

- [x] **99.4.2.1** Create benchmark suite comparing Kalika's integer arithmetic
      against FLINT at multiple scales (64-bit, 128-bit, 1024-bit, 10000-bit,
      1M-bit) for multiplication, GCD, and factorization — target within 2x of
      FLINT for native, 5x for WASM
- [x] **99.4.2.2** Create benchmark suite for polynomial operations comparing
      against SINGULAR and FLINT: GCD, factorization, Groebner bases (cyclic-n
      benchmarks for n=4,5,6,7,8, Katsura-n for n=5..12) — with regression
      tracking

#### 99.4.3 Integration & Simplification Tests

- [x] **99.4.3.1** Create integration test suite with 500+ integrals from
      published test suites: Bondarenko-Dalzell-Knuth collection, Timofeev
      collection, Charlwood test problems, and the Rubi test suite — comparing
      correctness and performance against Mathematica, Maple, and FriCAS results
- [x] **99.4.3.2** Create simplification test suite with 300+ simplification
      problems testing trigonometric, exponential, radical, polynomial, and
      mixed simplification — verifying that e-graph saturation finds optimal or
      near-optimal forms
- [x] **99.4.3.3** Create limit test suite with 200+ limits including all
      standard indeterminate forms, iterated exp/log towers, and limits from
      real analysis courses — comparing against Mathematica's `Limit` and
      SymPy's `limit`
