Idris2/libs/contrib/Data
Ohad Kammar 0c1a124704
Division theorem (#695)
Division Theorem. For every natural number `x` and positive natural
number `n`, there is a unique decomposition:
`x = q*n + r`
with `q`,`r` natural and `r` < `n`.

`q` is the quotient when dividing `x` by `n`
`r` is the remainder when dividing `x` by `n`.

This commit adds a proof for this fact, in case
we want to reason about modular arithmetic (for example, when dealing
with binary representations). A future, more systematic, development could
perhaps follow: @clayrat 's (idris1) port of Coq's binary arithmetics:

    https://github.com/sbp/idris-bi/blob/master/src/Data/Bin/DivMod.idr
    https://github.com/sbp/idris-bi/blob/master/src/Data/Biz/DivMod.idr
    https://github.com/sbp/idris-bi/blob/master/src/Data/BizMod2/DivMod.idr

In the process, it bulks up the stdlib with:
+ a generic PreorderReasoning module for arbitrary preorders,
analogous for the equational reasoning module
+ some missing facts about Nat operations.
+ Refactor some Nat order properties using a 'reflect' function

Co-authored-by: Ohad Kammar <ohad.kammar@ed.ac.uk>
Co-authored-by: G. Allais <guillaume.allais@ens-lyon.org>
2020-10-06 13:09:02 +01:00
..
Bool Division theorem (#695) 2020-10-06 13:09:02 +01:00
Fin various stdlib updates 2020-06-11 23:14:11 +02:00
Fun [contrib] Add misc libraries to contrib (#667) 2020-09-14 16:22:46 +01:00
Linear Be explicit about multiplicity in Array 2020-06-12 14:18:57 +01:00
List [ breaking ] remove List1 related ambiguities (#690) 2020-09-22 15:07:40 +01:00
Logic Port over some contrib stuff 2020-06-15 14:56:19 -05:00
Morphisms Add some algebra implementations 2020-07-17 08:25:20 -05:00
Nat Division theorem (#695) 2020-10-06 13:09:02 +01:00
Stream Add Data.Stream.Extra.startWith 2020-08-28 13:16:31 +01:00
String [ fix #63 ] interleaving let binders and local declarations (#691) 2020-09-28 13:15:22 +01:00
Vect Merge sort implementation for Vect (#417) 2020-07-07 10:25:42 +01:00
HVect.idr make constructor injectivity proofs use arguments at 0 multiplicity 2020-09-09 19:57:12 +01:00
SortedMap.idr various stdlib updates 2020-06-11 23:14:11 +02:00
SortedSet.idr Add libraries 2020-05-18 14:00:08 +01:00
Void.idr [contrib] Add misc libraries to contrib (#667) 2020-09-14 16:22:46 +01:00