"""Create reasoning_engine
Generated by Phi-Octopus Eden
2025-11-07 08:05:19.361122
"""

```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."""
        self.knowledge.append(fact)

    def query(self, question: str) -> bool:
        """Check if the given question is supported by the current knowledge base."""
        return any(question in fact for fact in self.knowledge)


def reasoning_engine(kb: KnowledgeBase, rules: List[Dict[str, str]]) -> bool:
    """
    A simple reasoning engine that applies a set of predefined logical rules to determine
    if a given statement can be inferred from the knowledge base.

    :param kb: An instance of KnowledgeBase containing the current facts.
    :param rules: A list of dictionaries where each dictionary contains two keys, 'if' and 'then',
                  representing the premise and conclusion respectively for each rule.
    :return: True if any of the rules can be applied to infer a new fact from the knowledge base,
             False otherwise.

    Example usage:
    kb = KnowledgeBase()
    kb.add_fact("It is raining.")
    kb.add_fact("People carry umbrellas when it rains.")

    rules = [
        {"if": "It is raining.", "then": "People carry umbrellas."}
    ]

    result = reasoning_engine(kb, rules)
    print(result)  # Should print True
    """
    for rule in rules:
        if kb.query(rule['if']):
            kb.add_fact(rule['then'])
            return True
    return False


# Example usage
kb = KnowledgeBase()
kb.add_fact("It is raining.")
kb.add_fact("People carry umbrellas when it rains.")

rules = [
    {"if": "It is raining.", "then": "People carry umbrellas."}
]

result = reasoning_engine(kb, rules)
print(result)  # Should print True
```