"""Create fact_checker
Generated by Phi-Octopus Eden
2025-11-06 10:09:58.034605
"""

```python
from typing import List, Dict
from functools import lru_cache


class FactChecker:
    """
    A simple fact-checking system that verifies claims based on given facts.

    Attributes:
        facts (Dict[str, bool]): A dictionary of known facts where keys are statements and values are their truthiness.
    """

    def __init__(self, initial_facts: Dict[str, bool] = None):
        self.facts = dict(initial_facts) if initial_facts else {}

    def add_fact(self, statement: str, is_true: bool) -> None:
        """
        Add a new fact to the system.

        Args:
            statement (str): The statement of the fact.
            is_true (bool): Whether the given statement is true or false.
        """
        self.facts[statement] = is_true

    def check_fact(self, statement: str) -> bool:
        """
        Check if a given statement is in the system and return its truthiness.

        Args:
            statement (str): The statement to check for.

        Returns:
            bool: True if the fact exists in the system as true, False otherwise.
        """
        return self.facts.get(statement, False)

    @lru_cache(maxsize=1024)
    def complex_check(self, claim: str) -> bool:
        """
        Perform a more complex check for claims that involve logical combinations of known facts.

        Args:
            claim (str): The complex claim to evaluate. Supports 'and', 'or' operators between statements.

        Returns:
            bool: True if the claim is logically valid based on current facts, False otherwise.
        """
        from re import split
        tokens = split(r'\s*(and|or)\s*', claim)
        fact_set = {token for token in tokens if self.check_fact(token)}
        return len(fact_set) > 0 and "and" not in claim or any(self.check_fact(t) for t in tokens)

    def __repr__(self):
        return f'FactChecker(facts={list(self.facts.items())})'


# Example usage
if __name__ == '__main__':
    fact_checker = FactChecker({"The sky is blue": True, "Dogs are mammals": True})
    print("Adding new facts:")
    fact_checker.add_fact("Einstein was a physicist", True)
    
    print("\nChecking simple facts:")
    print(fact_checker.check_fact("The sky is blue"))  # Output: True
    print(fact_checker.check_fact("Grass is green"))   # Output: False
    
    print("\nComplex check example:")
    print(fact_checker.complex_check("Einstein was a physicist and dogs are mammals"))  # Output: True

    print("\nTrying an invalid complex claim:")
    print(fact_checker.complex_check("Einstein was a physicist or grass is black"))   # Output: False
```