Skip to main content

reality-core

The Mobius-dynamics engine behind the Reality game and darmiyan-fs — zero dependencies, usable as a library, a terminal game, or a verifier.

A "law" is a Mobius transformation x -> (a*x + b) / (c*x + d), classified by the scale-invariant discriminant Delta = trace^2 - 4*det:

Delta sector fate
> 0 hyperbolic ("boost") settled — closes, has an arrow
= 0 parabolic ("null") drifting — the seam
< 0 elliptic ("rotation") unresolved — cycles or never repeats

A Mobius law has exactly 3 degrees of freedom, so it takes exactly 4 observed states to pin one down with certainty — not a game-design choice, an exact result (darmiyan-fs/instants.py, self-referential-seed).

Install

pip install reality-core

Play

reality play                  # a fresh puzzle
reality play --seed 42        # reproducible — share the seed, share the puzzle
reality play --save run.json  # save a transcript

You get exactly 4 looks at a hidden law, then name its sector: hyperbolic, parabolic, or elliptic.

A second law: --law linear

reality play --law linear

Same game, different hidden process: a sequence x[n+2] = p*x[n+1] + q*x[n]. Its sector comes from Delta = p^2 + 4q with the same sign rule, and it also takes exactly 4 looks: 2 unknowns, one equation per look after the first two. With 3 looks, laws from all three sectors still fit (readings 1, 1, 0 fit p=1, q=-1 elliptic, p=4, q=-4 parabolic and p=-4, q=4 hyperbolic).

It isn't unrelated to the Mobius law: the ratio x[n+1]/x[n] evolves by the Mobius law r -> (p*r + q)/r, which is why Delta and the sectors line up. Fibonacci (p = q = 1) has Delta = 5, the same as the golden-ratio map.

Verify, trust-free

reality verify run.json

Re-derives the result from the raw readings — no server, no trust required, just the same math run again. This is the honest version of "provably fair": it tells you whether the transcript is internally consistent, not that it's the one true history (a valid run from a different seed in the same conjugacy class passes identically — see darmiyan-fs/chain/verify.py for why that limit is real and exact, not a missing feature).

As a library

from reality_core import Law, random_law, v_local, v_delta

law = Law(1, 1, 1, 0)       # x -> 1 + 1/x, the golden-ratio map
law.sector()                 # 'hyperbolic'
law.step(1.0)                 # 2.0

Plugging in a law

Every law implements one contract (reality_core/interface.py, signatures only). A Recognizer can:

method does
random_law(rng, sector=None) draw a hidden law, optionally from one sector
initial_state(rng) draw a starting state
fit(readings) recover the law from exactly looks readings
verify(claimed_law, readings) re-derive every step from the raw readings
from_dict(d) load a law from a transcript
from reality_core import LAWS

rec = LAWS["linear"]
law = rec.fit(readings)       # recognition: the law, from 4 readings alone
rec.verify(law, readings)     # True — and False for any forged or missing reading

verify rejects transcripts with gaps in the step numbers or fewer than looks readings. (The pairwise v_local from 0.1.0 is still there, but it skips gaps instead of rejecting them, so don't use it to check a transcript.)

A new law is a new module with a law class and a recognizer, plus one line in LAWS — nothing else changes.

License

MIT — see LICENSE.

Metadata

Release files for reality-core 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for reality-core 0.2.0
File Size Uploaded Provenance
reality_core-0.2.0.tar.gz 14.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for reality-core 0.2.0
File Interpreter ABI Platform
reality_core-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 26.8 kB

Release files / reality_core-0.2.0.tar.gz

Download URL reality_core-0.2.0.tar.gz
Size 14.0 kB
Tags Source
SHA-256 checksum
How to use checksums
fdfec4f56b12f0390a93186512cdbc1c0c3b95019a38f7ba0c1bef580a11a5ab
BLAKE2b-256 checksum
How to use checksums
d4ccb09d10947bea661d27d3b0398cfa7a663963aeec17d64966838f436b5de8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release files / reality_core-0.2.0-py3-none-any.whl

Download URL reality_core-0.2.0-py3-none-any.whl
Size 12.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d913e78392c3a1a3be905b0d80f70ea350aad9cb293be23dd695004e884f6b19
BLAKE2b-256 checksum
How to use checksums
61dabdfca7fa3ec986f89995634af44dee8b6234b3adb2f22054e2d72d3c0e3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Security for reality-core 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page