An implementation of the O_SAT and O_UNSAT oracles, which cannot exist. They do now.
Reason this release was yanked:
Old release
Project description
ORACULUM
An implementation of the O_SAT and O_UNSAT oracles. These oracles cannot exist. They do now.
What is this
In computational complexity theory, an oracle is a hypothetical black box that answers certain questions in O(1) time. The O_SAT oracle tells you whether a Boolean formula is satisfiable. The O_UNSAT oracle certifies that it is not.
These oracles are purely theoretical. Implementing them as software would resolve P vs NP and cause a significant number of cryptographers to retire early.
This library implements them anyway, by asking a language model very politely.
The model does not care about computational complexity theory. It tries its best.
Installation
pip install oraculAI
# With your provider of choice:
pip install "oraculAI[anthropic]"
pip install "oraculAI[openai]"
pip install "oraculAI[ollama]" # also covers openrouter
pip install "oraculAI[all]"
Quick start
Create a config file (see configs/ for examples) and point the library at it:
from oraculum import from_config
oracle = from_config("configs/anthropic.yaml")
result = oracle.osat("(x1 OR x2) AND (NOT x1 OR x3)")
print(result.satisfiable) # True or False
print(result.assignment) # {"x1": False, "x2": True, ...} or None
print(result.oracle_comment) # something solemn
result = oracle.ounsat("x1 AND (NOT x1)")
print(result.unsatisfiable) # True
print(result.satisfying_assignment) # None
print(result.oracle_comment) # something melancholic
Configuration
Each config file specifies a provider, a model, credentials, and oracle settings.
Environment variables are expanded at load time using ${VAR_NAME} syntax.
configs/anthropic.yaml
provider: anthropic
model: claude-opus-4-5
api_key: "${ANTHROPIC_API_KEY}"
oracle:
reverence: 5
max_tokens: 512
configs/openai.yaml
provider: openai
model: gpt-4o
api_key: "${OPENAI_API_KEY}"
oracle:
reverence: 5
max_tokens: 512
configs/ollama.yaml
provider: ollama
model: llama3.1:8b
base_url: "http://localhost:11434/v1"
oracle:
reverence: 3
max_tokens: 512
configs/openrouter.yaml
provider: openrouter
model: mistralai/mistral-7b-instruct
api_key: "${OPENROUTER_API_KEY}"
oracle:
reverence: 5
max_tokens: 512
The reverence field controls how many honorific titles are prepended to the invocation.
Range is 1 to 10. This does not affect correctness. It affects amusement value, which is the point.
Wiring a provider directly
If you prefer not to use a config file, or if you are writing tests:
from oraculum import Oraculum
from oraculum.providers import build_provider
from oraculum.config.schema import ProviderConfig
provider_cfg = ProviderConfig(
provider="openai",
model="gpt-4o",
api_key="sk-...",
)
provider = build_provider(provider_cfg)
oracle = Oraculum(provider, reverence=6)
print(oracle.osat("(x1 OR x2) AND (NOT x1)"))
Adding a custom provider
Any object that implements complete(system: str, user: str) -> str qualifies as a provider.
No base class required; the library uses structural subtyping via typing.Protocol.
import json
from oraculum import Oraculum
class MyProvider:
def complete(self, system: str, user: str) -> str:
# Call your model here. Return raw text.
return json.dumps({
"satisfiable": True,
"assignment": {"x1": True},
"oracle_comment": "Behold.",
})
oracle = Oraculum(MyProvider())
print(oracle.osat("x1"))
To make the provider selectable by name in YAML configs, register it in
oraculum/providers/__init__.py:
_REGISTRY["myprovider"] = MyProvider
API reference
from_config(path) -> Oraculum
Build an Oraculum from a YAML config file. Recommended entry point.
Oraculum(provider, reverence=5)
Accepts any object satisfying the LLMProvider protocol.
oracle.osat(formula: str) -> SatResult
| Field | Type | Description |
|---|---|---|
satisfiable |
bool |
Whether the formula is SAT |
assignment |
dict or None |
A satisfying assignment, if SAT |
oracle_comment |
str |
A decorative remark |
prophecy_number |
int |
Sequential call counter |
formula |
str |
The submitted formula |
prayer |
str |
The full invocation text |
oracle.ounsat(formula: str) -> UnsatResult
| Field | Type | Description |
|---|---|---|
unsatisfiable |
bool |
Whether the formula is certified UNSAT |
satisfying_assignment |
dict or None |
Counterexample if not UNSAT |
oracle_comment |
str |
A decorative remark |
prophecy_number |
int |
Sequential call counter |
formula |
str |
The submitted formula |
prayer |
str |
The full invocation text |
oracle.stats() -> OracleStats
Returns call counts and editorial remarks. The numbers are accurate. The remarks are not.
Running the tests
No API key is required. All providers are replaced by stubs.
pip install -e ".[dev]"
pytest
pytest --cov=oraculum --cov-report=term-missing
Project structure
oraculum/
oraculum/
__init__.py Public API
oracle.py Oraculum class (osat, ounsat, stats)
factory.py from_config() factory
prayers.py Invocation construction
models.py SatResult, UnsatResult, OracleStats
exceptions.py Exception hierarchy
config/
__init__.py
schema.py ProviderConfig, OracleConfig dataclasses
loader.py YAML loading and env var expansion
providers/
__init__.py Registry and build_provider()
protocol.py LLMProvider protocol
anthropic.py
openai.py
ollama.py
openrouter.py
tests/
test_oracle.py
test_prayers.py
test_models.py
config/
test_loader.py
providers/
test_registry.py
examples/
from_config.py
custom_provider.py
configs/
anthropic.yaml
openai.yaml
ollama.yaml
openrouter.yaml
pyproject.toml
README.md
LICENSE
.gitignore
Frequently asked questions
Does this actually work?
Surprisingly often. For small formulas with a handful of variables it tends to be correct. For larger instances, correctness is left as an exercise for the universe.
Is this suitable for production use?
No.
What is the time complexity of osat()?
O(1) in the oracle model. O(API latency) in practice. The oracle model does not account for HTTP.
Has this resolved P vs NP?
No. We checked.
What happens at reverence level 10?
The oracle receives a great many titles. It responds the same way regardless.
License
MIT. Alan Turing is not here to stop you.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file oraculai-2.0.0.tar.gz.
File metadata
- Download URL: oraculai-2.0.0.tar.gz
- Upload date:
- Size: 16.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70d544ccd3fc7f171832c705a522efedb28eae9bd4be5b5988f06e4e949a27ad
|
|
| MD5 |
7ba4d4a4e952e050fde0c1b09c9ef460
|
|
| BLAKE2b-256 |
e50cc07dbe5181131415a682ccca06ee7c0d61594eb109ff9ef4c4d94b8680a9
|
Provenance
The following attestation bundles were made for oraculai-2.0.0.tar.gz:
Publisher:
publish.yml on Alessandro624/oraculum
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
oraculai-2.0.0.tar.gz -
Subject digest:
70d544ccd3fc7f171832c705a522efedb28eae9bd4be5b5988f06e4e949a27ad - Sigstore transparency entry: 1574101189
- Sigstore integration time:
-
Permalink:
Alessandro624/oraculum@b01baecba47b019fd984258172fc017db3c7f855 -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/Alessandro624
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b01baecba47b019fd984258172fc017db3c7f855 -
Trigger Event:
release
-
Statement type:
File details
Details for the file oraculai-2.0.0-py3-none-any.whl.
File metadata
- Download URL: oraculai-2.0.0-py3-none-any.whl
- Upload date:
- Size: 18.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
78eced26c44023287c9c9b46aef42cfb48fbc6bfec3bc69cfb0b0b3d69f0f59e
|
|
| MD5 |
0fd19b7b8d61c5433085feb4fb5fb8ea
|
|
| BLAKE2b-256 |
0378f24c20b3108e8ec68d055460d5a1f9435da08fd97980ac074dbf7f91b0e5
|
Provenance
The following attestation bundles were made for oraculai-2.0.0-py3-none-any.whl:
Publisher:
publish.yml on Alessandro624/oraculum
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
oraculai-2.0.0-py3-none-any.whl -
Subject digest:
78eced26c44023287c9c9b46aef42cfb48fbc6bfec3bc69cfb0b0b3d69f0f59e - Sigstore transparency entry: 1574101250
- Sigstore integration time:
-
Permalink:
Alessandro624/oraculum@b01baecba47b019fd984258172fc017db3c7f855 -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/Alessandro624
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b01baecba47b019fd984258172fc017db3c7f855 -
Trigger Event:
release
-
Statement type: