# lawref.population

*module*

`population-impact/0.1` — эталон оценки реформы на закреплённой выборке
(DECISION-0255; трек О, `spec/LAYERS-NEXT.ru.md` [§2](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/01-part-i-audit.ru.md#2-что-необходимо-исправить)–[§3](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/02-part-ii-goals-and-scope.ru.md#3-цели-law-dsl-core-01)).

Оркестрация без семантики (инвариант CLAUDE.md №5): строка банка — два вызова
операции `ask` [§168.4](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/24-part-xxiii-cases-snapshots-evaluation.ru.md#1684-пакет-дело-и-операция-ask-decision-0165) (`lawref.ask`) над пакетами-делами сторон; исход
сравнивается проекцией `scenario._outcome_view`, модели — `semdiff` [§215](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/29-part-xxviii-compiler-pipeline.ru.md#215-semantic-diff).
Инструмент ничего не выводит из права: состояние стороны — механическая
проекция закрытого evaluation-документа по матрице [§5](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/02-part-ii-goals-and-scope.ru.md#5-главные-инварианты-дизайна) решения, как
`impact.verdict`. Взвешенные суммы — арифметика хоста над уже вычисленными
значениями `Money` ([§6](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/03-part-iii-architecture-and-conformance.ru.md#6-слои-системы) решения), а не правовой ответ, и так не называются.

Поток (последовательный: у эталона одна задача — байты). Все отказы [§12](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/04-part-iv-project-and-files.ru.md#12-расширения-файлов) —
до первой строки:

    USAGE                              флаги, --bank, компилятор (CLI)
    → путь хранилища, без создания каталога  (POPULATION_STORE_ERROR)
    → форма банка по схеме, самопин, веса    (POPULATION_BANK_INVALID)
    → открытие стороны: пины law.toml, law.lock, ресурсы; понижение ОДНОГО
      корня, связанный мир W, theoryHash/artifactHash [§209](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/28-part-xxvii-canonical-legal-ir.ru.md#209-theory-hash-и-artifact-hash)
                                       (POPULATION_WORLD_MISMATCH)
    → semantic diff [§215](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/29-part-xxviii-compiler-pipeline.ru.md#215-semantic-diff) миров сторон
    → банк против сторон: одно множество [[cases]] и равные байты .lawcase;
      понижение дел строк, один вид legalTime (H4), Instant со смещением и не
      точнее микросекунд ([§2](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/01-part-i-audit.ru.md#2-что-необходимо-исправить))          (POPULATION_BANK_INVALID)
    → дело каждой строки               (POPULATION_CASE_UNKNOWN)
    → мера на обеих сторонах, статически  (POPULATION_MEASURE_INVALID)
    → создание каталога хранилища      (POPULATION_STORE_ERROR)
    → строка за строкой: ask(before), ask(after) → документы в хранилище
      по sha256 канонических байтов → состояния сторон → класс строки
    → покрытие, суммы, вердикт [§7](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/03-part-iii-architecture-and-conformance.ru.md#7-обязательные-компоненты-реализации) → reportCore (канон [§208](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/28-part-xxvii-canonical-legal-ir.ru.md#208-canonical-serialization)) + receipt.

Сбой посреди прогона — `FAILED` строки: в ядре только код и фиксированное
сообщение по коду (`FAILED_MESSAGES`), подробность — в `receipt.failures` и
stderr ([§5](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/02-part-ii-goals-and-scope.ru.md#5-главные-инварианты-дизайна)). Необработанное исключение хоста и сбой, после которого отчёт
выдать нельзя, — код 4 без отчёта с диагностикой в stderr ([§12](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/04-part-iv-project-and-files.ru.md#12-расширения-файлов)).

Понижение исходников — работа компилятора: модуль получает функции `Lower`
(дело) и `LowerRoot` (корень), а вызов `lawc` живёт в CLI (`lawc_lowering`,
тот же путь, что у `python -m lawref ask`).

## lawref.population.AMBIGUOUS_MEASURE

*attribute* · *module attribute*

```python
AMBIGUOUS_MEASURE = 'AMBIGUOUS_MEASURE'
```

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

## lawref.population.ASK_FAILED_MESSAGE

*attribute* · *module attribute*

```python
ASK_FAILED_MESSAGE = 'подготовка или исполнение ask отказали (§168.4)'
```

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

## lawref.population.BANK_INVALID

*attribute* · *module attribute*

```python
BANK_INVALID = 'POPULATION_BANK_INVALID'
```

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

## lawref.population.BANK_SCHEMA_VERSION

*attribute* · *module attribute*

```python
BANK_SCHEMA_VERSION = 'law.population.bank/0.1'
```

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

## lawref.population.BLOCKING_SEVERITIES

*attribute* · *module attribute*

```python
BLOCKING_SEVERITIES = ('error', 'fatal')
```

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

## lawref.population.CASE_LOWERING

*attribute* · *module attribute*

```python
CASE_LOWERING = 'POPULATION_CASE_LOWERING'
```

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

## lawref.population.CASE_UNKNOWN

*attribute* · *module attribute*

```python
CASE_UNKNOWN = 'POPULATION_CASE_UNKNOWN'
```

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

## lawref.population.CLASSES

*attribute* · *module attribute*

```python
CLASSES = (VALUE_ON_BOTH, VALUE_BEFORE_ONLY, VALUE_AFTER_ONLY, NO_COMPARABLE_VALUE, EXCLUDED, FAILED)
```

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

## lawref.population.CRASH_EXIT

*attribute* · *module attribute*

```python
CRASH_EXIT = 4
```

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

## lawref.population.DOCUMENT_CANON

*attribute* · *module attribute*

```python
DOCUMENT_CANON = 'POPULATION_DOCUMENT_CANON'
```

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

## lawref.population.EXCLUDED

*attribute* · *module attribute*

```python
EXCLUDED = 'EXCLUDED'
```

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

## lawref.population.EXIT_CODES

*attribute* · *module attribute*

```python
EXIT_CODES = {VERDICT_INCOMPLETE: 4, VERDICT_CHANGE: 1, VERDICT_NO_COMPARABLE_WEIGHT: 3, VERDICT_NO_WEIGHTED_CHANGE: 0}
```

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

## lawref.population.EXIT_HELP

*attribute* · *module attribute*

```python
EXIT_HELP = 'коды выхода population-impact: 0 NO_WEIGHTED_CHANGE, 1 CHANGE, 2 отказ (USAGE, POPULATION_*), 3 NO_COMPARABLE_WEIGHT, 4 INCOMPLETE либо сбой без отчёта (у impact и impact-editions коды 3 и 4 значат другое)'
```

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

## lawref.population.FAILED

*attribute* · *module attribute*

```python
FAILED = 'FAILED'
```

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

## lawref.population.FAILED_MESSAGES

*attribute* · *module attribute*

```python
FAILED_MESSAGES = {CASE_LOWERING: 'понижение дела на стороне не удалось (§168.4)', RESULT_COUNT: 'документ несёт не один результат запроса меры (§4)', STORE_ERROR: 'запись документа в хранилище не удалась (§9)', DOCUMENT_CANON: 'документ не канонизируется по §208', PANIC: 'крах исполнения строки (§5)'}
```

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

## lawref.population.Lower

*attribute* · *module attribute*

```python
Lower = Callable[[Path, RegisteredCase, dict], tuple[dict, dict]]
```

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

## lawref.population.LowerRoot

*attribute* · *module attribute*

```python
LowerRoot = Callable[[Path, dict], dict]
```

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

## lawref.population.MEASURE_CURRENCY

*attribute* · *module attribute*

```python
MEASURE_CURRENCY = 'MEASURE_CURRENCY'
```

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

## lawref.population.MEASURE_INVALID

*attribute* · *module attribute*

```python
MEASURE_INVALID = 'POPULATION_MEASURE_INVALID'
```

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

## lawref.population.MEASURE_KIND

*attribute* · *module attribute*

```python
MEASURE_KIND = 'MEASURE_KIND'
```

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

## lawref.population.MISSING_PARAMETER_VALUE

*attribute* · *module attribute*

```python
MISSING_PARAMETER_VALUE = 'MISSING_PARAMETER_VALUE'
```

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

## lawref.population.MONEY_TYPE

*attribute* · *module attribute*

```python
MONEY_TYPE = 'urn:law:std#Money'
```

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

## lawref.population.MONEY_TYPE_NAMES

*attribute* · *module attribute*

```python
MONEY_TYPE_NAMES = frozenset({'Money', MONEY_TYPE})
```

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

## lawref.population.NO_COMPARABLE_VALUE

*attribute* · *module attribute*

```python
NO_COMPARABLE_VALUE = 'NO_COMPARABLE_VALUE'
```

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

## lawref.population.NO_VALUE

*attribute* · *module attribute*

```python
NO_VALUE = 'NO_VALUE'
```

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

## lawref.population.PANIC

*attribute* · *module attribute*

```python
PANIC = 'PANIC'
```

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

## lawref.population.REFUSED_EXIT

*attribute* · *module attribute*

```python
REFUSED_EXIT = 2
```

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

## lawref.population.REPORT_SCHEMA_VERSION

*attribute* · *module attribute*

```python
REPORT_SCHEMA_VERSION = 'law.population.impact-report/0.1'
```

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

## lawref.population.RESULT_COUNT

*attribute* · *module attribute*

```python
RESULT_COUNT = 'POPULATION_RESULT_COUNT'
```

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

## lawref.population.SIDES

*attribute* · *module attribute*

```python
SIDES = ('before', 'after')
```

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

## lawref.population.STORE_ERROR

*attribute* · *module attribute*

```python
STORE_ERROR = 'POPULATION_STORE_ERROR'
```

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

## lawref.population.TOOL

*attribute* · *module attribute*

```python
TOOL = 'population-impact'
```

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

## lawref.population.USAGE

*attribute* · *module attribute*

```python
USAGE = 'USAGE'
```

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

## lawref.population.USAGE_TEXT

*attribute* · *module attribute*

```python
USAGE_TEXT = 'python -m lawref population-impact --bank <bank.json> (--store <каталог> | --no-store | --no-proof) [--json] [--lawc <бинарь>]'
```

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

## lawref.population.VALUE

*attribute* · *module attribute*

```python
VALUE = 'VALUE'
```

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

## lawref.population.VALUE_AFTER_ONLY

*attribute* · *module attribute*

```python
VALUE_AFTER_ONLY = 'VALUE_AFTER_ONLY'
```

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

## lawref.population.VALUE_BEFORE_ONLY

*attribute* · *module attribute*

```python
VALUE_BEFORE_ONLY = 'VALUE_BEFORE_ONLY'
```

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

## lawref.population.VALUE_ON_BOTH

*attribute* · *module attribute*

```python
VALUE_ON_BOTH = 'VALUE_ON_BOTH'
```

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

## lawref.population.VERDICT_CHANGE

*attribute* · *module attribute*

```python
VERDICT_CHANGE = 'CHANGE'
```

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

## lawref.population.VERDICT_INCOMPLETE

*attribute* · *module attribute*

```python
VERDICT_INCOMPLETE = 'INCOMPLETE'
```

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

## lawref.population.VERDICT_NO_COMPARABLE_WEIGHT

*attribute* · *module attribute*

```python
VERDICT_NO_COMPARABLE_WEIGHT = 'NO_COMPARABLE_WEIGHT'
```

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

## lawref.population.VERDICT_NO_WEIGHTED_CHANGE

*attribute* · *module attribute*

```python
VERDICT_NO_WEIGHTED_CHANGE = 'NO_WEIGHTED_CHANGE'
```

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

## lawref.population.WORLD_MISMATCH

*attribute* · *module attribute*

```python
WORLD_MISMATCH = 'POPULATION_WORLD_MISMATCH'
```

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

## lawref.population.Lowered

*class* · *dataclass*

```python
class Lowered
```

Понижение дела на стороне: (CLIR корня, документ дела) либо сбой.

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

### lawref.population.Lowered.case

*attribute* · *instance attribute*

```python
case: dict | None
```

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

### lawref.population.Lowered.failure

*attribute* · *instance attribute*

```python
failure: dict | None
```

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

### lawref.population.Lowered.root_ir

*attribute* · *instance attribute*

```python
root_ir: dict | None
```

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

### lawref.population.Lowered.legal_time

*property*

```python
legal_time: str | None
```

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

## lawref.population.Outcome

*class* · *dataclass*

```python
class Outcome
```

Итог `ask` одной стороны: документ либо сбой.

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

### lawref.population.Outcome.document

*attribute* · *instance attribute*

```python
document: dict | None
```

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

### lawref.population.Outcome.failure

*attribute* · *instance attribute*

```python
failure: dict | None
```

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

## lawref.population.PopulationRefusal

*class*

```python
class PopulationRefusal(Exception)
```

Bases: `Exception`

Отказ [§12](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/04-part-iv-project-and-files.ru.md#12-расширения-файлов) решения: отчёта нет, код выхода 2.

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

### lawref.population.PopulationRefusal.code

*attribute* · *instance attribute*

```python
code = code
```

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

### lawref.population.PopulationRefusal.message

*attribute* · *instance attribute*

```python
message = message
```

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

### lawref.population.PopulationRefusal.line

*method*

```python
def line() -> str
```

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

## lawref.population.Side

*class* · *dataclass*

```python
class Side
```

Открытая сторона банка: пакет-дело с проверенными пинами.

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

### lawref.population.Side.cases

*attribute* · *instance attribute*

```python
cases: dict[str, RegisteredCase]
```

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

### lawref.population.Side.context

*attribute* · *instance attribute*

```python
context: dict
```

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

### lawref.population.Side.label

*attribute* · *instance attribute*

```python
label: str
```

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

### lawref.population.Side.registration

*attribute* · *class attribute* · *instance attribute*

```python
registration: RegistrationChecked | None = None
```

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

### lawref.population.Side.resources

*attribute* · *class attribute* · *instance attribute*

```python
resources: ask_module.ResourcesChecked | None = None
```

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

### lawref.population.Side.root

*attribute* · *instance attribute*

```python
root: Path
```

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

### lawref.population.Side.world

*attribute* · *instance attribute*

```python
world: dict
```

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

## lawref.population.bank_content_hash

*function*

```python
def bank_content_hash(bank: dict) -> str
```

Самопин банка ([§8](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/03-part-iii-architecture-and-conformance.ru.md#8-conformance-профили)): sha256 канонических байтов [§208](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/28-part-xxvii-canonical-legal-ir.ru.md#208-canonical-serialization) банка без
`contentHash`, строки упорядочены по `rowId` — перестановка строк во
входе хэш не меняет.

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

## lawref.population.build_report

*function*

```python
def build_report(bank_path: Path, store_path: str | Path | None, lower: Lower, lower_root: LowerRoot | None = None, write_store: bool = True, record_proof: bool = True) -> dict
```

Полный прогон банка: отчёт `{reportCore, reportCoreHash, receipt}`;
отказ [§12](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/04-part-iv-project-and-files.ru.md#12-расширения-файлов) — `PopulationRefusal`, всегда до первой строки.

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

## lawref.population.canonical_legal_time

*function*

```python
def canonical_legal_time(value: str) -> str
```

Каноническая форма [§208](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/28-part-xxvii-canonical-legal-ir.ru.md#208-canonical-serialization) даты банка ([§2](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/01-part-i-audit.ru.md#2-что-необходимо-исправить)): `Instant` — представление UTC
`Z` (`2026-01-01T12:00:00+05:00` → `2026-01-01T07:00:00Z`, дробь секунд
без хвостовых нулей); `Date` и прочее — как есть. `lawref.canon` мгновений
не нормализует, поэтому запись — здесь.

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

## lawref.population.check_bank

*function*

```python
def check_bank(bank: object) -> None
```

Форма банка по схеме целиком — закрытость, обязательные поля, запрос
меры, закреплённые ресурсы ([§1](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/01-part-i-audit.ru.md#1-что-сохраняется-без-изменений)) — плюс отрицательный вес, уникальность
rowId и самопин ([§6](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/03-part-iii-architecture-and-conformance.ru.md#6-слои-системы), [§8](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/03-part-iii-architecture-and-conformance.ru.md#8-conformance-профили), [§12](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/04-part-iv-project-and-files.ru.md#12-расширения-файлов)).

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

## lawref.population.check_case_sets

*function*

```python
def check_case_sets(before: Side, after: Side) -> None
```

[§1](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/01-part-i-audit.ru.md#1-что-сохраняется-без-изменений): одно множество имён [[cases]] и побайтово равные `.lawcase`.

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

## lawref.population.check_legal_time_kinds

*function*

```python
def check_legal_time_kinds(lowered: dict[str, dict[str, Lowered]]) -> None
```

H4: один вид `legalTime` на банк (`Date` либо `Instant`).

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

## lawref.population.check_legal_time_precision

*function*

```python
def check_legal_time_precision(lowered: dict[str, dict[str, Lowered]]) -> None
```

[§2](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/01-part-i-audit.ru.md#2-что-необходимо-исправить): `Instant` без явного смещения или с дробью секунд длиннее шести
знаков — отказ банка. Момент без смещения не определён (SPEC [§5](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/02-part-ii-goals-and-scope.ru.md#5-главные-инварианты-дизайна): у
литералов нет скрытой зоны), точность сверх микросекунд — граница 0.1.

`lawc lower-ask` дело с `legal_time` без смещения понижает; отказ
`CONTEXT_FIELD_INVALID` дала бы лишь подготовка `ask` уже в строке, поэтому
проверка стоит до первой строки (фикстура: `bank-instant-no-offset`).

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

## lawref.population.check_measure

*function*

```python
def check_measure(measure: dict, side: Side, case_name: str) -> None
```

[§3](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/02-part-ii-goals-and-scope.ru.md#3-цели-law-dsl-core-01) статически: вид запроса, `distinct` (H2), `options.empty` в терме
запроса (H3), явный тип переменной в любой записи, разрешение в мире стороны.

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

## lawref.population.check_store_path

*function*

```python
def check_store_path(path: str | Path | None) -> Path
```

Отказ STORE второй после USAGE ([§12](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/04-part-iv-project-and-files.ru.md#12-расширения-файлов)), но каталог здесь НЕ создаётся:
банк, отвергнутый позже, не оставляет пустого хранилища ([§9](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/04-part-iv-project-and-files.ru.md#9-стандартная-структура-проекта)).

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

## lawref.population.create_store

*function*

```python
def create_store(store: Path) -> Path
```

Создание каталога хранилища после всех отказов [§12](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/04-part-iv-project-and-files.ru.md#12-расширения-файлов), до первой строки.

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

## lawref.population.decimal_text

*function*

```python
def decimal_text(value: Fraction) -> str
```

Точная десятичная запись [§208](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/28-part-xxvii-canonical-legal-ir.ru.md#208-canonical-serialization) (канон `canonical_decimal`).

Веса и значения `Money` — конечные десятичные дроби, а их суммы и
произведения конечны по построению; иной знаменатель означает дефект
инструмента, а не округление ([§58](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/09-part-ix-values-terms-expressions.ru.md#58-arithmetic): float и молчаливое округление
запрещены).

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

## lawref.population.execute

*function*

```python
def execute(side: Side, case_name: str, lowered: Lowered, query: dict, record_proof: bool = True) -> Outcome
```

`ask` пониженного дела на стороне. Отказ подготовки и крах — FAILED.

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

## lawref.population.exit_code

*function*

```python
def exit_code(report: dict) -> int
```

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

## lawref.population.failed_record

*function*

```python
def failed_record(code: str) -> dict
```

Состояние FAILED в ядре: код и фиксированное сообщение по коду ([§5](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/02-part-ii-goals-and-scope.ru.md#5-главные-инварианты-дизайна)).

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

## lawref.population.failure

*function*

```python
def failure(code: str, detail: str) -> dict
```

Сбой стороны: код (в ядро) и подробность (в квитанцию и stderr).

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

## lawref.population.lawc_lowering

*function*

```python
def lawc_lowering(lawc: list[str]) -> Lower
```

Понижение дела тем же путём, что `python -m lawref ask`: корень — `lawc
lower --imports`, дело — `lawc lower-ask` под тем же контекстом, композиция
[§168.5](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/24-part-xxiii-cases-snapshots-evaluation.ru.md#1685-композиция-сведений-дел-decision-0169) — `core_cli._composed_case`. Атрибут `root` — понижение одного корня.

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

## lawref.population.lawc_root_lowering

*function*

```python
def lawc_root_lowering(lawc: list[str]) -> LowerRoot
```

Понижение одного корня (`lawc lower --imports`) — шаг открытия стороны
([§1](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/01-part-i-audit.ru.md#1-что-сохраняется-без-изменений)), общий с `python -m lawref ask` (`core_cli._lower_package_root`).

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

## lawref.population.legal_time_section

*function*

```python
def legal_time_section(dates: set[str]) -> dict
```

Распределение дат банка ([§2](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/01-part-i-audit.ru.md#2-что-необходимо-исправить)): минимум и максимум — по моменту UTC для
`Instant`, печать и счёт различных — в канонической форме [§208](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/28-part-xxvii-canonical-legal-ir.ru.md#208-canonical-serialization).

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

## lawref.population.load_bank

*function*

```python
def load_bank(path: Path) -> dict
```

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

## lawref.population.lower_rows

*function*

```python
def lower_rows(side: Side, names: list[str], lower: Lower) -> dict[str, Lowered]
```

Понижение дел строк до первой строки: дата дела нужна проверке H4.
Сбой понижения — всегда POPULATION_CASE_LOWERING при любом коде
компилятора; исходный код и текст — в подробности ([§5](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/02-part-ii-goals-and-scope.ru.md#5-главные-инварианты-дизайна)).

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

## lawref.population.main

*function*

```python
def main(argv: list[str], lower: Lower | None = None, lower_root: LowerRoot | None = None) -> int
```

`python -m lawref population-impact --bank B --store D [--json] [--lawc L]`.

`lower`/`lower_root` — понижение дела и корня, поданные вызывающим вместо
компилятора (ворота и замеры); CLI их не принимает.

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

## lawref.population.open_side

*function*

```python
def open_side(label: str, pin: dict, base: Path, lower_root: LowerRoot) -> Side
```

Открытие стороны ([§1](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/01-part-i-audit.ru.md#1-что-сохраняется-без-изменений)): пины, понижение ОДНОГО корня, связывание мира,
хэши [§209](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/28-part-xxvii-canonical-legal-ir.ru.md#209-theory-hash-и-artifact-hash). Дел не понижает: сбой понижения дела — FAILED его строки.
Отказ — POPULATION_WORLD_MISMATCH.

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

## lawref.population.prepare_store

*function*

```python
def prepare_store(path: str | Path | None) -> Path
```

Проверка пути и создание каталога разом (для вызывающих вне прогона).

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

## lawref.population.render_text

*function*

```python
def render_text(report: dict) -> str
```

Сводка для человека; полный отчёт — `--json`.

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

## lawref.population.report_bytes

*function*

```python
def report_bytes(report: dict) -> bytes
```

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

## lawref.population.root_lowering_of

*function*

```python
def root_lowering_of(lower: Lower) -> LowerRoot
```

Понижение корня к поданному понижению дела: атрибут `root` (так его
несёт `lawc_lowering`), иначе — компилятор по умолчанию CLI
(`core_cli._lawc_command`: `LAWREF_LAWC`, PATH). Совместимость для
вызывающих, подающих одну `Lower`; явный `lower_root` старше.

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

## lawref.population.row_class

*function*

```python
def row_class(before: dict, after: dict) -> tuple[str, str | None]
```

Класс строки по паре состояний ([§5](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/02-part-ii-goals-and-scope.ru.md#5-главные-инварианты-дизайна)). FAILED старше EXCLUDED: неполный
прогон обязан дойти до вердикта INCOMPLETE.

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

## lawref.population.side_state

*function*

```python
def side_state(outcome: Outcome, measure: dict, store: Path | None, record_proof: bool = True) -> tuple[dict, Fraction | None, dict | None]
```

Состояние стороны по матрице [§5](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/02-part-ii-goals-and-scope.ru.md#5-главные-инварианты-дизайна): (запись ядра, значение Money, сбой).
`record_proof=False` (DECISION-0275): документа с proof нет, адреса нет —
сторона несёт только `outcomeHash`.

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

## lawref.population.store_document

*function*

```python
def store_document(store: Path | None, document: dict) -> str
```

Атомарная запись `<sha256>.json`; повтор того же хэша — не ошибка ([§9](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/04-part-iv-project-and-files.ru.md#9-стандартная-структура-проекта)).

Временный файл — `mkstemp`: создание с `O_EXCL` и случайным именем, то есть
уникальное между процессами, пишущими в одно хранилище. Сбой записи
посреди прогона — FAILED строки, а не отказ [§12](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/04-part-iv-project-and-files.ru.md#12-расширения-файлов).

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

## lawref.population.verdict

*function*

```python
def verdict(complete: bool, classes: dict[str, _Tally], absolute: Fraction) -> str
```

[§7](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/03-part-iii-architecture-and-conformance.ru.md#7-обязательные-компоненты-реализации): 4 → 1 → 3 → 0. «Изменение найдено» — положительное утверждение и
стоит без сравнимого веса; «изменения нет» не печатается, пока судить нечем.

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

## lawref.population.world_pins

*function*

```python
def world_pins(root: Path, context: dict, world: dict) -> dict
```

Пины стороны в форме банка (без `package`) — для сверки и для
сборки фикстур тем же вычислением, что проверяет инструмент.

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