问题
#### 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:
ExerciseAny-∃
(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