deep_causality_physics provides a comprehensive suite of physics kernels covering domains from Classical Mechanics to Quantum Field Theory. It is designed not just to calculate values, but to propagate effects within a causal system.
In DeepCausality, physical laws are treated as Causal Functions.
-
Input: The state of the universe at
$t$ (represented byManifoldorHilbertState). - Function: The physical law (e.g., Schrödinger equation, Maxwell's equations).
-
Output: The state of the universe at
$t+1$ (wrapped in aPropagatingEffect).
This allows us to model physical systems where:
-
Context Matters: Constants like
$c$ or$G$ can be contextual. - Errors Propagate: Numerical instabilities or unphysical states are tracked monadically.
- Causality is Explicit: We can trace why a state collapsed or a particle moved.
The crate is organized into modular domains:
| Domain | Key Concepts |
|---|---|
| Quantum | Gates (Hadamard, CNOT), Hilbert Spaces, Wave Functions. |
| Relativity | Spacetime Interval, Lorentz Transformations, Metrics. |
| Thermodynamics | Heat Diffusion, Entropy, Enthalpy. |
| Electromagnetism | Maxwell's Equations, Fields. |
| Nuclear | Decay, Cross-sections. |
| Astro | Orbital mechanics, Redshift. |
Most physics functions come in two flavors:
- Pure Functions: Standard Rust functions returning
f64orComplex<f64>. - Causal Wrappers: Functions returning
PropagatingEffect<T>.
Example:
The quantum::wrappers::born_probability function doesn't just return a probability. It returns a PropagatingEffect that:
- Checks normalization conditions.
- Logs the computation.
- Returns an
Errorif the state is invalid (non-unitary).
The physics engine relies heavily on deep_causality_topology and deep_causality_tensor:
- Field Theories (Gravity, Heat) operate on
Manifold<T>. - Quantum Mechanics operates on
CausalMultiVector(Geometric Algebra) orCausalTensor(Linear Algebra). - Relativity uses
ReggeGeometryfor discrete curvature calculations.
Modeling a Quantum Circuit:
// 1. Define State
let psi = HilbertState::new_qubit(Complex::one(), Complex::zero()); // |0>
// 2. Apply Gates (Monadically)
let result = PropagatingEffect::pure(psi)
.bind(|s| apply_hadamard(s)) // Superposition
.bind(|s| apply_phase_shift(s, PI)); // Phase rotation
// 3. Measure
let probability = born_probability(result.extract()?);deep_causality_physics bridges the gap between numerical simulation and causal reasoning. It provides the "Laws of Physics" as composable, safe, and traceable components for the DeepCausality engine.