---
title: "math-calc-evaluation — Mova code model"
description: "Mova code model of math/src/calc.rs: components with their labels, obernants and the model text."
url: "https://groupants.elamur.ai/free/en/mova/math/src/calc.rs.groupant/evaluation.groupant/"
---
Elamur: [Mova](https://md.mova.elamur.ai/free/en/) · [Dictionary](https://md.dictionary.elamur.ai/free/en/) · [Research](https://md.research.elamur.ai/free/en/) · **Groupants**

This page as HTML: <https://groupants.elamur.ai/free/en/mova/math/src/calc.rs.groupant/evaluation.groupant/>

# math-calc-evaluation

The groupant beside math/src/calc.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

- **kind:** groupant_fragment
- **status:** partial source bound model
- **source:** [`math/src/calc.rs`](https://github.com/ElamurAI/mova-free/blob/main/math/src/calc.rs)
- **source SHA-256:** `81be7f264f451792…`
- **covers:** Env/eval implement ordered state changes, capped notes, exact/real coercions, lazy forms and inclusive binders. Range errors retain current variable; CRT writes modulus. Parent calls comb/nt and can duplicate evaluation. Work includes big arithmetic and every reached callee. (bytes 17753–55308)
- **part of:** [math-calc](https://md.groupants.elamur.ai/free/en/mova/math/src/calc.rs.groupant/)
- **repository folder:** [`math/src/calc.rs.groupant/evaluation.groupant`](https://github.com/ElamurAI/mova-free/tree/main/math/src/calc.rs.groupant/evaluation.groupant)
- **repository commit:** `48f2e6f74146`

> **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

| component | label | where |
|---|---|---|
| **approximant** | partial | [approximant](#approximant) |
| **ast** | partial | `../syntax.json` |
| **composition** | partial | `model.md` |
| **cost** | partial | [Cost](#cost) |
| **descriptant** | present | [descriptant](#descriptant) |
| **invariant** | partial | [invariant](#invariant) |
| **tests** | executed bounded checks | [tests](#tests) |

## 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.

| id | type | label | where |
|---|---|---|---|
| `behavior_complement` | behavior_complement | partial source derived model | [behavior_complement](#behavior-complement) |
| `reverse_reconstruction` | reverse_reconstruction | partial source derived model | [reverse_reconstruction](#reverse-reconstruction) |
| `state_prefix` | state_prefix | partial source derived model | [state_prefix](#state-prefix) |
| `argument_multiplicity` | argument_multiplicity | partial source derived model | [argument_multiplicity](#argument-multiplicity) |
| `resource_accounting` | resource_accounting | partial source derived model | [resource_accounting](#resource-accounting) |
| `numeric_coercion` | numeric_coercion | partial source derived model | [numeric_coercion](#numeric-coercion) |

## Parts

- [math-calc-evaluation-mixed-zero](https://md.groupants.elamur.ai/free/en/mova/math/src/calc.rs.groupant/evaluation.groupant/mixed-zero.groupant/)
- [math-calc-evaluation-ranged-binding](https://md.groupants.elamur.ai/free/en/mova/math/src/calc.rs.groupant/evaluation.groupant/ranged-binding.groupant/)

## Model text


### descriptant

#### math-calc-evaluation

Env/eval implement ordered state changes, capped notes, exact/real coercions, lazy forms and inclusive binders. Range errors retain current variable; CRT writes modulus. Parent calls comb/nt and can duplicate evaluation. Work includes big arithmetic and every reached callee.

Epoch 2026-10-31: complete source read, parent AST reused; partial finite evidence only.

### approximant

#### Scoped forward and cost

Env/eval implement ordered state changes, capped notes, exact/real coercions, lazy forms and inclusive binders. Range errors retain current variable; CRT writes modulus. Parent calls comb/nt and can duplicate evaluation. Work includes big arithmetic and every reached callee.

No executable percent surrogate claimed.

### invariant

#### Scoped invariant

Env/eval implement ordered state changes, capped notes, exact/real coercions, lazy forms and inclusive binders. Range errors retain current variable; CRT writes modulus. Parent calls comb/nt and can duplicate evaluation. Work includes big arithmetic and every reached callee.

Source range[17753,55308) bound by manifest digest. Parent domain applies, not arbitrary public states.

Additional source limits from independent review: range converts span through z_to_u64(...).unwrap_or(0); a positive span>u64 charges0 then loops without per-iteration ticks. Fingerprint factorial reduces its operand first: original operand P61+1 yields residue argument1 and result1, whereas mathematical factorial residue is0. Restrict original factorial operand domain; residue<=2M alone is insufficient. No huge input was executed.

### models

## Source-scoped typed relations

### behavior_complement

false and missing excludes unknown-variable error because right operand is skipped; ordinary Add evaluates both and can error. Successful normal ranged completion excludes a lingering overwritten binding; failure during body does not.

### reverse_reconstruction

Final sum0 admits an empty range or nonempty canceling body values; trace text cannot recover every iteration. A failed range with k=1 admits multiple previous k bindings because restoration was skipped.

### state_prefix

ranged saves k, ticks then inserts k then evaluates body. Body error retains inserted k; tick failure occurs before insertion of the next value. Normal/boolean early exit restores k before returning.

### argument_multiplicity

call first evaluates args; min/max/gcd/lcm and list aggregates call flat_args again. fact and at reenter eval. Therefore state/step effects can repeat even if output equals single evaluation.

### resource_accounting

range computes u64(span).unwrap_or(0), ticks once, then loops without ticks. Positive span>u64 can charge0 and still iterate. Ranged forms compare span with max_steps cast to i64 and tick each iteration; neither is a universal execution bound.

### numeric_coercion

Q/Q arithmetic exact; mixed values use f64 and real() finite gate, except exact zero shortcuts retain Q0. Traces cap 200 independently of steps. CRT additionally writes crt_modulus.

### tests

#### Evidence

See ../tests.md for actual checks and source mutant; this fragment adds no runtime test.

Env/eval implement ordered state changes, capped notes, exact/real coercions, lazy forms and inclusive binders. Range errors retain current variable; CRT writes modulus. Parent calls comb/nt and can duplicate evaluation. Work includes big arithmetic and every reached callee.

### wave34-composition

## Evaluation descendant composition

The mixed-zero child runs only after eval has produced operands and arith has checked list concatenation. It returns before generic arithmetic tick and real conversion. The ranged-binding child is dispatched directly by call for binder forms, before ordinary eager argument evaluation. Its sum/prod accumulator can invoke arith and therefore the mixed-zero child after evaluating a body. A skipped body or early witness never reaches later arithmetic. Body/accumulator failure retains the currently inserted binder; normal exit restores it before result extraction.

Both relations share Env.steps, vars and approx. A Q(0) result may retain approx=true from operand evaluation, so composing only numeric values loses meaningful state. Parent inversion requires a compatible body trace and exact restoration/failure cut; it is not the Cartesian product of independent child preimages. Existing callee checks, CRT writes and repeated ordinary argument evaluation remain historical parent models.

### Cost

For a reached range sum the costs of endpoint evaluation, iteration tick/binding, body evaluation and accumulator operations. The zero shortcut avoids only the local arith tail; operand evaluation is already paid. List retention and cloned exact values add storage not captured by steps. No speed claim or hard deadline bound.
