Alternative take on #153: fix `le` in future versions of Coq
This should provide compatibility for https://github.com/coq/coq/pull/12162
Other changes:
- Use
Arith
instead ofNPeano
, since the latter is deprecated. While it may also be possible to importNPeano
, numbers exportPArith NArith ZArith
, so it seemed logical to also exportArith
. - Add test to check for correct version of
le
.
Merge request reports
Activity
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. We used to export NPeano in numbers, according to https://coq.inria.fr/distrib/current/stdlib/Coq.Numbers.Natural.Peano.NPeano.html it's deprecated and Arith should be used instead.
Arith
exports at least all these things: https://coq.inria.fr/distrib/current/stdlib/Coq.Arith.Arith_base.htmlOh you mean because these are all "on the same level" in https://coq.inria.fr/distrib/current/stdlib/index.html ? Hm, I can see that.
However, we actually just import
QArith
. Makes me wonder if we should try to turn some of the others into imports, too...So yeah I think I prefer this over !153 (closed) -- could you make this an MR? I'l run the test on the reverse dependencies.
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. added 1 commit
- 8e38d217 - Also import `Arith` in numbers to make sure it shadows (just to be sure).
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 thatArith
gathersPeanoNat
with obsolete files. UsingPeanoNat
and properties namedNat.*
is apparently the safest way to go. It apparently misses very few useful statements from my own experience. I just tried on std++: replacingArith
withPeanoNat
works. Only one occurrence innumbers.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 LaurentFor the current MR: apparently
Arith
is not good at maskingBool.le
. From what I have been able to see, onlyPeano
(which contains the primary definition ofle
) does the job. Note also that it has to be called after any import ofBool
(which is in particular coming withProgram.Syntax
throughBVector
). What seems to work is to add:From Coq Require Export Peano.
at the end of
Require
s inbase.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 LaurentFor the current MR: apparently
Arith
is not good at maskingBool.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.
mentioned in merge request !159 (merged)
mentioned in commit ef839489
Closing in favor of !159 (merged).