# lawref.amend_guards

*module*

Структурные шаблоны amend: типизация и разбиение окна [§87](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/12-part-xii-events-actions-temporal-model.ru.md#87-rule-temporal-qualifiers), DECISION-0179.

Значения условий исполняет обычный evaluate. Здесь только проверка формы
операции и построение канонического CLIR; алиасы типов не разворачиваются.

## lawref.amend_guards.GUARD_OPS

*attribute* · *module attribute*

```python
GUARD_OPS = {'compare_threshold', 'restrict_interval', 'exclude_conjunction'}
```

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

## lawref.amend_guards.OPPOSITE

*attribute* · *module attribute*

```python
OPPOSITE = {'eq': 'ne', 'ne': 'eq', 'lt': 'ge', 'ge': 'lt', 'le': 'gt', 'gt': 'le'}
```

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

## lawref.amend_guards.ORDERED

*attribute* · *module attribute*

```python
ORDERED = {urn:law:std#{n} for n in ('Integer', 'Natural', 'Decimal', 'Money', 'Quantity', 'Date', 'Instant', 'Rational')}
```

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

## lawref.amend_guards.TEMPORAL_OP

*attribute* · *module attribute*

```python
TEMPORAL_OP = 'exclude_enum_value_from'
```

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

## lawref.amend_guards.guard_rule

*function*

```python
def guard_rule(rule: dict, edits: list[dict], enums: dict) -> dict | None
```

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

## lawref.amend_guards.split_exclusion

*function*

```python
def split_exclusion(document: dict, rule: dict, edit: dict, enums: dict) -> list[dict] | None
```

¬(A∧B) → две непересекающиеся strict-ветви: ¬A; A∧¬B.

Прямой body/or не входит в исполнимый срез. Для N условий строим N
ветвей с общим прежним телом; не меняем движковую семантику формул.

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

## lawref.amend_guards.split_from

*function*

```python
def split_from(document: dict, rule: dict, edit: dict, enums: dict) -> list[dict] | None
```

Узкий шаблон: strict без входящих ссылок, конечное полуоткрытое окно.

Старый id сохраняется до D, новый id с исключением — с D. Оба узла
сохраняют scope/anchors/interpretations и лежат внутри прежнего окна.

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

## lawref.amend_guards.valid_condition

*function*

```python
def valid_condition(rule: dict, condition: dict, enums: dict) -> bool
```

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