ReflexiveGraphs.Univalent
Ian Ray. 2nd September 2025. Minor changes and merged into TypeTopology in February 2026. We provide some equivalent descriptions of univalent reflexive graphs (see index for references to Sterling, Buchholtz, etc.) In this file we give some properties about fans (terminology borrowed from Sterling), which are analogous to singletons up to the edge relation. Then we provide some equivalent characterizations of univalent reflexive graphs. It is worth noting that, although Sterling makes no choice for the defintion in his paper, we are required to. There is good reason to go with the 'propositional fans' definition as it simplifies many proofs later on.{-# OPTIONS --safe --without-K #-} module ReflexiveGraphs.Univalent where open import MLTT.Spartan open import UF.Equiv open import UF.EquivalenceExamples open import UF.PropIndexedPiSigma open import UF.Retracts open import UF.Subsingletons open import UF.Subsingletons-Properties open import ReflexiveGraphs.Type module _ (π : Refl-Graph π€ π₯) where fan : β¨ π β© β π€ β π₯ Μ fan x = Ξ£ y κ β¨ π β© , x ββ¨ π β© y cofan : β¨ π β© β π€ β π₯ Μ cofan x = Ξ£ y κ β¨ π β© , y ββ¨ π β© xWe show that propositional fans imply propositional cofans and vice versa. The crux of the proofs is to observe that if (y , s) : cofan x for some x then (x , s) : fan y, the rest amounts to shuffling data within sigma types. It is worth noting that the proofs that follow were originally discovered as a string of equivalences, but to witness the equivalence requires function extensionality. The underlying maps of the equivalences are sufficient for the proof to go through and thus we are able to avoid appeals to function extensionality.prop-fan-to-cofan : ((x : β¨ π β©) β is-prop (fan x)) β ((x : β¨ π β©) β is-prop (cofan x)) prop-fan-to-cofan fan-prop = I βΌ-refl where I = ((x : β¨ π β©) β is-prop (cofan x)) ββ¨ id β© ((x : β¨ π β©) β ((y , s) (y' , t) : cofan x) β (y , s) οΌ (y' , t)) ββ¨ II β© ((x y : β¨ π β©) (s : y ββ¨ π β© x) (y' : β¨ π β©) (t : y' ββ¨ π β© x) β (y , s) οΌ (y' , t)) ββ¨ III β© ((y x : β¨ π β©) (s : y ββ¨ π β© x) (y' : β¨ π β©) (t : y' ββ¨ π β© x) β (y , s) οΌ (y' , t)) ββ¨ IV β© ((y : β¨ π β©) ((x , s) : fan y) (y' : β¨ π β©) (t : y' ββ¨ π β© x) β (y , s) οΌ (y' , t)) ββ¨ V β© ((y y' : β¨ π β©) (t : y' ββ¨ π β© y) β (y , β-refl π y) οΌ (y' , t)) ββ¨ VI β© ((y' y : β¨ π β©) (t : y' ββ¨ π β© y) β (y , β-refl π y) οΌ (y' , t)) ββ¨ VII β© ((y' : β¨ π β©) ((y , t) : fan y') β (y , β-refl π y) οΌ (y' , t)) ββ¨ VIII β© ((y' : β¨ π β©) β (y' , β-refl π y') οΌ[ fan y' ] (y' , β-refl π y')) β’ where II = (Ξ» f x (y , s) (y' , t) β f x y s y' t) III = (Ξ» f x y β f y x) IV = (Ξ» f y x s y' t β f y (x , s) y' t) V = (Ξ» f y β Ξ -projβ»ΒΉ (y , β-refl π y) (fan-prop y) (f y)) VI = (Ξ» f y' y β f y y') VII = (Ξ» f y' y t β f y' (y , t)) VIII = (Ξ» _ y' β Ξ -projβ»ΒΉ (y' , β-refl π y') (fan-prop y') refl) prop-cofan-to-fan : ((x : β¨ π β©) β is-prop (cofan x)) β ((x : β¨ π β©) β is-prop (fan x)) prop-cofan-to-fan co-prop = I βΌ-refl where I = ((x : β¨ π β©) β is-prop (fan x)) ββ¨ id β© ((x : β¨ π β©) β ((y , s) (y' , t) : fan x) β (y , s) οΌ (y' , t)) ββ¨ II β© ((x y : β¨ π β©) (s : x ββ¨ π β© y) (y' : β¨ π β©) (t : x ββ¨ π β© y') β (y , s) οΌ (y' , t)) ββ¨ III β© ((y x : β¨ π β©) (s : x ββ¨ π β© y) (y' : β¨ π β©) (t : x ββ¨ π β© y') β (y , s) οΌ (y' , t)) ββ¨ IV β© ((y : β¨ π β©) ((x , s) : cofan y) (y' : β¨ π β©) (t : x ββ¨ π β© y') β (y , s) οΌ (y' , t)) ββ¨ V β© ((y y' : β¨ π β©) (t : y ββ¨ π β© y') β (y , β-refl π y) οΌ (y' , t)) ββ¨ VI β© ((y' y : β¨ π β©) (t : y ββ¨ π β© y') β (y , β-refl π y) οΌ (y' , t)) ββ¨ VII β© ((y' : β¨ π β©) ((y , t) : cofan y') β (y , β-refl π y) οΌ (y' , t)) ββ¨ VIII β© ((y' : β¨ π β©) β (y' , β-refl π y') οΌ[ fan y' ] (y' , β-refl π y')) β’ where II = (Ξ» f x (y , s) (y' , t) β f x y s y' t) III = (Ξ» f x y β f y x) IV = (Ξ» f y x s y' t β f y (x , s) y' t) V = (Ξ» f y β Ξ -projβ»ΒΉ (y , β-refl π y) (co-prop y) (f y)) VI = (Ξ» f y y' β f y' y) VII = (Ξ» f y' y t β f y' (y , t)) VIII = (Ξ» _ y' β Ξ -projβ»ΒΉ (y' , β-refl π y') (co-prop y') refl) contr-fan-to-prop : ((x : β¨ π β©) β is-contr (fan x)) β ((x : β¨ π β©) β is-prop (fan x)) contr-fan-to-prop fan-contr x = singletons-are-props (fan-contr x) prop-fan-to-contr : ((x : β¨ π β©) β is-prop (fan x)) β ((x : β¨ π β©) β is-contr (fan x)) prop-fan-to-contr fan-prop x = pointed-props-are-singletons (x , β-refl π x) (fan-prop x) contr-fan-to-cofan : ((x : β¨ π β©) β is-contr (fan x)) β ((x : β¨ π β©) β is-contr (cofan x)) contr-fan-to-cofan contr-fan x = pointed-props-are-singletons (x , β-refl π x) (prop-fan-to-cofan (Ξ» - β singletons-are-props (contr-fan -)) x) prop-fan-to-contr-cofan : ((x : β¨ π β©) β is-prop (fan x)) β ((x : β¨ π β©) β is-contr (cofan x)) prop-fan-to-contr-cofan fan-prop x = contr-fan-to-cofan (prop-fan-to-contr fan-prop) x contr-cofan-to-fan : ((x : β¨ π β©) β is-contr (cofan x)) β ((x : β¨ π β©) β is-contr (fan x)) contr-cofan-to-fan contr-cofan x = pointed-props-are-singletons (x , β-refl π x) (prop-cofan-to-fan (Ξ» - β singletons-are-props (contr-cofan -)) x)We give the canonical function from an identification to an edge.id-to-edge : {x y : β¨ π β©} β x οΌ y β x ββ¨ π β© y id-to-edge {x} {x} refl = β-refl π xIf each fan is propositional then id-to-edge is an equivalence.private helper-edge-to-id : {x y : β¨ π β©} β (p : x ββ¨ π β© y) β (x , β-refl π x) οΌ (y , p) β x οΌ y helper-edge-to-id _ refl = refl module _ (prop-fans : ((x : β¨ π β©) β is-prop (fan x))) (x y : β¨ π β©) where prop-fans-edge-to-id : x ββ¨ π β© y β x οΌ y prop-fans-edge-to-id p = helper-edge-to-id p (prop-fans x (x , β-refl π x) (y , p)) prop-fans-gives-retraction : has-retraction id-to-edge prop-fans-gives-retraction = (prop-fans-edge-to-id , II) where I : prop-fans x (x , β-refl π x) (x , β-refl π x) οΌ refl I = props-are-sets (prop-fans x) (prop-fans x (x , β-refl π x) (x , β-refl π x)) refl II : (p : x οΌ y) β prop-fans-edge-to-id (id-to-edge p) οΌ p II refl = ap (helper-edge-to-id (β-refl π x)) I id-are-retracts-of-edges : retract (x οΌ y) of (x ββ¨ π β© y) id-are-retracts-of-edges = (prop-fans-edge-to-id , id-to-edge , retraction-equation id-to-edge prop-fans-gives-retraction) prop-fans-gives-section : has-section id-to-edge prop-fans-gives-section = (prop-fans-edge-to-id , II) where I : (p : x ββ¨ π β© y) (Ο : (x , β-refl π x) οΌ (y , p)) β id-to-edge (helper-edge-to-id p Ο) οΌ p I p refl = refl II : (p : x ββ¨ π β© y) β id-to-edge (prop-fans-edge-to-id p) οΌ p II p = I p (prop-fans x (x , β-refl π x) (y , p)) edges-are-retracts-of-id : retract (x ββ¨ π β© y) of (x οΌ y) edges-are-retracts-of-id = (id-to-edge , prop-fans-gives-section) id-to-edge-equiv-implies-prop-fans : ((x y : β¨ π β©) β is-equiv id-to-edge) β ((x : β¨ π β©) β is-prop (fan x)) id-to-edge-equiv-implies-prop-fans e = contr-fan-to-prop fan-is-contr where fan-is-contr : (x : β¨ π β©) β is-contr (fan x) fan-is-contr x = equiv-to-singleton' (Ξ£-cong (Ξ» y β id-to-edge , e x y)) (singleton-types-are-singletons x) prop-fans-implies-id-to-edge-equiv : ((x : β¨ π β©) β is-prop (fan x)) β ((x y : β¨ π β©) β is-equiv id-to-edge) prop-fans-implies-id-to-edge-equiv prop-fans x y = (prop-fans-gives-section prop-fans x y , prop-fans-gives-retraction prop-fans x y)We now define univalent reflexive graphs in terms of propositional fans, but one could use any of the equivalent characterizations.is-univalent-refl-graph : (π : Refl-Graph π€ π₯) β π€ β π₯ Μ is-univalent-refl-graph π = (x : β¨ π β©) β is-prop (fan π x) Univalent-Refl-Graph : (π€ π₯ : Universe) β (π€ β π₯)βΊ Μ Univalent-Refl-Graph π€ π₯ = Ξ£ π κ (Refl-Graph π€ π₯) , is-univalent-refl-graph πWe will now record some boiler plate code for univalent reflexive graphs.β¨_β©α΅€ : Univalent-Refl-Graph π€ π₯ β π€ Μ β¨ (π , _) β©α΅€ = β¨ π β© edge-relα΅€ : (π : Univalent-Refl-Graph π€ π₯) β β¨ π β©α΅€ β β¨ π β©α΅€ β π₯ Μ edge-relα΅€ (π , _) = edge-rel π syntax edge-relα΅€ π x y = x βα΅€β¨ π β© y β-reflα΅€ : (π : Univalent-Refl-Graph π€ π₯) β (x : β¨ π β©α΅€) β x βα΅€β¨ π β© x β-reflα΅€ (π , _) x = β-refl π x underlying-refl-graph : (π : Univalent-Refl-Graph π€ π₯) β Refl-Graph π€ π₯ underlying-refl-graph (π , _) = π syntax underlying-refl-graph π = π /α΅€ underlying-refl-graph-is-univalent : (π : Univalent-Refl-Graph π€ π₯) β is-univalent-refl-graph (π /α΅€) underlying-refl-graph-is-univalent (π , is-ua) = is-ua id-equiv-edge : (π : Univalent-Refl-Graph π€ π₯) β (x y : β¨ π β©α΅€) β (x οΌ y) β (x βα΅€β¨ π β© y) id-equiv-edge π x y = (id-to-edge (π /α΅€) , prop-fans-implies-id-to-edge-equiv (underlying-refl-graph π) (underlying-refl-graph-is-univalent π) x y) edge-to-id : (π : Univalent-Refl-Graph π€ π₯) {x y : β¨ π β©α΅€} β x βα΅€β¨ π β© y β x οΌ y edge-to-id π {x} {y} = β id-equiv-edge π x y ββ»ΒΉ edge-to-id-preserves-refl : (π : Univalent-Refl-Graph π€ π₯) {x : β¨ π β©α΅€} β edge-to-id π (β-refl (π /α΅€) x) οΌ refl edge-to-id-preserves-refl π {x} = inverses-are-retractions (id-to-edge (π /α΅€)) (prop-fans-implies-id-to-edge-equiv (underlying-refl-graph π) (underlying-refl-graph-is-univalent π) x x) reflWe show univalence implies edge induction. TODO: show they are also equivalent.module _ (π : Refl-Graph π€ π₯) where edge-induction : π€Ο edge-induction = {π£ : Universe} (P : (x y : β¨ π β©) β (x ββ¨ π β© y) β π£ Μ) β ((x : β¨ π β©) β P x x (β-refl π x)) β (x y : β¨ π β©) β (p : x ββ¨ π β© y) β P x y p univalence-implies-edge-induction : is-univalent-refl-graph π β edge-induction univalence-implies-edge-induction ua P R x y p = I (ua x (x , β-refl π x) (y , p)) where I : (x , β-refl π x) οΌ (y , p) β P x y p I refl = R x