docs← Back to article

Markdown for LLMs

Later-enacted rule

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

Download this articlePlain text ↗
# Later-enacted rule

## Intention

I want to apply an explicitly chosen policy that compares dates of enactment.

The policy compares entry-into-force dates; the applicability window is separate from the priority edge.

## Incorrect form and why it stays silent

```text title="Incorrect form"
// У New позднее effective; политики Later нет.

// Объявление entity RuleApplication отсутствует.
for high: RuleApplication;
```

effective determines applicability, not superiority. The profile explicitly chooses the date of enactment; missing date data leaves the conflict. RuleApplication is a local type here, not a built-in: it must be declared. Meta-predicates rule_of and conflicts, by contrast, are supplied by the engine; a local twin would shadow them.

## Correct form

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

entity Person;
relation eligible(p: Person);
relation special(p: Person);
relation allowed(p: Person);
entity RuleApplication;
relation enacted(rule_name: Text, day: Date);
rule Old defeasible { effective [@2025-01-01, infinity); for p: Person; when eligible(p); then allowed(p); }
rule New defeasible { effective [@2026-01-01, infinity); for p: Person; when eligible(p); then not allowed(p); }
priority policy Later {
    for high: RuleApplication; for low: RuleApplication;
    when conflicts(high, low)
        and exists hr in (collect hr: Text where rule_of(high, hr))
            where exists lr in (collect lr: Text where rule_of(low, lr))
                where exists hd in (collect hd: Date where enacted(hr, hd))
                    where exists ld in (collect ld: Date where enacted(lr, ld)) where hd > ld;
    prefer high over low; reason lex_posterior;
}
```

## Frozen execution scene

| Facts and choice | Question | Answer |
|---|---|---|
| enactment dates given | `truth(allowed(entity_ref("urn:recipe:b-rules:06:p")))` | `FALSE_ONLY` / `COMPUTED` |
| only effective windows | `truth(allowed(entity_ref("urn:recipe:b-rules:06:p")))` | `BOTH` / `COMPUTED` |
| policy removed | `truth(allowed(entity_ref("urn:recipe:b-rules:06:p")))` | `BOTH` / `COMPUTED` |

```law
test "introduction dates stated" {
    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:06:p")); assert enacted(Old, @2025-01-01); assert enacted(New, @2026-01-01);
    }
    evaluate truth(allowed(entity_ref("urn:recipe:b-rules:06:p")));
    expect truth_status == FALSE_ONLY;
    expect evaluation_status == COMPUTED;
}
```

```law
test "effective windows only" {
    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:06:p"));
    }
    evaluate truth(allowed(entity_ref("urn:recipe:b-rules:06:p")));
    expect truth_status == BOTH;
    expect evaluation_status == COMPUTED;
}
```

```law
test "policy 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:06:p")); assert enacted(Old, @2025-01-01); assert enacted(New, @2026-01-01);
    }
    evaluate truth(allowed(entity_ref("urn:recipe:b-rules:06:p")));
    expect truth_status == BOTH;
    expect evaluation_status == COMPUTED;
}
```

## Counterfactual

Mutation: `entity RuleApplication;` → ``; rejection LDC-E2101. Scenes that delete a fragment are marked explicitly in the table.

## Boundary

The teaching profile compares only two rules of one rank and subject. A real profile must separately constrain comparable kinds, level, special rules and transitional provisions.

## Pitfall

Effective windows alone do not resolve the conflict: without enactment dates for the policy, the answer stays BOTH.