aboutsummaryrefslogtreecommitdiff
path: root/lib/rites/rite_ef/temporal_ef.ml
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-08-12 11:38:35 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-08-12 11:38:35 +0200
commite19adb9c7ea369cafe76e7eff50e9248a4a954d0 (patch)
tree57824e121606286ebdf8fff68439986dd3300eae /lib/rites/rite_ef/temporal_ef.ml
parent0506388da160a15ceddb0cea1a697d737103d5c4 (diff)
parent36df2bd0af9a555a09334e14b0d89118be1dbbc0 (diff)
downloadcolitur-e19adb9c7ea369cafe76e7eff50e9248a4a954d0.tar.gz
colitur-e19adb9c7ea369cafe76e7eff50e9248a4a954d0.zip
Merge branch 'ef-plan3': Plan 3, the EF resolution engine
Adds the rite-parameterised Precedence resolver, Liturgical_day, Rite, and Calendar (year as the primitive, because transfers need whole-year knowledge), the full EF precedence ruleset (RG 91's 28-entry table, occurrence RG 92-95, commemorations RG 108-111, transfers RG 96-98), 322 bootstrapped sanctoral entries, colitur day <year>, and validation layers 3-5. Layer 3 diffs 16801 days against lectio; layer 4 diffs 730 days against missalemeum; layer 5 pins ~30 dates on the known-tricky years. Both comparison layers carry cited allow-lists that name the governing RG paragraph and which engine is right. The oracle layer earned its place immediately: Holy Thursday was violet in colitur and lectio alike, because colitur's data was bootstrapped from lectio and both carried the same error. Only an independent source could see it. RG 128(b) and RG 122 name it white.
Diffstat (limited to 'lib/rites/rite_ef/temporal_ef.ml')
-rw-r--r--lib/rites/rite_ef/temporal_ef.ml176
1 files changed, 133 insertions, 43 deletions
diff --git a/lib/rites/rite_ef/temporal_ef.ml b/lib/rites/rite_ef/temporal_ef.ml
index 52a9adb..7782876 100644
--- a/lib/rites/rite_ef/temporal_ef.ml
+++ b/lib/rites/rite_ef/temporal_ef.ml
@@ -17,9 +17,17 @@ let weekday_index d =
(* The Sunday on or before [d]. *)
let sunday_on_or_before d = Date.add_days d (-(weekday_index d))
-(* RG 71: Advent I is the Sunday nearest 30 November -- equivalently the fourth
- Sunday before Christmas, i.e. three weeks before the last Sunday on or before
- 24 December. *)
+(* RG 20 (Caput III, "De Dominicis"), primary-source-verified (final fix
+ wave): "Dominica I Adventus ea est, quae cadit die 30 novembris vel est
+ ipsi proximior" -- Advent I Sunday is that which falls on 30 November or
+ is nearest to it. CORRECTED citation: this comment previously cited RG
+ 71 for this placement rule -- WRONG, RG 71 (cited on [season] below)
+ states only Advent's own season BOUNDARY ("a I Vesperis dominicae I
+ Adventus..."), not which Sunday opens it; the register's own RG 71 entry
+ is a boundary citation, and the only "nearest 30 November" text there
+ before this fix was UNLYC nn. 39-42, the MODERN form's rule, not this
+ one's. Equivalently the fourth Sunday before Christmas, i.e. three weeks
+ before the last Sunday on or before 24 December. *)
let advent_start y = Date.add_days (sunday_on_or_before (mk y 12 24)) (-21)
let year_start = advent_start
@@ -47,8 +55,13 @@ let season d =
else if Date.compare d paschal_end <= 0 then Paschaltide (* RG 76 *)
else Time_after_pentecost (* RG 77 *)
-(* Last Sunday of October, per the 1960 calendar -- NOT the OF's last Sunday
- before Advent. Register §6 flags this for primary-source confirmation. *)
+(* RG 17(d) (Caput III, "De Dominicis"), PRIMARY-SOURCE-VERIFIED (final fix
+ wave, closing the item register §6 previously carried as "oracle-backed,
+ not yet primary-verified"): "festum D. N. Iesu Christi Regis, celebrandum
+ dominica ultima mensis octobris" -- the feast of Our Lord Jesus Christ
+ the King is to be celebrated on the LAST SUNDAY OF OCTOBER. NOT the OF's
+ last Sunday before Advent -- a genuine EF/OF divergence, not merely a
+ citation gap. *)
let christ_the_king y = sunday_on_or_before (mk y 10 31)
let same a b = Date.compare a b = 0
@@ -77,7 +90,10 @@ let named d =
if m = 12 && dd = 25 then Some (Christmastide, "ef-nativity", Colour.White, Class1)
else if m = 12 && dd = 24 then
(* RG 91 entry 5: the Vigil of the Nativity is I class. lectio has no slug
- for it, so this key has no lectionary entry until Plan 3 fills it. *)
+ for it, so this key has no lectionary entry until Plan 4 fills it
+ (CORRECTED, final fix wave, item 7 -- this is the lectionary/reading-
+ citations bootstrap, Plan 4, not the sanctoral one, Plan 3, which
+ already shipped in this branch). *)
Some (Advent, "ef-nativity-vigil", Colour.Violet, Class1)
else if m = 12 && (dd = 29 || dd = 30 || dd = 31) then
(* Days within the Octave of the Nativity; 26-28 Dec are Stephen, John and
@@ -98,9 +114,15 @@ let named d =
else if same d (off 7) then
Some (Paschaltide, "ef-low-sunday", Colour.White, Class1) (* RG 91 entry 6 *)
else if same d (off 38) then
- (* RG 91 entry 21: II-class vigil. It is also Rogation Wednesday; with no
- precedence framework until Plan 3, temporal emits the higher-ranked
- vigil and the Rogation commemoration waits for RG 108-111. *)
+ (* RG 91 entry 21: II-class vigil. It is also Rogation Wednesday; [named]
+ emits the higher-ranked vigil (entry 21 outranks any Rogation-day
+ ferial rank). CORRECTED (final fix wave, item 7): this comment
+ previously said the Rogation commemoration itself "waits for RG
+ 108-111" -- the precedence framework and RG 108-111 both exist now
+ (this branch), but no candidate for the Rogation Wednesday's own
+ observance is constructed here or anywhere else, so there is nothing
+ for RG 108-111 to admit; see the fuller comment on the Rogation
+ branch further down in [temporal] for the current, still-real gap. *)
Some (Paschaltide, "ef-ascension-vigil", Colour.White, Class2)
else if same d (off 39) then Some (Paschaltide, "ef-ascension", Colour.White, Class1)
else if same d (off 48) then Some (Paschaltide, "ef-pentecost-vigil", Colour.Red, Class1) (* RG 91 entry 9 *)
@@ -170,8 +192,10 @@ let week d =
this to "ef-christmas-0-<weekday>", indistinguishable from the stretch
above in lectio's own data. colitur cannot preserve a distinction lectio
doesn't make, so this becomes "ef-christmas-1-<weekday>" -- a
- colitur-only key and a lectionary gap for the Plan 3 bootstrap to fill,
- exactly like the Nativity vigil and octave-day keys above.
+ colitur-only key and a lectionary gap for the Plan 4 bootstrap to fill
+ (CORRECTED, final fix wave, item 7: the lectionary bootstrap is Plan 4,
+ not Plan 3 -- see Slug.ml's own corrected comment), exactly like the
+ Nativity vigil and octave-day keys above.
- 7-13 Jan, split in two by the *actual* first-Sunday-after-Epiphany
origin ([week_origin Time_after_epiphany], which by construction always
falls somewhere in this window -- see that function's own comment):
@@ -253,18 +277,30 @@ let id = "ef"
(* The third Sunday of September: the Ember week's anchor.
- This specific date-derivation rule is one of the more contested points in
- the 1962 calendar: pre-1955 practice tied the September Ember days to the
- week following the Exaltation of the Holy Cross (14 Sept) instead. The two
- rules only disagree when 1 September is a Monday -- 2025 is such a year --
- and the primary-source scan available to this project does not contain an
- explicit numbered-paragraph statement of either rule (searched; see
- register §3 "Ember days"), so this citation is deliberately left at the
- rank rules only (RG 91 entries 18/22, cited on [ember] below), not the
- date-derivation rule itself: a wrong citation is worse than none.
- Empirically: for 2025 this rule gives 24/26/27 September, confirmed
- against an independent oracle; the Holy-Cross rule would give 17/19/20
- September instead. See register §3 for the full note. *)
+ [cited] PRIMARY-SOURCE-VERIFIED (register §3a): MR1962, "De anno et eius
+ partibus", under the heading "Quatuor Tempora" (not a numbered RG
+ paragraph, which is why an earlier paragraph-number search missed it):
+
+ "Quatuor Tempora celebrantur quarta et sexta feria ac sabbato post
+ tertiam dominicam Adventus, post primam dominicam Quadragesimae, post
+ dominicam Pentecostes, post dominicam tertiam septembris."
+
+ -- the Ember Days are kept on the Wednesday, Friday and Saturday after
+ Advent III, after Lent I, after Pentecost, [and] after the third Sunday
+ of September -- confirming all four of this module's anchors, including
+ this specific contested one. This specific date-derivation rule was one
+ of the more contested points in the 1962 calendar: pre-1955 practice
+ tied the September Ember days to the week following the Exaltation of
+ the Holy Cross (14 Sept) instead. The two rules only disagree when 1
+ September is a Monday -- 2025 is such a year, and confirms the
+ third-Sunday reading empirically too (24/26/27 September against an
+ independent oracle, vs the Holy-Cross rule's 17/19/20). An earlier
+ version of this comment said the scan contained no numbered-paragraph
+ statement of either rule and left the citation at the rank rules only
+ (RG 91 entries 18/22) -- WRONG, corrected once the nominative heading
+ "Quatuor Tempora" was found rather than the genitive "Quatuor Temporum"
+ the original search used; register §3a records the correction, because a
+ false "not in the source" note is worse than no note. *)
let third_sunday_of_september y =
let sep1 = mk y 9 1 in
let first_sunday = Date.add_days sep1 ((7 - weekday_index sep1) mod 7) in
@@ -278,8 +314,10 @@ let third_sunday_of_september y =
The September and Advent sets match lectio's own Ember slugs. The Lent and
Whitsun (Pentecost) sets do not -- lectio has no Ember slug for either, so
"ef-lent-ember-*" and "ef-pentecost-ember-*" are colitur-only keys and a
- lectionary gap for the Plan 3 bootstrap to fill (spec §4.4), the same
- status as the Nativity vigil and the Rogation days below. *)
+ lectionary gap for the Plan 4 bootstrap to fill (spec §4.4; CORRECTED,
+ final fix wave, item 7 -- Plan 4, not Plan 3, is the lectionary
+ bootstrap), the same status as the Nativity vigil and the Rogation days
+ below. *)
let ember d =
let y = Date.year d in
let easter = Computus.gregorian_easter y in
@@ -302,25 +340,38 @@ let ember d =
(* RG 91 entry 7: Ash Wednesday (named above) and Monday-Wednesday of Holy
Week are I-class ferias -- the primary text reads "feria IV cinerum et II,
- III et IV Hebdomadae sanctae", i.e. explicitly stops at Wednesday. Thursday
- to Saturday of Holy Week are the Sacred Triduum, RG 91 entry 2 -- ranked
- even above entry 7, not a mere feria -- but their own named offices are a
- Plan 3 sanctoral addition; until then this gives them the same I-class rank
- via the generic ferial path. RG 91 entry 10: the weekdays within the
- privileged Octaves of Easter and Pentecost are I class too. *)
+ III et IV Hebdomadae sanctae", i.e. explicitly stops at Wednesday
+ (PRIMARY-SOURCE-VERIFIED, final fix wave: confirmed word for word
+ against the scan). Thursday to Saturday of Holy Week are the Sacred
+ Triduum, RG 91 entry 2 -- ranked even above entry 7, not a mere feria --
+ but the Sacred Triduum has NO PROPER OFFICE of its own in this codebase
+ (CORRECTED, final fix wave, item 7: this comment previously said their
+ "own named offices are a Plan 3 sanctoral addition"; WRONG on two
+ counts -- Plan 3 shipped, in this branch, without adding them, AND a
+ proper office for I-class FERIAS was never a sanctoral matter to begin
+ with, RG 21's own definition of "feria" excludes Sundays/feasts, not the
+ other way round). `Temporal_ef.temporal 2026-04-02/03/04` (Holy
+ Thursday/Good Friday/Holy Saturday) still resolve today to the ordinary
+ Passiontide ferial fallback's own generic slugs,
+ "ef-passiontide-2-{thursday,friday,saturday}" -- register §6 records
+ this as its own open item now. This gives them the same I-class rank
+ via the generic ferial path regardless. RG 91 entry 10: the weekdays
+ within the privileged Octaves of Easter and Pentecost are I class too. *)
let privileged_feria d =
let easter = Computus.gregorian_easter (Date.year d) in
let n = days_between easter d in
(n >= -6 && n <= -1) || (n >= 1 && n <= 6) || (n >= 50 && n <= 55)
(* RG 117 enumerates the five colours (white, red, green, violet, black);
- RG 127 assigns green and RG 128 violet to the seasons de Tempore below.
- White's own specific paragraph (the "B) De colore albo" section, between
- 117 and 123) was not pinned by the primary-source search available here --
- left uncited rather than guessed; see register §3 "Colours". *)
+ RG 127 assigns green and RG 128 violet to the seasons de Tempore below. RG
+ 119 (register §3b, primary-source-verified 2026-08-11 -- this comment was
+ stale until Task 16 noticed the correction had not been copied down here):
+ white "a festo Nativitatis Domini usque ad expletum tempus Epiphaniae"
+ and "a Missa Vigiliae paschalis usque ad Missam vigiliae Pentecostis
+ exclusive" -- exactly Christmastide and Paschaltide below. *)
let season_colour = function
| Advent | Septuagesima | Lent | Passiontide -> Colour.Violet (* RG 128 *)
- | Christmastide | Paschaltide -> Colour.White
+ | Christmastide | Paschaltide -> Colour.White (* RG 119 *)
| Time_after_epiphany | Time_after_pentecost -> Colour.Green (* RG 127 *)
(* Gaudete (Advent III) and Laetare (Lent IV) are rose: RG 131, "may be used...
@@ -365,16 +416,27 @@ let temporal d =
| None -> (
(* Rogations (the Minor Litanies only -- RG 87, Monday and Tuesday
before Ascension). The Major Litanies (25 April, RG 80) are a fixed
- date and are not yet computed; they arrive with Plan 3's sanctoral
- (register §6). The Wednesday here is the Ascension vigil (see Task
- 11). RG 88: "de Litaniis minoribus nihil fit in Officio" -- the
- Office (hence the day's rank) is unchanged by the Rogation; only the
- Mass is proper. No RG 91 table entry elevates these days, so they
+ date and are STILL not computed (CORRECTED, final fix wave, item 7:
+ this comment previously said "they arrive with Plan 3's sanctoral"
+ -- Plan 3 shipped, in this branch, without them; register §6 tracks
+ this as a plain open item, with no plan committed to build it yet).
+ The Wednesday here is the Ascension vigil (see Task 11), which
+ happens to also fall on Rogation Wednesday -- the vigil (higher
+ RG 91 entry) is what [named] emits for that date; the Rogation
+ Wednesday's own commemoration is not separately constructed (a real
+ gap, not a forward dependency: the precedence framework and RG
+ 108-111 both exist now, but nothing wires a Rogation-Wednesday
+ candidate into the contest for this specific date the way Monday
+ and Tuesday get one below). RG 88: "de Litaniis minoribus nihil fit
+ in Officio" -- the Office (hence the day's rank) is unchanged by
+ the Rogation; only the Mass is proper. No RG 91 table entry
+ elevates these days, so they
take the ordinary ferial rank of their season via [ferial_rank]
rather than a fixed class. lectio has no Rogation slug at all, so
"ef-rogation-monday"/"-tuesday" are colitur-only keys and a
- lectionary gap for Plan 3, like the Ember and Nativity-vigil keys
- above. *)
+ lectionary gap for Plan 4 (CORRECTED, final fix wave, item 7 --
+ the lectionary bootstrap is Plan 4, not Plan 3), like the Ember
+ and Nativity-vigil keys above. *)
let rogation = days_between easter d in
if rogation = 36 || rogation = 37 then
build ~season:s
@@ -411,6 +473,34 @@ let temporal d =
let colour =
(* The Pentecost octave weekdays are red, not Paschaltide's white. *)
if days_between easter d >= 50 && days_between easter d <= 55 then Colour.Red
+ (* RG 128(b) (docs/research/rules-register.md §3b), primary
+ text: "...a dominica in Septuagesima usque ad Vigiliam
+ paschalem, EXCEPTIS: ... MISSA SIVE CHRISMATIS SIVE IN
+ CENA DOMINI FERIA V HEBDOMADAE SANCTAE; ..." -- violet
+ runs Septuagesima to the Easter Vigil EXCEPT (among
+ others) "the Mass, whether of the Chrism or in Cena
+ Domini [Holy Thursday], on Thursday of Holy Week" --
+ named as a WHOLE-MASS exception (unlike Palm Sunday's
+ "blessing and procession of palms", which the SAME
+ sentence carves out as only PART of that day, register
+ §3b's own RG126 note on the not-yet-modelled per-action
+ nuance), so this is a clean whole-day colour fact, not
+ a per-action one the day/colour model cannot express.
+ RG 122, fix round 1 (F9), states the same fact
+ affirmatively rather than as an exception to RG 128's
+ violet: "Demum adhibetur color albus, feria V
+ Hebdomadae sanctae, in Missa Chrismatis et in Missa in
+ Cena Domini" -- white is used, finally [among the
+ White section's own list], on Thursday of Holy Week,
+ in the Mass of Chrism and in the Mass in Cena Domini.
+ Task 16, found via the missalemeum oracle comparison:
+ every other Triduum day's oracle colour SET includes
+ violet as one option (Good Friday "bv", Holy Saturday
+ "vw" -- RG 132's black is a separate, ALREADY-flagged
+ gap, register §3b, not touched here), but Holy
+ Thursday's is white ALONE -- confirming this specific
+ day, and only this one, needs the exception coded. *)
+ else if days_between easter d = -3 then Colour.White
else season_colour s
in
let week_n = week d in