"""Create reasoning_engine
Generated by Phi-Octopus Eden
2025-11-07 23:06:24.321714
"""

```python
from typing import List, Dict

class KnowledgeBase:
    """A simple knowledge base that stores facts in a dictionary."""
    def __init__(self):
        self.facts = {}
    
    def add_fact(self, fact: str, value: bool) -> None:
        """Add or update a fact in the knowledge base."""
        self.facts[fact] = value
    
    def query(self, fact: str) -> bool:
        """Query if a fact is true in the knowledge base."""
        return self.facts.get(fact, False)

def create_reasoning_engine() -> Dict[str, KnowledgeBase]:
    """
    Create and initialize a reasoning engine with two knowledge bases.
    
    Returns:
        A dictionary mapping 'general' and 'specific' to their respective
        KnowledgeBases.
    """
    engines = {
        'general': KnowledgeBase(),
        'specific': KnowledgeBase()
    }
    return engines

def infer(engines: Dict[str, KnowledgeBase], rule: str) -> None:
    """Infer new facts based on the given rule and existing knowledge."""
    for fact in rule.split(' AND '):
        if 'IF' in fact:
            condition, outcome = fact.split(' THEN ')
            if engines['general'].query(condition.strip()):
                engines['specific'].add_fact(outcome.strip(), True)
        elif engines['general'].query(fact.strip()):
            engines['specific'].add_fact(fact.strip(), True)

# Example usage
if __name__ == "__main__":
    reasoning_engine = create_reasoning_engine()
    
    # Adding general knowledge
    reasoning_engine['general'].add_fact('IF it_rains THEN grass_is_wet', True)
    
    # Adding specific knowledge
    if reasoning_engine['general'].query('it_rains'):
        reasoning_engine['specific'].add_fact('grass_is_wet', True)
    
    # Inferring new facts based on a rule
    infer(reasoning_engine, 'IF it_rains THEN umbrella_is_needed')
    print(f"Is umbrella needed? {reasoning_engine['specific'].query('umbrella_is_needed')}")  # Should be True if 'it_rains' is true

    reasoning_engine['general'].add_fact('IF sunny THEN grass_is_green', True)
    infer(reasoning_engine, 'IF sunny THEN sunshades_are_needed')
    print(f"Are sunshades needed? {reasoning_engine['specific'].query('sunshades_are_needed')}")  # Should be True if 'sunny' is true
```

This code defines a simple reasoning engine with two knowledge bases for general and specific rules, allowing basic inference based on given conditions. The `infer` function applies logical rules to update the state of specific facts in the knowledge base.