Download PDFOpen PDF in browser

Well-founded Functions and Extreme Predicates in Dafny: A Tutorial

15 pagesPublished: September 27, 2016


A recursive function is well defined if its every recursive call
corresponds a decrease in some well-founded order. Such a function is
said to be _terminating_ and is in many applications the standard way
to define a function. A boolean function can also be defined as
an extreme solution to a recurrence relation, that is, as a least or
greatest fixpoint of some functor. Such _extreme predicates_ are
useful to encode a set of inductive or coinductive inference rules
and are at the core of many a constructive logic. The
verification-aware programming language Dafny supports both
terminating functions and extreme predicates. This tutorial
describes the difference in general terms, and then describes novel
syntactic support in Dafny for defining and proving lemmas with
extreme predicates. Various examples and considerations are given.
Although Dafny's verifier has at its core a first-order SMT solver,
Dafny's logical encoding makes it possible to reason about fixpoints
in an automated way.

Keyphrases: coinduction, Coinductive predicate, greatest fixpoint, induction, inductive predicate, least fixpoint, mechanical proof assistant

In: Boris Konev, Stephan Schulz and Laurent Simon (editors). IWIL-2015. 11th International Workshop on the Implementation of Logics, vol 40, pages 52--66

BibTeX entry
  author    = {Rustan Leino},
  title     = {Well-founded Functions and Extreme Predicates in Dafny: A Tutorial},
  booktitle = {IWIL-2015. 11th International Workshop on the Implementation of Logics},
  editor    = {Boris Konev and Stephan Schulz and Laurent Simon},
  series    = {EPiC Series in Computing},
  volume    = {40},
  pages     = {52--66},
  year      = {2016},
  publisher = {EasyChair},
  bibsource = {EasyChair,},
  issn      = {2398-7340},
  url       = {},
  doi       = {10.29007/v2m3}}
Download PDFOpen PDF in browser