Markdown for LLMs
Run a chain of consequences
The source Markdown for this article. Copy it into your assistant or download it as a text file.
# Run a chain of consequences
## Intention
I want to derive reparation and then a sanction from violations of specific positions.
## Incorrect form and why it stays silent
```law title="Incorrect form"
relation violated(pos: PositionInstance); // локальный двойник стандартного предиката
```
A local declaration shadows urn:law:std#violated and breaks the chain. Standard violated, instance_of and bearer_of are not redeclared; the template is bound to the instance explicitly.
## Correct form
```law
language "law.core" version "0.2";
package recipes.zh.r03 version "0.1.0";
namespace "urn:recipe:zh-violation:03";
entity Person;
relation enrolled(p: Person);
relation done(p: Person);
rule Primary defeasible { for p: Person; when enrolled(p);
then duty Main { bearer p; achieve done(p) during [@2026-09-01, @2026-09-10]; };
}
relation repaired(p: Person);
relation penalty_paid(p: Person);
rule Reparation strict { for pos: PositionInstance; for p: Person;
when violated(pos) and instance_of(pos, Main) and bearer_of(pos, p);
then duty Repair { bearer p; achieve repaired(p) during [@2026-09-11, @2026-09-15]; };
}
rule Sanction strict { for pos: PositionInstance; for p: Person;
when violated(pos) and instance_of(pos, Repair) and bearer_of(pos, p);
then duty Penalty { bearer p; achieve penalty_paid(p) during [@2026-09-16, @2026-09-20]; };
}
```
## Frozen execution scene
| Facts and snapshot | Question | Answer |
|---|---|---|
| first overdue; 2026-09-13 | `positions()` | `position(Main, VIOLATED); position(Repair, ACTIVE);` |
| second overdue; 2026-09-17 | `positions()` | `position(Main, VIOLATED); position(Repair, VIOLATED); position(Penalty, ACTIVE);` |
| reparation performed; 2026-09-17 | `positions()` | `position(Repair, SATISFIED); not position(Penalty, ACTIVE);` |
```law
test "first delay activates reparation" {
given {
context {
legal_time @2026-09-13;
decision_time @2026-09-13T09:00:00+05:00;
knowledge_time @2026-09-30T09:00:00+05:00;
timezone "Asia/Almaty";
}
assert enrolled(entity_ref("urn:recipe:zh-violation:03:p")); assert not done(entity_ref("urn:recipe:zh-violation:03:p"));
}
evaluate positions();
expect position(Main, VIOLATED); expect position(Repair, ACTIVE);
expect evaluation_status == COMPUTED;
}
```
```law
test "second delay activates penalty" {
given {
context {
legal_time @2026-09-17;
decision_time @2026-09-17T09:00:00+05:00;
knowledge_time @2026-09-30T09:00:00+05:00;
timezone "Asia/Almaty";
}
assert enrolled(entity_ref("urn:recipe:zh-violation:03:p")); assert not done(entity_ref("urn:recipe:zh-violation:03:p")); assert not repaired(entity_ref("urn:recipe:zh-violation:03:p"));
}
evaluate positions();
expect position(Main, VIOLATED); expect position(Repair, VIOLATED); expect position(Penalty, ACTIVE);
expect evaluation_status == COMPUTED;
}
```
```law
test "performed reparation satisfies" {
given {
context {
legal_time @2026-09-17;
decision_time @2026-09-17T09:00:00+05:00;
knowledge_time @2026-09-30T09:00:00+05:00;
timezone "Asia/Almaty";
}
assert enrolled(entity_ref("urn:recipe:zh-violation:03:p")); assert not done(entity_ref("urn:recipe:zh-violation:03:p")); assert repaired(entity_ref("urn:recipe:zh-violation:03:p"));
}
evaluate positions();
expect position(Repair, SATISFIED); expect not position(Penalty, ACTIVE);
expect evaluation_status == COMPUTED;
}
```
A local `relation violated(pos: PositionInstance);` was added: both later steps are absent.
```law
test "local violated shadow removes later steps" {
given {
context {
legal_time @2026-09-17;
decision_time @2026-09-17T09:00:00+05:00;
knowledge_time @2026-09-30T09:00:00+05:00;
timezone "Asia/Almaty";
}
assert enrolled(entity_ref("urn:recipe:zh-violation:03:p")); assert not done(entity_ref("urn:recipe:zh-violation:03:p")); assert not repaired(entity_ref("urn:recipe:zh-violation:03:p"));
}
evaluate positions();
expect position(Main, VIOLATED); expect not position(Repair, VIOLATED); expect not position(Penalty, ACTIVE);
expect evaluation_status == COMPUTED;
}
```
```python
>>> import runpy
>>> check = runpy.run_path("docs/recipes/zh-violation/resources/check.py")
>>> check["check_variant"](https://github.com/arxohq/law/blob/master/docs/recipes/zh-violation/3)
'Ж3: контрфактуал подтверждён; lawc = lawref'
```
```python
>>> import runpy
>>> check = runpy.run_path("docs/recipes/zh-violation/resources/check.py")
>>> check["check_proof"](https://github.com/arxohq/law/blob/master/docs/recipes/zh-violation/3)
'Ж3: структура доказательства проверена; lawc = lawref'
```
## Counterfactual
Diagnostic mutation `when violated(pos) and instance_of(pos, Main)` → `when violated(pos, pos) and instance_of(pos, Main)`: LDC-E2103. Semantic differences are pinned as separate scenes.
## Boundary
A sanction does not follow from a violation of any position: the rule filters Repair. The fact of the original violation is kept after reparation arises. The adapter checks the proof of each step.