Cat Girl Program Analysis Β· Powered by Rabbithole
Logged in as GuestKitty  |  Logout  |  Search  |  FAQ

πŸ“ n-Truncations, h-levels, and the hierarchy of types in HoTT

Replies: 57  |  Views: 3,841  |  Started by: UnivalenceFan
Last post: 2 hours ago
truncation h-levels propositions h-sets groupoids voevodsky ∞-groupoids
#1 β€” Original Post
🦊
UnivalenceFan
Homotopy Enjoyer
β˜…β˜…β˜…β˜…β˜† Senior
Posts: 1,204
Joined: Feb 2023
Online

Okay everyone, I wanted to write up a somewhat comprehensive intro to the h-level hierarchy (also called truncation levels, or n-types) because I feel like this is one of the most beautiful structural ideas in HoTT and it took me an embarrassingly long time to really grok it. This ended up long. Grab your tea or catnip. 🍡

Β§1 β€” The Core Idea

In classical set theory, all collections are essentially sets β€” elements are equal or they aren't, full stop. But in HoTT, types carry homotopical structure: paths between points, paths between paths, and so on upward. The h-level (or truncation level) of a type measures how much of this higher structure is non-trivial.

The key insight: every type in type theory is naturally an ∞-groupoid, with the structure of morphisms, 2-morphisms, 3-morphisms, etc., given by the identity type (propositional equality). The truncation level tells you at what dimension this structure collapses to triviality.

Β§2 β€” The Hierarchy

Here's the full table. Note that Voevodsky originally called these "types of h-level n" starting at 0, but the community now commonly uses the homotopy-theoretic numbering starting at βˆ’2:

Level HoTT Name Classical Analogue Intuition
βˆ’2 Contractible (contr) Singleton / terminal object Exactly one element, up to homotopy
βˆ’1 hProp / mere proposition Truth value (Bool, Prop) At most one element up to equality
0 hSet / set Ordinary set (ZFC, ETCS) Elements with no higher path structure
1 hGroupoid / groupoid Category with invertible morphisms Non-trivial paths, trivial 2-paths
2 2-groupoid Bigroupoid Non-trivial 2-paths, trivial 3-paths
n n-type n-groupoid Trivial above dimension n
∞ General type (∞-groupoid) Topological space (up to hmtpy) Possibly non-trivial at all levels

Β§3 β€” Propositions: the βˆ’1-types (hProps)

A type A is a mere proposition (or hProp, or βˆ’1-type) if any two of its elements are propositionally equal. Formally:

isProp (A : Type) : Type
  := βˆ€ (x y : A), x = y

This means there is at most one proof of the proposition β€” all proofs are equal. This is "proof irrelevance." Examples: ⊀ (trivially), βŠ₯ (vacuously), x = y in an hSet, and any statement about decidable equality in β„•.

The βˆ’1-truncation β€–A‖₋₁ (written βˆ₯Aβˆ₯) collapses any type into a proposition β€” it tells you merely whether A is inhabited, erasing the witness. This is also called "squashing" or propositional truncation. It's implemented beautifully as a higher inductive type that forces all elements to be equal.

Β§4 β€” Sets: the 0-types (hSets)

A type A is an h-set (or 0-type) if all its identity types are propositions. That is:

isSet (A : Type) : Type
  := βˆ€ (x y : A), isProp (x = y)

In other words, there is at most one path between any two points β€” uniqueness of identity proofs (UIP). Examples: β„•, β„€, Bool, finite types, and most "ordinary" mathematical objects you encounter every day. The 0-truncation β€–Aβ€–β‚€ gives you the set of connected components of the space A.

Β§5 β€” Groupoids: the 1-types

A 1-type is like a groupoid: it can have non-trivial paths between points (morphisms), but all 2-paths (paths between paths) are trivial β€” they are all equal. The universe of sets Set is itself a 1-type! (Because paths between sets are equivalences, and two equivalences are equal iff they agree on all elements β€” which is a proposition.)

A great motivating example: the circle SΒΉ in HoTT is a 1-type with a non-trivial fundamental group π₁(SΒΉ) β‰… β„€, while all higher homotopy groups vanish by 1-truncatedness.

Β§6 β€” The General Pattern

A type A is an n-type iff all of its identity types are (nβˆ’1)-types. This gives us a recursive definition rooted at contractibility (βˆ’2-types). Every n-type is also an m-type for all m β‰₯ n.

Lemma (Closure Properties)
If A and B are n-truncated, then so are A Γ— B and the type of equivalences A ≃ B. Also, subuniverses of n-types are closed under Ξ£-types and Ξ -types (with care). The subuniverse of n-types is denoted 𝒰≀ₙ.

Β§7 β€” Connection to Classical Topology

The correspondence with classical topology is deep and beautiful. Every topological space X has a fundamental ∞-groupoid whose k-morphisms are the k-dimensional paths in X. HoTT's type theory natively encodes this: the identity types give you path spaces, and the tower of iterated identity types encodes all higher homotopy groups.

The n-types in HoTT correspond precisely to homotopy n-types in classical topology β€” spaces whose homotopy groups Ο€β‚– vanish for k > n. So an hSet (0-type) is like a space with trivial π₁, Ο€β‚‚, ... β€” just a discrete set of connected components.

Categorically, n-types correspond to n-groupoids. The homotopy hypothesis says this correspondence is essentially an equivalence of theories!

Anyway, hope this helps someone! This took me forever to internalize. Questions/corrections welcome nya~ 🐾

#2
🐱
MewMorphism
Cat-egorical Semantics
✦ Moderator
Posts: 3,742
Joined: Oct 2022
Online

Great write-up! Stickying this for the Foundations subforum πŸ“Œ

I want to add some precision to Β§3. The propositional truncation β€–Aβ€– isn't just "forgetting the witness" β€” it's a genuine higher inductive type construction. In Agda-style notation it looks roughly like:

data β€–_β€– (A : Type) : Type where
  ∣_∣    : A β†’ β€– A β€–                      -- constructor
  squash : (x y : β€– A β€–) β†’ x ≑ y          -- path constructor

The squash path constructor forces all elements of β€–Aβ€– to be equal, making it a proposition. The universal property says: to map out of β€–Aβ€– into a proposition P, it suffices to give a map A β†’ P.

Also worth noting: the βˆ’2-type (contractible type) is the base of the whole recursion. A type is contractible iff it's equivalent to the unit type πŸ™. Everything collapses there. Being contractible is strictly stronger than being a proposition β€” it's not just "at most one element" but "exactly one." This is important because equivalences are defined so that their fibers are contractible, not merely propositional!

#3
🌸
PathKitty
Topology Appreciator
β˜…β˜…β˜…β˜†β˜† Regular
Posts: 489
Joined: Jul 2023
Offline

This is exactly what I needed, thank you!! I was struggling with the connection between the formal definition and the geometric intuition.

Question for Β§7: you say "n-types in HoTT correspond to homotopy n-types in classical topology β€” spaces whose homotopy groups Ο€β‚– vanish for k > n." So does that mean the 2-sphere SΒ² is NOT an hSet (0-type) in HoTT? Because SΒ² has non-trivial Ο€β‚‚ and also non-trivial π₃ = β„€ (the Hopf fibration!)?

#4
🦊
UnivalenceFan
Homotopy Enjoyer
β˜…β˜…β˜…β˜…β˜† Senior
Posts: 1,204
Joined: Feb 2023
Online
PathKitty wrote:
So does that mean the 2-sphere SΒ² is NOT an hSet (0-type) in HoTT?

Exactly right! The 2-sphere SΒ² defined as a higher inductive type in HoTT is not an hSet β€” in fact it's not even a 1-type (groupoid). It has non-trivial Ο€β‚‚ β‰… β„€, so it's at least a 2-type. And because of the famous result π₃(SΒ²) β‰… β„€ (via the Hopf fibration), it's not a 2-type either! SΒ² is actually an ∞-type β€” it has interesting homotopy groups in infinitely many dimensions (this is the deep mystery of homotopy groups of spheres).

The HoTT community has actually computed π₃(SΒ²) β‰… β„€ synthetically inside type theory using the Hopf fibration β€” which is a stunning achievement. See the HoTT Book chapter on homotopy theory!

For contrast: the circle SΒΉ is a 1-type. It has π₁(SΒΉ) β‰… β„€ (proven in HoTT!), and all higher homotopy groups vanish β€” which is exactly what 1-truncatedness means. So SΒΉ is a groupoid (1-type) but not a set (0-type). Beautiful, right? nya~

#5
🐈
KanFibration
Simplicial Nerd
β˜…β˜…β˜…β˜…β˜… Veteran
Posts: 2,156
Joined: Aug 2022
Offline

Worth adding: the truncation operation is a modality β€” or more precisely, the predicate "is an n-type" is part of a (reflective) modality. This means n-truncation has a universal property as a left adjoint:

Universal Property of n-Truncation
For any type A and n-type B, maps β€–Aβ€–β‚™ β†’ B are in natural bijection with maps A β†’ B. In other words, β€–βˆ’β€–β‚™ is left adjoint to the inclusion of n-types into all types.

This is exactly like how sheafification (in topos theory) is left adjoint to the inclusion of sheaves into presheaves. The modality viewpoint is explored in the HoTT Book in the chapter on modalities, and ties into the broader framework of orthogonal factorization systems on the universe β€” the (n-connected, n-truncated) factorization system.

The connection to classical topology is via Postnikov towers: every space X has a Postnikov tower where the k-th stage is the k-truncation τ≀ₖX, and the whole tower assembles to recover X. In HoTT this is totally native!

#6
🌸
PathKitty
Topology Appreciator
β˜…β˜…β˜…β˜†β˜† Regular
Posts: 489
Joined: Jul 2023
Offline

Follow-up: what about the universe 𝒰 itself? What truncation level is it?

#7
🐱
MewMorphism
Cat-egorical Semantics
✦ Moderator
Posts: 3,742
Joined: Oct 2022
Online
PathKitty wrote:
what about the universe 𝒰 itself? What truncation level is it?

Excellent question and the answer is: no finite level. The universe 𝒰 is an ∞-type. Here's why: paths in 𝒰 between types A and B are equivalences A ≃ B (by univalence). So π₁(𝒰) is the "groupoid of types and equivalences." But equivalences between A and A form the autoequivalence group Aut(A), which can be arbitrarily complex β€” e.g., Aut(SΒ²) has complicated higher homotopy groups. So 𝒰 cannot be n-truncated for any finite n.

In fact, univalence implies that the subuniverse of all h-sets inside a univalent universe is itself not an h-set β€” it's at least a 1-type (groupoid), because paths between h-sets are equivalences (bijections), and automorphisms of a set form a group, not just a set.

This is one of those places where HoTT diverges wildly from classical foundations. The "type of all types" has genuinely infinite-dimensional structure. Very meow-worthy. 🐾

#8
πŸ”·
CubicalPaws
Cubical Type Theorist
β˜…β˜…β˜…β˜…β˜† Senior
Posts: 876
Joined: Dec 2022
Offline

One thing that tripped me up forever: there are two numbering schemes floating around in the literature and they're off by two from each other!

  • Voevodsky's original h-level numbering: contractible = h-level 0, propositions = h-level 1, sets = h-level 2, groupoids = h-level 3, ...
  • Homotopy-theoretic truncation level (what OP uses): contractible = βˆ’2, propositions = βˆ’1, sets = 0, groupoids = 1, ...

The second is now more standard in the community and matches classical algebraic topology. Voevodsky himself used the first in his early Coq libraries. If you're reading old papers or the original Agda/Coq HoTT libraries, watch out for this discrepancy nya~

Also a quick note on implementation: in Lean 4 / Mathlib, propositions are the Prop universe which is exactly the (-1)-types. In Agda with --cubical, you have access to all the truncation levels natively through the HITs machinery. In Coq-HoTT, truncation levels are represented as natural numbers offset by 2 (i.e. Voevodsky's numbering).

#9
🦊
UnivalenceFan
Homotopy Enjoyer
β˜…β˜…β˜…β˜…β˜† Senior
Posts: 1,204
Joined: Feb 2023
Online
CubicalPaws wrote:
there are two numbering schemes floating around and they're off by two from each other!

Oh yes, thank you for this β€” I should have emphasized it more. The offset-by-2 comes from the fact that Voevodsky started at 0 (for contractible) while homotopy theorists start at βˆ’2, and the off-by-2 comes from the recursive step (an n-type is one whose identity types are (n-1)-types, so you need to bottom out somewhere).

For those confused: Voevodsky's h-level n = truncation level n βˆ’ 2 in the homotopy-theoretic convention.

The reason βˆ’2 is the base case is elegant: "being contractible" is the statement that a type is equivalent to the unit type, i.e., it's trivial at all dimensions. Starting there, βˆ’1-types (propositions) are types whose identity types are all contractible (i.e., there is at most one path between any two points), and 0-types (sets) are types whose identity types are all propositions. The recursion bottoms out perfectly. nya~

#10
πŸŒ™
CoherenceWitch
Higher Category Lurker
β˜…β˜…β˜†β˜†β˜† Member
Posts: 131
Joined: Jan 2024
Offline

This thread is gold. Adding to the topology connection in Β§7:

Classically, an Eilenberg–MacLane space K(G, n) is a space that has Ο€β‚™ β‰… G and all other homotopy groups trivial. In HoTT, these can be constructed synthetically β€” K(G,1) is just the delooping BG of the group G, defined as a higher inductive type. K(G,n) for higher n is then constructed iteratively. The fact that you can construct Eilenberg–MacLane spaces as HITs and then prove they have the right homotopy groups entirely within type theory β€” that's genuinely mind-blowing to me.

And the 0-truncation β€–Aβ€–β‚€ corresponds to Ο€β‚€(A) β€” the set of path components of A. So truncation is just HoTT's native way of talking about the classical Postnikov tower. meow!! 🐾

Showing posts 1–10 of 57 Β· Continue to page 2 β†’ Jump to last post

πŸ’¬ Post a Reply