@@ -17,21 +17,22 @@ record Iso a b where
1717
1818-- Isomorphism properties
1919
20−||| Isomorphism is Reflexive
20+||| Isomorphism is reflexive
2121isoRefl : Iso a a
22−isoRefl = MkIso id id (\x => Refl) (\x => Refl)
22+isoRefl = MkIso id id (\_ => Refl) (\_ => Refl)
2323
2424||| Isomorphism is transitive
2525isoTrans : Iso a b -> Iso b c -> Iso a c
2626isoTrans (MkIso to from toFrom fromTo) (MkIso to' from' toFrom' fromTo') =
27− MkIso (\x => to' (to x))
28− (\y => from (from' y))
29− (\y => (to' (to (from (from' y)))) ={ cong (toFrom (from' y)) }=
30− (to' (from' y)) ={ toFrom' y }=
31− y QED)
32− (\x => (from (from' (to' (to x)))) ={ cong (fromTo' (to x)) }=
33− (from (to x)) ={ fromTo x }=
34− x QED)
27+ MkIso xto xfrom xtoFrom xfromTo where
28+ xto : a -> c
29+ xto = to' . to
30+ xfrom : c -> a
31+ xfrom = from . from'
32+ xtoFrom : (z : c) -> xto (xfrom z) = z
33+ xtoFrom z = rewrite toFrom $ from' z in toFrom' z
34+ xfromTo : (x : a) -> xfrom (xto x) = x
35+ xfromTo x = rewrite fromTo' (to x) in fromTo x
3536
3637Category Iso where
3738 id = isoRefl
@@ -99,8 +100,7 @@ eitherBotRight = isoTrans eitherComm eitherBotLeft
99100
100101||| Isomorphism is a congruence with regards to disjunction
101102eitherCong : Iso a a' -> Iso b b' -> Iso (Either a b) (Either a' b')
102−eitherCong {a = a} {a' = a'} {b = b} {b' = b'}
103− (MkIso to from toFrom fromTo)
103+eitherCong (MkIso to from toFrom fromTo)
104104 (MkIso to' from' toFrom' fromTo') =
105105 MkIso (eitherMap to to') (eitherMap from from') ok1 ok2
106106 where eitherMap : (c -> c') -> (d -> d') -> Either c d -> Either c' d'
@@ -143,9 +143,7 @@ pairAssoc = MkIso to from ok1 ok2
143143
144144||| Conjunction with truth is a no-op
145145pairUnitRight : Iso (a, ()) a
146−pairUnitRight = MkIso fst (\x => (x, ())) (\x => Refl) ok
147− where ok : (x : (a, ())) -> (fst x, ()) = x
148− ok (x, ()) = Refl
146+pairUnitRight = MkIso fst (\x => (x, ())) (\_ => Refl) (\(_, ()) => Refl)
149147
150148||| Conjunction with truth is a no-op
151149pairUnitLeft : Iso ((), a) a
@@ -161,8 +159,7 @@ pairBotRight = isoTrans pairComm pairBotLeft
161159
162160||| Isomorphism is a congruence with regards to conjunction
163161pairCong : Iso a a' -> Iso b b' -> Iso (a, b) (a', b')
164−pairCong {a = a} {a' = a'} {b = b} {b' = b'}
165− (MkIso to from toFrom fromTo)
162+pairCong (MkIso to from toFrom fromTo)
166163 (MkIso to' from' toFrom' fromTo') =
167164 MkIso to'' from'' iso1 iso2
168165 where to'' : (a, b) -> (a', b')
@@ -205,7 +202,7 @@ distribLeft = MkIso to from toFrom fromTo
205202
206203||| Products distribute over sums
207204distribRight : Iso (a, Either b c) (Either (a, b) (a, c))
208−distribRight {a} {b} {c} = (pairComm `isoTrans` distribLeft) `isoTrans` eitherCong pairComm pairComm
205+distribRight = (pairComm `isoTrans` distribLeft) `isoTrans` eitherCong pairComm pairComm
209206
210207
211208-- Enable preorder reasoning syntax over isomorphisms
@@ -222,7 +219,7 @@ step a iso1 iso2 = isoTrans iso1 iso2
222219-- Isomorphisms over Maybe
223220||| Isomorphism is a congruence with respect to Maybe
224221maybeCong : Iso a b -> Iso (Maybe a) (Maybe b)
225−maybeCong {a} {b} (MkIso to from toFrom fromTo) = MkIso (map to) (map from) ok1 ok2
222+maybeCong (MkIso to from toFrom fromTo) = MkIso (map to) (map from) ok1 ok2
226223 where ok1 : (y : Maybe b) -> map to (map from y) = y
227224 ok1 Nothing = Refl
228225 ok1 (Just x) = (Just (to (from x))) ={ cong (toFrom x) }= (Just x) QED
@@ -253,7 +250,7 @@ maybeVoidUnit = (Maybe Void) ={ maybeEither }=
253250 () QED
254251
255252eitherMaybeLeftMaybe : Iso (Either (Maybe a) b) (Maybe (Either a b))
256−eitherMaybeLeftMaybe {a} {b} =
253+eitherMaybeLeftMaybe =
257254 (Either (Maybe a) b) ={ eitherCongLeft maybeEither }=
258255 (Either (Either a ()) b) ={ eitherAssoc }=
259256 (Either a (Either () b)) ={ eitherCongRight eitherComm }=
@@ -263,7 +260,7 @@ eitherMaybeLeftMaybe {a} {b} =
263260
264261
265262eitherMaybeRightMaybe : Iso (Either a (Maybe b)) (Maybe (Either a b))
266−eitherMaybeRightMaybe {a} {b} =
263+eitherMaybeRightMaybe =
267264 (Either a (Maybe b)) ={ eitherComm }=
268265 (Either (Maybe b) a) ={ eitherMaybeLeftMaybe }=
269266 (Maybe (Either b a)) ={ maybeCong eitherComm }=
@@ -288,8 +285,8 @@ maybeIsoS = MkIso forth back fb bf
288285 fb (FS x) = Refl
289286
290287finZeroBot : Iso (Fin 0) Void
291−finZeroBot = MkIso (\x => void (uninhabited x))
292− (\x => void x)
288+finZeroBot = MkIso (void . uninhabited)
289+ void
293290 (\x => void x)
294291 (\x => void (uninhabited x))
295292