# Fold bridges into one deadline rule ## Intention I want to apply a single term to two kinds of notice, not including the event day. ## Incorrect form and why it stays silent An inclusive guard treats the event day as admissible: ```text title="Incorrect form" days_between(add_business_days(sent_on, 3 business_day), visit_on) >= 0 ``` ## Correct form ```law language "law.core" version "0.2"; package recipes.e.r11 version "0.1.0"; namespace "urn:recipe:e-time:11"; entity Person; relation registered(p: Person); 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; } relation sent_a(p: Person, on: Date); relation sent_b(p: Person, on: Date); relation notice(p: Person, on: Date); relation visit(p: Person, on: Date); relation timely(p: Person); rule BridgeA strict { for p: Person; for on: Date; when sent_a(p, on); then notice(p, on); } rule BridgeB strict { for p: Person; for on: Date; when sent_b(p, on); then notice(p, on); } rule CommonTerm strict { for p: Person; for sent_on: Date; for visit_on: Date; when notice(p, sent_on) and visit(p, visit_on) and days_between(add_business_days(sent_on, 3 business_day), visit_on) > 0; then timely(p); } ``` ## Frozen execution scene | Facts / cut | Question | Answer | |---|---|---| | A: sent 06.03, visit 12.03 | timely | NEITHER | | A: sent 06.03, visit 13.03 | timely | TRUE_ONLY | | B: sent 06.03, visit 13.03 | timely | TRUE_ONLY | | without bridge B | timely | NEITHER | | cutoff coincided with the event | days_between | 0 | | same cutoff, incorrect >= | comparison | true — event day admitted | ```law test "event day excluded from term" { 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; } assert sent_a(entity_ref("urn:recipe:e-time:11:a"), @2026-03-06); assert visit(entity_ref("urn:recipe:e-time:11:a"), @2026-03-12); } evaluate truth(timely(entity_ref("urn:recipe:e-time:11:a"))); expect truth_status == NEITHER; } ``` ```law test "shared term serves first bridge" { 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; } assert sent_a(entity_ref("urn:recipe:e-time:11:a"), @2026-03-06); assert visit(entity_ref("urn:recipe:e-time:11:a"), @2026-03-13); } evaluate truth(timely(entity_ref("urn:recipe:e-time:11:a"))); expect truth_status == TRUE_ONLY; } ``` ```law test "shared term serves second bridge" { 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; } assert sent_b(entity_ref("urn:recipe:e-time:11:a"), @2026-03-06); assert visit(entity_ref("urn:recipe:e-time:11:a"), @2026-03-13); } evaluate truth(timely(entity_ref("urn:recipe:e-time:11:a"))); expect truth_status == TRUE_ONLY; } ``` ```law test "missing bridge stays silent" { 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; } assert sent_b(entity_ref("urn:recipe:e-time:11:a"), @2026-03-06); assert visit(entity_ref("urn:recipe:e-time:11:a"), @2026-03-13); } evaluate truth(timely(entity_ref("urn:recipe:e-time:11:a"))); expect truth_status == NEITHER; } ``` ```law test "zero difference on boundary" { 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 days_between(add_business_days(@2026-03-06, 3 business_day), @2026-03-12); expect value == 0; } ``` The calendar is synthetic: Mon–Fri, 9 March 2026 is a conventional non-working day; this is not an official calendar. ```law test "inclusive variant admits event day" { 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 if days_between(add_business_days(@2026-03-06, 3 business_day), @2026-03-12) >= 0 then true else false; expect value == true; } ``` ## Counterfactual The two filing forms meet in notice. runs.without drops BridgeB and reveals a missed bridge. teaches replaces the integer threshold with a quantity and requires E2108; a separate comparison query shows that at the cutoff the difference is zero. ## Boundary Strict > is chosen for the wording “three full business days before, the event day not included”. Another wording may include the cutoff: see [Check a notice before an event](/recipes/e-time/before-event/). For a real shared code the rule lives with the owner and is imported; this standalone page does not import the corpus. ## Pitfall The scene excludes the event day and shows the difference between >= and >; the error cannot be fixed by a hidden subtraction of a day.