# lawref.evaluator.constraints

*module*

Non-derivational constraints [§93.1](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/14-part-xiii-a-non-derivational-constraints.ru.md#931-назначение)–[§93.3](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/14-part-xiii-a-non-derivational-constraints.ru.md#933-исполнение-и-место-результата-errata-e-0086) (errata E-0086).

Constraint не выводит и не поражает: он СПРАШИВАЕТ готовое состояние —
после всех strata [§111](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/16-part-xv-defeasible-semantics-and-conflict-resolution.ru.md#111-порядок-evaluation-strata) и norm runtime [§280.3](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/40-part-xxxvii-a-operational-algorithm.ru.md#2803-norm-runtime), перед ответом на запрос
([§280.2](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/40-part-xxxvii-a-operational-algorithm.ru.md#2802-evaluation): «evaluate finite constraint applications after their producer
barriers»). До E-0086 ни одна реализация его не вычисляла: prose называла
исходы, но не момент и не место результата (замер 01.09.2026, `kz.tuystyq`).

Порядок здесь нормативен байт в байт ([§208](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/28-part-xxvii-canonical-legal-ir.ru.md#208-canonical-serialization)): constraint-ы — по stable ID,
подстановки — по каноническим байтам; `law-eval/src/constraints.rs` — порт.

## lawref.evaluator.constraints.evaluate_constraints

*function*

```python
def evaluate_constraints(nodes: list[dict], store: SupportStore, registry: ProofRegistry, manifest: dict, query_id: str, legal_time: str, issues: list[dict], env: Any = None) -> tuple[list[dict], list[dict]]
```

Ground constraint applications [§93.3](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/14-part-xiii-a-non-derivational-constraints.ru.md#933-исполнение-и-место-результата-errata-e-0086) → (результаты `CONSTRAINT`, узлы
`constraint_check`). Issues [§93.3](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/14-part-xiii-a-non-derivational-constraints.ru.md#933-исполнение-и-место-результата-errata-e-0086) дописываются в `issues` по ходу.

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/evaluator/constraints.py#L85-L191)

## lawref.evaluator.constraints.merge_into

*function*

```python
def merge_into(doc: dict, results: list[dict], proof_nodes: list[dict], registry_nodes: list[dict]) -> dict
```

Вписать находки [§93.3](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/14-part-xiii-a-non-derivational-constraints.ru.md#933-исполнение-и-место-результата-errata-e-0086) в готовый документ ответа: результаты — после
ответов на запрос, узлы — корнями, посылки — замкнуто по [§179](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/26-part-xxv-proof-graph-and-explanations.ru.md#179-proof-graph).

Ветви запросов собирают `proofGraph.nodes` по-разному (term/calendar_op
несут только корень), поэтому замыкание по посылкам достраивается из
реестра: узлы, которых в документе нет, добавляются в порядке реестра.

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/evaluator/constraints.py#L194-L223)
