Code Monkey home page Code Monkey logo

idris-bi's People

Contributors

clayrat avatar sbp avatar steshaw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

idris-bi's Issues

Move the types into their respective function definition files

Coq defines its types in Numbers.BinNums which seems a little strange to me. It may be because they modularise [NPZ]Arith over so many files and they found that it's better to import the types into each file rather than do chained exporting.

On the other hand, in idris-bi we're keeping everything in the files Bip.idr, Bin.idr, and Biz.idr. It might be a good idea to move Bip into Bip.idr and so on. That way we would eliminate the Bi.idr file entirely. Who's really going to import Data.Bi without importing one of the other files?

Port QArith

Whilst I only envisaged porting the P, N, and Z arithmetics from Coq, it might be nice to go for full-on completion and port QArith too. I'm not sure what the type should be, but probably something like this:

record Biq where
  constructor Ratio
  numerator: Biz
  denominator: Bip

The constructor could be Rational instead of Ratio, though by convention it should really be MkBiq. Coq uses num and den for the field names. I don't like "num", but perhaps n and d, or numer and denom would be okay.

Build error with Idris 1.3

Reproducible with Nix:

$ nix-build https://github.com/nixos/nixpkgs/archive/a8c7103.tar.gz -A idrisPackages.bi
these derivations will be built:
  /nix/store/3cjip6k9ndqlsmdv1x3xmx7j5hqc79qk-bi-2018-01-17.drv
building '/nix/store/3cjip6k9ndqlsmdv1x3xmx7j5hqc79qk-bi-2018-01-17.drv'...
unpacking sources
unpacking source archive /nix/store/ngky5q8yzgghzfppb2sg1fzwyxzzj6r2-source
source root is source
patching sources
configuring
no configure script, doing nothing
building
Entering directory `./src'
Type checking ./Data/Bi.idr
Type checking ./Data/Util.idr
Type checking ./Data/Bip.idr
Type checking ./Data/Bip/AddMul.idr
Type checking ./Data/Bip/Iter.idr
./Data/Bip/Iter.idr:86:1-32:
   |
86 | iterInvariant f Inv  U    g x ix = g x ix
   | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When checking left hand side of iterInvariant:
When checking argument Inv to Data.Bip.Iter.iterInvariant:
        Inv is not a valid name for a pattern variable
builder for '/nix/store/3cjip6k9ndqlsmdv1x3xmx7j5hqc79qk-bi-2018-01-17.drv' failed with exit code 1
error: build of '/nix/store/3cjip6k9ndqlsmdv1x3xmx7j5hqc79qk-bi-2018-01-17.drv' failed

Reformulate case-using functions

If we define bipMinus as

bipMinusHelp : Bim -> Bip
bipMinusHelp (BimP c) = c
bipMinusHelp _        = U

bipMinus : (a, b: Bip) -> Bip
bipMinus a b = bipMinusHelp (bimMinus a b)

then the proof of subSuccR simplifies a lot, since now we can use rewrite:

subSuccR : (p, q: Bip) -> bipMinus p (bipSucc q) = bipPred (bipMinus p q)
subSuccR p q = rewrite subMaskSuccR p q in 
               rewrite subMaskCarrySpec p q in 
               aux (bimMinus p q)
  where
  aux : (m : Bim) -> bipMinusHelp (bimPred m) = bipPred (bipMinusHelp m) 
  aux  BimO        = Refl
  aux (BimP  U   ) = Refl
  aux (BimP (O _)) = Refl
  aux (BimP (I _)) = Refl
  aux  BimM        = Refl

So I propose to redefine all case-using functions (bipMinus, bipMin, bipMax, bipSqrtRemStep etc) to this form, at least until idris-lang/Idris-dev#4001 is fixed.

Another inconvenience is that we can't put these helpers under where, as there currently is no way to refer to them (see idris-lang/Idris-dev#3991).

Proof names

For now I've been simply converting snake_case to camelCase in proof names, but I think once Bip proofs are done, we should go through them and rename to reflect the names of actual Bip functions (e.g., subMask* -> bimMinus* etc).

Trivial proofs?

Should we bring back trivial proofs, i.e. ones provable with a single Refl? I've been leaving them out as they're useless as lemmas due to Idris's strong normalization, but maybe they're still useful as simple sanity checks?

Duplication of binDouble/binDoubleSucc

We seem to have two versions of those: in Bip, to define bipAnd/bipDiff/bipXor, and in Bin proper as binDPO/binD. As we don't have any proofs of bipAnd etc in Bip, might as well move those to Bin to avoid duplication?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.