Partial predecessor and partial subtraction on the natural numbers #
The usual definition of natural number subtraction (Nat.sub) returns 0 as a "garbage value" for
a - b when a < b. Similarly, Nat.pred 0 is defined to be 0. The functions in this file
wrap the result in an Option type instead:
Main definitions #
Partial predecessor operation. Returns ppred n = some m
if n = m + 1, otherwise none.
Instances For
Partial subtraction operation. Returns psub m n = some k
if m = n + k, otherwise none.