Quest 4 - Side Quests
Functional Extensionality
We show that two dependent functions
f g being equal is the same as
them being equal when applied to each
value of the domain.
We call one of these directions
functional extensionality :
funExt : {B : A → Type} {f g : (a : A) → B a} →
((a : A) → f a ≡ g a) → f ≡ g
funExt = {!!}
Write this up in agda and have a go at it.
We will cheat and use the native cubical definition of paths
(rather than using our axiomatic approach with J and JRefl etc),
since the HoTT proof of this is much more work.
A path in cubical agda between two points x and y
in a space A can be defined by just taking an arbitrary
point i on the “interval” I, to a point in the space A,
such that the end points agree.
Assuming we have the bundle B, functions f g,
a proof h of (a : A) → f a ≡ ga,
we can refine, and agda will assume such an i for us.
funExt : {B : A → Type} {f g : (a : A) → B a} →
((a : A) → f a ≡ g a) → f ≡ g
funExt h = λ i a → {!!}
Checking the goal you should see something like the following (we have extracted the important parts):
Goal: B a
——————————————————————————————————
a : A
i : I
h : (a₁ : A) → f a₁ ≡ g a₁
g : (a₁ : A) → B a₁ (not in scope)
f : (a₁ : A) → B a₁ (not in scope)
B : A → Type (not in scope)
A : Type (not in scope)
———— Constraints ————————————————————————
?0 (i = i1) = g a : B a
?0 (i = i0) = f a : B a
We break this down :
agdahas assumed an arbitraryi : Ianda : A, and is now asking for a point inB a.Let’s call whatever we put in the goal
?0; it has typeB a. The constraints say that at the start and end points ofI(calledi0andi1respectively)0? ishould bef aandg arespectively.To understand why
agdaalso gave us ana : Awe can go back a step, removinga. You should see that the goal at that point was a dependent function that at the start and end points arefandgrespectively.Try to complete the quest. You will need that given a path
pandi : Ialong the interval, writingp igives the corresponding point along the pathp.
The hypothesis Hint
h applied to the point a
gives us a path from f a to g a in B a.
Solution
funExt : {B : A → Type} {f g : (a : A) → B a} →
((a : A) → f a ≡ g a) → f ≡ g
funExt h = λ i a → h a i
Now we can promote this to an isomorphism,
hence an equality between f ≡ g and
(a : A) → f a ≡ g a.
Try to formalize and prove this.
funExtPath : (B : A → Type) (f g : (a : A) → B a) → (f ≡ g) ≡ ((a : A) → f a ≡ g a)
funExtPath {A} B f g = isoToPath (iso fun (funExt B f g) rightInv leftInv) where fun : f ≡ g → (a : A) → f a ≡ g a
fun h = λ a i → h i a rightInv : section fun (funExt B f g)
rightInv h = refl leftInv : retract fun (funExt B f g)
leftInv h = reflSolution
Justifying J
Work in progress.