Documentation

Time.Calendar.MonthDay

def Time.monthLengths (isleap : Bool) :

Month and days of month.

Equations
  • Time.monthLengths isleap = [(1, 31), (2, if isleap = true then 29 else 28), (3, 31), (4, 30), (5, 31), (6, 30), (7, 31), (8, 31), (9, 30), (10, 31), (11, 30), (12, 31)]
Instances For
    structure Time.Date :

    Date in proleptic Gregorian calendar.

    Instances For
      theorem Time.Date.ext {x y : Time.Date} (Year : x.Year = y.Year) (Month : x.Month = y.Month) (Day : x.Day = y.Day) :
      x = y
      Equations
      • One or more equations did not get rendered due to their size.
      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
          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.monthLengths_length_eq_12 (isleap : Bool) :
              (Time.monthLengths isleap).length = 12
              Equations
              Equations
              Equations
              Equations
              theorem Time.monthLengths_nodup {isleap : Bool} :
              (Time.monthLengths isleap).Nodup = (true = true)
              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_snd_eq (isleap : Bool) (i : Fin (Time.monthLastDayAsDayOfYear isleap).length) :
              ((Time.monthLastDayAsDayOfYear isleap).get i).snd = ((Time.monthLastDayAsDayOfYear' isleap).get (Fin.cast i)).snd.snd
              theorem Time.monthLastDayAsDayOfYear'_snd_eq (isleap : Bool) (i : Fin (Time.monthLastDayAsDayOfYear' isleap).length) :
              ((Time.monthLastDayAsDayOfYear' isleap).get i).snd.snd = ((Time.monthLastDayAsDayOfYear isleap).get (Fin.cast i)).snd
              theorem Time.monthLastDayAsDayOfYear'_fst_eq (isleap : Bool) (i : Fin (Time.monthLastDayAsDayOfYear' isleap).length) :
              (Time.monthLastDayAsDayOfYear' isleap)[i].fst = (Time.monthLengths isleap)[i].fst
              theorem Time.monthLastDayAsDayOfYear'_fst_lt_snd (isleap : Bool) (i : Fin (Time.monthLastDayAsDayOfYear' isleap).length) :
              ((Time.monthLastDayAsDayOfYear' isleap).get i).snd.fst < ((Time.monthLastDayAsDayOfYear' isleap).get i).snd.snd
              theorem Time.monthLengths_index_eq_of_fst_eq (isleap : Bool) (i i' : Fin (Time.monthLengths isleap).length) :
              (Time.monthLengths isleap)[i].fst = (Time.monthLengths isleap)[i'].fsti = i'
              theorem Time.monthLastDayAsDayOfYear'_index_le_of_fst_lt_snd (isleap : Bool) (i i' : Fin (Time.monthLastDayAsDayOfYear' isleap).length) :
              ((Time.monthLastDayAsDayOfYear' isleap).get i').snd.fst < ((Time.monthLastDayAsDayOfYear' isleap).get i).snd.sndi' i
              theorem Time.monthLastDayAsDayOfYear'_index_le_of_fst_le_snd (isleap : Bool) (i i' : Fin (Time.monthLastDayAsDayOfYear' isleap).length) :
              ((Time.monthLastDayAsDayOfYear' isleap).get i').snd.fst ((Time.monthLastDayAsDayOfYear' isleap).get i).snd.sndi' i
              theorem Time.monthLastDayAsDayOfYear'_index_le_of_fst_le_snd_incr (isleap : Bool) (i i' : Fin (Time.monthLastDayAsDayOfYear' isleap).length) :
              ((Time.monthLastDayAsDayOfYear' isleap).get i').snd.fst ((Time.monthLastDayAsDayOfYear' isleap).get i).snd.snd + 1i' i + 1
              theorem Time.monthLastDayAsDayOfYear'_index_le_of_snd_le_snd_incr (isleap : Bool) (i i' : Fin (Time.monthLastDayAsDayOfYear' isleap).length) :
              ((Time.monthLastDayAsDayOfYear' isleap).get i').snd.snd + 1 ((Time.monthLastDayAsDayOfYear' isleap).get i).snd.sndi' + 1 i
              theorem Time.monthLastDayAsDayOfYear'_index_le_of_fst_le_fst (isleap : Bool) (i i' : Fin (Time.monthLastDayAsDayOfYear' isleap).length) :
              ((Time.monthLastDayAsDayOfYear' isleap).get i').snd.fst ((Time.monthLastDayAsDayOfYear' isleap).get i).snd.fst + 31i' i + 1
              theorem Time.monthLastDayAsDayOfYear'_pred_snd_incr_eq_fst (isleap : Bool) (i : Fin (Time.monthLastDayAsDayOfYear' isleap).length) :
              i > 0((Time.monthLastDayAsDayOfYear' isleap).get i).snd.fst = ((Time.monthLastDayAsDayOfYear' isleap).get i - 1, ).snd.snd + 1
              theorem Time.monthLastDayAsDayOfYear'_pred_snd_lt_fst (isleap : Bool) (i : Fin (Time.monthLastDayAsDayOfYear' isleap).length) :
              i > 0((Time.monthLastDayAsDayOfYear' isleap).get i - 1, ).snd.snd < ((Time.monthLastDayAsDayOfYear' isleap).get i).snd.fst
              theorem Time.monthLastDayAsDayOfYear'_sub_eq (isleap : Bool) (i : Fin (Time.monthLastDayAsDayOfYear' isleap).length) :
              ((Time.monthLengths isleap).get (Fin.cast i)).snd = ((Time.monthLastDayAsDayOfYear' isleap).get i).snd.snd - ((Time.monthLastDayAsDayOfYear' isleap).get i).snd.fst + 1
              theorem Time.monthLastDayAsDayOfYear'_le_day_1 (isleap : Bool) (a : Nat × Nat × Nat) :
              a Time.monthLastDayAsDayOfYear' isleapa.snd.fst if isleap = true then 336 else 335
              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.Int.le_of_sub_le {a b c d : Nat} (h1 : a c) (h2 : c - b d) :
              a - b d
              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) :
              1 yd - val yd - val 31
              def Time.monthLengths_sum_le (isleap : Bool) (m : Nat) :
              Equations
              Instances For
                Equations
                Instances For
                  Equations
                  Instances For
                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      def Time.monthLengths' (isleap : Bool) :
                      Equations
                      Instances For
                        Equations
                        Instances For
                          theorem Time.monthLengths_sum_eq (isleap : Bool) :
                          (Time.monthLengths_sum isleap == if isleap = true then 366 else 365) = true
                          theorem Time.monthLengths_length_gt_0 (isleap : Bool) :
                          0 < (Time.monthLengths isleap).length
                          theorem Time.monthLengths_month_in (isleap : Bool) (a : Nat × Nat) :
                          a Time.monthLengths isleap1 a.fst a.fst 12
                          theorem Time.monthLengths_days_in (isleap : Bool) (a : Nat × Nat) :
                          a Time.monthLengths isleap1 a.snd a.snd 31
                          theorem Time.monthLengths_month_eq (isleap : Bool) (a : Fin (Time.monthLengths isleap).length) :
                          (Time.monthLengths isleap)[a].fst = a + 1
                          theorem Time.monthLastDayAsDayOfYear_sub_pred_eq_monthLengths (isleap : Bool) (i : Fin (Time.monthLastDayAsDayOfYear isleap).length) :
                          (((Time.monthLastDayAsDayOfYear isleap).get i).snd - if i = 0 then 0 else ((Time.monthLastDayAsDayOfYear isleap).get i - 1, ).snd) = ((Time.monthLengths isleap).get i, ).snd
                          theorem Time.monthLengths_eq (isleap : Bool) :
                          (Time.monthLengths isleap).length = (Time.monthLastDayAsDayOfYear isleap).length
                          theorem Time.month_le_val_exists (isleap : Bool) (i v : Nat) (hle : 1 i) (hlt : i < (Time.monthLengths isleap).length) (h1 : ((Time.monthLastDayAsDayOfYear isleap).get i - 1, ).snd < v) (h2 : v ((Time.monthLastDayAsDayOfYear isleap).get i, ).snd) :
                          ∃ (m : Nat × Nat), m Time.monthLengths isleap m.fst = i + 1 v - ((Time.monthLastDayAsDayOfYear isleap).get i - 1, ).snd m.snd
                          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
                          Instances For
                            def Time.findValidMonthDay_n (year : Int) (isLeap : Bool) (i : Nat) (yd : Time.Icc 1 366) (hl : Time.isLeapYear year = isLeap) (hle : 1 i) (hlt : i < (Time.monthLengths isLeap).length) (hlt' : i < (Time.monthLastDayAsDayOfYear isLeap).length) (hn : ¬yd.val ((Time.monthLastDayAsDayOfYear isLeap).get i - 1, ).snd) (h : yd.val ((Time.monthLastDayAsDayOfYear isLeap).get i, hlt').snd) :
                            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
                                def Time.findValidMonthDay (year : Int) (isLeap : Bool) (yd : Time.Icc 1 366) (hl : Time.isLeapYear year = isLeap) (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
                                  theorem Time.isLeapYear_false {yd : Time.Icc 1 365} {dt : Time.OrdinalDate} (h : dt.dayOfYear = Time.DayOfYear.common yd) :
                                  theorem Time.isLeapYear_true {yd : Time.Icc 1 366} {dt : Time.OrdinalDate} (h : dt.dayOfYear = Time.DayOfYear.leap yd) :
                                  Equations
                                  • One or more equations did not get rendered due to their size.
                                  Instances For
                                    theorem Time.monthLengths_month_le_12 (isleap : Bool) (a : Nat × Nat) :
                                    a Time.monthLengths isleap1 a.fst a.fst 12
                                    theorem Time.monthLengths_days_ge_28 (isleap : Bool) (a : Nat × Nat) :
                                    a Time.monthLengths isleap28 a.snd
                                    theorem Time.monthLengths_days_le_31 (isleap : Bool) (a : Nat × Nat) :
                                    a Time.monthLengths isleapa.snd 31
                                    def Time.monthLength' (isLeap : Bool) (month' : Fin 12) :

                                    The length of a given month in the Gregorian or Julian calendars.

                                    Equations
                                    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_month_in_monthLastDayAsDayOfYear' (isleap : Bool) (month : Time.Icc 1 12) :
                                      ∃ (m : Nat × Nat × Nat), m Time.monthLastDayAsDayOfYear' isleap m.fst = month.val
                                      theorem Time.exists_days_in_monthLastDayAsDayOfYear' (isleap : Bool) (month : Time.Icc 1 12) :
                                      ∃ (a : Nat), ∃ (b : Nat), (month.val, a, b) Time.monthLastDayAsDayOfYear' isleap
                                      def Time.memOfMonth (isleap : Bool) (month : Time.Icc 1 12) :
                                      { x : Nat × Nat × Nat // x Time.monthLastDayAsDayOfYear' isleap x.fst = month.val }
                                      Equations
                                      Instances For
                                        def Time.dy' (isleap : Bool) (month : Time.Icc 1 12) (day : Time.Icc 1 31) :

                                        Get day of year from month and day of month by lookup in monthLastDayAsDayOfYear'.

                                        Equations
                                        Instances For
                                          theorem Time.le_dy' (isleap : Bool) (month : Time.Icc 1 12) (day : Time.Icc 1 31) :
                                          1 Time.dy' isleap month day
                                          theorem Time.dy'_le (isleap : Bool) (month : Time.Icc 1 12) (day : Time.Icc 1 31) :
                                          Time.dy' isleap month day if isleap = true then 366 else 365
                                          def Time.dy (isleap : Bool) (month day : Nat) :

                                          Compute day of year from month (1..12) and day of month (1..31).

                                          Equations
                                          • Time.dy isleap month day = (((367 * month - 362) / 12 + if month 2 then 0 else if isleap = true then -1 else -2) + day).toNat
                                          Instances For
                                            def Time.dyOfLastDayOfMonth (isleap : Bool) (month : Nat) :

                                            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
                                            Instances For
                                              theorem Time.le_dy (isleap : Bool) (month : Time.Icc 1 12) (day : Time.Icc 1 31) :
                                              1 Time.dy isleap month.val day.val
                                              theorem Time.dy_le (isleap : Bool) (month : Time.Icc 1 12) (day : Time.Icc 1 31) :
                                              Time.dy isleap month.val day.val if isleap = true then 366 else 365
                                              def Time.monthAndDayToDayOfYearClipped' (year : Int) (month day : Nat) (hd1 : 1 day) (hd2 : day 31) (hm1 : 1 month) (hm2 : month 12) :
                                              Equations
                                              • One or more equations did not get rendered due to their size.
                                              Instances For
                                                def Time.monthAndDayToDayOfYearClipped (year : Int) (month' : Time.NonemptyIcc 1 12) (day' : Nat) (hd1 : 1 day') (hd2 : day' 31) :
                                                Equations
                                                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.
                                                      Instances For