Agda 如何在一个前提下重写?

Agda 如何在一个前提下重写?,agda,Agda,如何在此处使用append标识重写prf?我想我可以把目标改写成匹配,但是在这个前提下也可以这样做吗?我觉得后者会更简洁。啊,看来我对重写工作原理的假设是错误的 Goal: Any P xs ———————————————————————————————————————————————————————————— prf : Any P (xs ++ []) xs : List A P : A → Set (not in scope) A : Set (not in scope)

如何在此处使用append标识重写
prf
?我想我可以把目标改写成匹配,但是在这个前提下也可以这样做吗?我觉得后者会更简洁。

啊,看来我对重写工作原理的假设是错误的

Goal: Any P xs
————————————————————————————————————————————————————————————
prf : Any P (xs ++ [])
xs  : List A
P   : A → Set  (not in scope)
A   : Set  (not in scope)
当我尝试上述方法时,我惊讶地发现它重写了目标和前提。因此,重写前提的方法是

Goal: Any P (xs ++ [])
————————————————————————————————————————————————————————————
prf : Any P ((xs ++ []) ++ [])
P   : A → Set  (not in scope)
xs  : List A
A   : Set  (not in scope)
我不确定这是否应该如此令人惊讶,但我没有注意到这一点,尽管我几乎看完了PLFA书的第1卷的全部内容。这种行为不同于Coq的重写

Any-comm xs [] prf rewrite sym (++-identityʳ xs) = {!!}
Goal: Any P (xs ++ [])
————————————————————————————————————————————————————————————
prf : Any P ((xs ++ []) ++ [])
P   : A → Set  (not in scope)
xs  : List A
A   : Set  (not in scope)
Any-comm xs [] prf rewrite ++-identityʳ xs = prf