Skip to content

[Merged by Bors] - refactor(RelCat): use a type synonym for homs#25593

Closed
YaelDillies wants to merge 3 commits intomasterfrom
structure_rel_cat_hom
Closed

[Merged by Bors] - refactor(RelCat): use a type synonym for homs#25593
YaelDillies wants to merge 3 commits intomasterfrom
structure_rel_cat_hom

Conversation

@YaelDillies
Copy link
Copy Markdown
Contributor

This improves automation and follows the new pattern for concrete categories (although RelCat is not a concrete category).


Open in Gitpod

This improves automation and follows the new pattern for concrete categories (although `RelCat` is *not* a concrete category).
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jun 8, 2025

PR summary d1c754c26e

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

+ Hom
+ ext
+ inhabited
+ instLargeCategory
- RelCat.inhabited
- hom_ext
- rel
- rel_comp
- rel_id

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

map_id X := by
ext x y
exact Eq.comm
map_comp {X Y Z} f g := by
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.

Is this something that aesop_cat previously couldn't solve, or did we just not ask it to?

Copy link
Copy Markdown
Contributor Author

@YaelDillies YaelDillies Jun 8, 2025

Choose a reason for hiding this comment

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

I just tried and no it couldn't:

could not synthesize default value for field 'map_id' of 'CategoryTheory.Functor' using tactics
RelCat.lean:138:36
tactic 'aesop' failed, failed to prove the goal after exhaustive search.
Initial goal:
  
⊢ ∀ (X : RelCatᵒᵖ), (fun x y ↦ unop (𝟙 X) y x) = 𝟙 (unop X)

Remaining goals after safe rules:
  
X : RelCatᵒᵖ
⊢ (fun x y ↦ unop (𝟙 X) y x) = 𝟙 (unop X)

It was precisely getting stuck at seeing X → X → Prop through X ⟶ X to apply extensionality.

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.

Could you mention ext in the description? No need to give the full error.

@[ext] lemma ext (f g : X ⟶ Y) (h : f.rel = g.rel) : f = g := by
obtain ⟨R⟩ := f; obtain ⟨S⟩ := g; congr

@[simp] protected theorem rel_id (X : RelCat.{u}) : rel (𝟙 X) = (· = ·) := rfl
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'm curious if simps on the instance generates these, but I'm happy to leave things as is either way.

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.

Indeed it can, but that means they are outside the Hom namespace. Is that okay?


open Rel

attribute [local simp] Rel.comp Rel.inv flip
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'd be tempted to wrap these with in just around the declaration that uses them.

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.

Either that, or apply simp globally

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.

This is a patch until #25587 is in: After that second PR is merged, they won't be needed anymore 😉

@eric-wieser
Copy link
Copy Markdown
Member

bors merge

Indeed, this seems to match the pattern being established, and the aesop improvement is a nice example of the change helping.

Thanks!

@ghost ghost added the ready-to-merge This PR has been sent to bors. label Jun 15, 2025
mathlib-bors bot pushed a commit that referenced this pull request Jun 15, 2025
This improves automation and follows the new pattern for concrete categories (although `RelCat` is *not* a concrete category).
@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Jun 15, 2025

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title refactor(RelCat): use a type synonym for homs [Merged by Bors] - refactor(RelCat): use a type synonym for homs Jun 15, 2025
@mathlib-bors mathlib-bors bot closed this Jun 15, 2025
@mathlib-bors mathlib-bors bot deleted the structure_rel_cat_hom branch June 15, 2025 11:44
Rida-Hamadani pushed a commit to Rida-Hamadani/mathlib4 that referenced this pull request Jun 24, 2025
…5593)

This improves automation and follows the new pattern for concrete categories (although `RelCat` is *not* a concrete category).
callesonne pushed a commit to callesonne/mathlib4 that referenced this pull request Jul 24, 2025
…5593)

This improves automation and follows the new pattern for concrete categories (although `RelCat` is *not* a concrete category).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge This PR has been sent to bors. t-category-theory Category theory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants