"""Create reasoning_engine
Generated by Phi-Octopus Eden
2025-11-06 22:28:38.642067
"""

```python
class ReasoningEngine:
    """
    A basic reasoning engine that can handle simple logical operations.
    """

    def __init__(self):
        self.knowledge_base = []

    def add_fact(self, fact: str) -> None:
        """Add a new fact to the knowledge base.

        Args:
            fact (str): The fact to be added as a string.
        """
        self.knowledge_base.append(fact)

    def infer_new_fact(self, rule: str) -> str:
        """
        Infer a new fact from existing facts using a logical rule.

        Args:
            rule (str): A logical rule in the format of 'if ... then ...'.

        Returns:
            str: The inferred fact or an error message if no valid inference can be made.
        
        Example usage:
            >>> engine = ReasoningEngine()
            >>> engine.add_fact("all mammals are warm-blooded")
            >>> engine.add_fact("a dog is a mammal")
            >>> engine.infer_new_fact("if all mammals are warm-blooded and a dog is a mammal, then a dog is warm-blooded")
            'a dog is warm-blooded'
        """
        if "if" not in rule or "then" not in rule:
            return "Invalid logical structure"
        
        parts = rule.split('then')
        if len(parts) != 2 or any(part.strip() == '' for part in parts):
            return "Invalid logical structure"

        antecedent, consequent = parts
        antecedent = antecedent.replace("if", "").strip()
        facts = [fact for fact in self.knowledge_base if antecedent in fact]

        if all(fact in self.knowledge_base for fact in facts):
            return consequent.strip()

        return "No valid inference can be made"

# Example usage
engine = ReasoningEngine()
engine.add_fact("all mammals are warm-blooded")
engine.add_fact("a dog is a mammal")
print(engine.infer_new_fact("if all mammals are warm-blooded and a dog is a mammal, then a dog is warm-blooded"))
```