constraints-0.13.4: Constraint manipulation
Safe Haskell Trustworthy
Language Haskell2010

Data.Constraint.Nat

Description

Utilities for working with KnownNat constraints.

This module is only available on GHC 8.0 or later.

Synopsis

Documentation

type family Min (m :: Nat ) (n :: Nat ) :: Nat where ... Source #

Equations

Min m n = If (n <=? m) n m

type family Max (m :: Nat ) (n :: Nat ) :: Nat where ... Source #

Equations

Max m n = If (n <=? m) m n

type family Lcm (m :: Nat ) (n :: Nat ) :: Nat where ... Source #

Equations

Lcm m m = m

type family Gcd (m :: Nat ) (n :: Nat ) :: Nat where ... Source #

Equations

Gcd m m = m

type family Div (a :: Nat ) (b :: Nat ) :: Nat where ... infixl 7 Source #

Division (round down) of natural numbers. Div x 0 is undefined (i.e., it cannot be reduced).

Since: base-4.11.0.0

type family Mod (a :: Nat ) (b :: Nat ) :: Nat where ... infixl 7 Source #

Modulus of natural numbers. Mod x 0 is undefined (i.e., it cannot be reduced).

Since: base-4.11.0.0

plusZero :: forall n. Dict ((n + 0) ~ n) Source #

minusZero :: forall n. Dict ((n - 0) ~ n) Source #

timesZero :: forall n. Dict ((n * 0) ~ 0) Source #

timesOne :: forall n. Dict ((n * 1) ~ n) Source #

powZero :: forall n. Dict ((n ^ 0) ~ 1) Source #

powOne :: forall n. Dict ((n ^ 1) ~ n) Source #

gcdOne :: forall a. Dict ( Gcd 1 a ~ 1) Source #

lcmOne :: forall a. Dict ( Lcm 1 a ~ a) Source #

plusAssociates :: forall m n o. Dict (((m + n) + o) ~ (m + (n + o))) Source #

timesAssociates :: forall m n o. Dict (((m * n) * o) ~ (m * (n * o))) Source #

plusCommutes :: forall n m. Dict ((m + n) ~ (n + m)) Source #

timesCommutes :: forall n m. Dict ((m * n) ~ (n * m)) Source #

plusIsCancellative :: forall n m o. ((n + m) ~ (n + o)) :- (m ~ o) Source #

timesIsCancellative :: forall n m o. (1 <= n, (n * m) ~ (n * o)) :- (m ~ o) Source #

plusMonotone1 :: forall a b c. (a <= b) :- ((a + c) <= (b + c)) Source #

plusMonotone2 :: forall a b c. (b <= c) :- ((a + b) <= (a + c)) Source #

timesMonotone1 :: forall a b c. (a <= b) :- ((a * c) <= (b * c)) Source #

timesMonotone2 :: forall a b c. (b <= c) :- ((a * b) <= (a * c)) Source #

powMonotone1 :: forall a b c. (a <= b) :- ((a ^ c) <= (b ^ c)) Source #

powMonotone2 :: forall a b c. (b <= c) :- ((a ^ b) <= (a ^ c)) Source #

plusMod :: forall a b c. (1 <= c) :- ( Mod (a + b) c ~ Mod ( Mod a c + Mod b c) c) Source #

timesMod :: forall a b c. (1 <= c) :- ( Mod (a * b) c ~ Mod ( Mod a c * Mod b c) c) Source #

eqLe :: forall (a :: Nat ) (b :: Nat ). (a ~ b) :- (a <= b) Source #

leEq :: forall (a :: Nat ) (b :: Nat ). (a <= b, b <= a) :- (a ~ b) Source #

leTrans :: forall (a :: Nat ) (b :: Nat ) (c :: Nat ). (b <= c, a <= b) :- (a <= c) Source #

leZero :: forall a. (a <= 0) :- (a ~ 0) Source #

plusMinusInverse2 :: forall n m. (m <= n) :- (((m + n) - m) ~ n) Source #

plusMinusInverse3 :: forall n m. (n <= m) :- (((m - n) + n) ~ m) Source #