Martin Escardo, 22nd October 2024 - 15 June 2025
Abstract. Both here in TypeTopology and in the publication
[0] Mathematical Structures in Computer Science, Cambridge University
Press, 5th January 2021.
https://doi.org/10.1017/S0960129520000225
we defined notions of "algebraically injective" and "algebraically
flabby" type.
Here we rename these notions to "injective structure" and "flabby
structure", and define new notions of "algebraically injective" and
"algebraically flabby" structure, so that the following are isomorphic
for any *set* D:
(i) Algebraic injective structure on D.
(ii) Algebraic flabby structure on D.
(iii) π-algebra structure on D, where π is the lifting monad, also
known as the partial-map classifier monad.
This theorem applies to objects D of (elementary) 1-toposes, given
that we work constructively in HoTT/UF here, without assuming
univalence.
For an arbitrary type D, we only prove the above to be *logical
equivalences*, but perhaps there is a chance that they are actually
typal equivalences, and we leave this as an open problem.
The following ASSUME slides (https://tdejong.com/ASSUME/) discuss
this, but we include most of the discussion here in comments.
[1] Taking "algebraically" seriously in the definition of
algebraically injective type.
https://cs.bham.ac.uk/~mhe/.talks/2025-05-29-Note-09-58-algebraic-injectives-assume_pdf.pdf
Introduction. We give conditions on injective structure on a type D so
that it coincides with the algebraic structure for the partial-map
classifier (aka lifting) monad π on types, when D is a set, and we
also have partial results in this direction when D is a general type.
We call these conditions "associativity" and "pullback naturality".
Associativity says that an extension (f|j)|k of an extension f|j is
the extension f|(kβj) along the composition of the embeddings j and k,
as in the following commutative diagram:
j k
X βββββββ Y βββββββ Z
β² β β±
β² β β±
f β² β f|j β± (f|j)|k = fβ£(kβj)
β² β β±
β² β β±
β² β β±
β β β
D.
Pullback naturality is expressed by the following diagram, where the
square is a pullback and j (and hence k) is an embedding:
k
A βββββββ B
β β β
g β β h
β β
β j β
X βββββββ Y
β² β
β² β
f β² β f|j β h = (f β g) | k
β² β
β² β
β² β
β β
D.
It actually suffices to consider pullbacks of the form
fiber j y βββββ π
β β β
β β y
β β
β j β
X βββββββ Y.
This is a sense in which extensions are pointwise (or fiberwise).
One may wonder whether it is reasonable to consider naturality with
respect to all commutative squares which are not necessarily pullbacks,
k
A βββββββ B
β β
g β β h
β β
β j β
X βββββββ Y,
where j and k are embeddings. However, a counter-example is the
commutative square
π βββββββ π
β β
β β
β β
β β
π βββββββ π.
Now, an algebra Ξ± : π D β D of the lifting monad amounts flabbiness
structure plus an associativity law on this structure. Via the
canonical correspondence between algebraic injective structure and
algebraic flabby structure, the above associativity condition
corresponds to the associativity law for π-algebras (which justifies
our terminology in the case of injectivity). In terms of flabbinnes,
this says that if we have a situation
P Γ Q βββββ π
β² β
β² β
f β² β
β² β
β² β
β² β
β β
D
where P and Q propositions, so that also P Γ Q is a proposition, then
we can
1. extend f at once, or
2. extend f in its first variable and then in its second variable,
and these two processes give the same result. More precisely, rather
than P Γ Q we have the type Ξ£ p : P , Q p, where Q depends on p : P,
but this doesn't make any difference, as shown in the study of the
lifting monad elsewhere in this development.
As for pullback naturality, it is given automatically by the canonical
construction of algebraic injectivity data from algebraic flabiness
data.
If we define homomorphisms h : D β E of algebraic injectives in the
obvious way, namely, that for any f : X β D and j : X βͺ Y we have that
h β f β£ j = (h β f) β£ j
as (partially) illustrated by the (incomplete, due to typographical
reasons) diagram
j
X ββββββββ Y
β² β±
β² β±
f β² β± f/j
β β
D
β
β h
β
E,
then injective homomorphisms correspond to π-homomorphisms.
When we restrict to types that are sets, we get that the category of
associative, pullback-natural algebraically injective objects is
isomorphic to the category of π-algebras.
This result holds for the objects of any 1-topos, due to our
constructive reasoning in a restricted type theory.
However, at the moment we don't have a result for β-toposes, because,
although the associativity, pullback naturality and the algebra
equations are all property for sets, they are data for arbitrary
types, and we have proved only a logical equivalence of associativity
+ pullback-naturality with the π-algebra equations, rather than a full
type equivalence (whose possibility is an interesting open problem).
\begin{code}
{-# OPTIONS --safe --without-K --lossy-unification #-}
open import MLTT.Spartan hiding (_β_)
open import UF.FunExt
\end{code}
In this file we work with an arbitrary type D in a universe π¦.
\begin{code}
module InjectiveTypes.Algebra
{π¦ : Universe}
(D : π¦ Μ )
where
open import InjectiveTypes.Structure
open import UF.Embeddings renaming (_ββͺ_ to _β_)
open import UF.Equiv
open import UF.EquivalenceExamples
open import UF.Pullback
open import UF.Sets
open import UF.Subsingletons
open import UF.Subsingletons-FunExt
open import UF.SubtypeClassifier
\end{code}
Definitions of associativity and pullback naturality for injective
structure.
\begin{code}
module _
{π€ : Universe}
(s@(_β£_ , _) : injective-structure D π€ π€)
where
injective-associativity : π¦ β π€ βΊ Μ
injective-associativity = (X Y Z : π€ Μ ) (f : X β D) (π : X βͺ Y) (π : Y βͺ Z)
β f β£ (π β π) βΌ (f β£ π) β£ π
\end{code}
For the following definition, we consider the standard pullback
pbβ
pullback j h ββββββ B
β β β
pbβ β β h
β β
β j β
X βββββββ Y,
where
pullback j h := Ξ£ (x , y) κ X Γ B , j x οΌ h y
and pbβ and pbβ are the projections, rather than an abstract pullback,
for simplicity, so that the above naturality condition becomes
pbβ
pullback j h ββββββ B
β β β
pbβ β β h
β β
β j β
X βββββββ Y
β² β
β² β
f β² β (f | j) β h = (f β pbβ) | pbβ
β² β
β² β
β² β
β β
D.
\begin{code}
pullback-naturality : (π€ βΊ) β π¦ Μ
pullback-naturality = (X Y B : π€ Μ )
(f : X β D)
(π : X βͺ Y)
(h : B β Y)
β let open pullback β π β h renaming (pullback to A)
ππβ : A βͺ B
ππβ = π‘πβ β π β-is-embedding
in (f β£ π) β h βΌ (f β pbβ) β£ ππβ
\end{code}
The following is a particular case of this notion, but also equivalent
to it.
\begin{code}
extensions-are-fiberwise : π€ βΊ β π¦ Μ
extensions-are-fiberwise = (X Y : π€ Μ )
(f : X β D)
(π : X βͺ Y)
(y : Y)
β (f β£ π) y οΌ ((f β fiber-point) β£ fiber-to-π π y) β
\end{code}
The following implicitly uses the fact that the diagram
fiber j y ββββββ π
β β β
fiber-point β β y
β β
β j β
X βββββββ Y
is a pullback (perhaps we should make this explicit in the proof, but
this involves adding more material to the current material on
pullabacks (TODO)).
\begin{code}
pullback-naturality-gives-that-extensions-are-fiberwise
: propext π€
β funext π€ π€
β pullback-naturality
β extensions-are-fiberwise
pullback-naturality-gives-that-extensions-are-fiberwise pe fe pbn X Y f π y
= II
where
h : π {π€} β Y
h _ = y
open pullback β π β h renaming (pullback to A)
Ο = A ββ¨ β-refl _ β©
(Ξ£ z κ X Γ π , β π β (prβ z) οΌ y) ββ¨ Ξ£-assoc β©
(Ξ£ x κ X , π Γ (β π β x οΌ y)) ββ¨ Ξ£-cong (Ξ» x β π-lneutral) β©
fiber β π β y β
ππβ : A βͺ π
ππβ = π‘πβ β π β-is-embedding
ππβ : X Γ π βͺ X
ππβ = π‘π£β (Ξ» _ β π-is-prop)
_ : pbβ οΌ fiber-point β β Ο β
_ = refl
I : ππβ οΌ embedding-to-π
I = to-subtype-οΌ (being-embedding-is-prop fe) refl
β¨ : (P : Ξ© π€) β (P holds β D) β D
β¨ P g = (g β£ embedding-to-π) β
II = (f β£ π) y οΌβ¨ by-pbn β©
((f β pbβ) β£ ππβ) β οΌβ¨ refl β©
((f β fiber-point β β Ο β) β£ ππβ) β οΌβ¨ by-I β©
((f β fiber-point β β Ο β) β£ embedding-to-π) β οΌβ¨ refl β©
β¨ (Fiber (π β ππβ) y) (f β fiber-point β β Ο β) οΌβ¨ change-of-var β»ΒΉ β©
β¨ (Fiber π y) (f β fiber-point) οΌβ¨ refl β©
((f β fiber-point) β£ fiber-to-π π y) β β
where
by-pbn = pbn X Y π f π h β
by-I = ap (Ξ» - β ((f β fiber-point β β Ο β) β£ -) β) I
change-of-var = β¨-change-of-variable D pe fe β¨ (f β fiber-point)
(β Ο ββ»ΒΉ , β Ο β)
\end{code}
TODO. At the moment, we define pullback naturality with respect to the
canonical, or chosen, pullback. But the above argument actually shows
that this implies naturality with respect to any pullback. So we
should reformulate the above in this way, and then use the (already
proved) fact that fibers are pullbacks. This is low priority, but it
is interesting for conceptual reasons.
We now observe that the pullback requirement in the naturality
condition is essential, no matter which injective structure we have,
provided D has the property that for every d : D there is a designated
d' β d. This is the case in all examples of algebraically injective
types we've identified so far (for example, for the universe, d' can
be given by negation). We also need function extensionality for
functions defined on the empty type (but we assume general function
extensionality).
\begin{code}
module counter-example-to-general-naturality
(Ο : D β D)
(Ξ΄ : (d : D) β Ο d β d)
(π€ π₯ : Universe)
((_β£_ , _β£_-is-extension) : injective-structure D π€ π₯)
(fe : funext π€ π¦)
where
A X : π€ Μ
B Y : π₯ Μ
A = π
B = π
X = π
Y = π
π : A βͺ B
π : X βͺ Y
g : A β X
h : B β Y
π = unique-from-π , unique-from-π-is-embedding
π = unique-to-π , maps-of-props-are-embeddings _ π-is-prop π-is-prop
g = unique-from-π
h = id
fβ : A β D
fβ = unique-from-π
dβ : D
dβ = (fβ β£ π) β
f : X β D
f _ = Ο dβ
naturality-failure : Β¬ ((f β£ π) β h βΌ (f β g) β£ π)
naturality-failure p = Ξ΄ dβ II
where
I : f β g οΌ fβ
I = dfunext fe (Ξ» x β π-elim x)
II = Ο dβ οΌβ¨ refl β©
f β οΌβ¨ (_β£_-is-extension f π β)β»ΒΉ β©
(f β£ π) (β π β β) οΌβ¨ refl β©
(f β£ π) β οΌβ¨ refl β©
((f β£ π) β h) β οΌβ¨ p β β©
((f β g) β£ π) β οΌβ¨ ap (Ξ» - β (- β£ π) β) I β©
(fβ β£ π) β οΌβ¨ refl β©
dβ β
\end{code}
The notion of flabby associativity.
\begin{code}
module _
{π€ : Universe}
(s@(β¨ , _) : flabby-structure D π€)
where
flabby-associativity : π€ βΊ β π¦ Μ
flabby-associativity = (P : Ξ© π€) (Q : P holds β Ξ© π€) (f : ΣΩ Q holds β D)
β β¨ (ΣΩ Q) f οΌ β¨ P (Ξ» p β β¨ (Q p) (Ξ» q β f (p , q)))
\end{code}
We now show that flabby associativity implies injective associativity
and pullback naturality of the derived injective structure, assuming
propositional and functional extensionality.
\begin{code}
module _
(pe : Prop-Ext)
(fe : Fun-Ext)
where
private
_β£_ : {X Y : π€ Μ } β (X β D) β (X βͺ Y) β (Y β D)
_β£_ = injective-extension-operator D (derived-injective-structure D s)
derived-injective-associativity
: flabby-associativity
β injective-associativity (derived-injective-structure D s)
derived-injective-associativity fassoc X Y Z f π π z = V
where
I : β¨ (ΣΩ w κ Fiber π z , Fiber π (fiber-point w)) (Ξ» q β f (fiber-point (prβ q)))
οΌ β¨ (Fiber π z) (Ξ» u β β¨ (Fiber π (fiber-point u)) (f β fiber-point))
I = fassoc
(Fiber π z)
(Ξ» (p : fiber β π β z) β Fiber π (fiber-point p))
(Ξ» (q : (Ξ£ w κ fiber β π β z , fiber β π β (fiber-point w)))
β f (fiber-point (prβ q)))
II : (fiber β π β π β z) β (Ξ£ w κ fiber β π β z , fiber β π β (fiber-point w))
II = fiber-of-composite β π β β π β z
III : β¨ (Fiber (π β π) z) (f β fiber-point)
οΌ β¨ (ΣΩ w κ Fiber π z , Fiber π (fiber-point w)) (Ξ» q β f (fiber-point (prβ q)))
III = β¨-change-of-variable-β D pe fe β¨ (f β fiber-point) II
IV : β¨ (Fiber (π β π) z) (f β fiber-point)
οΌ β¨ (Fiber π z) (Ξ» w β β¨ (Fiber π (fiber-point w)) (f β fiber-point))
IV = III β I
V : (f β£ (π β π)) z οΌ ((f β£ π) β£ π) z
V = IV
derived-injective-fiberwise-extensions
: extensions-are-fiberwise (derived-injective-structure D s)
derived-injective-fiberwise-extensions X Y f π y
= I
where
I : (f β£ π) y οΌ ((f β fiber-point) β£ fiber-to-π π y) β
I = derived-injective-structure-operator-lemma D s pe fe f π y
\end{code}
The injective structure derived from a flabby structure is pullback
natural.
\begin{code}
derived-injective-pullback-naturality
: pullback-naturality (derived-injective-structure D s)
derived-injective-pullback-naturality X Y B f π h = II
where
open pullback β π β h
ππβ : pullback βͺ B
ππβ = π‘πβ β π β-is-embedding
module _ (b : B) where
Ο : fiber β π β (h b) β fiber β ππβ β b
Ο = (Ξ» (x , e) β ((x , b) , e) , refl)
Ο : fiber β ππβ β b β fiber β π β (h b)
Ο (((x , _) , e) , refl) = (x , e)
I : f β prβ β Ο βΌ f β pbβ β fiber-point
I (((x , _) , e) , refl) = refl
II : (f β£ π) (h b) οΌ ((f β pbβ) β£ ππβ) b
II = (f β£ π) (h b) οΌβ¨ refl β©
β¨ (Fiber π (h b)) (f β fiber-point) οΌβ¨ IIβ β©
β¨ (Fiber ππβ b) (f β fiber-point β Ο) οΌβ¨ IIβ β©
β¨ (Fiber ππβ b) (f β pbβ β fiber-point) οΌβ¨ refl β©
((f β pbβ) β£ ππβ) b β
where
IIβ = β¨-change-of-variable D pe fe β¨ (f β fiber-point) (Ο , Ο)
IIβ = ap (β¨ (Fiber ππβ b)) (dfunext fe I)
\end{code}
We now consider the flabby structure derived from the injective
structure derived from the flabby structure, and show that it is the
identity on extension operators.
\begin{code}
private
β¨' : (P : Ξ© π€) β (P holds β D) β D
β¨' = flabby-extension-operator D
(derived-flabby-structure D {π€} {π€}
(derived-injective-structure D s))
\end{code}
The round trip β¨ β¦ _β£_ β¦ β¦ β¨' is the identity.
\begin{code}
β¨-round-trip : β¨ οΌ β¨'
β¨-round-trip = dfunext fe (Ξ» P β dfunext fe (I P))
where
I : (P : Ξ© π€) (f : P holds β D) β β¨ P f οΌ β¨' P f
I P f = β¨ P f οΌβ¨ Iβ β©
β¨ (Fiber embedding-to-π β) (f β fiber-point) οΌβ¨ refl β©
β¨' P f β
where
Iβ = β¨-change-of-variable D pe fe β¨ f ((Ξ» p β p , refl) , fiber-point)
\end{code}
Notice that we didn't use the extension properties of the flabby
structure or the derived injective structure. The same is the case
below.
We now show that injective associativity implies flabby associativity
of the derived flabby structure, assuming pullback naturality, and,
again, propositional and functional extensionality.
\begin{code}
module _
{π€ : Universe}
(s@(_β£_ , _) : injective-structure D π€ π€)
(pe : Prop-Ext)
(fe : Fun-Ext)
where
private
β¨ : (P : Ξ© π€) β (P holds β D) β D
β¨ = flabby-extension-operator D (derived-flabby-structure D s)
derived-flabby-associativity
: injective-associativity s
β pullback-naturality s
β flabby-associativity (derived-flabby-structure D s)
derived-flabby-associativity iassoc pbn P Q f
= β¨ (ΣΩ Q) f οΌβ¨ refl β©
(f β£ w) β οΌβ¨ ap (Ξ» - β (f β£ -) β) I β©
(f β£ (v β u)) β οΌβ¨ iassoc _ _ _ f u v β β©
((f β£ u) β£ v) β οΌβ¨ refl β©
β¨ P (f β£ u) οΌβ¨ ap (β¨ P) (dfunext fe III) β©
β¨ P (Ξ» p β β¨ (Q p) (Ξ» q β f (p , q))) β
where
u : ΣΩ Q holds βͺ P holds
u = π‘π£β (Ξ» p β holds-is-prop (Q p))
v : P holds βͺ π
v = embedding-to-π
w : ΣΩ Q holds βͺ π
w = embedding-to-π
I : w οΌ v β u
I = to-subtype-οΌ (being-embedding-is-prop fe) refl
II : (p : P holds)
β β¨ (Fiber u p) (f β fiber-point) οΌ β¨ (Q p) (Ξ» q β f (p , q))
II p = β¨-change-of-variable D pe fe β¨ (f β fiber-point) (g , h)
where
g : fiber β u β p β Q p holds
g ((p' , q) , _) = transport (Ξ» - β Q - holds) (holds-is-prop P p' p) q
h : Q p holds β fiber β u β p
h q = (p , q) , holds-is-prop P (β u β (p , q)) p
III : (p : P holds) β (f β£ u) p οΌ β¨ (Q p) (Ξ» q β f (p , q))
III p = (f β£ u) p οΌβ¨ IIβ β©
((f β fiber-point) β£ fiber-to-π u p) β οΌβ¨ refl β©
β¨ (Fiber u p) (f β fiber-point) οΌβ¨ II p β©
β¨ (Q p) (Ξ» q β f (p , q)) β
where
IIβ = pullback-naturality-gives-that-extensions-are-fiberwise
s pe fe pbn (ΣΩ Q holds) (P holds) f u p
\end{code}
We now show that the round trip _β£_ β¦ β¨ β¦ _β£'_ is the identity.
\begin{code}
private
s' : injective-structure D π€ π€
s' = derived-injective-structure D (derived-flabby-structure D s)
_β£'_ : {X Y : π€ Μ} β (X β D) β X βͺ Y β Y β D
_β£'_ = injective-extension-operator D {π€} {π€} s'
β£-round-trip' : pullback-naturality s
β (X Y : π€ Μ) (f : X β D) (π : X βͺ Y)
β f β£ π βΌ f β£' π
β£-round-trip' pbn X Y f π y =
(f β£ π) y οΌβ¨ I β©
((f β fiber-point) β£ fiber-to-π π y) β οΌβ¨ refl β©
(f β£' π) y β
where
I = pullback-naturality-gives-that-extensions-are-fiberwise
s pe fe pbn X Y f π y
\end{code}
We need to eta-expand the lhs of the following equality to avoid Agda
getting lost due to the way it deals with implicit arguments. What we
are really showing is that _β£_ οΌ _β£'_.
\begin{code}
β£-round-trip : pullback-naturality s
β (Ξ» {X} {Y} β _β£_ {X} {Y}) οΌ _β£'_
β£-round-trip pbn =
implicit-dfunext fe (Ξ» X β
implicit-dfunext fe (Ξ» Y β
dfunext fe (Ξ» f β
dfunext fe (Ξ» π β
dfunext fe (Ξ» y β ((β£-round-trip' pbn X Y f π y)))))))
\end{code}
We now put the above together to get the main results of this file.
Motivated by the above, we (re)define algebraic injective and flabby
structure on our type D as follows.
\begin{code}
module _ {π€ : Universe} where
ainjective-structure aflabby-structure : π€ βΊ β π¦ Μ
ainjective-structure = Ξ£ s κ injective-structure D π€ π€
, injective-associativity s
Γ pullback-naturality s
aflabby-structure = Ξ£ t κ flabby-structure D π€
, flabby-associativity t
\end{code}
When D is a set, pullback naturality and the two associativity
conditions are property rather than data.
\begin{code}
module _
(D-is-set : is-set D)
(fe : Fun-Ext)
where
injective-associativity-is-prop
: (s : injective-structure D π€ π€)
β is-prop (injective-associativity s)
injective-associativity-is-prop s
= Ξ β-is-prop fe (Ξ» _ _ _ _ _ _ _ β D-is-set)
pullback-naturality-is-prop
: (s : injective-structure D π€ π€)
β is-prop (pullback-naturality s)
pullback-naturality-is-prop s
= Ξ β-is-prop fe (Ξ» _ _ _ _ _ _ _ β D-is-set)
flabby-associativity-is-prop
: (t : flabby-structure D π€)
β is-prop (flabby-associativity t)
flabby-associativity-is-prop t
= Ξ β-is-prop fe (Ξ» _ _ _ β D-is-set)
\end{code}
And the main theorem of this file is that the above notions of
algebraic injectivity and flabbines are equivalent (assuming
propositional and functional extensionality).
For our arbitrary type D, all we know so far is that they *logically*
equivalent.
\begin{code}
module _
(pe : Prop-Ext)
(fe : Fun-Ext)
where
private
Ο : ainjective-structure β aflabby-structure
Ο (s , iassoc , pbn) =
derived-flabby-structure D s ,
derived-flabby-associativity s pe fe iassoc pbn
Ξ³ : aflabby-structure β ainjective-structure
Ξ³ (t , fassoc) =
derived-injective-structure D t ,
derived-injective-associativity t pe fe fassoc ,
derived-injective-pullback-naturality t pe fe
ainjective-structure-iff-aflabby-structure
: ainjective-structure β aflabby-structure
ainjective-structure-iff-aflabby-structure = (Ο , Ξ³)
\end{code}
But if D is a set, it follows that they are typally equivalent, which
is the main theorem of this file.
The essence of the proof are the above two round-trip functions
together with the fact that pullback naturality and associativity, for
both injectivity and flabbiness, are property, rather than just data,
when D is a set.
\begin{code}
Theorem[ainjective-structure-β-aflabby-structure-for-sets]
: is-set D
β ainjective-structure β aflabby-structure
Theorem[ainjective-structure-β-aflabby-structure-for-sets] D-is-set
= qinveq Ο (Ξ³ , Ξ³Ο , ΟΞ³)
where
Ξ³Ο : Ξ³ β Ο βΌ id
Ξ³Ο (s , _ , pbn) =
to-subtype-οΌ
(Ξ» s β Γ-is-prop
(injective-associativity-is-prop D-is-set fe s)
(pullback-naturality-is-prop D-is-set fe s))
(to-subtype-οΌ
(Ξ» (_β£_ : {X Y : π€ Μ} β (X β D) β X βͺ Y β Y β D)
β implicit-Ξ -is-prop fe (Ξ» X β
implicit-Ξ -is-prop fe (Ξ» Y β
Ξ β-is-prop fe (Ξ» f π x β D-is-set))))
(β£-round-trip s pe fe pbn)β»ΒΉ)
ΟΞ³ : Ο β Ξ³ βΌ id
ΟΞ³ (t , _) =
to-subtype-οΌ
(flabby-associativity-is-prop D-is-set fe)
(to-subtype-οΌ
(Ξ» _ β Ξ β-is-prop fe (Ξ» _ _ _ β D-is-set))
(β¨-round-trip t pe fe)β»ΒΉ)
\end{code}
The above establishes the internal fact that, in a 1-topos,
pulback-natural, associative injective structure on D is isomorphic to
associative flabby structure on D.
But also associative flabby structure on D is equivalent to π-algebra
structure on D, where π is the lifting (of partial-map classifier)
wild monad on types, as we record now.
\begin{code}
open import Lifting.Algebras π€
private
Ξ± : aflabby-structure β π-alg D
Ξ± ((β¨ , e) , a) =
(Ξ» {P} (i : is-prop P) f
β β¨ (P , i) f) ,
(Ξ» (d : D) β e (π , π-is-prop) (Ξ» _ β d) β) ,
(Ξ» P Q i j β a (P , i) (Ξ» p β Q p , j p))
Ξ² : π-alg D β aflabby-structure
Ξ² (β¨ , lawβ , lawβ) =
((Ξ» (P , i) β β¨ i) ,
(Ξ» (P , i) f p β π-alg-Lawβ-givesβ' pe fe fe β¨ lawβ P i f p)) ,
(Ξ» (P , i) Q β lawβ P (Ξ» - β Q - holds) i (Ξ» p β holds-is-prop (Q p)))
\end{code}
As above, we only have a logical equivalence for our arbitrary type D.
\begin{code}
aflabby-structure-β-π-alg : aflabby-structure β π-alg D
aflabby-structure-β-π-alg = Ξ± , Ξ²
\end{code}
But if D is a set, we again have a typal equivalence.
\begin{code}
Theorem[aflabby-structure-β-π-alg-for-sets]
: is-set D
β aflabby-structure β π-alg D
Theorem[aflabby-structure-β-π-alg-for-sets] D-is-set
= qinveq Ξ± (Ξ² , Ξ²Ξ± , Ξ±Ξ²)
where
Ξ²Ξ± : Ξ² β Ξ± βΌ id
Ξ²Ξ± _ = to-subtype-οΌ
(flabby-associativity-is-prop D-is-set fe)
(to-subtype-οΌ
(Ξ» _ β Ξ β-is-prop fe (Ξ» _ _ _ β D-is-set))
refl)
Ξ±Ξ² : Ξ± β Ξ² βΌ id
Ξ±Ξ² _ = to-subtype-οΌ
(Ξ» _ β Γ-is-prop
(Ξ -is-prop fe (Ξ» _ β D-is-set))
(Ξ β
-is-prop fe (Ξ» _ _ _ _ _ β D-is-set)))
refl
\end{code}
TODO (trivial). Bring homomorphisms into the picture explicitly, where
π-algebras and their homomorphisms are already defined in another
module, and here we define homomorphisms of injective structures as
follows.
\begin{code}
module _
{π€ π₯ π£ : Universe}
(E : π£ Μ )
((_β£α΄°_ , _) : injective-structure D π€ π₯)
((_β£α΄±_ , _) : injective-structure E π€ π₯)
where
is-hom : (D β E) β π₯ βΊ β π€ βΊ β π¦ β π£ Μ
is-hom h = {X : π€ Μ } {Y : π₯ Μ } (f : X β D) (π : X βͺ Y)
β h β f β£α΄° π βΌ (h β f) β£α΄± π
\end{code}
TODO (more challenging and more interesting). What can we say when D
is not necessarily a set? Do we have the same theorems?
These questions are particularly interesting because in HoTT/UF, and
hence in β-toposes, as illustrated in other files in this development,
there is a richer supply of injective objects than in 1-toposes.