Skip to content

feat(Algebra/GroupWithZero/Range): the range of a MonoidHom whose codomain is a GroupWithZero as a GroupWithZero when #25496

Closed
faenuccio wants to merge 19 commits intomasterfrom
ACLFN/Range
Closed

feat(Algebra/GroupWithZero/Range): the range of a MonoidHom whose codomain is a GroupWithZero as a GroupWithZero when #25496
faenuccio wants to merge 19 commits intomasterfrom
ACLFN/Range

Conversation

@faenuccio
Copy link
Copy Markdown
Contributor

@faenuccio faenuccio commented Jun 5, 2025

We define an instance of GroupWithZero on the subgroup generated by the range of a MonoidHom taking values in a GroupWithZero (by adding a zero to it).

Co-authored-by: @AntoineChambert-Loir


Open in Gitpod

…omain is a GroupWithZero as a GroupWithZero when

We define an instance of `GroupWithZero` on the range of a MonoidHom taking values in a `GroupWithZero`

Co-authored-by: Antoine Chambert-Loir

---
<!-- The text above the `---` will become the commit message when your
PR is merged. Please leave a blank newline before the `---`, otherwise
GitHub will format the text above it as a title.

For details on the "pull request lifecycle" in mathlib, please see:
https://leanprover-community.github.io/contribute/index.html

In particular, note that most reviewers will only notice your PR
if it passes the continuous integration checks.
Please ask for help on https://leanprover.zulipchat.com if needed.

To indicate co-authors, include lines at the bottom of the commit message
(that is, before the `---`) using the following format:

Co-authored-by: Author Name <author@email.com>

If you are moving or deleting declarations, please include these lines at the bottom of the commit message
(that is, before the `---`) using the following format:

Moves:
- Vector.* -> List.Vector.*
- ...

Deletions:
- Nat.bit1_add_bit1
- ...

Any other comments you want to keep out of the PR commit should go
below the `---`, and placed outside this HTML comment, or else they
will be invisible to reviewers.

If this PR depends on other PRs, please list them below this comment,
using the following format:
- [ ] depends on: #abc [optional extra text]
- [ ] depends on: #xyz [optional extra text]

-->

[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/from-referrer/)
@faenuccio faenuccio added WIP Work in progress t-algebra Algebra (groups, rings, fields, etc) labels Jun 5, 2025
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jun 5, 2025

PR summary 45feb5a269

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference
Mathlib.Algebra.GroupWithZero.Range (new file) 430

Declarations diff

+ instance : CancelMonoidWithZero (range₀ f)
+ instance : CommGroupWithZero (range₀ f)
+ instance : GroupWithZero (range₀ f)
+ inv_mem_range₀
+ inv_mem_range₀_iff
+ mem_range₀
+ mem_range₀_iff_of_comm
+ range₀
+ range₀_coe_one
+ range₀_coe_zero
+ zero_mem_range₀

You can run this locally as follows
## summary with just the declaration names:
./scripts/declarations_diff.sh <optional_commit>

## more verbose report:
./scripts/declarations_diff.sh long <optional_commit>

The doc-module for script/declarations_diff.sh contains some details about this script.


No changes to technical debt.

You can run this locally as

./scripts/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

@github-actions github-actions bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Jun 6, 2025
@leanprover-community-bot-assistant leanprover-community-bot-assistant removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Jun 6, 2025
@github-actions github-actions bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Jun 6, 2025
@leanprover-community-bot-assistant leanprover-community-bot-assistant removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Jun 6, 2025
@kbuzzard
Copy link
Copy Markdown
Member

kbuzzard commented Jun 10, 2025

you need to run lake exe mk_all to update FLT.lean to pass CI.

Also, can you fix the description of this PR? It currently ends mid-sentence.

@github-actions github-actions bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Jun 10, 2025
@github-actions github-actions bot removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Jun 10, 2025
@AntoineChambert-Loir AntoineChambert-Loir removed the WIP Work in progress label Jun 10, 2025
/-! # Range of MonoidHomWithZero
Given a function `f : A → B` whose codomain `B` is a `GroupWithZero`, we define the
type `range₀`, by endowing the invertible elements in the range of `f` (i.e., all non-zero elements)
with a `0` (inherited from that of `B`): it is a `GroupWithZero` and if `B` is commutative, then
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

