Skip to content

feat(Combinatorics/Quiver): induced quivers - #45032

Open
mkaratarakis wants to merge 2 commits into
leanprover-community:masterfrom
mkaratarakis:quiver-induced
Open

mkaratarakis wants to merge 2 commits into
leanprover-community:masterfrom
mkaratarakis:quiver-induced

Conversation

@mkaratarakis

@mkaratarakis mkaratarakis commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Quiver.induce, the quiver induced on a set of vertices (cf. SimpleGraph.induce), and Quiver.Path.induce, which turns a path staying inside the set into a path in the induced quiver. Also Quiver.Path.vertices_mapPath, the vertices of a path mapped along a prefunctor.


Motivation: the quiver of the submatrix of a matrix on a set of indices S is the quiver induced on S. The Perron–Frobenius work (#39918) uses this to turn paths inside S into paths of the whole quiver that stay in S.

Split from #39916.

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

PR summary 47ce438a37

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference
Mathlib.Combinatorics.Quiver.Induced (new file) 490

Declarations diff (regex)

+ inducePrefunctor
+ mapPath_inducePrefunctor_mem_vertices
+ vertices_mapPath
+ vertices_mapPath_inducePrefunctor
++ induce

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 47ce438).

  • +6 new declarations
  • −0 removed declarations
+Quiver.Path.induce
+Quiver.Path.mapPath_inducePrefunctor_mem_vertices
+Quiver.Path.vertices_mapPath
+Quiver.Path.vertices_mapPath_inducePrefunctor
+Quiver.induce
+Quiver.inducePrefunctor

No changes to strong technical debt.

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

Current commit 47ce438a37
Reference commit bdece672cb

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.py 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 t-combinatorics Combinatorics label Oct 19, 2026

@YaelDillies YaelDillies left a comment

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.

Can you provide motivation for this in the PR description?

@YaelDillies YaelDillies added the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Oct 19, 2026
@YaelDillies YaelDillies self-assigned this Oct 19, 2026
@mkaratarakis

Copy link
Copy Markdown
Contributor Author

Added the motivation to the description.

@mkaratarakis

Copy link
Copy Markdown
Contributor Author

-awaiting-author

@github-actions github-actions Bot removed the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Oct 19, 2026
Comment on lines +174 to +176
induction p with
| nil => simp
| cons p e ih => simp [ih]

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.

Suggested change
induction p with
| nil => simp
| cons p e ih => simp [ih]
induction p <;> simp [*]

/-- A path in `V` whose vertices stay in `S` induces a path in the induced quiver on `S`. -/
def induce {i j : V} (p : Path i j) (hp : ∀ k, k ∈ p.vertices → k ∈ S) :
letI : Quiver S := Quiver.induce S
Path (⟨i, hp i (start_mem_vertices p)⟩ : S) (⟨j, hp j (end_mem_vertices p)⟩ : S) := 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.

Suggested change
Path (⟨i, hp i (start_mem_vertices p)⟩ : S) (⟨j, hp j (end_mem_vertices p)⟩ : S) := by
Path (⟨i, hp i (start_mem_vertices p)⟩ : S) (⟨j, hp j (end_mem_vertices p)⟩ : S) := by
Suggested change
Path (⟨i, hp i (start_mem_vertices p)⟩ : S) (⟨j, hp j (end_mem_vertices p)⟩ : S) := by
Path (V := S) ⟨i, hp i (start_mem_vertices p)⟩ ⟨j, hp j (end_mem_vertices p)⟩ := by

probably more readable

Comment on lines +38 to +42

/-- The vertices of `mapPath` on the inclusion are those of the path, viewed in `V`. -/
lemma vertices_mapPath_inducePrefunctor (p : Path i j) :
((inducePrefunctor S).mapPath p).vertices = p.vertices.map Subtype.val :=
vertices_mapPath _ p

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.

This lemma isn't in simp normal form. Once you normalise it, it becomes tautological, so I would drop it

Comment on lines +44 to +46
/-- Vertices of `mapPath` on the inclusion lie in `S`. -/
lemma mapPath_inducePrefunctor_mem_vertices {v : V} (p : Path i j)
(hv : v ∈ ((inducePrefunctor S).mapPath p).vertices) : v ∈ S := 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.

Same here

@YaelDillies YaelDillies added the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Oct 20, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. t-combinatorics Combinatorics

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants