Skip to main content

Pomagma

Tests PyPI Version

Pomagma is an inference engine for extensional untyped λ-join-calculus, a simple model of computation in which nondeterminism gives rise to an elegant gradual type system.

Pomagma can:

  • simplify code fragments expressed in λ-join-calculus
  • validate codebases of programs and assertions
  • solve systems of inequalities and horn clauses
  • synthesize code from sketches and inequality constraints

Pomagma's base theory has been partially verified in Coq (hstar) and Z3 (hstar-z3).

Pomagma's architecture follows a client-server model, where a Python client library performs high-level syntactic tasks, and a shared C++ database server performs low-level inference work.

Installing

The server targets Ubuntu 24.04, and installs in a uv virtual environment

git clone https://github.com/fritzo/pomagma
cd pomagma
. install.sh
make small-test     # takes ~5 CPU minutes
make test           # takes ~1 CPU hour

The client library supports Python 3.12.

pip install pomagma

Quick Start

Start a local analysis server with the tiny pre-built E-graph

pomagma analyze             # starts server, Ctrl-C to quit

Then in another terminal, start an interactive python client session

$ pomagma connect           # starts a client session, Ctrl-D to quit
>>> simplify(['APP I I'])
[I]
>>> validate(['I'])
[{'is_bot': False, 'is_top': False}]
>>> solve('x', 'EQUAL x APP x x', max_solutions=4)
['I', 'BOT', 'TOP', 'V']
>>> validate_facts(['EQUAL x TOP', 'LESS x BOT'])
False

Alternatively, connect using the Python client library

python
from pomagma import analyst
with analyst.connect() as db:
    print(db.simplify(["APP I I"]))
    print(db.validate(["I"]))
    print(db.solve('x', 'EQUAL x APP x x', max_solutions=4))
    print(db.validate_facts(['EQUAL x TOP', 'LESS x BOT']))

Get an E-graph

Pomagma reasons about large programs by approximately locating code fragments in an E-graph of 103-105 basic programs. The more basic programs in an E-graph, the more accurate pomagma's analysis will be. Pomagma ships with a tiny pre-built E-graph of ~2000 basic programs.

To get a large pre-built E-graph, put your AWS credentials in the environment and

export AWS_ACCESS_KEY_ID=...        # put your id here
export AWS_SECRET_ACCESS_KEY=...    # put your hey here
pomagma pull                        # downloads latest E-graph from S3

To start building a custom E-graph from scratch

pomagma make max_size=10000         # kill and restart at any time

Pomagma is parallelized and needs lots of memory to build a large E-graph.

E-graph Size Compute Time Memory Space Storage Space
1 000 E-classes ~1 CPU hour ~10MB ~1MB
10 000 E-classes ~1 CPU week ~1GB ~100MB
100 000 E-classes ~1 CPU year ~100GB ~10GB

License

Copyright (c) 2005-2025 Fritz Obermeyer.
Pomagma is licensed under the Apache 2.0 License.

Pomagma ships with the Google Farmhash library, licensed under the MIT license.

Metadata

Release files for pomagma 0.3.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 pomagma 0.3.1
File Size Uploaded Provenance
pomagma-0.3.1.tar.gz 211.8 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 473.1 kB

Release files / pomagma-0.3.1.tar.gz

Download URL pomagma-0.3.1.tar.gz
Size 211.8 kB
Tags Source
SHA-256 checksum
How to use checksums
cdb86ff35b42052e28bec0925423528424b762ef806be8495cb8f11f335c3ff4
BLAKE2b-256 checksum
How to use checksums
104da28518c2ffdf044112e9a970d9d8f6d236d2e1fee190450a4efb9c0e4fd3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.10

Release files / pomagma-0.3.1-py3-none-any.whl

Download URL pomagma-0.3.1-py3-none-any.whl
Size 261.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
44376c0907c711f2b1837684cf412ff3b5b100b3346d204746698b3b05716618
BLAKE2b-256 checksum
How to use checksums
1741eec96bed5983803b30073987b6af6203fe20a46204e4362ca2e4f0b1a2a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.10

Security for pomagma 0.3.1

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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