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

Do not make context variables non-erased #5341

Closed
nad opened this issue Apr 21, 2021 · 1 comment · Fixed by #5343
Closed

Do not make context variables non-erased #5341

nad opened this issue Apr 21, 2021 · 1 comment · Fixed by #5343
Assignees
Labels
erasure type: bug Issues and pull requests about actual bugs
Milestone

Comments

@nad
Copy link
Contributor

nad commented Apr 21, 2021

This issue has been broken out of issue #4525.

Agda accepts the following code:

postulate
  F : @0 Set  Set

G : @0 Set  Set
G A = F (λ {  A })

The reason why this code is accepted is that when an erased argument is checked, then Agda makes all variables in the context non-erased:

case unEl t0' of
Pi (Dom{domInfo = info', domName = dname, unDom = a}) b
| let name = bareNameWithDefault "_" dname,
sameHiding info info'
&& (visible info || maybe True (name ==) mx) -> do
u <- lift $ applyModalityToContext info' $ do

Thus, when the pattern-matching lambda is checked, the variable A is treated as non-erased.

The following code is rejected, because Agda does not make the variables in the context non-erased:

@0 F : @0 Set  Set
F A = λ {  A }

I suggest that we stop changing the context, and instead keep track of whether a term is in an erased context or not. (The TCEnv's envModality field is already supposed to keep track of this.)

@nad nad added type: bug Issues and pull requests about actual bugs erasure labels Apr 21, 2021
@nad nad added this to the 2.6.2 milestone Apr 21, 2021
nad added a commit that referenced this issue Apr 21, 2021
By applyModalityToContext or applyQuantityToContext.

Furthermore Agda.Interaction.BasicOps.typeInCurrent infers types in an
erased setting, so that one can infer the types of erased variables
and definitions. (Previously one could only do this for erased
variables.)
@nad nad linked a pull request Apr 21, 2021 that will close this issue
nad added a commit that referenced this issue Apr 22, 2021
By applyModalityToContext or applyQuantityToContext.

Furthermore Agda.Interaction.BasicOps.typeInCurrent infers types in an
erased context, so that one can infer the types of erased variables
and definitions in goals that are not in an erased context. (Previously
one could only do this for erased variables.)
@nad nad closed this as completed in #5343 Apr 22, 2021
nad added a commit that referenced this issue Apr 22, 2021
By applyModalityToContext or applyQuantityToContext.

Furthermore Agda.Interaction.BasicOps.typeInCurrent infers types in an
erased context, so that one can infer the types of erased variables
and definitions in goals that are not in an erased context. (Previously
one could only do this for erased variables.)
@nad nad self-assigned this Jun 2, 2021
nad added a commit that referenced this issue Jun 2, 2021
By inverseApplyModality, which was renamed to
inverseApplyModalityButNotQuantity.
@nad
Copy link
Contributor Author

nad commented Jun 2, 2021

I found a related problem, and I hope I have a fix for it.

@nad nad reopened this Jun 2, 2021
nad added a commit that referenced this issue Jun 2, 2021
By inverseApplyModality, which was renamed to
inverseApplyModalityButNotQuantity.
nad added a commit that referenced this issue Jun 3, 2021
nad added a commit that referenced this issue Jun 3, 2021
By inverseApplyModality, which was renamed to
inverseApplyModalityButNotQuantity.
nad added a commit that referenced this issue Jun 3, 2021
@nad nad closed this as completed Jun 3, 2021
jespercockx added a commit to jespercockx/agda that referenced this issue Dec 8, 2022
…ted in the codomain

This reverses the undoing of my initial fix of agda#3853.

References:
- My original fix: agda@37e8d81
- Undoing of my original fix: agda@78b956b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
erasure type: bug Issues and pull requests about actual bugs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant