Fuzzy operators: AND, OR, NOT
Boolean AND, OR and NOT only work on 0 and 1. Fuzzy logic needs versions that work on any degree in . There is no single correct choice. There is a whole family of operators that behave sensibly, and each family member has its own character.
T-norms (fuzzy AND)
A t-norm is any operator that is
- commutative:
- associative:
- monotone: if then
- has identity 1:
Every t-norm agrees with Boolean AND on , and every t-norm satisfies . Minimum is the largest possible t-norm, and drastic product is the smallest.
Name (kind=) | Aliases | Formula |
|---|---|---|
"min" (default) | godel, zadeh, standard | |
"product" | prod, algebraic | |
"lukasiewicz" | luk, bounded | |
"drastic" | if ; if ; else | |
"einstein" | ||
"hamacher" | (0 when ) |
T-conorms (fuzzy OR)
A t-conorm has the same first three properties, but its identity is 0: . Every t-conorm satisfies . Each t-norm has a dual t-conorm , and the table lists them in dual pairs.
Name (kind=) | Aliases | Formula |
|---|---|---|
"max" (default) | godel, zadeh, standard | |
"probor" | prob, probabilistic, algebraic | |
"lukasiewicz" | luk, bounded | |
"drastic" | if ; if ; else | |
"einstein" | ||
"hamacher" | (1 when ) |
Names are case-insensitive.
Complements (fuzzy NOT)
Name (kind=) | Parameter (param=) | Formula |
|---|---|---|
"standard" (default) | none | |
"sugeno" | ||
"yager" |
and both reduce to the standard complement.
A parameter outside its range, or an unknown kind name, raises ff.FuzzyError (a ValueError). Rule strings (IS NOT) always use the standard complement.
The same inputs, every operator
For and :
import ferrifuzz as ff
a, b = 0.7, 0.4
for kind in ["min", "product", "lukasiewicz", "drastic", "einstein", "hamacher"]:
print(f"T {kind:12s}", round(ff.Operator.t_norm(a, b, kind=kind), 4))
for kind in ["max", "probor", "lukasiewicz", "drastic", "einstein", "hamacher"]:
print(f"S {kind:12s}", round(ff.Operator.t_conorm(a, b, kind=kind), 4))
ff.Operator.complement(0.7) # 0.3
ff.Operator.complement(0.7, "sugeno", 2.0) # 0.125
ff.Operator.complement(0.7, "yager", 2.0) # 0.714...
| Operator | T-norm (AND) | T-conorm (OR) |
|---|---|---|
| min / max | 0.4 | 0.7 |
| product / probor | 0.28 | 0.82 |
| Łukasiewicz | 0.1 | 1.0 |
| drastic | 0.0 | 1.0 |
| Einstein | 0.2373 | 0.8594 |
| Hamacher | 0.3415 | 0.75 |
Some intuition:
- min / max are non-interactive. The result depends only on the weaker (or stronger) argument. They are idempotent (), and they are the classic Mamdani choice.
- product / probor let both arguments matter. Two half-true conditions give , not . The output surface is smoother, and gradients are non-zero in both arguments.
- Łukasiewicz and drastic are strict: two weak conditions can give exactly 0.
- Einstein and Hamacher sit between product and min.
Operators on intervals
For interval type-2 sets, a degree is an interval . T-norms and t-conorms are monotone, so they apply bound by bound. The complement swaps the bounds so that lower ≤ upper still holds:
ff.Operator.t_norm((0.6, 0.8), (0.5, 0.9), kind="product") # (0.3, 0.72)
ff.Operator.complement((0.2, 0.6)) # (0.4, 0.8)
How inference uses them
The antecedent of a rule is kept in disjunctive normal form, an OR of AND-groups:
IF a IS x AND b IS y OR c IS z THEN ... → (a IS x ∧ b IS y) ∨ (c IS z)
The firing strength is
with = the system's and_method and = its or_method:
system = ff.FuzzySystem(and_method="product", or_method="probor")
and_method accepts all six t-norm names and or_method all six t-conorm names.
How the firing strength then shapes the output (implication and aggregation) is covered in
Inference.
In ferrifuzz
- Python:
OperatorandHedge - Rust:
TNorm,TConorm,Complement