Qleisli
Write quantum algorithms in the language you use to think about them.
Qleisli is an experimental quantum programming language with linear quantum ownership, explicit measurement effects and exact finite semantic contracts. The Rust frontend produces IR that an independent Rust verifier checks before reference execution. Human-written and AI-generated programs use the same checks.
Package: qleisli · executable: qleisli · Rust library: qleisli.
Version: 0.2.2. The version-specific release record distinguishes the
implemented bounded profile from pending proof and migration goals.
Rust 1.85 or later is required. There are no external Rust dependencies;
ordinary CLI/library use requires no Lean, Python or LLVM installation.
Install and run
Install the matching executable from crates.io:
Alternatively, install 0.2.2 from a repository checkout with
cargo install --path . --locked --bin qleisli.
Put Cargo's installation bin directory on PATH (normally $HOME/.cargo/bin).
Create a directory named bell and save this program as bell/main.qli:
use std::quantum::init0;
use std::quantum::h;
use std::quantum::cnot;
use std::observe::measure_z;
observe fn main() -> (CBit, CBit) {
let (a, b) = cnot(h(init0()), init0());
(measure_z(a), measure_z(b))
}
From its parent directory:
The standard library is embedded: this example runs without a repository
checkout or a separate library directory. run reports 00 and 11 with
probabilities approximately 0.5 each; sample returns eight simulated shots,
each 00 or 11. These are local reference results, not device measurements.
Result bit strings follow the returned tuple from left to right. Numerical
probabilities can contain tiny rounding residues even for ideally impossible
outcomes. Add --format=json for structured results and diagnostics.
Embed in Rust
Add this dependency to your Rust project's Cargo.toml:
[]
= "0.2.2"
The API documentation provides a runnable
OpenQASM import and simulation example. Use frontend::compile::compile_project
for .qli projects, verify for raw IR, interchange for checked QIRF transport,
and sim for reference distributions or seeded sampling. Only independently
checked programs become VerifiedProgram values.
Supported scope
- Finite
.qliprograms, modules, linear ownership, measurement/feedback, static operation parameters and exact finite contracts are implemented. qleisli interopsupports bounded OpenQASM 3 input/output, QIRF input/output and QIR Base output. The terminal-circuit profile has explicit gate/resource limits; unsupported constructs reject with diagnostics. QASM input must initialize its qubits withreset.- The separate Python host requires Python 3.11+ and the Rust executable. QIR text/bitcode input additionally requires optional PyQIR 0.12.5. Cargo installs neither the Python host nor the Lean checker.
- The additive experimental
qleisli sizedCLI checks and executes boundedBits<n>/CBits<m>source and shared measured QPE. It requires a separately built Lean kernel; Cargo does not install that kernel. General source/runtime correspondence and full-profile migration remain pending. - The staged Lean kernel migration does not transfer production acceptance authority from Rust. General Soundness, Physical Realizability and Resource Safety theorems remain goals to prove. Successful checking is not a proof of an algorithm's correctness, physical hardware behavior or a quantitative resource bound.
The published 0.2.1 first registry release adopted the name qleisli in place of
the earlier Git/path package qleisli-core and Rust import qleisli_core.
Those consumers must update dependency/import names or use the documented
Cargo alias.
This user-selected identity migration is a narrow exception; other 0.2.x
contracts stay compatible. The planned 0.3.0 type-system work is a separate
breaking-change boundary.
Documentation
- Language quick reference
- Python and foreign-format connections
- Python setup
- Trust boundary and proof goals
- Release and validation record
- Source, examples and roadmap
Documentation links are pinned to the v0.2.2 source tag. The packaged files
retain the same version-specific specifications and validation account.
License
Copyright 2026 Masahiko G. Yamada. Qleisli's own code and documentation are
Apache-2.0 unless individually stated otherwise. See the packaged LICENSE
and NOTICE. The included corpus retains source-specific licenses and notices:
QuantumKatas translations are MIT; Qualtran and PennyLane translations are
Apache-2.0. This is not an Apache-2.0 OR MIT dual-license offer.