4.6 KiB
refl ≡ loop
is empty - Defining flipPath
via Univalence
In this part, we will define the path flipPath : Bool ≡ Bool
.
Recall the picture of doubleCover
.
(Insert gif.)
This means we need flipPath
to correspond to
the unique non-identity permutation of Bool
that flips true
and false
.
We proceed in steps :
- Define the function
Flip : Bool → Bool
. - Promote this to an isomorphism
flipIso : Bool ≅ Bool
. - The intuition is that the univalence axiom asserts that
paths in the space of spaces correspond to
homotopy-equivalences of spaces.
As a corollary,
we can make paths in
Type
from isomorphisms of types. We use this to turnflipIso
into a pathflipPath : Bool ≡ Bool
.
The function
-
In
1FundamentalGroup/Quest0.agda
, navigate to :Flip : Bool → Bool Flip x = {!!}
-
Write
x
inside the hole, and doC-c C-c
with your cursor still inside. Thec
stands for cases. You should now see :Flip : Bool → Bool Flip false = {!!} Flip true = {!!}
What this is saying is that the space
Bool
is made of two pointsfalse, true
and nothing else, so to map out of it, it suffices to give something to mapfalse
andtrue
to respectively. -
Since we want
Flip
to fliptrue
andfalse
, fill the first hole withtrue
and the second withfalse
. -
To check things have worked, try
C-c C-d
. (d
stands for deduce.) Thenagda
will ask you to input an expression. EnterFlip
. In the*Agda Information*
window, you should seeBool → Bool
This means
agda
recognisesFlip
as a well-formulated term and is a point in the space of maps fromBool
toBool
. -
We can also ask
agda
to compute outputs ofFlip
. TryC-c C-n
. (n
stands for normalise.)agda
should again be asking for an expression. EnterFlip true
. In the*Agda Information*
window, you should seefalse
, as desired.
The isomorphism
-
Navigate to
flipIso : Bool ≅ Bool flipIso = {!!}
-
Write
iso
in the hole and refine withC-c C-r
. You should now seeflipIso : Bool ≅ Bool flipIso = iso {!!} {!!} {!!} {!!}
-
Check that what
agda
is expecting in the first two holes are functionsBool → Bool
. These are our maps back and forth which will constitute the isomorphism so writeFlip
andFlip
in the first two holes. -
Check the goal of the next two holes. They should be
section Flip Flip
and
retract Flip Flip
This means we need to prove
Flip
is a right inverse and a left inverse ofFlip
. -
Write the following so that your code looks like
flipIso : Bool ≅ Bool flipIso = iso Flip Flip s r where s : section Flip Flip s b = {!!} r : retract Flip Flip r b = {!!}
The
where
allows you to make definitions local to the current definition, in the sense that you will not be able to accesss
andr
outside this proof. Note that what followswhere
must be indented. -
Check the goal of the hole
s b = {!!}
. In the*Agda Information*
window, you should seeGoal: Flip (Flip b) ≡ b ————————————————————————————————— b : Bool
Try to prove this.
Hint
You need to do cases on what
b
can be. Then for the case oftrue
andfalse
, tryC-c C-r
to see ifagda
can help. -
Do the same for
r b = {!!}
. -
Use
C-c C-d
to check thatagda
is okay withflipIso
.
The path
-
Navigate to
flipPath : Bool ≡ Bool flipPath = {!!}
-
In the hole, write in
isoToPath
and refine withC-c C-r
. You should now haveflipPath : Bool ≡ Bool flipPath = isoToPath {!!}
If you check the new hole, you should see that
agda
is expecting an isomorphismBool ≅ Bool
.isoToPath
is the function from the cubical library that converts isomorphisms between spaces into paths between the corresponding points in the space of spacesType
. -
Fill in the hole with
flipIso
and useC-c C-d
to checkagda
is happy withflipPath
. -
Try
C-c C-n
withtransport flipPath false
. You should gettrue
in the*Agda Information*
window.What
transport
did is it took the pathflipPath
in the space of spacesType
and followed the pointfalse
asBool
is transformed alongflipPath
. The end result is of coursetrue
, sinceflipPath
is the path obtained fromflip
!