huzzy- Fuzzy logic library with support for T1, IT2, GT2.

Safe HaskellSafe-Inferred




newtype MF a Source

Type representing type-1 membership functions.


MF (a -> Double) 


Num (MF a) 
Fuzzy (MF a) 
FRule (MF a) 
type Antecedent (MF a) = Double 

class Fuzzy a where Source

Standard operations on fuzzy sets. Instantiated for each kind of fuzzy set. If you want to overload with a t-norm, instantiate against a newtype or instantiated set.


(?&&) :: a -> a -> a infixr 3 Source

Union over fuzzy values.

(?||) :: a -> a -> a infixr 2 Source

Intersection over fuzzy values.

fnot :: a -> a Source

Fuzzy complement.


Fuzzy Double

Standard definitions for operations as defined by Zadeh (1965)

Fuzzy (MF a) 
Fuzzy (T1Set a)

Fuzzy operators are supported on T1Sets. Applies operator to membership functions inside T1Set type.

Fuzzy (IT2Set a)

Interval Type-2 fuzzy sets allow us to work in type-1 concepts. Operators are defined through application to lower and upper membership functions.

Fuzzy (T2ZSet a)

Operations on zSlices fuzzy sets are simply defined as higher order funcitons over the list of zSlices.

Fuzzy b => Fuzzy (a -> b)

Fuzzy operators for membership functions.

(Fuzzy a, Fuzzy b) => Fuzzy (a, b)

Instance for tuple needed for interval type-2 fuzzy sets.

class FSet a where Source

Specifically for fuzzy sets, as opposed to fuzzy values. Support is all elements of domain for which membership is non-zero. Hedge is a modifier of fuzzy sets. is is for application of a value to a fuzzy set.

Associated Types

type Value a Source

A single value of the domain.

type Support a Source

A list of values from the domain for which membership is non-zero.

type Returned a Source

Degree of membership from applying a value to membership function.


support :: a -> Support a Source

hedge :: Double -> a -> a Source

is :: Value a -> a -> Returned a Source


FSet (T1Set a)

Type-1 fuzzy sets are the most basic fuzzy set.

FSet (IT2Set a)

Enables use of support, hedge and is on interval type-2 fuzzy sets.

FSet (T2ZSet a)

Currently the most complex supported fuzzy set.

tCo :: (Num a, Fuzzy a) => FuzOp a -> a -> a -> a Source

Produces the dual t-conorm from a t-norm

tGodel :: (Fuzzy a, Ord a) => FuzOp a Source

Standard t-norm used for intersection.

tProd :: (Fuzzy a, Num a) => FuzOp a Source

tLuk :: (Fuzzy a, Num a, Ord a) => FuzOp a Source

tDras :: (Fuzzy a, Eq a, Num a) => FuzOp a Source

tNilMin :: (Fuzzy a, Eq a, Num a, Ord a) => FuzOp a Source

tHam :: (Fuzzy a, Eq a, Num a, Fractional a) => FuzOp a Source

discrete :: Eq a => [(a, Double)] -> MF a Source

Ensure that input list is correctly ordered for desired performance. I.e. if desired property is that for a u with 2 values of z, max is chosen, order descending on right value of tuple.

singleton :: Double -> MF a Source

Used for type-2 defuzzification.