fuzzy_dl_owl2.fuzzydl.concept.concrete.crisp_concrete_concept

A crisp concrete concept implementation that applies binary membership logic to determine if a value lies within a specified satisfaction interval.

Description

The software defines a specialized concept that operates within a fuzzy logic environment but enforces strict binary membership, effectively distinguishing between complete satisfaction and non-satisfaction based on numerical intervals. By establishing a validity domain defined by boundaries k1 and k2, alongside a narrower satisfaction interval bounded by a and b, the implementation ensures that any evaluated value yields a membership degree of 1.0 only if it falls strictly within the inner range, returning 0.0 otherwise. During initialization, rigorous validation logic enforces structural integrity by verifying that the satisfaction interval is properly contained within the validity domain, raising errors if the bounds are misconfigured. To facilitate complex logical reasoning, the class integrates with an operator framework to support negation, conjunction, and disjunction, allowing these crisp concepts to be combined or manipulated while maintaining their distinct binary characteristics.

Classes

CrispConcreteConcept

This class models a crisp concrete concept within a fuzzy logic framework, implementing a binary membership function that distinguishes strictly between satisfaction and non-satisfaction. It is defined by a validity interval [k1, k2] representing the domain of the concept, and a nested satisfaction interval [a, b] where the concept holds true. When evaluating a specific value, the class returns a membership degree of 1.0 if the value falls within the satisfaction interval [a, b] and 0.0 otherwise. The initialization process includes validation logic to ensure that the satisfaction interval is valid and fully contained within the validity interval, raising a ValueError if these constraints are violated. Furthermore, the class supports logical operations such as negation, conjunction, and disjunction, allowing for the composition of complex concepts.

Module Contents

UML Class Diagram for CrispConcreteConcept

UML Class Diagram for CrispConcreteConcept

class CrispConcreteConcept(name: str, k1: float, k2: float, a: float, b: float)

Bases: fuzzy_dl_owl2.fuzzydl.concept.concrete.fuzzy_concrete_concept.FuzzyConcreteConcept

Inheritance diagram of fuzzy_dl_owl2.fuzzydl.concept.concrete.crisp_concrete_concept.CrispConcreteConcept

This class models a crisp concrete concept within a fuzzy logic framework, implementing a binary membership function that distinguishes strictly between satisfaction and non-satisfaction. It is defined by a validity interval [k1, k2] representing the domain of the concept, and a nested satisfaction interval [a, b] where the concept holds true. When evaluating a specific value, the class returns a membership degree of 1.0 if the value falls within the satisfaction interval [a, b] and 0.0 otherwise. The initialization process includes validation logic to ensure that the satisfaction interval is valid and fully contained within the validity interval, raising a ValueError if these constraints are violated. Furthermore, the class supports logical operations such as negation, conjunction, and disjunction, allowing for the composition of complex concepts.

Parameters:
  • k1 (float) – Lower bound of the definition interval [k1, k2], representing the minimum value for which the concept is valid.

  • k2 (float) – The upper bound of the interval defining the domain of the concept.

  • _a (float) – Stores the lower bound of the interval for which the concept is satisfied, defining the start of the range where the membership degree is 1.

  • _b (float) – The upper bound of the interval for which the concept is satisfied.

Raises:

ValueError – Raised when the satisfaction interval [a, b] is invalid or not contained within the definition interval [k1, k2]. This happens if a > b, a < k1, or b > k2.

__and__(value: Self) Self

Performs a logical conjunction or intersection between the current instance and another concept of the same type. This method enables the use of the bitwise AND operator (&) to combine concepts, delegating the underlying logic to the OperatorConcept.and_ static method. It returns a new instance of the same class representing the result of the operation, leaving the original operands unchanged.

Parameters:

value (Self) – The right-hand operand to perform the AND operation with.

Returns:

A new instance representing the logical conjunction of this concept and the provided value.

Return type:

Self

__hash__() int

Return a hash value for this object, computed from its string representation. This approach ensures that the hash value reflects the structural identity of the object without relying on cached values or additional methods. The hash is derived from the output of the __str__ method, which provides a consistent and unique representation of the concept’s structure. This implementation does not utilize any internal caching mechanism and directly computes the hash each time it is called.

Returns:

An integer hash value representing the structural identity of this object.

Return type:

int

__neg__() fuzzy_dl_owl2.fuzzydl.concept.concrete.fuzzy_concrete_concept.FuzzyConcreteConcept

Implements the unary negation operator to compute the logical complement of the concept. This operation delegates to OperatorConcept.not_ to generate a new representation of the negated concept. The result is returned as a FuzzyConcreteConcept, indicating that the negation of a crisp concept is handled within the fuzzy logic framework, potentially promoting the type to accommodate degrees of truth or standardizing the output of logical operations. This method does not modify the current instance in place.

Returns:

The logical negation of the current concept.

Return type:

FuzzyConcreteConcept

__or__(value: Self) Self

Performs a logical disjunction between the current concept and another value of the same type, enabling the use of the bitwise OR operator (|). This operation returns a new instance representing the union or combination of the two operands, with the specific calculation logic delegated to the OperatorConcept.or_ method. The method expects the input value to be compatible with the current instance type to ensure the operation is valid.

Parameters:

value (Self) – Another instance of the same type to combine with the current instance using the OR operation.

Returns:

The result of the OR operation between this instance and the provided value.

Return type:

Self

clone() Self

Creates and returns a distinct copy of the current CrispConcreteConcept instance. The new object is initialized with the same values for name, k1, k2, a, and b as the original. This operation has no side effects on the source object, ensuring that modifications to the clone do not affect the original instance.

Returns:

A new instance of the class initialized with the same attribute values as the current instance.

Return type:

Self

compute_name() str

Generates a standardized string identifier for the concept instance by interpolating its internal parameters into a specific format. The returned string follows the pattern “crisp(k1, k2, a, b)”, where the placeholders are replaced by the string representations of the corresponding attributes k1, k2, a, and b. This method performs a read-only operation and does not modify the object’s state, though the resulting string’s content is dependent on the __str__ implementation of the stored parameter values.

Returns:

A string representation of the object’s configuration in the format ‘crisp(k1, k2, a, b)’.

Return type:

str

get_membership_degree(x: float) float

Calculates the membership degree of a specific value within the context of this crisp concept. The membership is determined by checking if the input value falls within the closed interval defined by the concept’s lower and upper bounds. If the value lies between these bounds (inclusive), the method returns 1.0 to signify full membership; otherwise, it returns 0.0. This method does not modify the state of the object.

Parameters:

x (float) – The input value to evaluate for membership.

Returns:

The degree of membership of the input value, returning 1.0 if it lies within the interval [a, b] and 0.0 otherwise.

Return type:

float

_a: float
_b: float
property a: float

Returns the lower bound of the crisp satisfaction interval [a, b], i.e. the smallest value for which the membership degree is 1. The value is held internally as a float and is read without modifying the instance.

Returns:

The lower bound a of the satisfaction interval.

Return type:

float

property b: float

Returns the upper bound of the crisp satisfaction interval [a, b], i.e. the largest value for which the membership degree is 1. The value is held internally as a float and is read without modifying the instance.

Returns:

The upper bound b of the satisfaction interval.

Return type:

float

k1: float
k2: float