2.2 Functions are functors

2.2 Functions are functors

Now we wish to establish that

functions

f

:

A

→

B

behave functorially on paths.
In traditional

type theory

, this is equivalently the statement that functions respect equality.
Topologically, this corresponds to saying that every function is “

continuous

”, i.e. preserves paths.

Lemma 2.2.1

.

Suppose that

f

:

A

→

B

is a function.
Then for any

x

,

y

:

A

there is an

operation

𝖺𝗉

f

:

(

x

=

A

y

)

→

(

f

(

x

)

=

B

f

(

y

)

)

.

Moreover, for each

x

:

A

we have

ap

f

⁢

(

refl

x

)

≡

refl

f

⁢

(

x

)

.

The notation

𝖺𝗉

f

can be read either as the

ap

plication of

f

to a path, or as the

a

ction on

p

aths of

f

.

First proof.

Let

D

:

∏

(

x

,

y

:

A

)

∏

(

p

:

x

=

y

)

𝒰

be the type family defined by

D

(

x

,

y

,

p

)

:

≡

(

f

(

x

)

=

f

(

y

)

)

.

Then we have

d

:

≡

λ

x

.

𝗋𝖾𝖿𝗅

f

⁢

(

x

)

:

∏

x

:

A

D

(

x

,

x

,

𝗋𝖾𝖿𝗅

x

)

.

By path

induction

, we obtain

𝖺𝗉

f

:

∏

(

x

,

y

:

A

)

∏

(

p

:

x

=

y

)

(

f

(

x

)

=

g

(

x

)

)

.
The computation rule implies

𝖺𝗉

f

⁢

(

𝗋𝖾𝖿𝗅

x

)

≡

𝗋𝖾𝖿𝗅

f

⁢

(

x

)

for each

x

:

A

.
∎

Second proof.

By induction, it suffices to assume

p

is

𝗋𝖾𝖿𝗅

x

.
In this case, we may define

𝖺𝗉

f

(

p

)

:

≡

𝗋𝖾𝖿𝗅

f

⁢

(

x

)

:

f

(

x

)

=

f

(

x

)

.
∎

We will often write

𝖺𝗉

f

⁢

(

p

)

as simply

f

(

p

)

.
This is strictly speaking ambiguous, but generally no confusion arises.
It matches the common convention in

category theory

of using the same symbol for the application of a

functor

to objects and to

morphisms

.

We note that

𝖺𝗉

behaves functorially, in all the ways that one might expect.

Lemma 2.2.2

.

For functions

f

:

A

→

B

and

g

:

B

→

C

and paths

p

:

x

=

A

y

and

q

:

y

=

A

z

, we have:

1.

𝖺𝗉

f

⁢

(

p

⁢

\centerdot

⁢

q

)

=

𝖺𝗉

f

⁢

(

p

)

⁢

\centerdot

⁢

𝖺𝗉

f

⁢

(

q

)

.

2.

𝖺𝗉

f

⁢

(

p

-

1

)

=

𝖺𝗉

f

⁢

(

p

)

-

1

.

3.

𝖺𝗉

g

⁢

(

𝖺𝗉

f

⁢

(

p

)

)

=

𝖺𝗉

g

∘

f

⁢

(

p

)

.

4.

𝖺𝗉

𝗂𝖽

A

⁢

(

p

)

=

p

.

Proof.

Left to the reader.
∎

Now we wish to establish that functions

f

:

A

→

B

behave functorially on paths.
In traditional type theory, this is equivalently the statement that functions respect equality.
Topologically, this corresponds to saying that every function is “continuous”, i.e. preserves paths.

Lemma 2.2.3

.

Suppose that

f

:

A

→

B

is a function.
Then for any

x

,

y

:

A

there is an operation

𝖺𝗉

f

:

(

x

=

A

y

)

→

(

f

(

x

)

=

B

f

(

y

)

)

.

Moreover, for each

x

:

A

we have

ap

f

⁢

(

refl

x

)

≡

refl

f

⁢

(

x

)

.

The notation

𝖺𝗉

f

can be read either as the

ap

plication of

f

to a path, or as the

a

ction on

p

aths of

f

.

First proof.

Let

D

:

∏

(

x

,

y

:

A

)

∏

(

p

:

x

=

y

)

𝒰

be the type family defined by

D

(

x

,

y

,

p

)

:

≡

(

f

(

x

)

=

f

(

y

)

)

.

Then we have

d

:

≡

λ

x

.

𝗋𝖾𝖿𝗅

f

⁢

(

x

)

:

∏

x

:

A

D

(

x

,

x

,

𝗋𝖾𝖿𝗅

x

)

.

By path induction, we obtain

𝖺𝗉

f

:

∏

(

x

,

y

:

A

)

∏

(

p

:

x

=

y

)

(

f

(

x

)

=

g

(

x

)

)

.
The computation rule implies

𝖺𝗉

f

⁢

(

𝗋𝖾𝖿𝗅

x

)

≡

𝗋𝖾𝖿𝗅

f

⁢

(

x

)

for each

x

:

A

.
∎

Second proof.

By induction, it suffices to assume

p

is

𝗋𝖾𝖿𝗅

x

.
In this case, we may define

𝖺𝗉

f

(

p

)

:

≡

𝗋𝖾𝖿𝗅

f

⁢

(

x

)

:

f

(

x

)

=

f

(

x

)

.
∎

We will often write

𝖺𝗉

f

⁢

(

p

)

as simply

f

(

p

)

.
This is strictly speaking ambiguous, but generally no confusion arises.
It matches the common convention in category theory of using the same symbol for the application of a functor to objects and to morphisms.

We note that

𝖺𝗉

behaves functorially, in all the ways that one might expect.

Lemma 2.2.4

.

For functions

f

:

A

→

B

and

g

:

B

→

C

and paths

p

:

x

=

A

y

and

q

:

y

=

A

z

, we have:

1.

𝖺𝗉

f

⁢

(

p

⁢

\centerdot

⁢

q

)

=

𝖺𝗉

f

⁢

(

p

)

⁢

\centerdot

⁢

𝖺𝗉

f

⁢

(

q

)

.

2.

𝖺𝗉

f

⁢

(

p

-

1

)

=

𝖺𝗉

f

⁢

(

p

)

-

1

.

3.

𝖺𝗉

g

⁢

(

𝖺𝗉

f

⁢

(

p

)

)

=

𝖺𝗉

g

∘

f

⁢

(

p

)

.

4.

𝖺𝗉

𝗂𝖽

A

⁢

(

p

)

=

p

.

Proof.

Left to the reader.
∎

As was the case for the equalities in Lemma 2.1.4 (

http://planetmath.org/21typesarehighergroupoids#Thmlem3

), those in Lemma 2.2.2 (

http://planetmath.org/22functionsarefunctors#Thmlem2

) are themselves paths, which

satisfy

their own coherence laws (which can be proved in the same way), and so on.

Title

2.2 Functions are functors

\metatable

Generated on Thu Feb 8 19:33:49 2018 by

LaTeXML