Numbers strictly less than some bound. The name comes from "finite sets".
It's probably not a good idea to use Fin
for arithmetic, and they will be
exceedingly inefficient at run time.
the upper bound
There are no elements of Fin Z
Add two Fins
Convert a Fin to an Integer
Convert a Fin to a Nat
finToNat
is injective
Allow overloading of Integer literals for Fin.
the Integer that the user typed
an automatically-constructed proof that x
is in bounds
Convert an Integer
to a Fin
, provided the integer is within bounds.
The upper bound of the Fin
The largest element of some Fin type
Convert an Integer to a Fin in the required bounds/
This is essentially a composition of mod
and fromInteger
Add some natural number to a Fin, extending the bound accordingly
the previous bound
the number to increase the Fin by
Attempt to tighten the bound on a Fin.
Return Left
if the bound could not be tightened, or Right
if it could.
Weaken the bound on a Fin by 1
Weaken the bound on a Fin using an inequality proof
Weaken the bound on a Fin by some amount