unimath2024/Lecture5.typ

246 lines
10 KiB
Text
Raw Normal View History

2024-08-01 15:32:27 +00:00
#import "prooftree.typ": *
#import "@preview/showybox:2.0.1": showybox
#import "@preview/commute:0.2.0": node, arr, commutative-diagram
#import "@preview/cetz:0.2.2": *
#set page(width: 5.6in, height: 9in, margin: 0.4in)
= Set-level mathematics
#let isofhlevel = $sans("isofhlevel")$
#let Nat = $sans("Nat")$
#let Vect = $sans("Vect")$
#let Bool = $sans("Bool")$
#let carrier = $sans("carrier")$
#let iseqclass = $sans("iseqclass")$
#let isInjective = $sans("isInjective")$
#let Type = $sans("Type")$
#let reflexive = $sans("reflexive")$
#let Even = $sans("Even")$
#let isEven = $sans("isEven")$
#let Prop = $sans("Prop")$
#let isProp = $sans("isProp")$
#let Set = $sans("Set")$
#let isContr = $sans("isContr")$
#let isIso = $sans("isIso")$
#let isEquiv = $sans("isEquiv")$
#let isSet = $sans("isSet")$
#let zero = $sans("zero")$
#let suc = $sans("suc")$
#let Monoid = $sans("Monoid")$
#let MonoidStr = $sans("MonoidStr")$
#let MonoidAxioms = $sans("MonoidAxioms")$
#let refl = $sans("refl")$
#let defeq = $equiv$
#let propeq = $=$
$ isofhlevel& : Nat -> Type -> Type \
isofhlevel&(zero)(X) :defeq isContr(X) \
isofhlevel&(suc(n))(X) :defeq product_(x,y:X) \
isofhlevel& (n, x propeq y)$
$ isSet(X) :defeq isofhlevel(2)(X) \
Set :defeq sum_(X : Type) isSet(X) $
Sets are the types that satisfy UIP. We don't have _all_ types satisfying UIP since it would contradict univalence.
- If $p, q : x propeq y$ then $p propeq q$
- Also, $p : x propeq x$ then $p propeq refl$
Quite a lot of things are sets. What are some sets?
== Decidable equality
*Definition (decidable).* A type $X$ is _decidable_ if $X + not X$.
*Definition (decidable equality).* A type $X$ has decidable equality if all of its path types are decidable.
If a type $X$ has decidable equality, then $X$ is a set. (Hedberg's theorem.)
*Exercise.* Prove that $Bool$ and $Nat$ have decidable equality
Using this theorem you can prove $Bool$ and $Nat$ are sets.
=== Closure properties
Sets also have a lot of closure properties:
- $sum_(x : A) B(x)$ is a set if $A$ and all $B(x)$ are
- $A times B$ is a set if $A$ and $B$ are
- $product_(x : A) B(x)$ is a set if all $B(x)$ are
- $A -> B$ is a set if $B$ is
- $A$ is a set if its a proposition
Example. $Bool$ is a set, so $Bool times Bool$ is a set. etc. What types are definitely _not_ a set?
*Exercise.* Prove that $Prop :defeq sum_(X : Type) isProp(X)$ is a set. (this is not a trivial proof by one of the closure properties)
- It's consistent to add global UIP to regular MLTT.
- If you add univalence, some types can be shown to _not_ be sets.
- (UIP + univalence == inconsistent)
You can prove that $Type$ is not a set, if it contains the type $Bool$ (not exactly just this, but some other types might be also able to satisfy this (true $eq.not$ false???))
Notably, $Set$ is also not a set. (what h-level does it have?). This is different from working in a classic system with UIP.
Why do we care about sets, h-levels and props? Some types are very "property"-like, and it's nice for them to be propositions. For example, if a natural number is even.
$ Even :defeq sum_(n : Nat) isEven(n) $
In dependent pairs, the second b condition requires a transport to express its identity. In the case that $B(x)$ is a proposition for all $x$, then $Even$s can have the "right" notion of equality.
Sets are important because a lot of side conditions (i.e is even), are equational. You would like these to be propositions. By restricting to sets, you get this nice property.
One example that's weird about univalence foundations, $f : X -> Y$
$ isInjective(f) :defeq product_(x,x': X) f(x) propeq f(x') -> x propeq x' $
This isn't a proposition in general, but if we make $X$ a set, this becomes a proposition. If $X$ isn't a set, then the actual proof of injectivity needs to be carried around and is relevant.
Question: why does $Y$ not need to be a set here? \
Answer: see exercises!
You can also define it in a way that doesn't depend on what $X$ and $Y$ are (truncations?).
Another example is isomorphism.
*Warning.* Stating the univalence axiom with isomorphism instead of equivalence leads to inconsistency. (advanced exercise). But if $X$ and $Y$ are sets, then $isIso(f) tilde.eq isEquiv(f) $
The space of proofs of equivalence is a proposition. But the space of isomorphisms may not be a proposition. So they are logically equivalence (there are functions in both directions) but there's no inverse laws because there may be more isomorphisms.
== Applications: algebraic structures
A *monoid* is a triple $(M, mu, e)$ of:
- A set $M$
- A multiplciation $mu : M times M -> M$
- Unit $e in M$
satisfying associativity, left / right neutrality. Exampls of these are natural numbers or integers with $mu = $ addition and $e = 0$.
But in type theory, equations are just other types. So we need a 6-tuple instead of a 3-tuple that also contains the three properties (associativity, neutrality...). In particular, we want $M$ to be a $Set$ instead of a $Type$.
This way we can have the axioms to be propositions. When comparing two monoids we would like the equality to really just involve the first three parts and not have to talk about equality between the proofs of the properties in the last 3.
So we can re-group these into:
$ Monoid :defeq sum_( M :Set) sum_(mu, e : MonoidStr(M)) MonoidAxioms(M, (mu,e)) $
This type will have the nice equality property that we want if $MonoidAxioms$ is a proposition. And we will have this automatically if $M$ is a set.
Question: what happens if you just truncate the axioms? \
Answer: you could only map truncations out into propositions, instead of mapping the axioms out to anything. Also it won't form a category.
2024-08-01 22:56:54 +00:00
#let MonoidM = $bold("M")$
2024-08-01 15:32:27 +00:00
*Definition( monoid isomorphism).* between two monoids is an isomorphism of sets $f : MonoidM tilde.equiv MonoidM'$ that sends one unit to other unit and one multiplication to the other.
*Exercise.* The type of monoid equalities $MonoidM propeq MonoidM'$ is equivalent to the type of monoid isomorphisms $MonoidM tilde.equiv MonoidM'$.
_Proof sketch._ First, discard the axioms since $M$ is a set. So split it apart into $M$ equality and then the equality of the $MonoidStr$ part, which requires a transport. With $M$ is a set, the transports go away.
In fact, any property about monoids expressible in UF can be transported along isomorphism.
$ (MonoidM tilde.equiv MonoidM') -> T(MonoidM) -> T(MonoidM') $
*Example.* If $MonoidM$ is commutative, then $MonoidM'$ is also, regardless of what commutativity says.
This is known as the _Structure Identity Principle_.
#align(center)[
#quote[
Isomorphic mathematical structures are equal as structured types, and have all the same structural properties.
]
]
(Coquand, Aczel)
This holds for many algebraic structures. Isomorphic structures have *all* the same definable properties.
https://ncatlab.org/nlab/show/structure+identity+principle
Question: is this only true of sets? \
Answer: this is normally stated for sets, but this is more general than that. The isomorphisms just become a bit more complicated.
== Predicates on types
A *subtype* $A$ of a type $X$ is a prop-valued predicate:
$ A : X -> Prop $
*Exercise.* Prove that the type of subtypes of $X$ is a set. (you can do this just with things from the slides)
You might've thought that a subtype would be a type. But $A$ is a function. So you can create a type that carries it:
$ carrier(A) :defeq sum_(x: X) A(x) $
What about a binary relation?
$ R : X -> X -> Prop $
*Exercise.* Prove that the type of binary relations on $X$ is a set.
These behave as you think. For example:
$ reflexive(R) :defeq product_(x: X) R(x)(x) $
(there can only be one proof of this because $R$ is prop-valued)
Why are we talking about equivalence relations? Well, one important thing in math is to take the quotient of a set by an equivalence relation.
The *quotient* of a type $X$ by an equivalence relation $R$ on $X$ is a pair $(X \/ R , p)$ of a type $X \/ R$ and a map $p : X -> X \/ R$ such that any $R$-compatible map $f$ into a set $Y$ factors uniquely via $p$. ($R$-compatible map is $product_(x,y:A) R(x,y) -> f(x) propeq f(y)$)
You think of the quotient as the set of equivalence classes. $p$ sends each element of $X$ to its equivalence class.
#align(center)[#commutative-diagram(
node((0, 0), $X$),
node((1, 0), $X\/R$),
node((1, 1), $Y$),
arr($X$, $X\/R$, $p$),
arr($X\/R$,$Y$, $exists ! f'$),
arr($X$, $Y$, $f$),
)]
MLTT normally doesn't have quotients. But in UF we can define them as the set of equivalence classes in $R$.
(You could consider things like groupoid quotients too) (you can quotient the unit type into a circle) (the problem is if $Y$ is not a set, then $X \/ R$ also won't be a set) (Favonia: don't do this yet)
== Quotient set
*Definition.* A subtype $A : X -> Prop$ is an equivalence class of $R$ if
$ iseqclass(A, R) :defeq bar.double carrier(A) bar.double times (product_(x,y:X) R(x,y) -> A(x) -> A(y)) \
times (product_(x,y:X) A(x) -> A(y) -> R(x, y )) $
Then we define
$ X \/ R :defeq sum_(A : X -> Prop) iseqclass(A, R) $
The fact that $Prop$ is a set, that two $Prop$s are equal if they imply each other is a consequence of univalence. So you can't do this in plain MLTT.
== Questions
- #[
*Why is this not possible in MLTT?* \
Let's say you dropped the truncation. What happens? Then there are a lot of proofs of $iseqclass(A, R)$ (one for each $x : X$ telling how it got into $X \/ R$). Then $X \/ R$ will count as many elements as there are in $X$, so you haven't reduced the number of elements at all.
]
- #[
*What about MLTT with UIP?*
Lean has MLTT with UIP and also they have quotients. Even if you add UIP to a language, you don't get quotients. The c ool thing in UF is that you can just define quotients.
]
- #[
*Is it possible to use unimath for algebraic structures that can't be defined with equations? (i.e quasi-groups)* \
https://en.wikipedia.org/wiki/Quasigroup \
Benedikt: there are some other examples, i.e fields. In constructive math there's lots of definitions of a field.
]
- #[
*What does SIP have to do with univalence? Sounds true of base MLTT.* \
Univalence says the equality of two sets is an isomorphism. You can think of $Set$ as an algebraic structure that has a carrier and no operations. So you can kind of observe that univalence holds for $Set$ as kind of a trivial case. But the SIP still holds even if you add more operations.
*Where did you use univalence in the proof sketch?*
Going from $p : MonoidM propeq MonoidM'$ to $f : MonoidM tilde.equiv MonoidM'$
*How does univalence imply this?*
$MonoidM$ and $MonoidM'$ are sets. This is true because of univalence.
]