úÎ!ƒéw[Í      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌSafe2 ³(c) Edward Kmett 2010-2013BSD3ekmett@gmail.com experimentalDeriveDataTypeableSafe27SXw 2 intervalsThe whole real number linewhole-Infinity ... Infinity intervalsAn empty intervalemptyEmpty intervalsCheck if an interval is emptynull (1 ... 5)Falsenull (1 ... 1)False null emptyTrue intervalsA singleton point singleton 11 ... 1 intervals(The infimum (lower bound) of an intervalinf (1.0 ... 20.0)1.0 inf empty*** Exception: empty interval intervals)The supremum (upper bound) of an intervalsup (1.0 ... 20.0)20.0 sup empty*** Exception: empty interval intervals’Is the interval a singleton point? N.B. This is fairly fragile and likely will not hold after even a few operations that only involve singletonssingular (singleton 1)Truesingular (1.0 ... 20.0)False intervals#Calculate the width of an interval.width (1 ... 20)19width (singleton 1)0 width empty0 intervals Magnitudemagnitude (1 ... 20)20magnitude (-20 ... 10)20magnitude (singleton 5)5throws  if the interval is empty.magnitude empty*** Exception: empty interval intervals "mignitude"mignitude (1 ... 20)1mignitude (-20 ... 10)0mignitude (singleton 5)5throws  if the interval is empty.mignitude empty*** Exception: empty interval intervals%Hausdorff distance between intervals.distance (1 ... 7) (6 ... 10)0distance (1 ... 7) (15 ... 24)8distance (1 ... 7) (-10 ... -2)3distance Empty (1 ... 1)*** Exception: empty interval intervals1Inflate an interval by enlarging it at both ends.inflate 3 (-1 ... 7) -4 ... 10inflate (-2) (0 ... 4)-2 ... 6inflate 1 emptyEmpty  intervals3Deflate an interval by shrinking it from both ends.deflate 3.0 (-4.0 ... 10.0) -1.0 ... 7.0deflate 2.0 (-1.0 ... 1.0)Emptydeflate 1.0 emptyEmpty! intervals%Scale an interval about its midpoint.scale 1.1 (-6.0 ... 4.0) -6.5 ... 4.5scale (-2.0) (-1.0 ... 1.0)Emptyscale 3.0 emptyEmpty" intervalsConstruct a symmetric interval. symmetric 3-3 ... 3symmetric (-2)-2 ... 2# intervals#Bisect an interval at its midpoint.bisect (10.0 ... 20.0)(10.0 ... 15.0,15.0 ... 20.0)bisect (singleton 5.0)(5.0 ... 5.0,5.0 ... 5.0) bisect Empty (Empty,Empty)% intervals.Nearest point to the midpoint of the interval.midpoint (10.0 ... 20.0)15.0midpoint (singleton 5.0)5.0midpoint empty*** Exception: empty interval& intervals(Determine if a point is in the interval.member 3.2 (1.0 ... 5.0)Truemember 5 (1.0 ... 5.0)Truemember 1 (1.0 ... 5.0)Truemember 8 (1.0 ... 5.0)Falsemember 5 emptyFalse' intervals4Determine if a point is not included in the intervalnotMember 8 (1.0 ... 5.0)TruenotMember 1.4 (1.0 ... 5.0)False9And of course, nothing is a member of the empty interval.notMember 5 emptyTrue( intervals(Determine if a point is in the interval.elem 3.2 (1.0 ... 5.0)Trueelem 5 (1.0 ... 5.0)Trueelem 1 (1.0 ... 5.0)Trueelem 8 (1.0 ... 5.0)False elem 5 emptyFalse) intervals4Determine if a point is not included in the intervalnotElem 8 (1.0 ... 5.0)TruenotElem 1.4 (1.0 ... 5.0)False9And of course, nothing is a member of the empty interval.notElem 5 emptyTrueÍ intervals9lift a monotone increasing function over a given intervalÎ intervals9lift a monotone decreasing function over a given interval* intervals,Calculate the intersection of two intervals.Hintersection (1 ... 10 :: Interval Double) (5 ... 15 :: Interval Double) 5.0 ... 10.0+ intervals*Calculate the convex hull of two intervals@hull (0 ... 10 :: Interval Double) (5 ... 15 :: Interval Double) 0.0 ... 15.0Ahull (15 ... 85 :: Interval Double) (0 ... 10 :: Interval Double) 0.0 ... 85.0, intervalsFor all x in X, y in Y. x Ï y?(5 ... 10 :: Interval Double) <! (20 ... 30 :: Interval Double)True?(5 ... 10 :: Interval Double) <! (10 ... 30 :: Interval Double)False?(20 ... 30 :: Interval Double) <! (5 ... 10 :: Interval Double)False- intervalsFor all x in X, y in Y. x Ð y@(5 ... 10 :: Interval Double) <=! (20 ... 30 :: Interval Double)True@(5 ... 10 :: Interval Double) <=! (10 ... 30 :: Interval Double)True@(20 ... 30 :: Interval Double) <=! (5 ... 10 :: Interval Double)False. intervalsFor all x in X, y in Y. x Ñ y;Only singleton intervals or empty intervals can return trueE(singleton 5 :: Interval Double) ==! (singleton 5 :: Interval Double)True?(5 ... 10 :: Interval Double) ==! (5 ... 10 :: Interval Double)FalseÒ intervalsFor all x in X, y in Y. x Ó y@(5 ... 15 :: Interval Double) /=! (20 ... 40 :: Interval Double)True@(5 ... 15 :: Interval Double) /=! (15 ... 40 :: Interval Double)False/ intervalsFor all x in X, y in Y. x Ô y@(20 ... 40 :: Interval Double) >! (10 ... 19 :: Interval Double)True?(5 ... 20 :: Interval Double) >! (15 ... 40 :: Interval Double)False0 intervalsFor all x in X, y in Y. x Õ yA(20 ... 40 :: Interval Double) >=! (10 ... 20 :: Interval Double)True@(5 ... 20 :: Interval Double) >=! (15 ... 40 :: Interval Double)False1 intervalsFor all x in X, y in Y. x op y2 intervalsCheck if interval X totally contains interval YH(20 ... 40 :: Interval Double) `contains` (25 ... 35 :: Interval Double)TrueH(20 ... 40 :: Interval Double) `contains` (15 ... 35 :: Interval Double)False3 intervalsFlipped version of 2. Check if interval X a subset of interval YJ(25 ... 35 :: Interval Double) `isSubsetOf` (20 ... 40 :: Interval Double)TrueJ(20 ... 40 :: Interval Double) `isSubsetOf` (15 ... 35 :: Interval Double)False4 intervalsDoes there exist an x in X, y in Y such that x Ï y?5 intervalsDoes there exist an x in X, y in Y such that x Ð y?6 intervalsDoes there exist an x in X, y in Y such that x Ñ y?Ö intervalsDoes there exist an x in X, y in Y such that x Ó y?7 intervalsDoes there exist an x in X, y in Y such that x Ô y?8 intervalsDoes there exist an x in X, y in Y such that x Õ y?9 intervalsDoes there exist an x in X, y in Y such that x op y?: intervals*id function. Useful for type specification:t idouble (1 ... 3)$idouble (1 ... 3) :: Interval Double; intervals*id function. Useful for type specification:t ifloat (1 ... 3)"ifloat (1 ... 3) :: Interval Float< intervalsan interval containing all x × y >>> (5 × 3) & ((4...6) < (2...4)) True >>> (1...10) <* ((-5)...4) *** Exception: divide by zero= intervalsan interval containing all x Ø y >>> (5 Ø 3) & ((4...6) = (2...4)) True >>> (1...10) =* ((-5)...4) *** Exception: divide by zero> intervalsan interval containing all x Ù y >>> (5 Ù 3) & ((4...6) > (2...4)) True >>> (1...10) >* ((-5)...4) *** Exception: divide by zero? intervalsan interval containing all x Ú y >>> (5 Ú 3) & ((4...6) ? (2...4)) True >>> (1...10) ?* ((-5)...4) *** Exception: divide by zero@ intervalsvWe have to play some semantic games to make these methods make sense. Most compute with the midpoint of the interval.D intervalsÛ will use the midpointH intervalsÜ is +2 !"#$%&'()*+,-./0123456789:;<=>?2&'()%*+#$ !"231,-.0/945687:;<=>?63(c) Edward Kmett 2010-2014BSD3ekmett@gmail.com experimentalDeriveDataTypeableSafez,0 !"#$%&'()*+,-./0123456789:;<=>?0&'()%*+#$ !"231,-.0/945687:;<=>?(c) Edward Kmett 2010-2014BSD3ekmett@gmail.com experimentalDeriveDataTypeableSafe27SXæ5P intervalsCreate a directed interval.Q intervals#Try to create a non-empty interval.R intervalsThe whole real number linewhole-Infinity ... InfinityS intervalsAn empty intervalempty NaN ... NaNT intervalsnegation handles NaN properlynull (1 ... 5)Falsenull (1 ... 1)False null emptyTrueU intervalsA singleton point singleton 11 ... 1V intervals*The infinumum (lower bound) of an intervalinf (1 ... 20)1W intervals)The supremum (upper bound) of an intervalsup (1 ... 20)20X intervals’Is the interval a singleton point? N.B. This is fairly fragile and likely will not hold after even a few operations that only involve singletonssingular (singleton 1)Truesingular (1.0 ... 20.0)FalseY intervals#Calculate the width of an interval.width (1 ... 20)19width (singleton 1)0 width emptyNaNZ intervals Magnitudemagnitude (1 ... 20)20magnitude (-20 ... 10)20magnitude (singleton 5)5[ intervals "mignitude"mignitude (1 ... 20)1mignitude (-20 ... 10)0mignitude (singleton 5)5mignitude emptyNaN\ intervals/Hausdorff distance between non-empty intervals.distance (1 ... 7) (6 ... 10)0distance (1 ... 7) (15 ... 24)8distance (1 ... 7) (-10 ... -2)3distance empty (1 ... 1)NaN] intervals1Inflate an interval by enlarging it at both ends.inflate 3 (-1 ... 7) -4 ... 10inflate (-2) (0 ... 4)2 ... 2^ intervals3Deflate an interval by shrinking it from both ends.deflate 3.0 (-4.0 ... 10.0) -1.0 ... 7.0deflate 2.0 (-1.0 ... 1.0) 1.0 ... -1.0_ intervals%Scale an interval about its midpoint.scale 1.1 (-6.0 ... 4.0) -6.5 ... 4.5scale (-2.0) (-1.0 ... 1.0) 2.0 ... -2.0` intervalsConstruct a symmetric interval. symmetric 3-3 ... 3symmetric (-2)2 ... -2a intervals#Bisect an interval at its midpoint.bisect (10.0 ... 20.0)(10.0 ... 15.0,15.0 ... 20.0)bisect (singleton 5.0)(5.0 ... 5.0,5.0 ... 5.0) bisect empty(NaN ... NaN,NaN ... NaN)b intervals.Nearest point to the midpoint of the interval.midpoint (10.0 ... 20.0)15.0midpoint (singleton 5.0)5.0midpoint emptyNaNc intervals(Determine if a point is in the interval.member 3.2 (1.0 ... 5.0)Truemember 5 (1.0 ... 5.0)Truemember 1 (1.0 ... 5.0)Truemember 8 (1.0 ... 5.0)Falsemember 5 emptyFalsed intervals4Determine if a point is not included in the intervalnotMember 8 (1.0 ... 5.0)TruenotMember 1.4 (1.0 ... 5.0)False9And of course, nothing is a member of the empty interval.notMember 5 emptyTruee intervals(Determine if a point is in the interval.elem 3.2 (1.0 ... 5.0)Trueelem 5 (1.0 ... 5.0)Trueelem 1 (1.0 ... 5.0)Trueelem 8 (1.0 ... 5.0)False elem 5 emptyFalsef intervals4Determine if a point is not included in the intervalnotElem 8 (1.0 ... 5.0)TruenotElem 1.4 (1.0 ... 5.0)False9And of course, nothing is a member of the empty interval.notElem 5 emptyTrueÝ intervals9lift a monotone increasing function over a given intervalÞ intervals9lift a monotone decreasing function over a given intervalg intervals,Calculate the intersection of two intervals.Hintersection (1 ... 10 :: Interval Double) (5 ... 15 :: Interval Double) 5.0 ... 10.0h intervals*Calculate the convex hull of two intervals@hull (0 ... 10 :: Interval Double) (5 ... 15 :: Interval Double) 0.0 ... 15.0Ahull (15 ... 85 :: Interval Double) (0 ... 10 :: Interval Double) 0.0 ... 85.0Ahull (10 ... 20 :: Interval Double) (15 ... 0 :: Interval Double) 10.0 ... 20.0i intervalsFor all x in X, y in Y. x Ï y?(5 ... 10 :: Interval Double) <! (20 ... 30 :: Interval Double)True?(5 ... 10 :: Interval Double) <! (10 ... 30 :: Interval Double)False?(20 ... 30 :: Interval Double) <! (5 ... 10 :: Interval Double)Falsej intervalsFor all x in X, y in Y. x Ð y@(5 ... 10 :: Interval Double) <=! (20 ... 30 :: Interval Double)True@(5 ... 10 :: Interval Double) <=! (10 ... 30 :: Interval Double)True@(20 ... 30 :: Interval Double) <=! (5 ... 10 :: Interval Double)Falsek intervalsFor all x in X, y in Y. x Ñ y$Only singleton intervals return trueE(singleton 5 :: Interval Double) ==! (singleton 5 :: Interval Double)True?(5 ... 10 :: Interval Double) ==! (5 ... 10 :: Interval Double)Falseß intervalsFor all x in X, y in Y. x Ó y@(5 ... 15 :: Interval Double) /=! (20 ... 40 :: Interval Double)True@(5 ... 15 :: Interval Double) /=! (15 ... 40 :: Interval Double)Falsel intervalsFor all x in X, y in Y. x Ô y@(20 ... 40 :: Interval Double) >! (10 ... 19 :: Interval Double)True?(5 ... 20 :: Interval Double) >! (15 ... 40 :: Interval Double)Falsem intervalsFor all x in X, y in Y. x Õ yA(20 ... 40 :: Interval Double) >=! (10 ... 20 :: Interval Double)True@(5 ... 20 :: Interval Double) >=! (15 ... 40 :: Interval Double)Falsen intervalsFor all x in X, y in Y. x op yo intervalsCheck if interval X totally contains interval YH(20 ... 40 :: Interval Double) `contains` (25 ... 35 :: Interval Double)TrueH(20 ... 40 :: Interval Double) `contains` (15 ... 35 :: Interval Double)Falsep intervalsFlipped version of o. Check if interval X a subset of interval YJ(25 ... 35 :: Interval Double) `isSubsetOf` (20 ... 40 :: Interval Double)TrueJ(20 ... 40 :: Interval Double) `isSubsetOf` (15 ... 35 :: Interval Double)Falseq intervalsDoes there exist an x in X, y in Y such that x Ï y?r intervalsDoes there exist an x in X, y in Y such that x Ð y?s intervalsDoes there exist an x in X, y in Y such that x Ñ y?à intervalsDoes there exist an x in X, y in Y such that x Ó y?t intervalsDoes there exist an x in X, y in Y such that x Ô y?u intervalsDoes there exist an x in X, y in Y such that x Õ y?v intervalsDoes there exist an x in X, y in Y such that x op y?w intervalsFThe nearest value to that supplied which is contained in the interval.x intervals*id function. Useful for type specification:t idouble (1 ... 3)$idouble (1 ... 3) :: Interval Doubley intervals*id function. Useful for type specification:t ifloat (1 ... 3)"ifloat (1 ... 3) :: Interval Floatz intervalsan interval containing all x × y >>> (5 × 3) c ((4...6) z (2...4)) True >>> (1...10) z* ((-5)...4) *** Exception: divide by zero{ intervalsan interval containing all x Ø y >>> (5 Ø 3) c ((4...6) { (2...4)) True >>> (1...10) {* ((-5)...4) *** Exception: divide by zero| intervalsan interval containing all x Ù y >>> (5 Ù 3) c ((4...6) | (2...4)) True >>> (1...10) |* ((-5)...4) *** Exception: divide by zero} intervalsan interval containing all x Ú y >>> (5 Ú 3) c ((4...6) } (2...4)) True >>> (1...10) }* ((-5)...4) *** Exception: divide by zero~ intervalsvWe have to play some semantic games to make these methods make sense. Most compute with the midpoint of the interval.‚ intervalsÛ will use the midpoint‹ intervalsÜ is h0NOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}0NOPQRSTUcdefVWXYbghaZ[\]^_`opnijkmlvqrsutwxyz{|}P3(c) Edward Kmett 2010-2014BSD3ekmett@gmail.com experimentalDeriveDataTypeableSafe27SXrÈ6“ intervals;Create a non-empty interval, turning it around if necessary” intervals#Try to create a non-empty interval.• intervalsThe whole real number linewhole-Infinity ... Infinity(x :: Double) `elem` whole– intervalsA singleton point singleton 11 ... 1x `elem` (singleton x)$x /= y ==> y `notElem` (singleton x)— intervals*The infinumum (lower bound) of an intervalinf (1 ... 20)1min x y == inf (x ... y)inf x <= sup x˜ intervals)The supremum (upper bound) of an intervalsup (1 ... 20)20sup x `elem` xmax x y == sup (x ... y)inf x <= sup x™ intervals’Is the interval a singleton point? N.B. This is fairly fragile and likely will not hold after even a few operations that only involve singletonssingular (singleton 1)Truesingular (1.0 ... 20.0)Falseš intervals#Calculate the width of an interval.width (1 ... 20)19width (singleton 1)0 0 <= width x› intervals Magnitudemagnitude (1 ... 20)20magnitude (-20 ... 10)20magnitude (singleton 5)50 <= magnitude xœ intervals "mignitude"mignitude (1 ... 20)1mignitude (-20 ... 10)0mignitude (singleton 5)50 <= mignitude x intervals#Bisect an interval at its midpoint.bisect (10.0 ... 20.0)(10.0 ... 15.0,15.0 ... 20.0)bisect (singleton 5.0)(5.0 ... 5.0,5.0 ... 5.0)<let (a, b) = bisect (x :: Interval Double) in sup a == inf b<let (a, b) = bisect (x :: Interval Double) in inf a == inf x<let (a, b) = bisect (x :: Interval Double) in sup b == sup xŸ intervals.Nearest point to the midpoint of the interval.midpoint (10.0 ... 20.0)15.0midpoint (singleton 5.0)5.0(midpoint x `elem` (x :: Interval Double)  intervals%Hausdorff distance between intervals.distance (1 ... 7) (6 ... 10)0distance (1 ... 7) (15 ... 24)8distance (1 ... 7) (-10 ... -2)3Fcommutative (distance :: Interval Double -> Interval Double -> Double)0 <= distance x y¡ intervals(Determine if a point is in the interval.member 3.2 (1.0 ... 5.0)Truemember 5 (1.0 ... 5.0)Truemember 1 (1.0 ... 5.0)Truemember 8 (1.0 ... 5.0)False¢ intervals4Determine if a point is not included in the intervalnotMember 8 (1.0 ... 5.0)TruenotMember 1.4 (1.0 ... 5.0)False£ intervals(Determine if a point is in the interval.elem 3.2 (1.0 ... 5.0)Trueelem 5 (1.0 ... 5.0)Trueelem 1 (1.0 ... 5.0)Trueelem 8 (1.0 ... 5.0)False¤ intervals4Determine if a point is not included in the intervalnotElem 8 (1.0 ... 5.0)TruenotElem 1.4 (1.0 ... 5.0)Falseá intervals9lift a monotone increasing function over a given intervalâ intervals9lift a monotone decreasing function over a given interval¥ intervals,Calculate the intersection of two intervals.Hintersection (1 ... 10 :: Interval Double) (5 ... 15 :: Interval Double)Just (5.0 ... 10.0)¦ intervals*Calculate the convex hull of two intervals@hull (0 ... 10 :: Interval Double) (5 ... 15 :: Interval Double) 0.0 ... 15.0Ahull (15 ... 85 :: Interval Double) (0 ... 10 :: Interval Double) 0.0 ... 85.0conservative2 const hullconservative2 (flip const) hull§ intervalsFor all x in X, y in Y. x Ï y?(5 ... 10 :: Interval Double) <! (20 ... 30 :: Interval Double)True?(5 ... 10 :: Interval Double) <! (10 ... 30 :: Interval Double)False?(20 ... 30 :: Interval Double) <! (5 ... 10 :: Interval Double)False¨ intervalsFor all x in X, y in Y. x Ð y@(5 ... 10 :: Interval Double) <=! (20 ... 30 :: Interval Double)True@(5 ... 10 :: Interval Double) <=! (10 ... 30 :: Interval Double)True@(20 ... 30 :: Interval Double) <=! (5 ... 10 :: Interval Double)False© intervalsFor all x in X, y in Y. x Ñ y;Only singleton intervals or empty intervals can return trueE(singleton 5 :: Interval Double) ==! (singleton 5 :: Interval Double)True?(5 ... 10 :: Interval Double) ==! (5 ... 10 :: Interval Double)Falseã intervalsFor all x in X, y in Y. x Ó y@(5 ... 15 :: Interval Double) /=! (20 ... 40 :: Interval Double)True@(5 ... 15 :: Interval Double) /=! (15 ... 40 :: Interval Double)Falseª intervalsFor all x in X, y in Y. x Ô y@(20 ... 40 :: Interval Double) >! (10 ... 19 :: Interval Double)True?(5 ... 20 :: Interval Double) >! (15 ... 40 :: Interval Double)False« intervalsFor all x in X, y in Y. x Õ yA(20 ... 40 :: Interval Double) >=! (10 ... 20 :: Interval Double)True@(5 ... 20 :: Interval Double) >=! (15 ... 40 :: Interval Double)False¬ intervalsFor all x in X, y in Y. x op y­ intervalsCheck if interval X totally contains interval YH(20 ... 40 :: Interval Double) `contains` (25 ... 35 :: Interval Double)TrueH(20 ... 40 :: Interval Double) `contains` (15 ... 35 :: Interval Double)False® intervalsFlipped version of ­. Check if interval X a subset of interval YJ(25 ... 35 :: Interval Double) `isSubsetOf` (20 ... 40 :: Interval Double)TrueJ(20 ... 40 :: Interval Double) `isSubsetOf` (15 ... 35 :: Interval Double)False¯ intervalsDoes there exist an x in X, y in Y such that x Ï y?° intervalsDoes there exist an x in X, y in Y such that x Ð y?± intervalsDoes there exist an x in X, y in Y such that x Ñ y?ä intervalsDoes there exist an x in X, y in Y such that x Ó y?² intervalsDoes there exist an x in X, y in Y such that x Ô y?³ intervalsDoes there exist an x in X, y in Y such that x Õ y?´ intervalsDoes there exist an x in X, y in Y such that x op y?µ intervalsFThe nearest value to that supplied which is contained in the interval.(clamp xs y) `elem` xs¶ intervals1Inflate an interval by enlarging it at both ends.inflate 3 (-1 ... 7) -4 ... 10inflate (-2) (0 ... 4)-2 ... 6inflate x i `contains` i· intervals£Deflate an interval by shrinking it from both ends. Note that in cases that would result in an empty interval, the result is a singleton interval at the midpoint.deflate 3.0 (-4.0 ... 10.0) -1.0 ... 7.0deflate 2.0 (-1.0 ... 1.0) 0.0 ... 0.0¸ intervals%Scale an interval about its midpoint.scale 1.1 (-6.0 ... 4.0) -6.5 ... 4.5scale (-2.0) (-1.0 ... 1.0) -2.0 ... 2.03abs x >= 1 ==> (scale (x :: Double) i) `contains` iQforAll (choose (0,1)) $ \x -> abs x <= 1 ==> i `contains` (scale (x :: Double) i)¹ intervalsConstruct a symmetric interval. symmetric 3-3 ... 3symmetric (-2)-2 ... 2x `elem` symmetric x0 `elem` symmetric xº intervals*id function. Useful for type specification:t idouble (1 ... 3)$idouble (1 ... 3) :: Interval Double» intervals*id function. Useful for type specification:t ifloat (1 ... 3)"ifloat (1 ... 3) :: Interval Float¼ intervalsan interval containing all x ×F y prop> forAll (memberOf xs) $ x -> forAll (memberOf ys) $ y -> 0 ¢ ys ==> (x × y) ¡ (xs ¼ ys) prop> 0 ¡/ ys ==> ioProperty $ do z <- try (evaluate (xs ¼' ys)); return $ z === Left DivideByZero½ intervalsan interval containing all x ØF y prop> forAll (memberOf xs) $ x -> forAll (memberOf ys) $ y -> 0 ¢ ys ==> (x Ø y) ¡ (xs ½ ys) prop> 0 ¡/ ys ==> ioProperty $ do z <- try (evaluate (xs ½' ys)); return $ z === Left DivideByZero¾ intervalsan interval containing all x ÙF y prop> forAll (memberOf xs) $ x -> forAll (memberOf ys) $ y -> 0 ¢ ys ==> (x Ù y) ¡ (xs ¾ ys) prop> 0 ¡/ ys ==> ioProperty $ do z <- try (evaluate (xs ¾' ys)); return $ z === Left DivideByZero¿ intervalsan interval containing all x ÚF y prop> forAll (memberOf xs) $ x -> forAll (memberOf ys) $ y -> 0 ¢ ys ==> (x Ú y) ¡ (xs ¿ ys) prop> 0 ¡/ ys ==> ioProperty $ do z <- try (evaluate (xs ¿' ys)); return $ z === Left DivideByZeroÀ intervalsvWe have to play some semantic games to make these methods make sense. Most compute with the midpoint of the interval.Á intervals'Transcendental functions for intervals.*conservative (exp :: Double -> Double) exp3conservativeExceptNaN (log :: Double -> Double) log*conservative (sin :: Double -> Double) sin*conservative (cos :: Double -> Double) cos*conservative (tan :: Double -> Double) tan5conservativeExceptNaN (asin :: Double -> Double) asin5conservativeExceptNaN (acos :: Double -> Double) acos,conservative (atan :: Double -> Double) atan,conservative (sinh :: Double -> Double) sinh,conservative (cosh :: Double -> Double) cosh,conservative (tanh :: Double -> Double) tanh7conservativeExceptNaN (asinh :: Double -> Double) asinh7conservativeExceptNaN (acosh :: Double -> Double) acosh7conservativeExceptNaN (atanh :: Double -> Double) atanhcos (0 ... (pi + 0.1)) -1.0 ... 1.0à intervals"Fractional instance for intervals.Qys /= singleton 0 ==> conservative2 ((/) :: Double -> Double -> Double) (/) xs ysGxs /= singleton 0 ==> conservative (recip :: Double -> Double) recip xsÄ intervalsÛ will use the midpointÅ intervalsNum instance for intervals.5conservative2 ((+) :: Double -> Double -> Double) (+)5conservative2 ((-) :: Double -> Double -> Double) (-)5conservative2 ((*) :: Double -> Double -> Double) (*)*conservative (abs :: Double -> Double) absÇ intervalsÜ is ¦/‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿/‘’“”•–¡¢£¤—˜™šŸ ¥¦ž›œ­®¬§¨©«ª´¯°±³²µ¶·¸¹º»¼½¾¿“3(c) Edward Kmett 2010-2013BSD3ekmett@gmail.com experimentalDeriveDataTypeableSafe27SXuç.‘“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿.‘“”•–¡¢£¤—˜™šŸ ¥¦ž›œ­®¬§¨©«ª´¯°±³²µ¶·¸¹º»¼½¾¿å      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQR !"#$%&'(*+,-./0123456789:;<=>S?@ABCDEFGHIJKTUVWXYMNOPQR !"()*#+,-./0123456789:;<=>S$%&'?@ABCDEFGHIJKMNOPQRZ[\]^\]_\]`a\]b\]c\]defghfgifgjfgkfglfmnZ[aeZ[aeo&intervals-0.9.1-9gZ9fwSgDCp7mpj8wap8wsNumeric.Interval.ExceptionNumeric.IntervalNumeric.Interval.InternalNumeric.Interval.KaucherNumeric.Interval.NonEmpty"Numeric.Interval.NonEmpty.InternalAmbiguousComparison EmptyInterval$fExceptionEmptyInterval$fShowEmptyInterval$fExceptionAmbiguousComparison$fShowAmbiguousComparison$fEqEmptyInterval$fOrdEmptyInterval$fDataEmptyInterval$fEqAmbiguousComparison$fOrdAmbiguousComparison$fDataAmbiguousComparisonIntervalIEmpty+/-interval...wholeemptynull singletoninfsupsingularwidth magnitude mignitudedistanceinflatedeflatescale symmetricbisectbisectIntegralmidpointmember notMemberelemnotElem intersectionhull!>=! certainlycontains isSubsetOf?>=?possiblyidoubleifloatiquotiremidivimod$fRealFloatInterval$fFloatingInterval$fRealFracInterval$fFractionalInterval$fRealInterval $fNumInterval$fShowInterval$fMonoidInterval$fSemigroupInterval $fEqInterval $fOrdInterval$fDataInterval$fGenericInterval$fGeneric1Intervalclamp$fDistributiveInterval$fMonadInterval$fApplicativeInterval$fTraversableInterval$fFoldableInterval$fFunctorInterval increasing decreasingghc-prim GHC.Classes<<===/=!/=>>=/=?baseGHC.Realquotremdivmod realToFracGHC.Base<>