docs← Back to article

Markdown for LLMs

Limit a legal change with immunity

The source Markdown for this article. Copy it into your assistant or download it as a text file.

Download this articlePlain text ↗
# Limit a legal change with immunity

## Intention

I want to protect a person from a given worsening effect after an event.

## Incorrect form and why it stays silent

Removing immunity and dating only the power rule leaves the effect itself permitted:

```text title="Incorrect form"
// Power действует; Shield отсутствует.
```

## Correct form

```law
language "law.core" version "0.2";
package recipes.e.r07 version "0.1.0";
namespace "urn:recipe:e-time:07";

entity Person;
relation registered(p: Person);

entity Authority;
relation authority_for(p: Person, a: Authority);
relation offence(p: Person, on: Date);
relation attempted(p: Person);
relation harsher(p: Person);
rule Power strict {
    for p: Person; for a: Authority;
    when registered(p) and authority_for(p, a);
    then power Impose {
        holder a;
        over p;
        exercise attempted(p);
        valid_when registered(p);
        effect create(harsher(p));
    };
}
rule Shield strict {
    for p: Person; for on: Date; for a: Authority;
    when offence(p, on) and authority_for(p, a);
    then immunity NoHarsherPenalty {
        holder p;
        against a;
        protected_effect harsher(p);
        window [on, infinity);
    };
}
```

## Frozen execution scene



| Facts / cut | Question | Answer |
|---|---|---|
| registered, offence 01.03, attempted, cut 10.03 | harsher | NEITHER |
| same facts | NoHarsherPenalty | ACTIVE |
| same facts, without Shield | harsher | TRUE_ONLY |

```law
test "immunity blocks harsher effect" {
    given {
        context {
            legal_time @2026-03-10;
            decision_time @2027-12-31T09:00:00+05:00;
            knowledge_time @2027-12-31T09:00:00+05:00;
            timezone "Asia/Almaty";
        }
        assert registered(entity_ref("urn:recipe:e-time:07:a"));
        assert authority_for(entity_ref("urn:recipe:e-time:07:a"), entity_ref("urn:recipe:e-time:07:agency"));
        assert offence(entity_ref("urn:recipe:e-time:07:a"), @2026-03-01);
        assert attempted(entity_ref("urn:recipe:e-time:07:a"));
    }
    evaluate truth(harsher(entity_ref("urn:recipe:e-time:07:a")));
    expect truth_status == NEITHER;
    expect position(NoHarsherPenalty, ACTIVE);
}
```

```law
test "missing immunity lets effect through" {
    given {
        context {
            legal_time @2026-03-10;
            decision_time @2027-12-31T09:00:00+05:00;
            knowledge_time @2027-12-31T09:00:00+05:00;
            timezone "Asia/Almaty";
        }
        assert registered(entity_ref("urn:recipe:e-time:07:a"));
        assert authority_for(entity_ref("urn:recipe:e-time:07:a"), entity_ref("urn:recipe:e-time:07:agency"));
        assert offence(entity_ref("urn:recipe:e-time:07:a"), @2026-03-01);
        assert attempted(entity_ref("urn:recipe:e-time:07:a"));
    }
    evaluate truth(harsher(entity_ref("urn:recipe:e-time:07:a")));
    expect truth_status == TRUE_ONLY;
}
```

## Counterfactual

runs.without drops Shield, keeps the offence date, and shows materialization of the worsening effect. teaches removes protected_effect: E1305.

## Boundary

This is the mechanics of immunity against a specific effect, not an automatic choice of the milder law. Person and authority are different entities; authority_for binds them in a minimal case. The authority's physical action and the legal validity of the effect are distinct.

## Pitfall

A power/immunity pair does not materialize the protected effect; this is not dating of an edition.