it is a GroupWithZero

The thing you describe here is not a group with 0 in the generality in which you are writing (A is a random type and f is a random function). e.g. A could be {37} and f can be the inclusion into NNReal; then the thing you are describing here is {0,37}.

Comment on lines +19 to +24
* `range₀ f` is the smallest subgroup with zero containing the range of `f`;
* `range₀ f` is a `CancelCommMonoidWithZero`;
* `range₀ f` is a `GroupWithZero`;
* When `A` is a monoid with zero and `f` is a homomorphism of monoids with zero, `range₀ f` can be
explicitely descibed as the elements that are ratios of terms in `range f` , see
`MonoidHomWithZero.mem_range₀_iff_of_comm`.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we should stick to he usual style here, which is

## Main results
[set up notation, i.e. types of the things which will be inputs into the theorems]
* `name_of_theorem f A B` : `range₀ f` is the smallest subgroup with zero containing the range of `f`;
* etc

section GroupWithZero

variable [GroupWithZero B]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change


## Implementation details
The definition of `range₀` (as a `Submonoid B`) simply requires that `B` be a nontrivial
`CancelMonoidWithZero`, and no assumption neither on `A` nor on `f` is needed; that `B` is a
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
`CancelMonoidWithZero`, and no assumption neither on `A` nor on `f` is needed; that `B` is a
`CancelMonoidWithZero`, and no assumption on either `A` or`f` is needed; that `B` is a

(sounds a bit better to this native speaker)

Comment on lines +49 to +53
/-- For a map with codomain a `MonoidWithZero`, this is a smallest
`GroupWithZero`, that contains the invertible elements in the image.

See `MonoidHomWithZero.mem_range₀_iff_of_comm` for another characterization
of `range₀ f` when `B` is commutative. -/
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The codomain is a GroupWithZero not a MonoidWithZero and a simpler way of saying "this is a smallest
GroupWithZero, that contains the invertible elements in the image." is "this is the smallest group with zero containing the image".

My instinct is that that the "mathlib way" to do this is just to define the lattice of subgroupwithzeros of a groupwithzero and then define this to be the SubgroupWithZero.closure of the range, rather than packing all of this stuff into carrier and then having to write such a complicated proof of mul_mem'.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Your instinct is correct, but this is a side PR for some other aim (correcting the definition of the valuation on topologies) and I fear it will take us too far away.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

After some discussions with @faenuccio in Cambridge last week we decided that the best way to proceed is actually to define the value group of a valuation. We don't have this! We have something called ValueGroup but it's a group with zero and it's only defined under certain conditions. The value group of a valuation should be a subgroup of the group of units of the target groupwithzero:

import Mathlib

namespace Valuation

variable {R Γ₀ : Type*} [LinearOrderedCommMonoidWithZero Γ₀] [Ring R] (v : Valuation R Γ₀)

def ValueGroup : Subgroup Γ₀ˣ := .closure {γ : Γ₀ˣ | ∃ r, v r = γ}

This should hopefully (a) be easier to work with than the definition currently in this PR (b) avoid the large amount of boilerplate which I had previously suggested and (c) give an easy definition of Discrete, which as far as I can see is the only thing currently holding up the definition of Valued.LocalField, the proposed definition of a local field which extends Valued.

NB: the plan currently is to have a second definition of a local field which does not come equipped with a preferred valuation, but for this we need the "module" of a locally compact ring: this is currently waiting on #25829 .

@riccardobrasca riccardobrasca added the WIP Work in progress label Jun 11, 2025
@faenuccio faenuccio added the closed-due-to-inactivity Inactive PR (unclear if adoption would be valuable) label Jul 3, 2025
@faenuccio faenuccio closed this Jul 3, 2025
@YaelDillies YaelDillies deleted the ACLFN/Range branch August 15, 2025 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

closed-due-to-inactivity Inactive PR (unclear if adoption would be valuable) t-algebra Algebra (groups, rings, fields, etc) WIP Work in progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants