(* The Tabula dierum liturgicorum secundum ordinem praecedentiae disposita (Missale Romanum, editio typica tertia 2002; "Normae universales de anno liturgico et de calendario", printed immediately before it) -- 13 numbered entries in three parts. This module transcribes it, one [band] branch per entry, the same discipline Rite_ef.Precedence_ef applies to RG 91's 28. CITATION DISCIPLINE: the 2002 Missal PDF carries BOTH the Normae universales AND the Institutio Generalis Missalis Romani, each independently numbered from 1. Every citation below therefore names its document: "Normae n. N" or "IGMR n. N". A bare "n. N" is ambiguous and must not appear. ENTRY VALUES ARE THE TABLE'S OWN NUMBER TIMES TEN (entry 1 -> 10, entry 13 -> 130). Identical to Precedence_ef's own convention and adopted for the identical reason: a future sub-rank (a movable/fixed split of one row, the shape RG 91 entry 14 forced on the EF side) becomes an ordinary position BETWEEN neighbours, with no rescale of every other branch. Do NOT express a sub-rank as a negative sentinel: Precedence_ef's own history records that as a defect, because a negative value avoids collision but inverts ORDERING. *) open Colitur_kernel let unclassified = max_int (* Not a Normae citation. The Tabula distinguishes universal-calendar entries (3, 7, 10) from proper-calendar ones (4, 8, 11), and nothing in Celebration.t marks that distinction except [layer]. Same mechanism, and same naming, as Precedence_ef.{universal_layer,indult_prefix}. [universal_layer] itself is exported (hand-authored sanctoral data is tagged with it) but [band] no longer tests [layer = universal_layer] directly anywhere in this chain: every temporal-origin candidate {!Rite_of.Temporal_of.temporal} constructs carries [layer = "temporal"] unconditionally (temporal_of.ml, [build]'s own hardcoded ~layer), never [universal_layer] -- so a positive "is this the universal layer" test would silently exclude Trinity Sunday, Corpus Christi, Christ the King, Mary Mother of God, Holy Family and the Baptism of the Lord, none of which are proper-calendar in the sense the Tabula's own 4/8/11 mean. Entries 3, 5 and 7 (all universal-or-temporal, never proper) therefore test [not (is_proper layer)] instead -- true for both [universal_layer] and ["temporal"], false only for a genuine ["proper:..."] candidate. Only entries 4 and 8 test [is_proper] itself. *) let universal_layer = "of-universal" let proper_prefix = "proper:" let is_proper layer = String.starts_with ~prefix:proper_prefix layer (* Days measured from Easter, so the Triduum and the Easter Octave are identified STRUCTURALLY rather than by slug. Temporal_of emits Good Friday and Holy Saturday as ordinary Lent week-6 ferias ("of-lent-6-friday"/"of-lent-6-saturday"), so there is no slug to key on -- the same situation Precedence_ef.band faces for RG 91 entry 2, resolved the same way. *) let easter_offset (ctx : Vocab_of.season Precedence.context) = let y = Date.year ctx.date in Date.to_rata ctx.date - Date.to_rata (Computus.gregorian_easter y) let slug_of (c : Vocab_of.rank Precedence.candidate) = Slug.to_string c.cel.slug (* Tabula I.1: "Triduum paschale Passionis et Resurrectionis Domini." HOLY THURSDAY IS DELIBERATELY NOT HERE. The Tabula's own entry 2 reads "Feriae Hebdomadae sanctae, a feria II ad feriam V inclusive" -- Monday through THURSDAY inclusive -- and the Paschal Triduum begins with the evening Mass of the Lord's Supper, an event INSIDE Holy Thursday's civil day. At colitur's civil-day granularity (one office per date, never a sub-day boundary) the day itself therefore stays with the Holy Week ferias at entry 2. This is the SAME granularity decision, on the precedence axis, that data/of/expected-divergences-litcal.sexp's own L1 records on the season axis (Normae nn. 28/30) -- one decision with two visible consequences, not two independent judgements. *) let is_triduum ctx = List.mem (easter_offset ctx) [ -2; -1; 0 ] (* Tabula I.2, five clauses in one entry. *) let entry_2_named = [ "of-nativity"; "of-epiphany"; "of-ascension"; "of-pentecost"; "of-ash-wednesday" ] let is_privileged_sunday (ctx : Vocab_of.season Precedence.context) c = ctx.weekday = Date.Sun && (match ctx.season with | Vocab_of.Advent | Vocab_of.Lent | Vocab_of.Easter -> true | Vocab_of.Christmas | Vocab_of.Ordinary_time -> false) && c.Precedence.origin = Precedence.Temporal (* "Feriae Hebdomadae sanctae, a feria II ad feriam V inclusive": Easter-6 (Monday) through Easter-3 (Thursday). Palm Sunday (Easter-7) is a Sunday of Lent, covered by [is_privileged_sunday] in the same entry. *) let is_holy_week_feria ctx = List.mem (easter_offset ctx) [ -6; -5; -4; -3 ] (* "Dies infra octavam Paschae": Easter+1 .. Easter+7. Easter Sunday itself is entry 1. *) let is_easter_octave_day ctx = let o = easter_offset ctx in o >= 1 && o <= 7 (* Tabula II.6: "Dominicae temporis Nativitatis et dominicae 'per annum'". The privileged Sundays (Advent, Lent, Easter) are entry 2 and are tested first, so this branch sees only the remaining two seasons. *) let is_ordinary_sunday (ctx : Vocab_of.season Precedence.context) c = ctx.weekday = Date.Sun && (match ctx.season with | Vocab_of.Christmas | Vocab_of.Ordinary_time -> true | Vocab_of.Advent | Vocab_of.Lent | Vocab_of.Easter -> false) && c.Precedence.origin = Precedence.Temporal (* Tabula II.9, three clauses. "Feriae Adventus a die 17 ad 24 decembris inclusive" -- the late-Advent ferias, which outrank an obligatory memorial where an ordinary Advent feria (entry 13) does not. *) let is_late_advent_feria (ctx : Vocab_of.season Precedence.context) = ctx.season = Vocab_of.Advent && Date.month ctx.date = 12 && Date.day ctx.date >= 17 && Date.day ctx.date <= 24 (* "Dies infra octavam Nativitatis": 26-31 December. The Nativity itself (25 December) is entry 2; 1 January is the Octave Day, a solemnity in the sanctoral, not a feria. *) let is_nativity_octave_day (ctx : Vocab_of.season Precedence.context) = Date.month ctx.date = 12 && Date.day ctx.date >= 26 && Date.day ctx.date <= 31 (* "Feriae Quadragesimae". Ash Wednesday and the Holy Week ferias are entry 2 and are tested first. *) let is_lenten_feria (ctx : Vocab_of.season Precedence.context) = ctx.season = Vocab_of.Lent let band (ctx : Vocab_of.season Precedence.context) (c : Vocab_of.rank Precedence.candidate) : int = let temporal = c.Precedence.origin = Precedence.Temporal in let layer = c.cel.layer in if temporal && is_triduum ctx then 10 (* Tabula I.1 *) else if temporal && (List.mem (slug_of c) entry_2_named || is_privileged_sunday ctx c || is_holy_week_feria ctx || is_easter_octave_day ctx) then 20 (* Tabula I.2 *) else if c.cel.rank = Vocab_of.Sollemnitas && not (is_proper layer) then 30 (* Tabula I.3 -- universal or temporal-origin, never proper; see the [is_proper] comment above for why this is not [is_universal] *) else if c.cel.rank = Vocab_of.Sollemnitas && is_proper layer then 40 (* Tabula I.4 *) else if c.cel.rank = Vocab_of.Festum && c.cel.subject = Subject.Lord && not (is_proper layer) then 50 (* Tabula II.5 *) else if is_ordinary_sunday ctx c then 60 (* Tabula II.6 *) else if c.cel.rank = Vocab_of.Festum && not (is_proper layer) then 70 (* Tabula II.7 -- BVM and saints; entry 5 already took subject = Lord *) else if c.cel.rank = Vocab_of.Festum && is_proper layer then 80 (* Tabula II.8 *) else if temporal && (is_late_advent_feria ctx || is_nativity_octave_day ctx || is_lenten_feria ctx) then 90 (* Tabula II.9 *) else unclassified