Engine

7.3. Statements of Values🔗

The exact statements behind the claims on the page Values.

theorem missing_field_is_null {e : Event} {f : String} (hf : f ∉ engineFieldNames) (hm : e.fields.lookup f = none) : e.get f = .null

proof: spec/Spec/Facts.lean:279

theorem arithmetic_with_null_on_the_left_is_null (op : ArithOp) (v : Value) : Value.arith op .null v = .null

proof: spec/Spec/Laws.lean:52

theorem arithmetic_with_null_on_the_right_is_null (op : ArithOp) (v : Value) : Value.arith op v .null = .null

proof: spec/Spec/Laws.lean:56

theorem division_by_zero_is_null (a : Rat) : Value.arith .div (.num a) (.num 0) = .null

proof: spec/Spec/Laws.lean:48

theorem division_is_exact (a b : Rat) (hb : b ≠ 0) : Value.arith .mul (Value.arith .div (.num a) (.num b)) (.num b) = .num a

proof: spec/Spec/Laws.lean:43

theorem one_third_times_three_is_exactly_one : Value.arith .mul (Value.arith .div (.num 1) (.num 3)) (.num 3) = .num 1

proof: spec/Spec/Laws.lean:59

theorem addition_subtraction_and_multiplication_are_exact (a b : Rat) : Value.arith .add (.num a) (.num b) = .num (a + b) ∧ Value.arith .sub (.num a) (.num b) = .num (a - b) ∧ Value.arith .mul (.num a) (.num b) = .num (a * b)

proof: spec/Spec/Facts.lean:340

theorem round_floor_and_ceil_give_integers (q : Rat) : Value.fn .round (.num q) = .num (roundHalfAway q) ∧ Value.fn .floor (.num q) = .num q.floor ∧ Value.fn .ceil (.num q) = .num q.ceil

proof: spec/Spec/Facts.lean:352

theorem round_goes_half_away_from_zero : roundHalfAway (1/2) = 1 ∧ roundHalfAway (-1/2) = -1 ∧ roundHalfAway (5/2) = 3 ∧ roundHalfAway (-5/2) = -3

proof: spec/Spec/Facts.lean:346

theorem round_is_within_a_half_of_its_argument (x : Rat) : x - 1/2 ≤ (roundHalfAway x : Rat) ∧ (roundHalfAway x : Rat) ≤ x + 1/2

proof: spec/Spec/Laws.lean:69

theorem floor_is_at_most_its_argument (x : Rat) : (x.floor : Rat) ≤ x

proof: spec/Spec/Laws.lean:64

theorem an_argument_is_less_than_its_floor_plus_one (x : Rat) : x < ((x.floor + 1 : Int) : Rat)

proof: spec/Spec/Laws.lean:65

theorem an_argument_is_at_most_its_ceil (x : Rat) : x ≤ (x.ceil : Rat)

proof: spec/Spec/Laws.lean:66

theorem ceil_is_less_than_the_argument_plus_one (x : Rat) : (x.ceil : Rat) < x + 1

proof: spec/Spec/Laws.lean:67

theorem lower_changes_ascii_letters_only : Value.fn .lower (.str "ÄbC") = .str "Äbc"

proof: spec/Spec/Facts.lean:357

theorem lower_twice_is_lower_once (s : String) : Value.fn .lower (Value.fn .lower (.str s)) = Value.fn .lower (.str s)

proof: spec/Spec/Laws.lean:154

theorem a_minute_is_60_seconds : TimeUnit.minute.micros = 60 * usPerSec

proof: spec/Spec/Meaning.lean:358

theorem an_hour_is_60_minutes : TimeUnit.hour.micros = 60 * TimeUnit.minute.micros

proof: spec/Spec/Meaning.lean:361

theorem a_day_is_24_hours : TimeUnit.day.micros = 24 * TimeUnit.hour.micros

proof: spec/Spec/Meaning.lean:365

theorem a_week_is_7_days : TimeUnit.week.micros = 7 * TimeUnit.day.micros

proof: spec/Spec/Meaning.lean:369

theorem every_date_has_exactly_one_weekday_from_1_to_7 (z : Int) : ∃ n : Int, Value.fn .weekday (.date z) = .num n ∧ 1 ≤ n ∧ n ≤ 7

proof: spec/Spec/Laws.lean:530

theorem consecutive_dates_cycle_through_weekdays_1_to_7 (z : Int) : weekdayOf (z + 1) = if weekdayOf z = 7 then 1 else weekdayOf z + 1

