2Collection of fuzzy implicator functions.
4This module provides a set of standard fuzzy logic implicators.
5Each function takes two fuzzy truth values (floats in the range [0.0, 1.0])
6and returns the result of the corresponding implicator.
13 Gaines fuzzy implicator.
15 Returns 1.0 if a <= b.
16 Returns b / a if a > b and a > 0.
17 Returns 0.0 if a == 0 and b < a.
19 @param a: Antecedent value in the range [0.0, 1.0].
20 @param b: Consequent value in the range [0.0, 1.0].
21 @return: Result of Gaines' implicator.
22 @throws ValueError: If either input is outside the range [0.0, 1.0].
24 if not (0.0 <= a <= 1.0
and 0.0 <= b <= 1.0):
25 raise ValueError(
"Inputs must be in range [0.0, 1.0].")
35 Gödel fuzzy implicator.
37 Returns 1.0 if a <= b, otherwise returns b.
39 @param a: Antecedent value in the range [0.0, 1.0].
40 @param b: Consequent value in the range [0.0, 1.0].
41 @return: Result of Gödel's implicator.
42 @throws ValueError: If either input is outside the range [0.0, 1.0].
44 if not (0.0 <= a <= 1.0
and 0.0 <= b <= 1.0):
45 raise ValueError(
"Inputs must be in range [0.0, 1.0].")
46 return 1.0
if a <= b
else b
50 Kleene-Dienes fuzzy implicator.
52 Computes max(1 - a, b).
54 @param a: Antecedent value in the range [0.0, 1.0].
55 @param b: Consequent value in the range [0.0, 1.0].
56 @return: Result of Kleene-Dienes implicator.
57 @throws ValueError: If either input is outside the range [0.0, 1.0].
59 if not (0.0 <= a <= 1.0
and 0.0 <= b <= 1.0):
60 raise ValueError(
"Inputs must be in range [0.0, 1.0].")
61 return max(1.0 - a, b)
65 Reichenbach fuzzy implicator.
67 Computes 1 - a + a * b.
69 @param a: Antecedent value in the range [0.0, 1.0].
70 @param b: Consequent value in the range [0.0, 1.0].
71 @return: Result of Reichenbach implicator.
72 @throws ValueError: If either input is outside the range [0.0, 1.0].
74 if not (0.0 <= a <= 1.0
and 0.0 <= b <= 1.0):
75 raise ValueError(
"Inputs must be in range [0.0, 1.0].")
76 return 1.0 - a + a * b
80 Łukasiewicz fuzzy implicator.
82 Computes min(1, 1 - a + b).
84 @param a: Antecedent value in the range [0.0, 1.0].
85 @param b: Consequent value in the range [0.0, 1.0].
86 @return: Result of Łukasiewicz implicator.
87 @throws ValueError: If either input is outside the range [0.0, 1.0].
89 if not (0.0 <= a <= 1.0
and 0.0 <= b <= 1.0):
90 raise ValueError(
"Inputs must be in range [0.0, 1.0].")
91 return min(1.0, 1.0 - a + b)
float imp_kleene_dienes(float a, float b)
float imp_gaines(float a, float b)
float imp_reichenbach(float a, float b)
float imp_goedel(float a, float b)
float imp_lukasiewicz(float a, float b)