Copyright | Guillaume Sabbagh 2021 |
---|---|
License | GPL-3 |
Maintainer | guillaumesabbagh@protonmail.com |
Stability | experimental |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
The FinSet category has as objects finite sets and as morphisms maps between them.
It is a full subcategory of the Set category.
It is itself a large category (therefore not a finite one),
we only construct finite subcategories of the mathematical infinite FinSet category.
FinSet
is the type of full finite subcategories of FinSet.
To instantiate it, use the FinSet
constructor on a list of sets.
For example, see Example.ExampleSet
Synopsis
- data FinSet a
- = Elem a
- | Collection [FinSet a]
- emptyFinSet :: FinSet a
- singleton :: a -> FinSet a
- toList :: FinSet a -> [FinSet a]
- fromList :: Eq a => [FinSet a] -> FinSet a
- (|||) :: Eq a => FinSet a -> FinSet a -> FinSet a
- union :: Eq a => [FinSet a] -> FinSet a
- (&&&) :: Eq a => FinSet a -> FinSet a -> FinSet a
- intersection :: Eq a => [FinSet a] -> FinSet a
- isIn :: Eq a => FinSet a -> FinSet a -> Bool
- includedIn :: Eq a => FinSet a -> FinSet a -> Bool
- card :: FinSet a -> Int
- generalizeType :: FinSet a -> FinSet (Either a b)
- data FinMap a = FinMap {}
- data FinSetCat a = FinSetCat [FinSet a]
- powerFinSet :: FinSet a -> FinSet a
- constructLimit :: (FiniteCategory c m o, Morphism m o, Eq a, Eq c, Eq m, Eq o) => Diagram c m o (FinSetCat a) (FinMap a) (FinSet a) -> (Diagram (FinSetCat a) (FinMap a) (FinSet a) (FinSetCat a) (FinMap a) (FinSet a), Diagram c m o (FinSetCat a) (FinMap a) (FinSet a), FinSet a)
- generalizeTypeSetCat :: FinSetCat a -> FinSetCat (Either a b)
Documentation
When constructing a set, the following rules should be respected :
- An elem is always a leaf construct.
- There should be no duplicate in a Collection.
- The root construct is always a Collection.
This set construction does not require the ord constraint.
Elem a | |
Collection [FinSet a] |
Instances
Functor FinSet Source # | |
Eq a => Eq (FinSet a) Source # | |
Show a => Show (FinSet a) Source # | |
PrettyPrintable a => PrettyPrintable (FinSet a) Source # | |
Eq a => Morphism (FinMap a) (FinSet a) Source # | |
Eq a => GeneratedFiniteCategory (FinSetCat a) (FinMap a) (FinSet a) Source # | |
Eq a => FiniteCategory (FinSetCat a) (FinMap a) (FinSet a) Source # | |
emptyFinSet :: FinSet a Source #
Constructs the empty set.
intersection :: Eq a => [FinSet a] -> FinSet a Source #
Intersection of a list of sets.
includedIn :: Eq a => FinSet a -> FinSet a -> Bool Source #
Returns wether a set is included in another one.
generalizeType :: FinSet a -> FinSet (Either a b) Source #
Generalizes a set of a
so that it can contain elements of type a
or b
.
FinMap
is the morphism of the FinSetCat
category.
We need to keep the codomain because it would not be present in a non-surjective map.
It is represented by an association list and a codomain.
Instances
Eq a => Eq (FinMap a) Source # | |
Show a => Show (FinMap a) Source # | |
(PrettyPrintable a, Eq a) => PrettyPrintable (FinMap a) Source # | |
Eq a => Morphism (FinMap a) (FinSet a) Source # | |
Eq a => GeneratedFiniteCategory (FinSetCat a) (FinMap a) (FinSet a) Source # | |
Eq a => FiniteCategory (FinSetCat a) (FinMap a) (FinSet a) Source # | |
FinSetCat
is the type for the category of FinSet
.
Its elements are the sets considered in the Set category.
powerFinSet :: FinSet a -> FinSet a Source #
Returns the FinSet
category such that every subset of the set given is an object of the category.
constructLimit :: (FiniteCategory c m o, Morphism m o, Eq a, Eq c, Eq m, Eq o) => Diagram c m o (FinSetCat a) (FinMap a) (FinSet a) -> (Diagram (FinSetCat a) (FinMap a) (FinSet a) (FinSetCat a) (FinMap a) (FinSet a), Diagram c m o (FinSetCat a) (FinMap a) (FinSet a), FinSet a) Source #
Add a set to the target FinSetCat such that the given diagram has a limit. The diagram must not be the empty diagram from 0
to 0
.
Returns an insertion functor from the previous set category to the new one, an updated diagram which has a limit, and the new limit object.
generalizeTypeSetCat :: FinSetCat a -> FinSetCat (Either a b) Source #
Generalizes a set category of a
so that it can contain elements of type a
or b
.