# Power and valid exercise ## Intention I want to create an effect only when a valid power is exercised. ## Incorrect form and why it stays silent ```text title="Incorrect form" effect approve(valid(p)); ``` A homemade effect name is not a materialization operation. This example needs create; the mere presence of a power does not create the effect. ## Correct form ```law language "law.core" version "0.2"; package recipes.a.r06 version "0.1.0"; namespace "urn:recipe:a-positions:06"; 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)); }; } ``` ## Frozen execution scene | Facts and snapshot | Question | Answer | |---|---|---| | power without exercise; 2026-09-05 | `truth(valid(entity_ref("urn:recipe:a-positions:06:p")))` | `truth_status == NEITHER;` / `COMPUTED` | | valid exercise; 2026-09-05 | `truth(valid(entity_ref("urn:recipe:a-positions:06:p")))` | `truth_status == TRUE_ONLY;` / `COMPUTED` | | competence not presented; 2026-09-05 | `truth(valid(entity_ref("urn:recipe:a-positions:06:p")))` | `truth_status == NEITHER;` / `COMPUTED` | ```law test "power without exercise stays unknown" { 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:06:p")); assert competent(entity_ref("urn:recipe:a-positions:06:p")); } evaluate truth(valid(entity_ref("urn:recipe:a-positions:06:p"))); expect truth_status == NEITHER; expect evaluation_status == COMPUTED; } ``` ```law test "valid exercise establishes 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:06:p")); assert competent(entity_ref("urn:recipe:a-positions:06:p")); assert sign(entity_ref("urn:recipe:a-positions:06:p")); } evaluate truth(valid(entity_ref("urn:recipe:a-positions:06:p"))); expect truth_status == TRUE_ONLY; expect evaluation_status == COMPUTED; } ``` ```law test "missing competence blocks exercise" { 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:06:p")); assert sign(entity_ref("urn:recipe:a-positions:06:p")); } evaluate truth(valid(entity_ref("urn:recipe:a-positions:06:p"))); expect truth_status == NEITHER; expect evaluation_status == COMPUTED; expect issue(POWER_INVALID_EXERCISE); } ``` `effect create(valid(p))` is replaced with `effect approve(valid(p))`: check and lower are green, the effect is not created; the answer is NEITHER. ```law test "renamed effect creates nothing" { 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:06:p")); assert competent(entity_ref("urn:recipe:a-positions:06:p")); assert sign(entity_ref("urn:recipe:a-positions:06:p")); } evaluate truth(valid(entity_ref("urn:recipe:a-positions:06:p"))); expect truth_status == NEITHER; 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/6) 'А6: контрфактуал подтверждён; lawc = lawref' ``` ## Counterfactual Mutation: `valid_when competent(p);` → ``; rejection LDC-E1305. Additional counterfactuals are shown as separate scenes. ## Boundary Exercise here is represented by an established relation of accepted exercise. For presenting events with time, see [Present an event with a time](/recipes/n-package/event/). terminate/modify and unsupported operations are not substituted with create.