-
Notifications
You must be signed in to change notification settings - Fork 345
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
Printing records in eta-contracted form let them look ill-typed sometimes #361
Comments
Looks almost as if this reduction is the result of an eta-contraction
Original comment by |
To precise the report, the problem appears only in the form with a definition
R.p {b} (relabel r) reduces to R.p {b} r The manually expanded term
reduces correctly to R.p {a} r. Must be that the body of relabel is eta-contracted or something like that. Original comment by |
The buggy behavior disappears if I skip eta-contraction of function bodies. cs <- instantiateFull =<< mapM rebindClause cs in Def.hs/checkFunDef. rebindClause is the identity, instantiateFull eta-contracts. Without this line the body of relabel is kept as is and not eta-contracted to r. As a side effect, test/fail/Issue259.agda now type-checks. How can I document this issue in the test suite? How can I write a test-case that ensures that a certain eta-contraction is not carried out? (When the type-checker works modulo eta...) Original comment by |
Original comment by
|
Undid my fix because it breaks Data.Star.Decoration of the std-lib. Original comment by |
Now this triggers an error message, which it should not. Eta-contraction for records is a solid bug: data _==_ {A : Set}(a : A) : A -> Set where
refl : a == a
postulate
A : Set
a b : A
F : A -> Set
record R (a : A) : Set where
constructor c
field
p : A
beta : (x : A) -> R.p {b} (c {b} x) == x
beta x = refl
lemma : (r : R a) -> R.p {b} (c {b} (R.p {a} r)) == R.p {a} r
lemma r = beta (R.p {a} r)
{-
a != b of type A
when checking that the expression beta (R.p {a} r) has type
_==_ {A} (R.p {b} r) (R.p {a} r)
-} Original comment by Attachments: |
Original comment by
|
The example in Comment 6 no longer triggers an error message. Original comment by |
Closing this. Original comment by
|
Original comment by
|
Original comment by |
postulate
A : Set
a b : A
record R (_ : A) : Set where
constructor c
field
p : A
postulate
r : R a
relabel : R a → R b
relabel r = c {b} (R.p {a} r)
-- Type of r: R a.
-- Type of relabel r: R b.
--
-- If we normalise relabel r we get r, which does not have type R b,
-- so it seems as if subject reduction is broken.
-- r-does-not-have-type-R-b : R b
-- r-does-not-have-type-R-b = r
Original comment by |
Original comment by
|
Original comment by
|
Here is an example using lambda. postulate
A : Set
B : A → Set
data D (x : A) : Set where
c : (B x → B x) → A → D x
test : (x : A) → D x
test = λ x → c (λ (y : B x) → y) x
-- Agda eta-contracts this to the following, which is not well-typed.
-- foo : (x : A) → D x
-- foo = c λ y → y
-- Cannot instantiate the metavariable _11 to solution x since it
-- contains the variable x which is not in scope of the metavariable
-- or irrelevant in the metavariable but relevant in the solution
-- when checking that the expression c λ y → y has type (x : A) → D x |
Now,
reduces to the ill-typed
instead of R.p {a} r
Original issue reported on code.google.com by
andreas....@gmail.com
on 12 Nov 2010 at 12:58The text was updated successfully, but these errors were encountered: