日本語 · English

coincides — the window-membership predicate

Translated from the canonical Japanese page reference/coincides.md. The source_sha above records the source revision; a consistency check flags this page when the Japanese original changes.

Category: projection (body layer §4.9; value function) / Signature: coincides(S, w, d) : point -> Bool / name settled (2026-07-09, the F51 batch confirmation; the compared candidates hits/anyIn/sharesWindow were not adopted)

Meaning

Whether at least one point of stream S lies within the w window that point d belongs to (a boolean). Where ordinalIn counts within the containing window, coincides asks whether something is there in the containing window — point → containing window → the window’s contents, the same skeleton as the projection family, bringing bounded existential quantification into value expressions (ADR-38). The argument order is 〈subject, window, point〉, isomorphic to ordinalIn(u, w, d) — but the first argument is the family’s only stream (a binding name, a qualified name, or a parenthesized inline expression. Placing a window word at S is a static error — implicit demotion to the atomic point sequence is a trap that trivializes the predicate to true. If a point sequence is intended, write month |> first). w is a window word resolved in scope (partition-type and segmentBy windows both work; cycle names do not).

This is the vessel for F68: applying exception days to timed and mixed schedules cannot be written with the equality combinators (snapTo crushes the firing time) — an explicit means of joining by membership is needed. Being a value predicate, it composes freely with not, and/or, and other projections (“exclude holidays, but keep Fridays” = not coincides(holidays, day, d) or weekday(d) == Fri).

Example (the canonical form of F68: drop ad-hoc closure “days” from a 9:00 every-business-day notification)

The 9 o’clock tick is wall clock (stepping by a civil-time width. ADR-38 revised — the old form shift(+9, unit: hour) has elapsed-time semantics and drifts from the wall clock on DST transition days, so it was demoted from canonical; it remains the explicit form when “9 elapsed hours later” is the intent). Exclusion is judged by coincides on “day” membership (the firing time 09:00 is preserved):

# eval: 2026-01-05..2026-01-10
premise Cal {
  calendar-system: Gregorian
  tz: "Asia/Tokyo"
  satSunC = everyDay |> filter(d => weekday(d) == Sat or weekday(d) == Sun)
  nonWorking = satSunC
}
premise Biz {
  calendar-system: Gregorian
  calendar: Cal
  tz: "Asia/Tokyo"
  wkst: Mon
  nineTick = everyInstant |> strideBy(1d, from: 2026-01-01T09:00)
}
@Biz
closures = [2026-01-07] covering: ..
nineTick |> filter(t => coincides(bizDay, day, t) and not coincides(closures, day, t))
#=> 2026-01-05T09:00 2026-01-06T09:00 2026-01-08T09:00 2026-01-09T09:00

Where a day-aligned derived form stands, differencing in a preceding stage is plainer (same result. ADR-38 decision 8 — the necessity of coincides narrows to directly written tables, mixed schedules, and irregular times):

# eval: 2026-01-05..2026-01-10
premise Cal {
  calendar-system: Gregorian
  tz: "Asia/Tokyo"
  satSunC = everyDay |> filter(d => weekday(d) == Sat or weekday(d) == Sun)
  nonWorking = satSunC
}
premise Biz {
  calendar-system: Gregorian
  calendar: Cal
  tz: "Asia/Tokyo"
  wkst: Mon
  nineTick = everyInstant |> strideBy(1d, from: 2026-01-01T09:00)
}
@Biz
closures = [2026-01-07] covering: ..
bizx = bizDay \ closures
nineTick |> filter(t => coincides(bizx, day, t))
#=> 2026-01-05T09:00 2026-01-06T09:00 2026-01-08T09:00 2026-01-09T09:00

Note that if the entity declares its opening times, this very form collapses into the single standard-derivation word bizOpen (ADR-41 — ad-hoc closures go to the right-hand side of nonWorking).

The intersection form is the same single word — “keep only the days that have a point of S” = filter(d => coincides(S, day, d)). Difference and intersection are written apart by the presence or absence of not. An example of the net gain in expressive power (execution-verified in impl/test/coincides.test.ts):

# leap-month detection — a lunisolar month containing no chūki (major solar term) is a leap month
# (doubles as the cross-check for the hand-maintained monthNos updates, F62)
lunarMonth |> first |> filter(p => not coincides(chukiDay, lunarMonth, p))
#=> 2025-07-25 (the first day of the leap sixth month)

The witness rule — the three-way branch of determination (ADR-38 decision 4)

The criterion is always the effective coverage (the complement of the transported annotated intervals; table literalscovering:, ADR-37), never the raw covering:

Points of the degenerate tail of everyDay \ holidays are not witnesses — no “confident true” is built on top of holidays that may not exist (the consumer-side face of the rule “annotations attach to non-empty results too”).

Pitfalls

filter (the composition target) · combinators (the right road for equality membership) · snapTo (aligning points) · ordinalIn (the “counting” side of the same skeleton) · ADR-36/37/38 · F68/F69/F75.