semibounded-lattices 0.1.0.0 → 0.1.0.1
raw patch · 2 files changed
+25/−14 lines, 2 filesdep +semibounded-latticesdep −semibounded-latticedep ~containersdep ~latticesPVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
Dependencies added: semibounded-lattices
Dependencies removed: semibounded-lattice
Dependency ranges changed: containers, lattices
API changes (from Hackage documentation)
+ Algebra.SemiBoundedLattice: instance Algebra.Lattice.BoundedJoinSemiLattice GHC.Integer.Type.Integer
+ Algebra.SemiBoundedLattice: instance Algebra.Lattice.JoinSemiLattice GHC.Integer.Type.Integer
+ Algebra.SemiBoundedLattice: instance Algebra.Lattice.MeetSemiLattice GHC.Integer.Type.Integer
+ Algebra.SemiBoundedLattice: instance Algebra.SemiBoundedLattice.LowerBoundedDistributiveLattice GHC.Integer.Type.Integer
+ Algebra.SemiBoundedLattice: instance Algebra.SemiBoundedLattice.LowerBoundedLattice GHC.Integer.Type.Integer
+ Algebra.SemiBoundedLattice: instance Algebra.SemiBoundedLattice.SemiCoHeytingAlgebra GHC.Integer.Type.Integer
Files
semibounded-lattices.cabal view
@@ -1,5 +1,5 @@ name: semibounded-lattices-version: 0.1.0.0+version: 0.1.0.1 synopsis: A Haskell implementation of semibounded lattices description: Please see README.md homepage: https://github.com/xu-hao/semibounded-lattices#readme@@ -17,16 +17,16 @@ hs-source-dirs: src exposed-modules: Algebra.SemiBoundedLattice build-depends: base >= 4 && < 5,- lattices,- containers+ lattices >= 1.4,+ containers >= 0.1 default-language: Haskell2010 -test-suite semibounded-lattice-test+test-suite semibounded-lattices-test type: exitcode-stdio-1.0 hs-source-dirs: test main-is: Spec.hs build-depends: base- , semibounded-lattice+ , semibounded-lattices ghc-options: -threaded -rtsopts -with-rtsopts=-N default-language: Haskell2010
src/Algebra/SemiBoundedLattice.hs view
@@ -18,7 +18,7 @@ -- import Data.List (union, intersect, (\\)) import Data.Set (union, intersection, (\\), Set) -import Algebra.Lattice+import Algebra.Lattice (JoinSemiLattice(..), MeetSemiLattice(..), BoundedJoinSemiLattice(..), BoundedMeetSemiLattice(..), Lattice (..), BoundedLattice(..)) -- | The combination of a JoinSemiLattice and a BoundedMeetSemiLattice makes an UpperBoundedLattice if the absorption law holds: --@@ -101,16 +101,16 @@ data Complemented a = Include a | Exclude a deriving Show instance SemiCoHeytingAlgebra a => JoinSemiLattice (Complemented a) where- join (Include vars) (Include vars2) = Include (vars \/ vars2)- join (Include vars) (Exclude vars2) = Exclude (vars2 \\\ vars)- join (Exclude vars) (Include vars2) = Exclude (vars \\\ vars2)- join (Exclude vars) (Exclude vars2) = Exclude (vars2 /\ vars)+ (Include vars) \/ (Include vars2) = Include (vars \/ vars2)+ (Include vars) \/ (Exclude vars2) = Exclude (vars2 \\\ vars)+ (Exclude vars) \/ (Include vars2) = Exclude (vars \\\ vars2)+ (Exclude vars) \/ (Exclude vars2) = Exclude (vars2 /\ vars) instance SemiCoHeytingAlgebra a => MeetSemiLattice (Complemented a) where- meet (Include vars) (Include vars2) = Include (vars /\ vars2)- meet (Exclude vars) (Include vars2) = Include (vars2 \\\ vars)- meet (Include vars) (Exclude vars2) = Include (vars \\\ vars2)- meet (Exclude vars) (Exclude vars2) = Exclude (vars \/ vars2)+ (Include vars) /\ (Include vars2) = Include (vars /\ vars2)+ (Exclude vars) /\ (Include vars2) = Include (vars2 \\\ vars)+ (Include vars) /\ (Exclude vars2) = Include (vars \\\ vars2)+ (Exclude vars) /\ (Exclude vars2) = Exclude (vars \/ vars2) instance SemiCoHeytingAlgebra a => BoundedJoinSemiLattice (Complemented a) where bottom = bottom@@ -143,6 +143,17 @@ instance Ord a => LowerBoundedDistributiveLattice (Set a) instance Ord a => SemiCoHeytingAlgebra (Set a) where subtraction = (\\)++instance MeetSemiLattice Integer where+ (/\) = min+instance JoinSemiLattice Integer where+ (\/) = max+instance BoundedJoinSemiLattice Integer where+ bottom = 0+instance LowerBoundedLattice Integer+instance LowerBoundedDistributiveLattice Integer+instance SemiCoHeytingAlgebra Integer where+ subtraction a b = max 0 (a - b) (/\\), rmeetproj :: SemiCoHeytingAlgebra a => a -> Complemented a -> a rmeetproj vars (Include vars2) = vars /\ vars2