WeakSets-1.2.4.0: Simple set types. Useful to create sets of arbitrary types and nested sets.
CopyrightGuillaume Sabbagh 2022
LicenseGPL-3
Maintainerguillaumesabbagh@protonmail.com
Stabilityexperimental
Portabilityportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Math.PureSet

Description

Pure sets are nested sets which only contain other sets all the way down. They allow to explore basic set theory.

Every mathematical object is a set, usual constructions such as Von Neumann numbers and Kuratowski pairs are implemented.

It is a tree where the order of the branches does not matter.

Functions with the same name as pure set functions are suffixed with the letter P for pure to avoid name collision.

Synopsis

PureSet datatype

data PureSet Source #

A PureSet is a Set of other pure sets.

Constructors

PureSet (Set PureSet) 

Instances

Instances details
Eq PureSet Source # 
Instance details

Defined in Math.PureSet

Methods

(==) :: PureSet -> PureSet -> Bool

(/=) :: PureSet -> PureSet -> Bool

Show PureSet Source # 
Instance details

Defined in Math.PureSet

Methods

showsPrec :: Int -> PureSet -> ShowS

show :: PureSet -> String

showList :: [PureSet] -> ShowS

pureSet :: [PureSet] -> PureSet Source #

Construct a PureSet from a list of pure sets.

Mathematical constructions using sets

emptySet :: PureSet Source #

Construct the empty set.

singleton :: PureSet -> PureSet Source #

Construct the singleton containing a given set.

pair :: PureSet -> PureSet -> PureSet Source #

Construct an ordered pair from two sets according to Kuratowski's definition of a tuple.

cartesianProduct :: PureSet -> PureSet -> PureSet Source #

Construct the cartesian product of two sets.

numberToSet :: (Num a, Eq a) => a -> PureSet Source #

Transform a number into its Von Neumann construction

(||||) :: PureSet -> PureSet -> PureSet Source #

Union of two pure sets.

(&&&&) :: PureSet -> PureSet -> PureSet Source #

Intersection of two pure sets.

isInP :: PureSet -> PureSet -> Bool Source #

Return wether a pure set is in another one.

isIncludedInP :: PureSet -> PureSet -> Bool Source #

Return wether a pure set is included in another one.

card :: PureSet -> Int Source #

Return the size of a pure set.

powerSetP :: PureSet -> PureSet Source #

Return the set of subsets of a given set.

Formatting functions

prettify :: PureSet -> String Source #

Prettify a pure set according to usual mathematical notation.

formatPureSet :: PureSet -> String Source #

Format pure sets such that if numbers are recognized, they are transformed into integer and if pairs are recognized, they are transformed into pairs.