Skip to main content

peye

EYE

peye — reasoning you can see.

A standalone, dependency-free Python rule language with forward and backward reasoning and checkable proofs.

peye turns explicit facts and rules into conclusions whose derivations can be inspected and checked. An answer can arrive together with a certificate, and that certificate can be verified against the program that produced it.

Facts and rules are Python:

from peye import *

fact(human('socrates'))
forward(mortal(X), human(X))

There is nothing to declare: a name the program uses without defining it is a variable when it starts with a capital or an underscore, like X, and a predicate otherwise, like human. Atoms are strings.

forward(Head, *Body) materializes conclusions until a fixpoint. backward(Head, *Body) defines a predicate evaluated when called. The two compose: a forward body may call backward definitions, and a backward goal may use facts that forward reasoning established.

The thread

peye is built around one idea: reasoning you can see. You write facts and rules; peye draws conclusions, forward until nothing new follows and backward on request, and every answer can come with a proof. A separate checker verifies that proof against the program, independently of the reasoner, and does more than a classic proof checker:

  • The derivation: every step is an instance of a program clause (C1), nothing is circular (C2), and every claim and every use is justified (C4).
  • The form (C3): every step has exactly one justification of an allowed kind, in the right shape, so the report shows at once whether a proof fails on form or on content.
  • Recomputation (C5): built-in calculations are redone rather than trusted.
  • Honesty about absence: "there is nothing that …" and "these are all the answers" cannot be proved; they become explicit obligations, which the checker tries to refute with the evidence at hand (C6).
  • The right question (C7): the proof answers the question asked and contains nothing beside it.

The report is itself Python data, and every generated proof is checked before it is returned. Proofs are read with Python's ast module and never executed, so checking a proof from someone else runs none of their code. Around that core, 59 examples grew, from Socrates and the zebra puzzle to a hospital research portal decided under today's EU rules and under the Commission's Digital Omnibus proposal, and package holiday cancellations under the 2015 and the revised Package Travel Directive. Each has a deck for a wide audience and can be run in the playground.

A proof guarantees that the conclusions follow from the rules, not that the rules say what the law or the policy says. So peye --unused shows which parts of a translation make no difference to the conclusions, and an expert knows where to look.

Run it

Python 3.9 or newer. No dependencies, no build step. From the root of a checkout:

python -m peye examples/socrates.py
python -m peye --proof examples/socrates.py
python -m peye --proof examples/socrates.py | python -m peye --check-proof - examples/socrates.py
python -m unittest discover -s tests

To use peye from anywhere, install it; an editable install keeps using the checkout, so your edits take effect at once:

pip install -e .
peye --proof examples/socrates.py
python examples/socrates.py --proof

Once peye is installed, a program is also a script: python program.py runs it with the same options as peye program.py. Run peye --help for the full command line.

Or in the browser: the playground edits, runs and checks any example, with peye running in the page through Pyodide. To run it from a checkout, serve it (python -m http.server) and open /playground/.

From Python

from peye import check_proof, load_text, run

socrates = load_text("""
from peye import *
fact(human('socrates'))
forward(mortal(X), human(X))
""")
result = run(socrates, goal='mortal(X)', proof=True)
print(result.answers)                                  # ["mortal('socrates')"]
print(check_proof(socrates, result.proof)['valid'])    # True

load('program.py') reads a program file the same way.

Read on

  • Make reasoning something you can see — what the language is for, how to write it, what a checked proof does and does not establish, and how the engine works.
  • Examples — 59 complete programs, each with its saved conclusions, proof and C1-C7 check report.
  • Example decks — a short card deck for every example, explaining it for a wide audience: the question, what peye concludes, why, and what the proof checker confirms.
  • Playground — write a program in the browser, run it, check its proof, and share a link to exactly what you see.

License

MIT

Metadata

Release files for peye 0.1.1

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

Source distribution (sdist)

Source distribution for peye 0.1.1
File Size Uploaded
peye-0.1.1.tar.gz 55.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for peye 0.1.1
File Interpreter ABI Platform
peye-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 101.3 kB

Release files / peye-0.1.1.tar.gz

Download URL peye-0.1.1.tar.gz
Size 55.1 kB
Tags Source
SHA-256 checksum
How to use checksums
56d4a3bb9a83424855691af4da5c7a6d0c91c40363b8d9af6018431b85be7b61
BLAKE2b-256 checksum
How to use checksums
f2e8378186721e3f299aaa9dec813980c5fa936162e8dcccb11d6491fcbd819b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 6, 2026.

Transparency log

Release files / peye-0.1.1-py3-none-any.whl

Download URL peye-0.1.1-py3-none-any.whl
Size 46.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
47eff425c8b36657dc376b91f7208bfbc527897d7517dd4f6b5c52637f6556e8
BLAKE2b-256 checksum
How to use checksums
fa8fb2244dff075cb23260cdc522ed853540c7d0443b516c232414d2ccda2520
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 6, 2026.

Transparency log
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