Maintainer | hahn@geoinfo.tuwien.ac.at |
---|---|
Stability | beta |
Safe Haskell | None |
Language | Haskell2010 |
models a Lattice for a context type, the top of the lattice is represented by One and inherits a list of all subcontexts, the bottom of the lattice is represented by Zero. To inherit the contextlattice to a new data type the data type has to instanciate: Enumerable c, Eq c, Ord c, Show c
- data Context c
- getFinerContexts :: (Eq c, Enumerable c, Enumerable (Context c)) => Context c -> [Context c]
- extractContext :: Context c -> [[c]]
- propCommutative :: (Eq c, Enumerable c, Enumerable (Context c)) => Context c -> Context c -> Bool
- propIdempotent :: (Eq c, Enumerable c, Enumerable (Context c)) => Context c -> Bool
- propAssociative :: (Eq c, Enumerable c, Enumerable (Context c)) => Context c -> Context c -> Context c -> Bool
Documentation
data type to represent a lattice structure, the actual context is the type variable c
:: (Eq c, Enumerable c, Enumerable (Context c)) | |
=> Context c | context that is used as start |
-> [Context c] | all finer contexts of the start context included in the lattice |
takes a context and returns all finer
:: Context c | Context where elements are extracted from, |
-> [[c]] | extracted context list |
extracts a context list of contexts from the element, needed for the One wrapper constructor
:: (Eq c, Enumerable c, Enumerable (Context c)) | |
=> Context c | context one |
-> Context c | context two |
-> Bool | true if the property is full-filled |
test for commutativity
>>>
(Ctx [Walking]) `propCommutative` One [Ctx [Walking],Ctx [Driving],Ctx [Walking,Driving],Ctx [Uphill],Ctx [Walking,Uphill],Ctx [Driving,Uphill],Ctx [Walking,Driving,Uphill]] = (Ctx [Walking]) `meet` One [Ctx [Walking],Ctx [Driving],Ctx [Walking,Driving],Ctx [Uphill],Ctx [Walking,Uphill],Ctx [Driving,Uphill],Ctx [Walking,Driving,Uphill]] == One [Ctx [Walking],Ctx [Driving],Ctx [Walking,Driving],Ctx [Uphill],Ctx [Walking,Uphill],Ctx [Driving,Uphill],Ctx [Walking,Driving,Uphill]] `meet` (Ctx [Walking])
true
:: (Eq c, Enumerable c, Enumerable (Context c)) | |
=> Context c | context to test |
-> Bool | true if the property is full-filled |
test for idempotency
>>>
propIdempotent (Ctx [Walking]) = (Ctx [Walking]) `meet` (Ctx [Walking]) == (Ctx [Walking])
true
:: (Eq c, Enumerable c, Enumerable (Context c)) | |
=> Context c | context one |
-> Context c | context two |
-> Context c | context three |
-> Bool | true if the property is full-filled |
test for associativity
>>>
propAssociative (Ctx [Walking]) (Ctx [Driving]) (Ctx [Uphill]) = (Ctx [Walking]) `meet` ((Ctx [Driving]) `meet` (Ctx [Uphill])) == ((Ctx [Walking]) `meet` (Ctx [Driving])) `meet` (Ctx [Uphill])
true