【发布时间】:2016-05-10 05:53:14
【问题描述】:
我收到x != y of type Y when checking that the pattern p(y) has type Z 形式的奇怪错误。我不知道为什么或如何得到这个,并想解决这个问题。下面是一个问题实例;谢谢。
假设我有一套,
postulate A : Set
以及一种将其元素解释为集合的方法,
postulate F : A → Set
然后使用该集合的对,
record B : Set where field s t : A
我可以在其上构建一个参数化类型:
data C : A → Set where MkC : (b : B) → F (B.s b) → C (B.t b)
现在我想,例如,形成一个函数
ABCF : ∀ a → (f : A → A) → C a → C (f a)
ABCF t f e = {!!}
我会通过C-c C-c 对第三个参数进行模式匹配来做到这一点
这样做让我很开心
ABCF .(B.t b) f (MkC b x) = {!!}
然后另一个C-c C-c,在b,产生
ABCF t f (MkC record { s = s ; t = .t } x) = ?
但是这个大小写紧跟着一个错误:
B.t b != t of type A
when checking that the pattern MkC record { s = s ; t = .t } x has
type C t
用t' 替换.t 也不能解决这个问题。
任何帮助指出此错误背后的原因以及如何修复它都将不胜感激!
编辑
正如下面的回答,上述问题可能是由于错误引起的,但相反的情况呢?
FCBA : ∀ {a} (f : A → A) → C (f a) → C a
FCBA {a} f (MkC record { s = s ; t = .(f a) } x) = ?
我们将如何解决这个问题?哪个带有错误
B.t b != f a of type A
when checking that the pattern MkC record { s = s ; t = .(f a) } x
has type C (f a)
【问题讨论】:
标签: agda