Skip to content

feat(Group Theory/Presentation): define group presentations#41936

Open
homeowmorphism wants to merge 5 commits into
leanprover-community:masterfrom
homeowmorphism:Group.Presentation
Open

feat(Group Theory/Presentation): define group presentations#41936
homeowmorphism wants to merge 5 commits into
leanprover-community:masterfrom
homeowmorphism:Group.Presentation

Conversation

@homeowmorphism

@homeowmorphism homeowmorphism commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Group.Presentation packages a chosen presentation of a given group G: a generating family together with relators (words r, each read as r = 1) whose generated normal subgroup is exactly the kernel of FreeGroup.lift val : FreeGroup α →* G. This the complementary to PresentedGroup rels, which constructs the group presented by a set of generators and relations.


PR #33233 by @jazzits previously was made to implement this feature but I am making a new PR due to inactivity. I have credited the original author.

Claude Fable assisted heavily in the making on this API, but I have done my best to review and steer it before putting this out.

Open in Gitpod

@homeowmorphism
homeowmorphism marked this pull request as draft July 19, 2026 22:33
@mathlib-bors

mathlib-bors Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

This pull request is now in draft mode. No active bors state needed cleanup.

While this PR remains draft, bors will ignore commands on this PR. Mark it ready for review before using commands like bors r+ or bors try.

@github-actions

Copy link
Copy Markdown

🚨 PR Title Needs Formatting

Please update the title to match our commit style conventions.

Errors from script:

labels are []
error: a PR's scope must not contain spaces
Details on the required title format

The title should fit the following format:

<kind>(<optional-scope>): <subject>

<kind> is:

  • feat (feature)
  • fix (bug fix)
  • doc (documentation)
  • style (formatting, missing semicolons, ...)
  • refactor
  • test (when adding missing tests)
  • chore (maintain)
  • perf (performance improvement, optimization, ...)
  • ci (changes to continuous integration, repo automation, ...)

<optional-scope> is a name of module or a directory which contains changed modules.
This is not necessary to include, but may be useful if the <subject> is insufficient.
The Mathlib directory prefix is always omitted.
For instance, it could be

  • Data/Nat/Basic
  • Algebra/Group/Defs
  • Topology/Constructions

<subject> has the following constraints:

  • do not capitalize the first letter
  • no dot(.) at the end
  • use imperative, present tense: "change" not "changed" nor "changes"

@github-actions github-actions Bot added the t-group-theory Group theory label Jul 19, 2026
@github-actions

github-actions Bot commented Jul 19, 2026

Copy link
Copy Markdown

PR summary 5a49e3f7dd

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference
Mathlib.GroupTheory.Presentation (new file) 1204

Declarations diff (regex)

+ Group.Generators
+ Group.Presentation
+ Group.fg_iff_nonempty_finite_generators
+ Group.isFinitelyPresented_iff_nonempty_finite_presentation
+ fg
+ instance [Finite ρ] : Finite P.relSet := P.relSet_finite.to_subtype
+ isFinitelyPresented
+ ker_lift
+ lift
+ lift_eq_one_of_mem_relSet
+ lift_of
+ lift_rel
+ lift_surjective
+ lift_surjective'
+ ofLiftSurjective
+ presentedGroupEquiv
+ presentedGroupEquiv_of
+ relSet
+ relSet_finite
+ rel_mem_relSet
+ self
+ val_ofLiftSurjective
+ val_self
++ range_lift_eq_top

You can run this locally as follows
## from your `mathlib4` directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci

## summary with just the declaration names:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh <optional_commit>

## more verbose report:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh long <optional_commit>

The doc-module for scripts/pr_summary/declarations_diff.sh in the mathlib-ci repository contains some details about this script.

Declarations diff (Lean)

Lean-aware diff — post-build, computed from the Lean environment (commit 5a49e3f).

  • +52 new declarations
  • −0 removed declarations
