@@ -17,12 +17,10 @@ class Functor f => VerifiedFunctor (f : Type -> Type) where
17 (g1 : a -> b) -> (g2 : b -> c) ->
17 (g1 : a -> b) -> (g2 : b -> c) ->
18 map (g2 . g1) x = (map g2 . map g1) x
18 map (g2 . g1) x = (map g2 . map g1) x
22class (Applicative f, VerifiedFunctor f) => VerifiedApplicative (f : Type -> Type) where
20class (Applicative f, VerifiedFunctor f) => VerifiedApplicative (f : Type -> Type) where
23 applicativeMap : (x : f a) -> (g : a -> b) ->
21 applicativeMap : (x : f a) -> (g : a -> b) ->
24 map g x = pure g <*> x
22 map g x = pure g <*> x
25− applicativeIdentity : (x : f a) -> pure id <*> x = x
23+ applicativeIdentity : (x : f a) -> pure Basics.id <*> x = x
26 applicativeComposition : (x : f a) -> (g1 : f (a -> b)) -> (g2 : f (b -> c)) ->
24 applicativeComposition : (x : f a) -> (g1 : f (a -> b)) -> (g2 : f (b -> c)) ->
27 ((pure (.) <*> g2) <*> g1) <*> x = g2 <*> (g1 <*> x)
25 ((pure (.) <*> g2) <*> g1) <*> x = g2 <*> (g1 <*> x)
28 applicativeHomomorphism : (x : a) -> (g : a -> b) ->
26 applicativeHomomorphism : (x : a) -> (g : a -> b) ->
@@ -30,14 +28,13 @@ class (Applicative f, VerifiedFunctor f) => VerifiedApplicative (f : Type -> Typ
30 applicativeInterchange : (x : a) -> (g : f (a -> b)) ->
28 applicativeInterchange : (x : a) -> (g : f (a -> b)) ->
31 g <*> pure x = pure (\g' : a -> b => g' x) <*> g
29 g <*> pure x = pure (\g' : a -> b => g' x) <*> g
34class (Monad m, VerifiedApplicative m) => VerifiedMonad (m : Type -> Type) where
31class (Monad m, VerifiedApplicative m) => VerifiedMonad (m : Type -> Type) where
35 monadApplicative : (mf : m (a -> b)) -> (mx : m a) ->
32 monadApplicative : (mf : m (a -> b)) -> (mx : m a) ->
36 mf <*> mx = mf >>= \f =>
33 mf <*> mx = mf >>= \f =>
37 mx >>= \x =>
34 mx >>= \x =>
38 pure (f x)
35 pure (f x)
39 monadLeftIdentity : (x : a) -> (f : a -> m b) -> return x >>= f = f x
36 monadLeftIdentity : (x : a) -> (f : a -> m b) -> return x >>= f = f x
40− monadRightIdentity : (mx : m a) -> mx >>= return = mx
37+ monadRightIdentity : (mx : m a) -> mx >>= Monad.return = mx
41 monadAssociativity : (mx : m a) -> (f : a -> m b) -> (g : b -> m c) ->
38 monadAssociativity : (mx : m a) -> (f : a -> m b) -> (g : b -> m c) ->
42 (mx >>= f) >>= g = mx >>= (\x => f x >>= g)
39 (mx >>= f) >>= g = mx >>= (\x => f x >>= g)
@@ -53,8 +50,8 @@ instance VerifiedSemigroup (List a) where
55class (VerifiedSemigroup a, Monoid a) => VerifiedMonoid a where
52class (VerifiedSemigroup a, Monoid a) => VerifiedMonoid a where
56− total monoidNeutralIsNeutralL : (l : a) -> l <+> neutral = l
53+ total monoidNeutralIsNeutralL : (l : a) -> l <+> Algebra.neutral = l
57− total monoidNeutralIsNeutralR : (r : a) -> neutral <+> r = r
54+ total monoidNeutralIsNeutralR : (r : a) -> Algebra.neutral <+> r = r
59-- instance VerifiedMonoid Nat where
56-- instance VerifiedMonoid Nat where
60-- monoidNeutralIsNeutralL = plusZeroRightNeutral
57-- monoidNeutralIsNeutralL = plusZeroRightNeutral
@@ -65,8 +62,8 @@ instance VerifiedMonoid (List a) where
65 monoidNeutralIsNeutralR xs = Refl
62 monoidNeutralIsNeutralR xs = Refl
67class (VerifiedMonoid a, Group a) => VerifiedGroup a where
64class (VerifiedMonoid a, Group a) => VerifiedGroup a where
68− total groupInverseIsInverseL : (l : a) -> l <+> inverse l = neutral
65+ total groupInverseIsInverseL : (l : a) -> l <+> inverse l = Algebra.neutral
69− total groupInverseIsInverseR : (r : a) -> inverse r <+> r = neutral
66+ total groupInverseIsInverseR : (r : a) -> inverse r <+> r = Algebra.neutral
71class (VerifiedGroup a, AbelianGroup a) => VerifiedAbelianGroup a where
68class (VerifiedGroup a, AbelianGroup a) => VerifiedAbelianGroup a where
72 total abelianGroupOpIsCommutative : (l, r : a) -> l <+> r = r <+> l
69 total abelianGroupOpIsCommutative : (l, r : a) -> l <+> r = r <+> l
@@ -77,12 +74,12 @@ class (VerifiedAbelianGroup a, Ring a) => VerifiedRing a where
77 total ringOpIsDistributiveR : (l, c, r : a) -> (l <+> c) <.> r = (l <.> r) <+> (c <.> r)
74 total ringOpIsDistributiveR : (l, c, r : a) -> (l <+> c) <.> r = (l <.> r) <+> (c <.> r)
79class (VerifiedRing a, RingWithUnity a) => VerifiedRingWithUnity a where
76class (VerifiedRing a, RingWithUnity a) => VerifiedRingWithUnity a where
80− total ringWithUnityIsUnityL : (l : a) -> l <.> unity = l
77+ total ringWithUnityIsUnityL : (l : a) -> l <.> Algebra.unity = l
81− total ringWithUnityIsUnityR : (r : a) -> unity <.> r = r
78+ total ringWithUnityIsUnityR : (r : a) -> Algebra.unity <.> r = r
83--class (VerifiedRingWithUnity a, Field a) => VerifiedField a where
80--class (VerifiedRingWithUnity a, Field a) => VerifiedField a where
84−-- total fieldInverseIsInverseL : (l : a) -> (notId : Not (l = neutral)) -> l <.> (inverseM l notId) = unity
81+-- total fieldInverseIsInverseL : (l : a) -> (notId : Not (l = neutral)) -> l <.> (inverseM l notId) = Algebra.unity
85−-- total fieldInverseIsInverseR : (r : a) -> (notId : Not (r = neutral)) -> (inverseM r notId) <.> r = unity
82+-- total fieldInverseIsInverseR : (r : a) -> (notId : Not (r = neutral)) -> (inverseM r notId) <.> r = Algebra.unity
88class JoinSemilattice a => VerifiedJoinSemilattice a where
85class JoinSemilattice a => VerifiedJoinSemilattice a where
@@ -96,10 +93,10 @@ class MeetSemilattice a => VerifiedMeetSemilattice a where
96 total meetSemilatticeMeetIsIdempotent : (e : a) -> meet e e = e
93 total meetSemilatticeMeetIsIdempotent : (e : a) -> meet e e = e
98class (VerifiedJoinSemilattice a, BoundedJoinSemilattice a) => VerifiedBoundedJoinSemilattice a where
95class (VerifiedJoinSemilattice a, BoundedJoinSemilattice a) => VerifiedBoundedJoinSemilattice a where
99− total boundedJoinSemilatticeBottomIsBottom : (e : a) -> join e bottom = e
96+ total boundedJoinSemilatticeBottomIsBottom : (e : a) -> join e Algebra.bottom = e
101class (VerifiedMeetSemilattice a, BoundedMeetSemilattice a) => VerifiedBoundedMeetSemilattice a where
98class (VerifiedMeetSemilattice a, BoundedMeetSemilattice a) => VerifiedBoundedMeetSemilattice a where
102− total boundedMeetSemilatticeTopIsTop : (e : a) -> meet e top = e
99+ total boundedMeetSemilatticeTopIsTop : (e : a) -> meet e Algebra.top = e
104class (VerifiedJoinSemilattice a, VerifiedMeetSemilattice a) => VerifiedLattice a where
101class (VerifiedJoinSemilattice a, VerifiedMeetSemilattice a) => VerifiedLattice a where
105 total latticeMeetAbsorbsJoin : (l, r : a) -> meet l (join l r) = l
102 total latticeMeetAbsorbsJoin : (l, r : a) -> meet l (join l r) = l
@@ -110,7 +107,7 @@ class (VerifiedBoundedJoinSemilattice a, VerifiedBoundedMeetSemilattice a, Verif
111--class (VerifiedRingWithUnity a, VerifiedAbelianGroup b, Module a b) => VerifiedModule a b where
108--class (VerifiedRingWithUnity a, VerifiedAbelianGroup b, Module a b) => VerifiedModule a b where
112-- total moduleScalarMultiplyComposition : (x,y : a) -> (v : b) -> x <#> (y <#> v) = (x <.> y) <#> v
109-- total moduleScalarMultiplyComposition : (x,y : a) -> (v : b) -> x <#> (y <#> v) = (x <.> y) <#> v
113−-- total moduleScalarUnityIsUnity : (v : b) -> unity {a} <#> v = v
110+-- total moduleScalarUnityIsUnity : (v : b) -> Algebra.unity {a} <#> v = v
114-- total moduleScalarMultDistributiveWRTVectorAddition : (s : a) -> (v, w : b) -> s <#> (v <+> w) = (s <#> v) <+> (s <#> w)
111-- total moduleScalarMultDistributiveWRTVectorAddition : (s : a) -> (v, w : b) -> s <#> (v <+> w) = (s <#> v) <+> (s <#> w)
115-- total moduleScalarMultDistributiveWRTModuleAddition : (s, t : a) -> (v : b) -> (s <+> t) <#> v = (s <#> v) <+> (t <#> v)
112-- total moduleScalarMultDistributiveWRTModuleAddition : (s, t : a) -> (v : b) -> (s <+> t) <#> v = (s <#> v) <+> (t <#> v)