Skip to content

has it (DecTotalOrder Bin) ? #65

Closed

Description

@mechvel

has it (DecTotalOrder Bin) ?

Activity

  1. MatthewDaggitt commented on Jun 22, 2017

    @MatthewDaggitt
    Collaborator

    Can you elaborate a bit more? Do you mean Fin instead of Bin?

  2. mechvel commented on Jun 23, 2017

    @mechvel
    ContributorAuthor
  3. MatthewDaggitt commented on Jun 26, 2017

    @MatthewDaggitt
    Collaborator

    Correct me if I'm wrong, but _<_ in Data.Bin is not a total order or even a preorder because it is a strict inequality and therefore is not reflexive...

  4. mechvel commented on Jun 26, 2017

    @mechvel
    ContributorAuthor
  5. MatthewDaggitt commented on Jun 26, 2017

    @MatthewDaggitt
    Collaborator

    Ah, well at the moment the relation _≤_ isn't even defined in Data.Bin. Adding such a definition would probably mean that the existing definition of _<_ would want to be reworked in terms of it and that would entail making large changes to the rest of the file.

    As it's a fairly niche part of the library and a reasonably large piece of work, I don't think that it's likely it'll be done any time soon. However if you need this and have already written the necessary code then please do feel free to submit a pull request with it!

  6. mechvel commented on Jun 29, 2017

    @mechvel
    ContributorAuthor
  7. mechvel commented on Jun 30, 2017

    @mechvel
    ContributorAuthor

    Please, take a fresh version from there:
    ftp://ftp.botik.ru/pub/local/Mechveliani/agdaNotes/bin2.zip

    Ii is tested under Agda 2.6.0-207bde6.

  8. mechvel commented on Jun 30, 2017

    @mechvel
    ContributorAuthor

    Also
    ftp://ftp.botik.ru/pub/local/Mechveliani/agdaNotes/bin3.zip

    includes the items of bin2.zip + the instance of DecTotalOrder for Bin
    for
    x ≤ y defined on Bin as x < y ⊎ x ≡ y.

  9. MatthewDaggitt commented on Jul 5, 2017

    @MatthewDaggitt
    Collaborator

    Thank you for your contribution! It would be great if you could submit some of it as a pull request rather than a zip file. If you need any pointers on creating a pull request please feel free to ask!

    As for the ordering x ≤ y = x < y ⊎ x ≡ y, defining _≤_ in terms of _<_ is backwards with respect to the rest of the standard library. I'm reluctant to accept it as I feel its likely to cause confusions for users and further problems down the line. As I mentioned before, I'd be much more comfortable rewriting the implementation of _<_ in terms of a new native _≤_ relation.

  10. mechvel commented on Jul 9, 2017

    @mechvel
    ContributorAuthor
  11. MatthewDaggitt commented on Jul 9, 2017

    @MatthewDaggitt
    Collaborator

    Please, how to make a pull request in this my particular case?

    1. In a suitable directory, on the command line call git clone https://github.com/mechvel/agda-stdlib stdlib-clone. This will copy the standard library into a new folder called stdlib-clone.
    2. Make the changes you want to in the files Data.Bin and Data.Bin.Properties within stdlib-clone, (including updating CHANGELOG.md with the changes you've made)
    3. Whilst in the top level of the directory stdlib-clone, run the command make test from the command line to check that your changes haven't broken anything.
    4. Add the files you've made changes to using the commands git add src/Data/Bin.agda, git add src/Data/Bin/Properties.agda, git add CHANGELOG.md etc.
    5. Commit the files you've added using git commit.
    6. Push all your changes to your fork on github using git push origin master
    7. Go to https://github.com/mechvel/agda-stdlib and there should be a button to create a pull request from your new commit.
  12. mechvel commented on Jul 9, 2017

    @mechvel
    ContributorAuthor

    I put Nat2.agda into the folder Data/Nat/,
    and put Bin2.agda into Data/Bin

    And module Data.Bin.Bin2
    imports items from ``Data.Nat.Nat2''.

    And ``make test" reports


    cabal clean && cabal install
    cleaning...
    Resolving dependencies...
    Configuring lib-0.13...
    Building lib-0.13...
    Preprocessing executable 'GenerateEverything' for lib-0.13...
    [1 of 1] Compiling Main ( GenerateEverything.hs, dist/build/GenerateEverything/GenerateEverything-tmp/Main.o )
    Linking dist/build/GenerateEverything/GenerateEverything ...
    Preprocessing executable 'AllNonAsciiChars' for lib-0.13...
    [1 of 1] Compiling Main ( AllNonAsciiChars.hs, dist/build/AllNonAsciiChars/AllNonAsciiChars-tmp/Main.o )
    Linking dist/build/AllNonAsciiChars/AllNonAsciiChars ...
    Installing executable(s) in /home/mechvel/.cabal/bin
    Installed lib-0.13
    cabal exec -- GenerateEverything
    GenerateEverything: src/Data/Bin/Bin2.agda is malformed

    I reduce this module to two lines (by commenting out all the rest):

    module Data.Bin.Bin2 where -- ℕ <--> Bin⁺ isomorphism

    open import Level using () renaming (zero to 0ℓ)

    and still it is reported "malformed".

    I wonder what might this mean.

  13. mechvel commented on Jul 9, 2017

    @mechvel
    ContributorAuthor

    As for the ordering x ≤ y = x < y ⊎ x ≡ y, defining ≤ in terms of < is backwards with respect
    to the rest of the standard library. I'm reluctant to accept it as I feel its likely to cause confusions
    for users and further problems down the line. As I mentioned before, I'd be much more
    comfortable rewriting the implementation of < in terms of a new native ≤ relation.

    Currently, Bin has the following implementation to _<_ :

    data _<_ (b₁ b₂ : Bin) : Set where
    less : (lt : (Nat._<_ on toℕ) b₁ b₂) → b₁ < b₂

    Do you suggest to replace this with

    data _≤__ (b₁ b₂ : Bin) : Set where
    leq : (le : (Nat._≤__ on toℕ) b₁ b₂) → b₁ ≤_b₂

    and then, to define _<_ as
    x < y = x ≤ y × x ≢ y
    ?

  14. MatthewDaggitt commented on Jul 9, 2017

    @MatthewDaggitt
    Collaborator

    I put Nat2.agda into the folder Data/Nat/ and put Bin2.agda into Data/Bin

    So the changes that you're making shouldn't be put inside their own files. They should be incorporated into the existing Data.Bin and Data.Bin.Properties files. This should bypass your current problem with the tests.

    Currently, Bin has the following implementation to <:

    data < (b₁ b₂ : Bin) : Set where
    less : (lt : (Nat.< on toℕ) b₁ b₂) → b₁ < b₂

    Do you suggest to replace this with

    data ≤_ (b₁ b₂ : Bin) : Set where
    leq : (le : (Nat.≤_ on toℕ) b₁ b₂) → b₁ ≤_b₂

    and then, to define < as
    x < y = x ≤ y × x ≢ y

    That certainly seems better. In fact, as we're reworking the implementation and the changes aren't going to be backwards compatible anyway, I might be tempted to copy the style of _≤_ in Data.Fin and get rid of the data declaration entirely so that it reads as follows:

    _≤_ : Rel Bin Set
    x ≤ y = toℕ x Nat.≤ toℕ y
    
    _<_ : Rel Bin Set
    x < y = x ≤ y × x ≢ y

    The notes say that the existing data declaration is to aid in pattern matching. It might be worth experimenting with the two different definitions of _≤_: your new version and mine and see which is easier to work with.

  15. 18 remaining items

  16. mechvel commented on Jul 11, 2017

    @mechvel
    ContributorAuthor

    Is this the first or the second "Create pull request" button? Does the page say "Comparing changes"
    or "Open a pull request" at the top?

    First I stay at
    https://github.com/mechvel/agda-stdlib
    There is the headline of
    "This branch is 1 commit ahead of agda:master." "Pull request" "Compare".

    The last two are the buttons at the right end. I click "Pull request".
    And it shows now differently.
    At the right end it shows green "View pull request".
    And it prints " Committer: Sergei Meshveliani ......"
    -- in one left column, leaving blank the rest of the page on screen.
    One page lower it shows in green "Create new pull request",
    and below shows in green a responsible part of my CHANGELOG.md.
    No "Create pull request" button is visible

    Clicking at "Create new pull request" does not change anything.
    Lower it is visible a small ring with running segment in it.
    The page ends with "No commit comments for this range".
    And this way it stays.

  17. MatthewDaggitt commented on Jul 11, 2017

    @MatthewDaggitt
    Collaborator

    The last two are the buttons at the right end. I click "Pull request".

    So after clicking "Pull request" you should see this:
    image

    .
    .
    .

    Clicking at "Create new pull request" does not change anything.

    Clicking the "Create new pull request" button should then allow you to enter the description of the pull request. The screen should now look like this:
    image

    Do you get this screen? After editing the details, you then need to click the green "Create pull request" button at the bottom.

  18. mechvel commented on Jul 11, 2017

    @mechvel
    ContributorAuthor
  19. gallais commented on Jul 11, 2017

    @gallais
    Member

    And I probably do not need to create another pull request.

    Yes you do. The pull requests are listed here so yours most definitely has not been created yet. If you want to make some more edits, you need to commit them and push them to your fork before you start the pull request.

  20. asr commented on Jul 11, 2017

    @asr
    Member

    (my address is mechvel@botik.ru, but Git inserts there `mechvel2' in
    the middle, which is suspicious).

    On the directory where you are doing the commits, please show me the output of

    $ git log -5
    
  21. mechvel commented on Jul 12, 2017

    @mechvel
    ContributorAuthor
  22. mechvel commented on Jul 12, 2017

    @mechvel
    ContributorAuthor

    I have sent an email reply to the last request here. But Github replaced 1 page log text with "..." .
    Can you see this text anywhere?

  23. MatthewDaggitt commented on Jul 12, 2017

    @MatthewDaggitt
    Collaborator

    Okay, let's try again.

    1. Go to https://github.com/mechvel/agda-stdlib
    2. Press "Pull request"
      image
    3. Press "Create new pull request"
      image
    4. Change the title of the pull request to something sensible
      image
    5. Click "Create pull request"
      image
  24. fredrikNordvallForsberg commented on Jul 12, 2017

    @fredrikNordvallForsberg
    Member

    @mechvel The email address used is not important for the success of the creation of the pull request, but if you want to change it, you can execute the following command on the command line:

    git config --global user.email "mechvel@botik.ru"

    Afterwards git will use your correct email address (see e.g. https://help.github.com/articles/setting-your-email-in-git/#setting-your-email-address-for-every-repository-on-your-computer).

  25. mechvel commented on Jul 12, 2017

    @mechvel
    ContributorAuthor
  26. MatthewDaggitt commented on Jul 12, 2017

    @MatthewDaggitt
    Collaborator

    The step
    3. Press "Create new pull request"
    does not produce any effect. And I do not see how can I change there
    anything in the title, there is no possibility.

    Okay, well that's deeply bizarre. Fine, I guess I'll go ahead and create the pull request for you.

  27. MatthewDaggitt commented on Feb 22, 2018

    @MatthewDaggitt
    Collaborator

    Closing this issue, as users seriously interested in binary computation can use the release of @mechvel 's new library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions