module 1Lab.Biimp whereBiimplicationsπ
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
from : B β A
open _β_private variable
β β' : Level
A B C : Type βmodule Biimp (f : A β B) where
open _β_ f publicIf and n-types, then the type of biimplications is also an n-type.
private unquoteDecl eqv = declare-record-iso eqv (quote _β_)β-is-hlevel : β n β is-hlevel A n β is-hlevel B n β is-hlevel (A β B) n
β-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
H-Level-β {n = n} .H-Level.has-hlevel =
β-is-hlevel n (hlevel n) (hlevel n)
instance
Extensional-β
: β {βr}
β β¦ _ : Extensional ((A β B) Γ (B β A)) βr β¦
β Extensional (A β B) βr
Extensional-β β¦ e β¦ = isoβextensional eqv eWorking with biimplicationsπ
There is an identity biimplication, and biimplications compose.
idβ : A β A
idβ .to = id
idβ .from = id
_ββ_ : A β B β B β C β A β C
(f ββ g) .to = g .to β f .to
(f ββ g) .from = f .from β g .fromMoreover, every biimplication induces a biimplication
_ββ»ΒΉ : A β B β B β A
(f ββ»ΒΉ) .to = f .from
(f ββ»ΒΉ) .from = f .toBiimplications and equivalencesπ
Every equivalence is a biimplication.
equivβbiimp : A β B β A β B
equivβbiimp f .to = Equiv.to f
equivβbiimp f .from = Equiv.from fEvery biimplication between propositions is an equivalence. In light of this, biimplications are often referred to as logical equivalences.
biimpβequiv : is-prop A β is-prop B β A β B β A β B
biimpβequiv A-prop B-prop f =
prop-ext A-prop B-prop (f .to) (f .from)infix 21 _β_
infixr 30 _ββ_
infix 31 _ββ»ΒΉ