# lawref.evaluator.focus

*module*

`focused_truth` — полнота относительно вопроса (SPEC [§181.3](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/26-part-xxv-proof-graph-and-explanations.ru.md#1813-полнота-относительно-вопроса-focused_truth-decision-0368), DECISION-0368).

Эталон ВСЕГДА исполняет полный `truth` о том же литерале и проецирует его
документ `D` по конусу вопроса: `ProjectFocused(D)`. Способ вычисления в
байты не входит; порт вправе исполнять только подпрограмму конуса там, где
статический квалификатор DECISION-0368 [§3.8](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/02-part-ii-goals-and-scope.ru.md#3-цели-law-dsl-core-01) это разрешил, но обязан выдать
ровно эти байты.

Функции модуля — чистые функции от IR вида программы и документа `D`:
конус (`cone`), профиль первого среза (`profile_refusal`), проекция
(`project`). Порядок всех перечней — [§208](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/28-part-xxvii-canonical-legal-ir.ru.md#208-canonical-serialization)-порядок строк либо порядок `D`.

## lawref.evaluator.focus.CONTRACT

*attribute* · *module attribute*

```python
CONTRACT = 'law.focus/0.1'
```

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

## lawref.evaluator.focus.PROFILE

*attribute* · *module attribute*

```python
PROFILE = 'i-relational-defeasible'
```

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

## lawref.evaluator.focus.SCHEMA_VERSION

*attribute* · *module attribute*

```python
SCHEMA_VERSION = 'law.core.focused-evaluation/0.1'
```

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

## lawref.evaluator.focus.comparable_nodes

*function*

```python
def comparable_nodes(document: dict) -> list[bytes]
```

Узлы proof focused-документа в форме для сверки двух путей: без узла
завершения и корня, с сертификатами без привязки к программе и БЕЗ id
(id сертификата [§181.1](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/26-part-xxv-proof-graph-and-explanations.ru.md#1811-candidate-closure-certificate) — контентный и включает эту привязку).

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

## lawref.evaluator.focus.cone

*function*

```python
def cone(nodes: list[dict], predicate: str) -> tuple[list[str], list[str]]
```

[§181.3](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/26-part-xxv-proof-graph-and-explanations.ru.md#1813-полнота-относительно-вопроса-focused_truth-decision-0368): наименьшее множество предикатов, замкнутое назад по рёбрам
графа [§110](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/16-part-xv-defeasible-semantics-and-conflict-resolution.ru.md#110-stratification) (те же рёбра, что у замыканий [§181.2](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/26-part-xxv-proof-graph-and-explanations.ru.md#1812-total-outcome-при-блокирующей-диагностике)) и по ограничениям [§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),
читающим конус. Возвращает (предикаты, ограничения) в [§208](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/28-part-xxvii-canonical-legal-ir.ru.md#208-canonical-serialization)-порядке строк.

Вершины замыканий [§70](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/10-part-x-propositions-and-four-valued-support.ru.md#70-closed-world-declarations) (id `closure_policy`) — вершины графа [§110](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/16-part-xv-defeasible-semantics-and-conflict-resolution.ru.md#110-stratification) наравне с
предикатами; в перечень предикатов конуса они не входят.

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

## lawref.evaluator.focus.cone_hash

*function*

```python
def cone_hash(predicates: list[str]) -> str
```

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

## lawref.evaluator.focus.cone_subprogram

*function*

```python
def cone_subprogram(ir: dict, predicates: list[str]) -> dict
```

Программа, в которой из правил остались только правила с литеральной
головой предиката конуса; прочие узлы (декларации, утверждения,
ограничения, замыкания, приоритеты) — без изменений и в прежнем порядке.

Не норма, а материал теоремы [§3.6](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/02-part-ii-goals-and-scope.ru.md#3-цели-law-dsl-core-01) п. 6: её вывод обязан дать те же узлы
proof по конусу, что и проекция полного документа. Манифест у неё свой
(другой `programHash`), поэтому сравниваются узлы, а не документы.

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

## lawref.evaluator.focus.evaluate_focused

*function*

```python
def evaluate_focused(request, evaluate: Callable[[Any], dict]) -> dict
```

`focused_truth`: полный `truth` о том же литерале + `ProjectFocused`.

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

## lawref.evaluator.focus.profile_refusal

*function*

```python
def profile_refusal(nodes: list[dict], predicates: list[str]) -> dict | None
```

[§181.3](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/26-part-xxv-proof-graph-and-explanations.ru.md#1813-полнота-относительно-вопроса-focused_truth-decision-0368) «Вне профиля первого среза»: пересечение конуса с предикатами
эффектов полномочий [§127](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/18-part-xvii-normative-positions.ru.md#127-power) (E-0134) и свёртки процедур [§161.1](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/22-part-xxi-procedures.ru.md#1611-свёртка-истории-decision-0156) — отказ до
вычисления. Первая найденная причина в фиксированном порядке.

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

## lawref.evaluator.focus.project

*function*

```python
def project(full: dict, query: dict, nodes: list[dict], case: dict, predicates: list[str], constraints: list[str]) -> dict
```

`ProjectFocused(D)` — [§181.3](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/26-part-xxv-proof-graph-and-explanations.ru.md#1813-полнота-относительно-вопроса-focused_truth-decision-0368) пп. 1–7.

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

## lawref.evaluator.focus.refusal_document

*function*

```python
def refusal_document(full: dict, query_id: str, predicates: list[str], issue: dict) -> dict
```

Отказ вида: манифест `D`, одна issue, без результата и без proof.

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

## lawref.evaluator.focus.view_nodes

*function*

```python
def view_nodes(request) -> list[dict]
```

Узлы вида программы — те же оси, что у полного вызова ([§181.3](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/26-part-xxv-proof-graph-and-explanations.ru.md#1813-полнота-относительно-вопроса-focused_truth-decision-0368): конус
считается после изоляции прочтений и проекции редакций).

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