Comments (7)
Looks like a bad interaction between module application and generalised variables.
open import Agda.Primitive
module P {l} (A : Set l) where
postulate f : A → A
record _∋_ {l} (A : Set l) (x : A) : Set where
variable l : Level
works : (X : Set l) (open P X) → (X → X) ∋ f
works = _
module _ (X : Set l) (open P X) where
fails : (X → X) ∋ f
fails = _
-- X !=< Issue6916.GeneralizeTel
-- when checking that the expression f has type X → X
Inside the module we think f
has type (genTel : Issue6916.GeneralizeTel) (X₁ : Set l₁) → X₁ → X₁
. Interestingly it works fine when in a type signature instead of a module telescope.
And this example fails also in 2.6.1 so the sort comparison is a red herring.
from agda.
Briefly, the way generalisation works is that we type check the type or telescope to be generalised in the context of a single variable genTel
of type GeneralizeTel
, a freshly generated as yet undetermined record type. When generalisation is complete we fill in the record type with the variables being generalised over and compute a substitution from the context with genTel
to the "real" context containing the generalised variables. When generalising a module telescope we apply this substitution to let bindings from the telescope to make sure they live in the correct context when checking the module body. This part is missing for modules created in the telescope.
For let bindings, this is easy because they are ephemeral local things, but for modules it's a bit trickier. What we need to do is create new modules applying the genTel
substitution to the modules created inside the telescope, and make sure the scope checker is pointing to these modules instead of the ones from the telescope when checking the body.
Given that this is a nontrivial fix and it hasn't ever worked I think it's best to not hold up 2.6.4.1 over it.
from agda.
Seems to be some bad interaction between generalization and sort inference. Debug output with -v tc.sort:60
:
sortOf Issue6916.GeneralizeTel
sortOfE
a = {A = A₁ : Set} → Set
hd = Issue6916.GeneralizeTel
e = $ {_}
sortOf Level
sortOf Level
sortOf Issue6916.GeneralizeTel
sortOfE
a = {A = A₁ : Set} → Set
hd = Issue6916.GeneralizeTel
e = $ {_}
sortOf Level
sortOf Level
sortOf Level
sortOf Level
sortOf Rec _13
sortOfE
a = {A = A₁ : Set} (ℓ₄ : _3) → Set₁
hd = Rec
e = $ {_}
sortOfE
a = (ℓ₄ : _3) → Set₁
hd = Rec
e = $ _13
sortOf Rec _13
sortOfE
a = {A = A₁ : Set} (ℓ₄ : _3) → Set₁
hd = Rec
e = $ {_}
sortOfE
a = (ℓ₄ : _3) → Set₁
hd = Rec
e = $ _13
sortOf {a : record { .generalizedField-ℓ₃ = _ }} → IsS _22 a → Set
sortOf record { .generalizedField-ℓ₃ = _ }
So somehow the sortOf
function is getting a pi type where the type of the domain is a record
value, which is not a valid type.
from agda.
Running the test with -v tc:50 -v tc.sig.param:90
the first suspicious part of the output is this:
checkApplication
hd = extract
args = f ?
e = extract (f ?)
t = ?1
computing module parameters of Issue6916._._
cxt = {A = A₁ : Set} {ℓ₃ = ℓ₄ : Level} (r₁ : Rec _13)
sub = emptyS, @2, Issue6916._.mkGeneralizeTel {@1}
n = 1
tel = [{(A, Set)}]
args = {Issue6916._.mkGeneralizeTel {@1}}
instDef in Issue6916._.Test._: Issue6916._._.extract {A}
inferDef extract
absolute type: {A : Set} {genTel : Issue6916.GeneralizeTel}
(r : Rec _13) {a : A} →
r .Rec.IsS a → Set
instantiated type: {genTel : Issue6916.GeneralizeTel}
(r₁ : Rec _13) {a : record { .generalizedField-ℓ₃ = _ }} →
r₁ .Rec.IsS a → Set
In the last line, there is the domain {a : record { .generalizedField-ℓ₃ = _ }}
which is ill-formed because a record
expression is not a type.
I'm not familiar enough with the generalization code (or perhaps my brain is just too tired because it's Friday afternoon) so I don't really see exactly what's going wrong. Perhaps @UlfNorell could take a look?
from agda.
Still works in 2.6.1 (producing unsolved metas).
from agda.
Bisection says: d867f57 is the first bad commit (ping @jespercockx)
Date: Tue Aug 25 12:38:04 2020 +0200
[ fix #4615 ] Enable --no-sort-comparison by default
The option --no-sort-comparison
has been removed, so there is no --sort-comparison
to turn on to try to recover the old behavior.
from agda.
Is #6770 a duplicate of this?
from agda.
Related Issues (20)
- REWRITE rule with confluence, inconsistencies with documentation and error messages HOT 3
- Agda build flags appear as "automatic", but they are all "manual" HOT 1
- Mimer triggers __IMPOSSIBLE__ in my homework assignment HOT 3
- Warning "there are two interface files" should not be serialized
- Internal error in generate-helper (C-c C-h) HOT 1
- Preserve let-bindings when pretty-printing HOT 2
- Mutually recursive definition doesn't recognize data constructor defined later HOT 4
- Mimer doesn't check existing constraints HOT 4
- Instance resolution runs too late, leads to `with`-abstraction failure HOT 18
- Test suite needs to be run with debug printing enabled HOT 1
- Internal error in Mimer with module parameter and matching
- Instance resolution failure in Agda 2.6.4 HOT 6
- Mimer drops part of the solution with module parameter
- Citation.cff HOT 1
- Prune the `Makefile` HOT 7
- Delete the GitHub Wiki HOT 3
- Migrate the Chalmers Wiki HOT 4
- Prune `Setup.hs` HOT 5
- Reorganize `HACKING.md`
- Merge `.authorspellings` and `.mailmap` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from agda.