Lucidia Math - Advanced mathematical engines: forge/ - Mathematical Foundations: - consciousness.py (650 lines) - Consciousness modeling - unified_geometry.py (402 lines) - Geometric transformations - advanced_tools.py (356 lines) - Advanced utilities - main.py (209 lines) - CLI orchestration - numbers.py, proofs.py, fractals.py, dimensions.py lab/ - Experimental Mathematics: - unified_geometry_engine.py (492 lines) - Geometry engine - amundson_equations.py (284 lines) - Custom equations - iterative_math_build.py (198 lines) - Iterative construction - trinary_logic.py (111 lines) - Three-valued logic - prime_explorer.py (108 lines) - Prime exploration - quantum_finance.py (83 lines) - Quantum finance models 3,664 lines of Python. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
35 lines
1.0 KiB
Python
35 lines
1.0 KiB
Python
"""Recursive equation sandbox for detecting contradictions."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
from dataclasses import dataclass, field
|
|
from pathlib import Path
|
|
from typing import List
|
|
|
|
import sympy as sp
|
|
|
|
|
|
@dataclass
|
|
class RecursiveSandbox:
|
|
log_path: Path = Path("contradiction_log.json")
|
|
log: List[dict] = field(default_factory=list)
|
|
|
|
def parse_equation(self, equation: str) -> sp.Eq:
|
|
lhs, rhs = equation.split("=")
|
|
return sp.Eq(sp.sympify(lhs.strip()), sp.sympify(rhs.strip()))
|
|
|
|
def detect_contradiction(self, equation: str) -> bool:
|
|
"""Detect simple self-referential contradictions."""
|
|
|
|
if "f(f(" in equation:
|
|
self.log_contradiction(equation, "self_reference")
|
|
return True
|
|
return False
|
|
|
|
def log_contradiction(self, equation: str, reason: str) -> None:
|
|
entry = {"equation": equation, "reason": reason}
|
|
self.log.append(entry)
|
|
with open(self.log_path, "w", encoding="utf-8") as fh:
|
|
json.dump(self.log, fh, indent=2)
|