liveBook · Manning

Proved

As explained in Functional Programming in Scala, Second Edition

Proved is a Result case indicating that a property was established conclusively rather than merely tested without finding a counterexample.

Proved is a Result case for properties established conclusively. Unlike Passed, it does not mean that testing found no counterexample after a fixed number of cases. section 8.2.3

Proved changes property execution in three ways:

  • verify can return Proved after evaluating its Boolean argument once instead of reporting that it passed many tests. section 8.2.3
  • Property combinators such as && can treat Proved alongside Passed without distinguishing them. section 8.2.3

Testing a parallel computation

Prop.verify checks that Par.unit(1).map(_ + 1) equals Par.unit(2), expressing the intent without pretending that 100 repeated tests provide a proof.

How Functional Programming in Scala, Second Edition covers it

How deep it goes
Defines the Result case and updates verify, the runner, and combinators, while deferring exhaustive finite-domain proving to an exercise.
Examples
Uses verify for parallel equality and contrasts it with forAll over generated integers and parallel computations.
What it assumes
Assumes Prop, Result, verify, forAll, and generated-property testing; motivates these distinctions through parallel computations.
What you can do after
Evaluate properties with distinct Passed, Falsified, and Proved outcomes, including direct parallel-computation checks.
How it connects
Connects Result to Prop, verify, forAll, property combinators, exhaustive checking, and parallel computation testing.

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.