5.4 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
. - We use univalence to turn
flipIso
into a pathflipPath : Bool ≡ Bool
. The univalence axiom asserts that paths inType
- the space of spaces - correspond to homotopy-equivalences of spaces. As a corollary, we can make paths inType
from isomorphisms inType
.
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. You should now see :Flip : Bool → Bool Flip false = {!!} Flip true = {!!}
This means : the space
Bool
is made of two pointsfalse, true
and nothing else, so to map out ofBool
it suffices to find images forfalse
andtrue
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
agda
expects functionsBool → Bool
to go in the first two holes. These are the maps back and forth which constitute the isomorphism, so fill them withFlip
and its inverseFlip
. -
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.Skipped step
-
To find out why we put
s b
on the left you can tryflipIso : Bool ≅ Bool flipIso = iso Flip Flip s r where s : section Flip Flip s = {!!} r : retract Flip Flip r = {!!}
-
Check the goal of the hole
s = {!!}
and try usingC-c C-r
. It should give youλ x → {!!}
. This says it's asking for some new proof for eachx : Bool
. If you check the goal you can find out what proof it wants and thatx : Bool
. -
To do a proof for each
x : Bool
, we can also just stickx
before the=
and do away with theλ
. -
Check the goal of the hole
s b = {!!}
. In the*Agda Information*
window, you should seeGoal: Flip (Flip b) ≡ b ————————————————————————————————— b : Bool
This says it suffices to find a path from
Flip (Flip b)
tob
in the spaceBool
. Try to prove this.Tips
You need to case on what
b
can be. Then for the case oftrue
andfalse
, tryC-c C-r
to see ifagda
can help.The added benefit of having
b
before the=
is exactly this - that we can case on whatb
can be. This is called pattern matching. -
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
!