Skip to main content

Crate tnorms

Crate tnorms 

Source
Expand description

T-conorm (s-norm) families for fuzzy logic and differentiable relaxations.

A t-conorm S: [0, 1]^2 -> [0, 1] generalizes logical OR. It is:

  • Commutative: S(a, b) = S(b, a)
  • Associative: S(S(a, b), c) = S(a, S(b, c))
  • Monotone: a1 <= a2 => S(a1, b) <= S(a2, b)
  • Bounded: S(a, 0) = a (0 is identity)

Different families provide different “softness” of the OR operation, useful in differentiable relaxations and probabilistic reasoning.

§Named families

The constants GODEL, PRODUCT, and LUKASIEWICZ name the three common fuzzy-logic families. LogicFamily adds the corresponding residuum for implication:

assert_eq!(tnorms::tnorm(tnorms::GODEL, 0.4, 0.7), 0.4);
assert!((tnorms::tnorm(tnorms::PRODUCT, 0.4, 0.7) - 0.28).abs() < 1e-12);
assert!((tnorms::tnorm(tnorms::LUKASIEWICZ, 0.4, 0.7) - 0.1).abs() < 1e-12);
assert_eq!(tnorms::LogicFamily::Godel.residuum(0.7, 0.4), 0.4);
assert_eq!(tnorms::LogicFamily::Product.tnorm_gradient(0.4, 0.7).da, 0.7);

TruthAlgebra exposes the same three families as zero-sized marker types for crates that choose the logic at the type level:

use tnorms::{Product, TruthAlgebra};

assert!((Product::tnorm_f32(0.4, 0.7) - 0.28).abs() < 1e-6);

The generic TConormFamily catalog is an aggregation catalog. residuum is available for families with a known left-continuous path; LogicFamily remains the standard fuzzy-logic surface where the t-norm and residuum form the adjoint pair by construction.

§Catalog

FamilyFormula S(a,b)ParameterBehavior
Maximummax(a,b)noneHard OR
Probabilistica+b-abnoneIndependent events
Bounded (Lukasiewicz)min(1, a+b)noneSaturating sum
Einstein(a+b)/(1+ab)noneSmooth OR
Hamacher(a+b-2ab)/(1-ab)noneAggressive
Yagermin(1, (a^p + b^p)^(1/p))p >= 1Lp norm
Frank1 - log_s(1+(s^(1-a)-1)(s^(1-b)-1)/(s-1))s > 0Interpolates max<->bounded
Dombi1/(1+((1/a-1)^p + (1/b-1)^p)^(-1/p))p > 0Power-based
Schweizer-Sklardual of (x^p+y^p-1)^(1/p)pspans min/product/Łukasiewicz/drastic
Sugeno-Weberdual of max(0,(x+y-1+pxy)/(1+p))p >= -1spans drastic/Łukasiewicz/product
Aczel-Alsinadual of exp(-(((-ln x)^p+(-ln y)^p)^(1/p)))p > 0product-to-min family
Mayor-Torrensordinal-sum dualp in [0, 1]min-to-Łukasiewicz ordinal sum
Drasticdrastic sumnonediscontinuous limit
Nilpotent minimumnilpotent-minimum dualnoneleft-continuous threshold

Based on: Petersen et al., gendr – Generalized Differentiable Rendering. The t-conorm catalog provides the relaxation families used for differentiable logical operations and soft aggregation.

Structs§

BinaryGradient
Partial derivatives of a binary operation.
Godel
Godel truth algebra: minimum t-norm, maximum t-conorm, and Godel residuum.
Lukasiewicz
Lukasiewicz truth algebra: bounded-sum t-norm, bounded t-conorm, and Lukasiewicz residuum.
OrdinalSegment
One interval of an ordinal-sum t-norm or t-conorm.
OrdinalSum
Ordinal sum over disjoint sub-intervals of [0, 1].
Product
Product truth algebra: product t-norm, probabilistic t-conorm, and Goguen residuum.

Enums§

CopulaCompatibility
Whether a t-norm family is known to satisfy the copula constraints.
GeneratorFamily
Archimedean additive-generator family.
ImplicationFamily
Fuzzy implication family.
LogicFamily
Standard t-norm fuzzy logic families with residual implication.
MixedRegion
Mixed-region behavior for representable uninorms.
NegationFamily
Fuzzy negation family.
TConormFamily
T-conorm family selection.

Constants§

GODEL
Godel family: min(a, b) t-norm and max(a, b) t-conorm.
LUKASIEWICZ
Lukasiewicz family: max(0, a + b - 1) t-norm and min(1, a + b) t-conorm.
PRODUCT
Product family: a * b t-norm and a + b - a * b t-conorm.

Traits§

TruthAlgebra
A standard residuated truth algebra on degrees in [0, 1].

Functions§

implication
Evaluate a fuzzy implication a -> b.
log_product
Sum of logs for product t-norm aggregation.
negation
Evaluate a fuzzy negation.
owa
Ordered weighted averaging over values.
power_mean
Generalized power mean over values in [0, 1].
power_mean_weighted
Weighted generalized power mean over values in [0, 1].
product_from_log
Convert a log-space product back to a degree in [0, 1].
representable_uninorm
Evaluate a representable uninorm with neutral point e.
residuum
Evaluate the residuum a -> b for a t-norm family when available.
residuum_numeric
Numerically approximate the residuum as sup { c : T(a, c) <= b }.
tconorm
Evaluate a t-conorm S(a, b) for the given family.
tconorm_fold
Aggregate multiple values using a t-conorm (generalized multi-way OR).
tconorm_generic
Evaluate a t-conorm S(a, b) for the given family and float type.
tconorm_gradient
Evaluate the t-conorm gradient with respect to (a, b).
tnorm
The dual t-norm T(a,b) = 1 - S(1-a, 1-b) for a given t-conorm family.
tnorm_fold
Aggregate multiple values using a t-norm (generalized multi-way AND).
tnorm_generic
Evaluate the standard-negation dual t-norm for a generic float type.
tnorm_gradient
Evaluate the t-norm gradient with respect to (a, b).

Type Aliases§

Family
Short alias for selecting a t-norm/t-conorm family.