module 1Lab.Biimp where
Biimplicationsπ
A biimplication between a pair of types is a pair of functions
record _β_ {β} {β'} (A : Type β) (B : Type β') : Type (β β β') where
no-eta-equality
constructor biimp
field
to : A β B
: B β A
from
open _β_
private variable
: Level
β β' : Type β A B C
module Biimp (f : A β B) where
open _β_ f public
If and n-types, then the type of biimplications is also an n-type.
private unquoteDecl eqv = declare-record-iso eqv (quote _β_)
: β n β is-hlevel A n β is-hlevel B n β is-hlevel (A β B) n
β-is-hlevel =
β-is-hlevel n A-hl B-hl
Isoβis-hlevel n eqv $
Γ-is-hlevel n(Ξ -is-hlevel n Ξ» _ β B-hl)
(Ξ -is-hlevel n Ξ» _ β A-hl)
instance
H-Level-β: β {n}
β β¦ _ : H-Level A n β¦ β¦ _ : H-Level B n β¦
β H-Level (A β B) n
{n = n} .H-Level.has-hlevel =
H-Level-β (hlevel n) (hlevel n)
β-is-hlevel n
instance
Extensional-β: β {βr}
β β¦ _ : Extensional ((A β B) Γ (B β A)) βr β¦
β Extensional (A β B) βr
= isoβextensional eqv e Extensional-β β¦ e β¦
Working with biimplicationsπ
There is an identity biimplication, and biimplications compose.
: A β A
idβ .to = id
idβ .from = id
idβ
_ββ_ : A β B β B β C β A β C
(f ββ g) .to = g .to β f .to
(f ββ g) .from = f .from β g .from
Moreover, every biimplication induces a biimplication
_ββ»ΒΉ : A β B β B β A
(f ββ»ΒΉ) .to = f .from
(f ββ»ΒΉ) .from = f .to
Biimplications and equivalencesπ
Every equivalence is a biimplication.
: A β B β A β B
equivβbiimp .to = Equiv.to f
equivβbiimp f .from = Equiv.from f equivβbiimp f
Every biimplication between propositions is an equivalence. In light of this, biimplications are often referred to as logical equivalences.
: is-prop A β is-prop B β A β B β A β B
biimpβequiv =
biimpβequiv A-prop B-prop f (f .to) (f .from) prop-ext A-prop B-prop
infix 21 _β_
infixr 30 _ββ_
infix 31 _ββ»ΒΉ