phi-engine 1.1.1
Golden Continuum φ-Engine — An analytic compiler that computes exact calculus of black-box callables by exploiting factorial taylor structure.
Requires Python: >=3.10

# φ-Engine — Exact Black-Box Calculus for Executable Systems

![Status: Active Research](https://img.shields.io/badge/Status-Active%20Research-42FEEC?style=rounded-square)
![Exact Calculus](https://img.shields.io/badge/Exact%20Rational-Calculus-hotpink?style=round-square)
![PGP Signed](https://img.shields.io/badge/PGP%20Signed-verify-hotpink.svg?style=rounded-square)
[![PyPI](https://img.shields.io/pypi/v/phi-engine.svg?color=hotpink)](https://pypi.org/project/phi-engine/)
![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)
![License: CC-BY-SA 4.0](https://img.shields.io/badge/License-CC--BY--SA--4.0-blue)
![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue)

φ-Engine is an analytic compiler that computes exact calculus of black-box callables by exploiting factorial taylor structure.

Differentiate and integrate any callable to hundreds of digits.
No computational graph. No symbolic form. No grid. No Δx.

```bash
pip install phi-engine
```

## Quick Demo

```python
from phi_engine import PhiEngine
from mpmath import mp

mp.dps = 200
eng = PhiEngine()

f = lambda x: mp.cos(x * x)
result = eng.differentiate(f, mp.mpf("0.25"))

print("f'(0.25):", mp.nstr(result, 12))
# Abs error: ~1e-162
```

## What It Does

| Callable ($\frac{d}{dx}$) | Order | Time   | Correct Digits     |
|---------------------------|-------|--------|--------------------|
| GELU(x)                   | 1     | 183 ms | 1994               |
| GELU(x)                   | 3     | 195 ms | 1088               |
| 100-layer tanh(x)         | 1     | 1.21 s | 1963               |
| 100-layer tanh(x)         | 2     | 1.87 s | (no oracle exists) |
| sin(10¹⁰⁰·x²)             | 1     | 14 ms  | 1083               |
| e^x·sin(10⁶·x)            | 10    | 43 ms  | 109                |

All orders. Parallel execution. Hybrid CPU/GPU routing. Deterministic φ-certificates.

φ-Engine *knows* at runtime how much precision each taylor term needs and routes to devices accordingly.  

Watch φ-Engine differentiate a 724k param TANH model and route terms to CUDA as necessary:  
[Hybrid Self-Aware Precision Routing Example](https://github.com/purrplexia/LettersToMyHeroes/blob/main/Cantor_GoldenContinuum/code/phi_engine/examples/AdversarialAITests/test_neural_net_hybrid_heavy.py)

φ-Engine evaluates your callable at factorial-spaced points using exact rational moment laws.
All Taylor terms up to a predetermined degree are annihilated *exactly* — not asymptotically.
Precision grows superfactorially with depth, and the engine *knows* how much precision is needed per term.

## Watch AI Try to break it:

[ClaudeOpus 4.5 vs φ-Engine](https://github.com/purrplexia/LettersToMyHeroes/blob/main/Cantor_GoldenContinuum/code/phi_engine/examples/AdversarialAITests/claude_opus_adversarial_test_2.py)

[GPT5.2 vs φ-Engine](https://github.com/purrplexia/LettersToMyHeroes/blob/main/Cantor_GoldenContinuum/code/phi_engine/examples/AdversarialAITests/gpt_adversarial_test.py)

[Click here for more adversarial AI tests](https://github.com/purrplexia/LettersToMyHeroes/tree/main/Cantor_GoldenContinuum/code/phi_engine/examples/AdversarialAITests)

---

## Documentation

- **[WHITEPAPER.md](https://github.com/purrplexia/LettersToMyHeroes/blob/main/Cantor_GoldenContinuum/code/phi_engine/WHITEPAPER.md)** — Full technical explanation
- **[examples/](https://github.com/purrplexia/LettersToMyHeroes/tree/main/Cantor_GoldenContinuum/code/phi_engine/examples/)** — Runnable demos (differentiation, integration, loss landscape, hybrid CUDA, much more)
- **[LetterToCantor.pdf](https://github.com/purrplexia/LettersToMyHeroes/blob/main/Cantor_GoldenContinuum/LetterToCantor.pdf)** — Complete mathematical proof of the foundations that made φ-Engine possible

---

## Capability Briefs

- [For AI Researchers](https://github.com/purrplexia/LettersToMyHeroes/blob/main/Cantor_GoldenContinuum/CapabilityBrief-AIResearchers.md)
- [For Engineers](https://github.com/purrplexia/LettersToMyHeroes/blob/main/Cantor_GoldenContinuum/CapabilityBrief-Engineers.md)
- [For Physicists](https://github.com/purrplexia/LettersToMyHeroes/blob/main/Cantor_GoldenContinuum/CapabilityBrief-Physicists.md)
- [For Mathematicians](https://github.com/purrplexia/LettersToMyHeroes/blob/main/Cantor_GoldenContinuum/CapabilityBrief-Mathematicians.md)
- [For Cryptographers](https://github.com/purrplexia/LettersToMyHeroes/blob/main/Cantor_GoldenContinuum/CapabilityBrief-Cryptographers.md)
---

## Licenses

GPLv3-or-later (code) · CC BY-SA 4.0 (documents). Open forever.

## Contact

Alex B — [mathsisbeautiful@proton.me](mailto:mathsisbeautiful@proton.me)

## 🩷 Support the Work (Optional)

If you'd like to support ongoing research:

- **GitHub Sponsors:** https://github.com/sponsors/Purrplexia  
- **ETH (MetaMask):** `0x663D8288b4Aa6F3A72FF4FE67d1a7B080cD5097d`  
- **BTC (Electrum):** `bc1q0ntv4zvpdprlxexvz20mf7ajdydmp9ke9ulgep`