proof: spec/Spec/Laws.lean:535

theorem the_weekday_of_1970_01_01_is_4_thursday : Value.fn .weekday (.ofDate 1970 1 1) = .num 4

proof: spec/Spec/Laws.lean:541

theorem day_of_a_timestamp_is_the_date_whose_day_contains_it (t : Rat) : ∃ d : Int, Value.fn .day (.timestamp t) = .date d ∧ (d : Rat) * usPerDay ≤ t ∧ t < ((d + 1 : Int) : Rat) * usPerDay

proof: spec/Spec/Laws.lean:557

theorem a_timestamp_is_today_exactly_when_its_day_is_the_day_of_now (now t : Rat) : Window.today.contains now t = (Value.fn .day (.timestamp t) == Value.fn .day (.timestamp now) && decide (t ≤ now))

proof: spec/Spec/Laws.lean:563

theorem a_timestamp_is_the_start_of_its_day_plus_its_time_of_day (t : Rat) : ∃ (d : Int) (x : Rat), Value.fn .day (.timestamp t) = .date d ∧ Value.fn .timeOfDay (.timestamp t) = .dur x ∧ t = (d : Rat) * usPerDay + x ∧ 0 ≤ x ∧ x < usPerDay

proof: spec/Spec/Laws.lean:570

theorem shift_hours_precondition_loads_without_errors : (loadFile shiftHoursText).isOk

proof: spec/Spec/Readable.lean:343

theorem a_shift_on_tuesday_morning_is_accepted_on_saturday_or_before_six_rejected : (parseCondExpr "weekday(day($starts_at)) <= 5 and time_of_day($starts_at) >= 6 hours").map (fun c => [(shiftRule c).accepts [] (shiftAt (.ofTimestamp 2026 11 17 8 0 0)), (shiftRule c).accepts [] (shiftAt (.ofTimestamp 2026 11 21 8 0 0)), (shiftRule c).accepts [] (shiftAt (.ofTimestamp 2026 11 17 5 0 0))]) = some [true, false, false]

proof: spec/Spec/Readable.lean:360

theorem a_month_is_30_days : TimeUnit.month.micros = 30 * TimeUnit.day.micros

proof: spec/Spec/Meaning.lean:372

theorem timestamp_plus_a_duration_minus_the_timestamp_is_the_duration (t d : Rat) : Value.arith .sub (Value.arith .add (.timestamp t) (.dur d)) (.timestamp t) = .dur d

proof: spec/Spec/Laws.lean:86

theorem a_date_moves_by_whole_days (x k : Int) : Value.arith .sub (Value.arith .add (.date x) (.dur (k * usPerDay))) (.date x) = .dur (k * usPerDay)

proof: spec/Spec/Laws.lean:91

theorem a_date_plus_an_hour_is_null : Value.arith .add (.date 0) (.dur TimeUnit.hour.micros) = .null

proof: spec/Spec/Laws.lean:102

theorem a_number_times_a_duration_is_a_duration (n d : Rat) : Value.arith .mul (.num n) (.dur d) = .dur (n * d) ∧ Value.arith .mul (.dur d) (.num n) = .dur (n * d)

proof: spec/Spec/Laws.lean:105

theorem n_times_d_divided_by_n_is_d (n d : Rat) (h : n ≠ 0) : Value.arith .div (.dur (n * d)) (.num n) = .dur d

proof: spec/Spec/Laws.lean:112

theorem d_divided_by_n_times_n_is_d (n d : Rat) (h : n ≠ 0) : Value.arith .mul (Value.arith .div (.dur d) (.num n)) (.num n) = .dur d

proof: spec/Spec/Laws.lean:118

theorem a_range_of_non_dates_is_null {a b : Value} (h : ∀ x y, ¬ (a = .date x ∧ b = .date y)) : Value.range a b = .null

proof: spec/Spec/Meaning.lean:353

theorem a_range_has_b_minus_a_days (a b : Int) : (Value.range (.date a) (.date b)).elems.length = (b - a).toNat

proof: spec/Spec/Laws.lean:124

theorem a_range_is_empty_when_b_is_not_after_a {a b : Int} (h : b ≤ a) : (Value.range (.date a) (.date b)).elems = []

proof: spec/Spec/Laws.lean:128

theorem a_range_is_the_dates_from_a_up_to_but_not_including_b {a b : Int} {v : Value} : v ∈ (Value.range (.date a) (.date b)).elems ↔ ∃ d, v = .date d ∧ a ≤ d ∧ d < b

proof: spec/Spec/Laws.lean:131