The P programming language.

asynchronousprogramming-languagesystematic-testingevent-drivenpdistributed-systemsstate-machinemodel-checkingformal-methodsformal-verification
Star 增长趋势
Star
3.7k
Forks
224
周增长
+6
Issues
16
1k2k3k
2023年1月2024年3月2025年6月2026年9月
README

Formal Modeling and Analysis of Distributed Systems

NuGet Docker image GitHub license GitHub Action (CI on Windows) GitHub Action (CI on Ubuntu) GitHub Action (CI on MacOS) Tutorials


P is a state machine based programming language for formally modeling and specifying complex distributed systems. P allows programmers to model their system design as a collection of communicating state machines and provides automated reasoning backends to check that the system satisfies the desired correctness specifications.

Impact

P enables developers to model system designs as communicating state machines—a natural fit for microservices and service-oriented architectures. Teams across AWS building flagship products—from storage (S3, EBS), to databases (DynamoDB, MemoryDB, Aurora), to compute (EC2, IoT)—use P to reason about the correctness of their designs. P has helped these teams eliminate several critical bugs early in the development process.

📄 Systems Correctness Practices at Amazon Web ServicesMarc Brooker and Ankush Desai, Communications of the ACM, 2025.

Why Teams Choose P

Benefit Description
Thinking Tool Writing specifications forces rigorous design thinking—many bugs are caught before any code runs.
Bug Finder Model checking uncovers corner-case bugs that stress testing and integration testing miss.
Faster Iteration After initial modeling, changes can be validated quickly before implementation.

What's New

PeasyAI — AI-Powered Code Generation

Generate P state machines, specifications, and test drivers directly from design documents.

  • Integrates with Cursor and Claude Code via MCP
  • 27 specialized tools for P development
  • Ensemble generation with auto-fix pipeline
  • 1,200+ RAG examples for context-aware generation

👉 Get started with PeasyAI

PObserve — Runtime Monitoring

Validate that production systems conform to their formal P specifications.

  • Check service logs against P monitors
  • Bridge design-time verification with runtime behavior
  • Works in both testing and production environments

👉 Learn about PObserve

Multi-Error Compilation (P 3.0+)

p compile reports ALL type errors in one pass by default, sorted by source location. Cascade-suppression keeps root causes surfacing without downstream noise:

$ p compile
[Error:] [bad.p:6:4] got type: bool, expected: int

[Error:] [bad.p:8:13] could not find name 'undeclaredVar'

[Error:] [bad.p:9:16] operator '+' requires both operands to be int or both float; got int and string

Use --strict-errors (or -se) to restore the legacy abort-on-first behavior:

$ p compile --strict-errors
[Error:] [bad.p:6:4] got type: bool, expected: int

The new default is particularly useful with AI fix loops (PeasyAI, Cursor) and large refactors — fix N errors per LLM round-trip instead of N round-trips per N errors.

The P Framework

Component Description
P Language Model distributed systems as communicating state machines. Specify safety and liveness properties.
P Checker Systematically explore message interleavings and failures to find deep bugs. Additional backends: PEx, PVerifier.
PeasyAI AI-powered code generation with auto-fix and human-in-the-loop support.
PObserve Validate service logs against P specifications.

Let the fun begin!

You can find most of the information about the P framework on: https://p-org.github.io/P/

🐳 Want to skip the setup? Use the official Docker image, which bundles the P CLI, .NET SDK, JDK, Maven, and graphviz (available for amd64 and arm64):

docker run --rm -it -v "$PWD":/workspace ghcr.io/p-org/p:latest

See the installation guide for details.

What is P? | Getting Started | PeasyAI | Tutorials | Case Studies | Publications

If you have any questions, please feel free to create an issue, ask on discussions, or email us.

P has always been a collaborative project between industry and academia (since 2013). The P team welcomes contributions and suggestions from all of you! See CONTRIBUTING for more information.

相关仓库
tokio-rs/tokio

A runtime for writing reliable asynchronous applications with Rust. Provides I/O, networking, scheduling, timers, ...

Rustcrates.iolibraryMIT Licenserustasynchronous
tokio.rs
33.1k3.2k
libuv/libuv

Cross-platform asynchronous I/O

ClibraryMIT Licenseasynchronousio
libuv.org
27.2k3.9k
tornadoweb/tornado

Tornado is a Python web framework and asynchronous networking library, originally developed at FriendFeed.

PythonPyPIlibraryApache License 2.0pythonasynchronous
tornadoweb.org
22.2k5.6k
ktorio/ktor

Framework for quickly creating connected applications in Kotlin with minimal effort

KotlinlibraryApache License 2.0kotlinweb-framework
ktor.io
14.5k1.3k
nmap/nmap

Nmap - the Network Mapper. Github mirror of official SVN repository.

COtherc-plus-pluslua
svn.nmap.org
13.5k2.9k
walkor/workerman

An asynchronous event driven PHP socket framework. Supports HTTP, Websocket, SSL and other custom protocols.

PHPPackagistlibraryMIT Licensewebsockettimer
workerman.net
11.5k2.2k
panjf2000/gnet

🚀 gnet is a high-performance, lightweight, non-blocking, event-driven networking framework written in pure Go.

GoGo ModuleslibraryApache License 2.0event-drivenevent-loop
gnet.host
11.2k1.1k
alibaba/transmittable-thread-local

📌 a missing Java std lib(simple & 0-dependency) for framework/middleware, provide an enhanced InheritableThreadLocal that transmits values between threads even using thread pooling components.

JavaMavenlibraryApache License 2.0javathreadlocal
github.com/alibaba/transmittable-thread-local
8.3k1.7k
final-form/react-final-form

🏁 High performance subscription-based form state management for React

JavaScriptnpmMIT Licensereactform
final-form.org/react
7.4k497
mher/flower

Real-time monitor and web admin for Celery distributed task queue

PythonPyPIOthercelerytask-queue
flower.readthedocs.io
7.2k1.2k
tokio-rs/mio

Metal I/O library for Rust.

Rustcrates.iolibraryMIT Licenserustnon-blocking
7.1k868
marlonrichert/zsh-autocomplete

🤖 Real-time type-ahead completion for Zsh. Asynchronous find-as-you-type autocompletion.

ShellMIT Licensezshcompletion
6.7k202