7.4. Statements of Selectors
The exact statements behind the claims on the page Selectors.
theorem a_list_picks_the_events_of_both_types (ctx : Ctx) (src : List Event) (a b : String) (e : Event) :
e ∈ evalSelector ctx src (.list [a, b]) ↔ e ∈ evalSelector ctx src (.type a) ∨ e ∈ evalSelector ctx src (.type b)proof: spec/Spec/Laws.lean:187
theorem except_picks_what_the_first_picks_and_the_second_does_not (ctx : Ctx) (src : List Event) (a b : Selector) (e : Event) :
e ∈ evalSelector ctx src (.except a b) ↔ e ∈ evalSelector ctx src a ∧ e ∉ evalSelector ctx src bproof: spec/Spec/Laws.lean:192
theorem a_selector_except_itself_picks_nothing (ctx : Ctx) (src : List Event) (a : Selector) : evalSelector ctx src (.except a a) = []proof: spec/Spec/Laws.lean:197
theorem any_except_a_selector_picks_every_event_it_does_not (ctx : Ctx) (src : List Event) (s : Selector) (e : Event) :
e ∈ evalSelector ctx src (.except .any s) ↔ e ∈ src ∧ e ∉ evalSelector ctx src sproof: spec/Spec/Laws.lean:202
theorem where_where_is_where_and (ctx : Ctx) (src : List Event) (s : Selector) (a b : CondExpr) :
evalSelector ctx src (.filter (.filter s a) b) = evalSelector ctx src (.filter s (.and a b))proof: spec/Spec/Laws.lean:182
theorem a_selector_without_in_picks_a_sublist_of_the_history (ctx : Ctx) (src : List Event) :
∀ s : Selector, s.isLocal = true → (evalSelector ctx src s).Sublist srcproof: spec/Spec/Laws.lean:237
theorem within_covers_the_last_n_units (now t : Rat) (n : Nat) (u : TimeUnit) :
(Window.within n u).contains now t = true ↔ now - n * u.micros < t ∧ t ≤ nowproof: spec/Spec/Meaning.lean:375
theorem today_covers_the_day_of_now_up_to_now (now t : Rat) :
Window.today.contains now t = true ↔ dayOf t = dayOf now ∧ t ≤ nowproof: spec/Spec/Meaning.lean:380
theorem thisWeek_covers_the_week_of_now_up_to_now (now t : Rat) :
Window.thisWeek.contains now t = true ↔ weekOf t = weekOf now ∧ t ≤ nowproof: spec/Spec/Meaning.lean:385
theorem thisMonth_covers_the_month_of_now_up_to_now (now t : Rat) :
Window.thisMonth.contains now t = true ↔ monthOf t = monthOf now ∧ t ≤ nowproof: spec/Spec/Meaning.lean:390
theorem a_window_keeps_the_picked_events_it_contains {ctx : Ctx} {i : Event} (hi : ctx.incoming = some i) (src : List Event) (s : Selector)
(w : Window) (e : Event) :
e ∈ evalSelector ctx src (.window s w) ↔ e ∈ evalSelector ctx src s ∧ w.contains i.at e.at = trueproof: spec/Spec/Facts.lean:362
theorem window_without_incoming_picks_nothing {ctx : Ctx} (hi : ctx.incoming = none)
(src : List Event) (s : Selector) (w : Window) : evalSelector ctx src (.window s w) = []proof: spec/Spec/Facts.lean:369
theorem a_window_only_narrows_the_picks (ctx : Ctx) (src : List Event) (s : Selector) (w : Window) :
(evalSelector ctx src (.window s w)).Sublist (evalSelector ctx src s)proof: spec/Spec/Laws.lean:417
theorem a_window_never_contains_a_timestamp_after_now {now t : Rat} {w : Window} (h : w.contains now t = true) : t ≤ nowproof: spec/Spec/Laws.lean:425
theorem a_longer_within_contains_all_a_shorter_one_does {now t : Rat} {n m : Nat} {u : TimeUnit} (h : n ≤ m)
(hw : (Window.within n u).contains now t = true) : (Window.within m u).contains now t = trueproof: spec/Spec/Laws.lean:429
theorem within_1_hour_excludes_one_hour_ago_and_includes_now (now : Rat) :
(Window.within 1 .hour).contains now (now - TimeUnit.hour.micros) = false ∧
(Window.within 1 .hour).contains now now = trueproof: spec/Spec/Laws.lean:439
theorem a_time_is_in_day_d_exactly_between_d_and_d_plus_1_days (t : Rat) (d : Int) :
dayOf t = d ↔ (d : Rat) * usPerDay ≤ t ∧ t < (d + 1) * usPerDayproof: spec/Spec/Laws.lean:448
theorem weeks_run_from_monday_to_sunday (t : Rat) (w : Int) : weekOf t = w ↔ 7 * w - 3 ≤ dayOf t ∧ dayOf t < 7 * w + 4proof: spec/Spec/Laws.lean:454
theorem week_starts_monday :
weekOf (timestampOf 2026 11 16 0 0 0) = weekOf (timestampOf 2026 11 22 23 59 59 999999) ∧
weekOf (timestampOf 2026 11 15 23 59 59 999999) ≠ weekOf (timestampOf 2026 11 16 0 0 0)proof: spec/Spec/Laws.lean:459
theorem months_change_at_midnight_on_the_first :
monthOf (timestampOf 2024 2 29 23 59 59 999999) = 2024 * 12 + 1 ∧
monthOf (timestampOf 2024 3 1 0 0 0) = 2024 * 12 + 2 ∧
monthOf (timestampOf 2026 2 28 23 59 59 999999) = 2026 * 12 + 1 ∧
monthOf (timestampOf 2026 12 31 23 59 59 999999) = 2026 * 12 + 11 ∧
monthOf (timestampOf 2027 1 1 0 0 0) = 2027 * 12 ∧
monthOf (timestampOf 1969 12 31 23 59 59 999999) = 1969 * 12 + 11proof: spec/Spec/Laws.lean:465
theorem today_lies_in_this_week {now t : Rat} (h : Window.today.contains now t = true) :
Window.thisWeek.contains now t = trueproof: spec/Spec/Laws.lean:480
theorem today_lies_in_this_month {now t : Rat} (h : Window.today.contains now t = true) :
Window.thisMonth.contains now t = trueproof: spec/Spec/Laws.lean:485
theorem a_week_can_straddle_two_months :
Window.thisWeek.contains (timestampOf 2026 12 1 12 0 0) (timestampOf 2026 11 30 12 0 0) = true ∧
Window.thisMonth.contains (timestampOf 2026 12 1 12 0 0) (timestampOf 2026 11 30 12 0 0) = falseproof: spec/Spec/Laws.lean:490