Commit 2026-01-30 12:44 52e75dc9
View on Github →feat(CategoryTheory/Iso): use to_dual for X ≅ Y (#34008)
This PR uses to_dual for isomorphisms in category theory.
There are two possible designs:
to_dualcould swap the arguments, turningX ≅ YintoY ≅ Xto_dualcould leave the arguments in place, and instead translateIso.homtoIso.invand vice versa I went with the second option, because I think it is more sensible. In a sense,X ≅ Yis toX ⟶ Ywhata = bis toa ≤ b, and we also do not swap the arguments ina = b, even though it would be possible. Notes:- The new
ext_invdual ofextis hard to generate automatically forto_dualfor various reasons, so it is proved manually. - When applying
simpson a definition of type_ ≅ _, the generated_homand_invlemmas need to be manually tagged as dual to eachother withto_dual existing, with aset_option linter.existingAttributeWarning false in. - I used
to_dual nonea few times to avoid adding too many redundant declarations to the API. - I added
no_exposetoinv, with the reason thatto_dualcannot translate proofs that unfoldinv. And if the value isn't exported, theninvalso cannot be unfolded. Nobody should rely on this anyways since it is just aClassical.choose. Two proofs had to be fixed as a result, which was easy to do withgrind. - I removed the outdated porting notes on
asIso_homandasIso_inv.