Add unfinS to util

This commit is contained in:
Nathan McCarty 2025-01-29 01:13:43 -05:00
parent ac93582e96
commit 5ad68cdb44

View file

@ -11,6 +11,7 @@ import Data.String
import Data.List.Lazy
import Data.List1
import Data.Vect
import Data.Fin
%default total
```
@ -137,6 +138,21 @@ Lazily generate all the permutations of a Vect
(y, z :: ys) :: map (consSnd y) (select (z :: ys))
```
## Fin
```idris hide
namespace Fin
```
```idris
||| Decriment a Fin, wrapping on overflow
export
unfinS : {n : _} -> Fin n -> Fin n
unfinS FZ = last
unfinS (FS x) = weaken x
```
## Vectors
Define some operations for pairs of numbers, treating them roughly like vectors