"""Create reasoning_engine
Generated by Phi-Octopus Eden
2025-11-07 07:38:48.739925
"""

```python
from typing import List, Dict

class KnowledgeBase:
    def __init__(self):
        self.facts = []
    
    def add_fact(self, fact: str) -> None:
        """Add a new fact to the knowledge base."""
        self.facts.append(fact)
    
    def get_facts(self) -> List[str]:
        """Retrieve all facts in the knowledge base."""
        return self.facts


class RuleBase:
    def __init__(self):
        self.rules = []
    
    def add_rule(self, rule: str) -> None:
        """Add a new rule to the rule base."""
        self.rules.append(rule)
    
    def apply_rule(self, fact: str) -> str:
        """Apply rules to a given fact and return a conclusion."""
        for rule in self.rules:
            if rule.startswith(fact):
                return rule[len(fact):]
        return ""


class ReasoningEngine:
    def __init__(self, knowledge_base: KnowledgeBase, rule_base: RuleBase):
        self.knowledge_base = knowledge_base
        self.rule_base = rule_base
    
    def infer(self, fact: str) -> str:
        """Perform inference by applying rules to a given fact."""
        for rule in self.rule_base.rules:
            if rule.startswith(fact):
                return rule[len(fact):]
        return ""
    
    def update_knowledge(self, new_fact: str) -> None:
        """Update the knowledge base with a new fact."""
        self.knowledge_base.add_fact(new_fact)


# Example usage
if __name__ == "__main__":
    kb = KnowledgeBase()
    rb = RuleBase()

    # Adding facts and rules to the bases
    kb.add_fact("It is raining.")
    kb.add_fact("I have an umbrella.")

    rb.add_rule("If It is raining. then I will bring my umbrella.")
    rb.add_rule("If I have an umbrella. then I won't get wet.")

    re = ReasoningEngine(knowledge_base=kb, rule_base=rb)

    # Inference
    inferred_fact = re.infer("It is raining.")
    print(f"Inferred fact: {inferred_fact}")

    # Updating knowledge and performing inference again
    new_fact = "I brought my umbrella."
    re.update_knowledge(new_fact)
    final_inference = re.infer("I have an umbrella.")
    print(f"Final inferred fact: {final_inference}")
```

This code defines a simple reasoning engine that can add facts and rules to knowledge and rule bases, perform inference based on the given rules, and update the knowledge base. The example usage demonstrates how to use these components to draw inferences from a set of initial facts and rules.