Elamur GroupantsโŒ•
โ˜ฐ

mlab-builtins-stats-distributions

The groupant beside mlab/src/builtins/stats.rs in the Mova repository: what the code computes, what it never does, how to go back from its outputs, its invariants, cost and checks.

Facts

Implementation material. A Mova code model describes this code at one source revision: partial models, finite checks and their stated scope. It is not a reviewed general exposition, and its labels are shown as written, never raised.

Components

componentlabelwhere
approximantpartialapproximant
astpartial../syntax.json
costsymbolic source derivedinvariant
descriptantpresentdescriptant
invariantpartialinvariant
testspartial bounded parent evidencetests

Obernants

The typed relations around the forward model: the behaviour complement (what the code never does), the reverse reconstruction (every input compatible with an output) and specialised views.

idtypelabelwhere
behavior_complementbehavior_complementpartial source derived modelbehavior_complement
reverse_reconstructionreverse_reconstructionpartial source derived modelreverse_reconstruction
broadcast_shapebroadcast_shapepartial source derived modelbroadcast_shape
tail_precisiontail_precisionpartial source derived modeltail_precision
branch_relationbranch_relationpartial source derived modelbranch_relation
resource_costresource_costpartial source derived modelresource_cost

Model text

descriptant

mlab-builtins-stats-distributions

Registry installs scalar-broadcast distributions. bcast checks arity/types then identical nonscalar shape, defaults scalar parameters. phi=erfc(-z/sqrt2)/2 with infinities explicit. phi_inv uses statrs seed plus2 Newton steps. dinv linearly returns least k with CDF(k)>=p, p=1 returns kmax.

Epoch 2026-10-31: isolated source-bound fragment over bytes [907,7891); includes no claim beyond this relation. Source hash bdc3772b09d9113e108afa29e391fee97a5372caf9052bb1689996c41c94116f.

approximant

distributions: forward relation

Registry installs scalar-broadcast distributions. bcast checks arity/types then identical nonscalar shape, defaults scalar parameters. phi=erfc(-z/sqrt2)/2 with infinities explicit. phi_inv uses statrs seed plus2 Newton steps. dinv linearly returns least k with CDF(k)>=p, p=1 returns kmax.

Domain: Finite, well-shaped bounded observations unless branch explicitly describes NaN/Inf. Direct public chi2/OLS helpers assume dimensions not checked at every index; wrappers add validation.

Executable surrogate gap: no measured cheaper implementation with a useful scoped metric is supplied. Categorical/error/effect relations are exact obligations, not percent losses. Future numeric caps only1/2/5/10%.

invariant

distributions: invariant and cost

Scalar parameters broadcast to first nonscalar shape, not general singleton-axis broadcasting.

libm erfc avoids 1-erf cancellation; numerical implementation not a universal accuracy certificate.

Scope-specific cost: Broadcast O(ncells*nparams + distribution evaluation), discrete inverse O(returned k) CDF calls without bounded cap; phi_inv two Newton steps.

models

behavior_complement

Invalid p excludes finite inverse except NaN mapping; continuous unsupported parameters become NaN, not interpreter errors. Discrete p=1 can yield infinity.

reverse_reconstruction

CDF observation admits parameters and x satisfying F_theta(x)=p; discrete quantile admits interval F(k-1)<p<=F(k), endpoint conventions special.

broadcast_shape

Scalar parameters broadcast to first nonscalar shape, not general singleton-axis broadcasting.

tail_precision

libm erfc avoids 1-erf cancellation; numerical implementation not a universal accuracy certificate.

branch_relation

Registry installs scalar-broadcast distributions. bcast checks arity/types then identical nonscalar shape, defaults scalar parameters. phi=erfc(-z/sqrt2)/2 with infinities explicit. phi_inv uses statrs seed plus2 Newton steps. dinv linearly returns least k with CDF(k)>=p, p=1 returns kmax.

resource_cost

Broadcast O(ncells*nparams + distribution evaluation), discrete inverse O(returned k) CDF calls without bounded cap; phi_inv two Newton steps.

tests

Evidence boundary

See ../tests.md for the actual selected source test and mutant. These tests sample the file, not every fragment branch. Invalid p excludes finite inverse except NaN mapping; continuous unsupported parameters become NaN, not interpreter errors. Discrete p=1 can yield infinity. Other branches here are source-derived and unexecuted unless the parent test explicitly calls them.

This page in Markdown โ†’ https://md.groupants.elamur.ai/free/en/mova/mlab/src/builtins/stats.rs.groupant/distributions.groupant/