Equations
- Time.instReprFixed = { reprPrec := Time.reprFixed✝ }
Equations
- Time.instBEqFixed = { beq := Time.beqFixed✝ }
Equations
- Time.instDecidableEqFixed = Time.decEqFixed✝
Equations
- Time.instReprSign = { reprPrec := Time.reprSign✝ }
Equations
- Time.instDecidableEqSign x y = if h : x.toCtorIdx = y.toCtorIdx then isTrue ⋯ else isFalse ⋯
instance
Time.Fixed.instReprDenominator
{precision✝ : Nat}
:
Repr (Time.Fixed.Denominator precision✝)
Equations
- Time.Fixed.instReprDenominator = { reprPrec := Time.Fixed.reprDenominator✝ }
Equations
- Time.Fixed.instBEqDenominator = { beq := Time.Fixed.beqDenominator✝ }
instance
Time.Fixed.instDecidableEqDenominator
{precision✝ : Nat}
:
DecidableEq (Time.Fixed.Denominator precision✝)
Equations
- Time.Fixed.instDecidableEqDenominator = Time.Fixed.decEqDenominator✝
Equations
- Time.Fixed.instReprParts = { reprPrec := Time.Fixed.reprParts✝ }
Equations
- Time.Fixed.instBEqParts = { beq := Time.Fixed.beqParts✝ }
instance
Time.Fixed.instDecidableEqParts
{precision✝ : Nat}
:
DecidableEq (Time.Fixed.Parts precision✝)
Equations
- Time.Fixed.instDecidableEqParts = Time.Fixed.decEqParts✝
Equations
- Time.Fixed.zero = { val := 0 }
Instances For
Equations
- Time.Fixed.Denominator.zero = { val := 0, lt := ⋯ }
Instances For
Equations
- Time.instInhabitedFixed = { default := Time.Fixed.zero }
Equations
- Time.instLTFixed = { lt := fun (a b : Time.Fixed p) => a.val < b.val }
Equations
- Time.instLEFixed = { le := fun (a b : Time.Fixed p) => a.val ≤ b.val }
Equations
- Time.instInhabitedDenominator = { default := Time.Fixed.Denominator.zero }
Equations
- Time.instLTDenominator = { lt := fun (a b : Time.Fixed.Denominator p) => a.val < b.val }
Equations
- Time.instLEDenominator = { le := fun (a b : Time.Fixed.Denominator p) => a.val ≤ b.val }
Equations
- ⋯ = ⋯
Instances For
Equations
- f.toParts = { sign := if f.val < 0 then Time.Sign.Neg else Time.Sign.Nonneg, numerator := f.val.natAbs / 10 ^ p, denominator := f.val.natAbs % 10 ^ p, lt := ⋯ }
Instances For
def
Time.Fixed.toFixed
{p : Nat}
(sign : Time.Sign)
(num : Nat)
(denom : Time.Fixed.Denominator p)
:
Equations
- Time.Fixed.toFixed Time.Sign.Neg num denom = { val := Int.negOfNat (num * 10 ^ p + denom.val) }
- Time.Fixed.toFixed Time.Sign.Nonneg num denom = { val := ↑num * 10 ^ p + ↑denom.val }
Instances For
Equations
- parts.fromParts = Time.Fixed.toFixed parts.sign parts.numerator { val := parts.denominator, lt := ⋯ }
Instances For
Equations
- Time.Fixed.toSign n = if n < 0 then Time.Sign.Neg else Time.Sign.Nonneg
Instances For
remove trailing digits untill n < 10 ^ p
Equations
- Time.Fixed.toDenominator n p = { val := (Time.Fixed.toDenominator.clip_denom n (10 ^ p) ⋯).val, lt := ⋯ }
Instances For
@[irreducible]
Equations
- Time.Fixed.toDenominator.clip_denom n p hp = if h : 0 < n then if h1 : n ≥ p then Time.Fixed.toDenominator.clip_denom (n / 10) p hp else ⟨n, ⋯⟩ else ⟨0, hp⟩
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- f.denominatorToString = match f.toParts with | { sign := sign, numerator := numerator, denominator := d, lt := lt } => Time.Fixed.denominatorValueToString (↑d) p
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Instances For
Equations
- Time.Fixed.instSub = { sub := Time.Fixed.sub }
Equations
- Time.Fixed.instAdd = { add := Time.Fixed.add }
Equations
- Time.Fixed.Int.toFixed n p = { val := n }
Instances For
Instances For
Equations
- Time.Fixed.instHDivInt = { hDiv := Time.Fixed.div }
Equations
- Time.Fixed.mul a f = { val := a * f.val }
Instances For
Equations
- Time.Fixed.instHMulInt = { hMul := Time.Fixed.mul }
Instances For
Equations
- Time.Fixed.instMod = { mod := Time.Fixed.mod }
theorem
Time.Fixed.emod_nonneg
{p : Nat}
(a : Time.Fixed p)
{b : Time.Fixed p}
(h : b ≠ { val := 0 })
:
theorem
Time.Fixed.emod_lt_of_pos
{p : Nat}
(a : Time.Fixed p)
{b : Time.Fixed p}
(h : { val := 0 } < b)
:
def
Time.Fixed.toMod
{p : Nat}
(n d : Time.Fixed p)
(h : Time.Fixed.zero < d)
:
{ m : Time.Fixed p // Time.Fixed.zero ≤ m ∧ m < d }
toMod computes n % d : { m : Fixed p // zero ≤ m ∧ m < d }
Instances For
theorem
Time.Fixed.toFixed_lt_toFixed
(p n : Nat)
(n_denom : Time.Fixed.Denominator p)
(m : Nat)
(m_denom : Time.Fixed.Denominator p)
(hnm : n < m)
:
Time.Fixed.toFixed Time.Sign.Nonneg n n_denom < Time.Fixed.toFixed Time.Sign.Nonneg m m_denom
theorem
Time.Fixed.zero_lt_toFixed
(p m : Nat)
(m_denom : Time.Fixed.Denominator p)
(h : 0 < m)
:
Time.Fixed.zero < Time.Fixed.toFixed Time.Sign.Nonneg m m_denom
theorem
Time.Fixed.toFixed_le_toFixed_of_lt
(p n : Nat)
(n_denom : Time.Fixed.Denominator p)
(m : Nat)
(m_denom : Time.Fixed.Denominator p)
(hnm : n < m)
:
Time.Fixed.toFixed Time.Sign.Nonneg n n_denom ≤ Time.Fixed.toFixed Time.Sign.Nonneg m m_denom
theorem
Time.Fixed.zero_le_toFixed
(p m : Nat)
(m_denom : Time.Fixed.Denominator p)
(hnm : 0 < m)
:
Time.Fixed.zero ≤ Time.Fixed.toFixed Time.Sign.Nonneg m m_denom