Skip to content

Conversation

@YaelDillies
Copy link
Collaborator

Copy link
Contributor

@adomani adomani left a comment

Choose a reason for hiding this comment

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

Thanks for writing this!

@riccardobrasca
Copy link
Member

Can you mention that the subobject approach has sometimes performance issues? Like what happened for the ring of integers (see #12386).

Also, I think that it is worth mentioning that the anonymous constructor can make the projections' name issue less important.

@YaelDillies
Copy link
Collaborator Author

#12386 was in fact the impetus for me to write this blogpost, but it seems that the issue has been fixed by making the discrimination keys more thorough, see #86 (comment)

I am not sure why anonymous dot notation is relevant here.

1 similar comment
@YaelDillies
Copy link
Collaborator Author

#12386 was in fact the impetus for me to write this blogpost, but it seems that the issue has been fixed by making the discrimination keys more thorough, see #86 (comment)

I am not sure why anonymous dot notation is relevant here.

@riccardobrasca
Copy link
Member

I mean ⟨x, by simp⟩ (isn't this called anonymous constructor?) to build a term of a subtype.

@YaelDillies
Copy link
Collaborator Author

Ah sure, but anonymous constructor notation is useless when working with highly nested structures such as subobjects. Eg to build a subring one needs to do \<\<\<_, _\>, _\>, _\>, which I think isn't worth the trouble unless you are trying to write very compact code.

Copy link
Contributor

@Vierkantor Vierkantor left a comment

Choose a reason for hiding this comment

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

My concerns are addressed, this is good to go as far as I'm concerned. I'll merge in a few days unless we get objections.

Copy link
Contributor

@bryangingechen bryangingechen left a comment

Choose a reason for hiding this comment

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

Are there some examples in mathlib of each design that would be illuminating to discuss?

YaelDillies and others added 3 commits January 12, 2026 19:36
Co-authored-by: Bryan Gin-ge Chen <[email protected]>
@bryangingechen
Copy link
Contributor

Thanks!

@bryangingechen bryangingechen merged commit 58d3648 into master Jan 13, 2026
1 check passed
@bryangingechen bryangingechen deleted the tradeoff-of-defining-types-as-subobjects branch January 13, 2026 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants