Skip to content
Snippets Groups Projects

Alternative take on #153: fix `le` in future versions of Coq

Closed Robbert Krebbers requested to merge ci/robbert/arith into master

This should provide compatibility for https://github.com/coq/coq/pull/12162

Other changes:

  • Use Arith instead of NPeano, since the latter is deprecated. While it may also be possible to import NPeano, numbers export PArith NArith ZArith, so it seemed logical to also export Arith.
  • Add test to check for correct version of le.

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
3 3 abstract interfaces for ordered structures, sets, and various other data
4 4 structures. *)
5 5
6 From Coq Require Export Morphisms RelationClasses List Bool Utf8 Setoid.
6 From Coq Require Export Morphisms RelationClasses List Bool Utf8 Setoid Arith.
  • Ralf Jung
    Ralf Jung @jung started a thread on commit ef839489
  • 1 1 (** This file collects some trivial facts on the Coq types [nat] and [N] for
    2 2 natural numbers, and the type [Z] for integers. It also declares some useful
    3 3 notations. *)
    4 From Coq Require Export EqdepFacts PArith NArith ZArith NPeano.
    4 From Coq Require Export EqdepFacts PArith NArith ZArith.
  • I ran this through CI and our reverse deps are all fine.

  • added 1 commit

    • 8e38d217 - Also import `Arith` in numbers to make sure it shadows (just to be sure).

    Compare with previous version

  • Code looks good, but

    • should this be in the changelog?
    • can we have a comment explaining why the exports are the way they are?
    • Contributor

      Regarding the "spaghetti of kludges put on top of each other" of arith files in stdlib, I am also a bit lost.

      Concerning Arith (I did not dig into other *Arith), what I understand is that Arith gathers PeanoNat with obsolete files. Using PeanoNat and properties named Nat.* is apparently the safest way to go. It apparently misses very few useful statements from my own experience. I just tried on std++: replacing Arith with PeanoNat works. Only one occurrence in numbers.v:

      @@ -1,9 +1,9 @@
       (** This file collects some trivial facts on the Coq types [nat] and [N] for
       natural numbers, and the type [Z] for integers. It also declares some useful
       notations. *)
      -From Coq Require Export EqdepFacts PArith NArith ZArith Arith.
      +From Coq Require Export EqdepFacts PArith NArith ZArith PeanoNat.
       From Coq Require Import QArith Qcanon.
       From stdpp Require Export base decidable option.
       Set Default Proof Using "Type".
       Local Open Scope nat_scope.

      I don't know for projects using std++.

      Edited by Olivier Laurent
    • For the current MR: apparently Arith is not good at masking Bool.le. From what I have been able to see, only Peano (which contains the primary definition of le) does the job. Note also that it has to be called after any import of Bool (which is in particular coming with Program.Syntax through BVector). What seems to work is to add:

      From Coq Require Export Peano.

      at the end of Requires in base.v:

      @@ -1,15 +1,16 @@
       (** This file collects type class interfaces, notations, and general theorems
       that are used throughout the whole development. Most importantly it contains
       abstract interfaces for ordered structures, sets, and various other data
       structures. *)
       
      -From Coq Require Export Morphisms RelationClasses List Bool Utf8 Setoid Arith.
      +From Coq Require Export Morphisms RelationClasses List Bool Utf8 Setoid.
       From Coq Require Import Permutation.
       Set Default Proof Using "Type".
       Export ListNotations.
       From Coq.Program Require Export Basics Syntax.
      +From Coq Require Export Peano.
       
       (** This notation is necessary to prevent [length] from being printed
       as [strings.length] if strings.v is imported and later base.v. See
       also strings.v and
       https://gitlab.mpi-sws.org/iris/stdpp/-/merge_requests/144 and

      (tested both on master and master + PR#12162)

      Edited by Olivier Laurent
    • @olaure01

      For the current MR: apparently Arith is not good at masking Bool.le.

      So you are saying, the MR as-is does not build with your Coq change?

    • Yes: building stdpp + !156 (closed) against coq + coq/coq#12162 gives the same errors as building std++ master against coq + coq/coq#12162.

    • Please register or sign in to reply
  • Olivier Laurent mentioned in merge request !159 (merged)

    mentioned in merge request !159 (merged)

  • Olivier Laurent mentioned in commit ef839489

    mentioned in commit ef839489

  • Closing in favor of !159 (merged).

  • closed

  • Please register or sign in to reply
    Loading