You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
type Rel a = [(a,a)]
symClos :: Ord a => Rel a -> Rel a
symClos [] = []
symClos :: Ord a => Rel a -> Rel a
symClos ((x,y):xs) = (nub $ sort $ (y,x):(x,y):(symClos xs))
Exercise 7
Nice readable documentation by using mathematical symbols!
{-
trClos:
Test properties:
∀ x, y, z: xSy, ySz => xSz
R ⊆ S
∀ S' ⊂ S: S' is not a transitive closure of R
-}
The following function is not a good idea.
prop_TrClosSmallest r = isSmallest $ trClos r
where
isSmallest s = r ⊆ s && isTransitive s && (not . hasSmaller) s
hasSmaller [] = False
hasSmaller [x] = isSmallest []
hasSmaller (x:y:xs) = isSmallest (x:xs) && isSmallest (y:xs)
types = (r :: Rel Int)
Why not
prop_TrClosSmallest r = not (Any (\x -> not( isTransitive r\\ [x] ) r)
The text was updated successfully, but these errors were encountered:
Exercise 5
Better and cheaper
Exercise 7
Nice readable documentation by using mathematical symbols!
{-
trClos:
Test properties:
∀ x, y, z: xSy, ySz => xSz
R ⊆ S
∀ S' ⊂ S: S' is not a transitive closure of R
-}
The following function is not a good idea.
Why not
The text was updated successfully, but these errors were encountered: