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

feat: profunctor optics #290

Closed
wants to merge 1 commit into from
Closed

feat: profunctor optics #290

wants to merge 1 commit into from

Conversation

EdAyers
Copy link
Member

@EdAyers EdAyers commented Jun 22, 2022

A port of some of https://hackage.haskell.org/package/profunctor-optics-0.0.2/docs/Data-Profunctor-Optic-Traversal.html

Just for fun.

How should composition work?

If anyone has a good idea for how to get optic composition to work smoothly I'd love to hear it!

Currently all optics have the form

def Optic π A B S T := ∀ ⦃P⦄ [c : π P], P A B → P S T

where π is one of

π optic
Profunctor Iso
Strong Lens
Choice Prism
Affine Modification (aka traversal0)
Traversing Traversal
Mapping Setter
Closed Grate

Given o₁ : Optic π₁ A B S T and o₂ : Optic π₂ S T X Y, we compose these o₂ □ o₁ : Optic (π₁ ⊓ π₂) A B X Y. Where the meet operation is the tricky part that I don't know how to define nicely.

So for example composing a l : Lens A B S T and a p : Prism S T X Y would require taking the meet of Choice P and Strong P which is Affine P. But ideally Lean would display the type as p □ l : Modification A B X Y.

I'm essentially trying to get Lean elaborator to compute the joins on this lattice:

source

@bollu
Copy link
Collaborator

bollu commented Jun 29, 2022

It's cool to see that optics have a place in mathlib4. Could I have some context for what need they fulfil in the library?

@EdAyers
Copy link
Member Author

EdAyers commented Jun 29, 2022

They are just interesting on their own really. I was hoping to prove some stuff about lawful optics eventually. I don't know if we are still treating mathlib4 is a monorepo with all lean code in like mathlib3. I guess it could be its own package.

@semorrison semorrison added the awaiting-author A reviewer has asked the author a question or requested changes label Jul 27, 2022
@semorrison semorrison added the merge-conflict The PR has a merge conflict with master, and needs manual merging. label Nov 24, 2022
@bors bors bot changed the base branch from master to ScottCarnahan/BinomialRing2 September 17, 2023 03:24
@semorrison semorrison changed the base branch from ScottCarnahan/BinomialRing2 to master September 17, 2023 12:19
@jcommelin
Copy link
Member

This pull request has not seen any activity for quite a while, and it does not pass all CI checks. For these reasons, I am closing it now.

If you are still interested in getting this PR merged, please re-open the PR, update the branch, and make sure that all CI checks pass, Please label the PR with awaiting-review when ready.

@jcommelin jcommelin closed this Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-author A reviewer has asked the author a question or requested changes merge-conflict The PR has a merge conflict with master, and needs manual merging.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants