Imports
/- Copyright (c) 2025 Joseph Tooby-Smith. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joseph Tooby-Smith -/ module public import Mathlib.Analysis.RCLike.Basic

Units on time

A unit of time corresponds to a choice of translationally-invariant metric on the time manifold TimeTransMan. Such a choice is (non-canonically) equivalent to a choice of positive real number. We define the type TimeUnit to be equivalent to the positive reals.

On TimeUnit there is an instance of division giving a real number, corresponding to the ratio of the two scales of time unit.

We define HasTimeDimension to be a property of a function from TimeUnit to a type M which is a function that scales with the time unit with respect to the rational power d.

To define specific time units, we first state the existence of a a given time unit, and then construct all other time units from it. We choose to state the existence of the time unit of seconds, and construct all other time units from that.

@[expose] public section

The choices of translationally-invariant metrics on the manifold TimeTransMan. Such a choice corresponds to a choice of units for time.

The underlying scale of the unit.

structure TimeUnit : Type where val : property : 0 < val
@[simp] lemma val_ne_zero (x : TimeUnit) : x.val 0 := x:TimeUnitx.val 0 All goals completed! 🐙lemma val_pos (x : TimeUnit) : 0 < x.val := x.propertyinstance : Inhabited TimeUnit where default := 1, 0 < 1 All goals completed! 🐙

Division of TimeUnit

lemma div_eq_val (x y : TimeUnit) : x / y = (x.val / y.val, div_nonneg (le_of_lt x.val_pos) (le_of_lt y.val_pos) : ℝ≥0) := rflx:TimeUnity:TimeUnit¬x.val / y.val, = 0 x:TimeUnity:TimeUnitx.val / y.val, 0 All goals completed! 🐙@[simp] lemma div_pos (x y : TimeUnit) : (0 : ℝ≥0) < x/ y := x:TimeUnity:TimeUnit0 < x / y x:TimeUnity:TimeUnit0 x / yx:TimeUnity:TimeUnit0 x / y x:TimeUnity:TimeUnit0 x / y All goals completed! 🐙 x:TimeUnity:TimeUnit0 x / y All goals completed! 🐙@[simp] lemma div_self (x : TimeUnit) : x / x = (1 : ℝ≥0) := x:TimeUnitx / x = 1 x:TimeUnit1, = 1 All goals completed! 🐙All goals completed! 🐙@[simp] lemma div_mul_div_coe (x y z : TimeUnit) : (x / y : ) * (y / z : ) = x / z := x:TimeUnity:TimeUnitz:TimeUnit(x / y) * (y / z) = (x / z) x:TimeUnity:TimeUnitz:TimeUnitx.val / y.val * (y.val / z.val) = x.val / z.val All goals completed! 🐙

The scaling of a time unit

The scaling of a time unit by a positive real.

def scale (r : ) (x : TimeUnit) (hr : 0 < r := by norm_num) : TimeUnit := r * x.val, mul_pos hr x.val_pos
@[simp] lemma scale_div_self (x : TimeUnit) (r : ) (hr : 0 < r) : scale r x hr / x = (r, le_of_lt hr : ℝ≥0) := x:TimeUnitr:hr:0 < rscale r x hr / x = r, All goals completed! 🐙@[simp] lemma scale_one (x : TimeUnit) : scale 1 x = x := x:TimeUnitscale 1 x = x All goals completed! 🐙x1:TimeUnitx2:TimeUnitr1:r2:hr1:0 < r1hr2:0 < r2r1 * x1.val / (r2 * x2.val), = r1, / r2, * x1.val / x2.val, All goals completed! 🐙@[simp] lemma self_div_scale (x : TimeUnit) (r : ) (hr : 0 < r) : x / scale r x hr = (1/r, _root_.div_nonneg (x:TimeUnitr:hr:0 < r0 1 All goals completed! 🐙) (le_of_lt hr) : ℝ≥0) := x:TimeUnitr:hr:0 < rx / scale r x hr = 1 / r, x:TimeUnitr:hr:0 < rx.val / (r * x.val), = r⁻¹, All goals completed! 🐙@[simp] lemma scale_scale (x : TimeUnit) (r1 r2 : ) (hr1 : 0 < r1) (hr2 : 0 < r2) : scale r1 (scale r2 x hr2) hr1 = scale (r1 * r2) x (mul_pos hr1 hr2) := x:TimeUnitr1:r2:hr1:0 < r1hr2:0 < r2scale r1 (scale r2 x hr2) hr1 = scale (r1 * r2) x x:TimeUnitr1:r2:hr1:0 < r1hr2:0 < r2r1 * (r2 * x.val) = r1 * r2 * x.val All goals completed! 🐙

Specific choices of time units

To define a specific time units. We first define the notion of a second to correspond to the length unit with underlying value equal to 1. This is really down to a choice in the isomorphism between the set of metrics on the time manifold and the positive reals. From this choice of second, we can define other length units by scaling second.

The definition of a time unit of seconds.

def seconds : TimeUnit := 1, 0 < 1 All goals completed! 🐙

Relations between time units

All goals completed! 🐙60 * 60, = 3600; All goals completed! 🐙24 * 60 * 60, = 86400; All goals completed! 🐙7 * 24 * 60 * 60, = 604800; All goals completed! 🐙24 * 60 * 60, / 60, = 1440; All goals completed! 🐙7 * 24 * 60 * 60, / 60, = 10080; All goals completed! 🐙24 * 60 * 60, / 60 * 60, = 24; All goals completed! 🐙7 * 24 * 60 * 60, / 60 * 60, = 168; All goals completed! 🐙