Equations
- Time.instReprDate = { reprPrec := Time.reprDate✝ }
Equations
- One or more equations did not get rendered due to their size.
Instances For
Date syntactic category
Equations
Instances For
Date from numeric literals year, month and day
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Time.Notation.«termDate%_» = Lean.ParserDescr.node `Time.Notation.«termDate%_» 1022 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol "date%") (Lean.ParserDescr.cat `date 0))
Instances For
Equations
- One or more equations did not get rendered due to their size.
Last day of month as day of year, see monthLengths_sum_le_map_pair
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
First and last day of month as day of year, see monthLengths_sum_le_map_pair'
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]
theorem
Time.monthLastDayAsDayOfYear_length_eq_12
(isleap : Bool)
:
(Time.monthLastDayAsDayOfYear isleap).length = 12
theorem
Time.monthLastDayAsDayOfYear_index_lt
{isleap : Bool}
(i : Fin (Time.monthLastDayAsDayOfYear isleap).length)
:
↑i - 1 < (Time.monthLastDayAsDayOfYear isleap).length
@[simp]
theorem
Time.monthLastDayAsDayOfYear'_length_eq_12
(isleap : Bool)
:
(Time.monthLastDayAsDayOfYear' isleap).length = 12
theorem
Time.monthLastDayAsDayOfYear'_index_lt
{isleap : Bool}
(i : Fin (Time.monthLastDayAsDayOfYear' isleap).length)
:
↑i - 1 < (Time.monthLastDayAsDayOfYear' isleap).length
theorem
Time.monthLastDayAsDayOfYear_sub_pred_le
(isleap : Bool)
(i : Fin (Time.monthLastDayAsDayOfYear isleap).length)
:
((Time.monthLastDayAsDayOfYear isleap).get i).snd - ((Time.monthLastDayAsDayOfYear isleap).get ⟨↑i - 1, ⋯⟩).snd ≤ 31
theorem
Time.monthLastDayAsDayOfYear'_sub_pred_le
(isleap : Bool)
(i : Fin (Time.monthLastDayAsDayOfYear' isleap).length)
:
((Time.monthLastDayAsDayOfYear' isleap).get i).snd.fst = if ↑i = 0 then 1 else ((Time.monthLastDayAsDayOfYear' isleap).get ⟨↑i - 1, ⋯⟩).snd.snd + 1
theorem
Time.monthLastDayAsDayOfYear'_sub_days_le
(isleap : Bool)
(i : Fin (Time.monthLastDayAsDayOfYear' isleap).length)
:
((Time.monthLastDayAsDayOfYear' isleap).get i).snd.snd - ((Time.monthLastDayAsDayOfYear' isleap).get i).snd.fst ≤ 30
theorem
Time.monthLastDayAsDayOfYear'_val_in
(isLeap : Bool)
(yd : Nat)
(i : Fin (Time.monthLastDayAsDayOfYear' isLeap).length)
(h2 : yd ≤ (Time.monthLastDayAsDayOfYear' isLeap)[i].snd.snd)
:
1 ≤ yd - (Time.monthLastDayAsDayOfYear' isLeap)[i].snd.fst + 1 ∧ yd - (Time.monthLastDayAsDayOfYear' isLeap)[i].snd.fst + 1 ≤ 31
theorem
Time.monthLastDayAsDayOfYear_val_le
{yd : Nat}
(isleap : Bool)
(i : Fin (Time.monthLastDayAsDayOfYear isleap).length)
(val : Nat)
(hVal : val = ((Time.monthLastDayAsDayOfYear isleap).get ⟨↑i - 1, ⋯⟩).snd)
(h1 : ¬yd ≤ val)
(h2 : yd ≤ ((Time.monthLastDayAsDayOfYear isleap).get i).snd)
:
Sum of month lengths upto month m
Equations
- Time.monthLengths_sum_le isleap m = List.foldl (fun (acc : Nat) (ml : Nat × Nat) => ml.snd + acc) 0 (List.takeWhile (fun (ml : Nat × Nat) => decide (ml.fst ≤ m)) (Time.monthLengths isleap))
Instances For
Equations
- Time.monthLengths_sum_le_map isleap = List.map (fun (x : Nat × Nat) => Time.monthLengths_sum_le isleap x.fst) (Time.monthLengths isleap)
Instances For
Equations
- Time.monthLengths_sum_le_map_pair isleap = List.map (fun (ml : Nat × Nat) => (ml.fst, Time.monthLengths_sum_le isleap ml.fst)) (Time.monthLengths isleap)
Instances For
theorem
Time.monthLengths_sum_le_eq_monthLastDayAsDayOfYear
(isleap : Bool)
:
Time.monthLengths_sum_le_map isleap = List.map (fun (x : Nat × Nat) => x.snd) (Time.monthLastDayAsDayOfYear isleap)
Equations
- Time.monthLengths' isleap a = List.lookup a (Time.monthLengths isleap)
Instances For
Equations
- Time.monthLengths_sum isleap = List.foldl (fun (acc : Nat) (m : Nat × Nat) => acc + m.snd) 0 (Time.monthLengths isleap)
Instances For
theorem
Time.monthLengths_length_eq_12
(isleap : Bool)
:
((Time.monthLengths isleap).length == 12) = true
theorem
Time.list_foldl_init_add
{α : Type u_1}
(l : List α)
(init v : Nat)
(f : α → Nat)
:
List.foldl (fun (acc : Nat) (v : α) => f v + acc) init l + v = List.foldl (fun (acc : Nat) (v : α) => f v + acc) (init + v) l
def
Time.findValidMonthDay_1
(year : Int)
(isLeap : Bool)
(yd : Time.Icc 1 366)
(h : yd.val ≤ ((Time.monthLastDayAsDayOfYear isLeap).get ⟨0, ⋯⟩).snd)
:
Equations
- Time.findValidMonthDay_1 year isLeap yd h = { Year := year, Month := ⟨1, Time.findValidMonthDay_1.proof_2⟩, Day := ⟨yd.val, ⋯⟩, IsValid := ⋯ }
Instances For
def
Time.findValidMonthDay_2
(year : Int)
(isLeap : Bool)
(yd : Time.Icc 1 366)
(hl : Time.isLeapYear year = isLeap)
(hn : ¬yd.val ≤ (Time.monthLastDayAsDayOfYear isLeap)[0].snd)
(h : yd.val ≤ ((Time.monthLastDayAsDayOfYear isLeap).get ⟨1, ⋯⟩).snd)
:
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
Time.findValidMonthDay_3
(year : Int)
(isLeap : Bool)
(yd : Time.Icc 1 366)
(hl : Time.isLeapYear year = isLeap)
(hn : ¬yd.val ≤ (Time.monthLastDayAsDayOfYear isLeap)[1].snd)
(h : yd.val ≤ ((Time.monthLastDayAsDayOfYear isLeap).get ⟨2, ⋯⟩).snd)
:
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
Time.findValidMonthDay_4
(year : Int)
(isLeap : Bool)
(yd : Time.Icc 1 366)
(hl : Time.isLeapYear year = isLeap)
(hn : ¬yd.val ≤ (Time.monthLastDayAsDayOfYear isLeap)[2].snd)
(h : yd.val ≤ ((Time.monthLastDayAsDayOfYear isLeap).get ⟨3, ⋯⟩).snd)
:
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
Time.findValidMonthDay_5
(year : Int)
(isLeap : Bool)
(yd : Time.Icc 1 366)
(hl : Time.isLeapYear year = isLeap)
(hn : ¬yd.val ≤ (Time.monthLastDayAsDayOfYear isLeap)[3].snd)
(h : yd.val ≤ ((Time.monthLastDayAsDayOfYear isLeap).get ⟨4, ⋯⟩).snd)
:
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
Time.findValidMonthDay_6
(year : Int)
(isLeap : Bool)
(yd : Time.Icc 1 366)
(hl : Time.isLeapYear year = isLeap)
(hn : ¬yd.val ≤ (Time.monthLastDayAsDayOfYear isLeap)[4].snd)
(h : yd.val ≤ ((Time.monthLastDayAsDayOfYear isLeap).get ⟨5, ⋯⟩).snd)
:
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
Time.findValidMonthDay_7
(year : Int)
(isLeap : Bool)
(yd : Time.Icc 1 366)
(hl : Time.isLeapYear year = isLeap)
(hn : ¬yd.val ≤ (Time.monthLastDayAsDayOfYear isLeap)[5].snd)
(h : yd.val ≤ ((Time.monthLastDayAsDayOfYear isLeap).get ⟨6, ⋯⟩).snd)
:
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
Time.findValidMonthDay_8
(year : Int)
(isLeap : Bool)
(yd : Time.Icc 1 366)
(hl : Time.isLeapYear year = isLeap)
(hn : ¬yd.val ≤ (Time.monthLastDayAsDayOfYear isLeap)[6].snd)
(h : yd.val ≤ ((Time.monthLastDayAsDayOfYear isLeap).get ⟨7, ⋯⟩).snd)
:
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
Time.findValidMonthDay_9
(year : Int)
(isLeap : Bool)
(yd : Time.Icc 1 366)
(hl : Time.isLeapYear year = isLeap)
(hn : ¬yd.val ≤ (Time.monthLastDayAsDayOfYear isLeap)[7].snd)
(h : yd.val ≤ ((Time.monthLastDayAsDayOfYear isLeap).get ⟨8, ⋯⟩).snd)
:
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
Time.findValidMonthDay_10
(year : Int)
(isLeap : Bool)
(yd : Time.Icc 1 366)
(hl : Time.isLeapYear year = isLeap)
(hn : ¬yd.val ≤ (Time.monthLastDayAsDayOfYear isLeap)[8].snd)
(h : yd.val ≤ ((Time.monthLastDayAsDayOfYear isLeap).get ⟨9, ⋯⟩).snd)
:
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
Time.findValidMonthDay_11
(year : Int)
(isLeap : Bool)
(yd : Time.Icc 1 366)
(hl : Time.isLeapYear year = isLeap)
(hn : ¬yd.val ≤ (Time.monthLastDayAsDayOfYear isLeap)[9].snd)
(h : yd.val ≤ ((Time.monthLastDayAsDayOfYear isLeap).get ⟨10, ⋯⟩).snd)
:
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
Time.findValidMonthDay_12
(year : Int)
(isLeap : Bool)
(yd : Time.Icc 1 366)
(hl : Time.isLeapYear year = isLeap)
(hn : ¬yd.val ≤ (Time.monthLastDayAsDayOfYear isLeap)[10].snd)
(hle : yd.val ≤ if isLeap = true then 366 else 365)
:
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
Time.findValidMonthDay_tail
(year : Int)
(isLeap : Bool)
(yd : Time.Icc 1 366)
(hl : Time.isLeapYear year = isLeap)
(hle : yd.val ≤ if isLeap = true then 366 else 365)
(h6 : ¬yd.val ≤ (Time.monthLastDayAsDayOfYear isLeap)[5].snd)
:
Equations
- One or more equations did not get rendered due to their size.
Instances For
theorem
Time.isLeapYear_false
{yd : Time.Icc 1 365}
{dt : Time.OrdinalDate}
(h : dt.dayOfYear = Time.DayOfYear.common yd)
:
Time.isLeapYear dt.year = false
theorem
Time.isLeapYear_true
{yd : Time.Icc 1 366}
{dt : Time.OrdinalDate}
(h : dt.dayOfYear = Time.DayOfYear.leap yd)
:
Time.isLeapYear dt.year = true
Equations
- One or more equations did not get rendered due to their size.
Instances For
theorem
Time.monthLengths_days_ge_28
(isleap : Bool)
(a : Nat × Nat)
:
a ∈ Time.monthLengths isleap → 28 ≤ a.snd
theorem
Time.monthLengths_days_le_31
(isleap : Bool)
(a : Nat × Nat)
:
a ∈ Time.monthLengths isleap → a.snd ≤ 31
The length of a given month in the Gregorian or Julian calendars.
Equations
- Time.monthLength' isLeap month' = ((Time.monthLengths isLeap).get month').snd
Instances For
theorem
Time.monthLength'_ge_1
(isLeap : Bool)
(month' : Fin 12)
:
1 ≤ Time.monthLength' isLeap month'
theorem
Time.monthLength'_le_31
(isLeap : Bool)
(month' : Fin 12)
:
Time.monthLength' isLeap month' ≤ 31
theorem
Time.exists_days_in_monthLastDayAsDayOfYear'
(isleap : Bool)
(month : Time.Icc 1 12)
:
∃ (a : Nat), ∃ (b : Nat), (month.val, a, b) ∈ Time.monthLastDayAsDayOfYear' isleap
Equations
- Time.memOfMonth isleap month = ⟨(List.findExisting (fun (m : Nat × Nat × Nat) => decide (m.fst = month.val)) (Time.monthLastDayAsDayOfYear' isleap) ⋯).val, ⋯⟩
Instances For
The day of year of the last day of a month can be computed as the predecessor of the first day of the next month.
Equations
- Time.dyOfLastDayOfMonth isleap month = Time.dy isleap (month + 1) 0
Instances For
def
Time.monthAndDayToDayOfYearClipped
(year : Int)
(month' : Time.NonemptyIcc 1 12)
(day' : Nat)
(hd1 : 1 ≤ day')
(hd2 : day' ≤ 31)
:
Equations
- Time.monthAndDayToDayOfYearClipped year month' day' hd1 hd2 = Time.monthAndDayToDayOfYearClipped' year month'.icc.val day' hd1 hd2 ⋯ ⋯
Instances For
theorem
Time.days_le_31
(isLeap : Bool)
(m : Fin 12)
(day : Time.NonemptyIcc 1 (Time.monthLength' isLeap m))
:
day.icc.val ≤ 31
Convert month and day in the Gregorian or Julian calendars to day of year.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Convert month and day in the Gregorian or Julian calendars to day of year option.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.