docs← Back to article

Markdown for LLMs

State only a necessary condition

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

Download this articlePlain text ↗
# State only a necessary condition

## Intent

I want to check a concept’s condition without turning it into a sufficient one.

A necessary condition is silent as a producer.

## Wrong form and why it stays silent

```text title="Incorrect form"
// necessary понимают как правило young(p) → eligible(p).
```

necessary/only_if adds no support for the concept or for the condition. The requirement is checked only against a presented qualification.

## Correct form

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

entity Person;
relation young(p: Person) kind empirical;
definition eligible(p: Person) necessary { when young(p); }
```

## Frozen execution scene

| Facts on 13.09.2026 | Question | Answer |
|---|---|---|
| condition present | `truth(eligible(entity_ref("urn:recipe:g-concepts:02:p")))` | `truth_status == NEITHER;` / `COMPUTED` |
| qualification without data | `truth(young(entity_ref("urn:recipe:g-concepts:02:p")))` | `truth_status == NEITHER;` / `COMPUTED` |
| requirement refuted | `truth(eligible(entity_ref("urn:recipe:g-concepts:02:p")))` | `truth_status == TRUE_ONLY; issue(CONSTRAINT_VIOLATED);` / `NON_EXECUTABLE` |

```law
test "necessary condition present" {
    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:02:p"));
    }
    evaluate truth(eligible(entity_ref("urn:recipe:g-concepts:02:p")));
    expect truth_status == NEITHER;
    expect evaluation_status == COMPUTED;
}
```

```law
test "qualification without data stays unknown" {
    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:g-concepts:02:p"));
    }
    evaluate truth(young(entity_ref("urn:recipe:g-concepts:02:p")));
    expect truth_status == NEITHER;
    expect evaluation_status == COMPUTED;
}
```

```law
test "refuted requirement blocks document" {
    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:g-concepts:02:p")); assert not young(entity_ref("urn:recipe:g-concepts:02:p"));
    }
    evaluate truth(eligible(entity_ref("urn:recipe:g-concepts:02:p")));
    expect truth_status == TRUE_ONLY; expect issue(CONSTRAINT_VIOLATED);
    expect evaluation_status == NON_EXECUTABLE;
}
```

necessary is replaced with exact: the sufficient condition starts deriving the concept.

```law
test "exact-form variant qualifies directly" {
    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:02:p"));
    }
    evaluate truth(eligible(entity_ref("urn:recipe:g-concepts:02:p")));
    expect truth_status == TRUE_ONLY;
    expect evaluation_status == COMPUTED;
}
```

```python
>>> import runpy
>>> check = runpy.run_path("docs/recipes/g-concepts/resources/check.py")
>>> check["check_variant"](https://github.com/arxohq/law/blob/master/docs/recipes/g-concepts/2)
'Г2: контрфактуал подтверждён; lawc = lawref'
```

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/2)
'Г2: вердикты ограничений проверены; lawc = lawref'
```

## Counterfactual

Mutation `definition eligible(p: Person) necessary` → `definition eligible(p: Person) defeasible`: 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.

If young must be derived from eligible, the author writes a separate rule with a literal head. That is an independent decision about the direction of inference.