-
Notifications
You must be signed in to change notification settings - Fork 344
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
Case-split causes problems for coverage checker #887
Comments
I suppose I should add, case-split results in this code: determinacy : {e v₁ v₂ : [] ⊢ bool} → e ⇓ v₁ → e ⇓ v₂ → v₁ == v₂
determinacy (N x Done) (N x₂ Done) = {!!}
determinacy (N Value/true Done) (N x₂ (Step (Step/here x) x₃)) = {!!}
determinacy (N Value/false Done) (N x₂ (Step (Step/here x) x₃)) = {!!}
determinacy (N x (Step (Step/here x₁) x₂)) (N Value/true Done) = {!!}
determinacy (N x (Step (Step/here x₁) x₂)) (N Value/false Done) = ?
determinacy (N x (Step x₁ x₂)) (N x₃ (Step x₄ x₅)) = {!!} And this error from the coverage checker:
I'd also like to know a workaround to convince the type-checker to accept this Original comment by |
You could presumably add the missing cases manually. Original comment by
|
Maybe related to issue #408. Original comment by
|
Bug still exists as of today (2016-06-20). Updated test case: data List {l} (A : Set l) : Set l where
[] : List A
_::_ : A -> List A -> List A
infixr 99 _::_
data _==_ {l} {A : Set l} (M : A) : A → Set l where
Refl : M == M
-- {-# BUILTIN EQUALITY _==_ #-}
-- {-# BUILTIN REFL Refl #-}
data _∈_ {A : Set} : (x : A) (l : List A) → Set where
i0 : {x : A} {xs : List A} → x ∈ x :: xs
iS : {x y : A} {xs : List A} → x ∈ xs → x ∈ y :: xs
data Tp : Set where
bool : Tp
_⇒_ : Tp → Tp → Tp
Ctx = List Tp
_,,_ : Ctx → Tp → Ctx
Γ ,, τ = τ :: Γ
infixr 10 _⇒_
infixr 9 _,,_
infixr 8 _⊢_
infix 4 if_then_else_
data _⊢_ (Γ : Ctx) : Tp → Set where
#t : Γ ⊢ bool
#f : Γ ⊢ bool
if_then_else_ : {τ : Tp} → Γ ⊢ bool → Γ ⊢ τ → Γ ⊢ τ → Γ ⊢ τ
var : {τ : Tp}
→ τ ∈ Γ
→ Γ ⊢ τ
lam : {τ1 τ2 : Tp}
→ Γ ,, τ1 ⊢ τ2
→ Γ ⊢ τ1 ⇒ τ2
app : {τ1 τ2 : Tp}
→ Γ ⊢ τ1 ⇒ τ2
→ Γ ⊢ τ1
→ Γ ⊢ τ2
data value : {τ : Tp} → [] ⊢ τ → Set where
Value/true : value #t
Value/false : value #f
Value/lam : {τ₁ τ₂ : Tp} {e : [] ,, τ₁ ⊢ τ₂} → value (lam e)
module OpSem where
infix 2 _↦_ _↦c_
data _↦c_ : {τ : Tp} → [] ⊢ τ → [] ⊢ τ → Set where
-- beta omitted to avoid defining substitutions
Step/if-true : {τ : Tp} {e₁ e₂ : [] ⊢ τ}
→ if #t then e₁ else e₂ ↦c e₁
Step/if-false : {τ : Tp} {e₁ e₂ : [] ⊢ τ}
→ if #f then e₁ else e₂ ↦c e₂
data _↦_ : {τ : Tp} → [] ⊢ τ → [] ⊢ τ → Set where
Step/here : {τ : Tp} {e e' : [] ⊢ τ} → e ↦c e' → e ↦ e'
Step/app1 : {τ₁ τ₂ : Tp} {e e' : [] ⊢ τ₁ ⇒ τ₂} {e₁ : [] ⊢ τ₁}
→ e ↦ e'
→ (app e e₁) ↦ (app e' e₁)
Step/app2 : {τ₁ τ₂ : Tp} {e : [] ,, τ₁ ⊢ τ₂} {e₁ e₁' : [] ⊢ τ₁}
→ e₁ ↦ e₁'
→ (app (lam e) e₁) ↦ (app (lam e) e₁')
Step/if-cond : {τ : Tp} {e e' : [] ⊢ bool} {e₁ e₂ : [] ⊢ τ}
→ e ↦ e'
→ if e then e₁ else e₂ ↦ if e' then e₁ else e₂
data _↦*_ : {τ : Tp} → [] ⊢ τ → [] ⊢ τ → Set where
Done : {τ : Tp} {e : [] ⊢ τ} → e ↦* e
Step : {τ : Tp} {e e' e'' : [] ⊢ τ}
→ e ↦ e' → e' ↦* e''
→ e ↦* e''
data _⇓_ {τ : Tp} : [] ⊢ τ → [] ⊢ τ → Set where
N : {e v : [] ⊢ τ} → value v → e ↦* v → e ⇓ v
determinacy : {e v₁ v₂ : [] ⊢ bool} → e ⇓ v₁ → e ⇓ v₂ → v₁ == v₂
determinacy (N x Done) (N x₂ Done) = {!!}
determinacy (N Value/true Done) (N x₂ (Step (Step/here x) x₃)) = {!!}
determinacy (N Value/false Done) (N x₂ (Step (Step/here x) x₃)) = {!!}
determinacy (N x (Step (Step/here x₁) x₂)) (N Value/true Done) = {!!}
determinacy (N x (Step CASE-ME x₂)) (N Value/false Done) = {!CASE-ME!}
determinacy (N x (Step x₁ x₂)) (N x₃ (Step x₄ x₅)) = {!!} |
It's worth noting that you can build the definition of The missing cases that the coverage checker wants are determinacy (N _ (Step (Step/app1 _) _)) (N _ Done) = {!!}
determinacy (N _ (Step (Step/app2 _) _)) (N _ Done) = {!!}
determinacy (N _ (Step (Step/if-cond _) _)) (N _ Done) = {!!} |
Here's the case tree before splitting: case 3 of
N ->
case 6 of
Done ->
case 8 of
N ->
case 11 of
Done -> ?
Step ->
case 5 of
Value/true ->
case 14 of
Step/here -> ?
Value/false ->
case 14 of
Step/here -> ?
Step ->
case 10 of -- (*) This is the interesting step
Step/here ->
case 15 of
N ->
case 17 of
Value/true ->
case 17 of
Done -> ?
_ -> case 12 of
N ->
case 14 of
Value/false ->
case 14 of
Done -> ?
_ -> case 15 of
Step -> ? At (*) we've only matched the first argument against determinacy (N x (Step y z)) w matching the clauses determinacy (N x (Step (Step/here x₁) x₂)) (N Value/true Done) = ?
determinacy (N x (Step CASE-ME x₂)) (N Value/false Done) = ?
determinacy (N x (Step x₁ x₂)) (N x₃ (Step x₄ x₅)) = ? Instead of splitting on |
This seems to be working fine now, Agda no longer complains about missing clauses. I think I may have fixed this in 242684b (not sure though). |
Here is a self-contained module (a simple proof of determinacy for lambda
calculus; it won't work because I've omitted the beta rule for purposes of
reducing the test-case) which demonstrates the problem:
Navigate to the second to last hole and attempt to case-split on CASE-ME.
Q: What version of Agda are you using? On what operating system (if relevant)?
A: Latest Darcs checkout as of August 22, 2013.
Original issue reported on code.google.com by
ezy...@mit.edu
on 22 Aug 2013 at 5:09The text was updated successfully, but these errors were encountered: