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

Wrong variable name in constraints for higher constructor #3660

Closed
jespercockx opened this issue Mar 29, 2019 · 6 comments · Fixed by #6370
Closed

Wrong variable name in constraints for higher constructor #3660

jespercockx opened this issue Mar 29, 2019 · 6 comments · Fixed by #6370
Labels
cubical Cubical Agda paraphernalia: Paths, Glue, partial elements, hcomp, transp type: enhancement Issues and pull requests about possible improvements ux: error reporting Issues to do with how Agda reports errors
Milestone

Comments

@jespercockx
Copy link
Member

jespercockx commented Mar 29, 2019

This may be related to #3659, but this time it is in the unsolved constraints you get when pattern matching on a higher inductive type. Minimal example:

{-# OPTIONS --cubical #-}

open import Agda.Primitive.Cubical
open import Agda.Builtin.Cubical.Path

module _ where

data D (A : Set) : Set where
  c : A  D A
  path : (x : A)  c x ≡ c x

map : {A B : Set}  (A  B)  D A  D B
map f (c x) = c (f x)
map f (path x i) = path (f x) {!!}

Agda reports the following:

?0 : I

———— Errors ————————————————————————————————————————————————
Failed to solve the following constraints:
  path (x x₁) (?0 (f = x) (x = x₁) (i = i0)) = c (x x₁) : D B
  path (x x₁) (?0 (f = x) (x = x₁) (i = i1)) = c (x x₁) : D B

The proper constraints should be like this instead:

  path (f x) (?0 (f = f) (x = x) (i = i0)) = c (f x) : D B
  path (f x) (?0 (f = f) (x = x) (i = i1)) = c (f x) : D B
@jespercockx jespercockx added type: bug Issues and pull requests about actual bugs cubical Cubical Agda paraphernalia: Paths, Glue, partial elements, hcomp, transp labels Mar 29, 2019
@nad nad added this to the 2.6.0 milestone Mar 29, 2019
@andreasabel andreasabel added deBruijn de-Bruijn Internal problems with variable scoping ("de Bruijn indices") and removed deBruijn labels Mar 30, 2019
@jespercockx jespercockx added the not-in-changelog This issue should not be listed in the changelog. label Mar 30, 2019
@Saizan
Copy link
Contributor

Saizan commented Apr 4, 2019

I believe this is just an unfortunate printout. notice how (f = x) and (x = x₁) in the arguments to the meta.

If you give names in the type signature you get better names in the constraints:

map : {A B : Set}  (g : A  B)  (d : D A)  D B
map f (c x) = c (f x)
map f (path x i) = path (f x) { }0
Failed to solve the following constraints:
  path (g x) (?0 (f = g) (x = x) (i = i0)) = c (g x) : D B
  path (g x) (?0 (f = g) (x = x) (i = i1)) = c (g x) : D B

It would be great if we could get the user-provided names in the clause all the way to checkIApplyConfluence. However we get the clauses from the coverage checker, while the names seem most accessible from checkClause.

@Saizan Saizan added ux: error reporting Issues to do with how Agda reports errors and removed de-Bruijn Internal problems with variable scoping ("de Bruijn indices") labels Apr 4, 2019
@UlfNorell UlfNorell modified the milestones: 2.6.0, 2.6.1 Apr 10, 2019
@andreasabel andreasabel removed the not-in-changelog This issue should not be listed in the changelog. label Apr 10, 2019
@jespercockx jespercockx modified the milestones: 2.6.1, 2.6.2 Dec 1, 2019
@jespercockx jespercockx added type: enhancement Issues and pull requests about possible improvements and removed type: bug Issues and pull requests about actual bugs labels Feb 8, 2021
@jespercockx jespercockx modified the milestones: 2.6.2, 2.6.3 Feb 8, 2021
@jespercockx jespercockx modified the milestones: 2.6.3, Later Aug 26, 2022
@plt-amy
Copy link
Member

plt-amy commented Nov 29, 2022

I had forgotten about this issue, but it was actually fixed in 1fd6b9f. Constraints printed now:

Checking Test30 (/home/amelia/default/Projects/agda/Test30.agda).
Failed to solve the following constraints:
  path (f x) (?0 (f = f) (x = x) (i = i1)) = c (f x) : D B
    (blocked on _12)
  path (f x) (?0 (f = f) (x = x) (i = i0)) = c (f x) : D B
    (blocked on _12)
Unsolved interaction metas at the following locations:
  /home/amelia/default/Projects/agda/Test30.agda:15,31-35

@plt-amy plt-amy closed this as completed Nov 29, 2022
@plt-amy
Copy link
Member

plt-amy commented Nov 29, 2022

Actually, give me just a second to add a test case.

@plt-amy plt-amy reopened this Nov 29, 2022
plt-amy added a commit that referenced this issue Nov 29, 2022
plt-amy added a commit that referenced this issue Nov 29, 2022
@asr
Copy link
Member

asr commented Nov 30, 2022

I had forgotten about this issue, but it was actually fixed in 1fd6b9f.

That commit is included in 2.6.3 RC2, so I'll change the milestone to 2.6.3.

@asr asr modified the milestones: later, 2.6.3 Nov 30, 2022
@asr
Copy link
Member

asr commented Nov 30, 2022

@plt-amy, please cherry-pick the test case into the release-2.6.3 branch.

plt-amy added a commit that referenced this issue Dec 1, 2022
@plt-amy
Copy link
Member

plt-amy commented Dec 1, 2022

@asr Done, thanks for the reminder 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cubical Cubical Agda paraphernalia: Paths, Glue, partial elements, hcomp, transp type: enhancement Issues and pull requests about possible improvements ux: error reporting Issues to do with how Agda reports errors
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants