6.12 The flattening lemma

6.12 The flattening lemma

As we will see in

http://planetmath.org/node/87582

Chapter 8, amazing things happen when we combine

higher inductive types

with univalence.
The principal way this comes about is that if

W

is a higher inductive type and

𝒰

is a type

universe

, then we can define a type family

P

:

W

→

𝒰

by using the

recursion

principle for

W

.
When we come to the clauses of the recursion principle dealing with the path constructors of

W

, we will need to supply paths in

𝒰

, and this is where univalence comes in.

For example, suppose we have a type

X

and a self-equivalence

e

:

X

≃

X

.
Then we can define a type family

P

:

𝕊

1

→

𝒰

by using

𝕊

1

-recursion:

P

(

𝖻𝖺𝗌𝖾

)

:

≡

X

and

P

(

𝗅𝗈𝗈𝗉

)

:=

𝗎𝖺

(

e

)

.

The type

X

thus appears as the fiber

P

⁢

(

𝖻𝖺𝗌𝖾

)

of

P

over the

basepoint

.
The self-equivalence

e

is a little more hidden in

P

, but the following lemma says that it can be extracted by transporting along

𝗅𝗈𝗈𝗉

.

Lemma 6.12.1

.

Given

B

:

A

→

U

and

x

,

y

:

A

, with a path

p

:

x

=

y

and an equivalence

e

:

P

⁢

(

x

)

≃

P

⁢

(

y

)

such that

B

(

p

)

=

ua

(

e

)

, then for any

u

:

P

⁢

(

x

)

we have

𝗍𝗋𝖺𝗇𝗌𝗉𝗈𝗋𝗍

B

⁢

(

p

,

u

)

=

e

⁢

(

u

)

.

Proof.

Applying Lemma 2.10.5 (

http://planetmath.org/210universesandtheunivalenceaxiom#Thmprelem2

), we have

𝗍𝗋𝖺𝗇𝗌𝗉𝗈𝗋𝗍

B

⁢

(

p

,

u

)

=

𝗂𝖽𝗍𝗈𝖾𝗊𝗏

(

B

(

p

)

)

(

u

)

=

𝗂𝖽𝗍𝗈𝖾𝗊𝗏

⁢

(

𝗎𝖺

⁢

(

e

)

)

⁢

(

u

)

=

e

⁢

(

u

)

.

∎

We have seen type families defined by recursion before: in §2.12 (

http://planetmath.org/212coproducts

),§2.13 (

http://planetmath.org/213naturalnumbers

) we used them to characterize the identity types of (ordinary) inductive types.
In

http://planetmath.org/node/87582

Chapter 8, we will use

similar

ideas to

calculate

homotopy groups

of higher inductive types.

In this

section

, we describe a general lemma about type families of this sort which will be useful later on.
We call it the

flattening lemma

:
it says that if

P

:

W

→

𝒰

is defined recursively as above, then its

total space

∑

(

x

:

W

)

P

⁢

(

x

)

is

equivalent

to a “flattened” higher inductive type, whose constructors may be deduced from those of

W

and the definition of

P

.
From a category-theoretic point of view,

∑

(

x

:

W

)

P

⁢

(

x

)

is the “Grothendieck construction” of

P

, and this expresses its

universal property

as a “lax

colimit

”.

We prove here one general case of the flattening lemma, which directly implies many particular cases and suggests the method to prove others.
Suppose we have

A

,

B

:

𝒰

and

f

,

g

:

B

→

A

, and that the higher inductive type

W

is generated by

•

𝖼

:

A

→

W

and

•

𝗉

:

∏

(

b

:

B

)

(

𝖼

(

f

(

b

)

)

=

W

𝖼

(

g

(

b

)

)

)

.

Thus,

W

is the

(homotopy)

coequalizer

of

f

and

g

.
Using binary sums (

coproducts

) and dependent sums (

Σ

-types), a lot of interesting nonrecursive higher
inductive types can be represented in this form. All point constructors have to
be bundled in the type

A

and all path constructors in the type

B

.
For

instance

:

•

The circle

𝕊

1

can be represented by taking

A

:

≡

𝟏

and

B

:

≡

𝟏

, with

f

and

g

the

identity

.

•

The

pushout

of

j

:

X

→

Y

and

k

:

X

→

Z

can be represented by taking

A

:

≡

Y

+

Z

and

B

:

≡

X

, with

f

:

≡

𝗂𝗇𝗅

∘

j

and

g

:

≡

𝗂𝗇𝗋

∘

k

.

Now suppose in

addition

that

•

C

:

A

→

𝒰

is a family of types over

A

, and

•

D

:

∏

(

b

:

B

)

C

⁢

(

f

⁢

(

b

)

)

≃

C

⁢

(

g

⁢

(

b

)

)

is a family of equivalences over

B

.

Define a type family

P

:

W

→

𝒰

inductively by

P

⁢

(

𝖼

⁢

(

a

)

)

:

≡

C

(

a

)

P

(

𝗉

(

b

)

)

:=

𝗎𝖺

⁢

(

D

⁢

(

b

)

)

.

Let

W

~

be the higher inductive type generated by

•

𝖼

~

:

∏

(

a

:

A

)

C

⁢

(

a

)

→

W

~

and

•

𝗉

~

:

∏

(

b

:

B

)

∏

(

y

:

C

(

f

(

b

)

)

)

(

𝖼

~

(

f

(

b

)

,

y

)

=

W

~

𝖼

~

(

g

(

b

)

,

D

(

b

)

(

y

)

)

)

.

The flattening lemma is:

Lemma 6.12.2

(Flattening lemma).

In the above situation, we have

(

∑

x

:

W

P

⁢

(

x

)

)

≃

W

~

.

As remarked above, this equivalence can be seen as expressing the universal property of

∑

(

x

:

W

)

P

⁢

(

x

)

as a “lax colimit” of

P

over

W

.
It can also be seen as part of the

stability and descent

property of colimits, which characterizes higher toposes.

The proof of Lemma 6.12.2 (

http://planetmath.org/612theflatteninglemma#Thmprelem2

) occupies the rest of this section.
It is somewhat technical and can be skipped on a first reading.
But it is also a good example of “proof-relevant mathematics”,
so we recommend it on a second reading.

The idea is to show that

∑

(

x

:

W

)

P

⁢

(

x

)

has the same universal property as

W

~

.
We begin by showing that it comes with analogues of the constructors

𝖼

~

and

𝗉

~

.

Lemma 6.12.3

.

There are

functions

•

𝖼

~

′

:

∏

(

a

:

A

)

C

⁢

(

a

)

→

∑

(

x

:

W

)

P

⁢

(

x

)

and

•

𝗉

~

′

:

∏

(

b

:

B

)

∏

(

y

:

C

(

f

(

b

)

)

)

(

𝖼

~

′

(

f

(

b

)

,

y

)

=

∑

(

w

:

W

)

P

⁢

(

w

)

𝖼

~

′

(

g

(

b

)

,

D

(

b

)

(

y

)

)

)

.

Proof.

The first is easy; define

𝖼

~

′

(

a

,

x

)

:

≡

(

𝖼

(

a

)

,

x

)

and note that by definition

P

⁢

(

𝖼

⁢

(

a

)

)

≡

C

⁢

(

a

)

.
For the second, suppose given

b

:

B

and

y

:

C

⁢

(

f

⁢

(

b

)

)

; we must give an equality

(

𝖼

⁢

(

f

⁢

(

b

)

)

,

y

)

=

(

𝖼

⁢

(

g

⁢

(

b

)

,

D

⁢

(

b

)

⁢

(

y

)

)

)

.

Since we have

𝗉

⁢

(

b

)

:

f

⁢

(

b

)

=

g

⁢

(

b

)

, by equalities in

Σ

-types it suffices to give an equality

𝗉

(

b

)

*

(

y

)

=

D

(

b

)

(

y

)

.
But this follows from Lemma 6.12.1 (

http://planetmath.org/612theflatteninglemma#Thmprelem1

), using the definition of

