I was asked about my proof showing that positive h-levels are closed under W (assuming extensionality), so I decided to write a short note about it.
W-types are defined inductively as follows (using Agda notation):
data W (A : Set) (B : A → Set) : Set where sup : (x : A) → (B x → W A B) → W A B
The result can then be stated as follows:
(A : Set) (B : A → Set) → ((x : A) (C : B x → Set) (f g : (y : B x) → C y) → ((y : B x) → f y ≡ g y) → f ≡ g) → (n : ℕ) → H-level (1 + n) A → H-level (1 + n) (W A B)
Here _≡_
is the identity type, and H-level n A
means that A
has h-level n
. Note that B
, which is only used negatively in W
, can have any h-level. Note also that h-level 0 is not closed under W
: the type W ⊤ (λ _ → ⊤)
is empty (where ⊤
is the unit type).
Sketch of the proof:
- It is easy to see that
W A B
is isomorphic toΣ A (λ x → B x → W A B)
. - Using this isomorphism and extensionality we can prove that, for any
x
,y : A
,f : B x → W A B
, andg : B y → W A B
, there is a surjection fromΣ (x ≡ y) (λ p → (i : B x) → f i ≡ g (subst B p i))
to
sup x f ≡ sup y g.
(The
subst
function is sometimes called transport.) - We can wrap up by proving
(s t : W A B) → H-level n (s ≡ t)
by induction on the structure of
s
. There is one case to consider, in whichs = sup x f
andt = sup y g
. From the inductive hypothesis we getH-level n (f i ≡ g j)
for any
i
,j
. In particular, if we assumep : x ≡ y
, then we haveH-level n (f i ≡ g (subst B p i)).
All h-levels are closed under Image may be NSFW.
Clik here to view.(B x)
(assuming extensionality), so we getH-level n ((i : B x) → f i ≡ g (subst B p i)).
Every h-level is also closed under
Σ
, so by the assumption thatA
has h-level1 + n
we getH-level n (Σ (x ≡ y) (λ p → (i : B x) → f i ≡ g (subst B p i))).
Finally
H-level n
respects surjections, so by step 2 above we getH-level n (sup x f ≡ sup y g).
See the code listing for the full proof, which is stated in a universe-polymorphic way. (Search for “W-types”, and note that identifiers are hyperlinked to their definition.)