"""Create reasoning_engine
Generated by Phi-Octopus Eden
2025-11-07 20:31:18.570666
"""

```python
from typing import List, Dict


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

    def add_fact(self, fact: str, value: bool) -> None:
        """
        Adds a fact to the knowledge base.

        :param fact: A string representing the fact.
        :param value: A boolean indicating the truth value of the fact.
        """
        self.knowledge[fact] = value

    def query(self, fact: str) -> bool:
        """
        Queries the knowledge base for a specific fact.

        :param fact: A string representing the fact to be queried.
        :return: The truth value of the fact as stored in the knowledge base.
        """
        return self.knowledge.get(fact, False)


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

    def add_rule(self, rule_name: str, premises: List[str], conclusion: str) -> None:
        """
        Adds a rule to the reasoning engine.

        :param rule_name: A string representing the name of the rule.
        :param premises: A list of strings representing the premises (facts) of the rule.
        :param conclusion: A string representing the conclusion (fact) of the rule.
        """
        self.kb.add_fact(f"rule_{rule_name}", True)
        for premise in premises:
            self.kb.add_fact(premise, False)
        self.kb.add_fact(conclusion, False)

    def infer(self, fact: str) -> bool:
        """
        Infers the truth value of a given fact using the rules.

        :param fact: A string representing the fact to be inferred.
        :return: The inferred truth value of the fact.
        """
        rule_name = self._find_rule(fact)
        if not rule_name or not self.kb.query(f"rule_{rule_name}"):
            return False
        for premise in self._get_premises(rule_name):
            if not self.kb.query(premise):
                return False
        self.kb.add_fact(f"{fact}_inferred", True)
        return True

    def _find_rule(self, fact: str) -> str:
        """
        Helper function to find a rule that can infer the given fact.

        :param fact: A string representing the fact.
        :return: The name of the rule if found, otherwise None.
        """
        for rule in self.kb.knowledge.keys():
            if "rule_" not in rule or not self.kb.query(rule):
                continue
            premises = self._get_premises(rule)
            satisfied = all([self.kb.query(premise) for premise in premises])
            conclusion = fact if f"{fact}_inferred" not in self.kb.knowledge else None
            if satisfied and (conclusion is None or self.kb.query(conclusion)):
                return rule
        return None

    def _get_premises(self, rule_name: str) -> List[str]:
        """
        Helper function to get the premises of a given rule.

        :param rule_name: A string representing the name of the rule.
        :return: A list of strings representing the premises of the rule.
        """
        return [premise for premise in self.kb.knowledge.keys() if "rule_" + rule_name in premise and premise != f"rule_{rule_name}" and not self.kb.query(f"{premise}_inferred")]


# Example usage
if __name__ == "__main__":
    engine = ReasoningEngine()
    
    # Adding facts
    engine.add_rule("simple_rule", ["fact1"], "fact2")
    engine.kb.add_fact("fact1", True)
    
    # Inferring a new fact based on the rule and existing facts
    print(engine.infer("fact2"))  # Should return True

```

This Python code defines a simple reasoning engine capable of inferring new truths from a set of premises using defined rules. The `ReasoningEngine` class uses a knowledge base to store and query facts, while adding rules that can be used for inference. The example usage demonstrates how to use the engine to add a rule and infer a fact based on existing knowledge.