docs← Back to article

Markdown for LLMs

Choose a policy for the whole case

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

Download this articlePlain text ↗
# Choose a policy for the whole case

## Intention

I want to separate calculations that need incompatible deadline policies.

## Incorrect form and why it stays silent

Two axes in one context do not assign policies to different terms. Current lower-test keeps the last record:

```law title="Incorrect form"
context { deadline_policy Days; deadline_policy SameDay; }
```

An undeclared name `deadline_policy Missing` is rejected with E1332. Each lawful case below chooses one declared policy.

## Correct form

```law
language "law.core" version "0.2";
package recipes.e.r10 version "0.1.0";
namespace "urn:recipe:e-time:10";

source SyntheticCalendar { kind standard; jurisdiction "none"; number "E-CALENDAR"; }
calendar Calendar {
    timezone "Asia/Almaty";
    timezone_db "iana-tzdb@2026a";
    period [@2024-01-01, @2028-01-01);
    source SyntheticCalendar;
    resource "resources/calendar-2024-2027.json";
    format "law.calendar/0.1";
    content_hash "sha256:dfd0181e1347cc2fd48b5fd81d27f3551cabae10eaefbf8b4dffb70bcbb3cd12";
}
deadline policy Days {
    start_count next_day;
    include_end true;
    roll next_working_day;
}
deadline policy Months {
    start_count same_day;
    include_end true;
    roll no_roll;
    month_end last_day_of_month;
}
deadline policy SameDay {
    start_count same_day;
    include_end true;
    roll no_roll;
}
relation marker();
```

## Frozen execution scene



| Facts / cut | Question | Answer |
|---|---|---|
| Days: 06.03 + 1 business day | date | 10.03 |
| SameDay: 06.03 + 1 business day | date | 06.03 |
| Months: 31.01 + 1 month | date | 28.02 |
| Days, then SameDay in one context | 06.03 + 1 business day | 06.03 — last one chosen |

```law
test "next-day start counts forward" {
    given {
        context {
            legal_time @2026-03-10;
            decision_time @2027-12-31T09:00:00+05:00;
            knowledge_time @2027-12-31T09:00:00+05:00;
            timezone "Asia/Almaty";
            deadline_policy Days;
        }

    }
    evaluate add_business_days(@2026-03-06, 1 business_day);
    expect value == @2026-03-10;
}
```

```law
test "same-day start counts forward" {
    given {
        context {
            legal_time @2026-03-10;
            decision_time @2027-12-31T09:00:00+05:00;
            knowledge_time @2027-12-31T09:00:00+05:00;
            timezone "Asia/Almaty";
            deadline_policy SameDay;
        }

    }
    evaluate add_business_days(@2026-03-06, 1 business_day);
    expect value == @2026-03-06;
}
```

```law
test "monthly term resolves" {
    given {
        context {
            legal_time @2026-03-10;
            decision_time @2027-12-31T09:00:00+05:00;
            knowledge_time @2027-12-31T09:00:00+05:00;
            timezone "Asia/Almaty";
            deadline_policy Months;
        }

    }
    evaluate add_calendar_period(@2026-01-31, 1 calendar_month);
    expect value == @2026-02-28;
}
```

The calendar is synthetic: Mon–Fri, 9 March 2026 is a conventional non-working day; this is not an official calendar.

```law
test "last policy option wins" {
    given {
        context {
            legal_time @2026-03-10;
            decision_time @2027-12-31T09:00:00+05:00;
            knowledge_time @2027-12-31T09:00:00+05:00;
            timezone "Asia/Almaty";
            deadline_policy Days;
            deadline_policy SameDay;
        }

    }
    evaluate add_business_days(@2026-03-06, 1 business_day);
    expect value == @2026-03-06;
}
```

## Counterfactual

teaches replaces the Days reference with Missing and requires E1332 at lower-test. A separate scene with two options shows that SameDay displaces Days; that is an authoring mistake, not assignment of different policies to different terms.

## Boundary

The program may have three declarations, but a case has one deadline_policy. Policies in a standalone test file are redeclared so the name can resolve at lower-test; that is not three policies at once.

## Pitfall

A shared monthly and daily calculation collides with an incompatible month_end; one policy per case.