docs← Back to article

Markdown for LLMs

Delegation and subdelegation

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

Download this articlePlain text ↗
# Delegation and subdelegation

## Intention

I want to pass a power along a chain through a legal effect.

## Incorrect form and why it stays silent

```text title="Incorrect form"
// Глубину цепочки считают неограниченной.
```

The effect enters the next step of the strict closure. Depth is limited by maxNormChainDepth; exhausting it must not return a partial legal result.

## Correct form

```law
language "law.core" version "0.2";
package recipes.a.r13 version "0.1.0";
namespace "urn:recipe:a-positions:13";

entity Person;
relation authorised(p: Person);
relation next(p: Person, q: Person);
relation signed(p: Person, q: Person);
rule Delegate strict { for p: Person; for q: Person; when authorised(p) and next(p, q);
    then power Transfer { holder p; over q; exercise signed(p, q); valid_when authorised(p); effect create(authorised(q)); };
}
```

## Frozen execution scene

| Facts and snapshot | Question | Answer |
|---|---|---|
| two transfer steps; 2026-09-05 | `truth(authorised(entity_ref("urn:recipe:a-positions:13:r")))` | `truth_status == TRUE_ONLY;` / `COMPUTED` |
| second step not signed; 2026-09-05 | `truth(authorised(entity_ref("urn:recipe:a-positions:13:r")))` | `truth_status == NEITHER;` / `COMPUTED` |

```law
test "two signed delegation steps authorise" {
    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 authorised(entity_ref("urn:recipe:a-positions:13:p")); assert next(entity_ref("urn:recipe:a-positions:13:p"), entity_ref("urn:recipe:a-positions:13:q")); assert next(entity_ref("urn:recipe:a-positions:13:q"), entity_ref("urn:recipe:a-positions:13:r")); assert signed(entity_ref("urn:recipe:a-positions:13:p"), entity_ref("urn:recipe:a-positions:13:q")); assert signed(entity_ref("urn:recipe:a-positions:13:q"), entity_ref("urn:recipe:a-positions:13:r"));
    }
    evaluate truth(authorised(entity_ref("urn:recipe:a-positions:13:r")));
    expect truth_status == TRUE_ONLY;
    expect evaluation_status == COMPUTED;

}
```

```law
test "unsigned second step blocks authorisation" {
    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 authorised(entity_ref("urn:recipe:a-positions:13:p")); assert next(entity_ref("urn:recipe:a-positions:13:p"), entity_ref("urn:recipe:a-positions:13:q")); assert next(entity_ref("urn:recipe:a-positions:13:q"), entity_ref("urn:recipe:a-positions:13:r")); assert signed(entity_ref("urn:recipe:a-positions:13:p"), entity_ref("urn:recipe:a-positions:13:q"));
    }
    evaluate truth(authorised(entity_ref("urn:recipe:a-positions:13:r")));
    expect truth_status == NEITHER;
    expect evaluation_status == COMPUTED;

}
```

Two signed steps with `maxNormChainDepth = 1` → fatal RESOURCE_LIMIT without a partial result. The case is replaced by the JSON shown in full.

```law
test "depth limit refuses recursive proof" {
    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 authorised(entity_ref("urn:recipe:a-positions:13:p")); assert next(entity_ref("urn:recipe:a-positions:13:p"), entity_ref("urn:recipe:a-positions:13:q")); assert next(entity_ref("urn:recipe:a-positions:13:q"), entity_ref("urn:recipe:a-positions:13:r")); assert signed(entity_ref("urn:recipe:a-positions:13:p"), entity_ref("urn:recipe:a-positions:13:q")); assert signed(entity_ref("urn:recipe:a-positions:13:q"), entity_ref("urn:recipe:a-positions:13:r"));
    }
    evaluate truth(authorised(entity_ref("urn:recipe:a-positions:13:r")));
    expect issue(RESOURCE_LIMIT);


}
```

