Regarding the OCaml QCheck library (https://github.com/c-cube/qcheck),
say we have a complete generator g: typ Gen.t for a finite type typ or a finite subset s: typ -> bool of typ, is it possible (with or without resorting to hacky techniques and/or slight modification to the library itself) to perform an exhaustive test (thus a proof!) for a property e.g. forall x (s.t. s x = true in the case we are only interested in a subset), prop x = true, given prop: typ -> bool always return a value for either any value of the type or the subset we are interested in?
By a "complete generator", I don't have a concrete definition for it but something as the name suggests. Some examples include:
Gen.pure ()for the typeunitGen.int_bound 5for the subsetfun x -> x >= 0 && x <= 5of typeintGen.oneofl [`mon; `tue; `wed; `thu; `fri; `sat; `sun]for the type[`mon|`tue|`wed|`thu|`fri|`sat|`sun]
In brief, this is possible but it is really unclear if it is desirable.
Indeed, you can define a qcheck generator from an exhaustive sequence
and use
Qcheckrunner to test properties on the total number of elements in this existing sequence.However, it is then not clear what
Qcheckbrings you since you can not use any of the otherQcheckgenerators: even for a finite set, a random generator will require an infinite number of samples to almost surely cover all cases. Similarly, for an exhaustive generator, shrinking is not useful since you will have to test all values at some point.