liquidhaskell-0.9.14.1.2: src/GHC/Real_LHAssumptions.hs
{-# OPTIONS_GHC -fplugin=LiquidHaskellBoot #-}
{-# OPTIONS_GHC -Wno-unused-imports #-}
-- Reexports are necessary for LH to expose specs of type classes
module GHC.Real_LHAssumptions(Integral(..), Fractional(..)) where
import GHC.Real
import GHC.Types_LHAssumptions()
import GHC.Num_LHAssumptions()
{-@
assume (^) :: (Num a, Integral b) => x:a -> y:{n:b | n >= 0} -> {z:a | (y == 0 => z == 1) && ((x == 0 && y /= 0) <=> z == 0)}
assume fromIntegral :: (Integral a, Num b) => x:a -> {v:b|v=x}
class Num a => Fractional a where
(/) :: x:a -> y:{v:a | v /= 0} -> {v:a | v == x / y}
recip :: a -> a
fromRational :: Ratio Integer -> a
class (Real a, Enum a) => Integral a where
quot :: x:a -> y:{v:a | v /= 0} -> {v:a | v = quot x y}
rem :: x:a -> y:{v:a | v /= 0} -> {v:a | v = rem x y}
// we cannot use the mod function unqualified because the parser regards it as
// the infix liquid-fixpoint operator, so we have to use GHC.Real.mod instead.
mod :: x:a -> y:{v:a | v /= 0} -> {v:a | v = GHC.Real.mod x y}
div :: x:a -> y:{v:a | v /= 0} -> {v:a | v = div x y }
quotRem :: x:a -> y:{v:a | v /= 0} -> ( {v:a | v = quot x y}
, {v:a | v = rem x y}
)
divMod :: x:a -> y:{v:a | v /= 0} -> ( {v:a | v = div x y}
, {v:a | v = GHC.Real.mod x y}
)
toInteger :: x:a -> {v:Integer | v = x}
define div x y = if y > 0 then x / y else -((- x) / y)
define mod x y = if y > 0 then x mod y else -((- x) mod y)
define quot x y = if x >= 0 then x / y else -((- x) / y)
define rem x y = if x >= 0 then x mod y else -((- x) mod y)
define fromIntegral x = (x)
@-}