Ian Ray. 4th November 2025.
Minor changes and merged into TypeToplogy in July 2026.
We provide some examples of using (displayed) univalent reflexive graphs and
reflexive graph lenses to characterize certain identity types, characterize
transport, and observe the relationship between the reflexive graph approach
to the structured identity principled (SIP) and the existing approaches
available in the TypeTopology library.
\begin{code}
{-# OPTIONS --safe --without-K #-}
module ReflexiveGraphs.Examples where
open import MLTT.Spartan
open import UF.Base
open import UF.Equiv
open import UF.EquivalenceExamples
open import UF.FunExt
open import UF.FundamentalLemmaOfTransportAlongEquivalences
open import UF.Pullback
open import UF.Sets
open import UF.Sets-Properties
open import UF.SIP
open import UF.Subsingletons
open import UF.Subsingletons-FunExt
open import UF.Subsingletons-Properties
open import UF.Univalence
open import ReflexiveGraphs.Constructions
open import ReflexiveGraphs.Displayed
open import ReflexiveGraphs.DisplayedUnivalent
open import ReflexiveGraphs.Lenses
open import ReflexiveGraphs.Properties
open import ReflexiveGraphs.Type
open import ReflexiveGraphs.UnbiasedLenses
open import ReflexiveGraphs.Univalent
open import ReflexiveGraphs.UnivalentClosureProperties
open import ReflexiveGraphs.UnivalentFamilies
\end{code}
We can recover the standard characterization of the identity type of products
using the discrete reflexive graph construction.
\begin{code}
product-characterization-from-univalent-refl-graphs
: (A : π€ Μ) (B : π₯ Μ) (a a' : A) (b b' : B)
β ((a , b) οΌ (a' , b')) β (a οΌ a') Γ (b οΌ b')
product-characterization-from-univalent-refl-graphs A B a a' b b'
= id-equiv-edge ((Ξ A) β (Ξ B) , I) (a , b) (a' , b')
where
I : is-univalent-refl-graph ((Ξ A) β (Ξ B))
I = univalence-closed-under-Γ (Ξ A) (Ξ B)
(discrete-refl-graph-is-univalent A) (discrete-refl-graph-is-univalent B)
\end{code}
Similarly for Sigma types.
\begin{code}
sigma-characterization-from-univalent-refl-graphs
: (A : π€ Μ) (B : A β π₯ Μ) (a a' : A) (b : B a) (b' : B a')
β ((a , b) οΌ (a' , b')) β (Ξ£ p κ (a οΌ a') , transport B p b οΌ b')
sigma-characterization-from-univalent-refl-graphs A B a a' b b'
= id-equiv-edge ((β a ΛΈ A , (Ξ (B a))) , I) (a , b) (a' , b')
where
I : is-univalent-refl-graph (β a ΛΈ A , (Ξ (B a)))
I = univalence-closed-under-Ξ£ A (Ξ» a β Ξ (B a))
(Ξ» a β discrete-refl-graph-is-univalent (B a))
\end{code}
This is simply a sanity check for the theory we have developed. We now move
towards a more unified approach to the SIP, by working through some
illustrative examples.
Example 1:
We give a detailed characterization of the identity type of cones over a
cospan using reflexive graphs. This illustration is not intended to be brief.
Two cones with commutative graphs witnessed by
q q'
A ββββββββββ X A ββββββββββ X
β β β β
H : p β β g H' : p' β β g
β β β β
β β β β
Y ββββββββββ Z Y ββββββββββ Z
f f
are the same when we have homotopies Ξ± : p βΌ p' and Ξ² : q βΌ q' and a natural
coherence
H
f β p ββββββββ g β q
| |
Ξ±* | | Ξ²*
| |
β β
f β p' ββββββββ g β q'
H'
between the homotopies.
\begin{code}
module _ (fe : Fun-Ext) {X : π€ Μ } {Y : π₯ Μ } {Z : π¦ Μ }
(f : X β Z) (g : Y β Z) (A : π£ Μ)
where
open pullback f g
\end{code}
We define reflexive graph structure on the base of a cone whose underlying type
must be (A β X) Γ (A β Y) with edges corresponding to the pair of homotopies
p βΌ p' and q βΌ q'.
\begin{code}
cone-base-refl-graph : Refl-Graph (π€ β π₯ β π£) (π€ β π₯ β π£)
cone-base-refl-graph
= (((A β X) Γ (A β Y)) , I , II)
where
I : ((A β X) Γ (A β Y))
β ((A β X) Γ (A β Y))
β π€ β π₯ β π£ Μ
I (p , q) (p' , q') = (p βΌ p') Γ (q βΌ q')
II : ((p , q) : (A β X) Γ (A β Y)) β (p βΌ p) Γ (q βΌ q)
II (p , q) = (βΌ-refl , βΌ-refl)
\end{code}
That this reflexive graph is univalent is automatic as univalence is closed
under products, functions and the discrete reflexive graph.
\begin{code}
cone-base-is-univalent : is-univalent-refl-graph cone-base-refl-graph
cone-base-is-univalent = univalence-closed-under-Γ
(A β (Ξ X)) (A β (Ξ Y))
(univalence-closed-under-cotensor fe A (Ξ X)
(discrete-refl-graph-is-univalent X))
(univalence-closed-under-cotensor fe A (Ξ Y)
(discrete-refl-graph-is-univalent Y))
\end{code}
We now give the structure of a displayed reflexive graph over the base
whose type family takes pairs of maps and returns commutative squares. The
edges correspond to the natural coherence condition mentioned above.
\begin{code}
cone-displayed-refl-graph
: Displayed-Refl-Graph (π¦ β π£) (π¦ β π£) cone-base-refl-graph
cone-displayed-refl-graph
= (commutative-square , I , II)
where
I : {(p , q) (p' , q') : (A β X) Γ (A β Y)}
((Ξ± , Ξ²) : (p βΌ p') Γ (q βΌ q'))
β commutative-square (p , q)
β commutative-square (p' , q')
β π¦ β π£ Μ
I (Ξ± , Ξ²) H H' = βΌ-trans H (βΌ-ap-β g Ξ²) βΌ βΌ-trans (βΌ-ap-β f Ξ±) H'
II : {(p , q) : (A β X) Γ (A β Y)}
(H : commutative-square (p , q))
β βΌ-trans H βΌ-refl βΌ βΌ-trans βΌ-refl H
II H x = refl-left-neutral β»ΒΉ
\end{code}
To see that the displayed reflexive graph is univalent we only have to look
at the fibers. The luxury here is that the base edges are taken to be the
reflexive data. The fan of interest is equivalent to a fan over what is
essentially the discrete reflexive graph of f β p βΌ g β q (which is manifestly
univalent).
\begin{code}
cone-display-is-univalent
: is-displayed-univalent-refl-graph
cone-base-refl-graph cone-displayed-refl-graph
cone-display-is-univalent (p , q) H
= equiv-to-prop I
(univalence-closed-under-Ξ fe A (Ξ» - β Ξ (f (p -) οΌ g (q -)))
(Ξ» - β discrete-refl-graph-is-univalent (f (p -) οΌ g (q -))) H)
where
I : fan ([ cone-displayed-refl-graph ] (p , q)) H
β fan (β x ΛΈ A , (Ξ (f (p x) οΌ g (q x)))) H
I = (Ξ£ H' κ commutative-square (p , q) ,
βΌ-trans H βΌ-refl βΌ βΌ-trans βΌ-refl H') ββ¨ II β©
(Ξ£ H' κ commutative-square (p , q) , H βΌ H') β
where
II = Ξ£-cong (Ξ» - β transport-β (Ξ» - β H βΌ -)
(dfunext fe (Ξ» x β refl-left-neutral)))
\end{code}
The hard work is done. Since we have a displayed univalent reflexive graph
over a univalent reflexive graph the total reflexive graph is also univalent.
The carrier of this total reflexive graph corresponds to the type of cones.
\begin{code}
cone-total-refl-graph : Refl-Graph (π€ β π₯ β π¦ β π£) (π€ β π₯ β π¦ β π£)
cone-total-refl-graph = (cone-base-refl-graph οΉ cone-displayed-refl-graph)
private
observationβ : β¨ cone-total-refl-graph β© οΌ cone A
observationβ = refl
cone-total-is-univalent : is-univalent-refl-graph cone-total-refl-graph
cone-total-is-univalent
= univalence-closed-under-total cone-base-refl-graph cone-displayed-refl-graph
cone-base-is-univalent cone-display-is-univalent
cone-οΌ-characterization
: (p p' : A β X) (q q' : A β Y)
(H : f β p βΌ g β q) (H' : f β p' βΌ g β q')
β (((p , q) , H) οΌ ((p' , q') , H'))
β (Ξ£ (Ξ± , Ξ²) κ (p βΌ p') Γ (q βΌ q') ,
βΌ-trans H (βΌ-ap-β g Ξ²) βΌ βΌ-trans (βΌ-ap-β f Ξ±) H')
cone-οΌ-characterization p p' q q' H H'
= id-equiv-edge (cone-total-refl-graph , cone-total-is-univalent)
((p , q) , H) ((p' , q') , H')
\end{code}
Example 2:
We now use lenses to generalize an existing characterization of transport (see
file UF.FundamentalLemmaOfTransportAlongEquivalences). We start by defining
transport along an edge.
\begin{code}
module _ (π : Refl-Graph π€ π₯)
(ua-π : is-univalent-refl-graph π)
(P : β¨ π β© β π£ Μ)
where
transport-along-β : {x y : β¨ π β©}
β x ββ¨ π β© y
β P x β P y
transport-along-β e = transport P (edge-to-id (π , ua-π) e)
transport-along-β-comp : {x : β¨ π β©}
β (u : P x)
β transport-along-β (β-refl π x) u οΌ u
transport-along-β-comp u
= transport (Ξ» - β transport P - u οΌ u)
(edge-to-id-preserves-refl (π , ua-π) β»ΒΉ) refl
\end{code}
We now show that if a univalent reflexive graph has an oplax covariant lens
structure on it then push and transport share an edge.
\begin{code}
module _ {π€' π₯' : Universe}
(π : Refl-Graph π€ π₯) (ua-π : is-univalent-refl-graph π)
(π@(π , s) : Oplax-Covariant-Lens π€' π₯' π)
where
open oplax-covariant-lens-structure s
fundamental-theorem-of-transport-for-edges
: {x y : β¨ π β©}
β (e : x ββ¨ π β© y)
β (u : β¨ π x β©)
β push e u ββ¨ π y β© transport-along-β π ua-π (lens-push-fam π) e u
fundamental-theorem-of-transport-for-edges {x} {y} = I II IV x y
where
I : edge-induction π
I = univalence-implies-edge-induction π ua-π
II : (x y : β¨ π β©) β x ββ¨ π β© y β π€' β π₯' Μ
II x y e = (u : β¨ π x β©)
β push e u ββ¨ π y β© transport-along-β π ua-π (lens-push-fam π) e u
III : (x : β¨ π β©) (u : β¨ π x β©)
β u οΌ transport-along-β π ua-π (lens-push-fam π) (β-refl π x) u
III x u = transport-along-β-comp π ua-π (lens-push-fam π) u β»ΒΉ
IV : (x : β¨ π β©) (u : β¨ π x β©)
β push (β-refl π x) u
ββ¨ π x β© transport-along-β π ua-π (lens-push-fam π) (β-refl π x) u
IV x u = transport (Ξ» - β push (β-refl π x) u ββ¨ π x β© -) (III x u)
(push-refl u)
\end{code}
If the oplax lens is itself univalent then we can upgrade the edge to an
identity.
\begin{code}
module _ {π€' π₯' : Universe}
(π : Refl-Graph π€ π₯) (ua-π : is-univalent-refl-graph π)
(π@(π , s) : Oplax-Covariant-Lens π€' π₯' π)
(ua-π : oplax-covariant-lens-is-univalent π π)
where
open oplax-covariant-lens-structure s
fundamental-theorem-of-transport
: {x y : β¨ π β©}
β (e : x ββ¨ π β© y)
β push e βΌ transport-along-β π ua-π (lens-push-fam π) e
fundamental-theorem-of-transport {x} {y} e u
= edge-to-id (π y , ua-π y)
(fundamental-theorem-of-transport-for-edges π ua-π π e u)
\end{code}
It is worth noting that this result follows immediately from the fact that
oplax structure is in fact a property, but this avenue requires function
extensionality.
\begin{code}
private
transport-along-β-is-oplax-structure
: oplax-covariant-lens-structure π€' π₯' π π
transport-along-β-is-oplax-structure
= record {push = I ; push-refl = II}
where
I : {x y : β¨ π β©} β (x ββ¨ π β© y) β β¨ π x β© β β¨ π y β©
I {x} {y} = transport-along-β π ua-π (lens-push-fam π)
II : {x : β¨ π β©} (u : β¨ π x β©)
β (I (β-refl π x) u) ββ¨ π x β© u
II {x} u = id-to-edge (π x)
(transport-along-β-comp π ua-π (lens-push-fam π) u)
oplax-οΌ-transport-structure
: Fun-Ext
β s οΌ transport-along-β-is-oplax-structure
oplax-οΌ-transport-structure fe
= oplax-lens-structure-is-a-property fe π€' π₯' π π ua-π ua-π
s transport-along-β-is-oplax-structure
unique-transport-observation
: Fun-Ext
β {x y : β¨ π β©}
β (e : x ββ¨ π β© y)
β push e βΌ transport-along-β π ua-π (lens-push-fam π) e
unique-transport-observation fe e u
= ap (Ξ» - β lens-push (π , -) e u) (oplax-οΌ-transport-structure fe)
\end{code}
Using the fundamental theorem derived above on the reflexive graph associated
to a univalent universe we can recover the lemma that is stated in the file
UF.FundamentalLemmaOfTransportAlongEquivalences.
\begin{code}
transport-along-β-fundamental-lemma'
: {π€ π₯ : Universe}
(S : π€ Μ β π₯ Μ )
(T : {X Y : π€ Μ } β X β Y β S X β S Y)
(T-refl : {X : π€ Μ } β T (β-refl X) βΌ id)
{X Y : π€ Μ }
(π : X β Y)
(ua : is-univalent π€)
β T π βΌ transport-along-β ua S π
transport-along-β-fundamental-lemma' {π€} {π₯} S T T-refl {X} {Y} π ua s
= III s β IV s β»ΒΉ
where
I = universe-refl-graph π€
II = univalent-universe-is-univalent-family π€ ua
III : T π βΌ transport-along-β I II S π
III = fundamental-theorem-of-transport I II
((Ξ» - β Ξ (S -)) , record {push = T ; push-refl = T-refl})
(Ξ» - β discrete-refl-graph-is-univalent (S -)) π
IV : transport-along-β ua S π βΌ transport-along-β I II S π
IV = fundamental-theorem-of-transport I II
((Ξ» - β Ξ (S -)) , record {push = transport-along-β ua S
; push-refl = Ξ» {x} u
β ap (Ξ» r β transport S r u)
(eqtoid-refl ua x)})
(Ξ» - β discrete-refl-graph-is-univalent (S -)) π
\end{code}
Example 3:
We record the logical equivalence between displayed univalent reflexive graphs
over the reflexive graph on a univalent universe and the standard notion of
structure (SNS) (see UF.SIP) already present in the TypeTopology library.
\begin{code}
module _ {π€ π£ π¦ : Universe} (fe : Fun-Ext) where
open sip hiding (β¨_β©)
displayed-univalent-refl-graph-to-SNS
: (((B , _ , _) , _) : Displayed-Univalent-Refl-Graph π£ π¦
(universe-refl-graph π€))
β SNS B π¦
displayed-univalent-refl-graph-to-SNS (π@(B , R , r) , ua)
= (I , II , III)
where
I : ((X , _) (Y , _) : Ξ£ B) β X β Y β π¦ Μ
I X Y e = structure X ββ¨ π βΈ΄ e β© structure Y
II : ((X , _) : Ξ£ B) β I (X , _) (X , _) (β-refl X)
II X = r (structure X)
obs : {X : π€ Μ} (s t : B X)
β id-to-edge ([ π ] X) {s} {t} οΌ canonical-map I II s t
obs {X} s t = dfunext fe obs'
where
obs' : id-to-edge ([ (B , R , r) ] X) βΌ canonical-map I II s t
obs' refl = refl
III : {X : π€ Μ} (s t : B X)
β is-equiv (canonical-map I II s t)
III {X} s t = transport is-equiv (obs s t)
(prop-fans-implies-id-to-edge-equiv ([ π ] X) (ua X) s t)
SNS-to-displayed-univalent-refl-graph
: (B : π€ Μ β π£ Μ)
β SNS B π¦
β Displayed-Univalent-Refl-Graph π£ π¦ (universe-refl-graph π€)
SNS-to-displayed-univalent-refl-graph B (ΞΉ , Ο , ΞΈ)
= ((B , I , II) , III)
where
I : {X Y : β¨ universe-refl-graph π€ β©} β X β Y β B X β B Y β π¦ Μ
I {X} {Y} e s t = ΞΉ (X , s) (Y , t) e
II : {X : β¨ universe-refl-graph π€ β©} (u : B X)
β ΞΉ (X , u) (X , u) (β-refl (universe-refl-graph π€) X)
II {X} u = Ο (X , u)
obs : {X : π€ Μ} (s t : B X)
β canonical-map ΞΉ Ο s t οΌ id-to-edge ([ (B , I , II) ] X)
obs {X} s t = dfunext fe obs'
where
obs' : canonical-map ΞΉ Ο s t βΌ id-to-edge ([ (B , I , II) ] X)
obs' refl = refl
III : is-displayed-univalent-refl-graph (universe-refl-graph π€) (B , I , II)
III X u = id-to-edge-equiv-implies-prop-fans ([ (B , I , II) ] X)
(Ξ» s t β transport is-equiv (obs s t) (ΞΈ s t)) u
\end{code}
TODO: Characterize the identity type of displayed refl graphs and finish the
proof of equivalence stated below.
displayed-univalent-refl-graph-β-SNS
: (displayed-univalent-refl-graph π£ π¦ (universe-refl-graph π€))
β (Ξ£ B κ (π€ Μ β π£ Μ) , SNS B π¦)
displayed-univalent-refl-graph-β-SNS fe
= (I , qinvs-are-equivs I (II , III , IV))
where
I : (displayed-univalent-refl-graph π£ π¦ (universe-refl-graph π€))
β (Ξ£ B κ (π€ Μ β π£ Μ) , SNS B π¦)
I (π@((B , _ , _) , _)) = (B , displayed-univalent-refl-graph-to-SNS fe π)
II : (Ξ£ B κ (π€ Μ β π£ Μ) , SNS B π¦)
β (displayed-univalent-refl-graph π£ π¦ (universe-refl-graph π€))
II (B , sns) = SNS-to-displayed-univalent-refl-graph fe B sns
III : II β I βΌ id
III ((B , R , r) , ua) = ?
IV : I β II βΌ id
IV (B , (ΞΉ , Ο , ΞΈ)) = ?
Example 4:
We now compare two characterizations of the identity type of β-magmas. The
former characterization directly via displayed reflexive graphs and the latter
via unbiased lenses.
\begin{code}
β-Magma : (π€ : Universe) β (π€ βΊ) Μ
β-Magma π€ = Ξ£ X κ π€ Μ , (X β X β X)
\end{code}
We now define a displayed reflexive graph over π€ of binary operations.
\begin{code}
module _ (π€ : Universe) (ua : is-univalent π€) (fe : Fun-Ext) where
bin-op-displayed-refl-graph : Displayed-Refl-Graph π€ π€ (universe-refl-graph π€)
bin-op-displayed-refl-graph
= ((Ξ» X β (X β X β X)) , I , II)
where
I : {X Y : π€ Μ}
β (X β Y)
β (X β X β X)
β (Y β Y β Y)
β π€ Μ
I {X} {_} e _Β·X_ _Β·Y_ = (x y : X) β β e β (x Β·X y) οΌ (β e β x Β·Y β e β y)
II : {X : π€ Μ}
β (_Β·X_ : X β X β X)
β (x y : X)
β (x Β·X y) οΌ (x Β·X y)
II _Β·X_ x y = refl
bin-op-disp-is-univalent
: is-displayed-univalent-refl-graph (universe-refl-graph π€)
(bin-op-displayed-refl-graph)
bin-op-disp-is-univalent X _Β·X_
= equiv-to-prop I
(Ξ -is-prop fe (Ξ» x β Ξ -is-prop fe Ξ» y
β singletons-are-props (singleton-types-are-singletons (x Β·X y))))
where
I : fan ([ bin-op-displayed-refl-graph ] X) _Β·X_
β ((x y : X) β Ξ£ z κ X , x Β·X y οΌ z)
I = (Ξ£ _Β·X'_ κ (X β X β X) , ((x y : X) β x Β·X y οΌ x Β·X' y)) ββ¨ II β©
((x y : X) β Ξ£ z κ X , x Β·X y οΌ z) β
where
II = β-sym (β-comp (Ξ -cong fe fe (Ξ» x β Ξ Ξ£-distr-β)) Ξ Ξ£-distr-β)
\end{code}
Now we can give the total univalent reflexive graph whose carrier is the type
of β-magmas and then characterize the type of identifications of them.
\begin{code}
β-Magma-total-refl-graph : Refl-Graph (π€ βΊ) π€
β-Magma-total-refl-graph
= (universe-refl-graph π€ οΉ bin-op-displayed-refl-graph)
private
observationβ : β¨ β-Magma-total-refl-graph β© οΌ β-Magma π€
observationβ = refl
β-Magma-total-univalent-refl-graph
: is-univalent-refl-graph (β-Magma-total-refl-graph)
β-Magma-total-univalent-refl-graph
= univalence-closed-under-total
(universe-refl-graph π€)
(bin-op-displayed-refl-graph)
(univalent-universe-is-univalent-family π€ ua)
(bin-op-disp-is-univalent)
β-Magma-οΌ-char
: ((X , _Β·X_) (Y , _Β·Y_) : β-Magma π€)
β ((X , _Β·X_) οΌ (Y , _Β·Y_))
β (Ξ£ e κ X β Y , ((x y : X) β β e β (x Β·X y) οΌ (β e β x Β·Y β e β y)))
β-Magma-οΌ-char (X , _Β·X_) (Y , _Β·Y_)
= id-equiv-edge
(β-Magma-total-refl-graph , β-Magma-total-univalent-refl-graph)
(X , _Β·X_) (Y , _Β·Y_)
\end{code}
We may instead utilize the unbiased lense machinery, which allows us to
characterize structures that have 'mixed variance'.
\begin{code}
module _ (π€ : Universe) (ua : is-univalent π€) (fe : Fun-Ext) where
β-Magma-unbiased-lens : Unbiased-Lens π€ π€ (universe-refl-graph π€)
β-Magma-unbiased-lens =
(I , record
{ lext = Ξ» e u β Ξ» x x' β β e β (u x x')
; rext = Ξ» e u β Ξ» x x' β u (β e β x) (β e β x')
; ext-refl = Ξ» u x x' β refl
; rext-refl = Ξ» u x x' β refl })
where
I : {x y : β¨ universe-refl-graph π€ β©}
β x ββ¨ universe-refl-graph π€ β© y
β Refl-Graph π€ π€
I {X} {Y} e = X β (X β (Ξ Y))
β-Magma-unbiased-lens-is-univalent
: unbiased-lens-is-univalent (universe-refl-graph π€) β-Magma-unbiased-lens
β-Magma-unbiased-lens-is-univalent {X} {Y} p
= univalence-closed-under-cotensor fe X (X β (Ξ Y))
(univalence-closed-under-cotensor fe X (Ξ Y)
(discrete-refl-graph-is-univalent Y))
β-Magma-unbiased-lens-display
: Displayed-Refl-Graph π€ π€ (universe-refl-graph π€)
β-Magma-unbiased-lens-display
= dispΒ± (universe-refl-graph π€) β-Magma-unbiased-lens
β-Magma-unbiased-lens-display-univalent
: is-displayed-univalent-refl-graph (universe-refl-graph π€)
β-Magma-unbiased-lens-display
β-Magma-unbiased-lens-display-univalent
= disp-unbiased-lens-univalent (universe-refl-graph π€) β-Magma-unbiased-lens
(Ξ» x β β-Magma-unbiased-lens-is-univalent (β-refl x))
β-Magma-unbiased-lens-total
: Refl-Graph (π€ βΊ) π€
β-Magma-unbiased-lens-total
= universe-refl-graph π€ οΉ β-Magma-unbiased-lens-display
private
observationβ : β¨ β-Magma-unbiased-lens-total β© οΌ β-Magma π€
observationβ = refl
β-Magma-unbiased-lens-total-univalent
: is-univalent-refl-graph β-Magma-unbiased-lens-total
β-Magma-unbiased-lens-total-univalent
= univalence-closed-under-total
(universe-refl-graph π€) β-Magma-unbiased-lens-display
(univalent-universe-is-univalent-family π€ ua)
β-Magma-unbiased-lens-display-univalent
β-Magma-unbiased-lens-οΌ-char
: ((X , _Β·X_) (Y , _Β·Y_) : β-Magma π€)
β ((X , _Β·X_) οΌ (Y , _Β·Y_))
β (Ξ£ e κ X β Y , ((x y : X) β β e β (x Β·X y) οΌ (β e β x Β·Y β e β y)))
β-Magma-unbiased-lens-οΌ-char (X , _Β·X_) (Y , _Β·Y_)
= id-equiv-edge
(β-Magma-unbiased-lens-total , β-Magma-unbiased-lens-total-univalent)
(X , _Β·X_) (Y , _Β·Y_)
\end{code}
Appealing simply to line counting one could not justify the latter approach to
characterizing the identity type of β-Magma. But we would like to point out a
few advantages. We get the displayed reflexive graph (and its univalence) for
free just by identifying what we want the left and right hand side of the
equation relating the mixed variance data to be. This offers a blueprint for
characterizing mixed variance structures of increasingly complicated nature
where "guessing" (or maybe it is more apt to say "being clever") is not
feasible.
TODO: Currently we are exploring a number of results of similar flavor to the
one below. When such a file is added we will move the following result and
import that file here.
If we have a univalent lens with underlying propositionally valued family then
the total reflexive graph induced by the lens carries no new edge information.
\begin{code}
univalent-prop-lens-edge-char
: (π : Refl-Graph π€ π₯)
β (π : Oplax-Covariant-Lens π£ π£' π)
β oplax-covariant-lens-is-univalent π π
β ((x : β¨ π β©) β is-prop (lens-push-fam π x))
β (x y : β¨ π β©) (u : lens-push-fam π x) (v : lens-push-fam π y)
β (x , u) ββ¨ π οΉ dispβΊ π π β© (y , v) β x ββ¨ π β© y
univalent-prop-lens-edge-char π π ua-π prop-lens x y u v
= (x , u) ββ¨ π οΉ dispβΊ π π β© (y , v) ββ¨reflβ©
(Ξ£ p κ x ββ¨ π β© y , lens-push π p u ββ¨ lens-push-graph π y β© v) ββ¨ I β©
(Ξ£ p κ x ββ¨ π β© y , lens-push π p u οΌ v) ββ¨ II β©
x ββ¨ π β© y β
where
I = Ξ£-cong (Ξ» - β β-sym (id-equiv-edge (lens-push-graph π y , ua-π y)
(lens-push π - u) v))
II = prβ-β (x ββ¨ π β© y) (Ξ» - β lens-push π - u οΌ v)
(Ξ» - β pointed-props-are-singletons (prop-lens y (lens-push π - u) v)
(props-are-sets (prop-lens y)))
\end{code}
Example 5:
We use the previous fact to give a characterization of the identity type of
hSets. Although we make no claims that this characterization of hSet identity
is superior, it suggests a methodology for characterizing the identity type of
more complicated structures with propositional lenses.
\begin{code}
module _ (π€ : Universe) (ua : is-univalent π€) (fe : Fun-Ext) where
hSet-lens : Oplax-Covariant-Lens π€ π€ (universe-refl-graph π€)
hSet-lens = (I , II)
where
I : π€ Μ β Refl-Graph π€ π€
I X = Ξ (is-set X)
II : oplax-covariant-lens-structure π€ π€ (universe-refl-graph π€) I
II = record
{push = equiv-to-set β β-sym
; push-refl = Ξ» {X} is-set β being-set-is-prop fe
((equiv-to-set β β-sym) (β-refl X) is-set) is-set}
hSet-refl-graph : Refl-Graph (π€ βΊ) π€
hSet-refl-graph
= universe-refl-graph π€ οΉ dispβΊ (universe-refl-graph π€) hSet-lens
private
observationβ : β¨ hSet-refl-graph β© οΌ hSet π€
observationβ = refl
hSet-refl-graph-is-univalent : is-univalent-refl-graph hSet-refl-graph
hSet-refl-graph-is-univalent
= univalence-closed-under-total (universe-refl-graph π€)
(dispβΊ (universe-refl-graph π€) hSet-lens)
(univalent-universe-is-univalent-family π€ ua)
(Ξ» X β disp-oplax-covariant-lens-univalent (universe-refl-graph π€)
hSet-lens (Ξ» - β discrete-refl-graph-is-univalent (is-set -)) X)
hSet-univalent-refl-graph : Univalent-Refl-Graph (π€ βΊ) π€
hSet-univalent-refl-graph
= (hSet-refl-graph , hSet-refl-graph-is-univalent)
hSet-οΌ-char : (X Y : hSet π€)
β (X οΌ Y) β (underlying-set X β underlying-set Y)
hSet-οΌ-char π§@(X , X-is-set) π¨@(Y , Y-is-set)
= (π§ οΌ π¨) ββ¨ I β©
(π§ ββ¨ hSet-refl-graph β© π¨) ββ¨ II β©
(X β Y) β
where
I = id-equiv-edge hSet-univalent-refl-graph π§ π¨
II = univalent-prop-lens-edge-char (universe-refl-graph π€)
hSet-lens (Ξ» - β discrete-refl-graph-is-univalent (is-set -))
(Ξ» _ β being-set-is-prop fe) X Y X-is-set Y-is-set
\end{code}