"""Create logic_validator
Generated by Phi-Octopus Eden
2025-11-07 18:51:50.383356
"""

```python
from typing import Callable


class LogicValidator:
    """
    A class for validating logical expressions based on a given set of rules.
    
    Attributes:
        validate_func: A callable function that takes a logical expression and returns its validity.
        
    Methods:
        __call__: Calls the logic validator with provided expression.
        add_rule: Adds a new rule to the validation function.
        remove_rule: Removes an existing rule from the validation function.
    """
    
    def __init__(self, validate_func: Callable[[str], bool]):
        self.validate_func = validate_func
    
    def __call__(self, expression: str) -> bool:
        """
        Validates a logical expression using the provided validation function.
        
        Args:
            expression: A string representing the logical expression to be validated.
            
        Returns:
            bool: True if the expression is valid according to the rules, False otherwise.
        """
        return self.validate_func(expression)
    
    def add_rule(self, rule_function: Callable[[str], bool]):
        """Adds a new rule function to modify validation logic."""
        self.validate_func = lambda expr: rule_function(expr) and self.validate_func(expr)
    
    def remove_rule(self):
        """Removes the last added rule, restoring original validation logic if any rules were applied."""
        try:
            # Assuming there was at least one rule. If not, this will raise an exception.
            self.validate_func = lambda expr: self.validate_func(expr) and eval(rule_function_str)
        except NameError:
            print("No rules to remove.")
    
    
def simple_logic_validator(expression: str) -> bool:
    """
    A basic logic validator that checks if the expression is a valid boolean condition using Python's eval.
    
    Args:
        expression: A string representing a logical expression, e.g., "1 and 2 == 2".
        
    Returns:
        bool: True if the expression evaluates to True, False otherwise.
    """
    try:
        return eval(expression)
    except Exception as e:
        print(f"Error evaluating expression: {e}")
        return False


# Example usage
if __name__ == "__main__":
    # Initial validator
    initial_validator = LogicValidator(simple_logic_validator)
    
    # Adding a rule to ensure all expressions contain the 'and' operator
    def add_and_rule(expr):
        return "and" in expr
    
    initial_validator.add_rule(add_and_rule)
    
    print(initial_validator("1 and 2 == 2"))  # True
    print(initial_validator("1 or 2 == 2"))  # False, due to the rule added
    
    # Removing the added rule
    initial_validator.remove_rule()
    print(initial_validator("1 or 2 == 2"))  # True, back to original behavior
```

This code defines a `LogicValidator` class that can validate logical expressions based on a given function. It includes methods to add and remove rules for modifying validation logic dynamically. The example usage demonstrates how to use the validator with basic and custom rules.