liveBook · Manning

Exhaustive checking

As explained in Functional Programming in Scala, Second Edition

Exhaustive checking is a verification technique that evaluates a property over every value in a finite domain or every value within a bounded generated domain.

Exhaustive checking verifies a property by testing every value in a finite domain, turning successful testing into conclusive proof for that domain. section 8.2.3

Apply the technique when the tested domain is small or deliberately bounded:

  • Check both Boolean values instead of sampling generated inputs. section 8.2.3
  • Enumerate small domains such as Byte when their complete value sets are practical. section 8.2.3
  • Bound an otherwise infinite domain with a sized generator, then check every generated value up to the maximum size. section 8.2.3

Proving a Boolean property

A property such as forAll(p) is proved when both p(true) and p(false) pass. The property-testing library can represent this result as Proved rather than merely Passed. section 8.2.3

How Functional Programming in Scala, Second Edition covers it

How deep it goes
Explains finite and sized-generator cases, but leaves library integration as an open-ended design project.
Examples
Uses Boolean and Byte domains, sized generators, and the Proved result.
What it assumes
Assumes familiarity with forAll properties, generators, and Boolean evaluation.
What you can do after
Evaluate properties conclusively when their domains are finite or bounded by sized generators.
How it connects
Connects property-based testing with generators, bounded domains, and proof results.

This explainer was generated by Manning's knowledge graph from the text of Functional Programming in Scala, Second Edition. The section links point to the parts of the book it draws on.