module 1Lab.Function.Reasoning where
Reasoning combinators for functionsπ
Unlike for paths and categories, reasoning about functions is often easy because composition of functions is strict, i.e.Β definitionally unital and associative.
Notationπ
When doing equational reasoning, itβs often somewhat clumsy to have
to write ap (f β_) p
when proving that
f β g β‘ f β h
. To fix this, we steal some cute mixfix
notation from agda-categories
which allows us to write
β‘β¨ reflβ©ββ¨ p β©
instead, which is much more aesthetically
pleasing!
As unification is sometimes fiddly when functions are involved, we
also provide a way to write β‘β¨ f ββ¨ p β©
instead.
_β©ββ¨_ : f β‘ h β g β‘ i β f β g β‘ h β i _β©ββ¨_ = apβ (Ξ» x y β x β y) reflβ©ββ¨_ : g β‘ h β f β g β‘ f β h reflβ©ββ¨_ {f = f} p = ap (f β_) p _β©ββ¨refl : f β‘ h β f β g β‘ h β g _β©ββ¨refl {g = g} p = ap (_β g) p _ββ¨_ : (f : A β B) β g β‘ h β f β g β‘ f β h f ββ¨ p = ap (f β_) p _β©β_ : f β‘ h β (g : A β B) β f β g β‘ h β g p β©β g = ap (_β g) p infixr 39 _β©ββ¨_ _ββ¨_ _β©β_