+Group.Generators
+Group.Generators.casesOn
+Group.Generators.closure_eq_top
+Group.Generators.ctorIdx
+Group.Generators.fg
+Group.Generators.lift_surjective
+Group.Generators.mk
+Group.Generators.mk.inj
+Group.Generators.mk.injEq
+Group.Generators.mk.noConfusion
+Group.Generators.mk.sizeOf_spec
+Group.Generators.noConfusion
+Group.Generators.noConfusionType
+Group.Generators.ofLiftSurjective
+Group.Generators.range_lift_eq_top
+Group.Generators.rec
+Group.Generators.recOn
+Group.Generators.self
+Group.Generators.val
+Group.Generators.val_ofLiftSurjective
+Group.Generators.val_self
+Group.Presentation
+Group.Presentation.casesOn
+Group.Presentation.ctorIdx
+Group.Presentation.instFiniteElemFreeGroupRelSet
+Group.Presentation.isFinitelyPresented
+Group.Presentation.ker_eq_normalClosure
+Group.Presentation.ker_lift
+Group.Presentation.lift
+Group.Presentation.lift_eq_one_of_mem_relSet
+Group.Presentation.lift_of
+Group.Presentation.lift_rel
+Group.Presentation.lift_surjective'
+Group.Presentation.mk
+Group.Presentation.mk.inj
+Group.Presentation.mk.injEq
+Group.Presentation.mk.noConfusion
+Group.Presentation.mk.sizeOf_spec
+Group.Presentation.noConfusion
+Group.Presentation.noConfusionType
+Group.Presentation.presentedGroupEquiv
+Group.Presentation.presentedGroupEquiv_of
+Group.Presentation.range_lift_eq_top
+Group.Presentation.rec
+Group.Presentation.recOn
+Group.Presentation.rel
+Group.Presentation.relSet
+Group.Presentation.relSet_finite
+Group.Presentation.rel_mem_relSet
+Group.Presentation.toGenerators
+Group.fg_iff_nonempty_finite_generators
+Group.isFinitelyPresented_iff_nonempty_finite_presentation

No changes to strong technical debt.

Increase in weak tech debt: (relative, absolute) = (1.00, 0.00)
Current number Change Type (weak)
5015 1 exposed public sections

Current commit 5a49e3f7dd
Reference commit 4608056c77

This script lives in the mathlib-ci repository. To run it locally, from your mathlib4 directory:

git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
../mathlib-ci/scripts/reporting/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).

@homeowmorphism
homeowmorphism marked this pull request as ready for review July 20, 2026 15:38
Comment thread Mathlib/GroupTheory/Presentation.lean Outdated
@tb65536 tb65536 added the LLM-generated PRs with substantial input from LLMs - review accordingly label Jul 20, 2026
with finitely many generators and finitely many relators. -/
theorem Group.isFinitelyPresented_iff_nonempty_finite_presentation :
Group.IsFinitelyPresented G ↔
∃ (α ρ : Type) (_ : Finite α) (_ : Finite ρ), Nonempty (Group.Presentation G α ρ) := by

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You way as well use Set here rather than quantifying over Type.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I wasn't able to get a nice proof with Set, I think because of the way Presentation is structured it's more natural to quantify over types unless I'm missing something?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Here's a proof attempt in case it helps. Just feels like the coersion going on here is clunky?

/-- A group is finitely presented if and only if it admits a `Group.Presentation` on a finite
generating family whose relators are indexed by a finite set of words in those generators, which
then indexes itself. -/
theorem Group.isFinitelyPresented_iff_nonempty_finite_presentation :
    Group.IsFinitelyPresented G ↔
      ∃ (S : Set G) (_ : Finite S) (R : Set (FreeGroup S)) (_ : Finite R),
        Nonempty (Group.Presentation G S R) := by
  constructor
  · rintro h
    obtain ⟨n, φ, hφ, hker⟩ := h.out
    obtain ⟨v, rfl⟩ := FreeGroup.lift.surjective φ
    obtain ⟨t, htfin, ht⟩ :
        (FreeGroup.lift (Subtype.val : Set.range v → G)).ker.IsFinitelyNormallyGenerated :=
      Subgroup.IsFinitelyNormallyGenerated.of_comp_surjective
        (π := FreeGroup.map (Set.rangeFactorization v))
        (by rwa [FreeGroup.lift_comp_map, Set.rangeFactorization_eq])
        (FreeGroup.map_surjective Set.rangeFactorization_surjective)
    exact ⟨_, (Set.finite_range v).to_subtype, t, htfin.to_subtype,
      ⟨{ val := Subtype.val
         closure_eq_top := by
           rw [Subtype.range_coe, ← FreeGroup.range_lift_eq_closure]
           exact MonoidHom.range_eq_top.mpr hφ
         rel := Subtype.val
         ker_eq_normalClosure := by rw [Subtype.range_coe]; exact ht.symm }⟩⟩
  · rintro ⟨S, hS, R, hR, ⟨P⟩⟩
    exact P.isFinitelyPresented

Comment thread Mathlib/GroupTheory/Presentation.lean Outdated
Comment thread Mathlib/GroupTheory/Presentation.lean Outdated
Comment thread Mathlib/GroupTheory/Presentation.lean Outdated
@tb65536 tb65536 self-assigned this Jul 20, 2026
homeowmorphism and others added 4 commits July 20, 2026 17:21
…f a lemma

Reword the `Group.Presentation` structure and `ker_eq_normalClosure`
docstrings for clarity, simplify the `isFinitelyPresented_iff` docstring,
and change `presentedGroupEquiv_of` from `theorem` to `lemma`.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

LLM-generated PRs with substantial input from LLMs - review accordingly t-group-theory Group theory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants