plfa

How to get around the implicit vs explicit function type error?

前提是你 提交于 2020-01-25 00:05:30
问题 This is from the last chapter of PLFA book. import Relation.Binary.PropositionalEquality as Eq open Eq using (_≡_; refl; sym; trans; cong) open import Data.Product using (_×_; ∃; ∃-syntax; Σ; Σ-syntax) renaming (_,_ to ⟨_,_⟩) infix 0 _≃_ record _≃_ (A B : Set) : Set where field to : A → B from : B → A from∘to : ∀ (x : A) → from (to x) ≡ x to∘from : ∀ (y : B) → to (from y) ≡ y open _≃_ data List (A : Set) : Set where [] : List A _∷_ : A → List A → List A infixr 5 _∷_ data All {A : Set} (P : A

How to get around the implicit vs explicit function type error?

泪湿孤枕 提交于 2020-01-25 00:05:12
问题 This is from the last chapter of PLFA book. import Relation.Binary.PropositionalEquality as Eq open Eq using (_≡_; refl; sym; trans; cong) open import Data.Product using (_×_; ∃; ∃-syntax; Σ; Σ-syntax) renaming (_,_ to ⟨_,_⟩) infix 0 _≃_ record _≃_ (A B : Set) : Set where field to : A → B from : B → A from∘to : ∀ (x : A) → from (to x) ≡ x to∘from : ∀ (y : B) → to (from y) ≡ y open _≃_ data List (A : Set) : Set where [] : List A _∷_ : A → List A → List A infixr 5 _∷_ data All {A : Set} (P : A

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