Commit Graph

66 Commits

Author SHA1 Message Date
Alex Humphreys
71a638ef28 Add extra parsers
This also changes the return type of `char` and `string`. They
previously returned `()`, they now return `Char` and `String`
repectively.

Signed-off-by: Alex Humphreys <alex.humphreys@here.com>
2020-11-27 11:54:12 +00:00
Guillaume ALLAIS
a9ff13c663 [ new ] proof that evaluation is Domain-independent 2020-10-29 23:05:41 +00:00
Alex Gryzlov
f79b86ae41
contrib.Data.String.Parser updates (#713) 2020-10-24 12:33:15 +01:00
Guillaume ALLAIS
482527063c [ new ] Variant with a runtime irrelevant Domain
Rather than translating the constraints to a Dybjer-Setzer IR code
we can produce an ad-hoc definition of a `Domain` that we will be
able to make runtime irrelevant.

This means that compiled code will never need to construct a proof
that a value is in the domain of the function: it will simply run
the function!
2020-10-15 17:03:32 +01:00
Guillaume ALLAIS
864be2c9dc [ contrib ] add McBride's General monad 2020-10-15 17:03:32 +01:00
Matus Tejiscak
f64163de1f Merge branch 'unscheme' into master 2020-10-11 08:20:01 +02:00
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
Ohad Kammar
c02481fb55
[contrib] Add a Reflects datatype (#722)
* [contrib] Add a `Reflects` datatype

as discussed in PR #695
2020-10-02 17:41:36 +01:00
G. Allais
3df1f9c476
[ fix #63 ] interleaving let binders and local declarations (#691) 2020-09-28 13:15:22 +01:00
G. Allais
d105dd11a7
[ breaking ] remove List1 related ambiguities (#690) 2020-09-22 15:07:40 +01:00
Christian Rasmussen
9add729ca3 Add Data.String.Iterator implementation for JavaScript 2020-09-20 17:44:19 +02:00
Matus Tejiscak
0a203f8f52 Add a warning comment. 2020-09-20 17:42:50 +02:00
Matus Tejiscak
b58cc433c8 Index StringIterator with the String it refers to. 2020-09-20 10:36:04 +02:00
Matus Tejiscak
d26a9c55bf Tune Data.String.Iterator. 2020-09-20 10:02:18 +02:00
Matus Tejiscak
f73fa55075 Unpack strings into a lazy list. 2020-09-19 22:48:45 +02:00
Matus Tejiscak
e36c211cc0 Add a missing covering annotation. 2020-09-19 21:57:54 +02:00
Matus Tejiscak
74f592053e Make StringIterator abstract. 2020-09-19 21:54:34 +02:00
Matus Tejiscak
7b2d1190a1 Make the comments more explicit. 2020-09-19 15:22:29 +02:00
Matus Tejiscak
5360adcc23 String-related stdlib tweaks. 2020-09-19 14:22:54 +02:00
Ohad Kammar
2ae330785b
[contrib] Add misc libraries to contrib (#667)
* [contrib] Add misc libraries to contrib

Expose some `private` function in libs/base that I needed, and seem like
their visibility was forgotten

I'd appreciate a code review, especially to tell me I'm
re-implementing something that's already elsewhere in the library

Mostly extending existing functionality:
* `Data/Void.idr`: add some utility functions for manipulating absurdity.
* `Decidable/Decidable/Extra.idr`: add support for double negation elimination in decidable relations
* `Data/Fun/Extra.idr`:
  + add `application` (total and partil) for n-ary functions
  + add (slightly) dependent versions of these operations
* `Decidable/Order/Strict.idr`: a strict preorder is what you get when
  you remove the diagonal from a pre-order. For example, `<` is the
  associated preorder for `<=` over `Nat`.
  Analogous to `Decidable.Order`. The proof search mechanism struggled
  a bit, so I had to hack it --- sorry.

Eventually we should move `Data.Fun.Extra.Pointwise` to `Data.Vect.Quantifiers` in base
but we don't have any interesting uses for it at the moment so it's not
urgent.

Co-authored by @gallais
2020-09-14 16:22:46 +01:00
Shay Lewis
53c2bf5885 make constructor injectivity proofs use arguments at 0 multiplicity 2020-09-09 19:57:12 +01:00
foss-mc
4b7dc38e62 Add Data.Stream.Extra.startWith 2020-08-28 13:16:31 +01:00
Alex Gryzlov
969f5443a9 additional refactor of Data.String.Parser 2020-08-27 15:27:52 +01:00
Thomas Dziedzic
a7ff5aa71f
implement HVect (#563) 2020-08-26 15:48:19 +01:00
Alex Gryzlov
ef5299733a
refactor Data.String.Parser (#579) 2020-08-22 08:13:34 +01:00
Alex Humphreys
f47d9cfef2 Add integer paser and extra test
Signed-off-by: Alex Humphreys <alex.humphreys@here.com>
2020-08-10 13:26:20 +02:00
Alex Humphreys
f020fd29e8 Use overloaded Fin literals
Signed-off-by: Alex Humphreys <alex.humphreys@here.com>
2020-08-10 13:26:20 +02:00
Alex Humphreys
d4cbb8a620 Move natural and digit combinators
Signed-off-by: Alex Humphreys <alex.humphreys@here.com>
2020-08-07 19:20:32 +02:00
Alex Humphreys
40427bd527 Move combinators to Data.String.Parser 2020-08-06 13:16:47 +02:00
Alex Humphreys
97b41d1ad9 Rename BuildExpressionParser to Parser.Expression
Signed-off-by: Alex Humphreys <alex.humphreys@here.com>
2020-08-06 12:42:38 +02:00
Alex Humphreys
22915d23ca Remove LO function
Signed-off-by: Alex Humphreys <alex.humphreys@here.com>
2020-08-06 12:27:42 +02:00
Alex Humphreys
eca083cdcc Add License comment to BuildExpressionParser
Signed-off-by: Alex Humphreys <alex.humphreys@here.com>
2020-08-06 08:59:57 +02:00
Alex Humphreys
29e49a74c5 Add BuildExpressionParser to contrib
Signed-off-by: Alex Humphreys <alex.humphreys@here.com>
2020-08-06 08:59:57 +02:00
G. Allais
0a7ea69df5
[ refactor ] introduce List1 to remove impossible case (#520) 2020-08-04 20:03:18 +01:00
Nick Drozd
a2bdf8e6d7 Add some algebra implementations 2020-07-17 08:25:20 -05:00
G. Allais
0908e76515
[ fix #346 ] Pull List.length into prelude (#450) 2020-07-14 12:15:57 +01:00
Nick Drozd
6519b5608d Further simplify List 2020-07-12 21:00:33 -05:00
Nick Drozd
7d1ee9dd08 Simplify Equality 2020-07-07 10:48:23 +01:00
Michael Birch
5c9339bde8
Merge sort implementation for Vect (#417) 2020-07-07 10:25:42 +01:00
Niklas Larsson
52c6db09d1 Add <?> for replacing error messages 2020-07-06 14:13:56 +02:00
Niklas Larsson
60a067fab1 Remove dumpState 2020-07-06 13:57:13 +02:00
Niklas Larsson
5060eaafaf Make things public export to work with bootstrap 2020-07-05 21:51:12 +02:00
Niklas Larsson
af83c9303b Add test and documentation 2020-07-05 21:51:12 +02:00
Niklas Larsson
d779c85df4 Add optional 2020-07-05 21:51:11 +02:00
Niklas Larsson
0e51124a43 Add option 2020-07-05 21:51:11 +02:00
Niklas Larsson
bba15974a5 Add takeWhile
add substring and length primitives to Data.Strings
2020-07-05 21:51:11 +02:00
Niklas Larsson
39535bf11a Add lifting 2020-07-05 21:51:11 +02:00
Niklas Larsson
d97789190d Add bounds checking 2020-07-05 21:51:11 +02:00
Niklas Larsson
f290c6c3ce Start on a simple string parser 2020-07-05 21:51:11 +02:00
Denis Buzdalov
77f1d69acb Injectivity and similar properties were added for lists'a append. 2020-06-30 17:00:47 +03:00