Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor coproduct equivalences #1137

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

morphismz
Copy link
Contributor

@morphismz morphismz commented May 5, 2024

Refactors some equivalences related to coproducs and adds one new definition.

  • removes the abstract block around is-equiv-coproduct in foundation.functorality-coproduct-types, thus allowing map-inv-equiv (equiv-coproduct e e') to compute to map-coproduct (map-inv-equiv e) (map-inv-equiv e'). We keep abstract blocks around the proof that the inverse map is a section and retraction

  • computes the underlying map of the equivalence Fin-add-ℕ in univalent-combinatorics.coproduct-types

Copy link
Collaborator

@fredrik-bakke fredrik-bakke 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 the contribution, and apologies for taking so long! I have a couple of requests on naming and good-practice definitions.

Comment on lines +199 to +200
( map-coproduct (map-equiv f) (map-equiv g)) ∘
( map-coproduct (map-inv-equiv f) (map-inv-equiv g)) ~ id
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks to me like you should define

map-equiv-coproduct = map-coproduct (map-equiv f) (map-equiv g)

and

map-inv-equiv-coproduct = map-coproduct (map-inv-equiv f) (map-inv-equiv g)

And then this should be

is-section map-equiv-coproduct map-inv-equiv-coproduct

Comment on lines +216 to +217
( map-coproduct (map-inv-equiv f) (map-inv-equiv g)) ∘
( map-coproduct (map-equiv f) (map-equiv g)) ~ id
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same as above

is-retraction map-equiv-coproduct map-inv-equiv-coproduct

@@ -69,6 +72,29 @@ inr-coproduct-Fin k l = map-coproduct-Fin k l ∘ inr
compute-inl-coproduct-Fin :
(k : ℕ) → inl-coproduct-Fin k 0 ~ id
compute-inl-coproduct-Fin k x = refl

map-Fin-add-ℕ :
Copy link
Collaborator

Choose a reason for hiding this comment

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

I see that the original name Fin-add-ℕ is not your fault, but having a capitalized word (Fin) before an uncapitalized one (add) is a sure sign that the naming should be improved.

I think better names for the entries in this file would be, in order,

  • coproduct-Fin -> compute-coproduct-Fin
  • map-coproduct-Fin -> map-compute-coproduct-Fin
  • Fin-add-ℕ -> inv-compute-coproduct-Fin, and then please add a definition for map-inv-compute-coproduct-Fin
  • inl-coproduct-Fin is fine
  • inr-coproduct-Fin is fine
  • map-Fin-add-ℕ -> map-compute-map-inv-compute-coproduct-Fin (since the maps are not definitionally the same)
  • compute-map-Fin-add-ℕ -> compute-map-inv-compute-coproduct-Fin

Could you please make these renamings as part of this pull request?

( map-coproduct (map-Fin-add-ℕ k l) id)

compute-map-Fin-add-ℕ :
(k l : ℕ) → map-equiv (Fin-add-ℕ k l) ~ map-Fin-add-ℕ k l
Copy link
Collaborator

Choose a reason for hiding this comment

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

After my above suggested renamings

Suggested change
(k l : ℕ) → map-equiv (Fin-add-ℕ k l) ~ map-Fin-add-ℕ k l
(k l : ℕ) →
map-inv-compute-coproduct-Fin k l ~
map-compute-map-inv-compute-coproduct-Fin k l

@morphismz
Copy link
Contributor Author

Hey @fredrik-bakke No worries for the delay, and sorry for the delay on my end :). I'll implement these changes this weekend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants