# Immunity locks the effect ## Intention I want to protect a status from change while keeping the fact of the attempt. ## Incorrect form and why it stays silent ```text title="Incorrect form" protected_effect sign(p); ``` Immunity must match the legal effect valid(p), not the action sign(p). When they match and there is no priority, a conflict arises and the effect does not materialize. ## Correct form ```law language "law.core" version "0.2"; package recipes.a.r07 version "0.1.0"; namespace "urn:recipe:a-positions:07"; entity Person; relation registered(p: Person); relation done(p: Person); relation sign(p: Person); relation competent(p: Person); relation valid(p: Person); rule Grant strict { for p: Person; when registered(p); then power Permit { holder p; exercise sign(p); valid_when competent(p); effect create(valid(p)); }; } relation protected(p: Person); rule Protect strict { for p: Person; when registered(p) and protected(p); then immunity Shield { holder p; against p; protected_effect valid(p); window [@2026-09-01, @2026-09-10]; }; } ``` ## Frozen execution scene | Facts and snapshot | Question | Answer | |---|---|---| | unresolved pair; 2026-09-05 | `truth(valid(entity_ref("urn:recipe:a-positions:07:p")))` | `truth_status == NEITHER;` / `UNRESOLVED_NORMATIVE_CONFLICT` | | the attempt is kept; 2026-09-05 | `truth(sign(entity_ref("urn:recipe:a-positions:07:p")))` | `truth_status == TRUE_ONLY;` / `COMPUTED` | | no immunity; 2026-09-05 | `truth(valid(entity_ref("urn:recipe:a-positions:07:p")))` | `truth_status == TRUE_ONLY;` / `COMPUTED` | ```law test "unresolved pair blocks effect" { given { context { legal_time @2026-09-05; decision_time @2026-09-05T09:00:00+05:00; knowledge_time @2026-09-30T09:00:00+05:00; timezone "Asia/Almaty"; } assert registered(entity_ref("urn:recipe:a-positions:07:p")); assert competent(entity_ref("urn:recipe:a-positions:07:p")); assert sign(entity_ref("urn:recipe:a-positions:07:p")); assert protected(entity_ref("urn:recipe:a-positions:07:p")); } evaluate truth(valid(entity_ref("urn:recipe:a-positions:07:p"))); expect truth_status == NEITHER; expect evaluation_status == UNRESOLVED_NORMATIVE_CONFLICT; } ``` ```law test "attempt fact survives" { given { context { legal_time @2026-09-05; decision_time @2026-09-05T09:00:00+05:00; knowledge_time @2026-09-30T09:00:00+05:00; timezone "Asia/Almaty"; } assert registered(entity_ref("urn:recipe:a-positions:07:p")); assert competent(entity_ref("urn:recipe:a-positions:07:p")); assert sign(entity_ref("urn:recipe:a-positions:07:p")); assert protected(entity_ref("urn:recipe:a-positions:07:p")); } evaluate truth(sign(entity_ref("urn:recipe:a-positions:07:p"))); expect truth_status == TRUE_ONLY; expect evaluation_status == COMPUTED; } ``` ```law test "no immunity lets effect through" { given { context { legal_time @2026-09-05; decision_time @2026-09-05T09:00:00+05:00; knowledge_time @2026-09-30T09:00:00+05:00; timezone "Asia/Almaty"; } assert registered(entity_ref("urn:recipe:a-positions:07:p")); assert competent(entity_ref("urn:recipe:a-positions:07:p")); assert sign(entity_ref("urn:recipe:a-positions:07:p")); } evaluate truth(valid(entity_ref("urn:recipe:a-positions:07:p"))); expect truth_status == TRUE_ONLY; expect evaluation_status == COMPUTED; } ``` The incorrect-form variant is executed as a separate package: `protected_effect valid(p)` is replaced with `protected_effect sign(p)`; a mismatching immunity does not lock valid. ```law test "mismatched immunity leaves effect valid" { given { context { legal_time @2026-09-05; decision_time @2026-09-05T09:00:00+05:00; knowledge_time @2026-09-30T09:00:00+05:00; timezone "Asia/Almaty"; } assert registered(entity_ref("urn:recipe:a-positions:07:p")); assert competent(entity_ref("urn:recipe:a-positions:07:p")); assert sign(entity_ref("urn:recipe:a-positions:07:p")); assert protected(entity_ref("urn:recipe:a-positions:07:p")); } evaluate truth(valid(entity_ref("urn:recipe:a-positions:07:p"))); expect truth_status == TRUE_ONLY; expect evaluation_status == COMPUTED; } ``` ```python >>> import runpy >>> check = runpy.run_path("docs/recipes/a-positions/resources/check.py") >>> check["check_variant"](https://github.com/arxohq/law/blob/master/docs/recipes/a-positions/7) 'А7: контрфактуал подтверждён; lawc = lawref' ``` ## Counterfactual Mutation: `protected_effect valid(p);` → ``; rejection LDC-E1305. Additional counterfactuals are shown as separate scenes. ## Boundary The physical attempt is kept. Priority and the Power/Immunity resolution profile are covered by [Power against immunity](/recipes/a-positions/effect-conflict-policy/); immunity is not the same as a prohibition of the action.