Rename plus/minus → add/sub and put number lemmas in modules to be consistent with Coq stdlib
Rename _plus
/_minus
into _add
/_sub
to be consistent with Coq's current convention for numbers.
Following the discussion at iris!821 (merged)
Merge request reports
Activity
assigned to @robbertkrebbers
Let's see what the Coq folks say. https://coq.zulipchat.com/#narrow/stream/237977-Coq-users/topic/plus.20versus.20add
I get the impression from that thread that add/mul are indeed the way to go. That is also consistent with our choice for Qp, see !188 (merged)
While we're at it, it seems we sometimes use
Nat_
and sometimesnat_
. For example:Global Instance nat_lt_pi: ∀ x y : nat, ProofIrrel (x < y). Lemma nat_le_sum (x y : nat) : x ≤ y ↔ ∃ z, y = x + z. Lemma Nat_lt_succ_succ n : n < S (S n). Lemma Nat_iter_S {A} n (f: A → A) x : Nat.iter (S n) f x = f (Nat.iter n f x).
The
Nat_
seems to imitate theNat.
lemmas in Coq, butnat_
is more like the standard std++ style.Considering Coq's fantastic module system, we could also dump all our own
Nat
lemmas in a moduleNat
. Then there will be multipleNat
modules (one in the stdlib, and one in std++'s numbers), but as long as the lemmas are disjoint, that works just fine.mentioned in merge request iris!821 (merged)
added 18 commits
-
33fc8e62...02fd8ca3 - 16 commits from branch
master
- dc815d28 - Rename `_plus`/`_minus` into `_add`/`_sub` to be consistent with Coq's current...
- bb414ed6 - Modules for `Pos` and `Nat`.
-
33fc8e62...02fd8ca3 - 16 commits from branch
I have done an experiment for nat and positive. See last commit in this MR. I did not update the sed script.
Feedback is welcome.
I am happy to continue this experiment for other number types and evaluate the impact on Iris and some other developments (I expect the sed script can port all of them trivially).
Edited by Robbert Krebbersadded 1 commit
- e548e71b - Same for Z and coercions between Z/N/Pos/nat.
- Resolved by Robbert Krebbers
- Resolved by Robbert Krebbers
Would be good if you could try porting Iris, to ensure it works there.
If
Qc
is an implementation detail we should probably not pollute the global namespace with its lemmas...
I ported Iris, it was trivial: iris@e1f9c08b
added 16 commits
-
8758522a...809dee91 - 10 commits from branch
master
- aa8376e2 - Rename `_plus`/`_minus` into `_add`/`_sub` to be consistent with Coq's current...
- b42404a3 - Modules for `Pos` and `Nat`.
- 1ac5e9d6 - Same for Z and coercions between Z/N/Pos/nat.
- 05ae1a51 - Same for `Qp`.
- 9377a916 - Export `Nat` and friends in our `Nat`.
- 5eb4810f - CHANGELOG.
Toggle commit list-
8758522a...809dee91 - 10 commits from branch
added 2 commits