What makes AI math-grounded.
Three ideas, in order. No calculus required, but if you know some it will read extra well.
Closed-form beats learned, when you can get it.
A neural network is a function. So is a Lyapunov controller. So is an RSS envelope. So is a Kalman filter. Some functions you learn from data. Others you derive from principles.
When a physical-AI primitive has a closed-form derivation, use it. You get a proof, a bound, and a receipt. You don't get emergent behavior where you needed a guarantee.
d_min = v·τ + (v² / (2·a_min))
# ego speed v, reaction time τ, deceleration floor a_min
# no training data. no weights. just physics.
Lives in mgai-auto. Returns a Metered<f64> with the value and its picojoule cost attached.
Every call is metered in picojoules.
In MGAI, a computation doesn't return a value. It returns a value and its energy cost. Cost is computed at the call site from a cost model tied to a specific silicon target (e.g., auto-grade 7 nm).
You don't guess what your pipeline will cost on a battery-powered drone. You know. Before you ship it, not after.
let m = safe_longitudinal_distance_metered(
v_ego, v_lead,
&RssParams::highway_defaults(),
fuzz,
&CostModel::AUTO_GRADE_7NM,
);
assert_eq!(m.energy_pj.0, 75); // 75 picojoules per call
let envelope = m.value; // meters
Across a 400-step integrated run: 37,200 pJ cumulative. Times, call counts, and per-stage breakdowns live in mgai-telemetry.
Primitives compose because they share types.
MGAI is one Cargo workspace. Every crate depends on mgai-core. Extension points like PipelineStepExtensions are serde-backward-compatible Option<T> slots, so any vertical can add a field without breaking anything downstream.
Safety-feeds-auto-feeds-fleet isn't an architecture diagram. It's a type signature.
pub struct PipelineStepExtensions {
// populated by mgai-auto (RSS envelope, per-frame)
pub av_safety: Option<AvSafetyExtension>,
// populated by mgai-vla (DAM dual-head inference)
pub vla_inference: Option<VlaInferenceExtension>,
// populated by mgai-digital-twin (divergence report)
pub twin_divergence: Option<TwinDivergenceExtension>,
} Same trajectory, three independent verticals, zero glue. That's the product.
That's it.
Closed-form. Metered. Composed.
git clone https://github.com/openie-dev/mgai
cd mgai && cargo test