What is a valid type signature for the `Any-∃` exercise?

∥☆過路亽.° 提交于 2019-12-11 06:36:21

问题


#### Exercise `Any-∃`

Show that `Any P xs` is isomorphic to `∃[ x ∈ xs ] P x`.

Leaving aside the fact that ∃[ x ∈ xs ] P x is not even valid syntax - only Σ[ x ∈ xs ] P x could be valid, none of the type signatures I've tried typecheck for that particular problem.

Any-∃ : ∀ {A : Set} {P : A → Set} {xs : List A} → Any P xs ≃ Σ[ x ∈ xs ] P x
List A !=< Set _a_1582 of type Set
when checking that the expression xs has type Set _a_1582

The most obvious thing here fails. I sort of understand what the question is trying to ask me here, but I am not sure what the structure ∃[ x ∈ xs ] P x is supposed to be.

This is the penultimate exercise in the Lists chapter of the PLFA book.


回答1:


The book has been corrected now:

Exercise Any-∃ (practice)

Show that Any P xs is isomorphic to ∃[ x ] (x ∈ xs × P x).



来源:https://stackoverflow.com/questions/56375003/what-is-a-valid-type-signature-for-the-any-%e2%88%83-exercise

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!