Skip to content

Conversation

lowasser
Copy link
Collaborator

@lowasser lowasser commented Oct 5, 2025

Maybe I should've done the natural numbers and the integers separately? If so, I'll split it...

Changes include:

  • more consistent terminology (e.g. irreflexive versus antireflexive, symmetric versus commutative)
  • updated naming conventions
  • making most proofs of most propositions abstract
  • Improved Idea sections: concept links, cross references, fixed missing idea sections entirely
  • minor code cleanups, especially the use of is-equiv-is-invertible

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll admit it's not obvious to me that these files on the standard finite types belong in elementary-number-theory and not univalent-combinatorics.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not obvious to me either


```agda
module elementary-number-theory.commutative-semiring-of-natural-numbers where
module elementary-number-theory.semiring-of-natural-numbers where
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't specify commutativity for the ring of integers, so it seemed more consistent.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough. Could you just also split up the definitions section to have ℕ-Semiring in its own section?

@lowasser
Copy link
Collaborator Author

lowasser commented Oct 5, 2025

Also, I broke several files down into more separate sections.

@lowasser lowasser added documentation Improvements or additions to documentation elementary-number-theory refactoring improve naming and removed documentation Improvements or additions to documentation labels Oct 5, 2025
@fredrik-bakke
Copy link
Collaborator

I'm a bit worried that these changes will make it considerably harder to get #1211 merged down the road. But since that PR has been stale for a while and there are likely other merged changes that already make this difficult I'm not sure it should be a blocker. I would be incredibly grateful if someone were to comb through that PR and try and get the more finished parts of it merged though, such as the well-ordering principle of the natural numbers and divisibility among many others.

@fredrik-bakke
Copy link
Collaborator

I'm a bit worried that these changes will make it considerably harder to get #1211 merged down the road. But since that PR has been stale for a while and there are likely other merged changes that already make this difficult I'm not sure it should be a blocker. I would be incredibly grateful if someone were to comb through that PR and try and get the more finished parts of it merged though, such as the well-ordering principle of the natural numbers and divisibility among many others.

I'd like to get some feedback from another maintainer before this PR is potentially merged. Preferrably @EgbertRijke, but otherwise @VojtechStep, since I expect the former will not respond.

From what I've seen so far, this PR mostly abstracts definitions and fixes a few names. Are these changes necessary for your continued process @lowasser, or could we potentially icebox this PR until progress has been made to merge the other one? Otherwise, should we consider #1211 discontinued and not take it into consideration, @VojtechStep? Keep in mind I have not checked exactly how much overlap there are between these two PRs.

@VojtechStep
Copy link
Collaborator

I don't think #1211 is becoming mergeable any time soon (it never typechecked, it's been stale for 8 months, and in any case a +17k-3k PR would be very hard to review in one go), and I don't think we should freeze elementary-number-theory until it's done. I'm sure it contains good ideas, and I hope the ideas should be rebasable onto this work, if not the actual code.

@lowasser
Copy link
Collaborator Author

lowasser commented Oct 7, 2025

These are not necessary changes, just things that have irritated me.

triangle-inequality-dist-ℕ m n k
```

### `dist-ℕ x y` is a solution in `z` to `x + z = y`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### `dist-ℕ x y` is a solution in `z` to `x + z = y`
### `dist-ℕ x y` is a solution in `z` to `x + z = y` when `x ≤ y`

is-nonzero-right-factor-mul-ℕ x .zero-ℕ H refl = H (right-zero-law-mul-ℕ x)
```

### If `(x+1)y = x+1`, then `y = 1`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd just like to reiterate that, until #1235 is resolved, using code guards over latex rendered text in headers should not generally be considered an improvement.

Comment on lines +33 to +34
The **[poset](order-theory.posets.md) of natural numbers ordered by
divisibility** consists of the
Copy link
Collaborator

@fredrik-bakke fredrik-bakke Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The **[poset](order-theory.posets.md) of natural numbers ordered by
divisibility** consists of the
The {{#concept "poset of natural numbers ordered by divisibility" Agda=ℕ-Div-Poset}} consists of the

Comment on lines +33 to +34
{{#concept "relatively prime" WDID=Q104752 WD="coprime" Disambiguation="natural numbers" Agda=is-relatively-prime-ℕ}}
if their
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{{#concept "relatively prime" WDID=Q104752 WD="coprime" Disambiguation="natural numbers" Agda=is-relatively-prime-ℕ}}
if their
{{#concept "relatively prime" WDID=Q104752 WD="coprime" Disambiguation="natural numbers" Agda=is-relatively-prime-ℕ}},
or **coprime**, if their

Comment on lines +25 to +26
{{#concept "relatively prime" Disambiguation="integers" Agda=is-relatively-prime-ℤ}}
if their
Copy link
Collaborator

@fredrik-bakke fredrik-bakke Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{{#concept "relatively prime" Disambiguation="integers" Agda=is-relatively-prime-ℤ}}
if their
{{#concept "relatively prime" Disambiguation="integers" WDID=Q104752 WD="coprime" Agda=is-relatively-prime-ℤ}},
or **coprime**, if their

The strong induction principle allows one to assume in the inductive step that
the inductive hypothesis is satisfied at all smaller values.
The
{{#concept "strong induction principle" WDID=Q54506667 WD="principle of complete induction" Agda=strong-ind-ℕ}}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the wikidata page, I wonder if this identifier also refers to well-founded induction á la https://unimath.github.io/agda-unimath/order-theory.well-founded-relations.html. Maybe we should point both to this identifier

open import elementary-number-theory.inequality-natural-numbers using
( preserves-leq-left-mul-ℕ
; reflects-order-mul-ℕ)
; reflects-leq-mul-ℕ)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This renaming is fine by me as a temporary solution. See #1575 however.

leq-quotient-div-ℕ d (succ-ℕ x) (is-nonzero-succ-ℕ x) H
```

### If `x` is nonzero, if `d | x` and `d ≠ x`, then `d < x`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### If `x` is nonzero, if `d | x` and `d ≠ x`, then `d < x`
### If `x` is nonzero, `d | x`, and `d ≠ x`, then `d < x`

@fredrik-bakke
Copy link
Collaborator

I guess I'm just struggling to accept that #1211 is again not going to get merged, and this PR puts a final nail in its coffin. I'll okay these changes for merging.

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

Successfully merging this pull request may close these issues.

3 participants