P

.
∎

Now the following lemma says to define a section of a type family over

∑

(

w

:

W

)

P

⁢

(

w

)

, it suffices to give analogous data as in the case of

W

~

.

Lemma 6.12.4

.

Suppose

Q

:

(

∑

(

x

:

W

)

P

⁢

(

x

)

)

→

U

is a type family and that we have

•

c

:

∏

(

a

:

A

)

∏

(

x

:

C

(

a

)

)

Q

⁢

(

𝖼

~

′

⁢

(

a

,

x

)

)

and

•

p

:

∏

(

b

:

B

)

∏

(

y

:

C

(

f

(

b

)

)

)

(

𝗉

~

′

(

b

,

y

)

*

(

c

(

f

(

b

)

,

y

)

)

=

c

(

g

(

b

)

,

D

(

b

)

(

y

)

)

)

.

Then there exists

f

:

∏

(

z

:

∑

(

w

:

W

)

P

(

w

)

)

Q

⁢

(

z

)

such that

f

⁢

(

c

~

′

⁢

(

a

,

x

)

)

≡

c

⁢

(

a

,

x

)

.

Proof.

Suppose given

w

:

W

and

x

:

P

⁢

(

w

)

; we must produce an

element

f

⁢

(

w

,

x

)

:

Q

⁢

(

w

,

x

)

.
By

induction

on

w

, it suffices to consider two cases.
When

w

≡

𝖼

⁢

(

a

)

, then we have

x

:

C

⁢

(

a

)

, and so

c

⁢

(

a

,

x

)

:

Q

⁢

(

𝖼

⁢

(

a

)

,

x

)

as desired.
(This part of the definition also ensures that the stated computational rule holds.)

Now we must show that this definition is preserved by transporting along

𝗉

⁢

(

b

)

for any

b

:

B

.
Since what we are defining, for all

w

:

W

, is a function of type

∏

(

x

:

P

(

w

)

)

Q

⁢

(

w

,

x

)

, by Lemma 2.9.7 (

http://planetmath.org/29pitypesandthefunctionextensionalityaxiom#Thmprelem2

) it suffices to show that for any

y

:

C

⁢

(

f

⁢

(

b

)

)

, we have

𝗍𝗋𝖺𝗇𝗌𝗉𝗈𝗋𝗍

Q

(

𝗉𝖺𝗂𝗋

=

(

𝗉

(

b

)

,

𝗋𝖾𝖿𝗅

𝗉

(

b

)

*

(

y

)

)

,

c

(

f

(

b

)

,

y

)

)

=

c

(

g

(

b

)

,

𝗉

(

b

)

*

(

y

)

)

.

Let

q

:

𝗉

(

b

)

*

(

y

)

=

D

(

b

)

(

y

)

be the path obtained from Lemma 6.12.1 (

http://planetmath.org/612theflatteninglemma#Thmprelem1

).
Then we have

c

(

g

(

b

)

,

𝗉

(

b

)

*

(

y

)

)

=

𝗍𝗋𝖺𝗇𝗌𝗉𝗈𝗋𝗍

x

↦

Q

⁢

(

c

⁢

(

g

⁢

(

b

)

,

x

)

)

⁢

(

q

-

1

,

c

⁢

(

g

⁢

(

b

)

,

D

⁢

(

b

)

⁢

(

y

)

)

)

(by $\mathsf{apd}_{x\mapstoc(g(b),x)}(\mathord{{q}^{-1}})$)

=

𝗍𝗋𝖺𝗇𝗌𝗉𝗈𝗋𝗍

Q

⁢

(

𝖺𝗉

x

↦

c

⁢

(

g

⁢

(

b

)

,

x

)

⁢

(

q

-

1

)

,

c

⁢

(

g

⁢

(

b

)

,

D

⁢

(

b

)

⁢

(

y

)

)

)

.

(by Lemma 2.3.10 (http://planetmath.org/23typefamiliesarefibrationshmprelem7))

Thus, it suffices to show

𝗍𝗋𝖺𝗇𝗌𝗉𝗈𝗋𝗍

Q

⁢

(

𝗉𝖺𝗂𝗋

=

⁢

(

𝗉

⁢

(

b

)

,

𝗋𝖾𝖿𝗅

𝗉

(

b

)

*

(

y

)

)

,

c

⁢

(

f

⁢

(

b

)

,

y

)

)

=

𝗍𝗋𝖺𝗇𝗌𝗉𝗈𝗋𝗍

Q

⁢

(

𝖺𝗉

x

↦

c

⁢

(

g

⁢

(

b

)

,

x

)

⁢

(

q

-

1

)

,

c

⁢

(

g

⁢

(

b

)

,

D

⁢

(

b

)

⁢

(

y

)

)

)

.

Moving the right-hand transport to the other side, and combining two transports, this is equivalent to

𝗍𝗋𝖺𝗇𝗌𝗉𝗈𝗋𝗍

Q

⁢

(

𝖺𝗉

x

↦

c

⁢

(

g

⁢

(

b

)

,

x

)

⁢

(

q

)

⁢

\centerdot

⁢

𝗉𝖺𝗂𝗋

=

⁢

(

𝗉

⁢

(

b

)

,

𝗋𝖾𝖿𝗅

𝗉

(

b

)

*

(

y

)

)

,

c

⁢

(

f

⁢

(

b

)

,

y

)

)

=

c

⁢

(

g

⁢

(

b

)

,

D

⁢

(

b

)

⁢

(

y

)

)

.

However, we have

𝖺𝗉

x

↦

c

⁢

(

g

⁢

(

b

)

,

x

)

⁢

(

q

)

⁢

\centerdot

⁢

𝗉𝖺𝗂𝗋

=

⁢

(

𝗉

⁢

(

b

)

,

𝗋𝖾𝖿𝗅

𝗉

(

b

)

*

(

y

)

)

=

𝗉𝖺𝗂𝗋

=

⁢

(

𝗋𝖾𝖿𝗅

g

⁢

(

b

)

,

q

)

⁢

\centerdot

⁢

𝗉𝖺𝗂𝗋

=

⁢

(

𝗉

⁢

(

b

)

,

𝗋𝖾𝖿𝗅

𝗉

(

b

)

*

(

y

)

)

=

𝗉𝖺𝗂𝗋

=

⁢

(

𝗉

⁢

(

b

)

,

q

)

=

𝗉

~

′

⁢

(

b

,

y

)

so the construction is completed by the

assumption

p

⁢

(

b

,

y

)

of type

𝗍𝗋𝖺𝗇𝗌𝗉𝗈𝗋𝗍

Q

⁢

(

𝗉

~

′

⁢

(

b

,

y

)

,

c

⁢

(

f

⁢

(

b

)

,

y

)

)

=

c

⁢

(

g

⁢

(

b

)

,

D

⁢

(

b

)

⁢

(

y

)

)

.

∎

Lemma 6.12.4 (

http://planetmath.org/612theflatteninglemma#Thmprelem4

)

almost

gives

∑

(

w

:

W

)

P

⁢

(

w

)

the same induction principle as

W

~

.
The missing bit is the equality

𝖺𝗉𝖽

f

⁢

(

𝗉

~

′

⁢

(

b

,

y

)

)

=

p

⁢

(

b

,

y

)

.
In order to prove this, we would need to analyze the proof of Lemma 6.12.4 (

http://planetmath.org/612theflatteninglemma#Thmprelem4

), which of course is the definition of

f

.

It should be possible to do this, but it turns out that we only need the

computation

rule for the non-dependent recursion principle.
Thus, we now give a somewhat simpler direct construction of the recursor, and a proof of its computation rule.

Lemma 6.12.5

.

Suppose

Q

is a type and that we have

•

c

:

∏

(

a

:

A

)

C

⁢

(

a

)

→

Q

and

•

p

:

∏

(

b

:

B

)

∏

(

y

:

C

(

f

(

b

)

)

)

(

c

(

f

(

b

)

,

y

)

=

Q

c

(

g

(

b

)

,

D

(

b

)

(

y

)

)

)

.

Then there exists

f

:

(

∑

(

w

:

W

)

P

⁢

(

w

)

)

→

Q

such that

f

⁢

(

c

~

′

⁢

(

a

,

x

)

)

≡

c

⁢

(

a

,

x

)

.

Proof.

As in Lemma 6.12.4 (

http://planetmath.org/612theflatteninglemma#Thmprelem4

), we define

f

⁢

(

w

,

x

)

by induction on

w

:

W

.
When

w

≡

𝖼

⁢

(

a

)

, we define

f

(

𝖼

(

a

)

,

x

)

:

≡

c

(

a

,

x

)

.
Now by Lemma 2.9.6 (

http://planetmath.org/29pitypesandthefunctionextensionalityaxiom#Thmprelem1

), it suffices to consider, for

b

:

B

and

y

:

C

⁢

(

f

⁢

(

b

)

)

, the composite path

𝗍𝗋𝖺𝗇𝗌𝗉𝗈𝗋𝗍

x

↦

Q

⁢

(

𝗉

⁢

(

b

)

,

c

⁢

(

f

⁢

(

b

)

,

y

)

)

=

c

⁢

(

g

⁢

(

b

)

,

𝗍𝗋𝖺𝗇𝗌𝗉𝗈𝗋𝗍

P

⁢

(

𝗉

⁢

(

b

)

,

y

)

)

(6.12.6)

defined as the

composition

𝗍𝗋𝖺𝗇𝗌𝗉𝗈𝗋𝗍

x

↦

Q

⁢

(

𝗉

⁢

(

b

)

,

c

⁢

(

f

⁢

(

b

)

,

y

)

)

=

c

⁢

(

f

⁢

(

b

)

,

y

)

(by Lemma 2.3.5 (http://planetmath.org/23typefamiliesarefibrationshmprelem4))

=

c

⁢

(

g

⁢

(

b

)

,

D

⁢

(

b

)

⁢

(

y

)

)

(by $p(b,y)$)

=

c

⁢

(

g

⁢

(

b

)

,

𝗍𝗋𝖺𝗇𝗌𝗉𝗈𝗋𝗍

P

⁢

(

𝗉

⁢

(

b

)

,

y

)

)

.

(by Lemma 6.12.1 (http://planetmath.org/612theflatteninglemmahmprelem1))

The computation rule

f

⁢

(

𝖼

~

′

⁢

(

a

,

x

)

)

≡

c

⁢

(

a

,

x

)

follows by definition, as before.
∎

For the second computation rule, we need the following lemma.

Lemma 6.12.7

.

Let

Y

:

X

→

U

be a type family and let

f

:

(

∑

(

x

:

X

)

Y

⁢

(

x

)

)

→

Z

be defined componentwise by

f

(

x

,

y

)

:

≡

d

(

x

)

(

y

)

for a

curried function

d

:

∏

(

x

:

X

)

Y

⁢

(

x

)

→

Z

.
Then for any

s

:

x

1

=

X

x

2

and any

y

1

:

P

⁢

(

x

1

)

and

y

2

:

P

⁢

(

x

2

)

with a path

r

:

s

*

(

y

1

)

=

y

2

, the path

𝖺𝗉

f

⁢

(

𝗉𝖺𝗂𝗋

=

⁢

(

s

,

r

)

)

:

f

⁢

(

x

1

,

y

1

)

=

f

⁢

(

x

2

,

y

2

)

is equal to the composite

f

⁢

(

x

1

,

y

1

)

≡

d

⁢

(

x

1

)

⁢

(

y

1

)

=

𝗍𝗋𝖺𝗇𝗌𝗉𝗈𝗋𝗍

x

↦

Q

⁢

(

s

,

d

⁢

(

x

1

)

⁢

(

y

1

)

)

(by $\mathord{{\text{(Lemma 2.3.5 ({http://planetmath.org/23typefamiliesarefibrationshmprelem4}))}}^{-1}}$)

=

𝗍𝗋𝖺𝗇𝗌𝗉𝗈𝗋𝗍

x

↦

Q

(

s

,

d

(

x

1

)

(

s

-

1

*

(

s

*

(

y

1

)

)

)

)

=

(

𝗍𝗋𝖺𝗇𝗌𝗉𝗈𝗋𝗍

x

↦

(

Y

(

x

)

→

Z

)

(

s

,

d

(

x

1

)

)

)

(

s

*

(

y

1

)

)

(by (2.9.4) (http://planetmath.org/29pitypesandthefunctionextensionalityaxiom0.E3))

=

d

(

x

2

)

(

s

*

(

y

1

)

)

(by $\mathsf{happly}(\mathsf{apd}_{d}(s))({s}_{*}\mathopen{}\left({y_{1}}\right)\mathclose{}$)

=

d

⁢

(

x

2

)

⁢

(

y

2

)

(by $\mathsf{ap}_{d(x_{2})}(r)$)

≡

f

⁢

(

x

2

,

y

2

)

.

Proof.

After path induction on

s

and

r

, both equalities reduce to

reflexivities

.
∎

At first it may seem surprising that Lemma 6.12.7 (

http://planetmath.org/612theflatteninglemma#Thmprelem6

) has such a complicated statement, while it can be proven so simply.
The reason for the complication is to ensure that the statement is well-typed:

𝖺𝗉

f

⁢

(

𝗉𝖺𝗂𝗋

=

⁢

(

s

,

r

)

)

and the composite path it is claimed to be equal to must both have the same start and

end points

.
Once we have managed this, the proof is easy by path induction.

Lemma 6.12.8

.

In the situation of Lemma 6.12.5 (

http://planetmath.org/612theflatteninglemma#Thmprelem5

), we have

ap

f

⁢

(

p

~

′

⁢

(

b

,

y

)

)

=

p

⁢

(

b

,

y

)

.

Proof.

Recall that

𝗉

~

′

(

b

,

y

)

:

≡

𝗉𝖺𝗂𝗋

=

(

𝗉

(

b

)

,

q

)

where

q

:

𝗉

(

b

)

*

(

y

)

=

D

(

b

)

(

y

)

comes from Lemma 6.12.1 (

http://planetmath.org/612theflatteninglemma#Thmprelem1

).
Thus, since

f

is defined componentwise, we may compute

𝖺𝗉

f

⁢

(

𝗉

~

′

⁢

(

b

,

y

)

)

by Lemma 6.12.7 (

http://planetmath.org/612theflatteninglemma#Thmprelem6

), with

x

1

:

≡

𝖼

(

f

(

b

)

)

y

1

:

≡

y

x

2

:

≡

𝖼

(

g

(

b

)

)

y

2

:

≡

D

(

b

)

(

y

)

s

:

≡

𝗉

(

b

)

r

:

≡

q

.

The curried function

d

:

∏

(

w

:

W

)

P

⁢

(

w

)

→

Q

was defined by induction on

w

:

W

;
to apply Lemma 6.12.7 (

http://planetmath.org/612theflatteninglemma#Thmprelem6

) we need to understand

𝖺𝗉

d

⁢

(

x

2

)

⁢

(

r

)

and

𝗁𝖺𝗉𝗉𝗅𝗒

(

𝖺𝗉𝖽

d

(

s

)

,

s

*

(

y

1

)

)

.

For the first, since

d

⁢

(

𝖼

⁢

(

a

)

,

x

)

≡

c

⁢

(

a

,

x

)

, we have

𝖺𝗉

d

⁢

(

x

2

)

⁢

(

r

)

≡

𝖺𝗉

c

⁢

(

g

⁢

(

b

)

,

-

)

⁢

(

q

)

.

For the second, the computation rule for the induction principle of

W

tells us that

𝖺𝗉𝖽

d

⁢

(

𝗉

⁢

(

b

)

)

is equal to the composite (

6.12.6

), passed across the equivalence of Lemma 2.9.6 (

http://planetmath.org/29pitypesandthefunctionextensionalityaxiom#Thmprelem1

).
Thus, the computation rule given in Lemma 2.9.6 (

http://planetmath.org/29pitypesandthefunctionextensionalityaxiom#Thmprelem1

) implies that

𝗁𝖺𝗉𝗉𝗅𝗒

(

𝖺𝗉𝖽

d

(

𝗉

(

b

)

)

,

𝗉

(

b

)

*

(

y

)

)

is equal to the composite

(

𝗉

(

b

)

*

(

c

(

f

(

b

)

,

-

)

)

)

(

𝗉

(

b

)

*

(

y

)

)

=

𝗉

(

b

)

*

(

c

(

f

(

b

)

,

𝗉

⁢

(

b

)

-

1

*

(

𝗉

(

b

)

*

(

y

)

)

)

)

(by (2.9.4) (http://planetmath.org/29pitypesandthefunctionextensionalityaxiom0.E3))

=

𝗉

(

b

)

*

(

c

(

f

(

b

)

,

y

)

)

=

c

⁢

(

f

⁢

(

b

)

,

y

)

(by Lemma 2.3.5 (http://planetmath.org/23typefamiliesarefibrationshmprelem4))

=

c

⁢

(

f

⁢

(

b

)

,

D

⁢

(

b

)

⁢

(

y

)

)

(by $p(b,y)$)

=

c

(

f

(

b

)

,

𝗉

(

b

)

*

(

y

)

)

.

(by $\mathord{{\mathsf{ap}_{c(g(b),-)}(q)}^{-1}}$)

Finally, substituting these values of

𝖺𝗉

d

⁢

(

x

2

)

⁢

(

r

)

and

𝗁𝖺𝗉𝗉𝗅𝗒

(

𝖺𝗉𝖽

d

(

s

)

,

s

*

(

y

1

)

)

into Lemma 6.12.7 (

http://planetmath.org/612theflatteninglemma#Thmprelem6

), we see that all the paths cancel out in pairs, leaving only

p

⁢

(

b

,

y

)

.
∎

Now we are finally ready to prove the flattening lemma.

Proof of Lemma 6.12.2 (

http://planetmath.org/612theflatteninglemma#Thmprelem2

).

We define

h

:

W

~

→

∑

(

w

:

W

)

P

⁢

(

w

)

by using the recursion principle for

W

~

, with

𝖼

~

′

and

𝗉

~

′

as input data.
Similarly, we define

k

:

(

∑

(

w

:

W

)

P

⁢

(

w

)

)

→

W

~

by using the recursion principle of Lemma 6.12.5 (

http://planetmath.org/612theflatteninglemma#Thmprelem5

), with

𝖼

~

and

𝗉

~

as input data.

On the one hand, we must show that for any

z

:

W

~

, we have

k

⁢

(

h

⁢

(

z

)

)

=

z

.
By induction on

z

, it suffices to consider the two constructors of

W

~

.
But we have

k

⁢

(

h

⁢

(

𝖼

~

⁢

(

a

,

x

)

)

)

≡

k

⁢

(

𝖼

~

′

⁢

(

a

,

x

)

)

≡

𝖼

~

⁢

(

a

,

x

)

by definition, while similarly

k

(

h

(

𝗉

~

(

b

,

y

)

)

)

=

k

(

𝗉

~

′

(

b

,

y

)

)

=

𝗉

~

(

b

,

y

)

using the propositional computation rule for

W

~

and Lemma 6.12.8 (

http://planetmath.org/612theflatteninglemma#Thmprelem7

).

On the other hand, we must show that for any

z

:

∑

(

w

:

W

)

P

⁢

(

w

)

, we have

h

⁢

(

k

⁢

(

z

)

)

=

z

.
But this is essentially identical, using Lemma 6.12.4 (

http://planetmath.org/612theflatteninglemma#Thmprelem4

) for “induction on

∑

(

w

:

W

)

P

⁢

(

w

)

” and the same computation rules.
∎

Title

6.12 The flattening lemma

\metatable

Generated on Thu Feb 8 19:37:45 2018 by

LaTeXML