---
title: "algorithm-dag-path-count-validation — Mova code model"
description: "Mova code model of algorithms/src/dag_path_count/mod.rs: components with their labels, obernants and the model text."
url: "https://groupants.elamur.ai/free/en/mova/algorithms/src/dag_path_count/mod.rs.groupant/validation.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/algorithms/src/dag_path_count/mod.rs.groupant/validation.groupant/>

# algorithm-dag-path-count-validation

The groupant beside algorithms/src/dag_path_count/mod.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:** [`algorithms/src/dag_path_count/mod.rs`](https://github.com/ElamurAI/mova-free/blob/main/algorithms/src/dag_path_count/mod.rs)
- **source SHA-256:** `b373088f752be5d1…`
- **covers:** Validate the source first, then delegate full endpoint and cycle checks to topological_sort. No DP state exists before this succeeds. Output is a full permutation with all arcs forward; a successful order cannot uniquely recover adjacency. (bytes 970–1180)
- **part of:** [algorithm-dag-path-count](https://md.groupants.elamur.ai/free/en/mova/algorithms/src/dag_path_count/mod.rs.groupant/)
- **repository folder:** [`algorithms/src/dag_path_count/mod.rs.groupant/validation.groupant`](https://github.com/ElamurAI/mova-free/tree/main/algorithms/src/dag_path_count/mod.rs.groupant/validation.groupant)
- **repository commit:** `855da7bd4a7b`

> **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 | [Forward](#forward) |
| **ast** | partial | `../syntax.json` |
| **composition** | partial | [Composition](#composition) |
| **descriptant** | present | [Epoch memory](#epoch-memory) |
| **invariant** | partial | [Invariant](#invariant) |
| **tests** | executed bounded checks | `../model.md#evidence` |

## 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) |
| `source-first` | source_error_priority | partial source derived model | [source-first](#source-first) |
| `endpoints-first` | endpoint_error_priority | partial source derived model | [endpoints-first](#endpoints-first) |
| `global-domain` | whole_graph_validation | partial source derived model | [global-domain](#global-domain) |
| `tie-order` | deterministic_order | partial source derived model | [tie-order](#tie-order) |

## Model text


Source hash and half-open byte scope are in manifest.json. Domain: reachable entry states from the parent function with successful allocation, trusted Rust compiler/library and fixed input. Observation: scoped exit state or early returned error.

### Forward
Given graph and source, first reject source >= graph.len(). Otherwise delegate full topological sorting. Success emits a full ordered vertex permutation; invalid endpoints precede cycle rejection.

### Invariant
No count allocation or arithmetic occurs before global graph validation succeeds. Every successful order contains each vertex once and all arcs point forward.

### Cost
O(E+V log(V+1)) time and O(V) auxiliary allocation inherited from topological_sort; the source failure is constant-time.

### behavior-complement
Type: behavior_complement. Within the declared reachable entry states and scoped return/state observations, let R be the forward relation above. Its complement consists of all incompatible outputs or state transitions: violations of the scoped invariant, incorrect early errors or absent transitions required by R. This is a specification complement, not merely a collection of negative fixtures. Given graph and source, first reject source >= graph.len(). Otherwise delegate full topological sorting. Success emits a full ordered vertex permutation; invalid endpoints precede cycle rejection.
Status: partial_source_derived_model. The domain, observation and assumptions above apply. Evidence is inherited from ../evidence.md; scoped generalizations beyond those finite cases remain unproved.

### reverse-reconstruction
Type: reverse_reconstruction. A topological order admits many arc sets pointing forward; it does not reconstruct adjacency or parallel multiplicity. Each error admits all inputs having its first failed condition under the stated precedence.
Status: partial_source_derived_model. The domain, observation and assumptions above apply. Evidence is inherited from ../evidence.md; scoped generalizations beyond those finite cases remain unproved.

### source-first
Type: source_error_priority. Even a malformed edge is not inspected when the source is invalid.
Status: partial_source_derived_model. The domain, observation and assumptions above apply. Evidence is inherited from ../evidence.md; scoped generalizations beyond those finite cases remain unproved.

### endpoints-first
Type: endpoint_error_priority. An invalid target anywhere wins over a cycle, including in an earlier adjacency row.
Status: partial_source_derived_model. The domain, observation and assumptions above apply. Evidence is inherited from ../evidence.md; scoped generalizations beyond those finite cases remain unproved.

### global-domain
Type: whole_graph_validation. Every component participates in ordering, including vertices unreachable from source.
Status: partial_source_derived_model. The domain, observation and assumptions above apply. Evidence is inherited from ../evidence.md; scoped generalizations beyond those finite cases remain unproved.

### tie-order
Type: deterministic_order. Smallest available vertex is chosen; it establishes deterministic overflow witness order for the next stage.
Status: partial_source_derived_model. The domain, observation and assumptions above apply. Evidence is inherited from ../evidence.md; scoped generalizations beyond those finite cases remain unproved.

### Composition
This fragment relies on its parent's entry preconditions and establishes only the exit conditions stated here. Parent composition wires traversal labels into canonicalization, or global ordering into checked counting. The next stage's preconditions require all preceding invariants, not merely local test success.

### Epoch memory
Prospective predictions and finite outcomes are retained in the parent model. The child scope clarifies interaction obligations; no independent execution or universal proof is claimed.

### Limits
Allocation failure excluded. Partial syntax has no semantic resolution or macro expansion. No useful certified approximation metric was established; exact finite checks are not approximate surrogates.
