FRsūtil̲s
A fuzzy-rough reasoning utilities library
 
Loading...
Searching...
No Matches
frsutils.core.implicators Namespace Reference

Functions

float imp_gaines (float a, float b)
 
float imp_goedel (float a, float b)
 
float imp_kleene_dienes (float a, float b)
 
float imp_reichenbach (float a, float b)
 
float imp_lukasiewicz (float a, float b)
 

Detailed Description

Collection of fuzzy implicator functions.

This module provides a set of standard fuzzy logic implicators.
Each function takes two fuzzy truth values (floats in the range [0.0, 1.0])
and returns the result of the corresponding implicator.

Function Documentation

◆ imp_gaines()

float frsutils.core.implicators.imp_gaines ( float a,
float b )
Gaines fuzzy implicator.

Returns 1.0 if a <= b.
Returns b / a if a > b and a > 0.
Returns 0.0 if a == 0 and b < a.

@param a: Antecedent value in the range [0.0, 1.0].
@param b: Consequent value in the range [0.0, 1.0].
@return: Result of Gaines' implicator.
@throws ValueError: If either input is outside the range [0.0, 1.0].

Definition at line 11 of file implicators.py.

11def imp_gaines(a: float, b: float) -> float:
12 """
13 Gaines fuzzy implicator.
14
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.
18
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].
23 """
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].")
26 if a <= b:
27 return 1.0
28 elif a > 0:
29 return b / a
30 else:
31 return 0.0
32

◆ imp_goedel()

float frsutils.core.implicators.imp_goedel ( float a,
float b )
Gödel fuzzy implicator.

Returns 1.0 if a <= b, otherwise returns b.

@param a: Antecedent value in the range [0.0, 1.0].
@param b: Consequent value in the range [0.0, 1.0].
@return: Result of Gödel's implicator.
@throws ValueError: If either input is outside the range [0.0, 1.0].

Definition at line 33 of file implicators.py.

33def imp_goedel(a: float, b: float) -> float:
34 """
35 Gödel fuzzy implicator.
36
37 Returns 1.0 if a <= b, otherwise returns b.
38
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].
43 """
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
47

◆ imp_kleene_dienes()

float frsutils.core.implicators.imp_kleene_dienes ( float a,
float b )
Kleene-Dienes fuzzy implicator.

Computes max(1 - a, b).

@param a: Antecedent value in the range [0.0, 1.0].
@param b: Consequent value in the range [0.0, 1.0].
@return: Result of Kleene-Dienes implicator.
@throws ValueError: If either input is outside the range [0.0, 1.0].

Definition at line 48 of file implicators.py.

48def imp_kleene_dienes(a: float, b: float) -> float:
49 """
50 Kleene-Dienes fuzzy implicator.
51
52 Computes max(1 - a, b).
53
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].
58 """
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)
62

◆ imp_lukasiewicz()

float frsutils.core.implicators.imp_lukasiewicz ( float a,
float b )
Łukasiewicz fuzzy implicator.

Computes min(1, 1 - a + b).

@param a: Antecedent value in the range [0.0, 1.0].
@param b: Consequent value in the range [0.0, 1.0].
@return: Result of Łukasiewicz implicator.
@throws ValueError: If either input is outside the range [0.0, 1.0].

Definition at line 78 of file implicators.py.

78def imp_lukasiewicz(a: float, b: float) -> float:
79 """
80 Łukasiewicz fuzzy implicator.
81
82 Computes min(1, 1 - a + b).
83
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].
88 """
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)

◆ imp_reichenbach()

float frsutils.core.implicators.imp_reichenbach ( float a,
float b )
Reichenbach fuzzy implicator.

Computes 1 - a + a * b.

@param a: Antecedent value in the range [0.0, 1.0].
@param b: Consequent value in the range [0.0, 1.0].
@return: Result of Reichenbach implicator.
@throws ValueError: If either input is outside the range [0.0, 1.0].

Definition at line 63 of file implicators.py.

63def imp_reichenbach(a: float, b: float) -> float:
64 """
65 Reichenbach fuzzy implicator.
66
67 Computes 1 - a + a * b.
68
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].
73 """
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
77