docs← Back to article

Markdown for LLMs

Forbid an incompatible combination

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

Download this articlePlain text ↗
# Forbid an incompatible combination

## Intent

I want to detect incompatibility of two qualifications without a hidden derivation of negation.

## Wrong form and why it stays silent

```text title="Incorrect form"
// require not adult(p) считают производителем not adult(p).
```

A constraint reads supports four-valued, but does not add them. A constraint violation is a check finding, not a legal violation of a position.

## Correct form

```law
language "law.core" version "0.2";
package recipes.g.r05 version "0.1.0";
namespace "urn:recipe:g-concepts:05";

entity Person;
relation eligible(p: Person) kind institutional;
relation young(p: Person) kind empirical;
relation adult(p: Person);
constraint Exclusive(p: Person) { when young(p); require not adult(p); severity error; }
```

## Frozen execution scene

| Facts on 13.09.2026 | Question | Answer |
|---|---|---|
| combination presented | `truth(adult(entity_ref("urn:recipe:g-concepts:05:p")))` | `truth_status == TRUE_ONLY; issue(CONSTRAINT_VIOLATED);` / `NON_EXECUTABLE` |
| second status unknown | `truth(adult(entity_ref("urn:recipe:g-concepts:05:p")))` | `truth_status == NEITHER;` / `COMPUTED` |
| exclusion proved | `truth(adult(entity_ref("urn:recipe:g-concepts:05:p")))` | `truth_status == FALSE_ONLY;` / `COMPUTED` |
| without the constraint | `truth(adult(entity_ref("urn:recipe:g-concepts:05:p")))` | `truth_status == TRUE_ONLY; not issue(CONSTRAINT_VIOLATED);` / `COMPUTED` |

```law
test "presented combination violates constraint" {
    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 young(entity_ref("urn:recipe:g-concepts:05:p")); assert adult(entity_ref("urn:recipe:g-concepts:05:p"));
    }
    evaluate truth(adult(entity_ref("urn:recipe:g-concepts:05:p")));
    expect truth_status == TRUE_ONLY; expect issue(CONSTRAINT_VIOLATED);
    expect evaluation_status == NON_EXECUTABLE;
}
```

```law
test "unknown second status stays open" {
    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 young(entity_ref("urn:recipe:g-concepts:05:p"));
    }
    evaluate truth(adult(entity_ref("urn:recipe:g-concepts:05:p")));
    expect truth_status == NEITHER;
    expect evaluation_status == COMPUTED;
}
```

```law
test "proven exception refutes" {
    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 young(entity_ref("urn:recipe:g-concepts:05:p")); assert not adult(entity_ref("urn:recipe:g-concepts:05:p"));
    }
    evaluate truth(adult(entity_ref("urn:recipe:g-concepts:05:p")));
    expect truth_status == FALSE_ONLY;
    expect evaluation_status == COMPUTED;
}
```

```law
test "removed constraint restores truth" {
    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 young(entity_ref("urn:recipe:g-concepts:05:p")); assert adult(entity_ref("urn:recipe:g-concepts:05:p"));
    }
    evaluate truth(adult(entity_ref("urn:recipe:g-concepts:05:p")));
    expect truth_status == TRUE_ONLY; expect not issue(CONSTRAINT_VIOLATED);
    expect evaluation_status == COMPUTED;
}
```

Constraint verdicts are read from separate CONSTRAINT results and checked together with constraint_check nodes.

```python
>>> import runpy
>>> check = runpy.run_path("docs/recipes/g-concepts/resources/check.py")
>>> check["check_constraints"](https://github.com/arxohq/law/blob/master/docs/recipes/g-concepts/5)
'Г5: вердикты ограничений проверены; lawc = lawref'
```

## Counterfactual

Mutation `require not adult(p);` → `then not adult(p);`: LDC-E0201.

## Boundary

An issue with error severity forbids a COMPUTED document: CONSTRAINT_VIOLATED and KEY_CONFLICT make the whole document NON_EXECUTABLE. This does not erase the fact’s truth status and does not change the constraint verdict.

A rule of negative qualification is written separately. Even a VIOLATED constraint does not automatically create a sanction or a negative fact.