Skip to content

Instantly share code, notes, and snippets.

@kztk-m
Created July 8, 2020 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kztk-m/9d9febb8f941d2bd39bbab9ddd181e5a to your computer and use it in GitHub Desktop.
Save kztk-m/9d9febb8f941d2bd39bbab9ddd181e5a to your computer and use it in GitHub Desktop.
open import Relation.Binary.PropositionalEquality
open import Data.Unit
open import Data.Product
open ≡-Reasoning
variable
A : Set
B : Set
record _~_ (A : Set) (B : Set) : Set where
constructor bij
field
to : A -> B
from : B -> A
from-to : ∀ x -> to (from x) ≡ x
to-from : ∀ x -> from (to x) ≡ x
open _~_
uniq : ⊤ ~ A -> (a : A) -> (a' : A) -> a ≡ a'
uniq h a a' =
begin
a
≡⟨ sym (from-to h a) ⟩
to h (from h a)
≡⟨ cong (to h) refl ⟩
to h (from h a')
≡⟨ from-to h a' ⟩
a'
lemma : ⊤ ~ (A × B) -> ⊤ ~ A
to (lemma h) = λ a -> proj₁ (to h a)
from (lemma h) = λ _ -> tt
from-to (lemma h) a =
let b = proj₂ (to h tt)
in cong proj₁ (uniq h (proj₁ (to h tt) , b) (a , b))
to-from (lemma h) tt = refl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment