Freedom251 › Formal Verification Tools
Stainless

What Stainless is
Stainless is a free, open-source framework for verifying Scala software against specifications. It uses deductive verification to check function preconditions and postconditions, array bounds, pattern-match coverage, and whether implementations conform to stated requirements. Stainless can verify termination on all inputs and provide counterexamples when code fails verification. It works with a Pure Scala fragment and translates certain imperative features into Pure Scala concepts. The current frontend supports Scala 3.5.0 and later; Scala 2 is no longer supported. Stainless uses the Inox backend and can work with SMT solvers including Z3 and cvc5, with Princess as a Scala-based fallback. Installation options include standalone releases, Snap, the Arch User Repository, source builds, and an sbt plugin; documentation also covers Docker, Metals, and GitHub Codespaces. The standalone release requires JDK 17 and bundles solver components. Stainless is available on Linux, macOS, and Windows under Apache 2.0. Verification assumes unbounded data types and sufficient stack space, so runtime overflows remain possible.
Who it suits
Stainless suits Scala developers who want deductive checks inside an sbt project or browser-based Codespaces workflow. It is intended for verified Scala software and supports Scala 3.5.0 or later.
What it does well
- Free and open source
- Checks contracts, bounds, and pattern matches
- Can prove termination and provide counterexamples
- Supports multiple SMT solvers
- Runs on Linux, macOS, and Windows
What to know first
- Scala 2 frontend is unsupported
- Requires JDK 17 for standalone release
- No default shared-heap concurrency encoding
- Verified code may still overflow at runtime
Verdict
Stainless provides contract-based verification and counterexamples for modern Scala projects, with several installation and solver choices. Its language and verification assumptions should be understood before relying on guarantees in production.
Facts from Stainless's own pages
- Browser workflow
- The documentation describes running Stainless in GitHub Codespaces, including through a browser. · epfl-lara.github.io, 8 Oct 2026
- Contracts
- It checks user-provided function preconditions and postconditions. · epfl-lara.github.io, 8 Oct 2026
- Correctness checks
- It can statically verify that a program conforms to a specification and cannot crash at runtime. · epfl-lara.github.io, 7 Oct 2026
- Counterexamples
- When a function does not satisfy its contract, Stainless can return a concrete counterexample. · epfl-lara.github.io, 8 Oct 2026
- Editor integration
- The project page links installation instructions for standalone use, Docker, sbt, and Metals. · ecocloud.epfl.ch, 7 Oct 2026
- Installation
- Stainless can be installed from a standalone release, through Snap or the Arch User Repository, built from source, or used as an sbt plugin. · epfl-lara.github.io, 8 Oct 2026
- Installation options
- The installation documentation lists standalone releases, Snap, source builds, and an sbt plugin. · epfl-lara.github.io, 7 Oct 2026
- Intended users
- The documentation describes using Stainless within an existing sbt project to check Scala code in enabled modules. · epfl-lara.github.io, 8 Oct 2026
- Language limits
- The language does not provide a default encoding for concurrency with a shared mutable heap. · epfl-lara.github.io, 7 Oct 2026
- License
- The repository states that Stainless is released under the Apache 2.0 license. · github.com, 8 Oct 2026
- Limitations
- The documentation warns that verification assumes unbounded data types and sufficient stack space, so verified code may still encounter stack or heap overflow at runtime. · epfl-lara.github.io, 8 Oct 2026
- Purpose
- Stainless is a verification framework and tool for a subset of the Scala programming language. · github.com, 8 Oct 2026
- Runtime requirement
- The installation documentation lists Java 17 JRE as a general requirement. · epfl-lara.github.io, 8 Oct 2026
- Safety checks
- It checks array bounds and whether pattern matches cover all possible cases. · epfl-lara.github.io, 8 Oct 2026
- Scala subset
- Stainless verifies a Pure Scala fragment and also supports certain imperative features by translating them into Pure Scala concepts. · epfl-lara.github.io, 7 Oct 2026
- Scala support
- The current repository README says Stainless supports Scala 3.5.0 and later, and no longer supports the Scala 2 frontend. · github.com, 8 Oct 2026
- Solvers
- Stainless uses the Inox backend and can use SMT solvers including Z3 and cvc5; Princess is included as a Scala-based fallback solver. · epfl-lara.github.io, 8 Oct 2026
- Solver support
- Stainless relies on Inox and supports SMT solvers including Z3, cvc5, and Princess. · github.com, 7 Oct 2026
- Supported Scala version
- The repository says the current frontend supports Scala 3.5.0 and later and no longer supports Scala 2. · github.com, 7 Oct 2026
- Termination
- Stainless attempts to prove termination and lets users specify a decreasing measure when automatic checking does not suffice. · epfl-lara.github.io, 8 Oct 2026
- Use cases
- The project page reports use in proving compression and decompression algorithms, aspects of file systems, distributed algorithms, type systems, balanced trees, and student assignments. · ecocloud.epfl.ch, 7 Oct 2026
- Who it is for
- The documentation describes Stainless as a tool to help developers build verified Scala software. · epfl-lara.github.io, 7 Oct 2026
Where Stainless stands on Freedom251
- Formal Verification Tools#28 of 34