"""Create reasoning_engine
Generated by Phi-Octopus Eden
2025-11-06 13:51:01.772946
"""

```python
from typing import List, Dict


class ReasoningEngine:
    """
    A simple reasoning engine that processes a list of rules and applies them to input data.
    Each rule is a function that takes an input dictionary and returns a boolean indicating if the rule matches.

    :param rules: List of functions representing rules for matching input data
    """

    def __init__(self, rules: List[callable]):
        self.rules = rules

    def match_rule(self, data: Dict[str, any]) -> bool:
        """
        Attempts to match an input dictionary against the defined rules.

        :param data: Input data as a dictionary
        :return: True if at least one rule matches, False otherwise
        """
        for rule in self.rules:
            if rule(data):
                return True
        return False

    def add_rule(self, new_rule: callable) -> None:
        """
        Adds a new rule to the reasoning engine.

        :param new_rule: A function that takes an input dictionary and returns a boolean
        """
        self.rules.append(new_rule)

    def remove_rule(self, rule_index: int) -> None:
        """
        Removes a rule from the reasoning engine by index.

        :param rule_index: Index of the rule to be removed
        """
        if 0 <= rule_index < len(self.rules):
            del self.rules[rule_index]


def is_age_adult(data: Dict[str, any]) -> bool:
    """Rule: Checks if age in data is greater than or equal to 18."""
    return data.get('age', 0) >= 18


def has_email_domain(data: Dict[str, any], domain: str) -> bool:
    """Rule: Checks if the email address ends with a specific domain."""
    return data.get('email') and data['email'].endswith(domain)


# Example usage
if __name__ == "__main__":
    rules = [is_age_adult, has_email_domain]
    engine = ReasoningEngine(rules)
    
    # Input data
    input_data = {
        'age': 21,
        'email': 'test@example.com'
    }
    
    print(engine.match_rule(input_data))  # Output: True
    
    # Adding a new rule and matching again
    engine.add_rule(lambda d: len(d['name']) > 5)
    input_data['name'] = 'JohnDoe'
    print(engine.match_rule(input_data))  # Output: True

    # Removing a rule and checking the state
    engine.remove_rule(1)
    print(engine.match_rule(input_data))  # Output: False
```