-
Notifications
You must be signed in to change notification settings - Fork 338
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 caused by addition of Checkpoints
to OpenThing
#5544
Comments
If this is the accurate error location, it means that there is an unsolved meta variable left when everything should be solved (at serialization time). |
Isn't this very strange? if a meta is unresolved, then wouldn't agda highlight the line here the meta is unresolved? I will check which field trigger this error then. |
The following are my findings:
to
Then Agda will generate a hole without crashing I |
I suppose nothing changes with |
no it still crashes with this flag. I would also like to mention that no |
Shrank to this version (self-contained, not minimal): {-# OPTIONS --without-K #-}
-- postulate
-- ANY : ∀{a} {A : Set a} → A
open import Agda.Primitive
open import Agda.Builtin.Nat renaming (Nat to ℕ; suc to suc)
open import Agda.Builtin.List using (List; []; _∷_)
open import Agda.Builtin.Sigma renaming (fst to proj₁; snd to proj₂)
∃ : ∀ {a b} {A : Set a} → (A → Set b) → Set (a ⊔ b)
∃ = Σ _
infixr 2 _×_
_×_ : ∀ {a b} (A : Set a) (B : Set b) → Set (a ⊔ b)
A × B = Σ A λ (x : A) → B
infix 4 -,_
-,_ : ∀ {a b} {A : Set a} {B : A → Set b} {x} → B x → ∃ B
-, y = _ , y
infixr 5 _++_
_++_ : ∀ {a} {A : Set a} → List A → List A → List A
[] ++ ys = ys
(x ∷ xs) ++ ys = x ∷ (xs ++ ys)
foldr : ∀ {a b} {A : Set a}{B : Set b} → (A → B → B) → B → List A → B
foldr c n [] = n
foldr c n (x ∷ xs) = c x (foldr c n xs)
length : ∀{a} {A : Set a} → List A → ℕ
length = foldr (λ _ → suc) 0
infix 2 _∶_∈_
data _∶_∈_ {a} {A : Set a} : ℕ → A → List A → Set a where
here : ∀ {x l} → 0 ∶ x ∈ x ∷ l
there : ∀ {n x y l} → n ∶ x ∈ l → suc n ∶ x ∈ y ∷ l
-- types
data Typ : Set where
N : Typ
Ctx : Set
Ctx = List Typ
variable
S T U : Typ
Γ Γ′ Γ″ : Ctx
Δ Δ′ Δ″ : Ctx
mutual
infixl 11 _[_]
data Exp : Set where
v : (x : ℕ) → Exp
ze : Exp
su : Exp → Exp
_[_] : Exp → Subst → Exp
infixl 3 _∘_
data Subst : Set where
↑ : Subst
I : Subst
_∘_ : Subst → Subst → Subst
_,_ : Subst → Exp → Subst
variable
t t′ t″ : Exp
s s′ : Exp
σ σ′ : Subst
τ τ′ : Subst
module Typing where
infix 4 _⊢_∶_ _⊢s_∶_
mutual
data _⊢_∶_ : Ctx → Exp → Typ → Set where
su-I : Γ ⊢ t ∶ N →
-------------
Γ ⊢ su t ∶ N
t[σ] : Δ ⊢ t ∶ T →
Γ ⊢s σ ∶ Δ →
----------------
Γ ⊢ t [ σ ] ∶ T
data _⊢s_∶_ : Ctx → Subst → Ctx → Set where
S-↑ : S ∷ Γ ⊢s ↑ ∶ Γ
S-I : Γ ⊢s I ∶ Γ
S-∘ : Γ ⊢s τ ∶ Γ′ →
Γ′ ⊢s σ ∶ Γ″ →
----------------
Γ ⊢s σ ∘ τ ∶ Γ″
infix 4 _⊢_≈_∶_
data _⊢_≈_∶_ : Ctx → Exp → Exp → Typ → Set where
su-cong : Γ ⊢ t ≈ t′ ∶ N →
---------------------------------------
Γ ⊢ su t ≈ su t′ ∶ N
su-[] : Γ ⊢s σ ∶ Δ →
Δ ⊢ t ∶ N →
--------------------------------------------
Γ ⊢ su t [ σ ] ≈ su (t [ σ ]) ∶ N
[∘] : Γ ⊢s τ ∶ Γ′ →
Γ′ ⊢s σ ∶ Γ″ →
Γ″ ⊢ t ∶ T →
-------------------------------------------
Γ ⊢ t [ σ ∘ τ ] ≈ t [ σ ] [ τ ] ∶ T
[,]-v-su : ∀ {x} →
Γ ⊢s σ ∶ Δ →
Γ ⊢ s ∶ S →
x ∶ T ∈ Δ →
---------------------------------------
Γ ⊢ v (suc x) [ σ , s ] ≈ v x [ σ ] ∶ T
≈-sym : Γ ⊢ t ≈ t′ ∶ T →
----------------------------------
Γ ⊢ t′ ≈ t ∶ T
≈-trans : Γ ⊢ t ≈ t′ ∶ T →
Γ ⊢ t′ ≈ t″ ∶ T →
-----------------------------------
Γ ⊢ t ≈ t″ ∶ T
open Typing
data Nf : Set where
su : Nf → Nf
Nf⇒Exp : Nf → Exp
Nf⇒Exp (su w) = su (Nf⇒Exp w)
mutual
data D : Set where
su : D → D
data Df : Set where
↓ : (T : Typ) → (a : D) → Df
infix 4 Rf_-_↘_
data Rf_-_↘_ : ℕ → Df → Nf → Set where
Rsu : ∀ n {a w} →
Rf n - ↓ N a ↘ w →
--------------------
Rf n - ↓ N (su a) ↘ su w
weaken : Ctx → Subst
weaken [] = I
weaken (T ∷ Γ) = weaken Γ ∘ ↑
weaken⊨s : ∀ Δ → Δ ++ Γ ⊢s weaken Δ ∶ Γ
weaken⊨s [] = S-I
weaken⊨s (T ∷ Δ) = S-∘ S-↑ (weaken⊨s Δ)
Pred : Set₁
Pred = Exp → D → Set
DPred : Set₁
DPred = Ctx → Pred
record TopPred Δ σ t a T : Set where
field
nf : Nf
↘nf : Rf length Δ - ↓ T a ↘ nf
≈nf : Δ ⊢ t [ σ ] ≈ Nf⇒Exp nf ∶ T
record Top T Γ t a : Set where
field
t∶T : Γ ⊢ t ∶ T
krip : ∀ Δ → TopPred (Δ ++ Γ) (weaken Δ) t a T
⟦_⟧ : Typ → DPred
⟦ N ⟧ = Top N
inv-t[σ] : Γ ⊢ t [ σ ] ∶ T →
∃ λ Δ → Δ ⊢ t ∶ T × Γ ⊢s σ ∶ Δ
inv-t[σ] (t[σ] t σ) = -, t , σ
infix 4 _∼∈⟦_⟧_ _⊨_∶_
record _∼∈⟦_⟧_ σ Γ Δ : Set where
field
⊢σ : Δ ⊢s σ ∶ Γ
record Intp Δ σ t T : Set where
field
⟦t⟧ : D
tT : ⟦ T ⟧ Δ (t [ σ ]) ⟦t⟧
_⊨_∶_ : Ctx → Exp → Typ → Set
Γ ⊨ t ∶ T = ∀ {σ Δ} → σ ∼∈⟦ Γ ⟧ Δ → Intp Δ σ t T
su-I′ : Γ ⊨ t ∶ N →
---------------
Γ ⊨ su t ∶ N
su-I′ t σ∼ρ = record
{ ⟦t⟧ = su ⟦t⟧
; tT =
let _ , t , σ = inv-t[σ] t∶T
in record
{ t∶T = t[σ] (su-I t) σ
; krip = λ Δ →
let open TopPred (krip Δ)
wΔ = weaken⊨s Δ
in record
{ nf = su nf
; ↘nf = Rsu _ ↘nf -- HERE
; ≈nf = ≈-trans (≈-sym ([∘] wΔ σ (su-I t)))
(≈-trans (su-[] (S-∘ wΔ σ) t)
(su-cong (≈-trans ([∘] wΔ σ t)
≈nf)))
}
}
}
where open _∼∈⟦_⟧_ σ∼ρ
open Intp (t σ∼ρ)
open Top tT |
Bisection blames commit 93e0d3d @UlfNorell Date: Tue Mar 23 10:44:38 2021 +0100 |
Otherwise, serialization might crash on MetaV.
Checkpoints
to OpenThing
Bumping this to 2.6.3 since I do not want to block a bugfix release by some bugfixes not existing yet. |
Ping @UlfNorell |
@UlfNorell : When do you think you will have time to work on this? |
Busy with teaching at the moment, so not until after exams. |
@UlfNorell : How is it looking now? |
I can have a look today. |
Simplified: postulate
Typ : Set
⊢ : Typ → Set
N : Typ
t : ⊢ N
record TopPred : Set where
constructor tp
field nf : Typ
postulate
inv-t[σ] : (T : Typ) → ⊢ T → TopPred
su-I′ : TopPred → Typ
su-I′ krip =
let tp _ = inv-t[σ] _ t
open TopPred krip
in N |
Otherwise, serialization might crash on MetaV.
Otherwise, serialization might crash on MetaV.
Cherry-picked onto |
Otherwise, serialization might crash on MetaV.
Hi,
one piece of my old code seems to trigger this bug:
while it is fine in Agda 2.6.1.3.
The offending function is:
https://gitlab.com/JasonHuZS/practice/-/blob/master/T/Soundness.agda#L375-400
To copy here
Visually, this function doesn't seem to use any special feature in Agda that might trigger a corner case, so I am not even sure how to find a minimal reproduction, but commenting out code from this function on would not trigger the error.
The text was updated successfully, but these errors were encountered: