RepositoryScala
epfl-lara

epfl-lara/stainless

Verification framework and tool for higher-order Scala programs. https://gitlab.epfl.ch/lara/stainless

417stars
64forks
293issues
2views

Featured achievements

The project's latest awards

1
TINIX TRENDING·Topic: cvc4

#1 Repository of the week

1
TINIX TRENDING·Topic: formal-methods

#1 Repository of the week

1
TINIX TRENDING·Topic: inox

#1 Repository of the week

Stainless Release Nightly Status Build Status Gitter chat Apache 2.0 License

Hosted at https://github.com/epfl-lara/stainless ; mirrored at https://gitlab.epfl.ch/lara/stainless . Check out also Inox and Bolts.

Verification framework for a subset of the Scala programming language. See the tutorial.

Please note that this repository uses git submodules, so you need to either:

  • clone it with the --recursive option, or
  • run $ git submodule update --init --recursive after cloning.

Please note that Stainless does not support Scala 2 frontend anymore, only Scala 3.5.0 and later. The latest release that supports Scala 2.13 frontend is the v0.9.8.7.

Quick start

We test mostly on Ubuntu; on Windows, you can get sufficient text-based Ubuntu environment by installing Windows Subsystem for Linux (e.g. wsl --install, then wsl --install -d ubuntu). Ensure you have a Java version ready (it can be headless); on Ubuntu sudo apt install openjdk-17-jdk-headless suffices.

Once ready, download the latest stainless-dotty-standalone release for your platform. Unzip the archive, and run Stainless through the stainless script. Stainless expects a list of space-separated Scala files to verify but also has other Command-line Options.

To check if everything works, you may create a file named HelloStainless.scala next to the stainless script with the following content:

import stainless.collection._
object HelloStainless {
  def myTail(xs: List[BigInt]): BigInt = {
    require(xs.nonEmpty)
    xs match {
      case Cons(h, _) => h
      // Match provably exhaustive
    }
  }
}

and run stainless HelloStainless.scala. If all goes well, Stainless should report something along the lines:

[  Info  ]   ┌───────────────────┐
[  Info  ] ╔═╡ stainless summary ╞════════════════════════════════════════════════════════════════════╗
[  Info  ] ║ └───────────────────┘                                                                    ║
[  Info  ] ║ HelloStainless.scala:6:5:   myTail  body assertion: match exhaustiveness  nativez3   0,0 ║
[  Info  ] ╟┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄╢
[  Info  ] ║ total: 1    valid: 1    (0 from cache) invalid: 0    unknown: 0    time:     0,0         ║
[  Info  ] ╚══════════════════════════════════════════════════════════════════════════════════════════╝
[  Info  ] Shutting down executor service.

If you see funny symbols instead of beautiful ASCII art, run Stainless with the --no-colors option for clean ASCII output with a standardized error message format.

The release archive of Stainless only requires JDK 17. In particular, it needs neither a Scala compiler nor SBT. It is shipped with Z3 4.12.2+, cvc5 1.0.8+ and Princess (branch compiled for Scala 3). If the Z3 native API is not found, use the option --solvers=smt-z3 to rely on the executable instead of API call to z3.

Build and Installation Instructions

Please refer to the installation documentation here.

Further Documentation and Learning Materials

The main documentation for Stainless is hosted at https://epfl-lara.github.io/stainless/.

To get started with using Stainless, see videos:

or see local documentation chapters, such as:

There is also a Stainless EPFL Page which hosts a mirror of the GitHub repository.

License

Stainless is released under the Apache 2.0 license. See the LICENSE file for more information.

Relation to Inox

Stainless relies on Inox to solve the various queries stemming from program verification. Inox supports model-complete queries in a feature-rich fragment that lets Stainless focus on program transformations and soundness of both contract and termination checking and uses its own reasoning steps, as well as invocations to solvers (theorem provers) z3, cvc5, and Princess.

Similar Projects

Discover other similar projects and AI models.

RepositoryPython
testsmt/yinyang

A fuzzing framework for SMT solvers

201
Nov 9, 2026
RepositoryScala
apalache-mc/apalache

APALACHE: symbolic model checker for TLA+ and Quint

634
Nov 18, 2026
RepositoryF*
FStarLang/FStar

A Proof-oriented Programming Language

3.2k
Dec 3, 2026
RepositoryC++
AliveToolkit/alive2

Automatic verification of LLVM optimizations

1.2k
Dec 1, 2026
RepositoryLean
verse-lab/veil

A verifier for automated and interactive proofs about transition systems.

450
Nov 29, 2026
RepositoryJupyter Notebook
philzook58/z3_tutorial

Jupyter notebooks for tutorial on the Z3 SMT solver

172
Nov 3, 2023
RepositoryOCaml
formalsec/smtml

An SMT solver frontend for OCaml

79
Nov 18, 2026
RepositoryPython
trailofbits/manticore

Symbolic execution tool

3.9k
Jun 24, 2026
RepositoryRust
model-checking/kani

A model checker for Rust programs.

3.8k
Nov 30, 2026