```json
{
  "assertions": [
    {
      "contentHash": "sha256:c985386b9ade6a5c28cf15a77c7f79001de97a50abecd2ca3fc3900615427786",
      "evidence": [],
      "id": "urn:recipe:a-positions:13#assert-ha73c25311c08daf34f51287d9a524c6cdd325d5aefdd7cc25a7bdf0775f03f83",
      "kind": "assertion",
      "literal": {
        "args": [
          {
            "id": "urn:recipe:a-positions:13:p",
            "kind": "entity_ref"
          }
        ],
        "kind": "literal",
        "polarity": "positive",
        "predicate": "urn:recipe:a-positions:13#authorised"
      },
      "origin": "source_asserted",
      "package": "urn:recipe:a-positions:13"
    },
    {
      "contentHash": "sha256:d6905d70435f0105cac4ce886fe6cf0be2af1f5139f87fc53a94a8c3d4b494d8",
      "evidence": [],
      "id": "urn:recipe:a-positions:13#assert-h387509721d083aee89c86785d2c19f3f6580d34cd1b275b06c541a7daa494397",
      "kind": "assertion",
      "literal": {
        "args": [
          {
            "id": "urn:recipe:a-positions:13:p",
            "kind": "entity_ref"
          },
          {
            "id": "urn:recipe:a-positions:13:q",
            "kind": "entity_ref"
          }
        ],
        "kind": "literal",
        "polarity": "positive",
        "predicate": "urn:recipe:a-positions:13#next"
      },
      "origin": "source_asserted",
      "package": "urn:recipe:a-positions:13"
    },
    {
      "contentHash": "sha256:785f255d344e2619a0dfa9c977918dc4ee906ccc6c67775571ff15f2b5cf5158",
      "evidence": [],
      "id": "urn:recipe:a-positions:13#assert-h596733113bd8228d49ed078901b65973e53009fe28bea591551c541a7db2aff7",
      "kind": "assertion",
      "literal": {
        "args": [
          {
            "id": "urn:recipe:a-positions:13:q",
            "kind": "entity_ref"
          },
          {
            "id": "urn:recipe:a-positions:13:r",
            "kind": "entity_ref"
          }
        ],
        "kind": "literal",
        "polarity": "positive",
        "predicate": "urn:recipe:a-positions:13#next"
      },
      "origin": "source_asserted",
      "package": "urn:recipe:a-positions:13"
    },
    {
      "contentHash": "sha256:9091453b4094a51cb0fc005a363ce3450bc6f58aa5bf840801e98797100e9ebe",
      "evidence": [],
      "id": "urn:recipe:a-positions:13#assert-h5fd9f05e6e62b46afe6f3ac38ba7d494c15d9b03d118c74db1bfd9f666ff5d15",
      "kind": "assertion",
      "literal": {
        "args": [
          {
            "id": "urn:recipe:a-positions:13:p",
            "kind": "entity_ref"
          },
          {
            "id": "urn:recipe:a-positions:13:q",
            "kind": "entity_ref"
          }
        ],
        "kind": "literal",
        "polarity": "positive",
        "predicate": "urn:recipe:a-positions:13#signed"
      },
      "origin": "source_asserted",
      "package": "urn:recipe:a-positions:13"
    },
    {
      "contentHash": "sha256:1e8bb1e7aa1023f47ca9dba2bd783b23db817eeb64d014439a4576adbe3596ce",
      "evidence": [],
      "id": "urn:recipe:a-positions:13#assert-h3ef52a93c1c069c034ed8997740040d1c78739f9e39e9d6472887532aa24f467",
      "kind": "assertion",
      "literal": {
        "args": [
          {
            "id": "urn:recipe:a-positions:13:q",
            "kind": "entity_ref"
          },
          {
            "id": "urn:recipe:a-positions:13:r",
            "kind": "entity_ref"
          }
        ],
        "kind": "literal",
        "polarity": "positive",
        "predicate": "urn:recipe:a-positions:13#signed"
      },
      "origin": "source_asserted",
      "package": "urn:recipe:a-positions:13"
    }
  ],
  "context": {
    "decisionTime": "2026-09-30T09:00:00+05:00",
    "knowledgeTime": "2026-09-30T09:00:00+05:00",
    "legalTime": "2026-09-05",
    "timezone": "Asia/Almaty"
  },
  "options": {
    "limits": {
      "maxNormChainDepth": 1
    }
  }
}
```

## Counterfactual

Mutation: `valid_when authorised(p);` → ``; rejection LDC-E1305. Additional counterfactuals are shown as separate scenes.

## Boundary

next sets a finite chain of possible delegates; signed is an accepted fact of exercise. Subject-matter competence and subdelegation limits must be given by the act.