Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Question

deleted 1 character in body; edited title
Source Link
marc_s
  • 760.2k
  • 186
  • 1.4k
  • 1.5k

Pattern matchinmatching without K in agda

I was trying to prove K (with without-K) using J to see what goes wrong when we try to do that.

that'sThat's all well and good, but in the process of playing around I noticed that agda refuses to match with refl any term (that I tried) of type Id A x x (saying something along the lines of "can't unify x1 ≟ x1").

forFor example, agda refuses to case split on p in the following example:

data 1 : Type where
 * : 1
test : {l : Level} {A : Type l} -> (x : A) -> (p : x ≡ x) -> 1
test {l} {A} x p = ?

but the following snippet is fine:

data 1 : Type where
 * : 1
test : {l : Level} {A : Type l} -> (x : A) -> (p : x ≡ x) -> 1
test {l} {A} x p = J {A = A} {x = x} (λ y path -> 1) {y = x} p *

isn'tIsn't using J here like this essentially the same as case-splitting on p and assuming it to be refl.? If yes, then why does agda refuse to split on p in the earlier example.?

forFor reference the type of the J rule being used is this:

J : {A : Set a} {x : A} (B : (y : A) → x ≡ y → Set b)
 {y : A} (p : x ≡ y) → B x refl → B y p

Pattern matchin without K in agda

I was trying to prove K (with without-K) using J to see what goes wrong when we try to do that

that's all well and good, but in the process of playing around I noticed that agda refuses to match with refl any term (that I tried) of type Id A x x (saying something along the lines of "can't unify x1 ≟ x1")

for example, agda refuses to case split on p in the following example:

data 1 : Type where
 * : 1
test : {l : Level} {A : Type l} -> (x : A) -> (p : x ≡ x) -> 1
test {l} {A} x p = ?

but the following snippet is fine

data 1 : Type where
 * : 1
test : {l : Level} {A : Type l} -> (x : A) -> (p : x ≡ x) -> 1
test {l} {A} x p = J {A = A} {x = x} (λ y path -> 1) {y = x} p *

isn't using J here like this essentially the same as case-splitting on p and assuming it to be refl. If yes, then why does agda refuse to split on p in the earlier example.

for reference the type of the J rule being used is this:

J : {A : Set a} {x : A} (B : (y : A) → x ≡ y → Set b)
 {y : A} (p : x ≡ y) → B x refl → B y p

Pattern matching without K in agda

I was trying to prove K (with without-K) using J to see what goes wrong when we try to do that.

That's all well and good, but in the process of playing around I noticed that agda refuses to match with refl any term (that I tried) of type Id A x x (saying something along the lines of "can't unify x1 ≟ x1").

For example, agda refuses to case split on p in the following example:

data 1 : Type where
 * : 1
test : {l : Level} {A : Type l} -> (x : A) -> (p : x ≡ x) -> 1
test {l} {A} x p = ?

but the following snippet is fine:

data 1 : Type where
 * : 1
test : {l : Level} {A : Type l} -> (x : A) -> (p : x ≡ x) -> 1
test {l} {A} x p = J {A = A} {x = x} (λ y path -> 1) {y = x} p *

Isn't using J here like this essentially the same as case-splitting on p and assuming it to be refl? If yes, then why does agda refuse to split on p in the earlier example?

For reference the type of the J rule being used is this:

J : {A : Set a} {x : A} (B : (y : A) → x ≡ y → Set b)
 {y : A} (p : x ≡ y) → B x refl → B y p
edited tags
Link
Source Link

Pattern matchin without K in agda

I was trying to prove K (with without-K) using J to see what goes wrong when we try to do that

that's all well and good, but in the process of playing around I noticed that agda refuses to match with refl any term (that I tried) of type Id A x x (saying something along the lines of "can't unify x1 ≟ x1")

for example, agda refuses to case split on p in the following example:

data 1 : Type where
 * : 1
test : {l : Level} {A : Type l} -> (x : A) -> (p : x ≡ x) -> 1
test {l} {A} x p = ?

but the following snippet is fine

data 1 : Type where
 * : 1
test : {l : Level} {A : Type l} -> (x : A) -> (p : x ≡ x) -> 1
test {l} {A} x p = J {A = A} {x = x} (λ y path -> 1) {y = x} p *

isn't using J here like this essentially the same as case-splitting on p and assuming it to be refl. If yes, then why does agda refuse to split on p in the earlier example.

for reference the type of the J rule being used is this:

J : {A : Set a} {x : A} (B : (y : A) → x ≡ y → Set b)
 {y : A} (p : x ≡ y) → B x refl → B y p

AltStyle によって変換されたページ (->オリジナル) /