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

Cannot resolve overloaded projection _≈_ #6

Closed
Akshobhya1234 opened this issue Jan 24, 2022 · 10 comments · Fixed by #7
Closed

Cannot resolve overloaded projection _≈_ #6

Akshobhya1234 opened this issue Jan 24, 2022 · 10 comments · Fixed by #7
Assignees
Labels
blocked-by-issue enhancement New feature or request

Comments

@Akshobhya1234
Copy link
Owner

Akshobhya1234 commented Jan 24, 2022

When defining direct product of quasigroup as

quasigroup : Quasigroup a ℓ₁ → Quasigroup b ℓ₂ → Quasigroup (a ⊔ b) (ℓ₁ ⊔ ℓ₂)
quasigroup M N = record
{ Carrier = M.Carrier × N.Carrier
; = Pointwise {! M. !} {! !}
; = zip M. N.
; \ = zip M.\ N.\
; // = zip M.// N.//
; isQuasigroup = record
{ isEquivalence = ×-isEquivalence M.isEquivalence N.isEquivalence
; ∙-cong = zip M.∙-cong N.∙-cong
; \-cong = zip M.\-cong N.\-cong
; //-cong = zip M.//-cong N.//-cong
; leftDivides = (λ x y → M.leftDividesˡ , N.leftDividesˡ <> x <> y) , (λ x y → M.leftDividesʳ , N.leftDividesʳ <> x <> y)
; rightDivides = (λ x y → M.rightDividesˡ , N.rightDividesˡ <> x <> y) , (λ x y → M.rightDividesʳ , N.rightDividesʳ <> x <> y)
}
} where module M = Quasigroup M; module N = Quasigroup N

It says "Cannot resolve overloaded projection because it is not applied to a visible argument when inferring the type of M."

@JacquesCarette Can you have a look at it.

@Akshobhya1234
Copy link
Owner Author

I think I found the issue. It depends on how the quasigroup is defined in stdlib. I will create an issue in stdlib to change the definition.

@Akshobhya1234 Akshobhya1234 added this to TODO in Agda-Algebra via automation Jan 25, 2022
@Akshobhya1234 Akshobhya1234 linked a pull request Jan 25, 2022 that will close this issue
@JacquesCarette
Copy link
Collaborator

Have you tried M._≈_ instead? That's the real name of the function.

@Akshobhya1234
Copy link
Owner Author

Have you tried M._≈_ instead? That's the real name of the function.

That is exactly the issue. We cannot use M._≈_.

@JacquesCarette
Copy link
Collaborator

But that makes no sense - that names comes from a module, and it shouldn't be overloaded at all. Can you provide a bigger explanation?

@JacquesCarette
Copy link
Collaborator

What I don't understand is how/where two version of as in-scope in M. I can understand that that's the problem.

@Akshobhya1234
Copy link
Owner Author

What I don't understand is how/where two version of as in-scope in M. I can understand that that's the problem.

Got your question. To be honest even I am confused. The agda error will not make it clear as to where two version of is in-scope in M. (Could it be from Magma that is defined in same file?) But I think we will face similar issue when we try to define direct product for Lattice.

@Akshobhya1234
Copy link
Owner Author

But for now this issue is resolved with the current changes proposed to quasigroup in stdlib.

@JacquesCarette
Copy link
Collaborator

One way to find out is to put in a hole, and do C-c C-w (for 'where', I think), and it will tell you where the definition(s) come from. (I think the documentation says "hy in scope")

@Akshobhya1234
Copy link
Owner Author

@JacquesCarette I got the issue. We had 2 instances of _≈_ one from Quasigroup and other from RawQuasigroup when we say

open RawQuasigroup rawQuasigroup public
using (_≈_; //-rawMagma; \\-rawMagma; ∙-rawMagma)

in Quasigroup

To overcome this with we could remove _≈_ like
open RawQuasigroup rawQuasigroup public
using (//-rawMagma; \\-rawMagma; ∙-rawMagma)

@JacquesCarette
Copy link
Collaborator

Yes, that's probably a good idea.

Agda-Algebra automation moved this from TODO to Done Jan 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked-by-issue enhancement New feature or request
Projects
Development

Successfully merging a pull request may close this issue.

2 participants