type-theory/src/2023-05-14-biinv-equiv.agda

95 lines
2.4 KiB
Agda
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{-# OPTIONS --cubical #-}
open import Agda.Primitive.Cubical
open import Cubical.Foundations.Equiv
open import Cubical.Foundations.Prelude hiding (Σ-syntax)
open import Cubical.Foundations.Isomorphism
open import Cubical.Foundations.Function
open import Cubical.Foundations.Univalence
open import Cubical.Foundations.Equiv.BiInvertible
open import Data.Bool
open import Data.Product.Base
id : {} {A : Type } A A
id x = x
linv : {A B : Type} (f : A B) Type
linv {A} {B} f = Σ[ g (B A) ] (g f id)
rinv : {A B : Type} (f : A B) Type
rinv {A} {B} f = Σ[ g (B A) ] (f g id)
-- Using this definition will need funExt everywhere
-- Use this:
linv : {A B : Type} (f : A B) Type
linv {A} {B} f = Σ[ g (B A) ] ((x : A) g (f x) x)
rinv : {A B : Type} (f : A B) Type
rinv {A} {B} f = Σ[ g (B A) ] ((y : B) f (g y) y)
biinv : {A B : Type} (f : A B) Type
biinv f = linv f × rinv f
--------------------------------------------------------------------------------
Bool-id : Bool Bool
Bool-id true = true
Bool-id false = false
Bool-id-pointwise : (b : Bool) Bool-id (Bool-id b) b
Bool-id-pointwise true = refl
Bool-id-pointwise false = refl
-- Bool-id-equiv : Bool-id ∘ Bool-id ≡ id
-- Bool-id-equiv = funExt Bool-id-pointwise
Bool-linv : linv Bool-id
Bool-linv .fst = Bool-id
Bool-linv .snd = ?
Bool-rinv : rinv Bool-id
Bool-rinv .fst = Bool-id
Bool-rinv .snd = funExt Bool-id-pointwise
Bool-id-biinv : BiInvEquiv Bool Bool
Bool-id-biinv = biInvEquiv
Bool-id
Bool-id Bool-id-pointwise
Bool-id Bool-id-pointwise
Bool-id-iso : Iso Bool Bool
Bool-id-iso = iso
Bool-id
Bool-id
Bool-id-pointwise
Bool-id-pointwise
Bool-id-biinv-equiv : Bool Bool
Bool-id-biinv-equiv = Bool-id , isoToIsEquiv Bool-id-iso
Bool-id-path : Bool Bool
Bool-id-path = ua Bool-id-biinv-equiv
--------------------------------------------------------------------------------
Bool-neg : Bool Bool
Bool-neg true = false
Bool-neg false = true
Bool-neg-pointwise : (b : Bool) Bool-neg (Bool-neg b) b
Bool-neg-pointwise true = refl
Bool-neg-pointwise false = refl
Bool-neg-iso : Iso Bool Bool
Bool-neg-iso = iso
Bool-neg
Bool-neg
Bool-neg-pointwise
Bool-neg-pointwise
Bool-neg-equiv : Bool Bool
Bool-neg-equiv = isoToEquiv Bool-neg-iso
Bool-neg-path : Bool Bool
Bool-neg-path = ua Bool-neg-equiv