Skip to content

Instantly share code, notes, and snippets.

@h4iku
Created May 20, 2019 21:26
Show Gist options
  • Save h4iku/ddc0ee5b19eca85e8877af93fd632e3c to your computer and use it in GitHub Desktop.
Save h4iku/ddc0ee5b19eca85e8877af93fd632e3c to your computer and use it in GitHub Desktop.
module plfa.ExerMini where
import Relation.Binary.PropositionalEquality as Eq
open Eq using (_≡_; refl)
open import Data.Product using (_×_; proj₁; proj₂) renaming (_,_ to ⟨_,_⟩)
open import plfa.Isomorphism using (_≃_; extensionality)
-- open import Level using (Level)
{-
-- Works with the version posted in the issue:
postulate
extensionality : ∀ {a b : Level} {A : Set a} {B : A → Set b}
{f g : (x : A) → B x} → (∀ x → f x ≡ g x) → f ≡ g
-}
-- Exercise ∀-×:
data Tri : Set where
aa : Tri
bb : Tri
cc : Tri
∀-× : {B : Tri → Set} → (∀ (x : Tri) → B x) ≃ B aa × B bb × B cc
∀-× =
record
{ to = λ{ f → ⟨ f aa , ⟨ f bb , f cc ⟩ ⟩ }
; from = λ{ ⟨ a , ⟨ b , c ⟩ ⟩ → λ{ aa → a
; bb → b
; cc → c
}}
; from∘to = λ{ f → extensionality λ{ aa → refl
; bb → refl
; cc → refl
}}
; to∘from = λ{ ⟨ a , ⟨ b , c ⟩ ⟩ → refl }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment