docs← Back to article

Markdown for LLMs

Exception from an exception

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

Download this articlePlain text ↗
# Exception from an exception

## Intention

I want to restore the general conclusion when there is an exception from a prohibition.

## Incorrect form and why it stays silent

```text title="Incorrect form"
unless restored(p) then allowed(p);
unless special(p) then not allowed(p);
```

A later proviso takes priority over an earlier one. Reordering does not preserve the chain of carve-outs.

## Correct form

```law
language "law.core" version "0.2";
package recipes.b.r02 version "0.1.0";
namespace "urn:recipe:b-rules:02";

entity Person;
relation eligible(p: Person);
relation special(p: Person);
relation allowed(p: Person);
relation restored(p: Person);
rule General defeasible {
    for p: Person; when eligible(p); then allowed(p);
    unless special(p) then not allowed(p);
    unless restored(p) then allowed(p);
}
relation reversed(p: Person);
rule Reversed defeasible {
    for p: Person; when eligible(p); then reversed(p);
    unless restored(p) then reversed(p);
    unless special(p) then not reversed(p);
}
```

## Frozen execution scene

| Facts and choice | Question | Answer |
|---|---|---|
| general case | `truth(allowed(entity_ref("urn:recipe:b-rules:02:p")))` | `TRUE_ONLY` / `COMPUTED` |
| exception | `truth(allowed(entity_ref("urn:recipe:b-rules:02:p")))` | `FALSE_ONLY` / `COMPUTED` |
| carve-out from the exception | `truth(allowed(entity_ref("urn:recipe:b-rules:02:p")))` | `TRUE_ONLY` / `COMPUTED` |
| last proviso removed | `truth(allowed(entity_ref("urn:recipe:b-rules:02:p")))` | `FALSE_ONLY` / `COMPUTED` |
| same facts, reverse order | `truth(reversed(entity_ref("urn:recipe:b-rules:02:p")))` | `FALSE_ONLY` / `COMPUTED` |

```law
test "general case" {
    given {
        context {
            legal_time @2026-09-13;
            decision_time @2026-09-13T09:00:00+05:00;
            knowledge_time @2026-09-13T09:00:00+05:00;
            timezone "Asia/Almaty";
        }
        assert eligible(entity_ref("urn:recipe:b-rules:02:p"));
    }
    evaluate truth(allowed(entity_ref("urn:recipe:b-rules:02:p")));
    expect truth_status == TRUE_ONLY;
    expect evaluation_status == COMPUTED;
}
```

```law
test "exception" {
    given {
        context {
            legal_time @2026-09-13;
            decision_time @2026-09-13T09:00:00+05:00;
            knowledge_time @2026-09-13T09:00:00+05:00;
            timezone "Asia/Almaty";
        }
        assert eligible(entity_ref("urn:recipe:b-rules:02:p")); assert special(entity_ref("urn:recipe:b-rules:02:p"));
    }
    evaluate truth(allowed(entity_ref("urn:recipe:b-rules:02:p")));
    expect truth_status == FALSE_ONLY;
    expect evaluation_status == COMPUTED;
}
```

```law
test "exception to exception" {
    given {
        context {
            legal_time @2026-09-13;
            decision_time @2026-09-13T09:00:00+05:00;
            knowledge_time @2026-09-13T09:00:00+05:00;
            timezone "Asia/Almaty";
        }
        assert eligible(entity_ref("urn:recipe:b-rules:02:p")); assert special(entity_ref("urn:recipe:b-rules:02:p")); assert restored(entity_ref("urn:recipe:b-rules:02:p"));
    }
    evaluate truth(allowed(entity_ref("urn:recipe:b-rules:02:p")));
    expect truth_status == TRUE_ONLY;
    expect evaluation_status == COMPUTED;
}
```

```law
test "last exception removed" {
    given {
        context {
            legal_time @2026-09-13;
            decision_time @2026-09-13T09:00:00+05:00;
            knowledge_time @2026-09-13T09:00:00+05:00;
            timezone "Asia/Almaty";
        }
        assert eligible(entity_ref("urn:recipe:b-rules:02:p")); assert special(entity_ref("urn:recipe:b-rules:02:p")); assert restored(entity_ref("urn:recipe:b-rules:02:p"));
    }
    evaluate truth(allowed(entity_ref("urn:recipe:b-rules:02:p")));
    expect truth_status == FALSE_ONLY;
    expect evaluation_status == COMPUTED;
}
```

```law
test "same conditions, reversed order" {
    given {
        context {
            legal_time @2026-09-13;
            decision_time @2026-09-13T09:00:00+05:00;
            knowledge_time @2026-09-13T09:00:00+05:00;
            timezone "Asia/Almaty";
        }
        assert eligible(entity_ref("urn:recipe:b-rules:02:p")); assert special(entity_ref("urn:recipe:b-rules:02:p")); assert restored(entity_ref("urn:recipe:b-rules:02:p"));
    }
    evaluate truth(reversed(entity_ref("urn:recipe:b-rules:02:p")));
    expect truth_status == FALSE_ONLY;
    expect evaluation_status == COMPUTED;
}
```

## Counterfactual

Mutation: `rule General defeasible` → `rule General strict`; rejection LDC-E4110. Scenes that delete a fragment are marked explicitly in the table.

## Boundary

Each exception condition binds p on its own. Independent grounds need an explicit priority scheme, not an arbitrary order of provisos. Reversed is a separate witness of reordering; it does not take part in deriving allowed.