-
Notifications
You must be signed in to change notification settings - Fork 364
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
Internal error in rewriting with --two-level
#5944
Comments
I think rewriting involving SSet was never implemented (check the blame):
This is the original PR: |
Okay, so I shouldn't expect it to work? That's fair, although it might be helpful to raise an error like "Rewriting with 2LTT not implemented" as soon as the user tries to combine the flags FWIW, I haven't gotten any errors with it until now. And it's easy to modify the example in other ways to remove the error while keeping the SSets around, e.g.: {-# OPTIONS --type-in-type --rewriting --two-level #-}
module Test where
open import Agda.Primitive public
postulate
Tel : SSet
ε : Tel
_≡_ : {A : SSet} (a : A) → A → SSet
el : Tel → SSet
coe← : {A B : Tel} → (A ≡ B) → el B → el A
[] : el ε
ID : (Δ : Tel) → Tel
ID′ : {Δ : Tel} (Θ : el Δ → Tel) → Tel
ID′ε : {Δ : Tel} → ID′ {Δ} (λ _ → ε) ≡ ε
{-# BUILTIN REWRITE _≡_ #-}
{-# REWRITE ID′ε #-}
postulate
ID′-CONST : {Θ : Tel} (Δ : Tel) →
ID′ {Θ} (λ _ → Δ) ≡ ID Δ
ID′-CONST-ε : {Θ : Tel} (δ₂ : el (ID ε)) →
coe← (ID′-CONST {Θ} ε) δ₂ ≡ []
{-# REWRITE ID′-CONST-ε #-} I see on that line you linked to that an error is raised whenever SSet is encountered while doing something involving rewriting, but without knowing anything about the internals of rewriting I can't tell exactly what that is. Evidently whatever this something is, it's possible to do a good deal of rewriting that "involves" SSet without it, at least for an intuitive meaning of "involves". |
@mikeshulman : {-# OPTIONS --type-in-type --rewriting --two-level #-}
open import Agda.Primitive public
postulate
Tel : SSet
ε : Tel
_≡_ : {A : SSet} (a : A) → A → SSet
cong : (A B : SSet) (f : A → B) {x y : A} (p : x ≡ y) → f x ≡ f y
coe← : (A B : SSet) → (A ≡ B) → B → A
el : Tel → SSet
[] : el ε
ID : (Δ : Tel) → Tel
ID′ : (Δ : Tel) (Θ : el Δ → Tel) → Tel
ID′ε : (Δ : Tel) → ID′ Δ (λ _ → ε) ≡ ε
{-# BUILTIN REWRITE _≡_ #-}
{-# REWRITE ID′ε #-}
postulate
ID′-CONST : (Θ : Tel) (Δ : Tel)
→ ID′ Θ (λ _ → Δ) ≡ ID Δ
ID′-CONST-ε : (Θ : Tel) (δ₂ : el (ID ε))
→ coe← (el (ID′ Θ (λ _ → ε))) (el (ID ε)) (cong Tel (SSet lzero) el (ID′-CONST Θ ε)) δ₂ ≡ []
{-# REWRITE ID′-CONST-ε #-} As you can see, you are asking Agda to rewrite anything of the form agda/src/full/Agda/TypeChecking/Monad/Base.hs Lines 1817 to 1823 in 5a0833a
Just why the author(s) of rewriting with 2ltt thought such a case would be impossible I cannot tell. It would have been reasonable to leave a comment there explaining why they think it is impossible, or a TODO. But most coders seem to have commentophobia... What you can try is to extend the type of |
@andreasabel let me try to explain the presence of The good news is that there is no reason to believe there are any difficulties with supporting the combination of |
Ah, I see; the problem arises with rewrite rules whose LHS actually includes SSet as an argument to be matched against. Trying to implement it sounds like a fun way to learn more about Agda internals, but unfortunately I don't think it'd be a good use of my time right now. Maybe I'll come back to it later. Thanks! As long as this remains unimplemented, I do still think it would be nice to give a more informative error message. |
Ok I give it a shot... |
Thanks!! |
--two-level
As part of the same development from #5923, I've run into another internal error. This one seems to involve some interaction with the
--two-level
flag, since it goes away if I remove that flag and change theSSet
s toSet
.In master (2.6.3-5a0833a) this produces
I realize
--two-level
is very experimental, but I thought I'd report this anyway.The text was updated successfully, but these errors were encountered: