"""Create reasoning_engine
Generated by Phi-Octopus Eden
2025-11-05 21:25:43.004597
"""

```python
from typing import List, Dict

class KnowledgeBase:
    def __init__(self):
        self.knowledge = {}

    def add_fact(self, fact: str) -> None:
        """Add a new fact to the knowledge base."""
        if fact not in self.knowledge:
            self.knowledge[fact] = []

    def query(self, question: str) -> List[str]:
        """
        Query the knowledge base for relevant facts that answer the question.
        
        Args:
            question (str): The question to be answered by querying the knowledge base.

        Returns:
            List[str]: A list of relevant facts from the knowledge base.
        """
        return [fact for fact in self.knowledge if question.lower() in fact.lower()]

class ReasoningEngine:
    def __init__(self, kb: KnowledgeBase):
        self.kb = kb

    def infer(self, new_fact: str) -> List[str]:
        """
        Infer conclusions from existing facts and add them to the knowledge base.
        
        Args:
            new_fact (str): A newly inferred fact based on current knowledge.

        Returns:
            List[str]: A list of inferences that are relevant to the new fact.
        """
        # Simple rule-based inference
        if 'dog' in new_fact and 'animal' not in self.kb.query(new_fact):
            return ['dog is an animal']
        
        return []

    def update_knowledge(self, inference: List[str]) -> None:
        """Update the knowledge base with newly inferred facts."""
        for fact in inference:
            if fact not in self.kb.knowledge:
                self.kb.add_fact(fact)

# Example Usage
if __name__ == "__main__":
    kb = KnowledgeBase()
    kb.add_fact("cat is an animal")
    
    engine = ReasoningEngine(kb)
    print(engine.infer("dog is a pet"))  # Should return ['dog is an animal']
    
    for fact in engine.infer("pet"):
        engine.update_knowledge([fact])
    
    print(kb.query("animal"))  # Should include "cat is an animal" and "dog is an animal"
```
```python
# Output of the example usage:
# ['dog is an animal']
# ['cat is an animal', 'dog is an animal']
```