{- HLINT ignore "Use camelCase" -}
{- HLINT ignore "Redundant bracket" -}
{- HLINT ignore "Redundant ==" -}

-- |
-- Copyright: © 2022–2024 Jonathan Knowles
-- License: Apache-2.0
--
-- This module provides 'Laws' definitions for classes exported by
-- "Data.Monoid.GCD".
--
module Test.QuickCheck.Classes.Monoid.GCD
    ( gcdMonoidLaws
    , leftGCDMonoidLaws
    , rightGCDMonoidLaws
    , overlappingGCDMonoidLaws
    , distributiveGCDMonoidLaws
    , leftDistributiveGCDMonoidLaws
    , rightDistributiveGCDMonoidLaws
    )
    where

import Prelude hiding
    ( gcd )

import Data.Function
    ( (&) )
import Data.Maybe
    ( isJust )
import Data.Monoid.GCD
    ( DistributiveGCDMonoid
    , GCDMonoid (..)
    , LeftDistributiveGCDMonoid
    , LeftGCDMonoid (..)
    , OverlappingGCDMonoid (..)
    , RightDistributiveGCDMonoid
    , RightGCDMonoid (..)
    )
import Data.Proxy
    ( Proxy (..) )
import Data.Semigroup.Cancellative
    ( LeftReductive (..), Reductive (..), RightReductive (..) )
import Internal
    ( cover, makeLaw1, makeLaw2, makeLaw3, makeProperty, report, (==>) )
import Test.QuickCheck
    ( Arbitrary (..), Property )
import Test.QuickCheck.Classes
    ( Laws (..) )

--------------------------------------------------------------------------------
-- GCDMonoid
--------------------------------------------------------------------------------

-- | 'Laws' for instances of 'GCDMonoid'.
--
-- Includes the following laws:
--
-- __/Reductivity/__
--
-- @
-- 'isJust' (a '</>' 'gcd' a b)
-- @
-- @
-- 'isJust' (b '</>' 'gcd' a b)
-- @
--
-- __/Uniqueness/__
--
-- @
-- 'all' 'isJust'
--     [ a '</>' c
--     , b '</>' c
--     , c '</>' 'gcd' a b
--     ]
-- ==>
--     (c '==' 'gcd' a b)
-- @
--
-- __/Idempotence/__
--
-- @
-- 'gcd' a a '==' a
-- @
--
-- __/Identity/__
--
-- @
-- 'gcd' 'mempty' a '==' 'mempty'
-- @
-- @
-- 'gcd' a 'mempty' '==' 'mempty'
-- @
--
-- __/Commutativity/__
--
-- @
-- 'gcd' a b '==' 'gcd' b a
-- @
--
-- __/Associativity/__
--
-- @
-- 'gcd' ('gcd' a b) c '==' 'gcd' a ('gcd' b c)
-- @
--
-- __/Equivalences/__
--
-- @
-- 'gcd' a b '==' 'commonPrefix' a b
-- @
-- @
-- 'gcd' a b '==' 'commonSuffix' a b
-- @
--
-- Note that the following superclass laws are __not__ included:
--
-- * 'Test.QuickCheck.Classes.monoidLaws'
-- * 'Test.QuickCheck.Classes.Semigroup.Cancellative.commutativeLaws'
-- * 'Test.QuickCheck.Classes.Semigroup.Cancellative.reductiveLaws'
-- * 'Test.QuickCheck.Classes.Monoid.GCD.leftGCDMonoidLaws'
-- * 'Test.QuickCheck.Classes.Monoid.GCD.rightGCDMonoidLaws'
-- * 'Test.QuickCheck.Classes.Monoid.GCD.overlappingGCDMonoidLaws'
--
gcdMonoidLaws
    :: forall a. (Arbitrary a, Show a, Eq a, GCDMonoid a)
    => Proxy a
    -> Laws
gcdMonoidLaws :: forall a.
(Arbitrary a, Show a, Eq a, GCDMonoid a) =>
Proxy a -> Laws
gcdMonoidLaws Proxy a
_ = String -> [(String, Property)] -> Laws
Laws String
"GCDMonoid"
    [ forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> a -> t) -> (String, Property)
makeLaw2 @a
        String
"gcdMonoidLaw_reductivity_left"
        (a -> a -> Property
forall a. (Eq a, Show a, GCDMonoid a) => a -> a -> Property
gcdMonoidLaw_reductivity_left)
    , forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> a -> t) -> (String, Property)
makeLaw2 @a
        String
"gcdMonoidLaw_reductivity_right"
        (a -> a -> Property
forall a. (Eq a, Show a, GCDMonoid a) => a -> a -> Property
gcdMonoidLaw_reductivity_right)
    , forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> a -> a -> t) -> (String, Property)
makeLaw3 @a
        String
"gcdMonoidLaw_uniqueness"
        (a -> a -> a -> Property
forall a. (Eq a, Show a, GCDMonoid a) => a -> a -> a -> Property
gcdMonoidLaw_uniqueness)
    , forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> t) -> (String, Property)
makeLaw1 @a
        String
"gcdMonoidLaw_idempotence"
        (a -> Property
forall a. (Eq a, Show a, GCDMonoid a) => a -> Property
gcdMonoidLaw_idempotence)
    , forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> t) -> (String, Property)
makeLaw1 @a
        String
"gcdMonoidLaw_identity_left"
        (a -> Property
forall a. (Eq a, Show a, GCDMonoid a) => a -> Property
gcdMonoidLaw_identity_left)
    , forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> t) -> (String, Property)
makeLaw1 @a
        String
"gcdMonoidLaw_identity_right"
        (a -> Property
forall a. (Eq a, Show a, GCDMonoid a) => a -> Property
gcdMonoidLaw_identity_right)
    , forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> a -> t) -> (String, Property)
makeLaw2 @a
        String
"gcdMonoidLaw_commutativity"
        (a -> a -> Property
forall a. (Eq a, Show a, GCDMonoid a) => a -> a -> Property
gcdMonoidLaw_commutativity)
    , forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> a -> a -> t) -> (String, Property)
makeLaw3 @a
        String
"gcdMonoidLaw_associativity"
        (a -> a -> a -> Property
forall a. (Eq a, Show a, GCDMonoid a) => a -> a -> a -> Property
gcdMonoidLaw_associativity)
    , forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> a -> t) -> (String, Property)
makeLaw2 @a
        String
"gcdMonoidLaw_equivalence_commonPrefix"
        (a -> a -> Property
forall a. (Eq a, Show a, GCDMonoid a) => a -> a -> Property
gcdMonoidLaw_equivalence_commonPrefix)
    , forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> a -> t) -> (String, Property)
makeLaw2 @a
        String
"gcdMonoidLaw_equivalence_commonSuffix"
        (a -> a -> Property
forall a. (Eq a, Show a, GCDMonoid a) => a -> a -> Property
gcdMonoidLaw_equivalence_commonSuffix)
    ]

gcdMonoidLaw_reductivity_left
    :: (Eq a, Show a, GCDMonoid a) => a -> a -> Property
gcdMonoidLaw_reductivity_left :: forall a. (Eq a, Show a, GCDMonoid a) => a -> a -> Property
gcdMonoidLaw_reductivity_left a
a a
b =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"isJust (a </> gcd a b)"
        (Maybe a -> Bool
forall a. Maybe a -> Bool
isJust (a
a a -> a -> Maybe a
forall m. Reductive m => m -> m -> Maybe m
</> a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
a a
b))
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"gcd a b /= mempty"
        (a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
a a
b a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"(a </> gcd a b) /= mempty"
        ((a
a a -> a -> Maybe a
forall m. Reductive m => m -> m -> Maybe m
</> a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
a a
b) Maybe a -> Maybe a -> Bool
forall a. Eq a => a -> a -> Bool
/= Maybe a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"gcd a b"
        (a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
a a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Maybe a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"a </> gcd a b"
        (a
a a -> a -> Maybe a
forall m. Reductive m => m -> m -> Maybe m
</> a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
a a
b)

gcdMonoidLaw_reductivity_right
    :: (Eq a, Show a, GCDMonoid a) => a -> a -> Property
gcdMonoidLaw_reductivity_right :: forall a. (Eq a, Show a, GCDMonoid a) => a -> a -> Property
gcdMonoidLaw_reductivity_right a
a a
b =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"isJust (b </> gcd a b)"
        (Maybe a -> Bool
forall a. Maybe a -> Bool
isJust (a
b a -> a -> Maybe a
forall m. Reductive m => m -> m -> Maybe m
</> a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
a a
b))
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"gcd a b /= mempty"
        (a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
a a
b a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"(b </> gcd a b) /= mempty"
        ((a
b a -> a -> Maybe a
forall m. Reductive m => m -> m -> Maybe m
</> a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
a a
b) Maybe a -> Maybe a -> Bool
forall a. Eq a => a -> a -> Bool
/= Maybe a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"gcd a b"
        (a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
a a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Maybe a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"b </> gcd a b"
        (a
b a -> a -> Maybe a
forall m. Reductive m => m -> m -> Maybe m
</> a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
a a
b)

gcdMonoidLaw_uniqueness
    :: (Eq a, Show a, GCDMonoid a) => a -> a -> a -> Property
gcdMonoidLaw_uniqueness :: forall a. (Eq a, Show a, GCDMonoid a) => a -> a -> a -> Property
gcdMonoidLaw_uniqueness a
a a
b a
c =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"all isJust [a </> c, b </> c, c </> gcd a b] ==> (c == gcd a b)"
        ((Maybe a -> Bool) -> [Maybe a] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
all Maybe a -> Bool
forall a. Maybe a -> Bool
isJust [a
a a -> a -> Maybe a
forall m. Reductive m => m -> m -> Maybe m
</> a
c, a
b a -> a -> Maybe a
forall m. Reductive m => m -> m -> Maybe m
</> a
c, a
c a -> a -> Maybe a
forall m. Reductive m => m -> m -> Maybe m
</> a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
a a
b] Bool -> Bool -> Bool
==> (a
c a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
a a
b))
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"all isJust [a </> c, b </> c, c </> gcd a b]"
        ((Maybe a -> Bool) -> [Maybe a] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
all Maybe a -> Bool
forall a. Maybe a -> Bool
isJust [a
a a -> a -> Maybe a
forall m. Reductive m => m -> m -> Maybe m
</> a
c, a
b a -> a -> Maybe a
forall m. Reductive m => m -> m -> Maybe m
</> a
c, a
c a -> a -> Maybe a
forall m. Reductive m => m -> m -> Maybe m
</> a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
a a
b])
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"not (all isJust [a </> c, b </> c, c </> gcd a b])"
        (Bool -> Bool
not ((Maybe a -> Bool) -> [Maybe a] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
all Maybe a -> Bool
forall a. Maybe a -> Bool
isJust [a
a a -> a -> Maybe a
forall m. Reductive m => m -> m -> Maybe m
</> a
c, a
b a -> a -> Maybe a
forall m. Reductive m => m -> m -> Maybe m
</> a
c, a
c a -> a -> Maybe a
forall m. Reductive m => m -> m -> Maybe m
</> a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
a a
b]))
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"c == gcd a b"
        (a
c a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
a a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"c /= gcd a b"
        (a
c a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
a a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"gcd a b"
        (a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
a a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Maybe a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"c </> gcd a b"
        (a
c a -> a -> Maybe a
forall m. Reductive m => m -> m -> Maybe m
</> a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
a a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Maybe a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"a </> c"
        (a
a a -> a -> Maybe a
forall m. Reductive m => m -> m -> Maybe m
</> a
c)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Maybe a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"b </> c"
        (a
b a -> a -> Maybe a
forall m. Reductive m => m -> m -> Maybe m
</> a
c)

gcdMonoidLaw_idempotence
    :: (Eq a, Show a, GCDMonoid a) => a -> Property
gcdMonoidLaw_idempotence :: forall a. (Eq a, Show a, GCDMonoid a) => a -> Property
gcdMonoidLaw_idempotence a
a =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"gcd a a == a"
        (a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
a a
a a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a
a)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"gcd a a"
        (a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
a a
a)

gcdMonoidLaw_identity_left
    :: (Eq a, Show a, GCDMonoid a) => a -> Property
gcdMonoidLaw_identity_left :: forall a. (Eq a, Show a, GCDMonoid a) => a -> Property
gcdMonoidLaw_identity_left a
a =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"gcd mempty a == mempty"
        (a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
forall a. Monoid a => a
mempty a
a a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"a /= mempty"
        (a
a a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"gcd mempty a"
        (a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
forall a. Monoid a => a
mempty a
a)

gcdMonoidLaw_identity_right
    :: (Eq a, Show a, GCDMonoid a) => a -> Property
gcdMonoidLaw_identity_right :: forall a. (Eq a, Show a, GCDMonoid a) => a -> Property
gcdMonoidLaw_identity_right a
a =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"gcd a mempty == mempty"
        (a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
a a
forall a. Monoid a => a
mempty a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"a /= mempty"
        (a
a a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"gcd a mempty"
        (a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
a a
forall a. Monoid a => a
mempty)

gcdMonoidLaw_commutativity
    :: (Eq a, Show a, GCDMonoid a) => a -> a -> Property
gcdMonoidLaw_commutativity :: forall a. (Eq a, Show a, GCDMonoid a) => a -> a -> Property
gcdMonoidLaw_commutativity a
a a
b =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"gcd a b == gcd b a"
        (a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
a a
b a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
b a
a)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"gcd a b == mempty"
        (a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
a a
b a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"gcd a b /= mempty"
        (a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
a a
b a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"gcd a b"
        (a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
a a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"gcd b a"
        (a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
b a
a)

gcdMonoidLaw_associativity
    :: (Eq a, Show a, GCDMonoid a) => a -> a -> a -> Property
gcdMonoidLaw_associativity :: forall a. (Eq a, Show a, GCDMonoid a) => a -> a -> a -> Property
gcdMonoidLaw_associativity a
a a
b a
c =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"gcd (gcd a b) c == gcd a (gcd b c)"
        (a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd (a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
a a
b) a
c a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
a (a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
b a
c))
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"gcd a b /= mempty"
        (a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
a a
b a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"gcd b c /= mempty"
        (a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
b a
c a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"gcd a b"
        (a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
a a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"gcd (gcd a b) c"
        (a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd (a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
a a
b) a
c)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"gcd b c"
        (a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
b a
c)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"gcd a (gcd b c)"
        (a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
a (a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
b a
c))

gcdMonoidLaw_equivalence_commonPrefix
    :: (Eq a, Show a, GCDMonoid a) => a -> a -> Property
gcdMonoidLaw_equivalence_commonPrefix :: forall a. (Eq a, Show a, GCDMonoid a) => a -> a -> Property
gcdMonoidLaw_equivalence_commonPrefix a
a a
b =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"gcd a b == commonPrefix a b"
        (a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
a a
b a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix a
a a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"gcd a b /= mempty"
        (a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
a a
b a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"commonPrefix a b /= mempty"
        (a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix a
a a
b a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"gcd a b"
        (a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
a a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"commonPrefix a b"
        (a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix a
a a
b)

gcdMonoidLaw_equivalence_commonSuffix
    :: (Eq a, Show a, GCDMonoid a) => a -> a -> Property
gcdMonoidLaw_equivalence_commonSuffix :: forall a. (Eq a, Show a, GCDMonoid a) => a -> a -> Property
gcdMonoidLaw_equivalence_commonSuffix a
a a
b =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"gcd a b == commonSuffix a b"
        (a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
a a
b a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix a
a a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"gcd a b /= mempty"
        (a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
a a
b a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"commonSuffix a b /= mempty"
        (a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix a
a a
b a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"gcd a b"
        (a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
a a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"commonSuffix a b"
        (a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix a
a a
b)

--------------------------------------------------------------------------------
-- LeftGCDMonoid
--------------------------------------------------------------------------------

-- | 'Laws' for instances of 'LeftGCDMonoid'.
--
-- Includes the following laws:
--
-- __/Reductivity/__
--
-- @
-- 'isJust' ('stripPrefix' ('commonPrefix' a b) a)
-- @
-- @
-- 'isJust' ('stripPrefix' ('commonPrefix' a b) b)
-- @
--
-- __/Uniqueness/__
--
-- @
-- 'all' 'isJust'
--     [ 'stripPrefix' c a
--     , 'stripPrefix' c b
--     , 'stripPrefix' ('commonPrefix' a b) c
--     ]
-- ==>
--     (c '==' 'commonPrefix' a b)
-- @
--
-- __/Idempotence/__
--
-- @
-- 'commonPrefix' a a '==' a
-- @
--
-- __/Identity/__
--
-- @
-- 'commonPrefix' 'mempty' a '==' 'mempty'
-- @
-- @
-- 'commonPrefix' a 'mempty' '==' 'mempty'
-- @
--
-- __/Commutativity/__
--
-- @
-- 'commonPrefix' a b '==' 'commonPrefix' b a
-- @
--
-- __/Associativity/__
--
-- @
-- 'commonPrefix' ('commonPrefix' a b) c
-- '=='
-- 'commonPrefix' a ('commonPrefix' b c)
-- @
--
-- __/Equivalences/__
--
-- @
-- 'stripCommonPrefix' a b '&' \\(p, _, _) -> p '==' 'commonPrefix' a b
-- @
--
-- @
-- 'stripCommonPrefix' a b '&' \\(p, x, _) -> p '<>' x '==' a
-- @
--
-- @
-- 'stripCommonPrefix' a b '&' \\(p, _, x) -> p '<>' x '==' b
-- @
--
-- @
-- 'stripCommonPrefix' a b '&' \\(p, x, _) -> 'Just' x '==' 'stripPrefix' p a
-- @
--
-- @
-- 'stripCommonPrefix' a b '&' \\(p, _, x) -> 'Just' x '==' 'stripPrefix' p b
-- @
--
-- Note that the following superclass laws are __not__ included:
--
-- * 'Test.QuickCheck.Classes.monoidLaws'
-- * 'Test.QuickCheck.Classes.Semigroup.Cancellative.leftReductiveLaws'
--
leftGCDMonoidLaws
    :: forall a. (Arbitrary a, Show a, Eq a, LeftGCDMonoid a)
    => Proxy a
    -> Laws
leftGCDMonoidLaws :: forall a.
(Arbitrary a, Show a, Eq a, LeftGCDMonoid a) =>
Proxy a -> Laws
leftGCDMonoidLaws Proxy a
_ = String -> [(String, Property)] -> Laws
Laws String
"LeftGCDMonoid"
    [ forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> a -> t) -> (String, Property)
makeLaw2 @a
        String
"leftGCDMonoidLaw_reductivity_left"
        (a -> a -> Property
forall a. (Eq a, Show a, LeftGCDMonoid a) => a -> a -> Property
leftGCDMonoidLaw_reductivity_left)
    , forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> a -> t) -> (String, Property)
makeLaw2 @a
        String
"leftGCDMonoidLaw_reductivity_right"
        (a -> a -> Property
forall a. (Eq a, Show a, LeftGCDMonoid a) => a -> a -> Property
leftGCDMonoidLaw_reductivity_right)
    , forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> a -> t) -> (String, Property)
makeLaw2 @a
        String
"leftGCDMonoidLaw_uniqueness"
        (a -> a -> a -> Property
forall a.
(Eq a, Show a, LeftGCDMonoid a) =>
a -> a -> a -> Property
leftGCDMonoidLaw_uniqueness)
    , forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> t) -> (String, Property)
makeLaw1 @a
        String
"leftGCDMonoidLaw_idempotence"
        (a -> Property
forall a. (Eq a, Show a, LeftGCDMonoid a) => a -> Property
leftGCDMonoidLaw_idempotence)
    , forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> t) -> (String, Property)
makeLaw1 @a
        String
"leftGCDMonoidLaw_identity_left"
        (a -> Property
forall a. (Eq a, Show a, LeftGCDMonoid a) => a -> Property
leftGCDMonoidLaw_identity_left)
    , forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> t) -> (String, Property)
makeLaw1 @a
        String
"leftGCDMonoidLaw_identity_right"
        (a -> Property
forall a. (Eq a, Show a, LeftGCDMonoid a) => a -> Property
leftGCDMonoidLaw_identity_right)
    , forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> a -> t) -> (String, Property)
makeLaw2 @a
        String
"leftGCDMonoidLaw_commutativity"
        (a -> a -> Property
forall a. (Eq a, Show a, LeftGCDMonoid a) => a -> a -> Property
leftGCDMonoidLaw_commutativity)
    , forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> a -> a -> t) -> (String, Property)
makeLaw3 @a
        String
"leftGCDMonoidLaw_associativity"
        (a -> a -> a -> Property
forall a.
(Eq a, Show a, LeftGCDMonoid a) =>
a -> a -> a -> Property
leftGCDMonoidLaw_associativity)
    , forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> a -> t) -> (String, Property)
makeLaw2 @a
        String
"leftGCDMonoidLaw_stripCommonPrefix_commonPrefix"
        (a -> a -> Property
forall a. (Eq a, Show a, LeftGCDMonoid a) => a -> a -> Property
leftGCDMonoidLaw_stripCommonPrefix_commonPrefix)
    , forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> a -> t) -> (String, Property)
makeLaw2 @a
        String
"leftGCDMonoidLaw_stripCommonPrefix_mappend_1"
        (a -> a -> Property
forall a. (Eq a, Show a, LeftGCDMonoid a) => a -> a -> Property
leftGCDMonoidLaw_stripCommonPrefix_mappend_1)
    , forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> a -> t) -> (String, Property)
makeLaw2 @a
        String
"leftGCDMonoidLaw_stripCommonPrefix_mappend_2"
        (a -> a -> Property
forall a. (Eq a, Show a, LeftGCDMonoid a) => a -> a -> Property
leftGCDMonoidLaw_stripCommonPrefix_mappend_2)
    , forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> a -> t) -> (String, Property)
makeLaw2 @a
        String
"leftGCDMonoidLaw_stripCommonPrefix_stripPrefix_1"
        (a -> a -> Property
forall a. (Eq a, Show a, LeftGCDMonoid a) => a -> a -> Property
leftGCDMonoidLaw_stripCommonPrefix_stripPrefix_1)
    , forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> a -> t) -> (String, Property)
makeLaw2 @a
        String
"leftGCDMonoidLaw_stripCommonPrefix_stripPrefix_2"
        (a -> a -> Property
forall a. (Eq a, Show a, LeftGCDMonoid a) => a -> a -> Property
leftGCDMonoidLaw_stripCommonPrefix_stripPrefix_2)
    ]

leftGCDMonoidLaw_reductivity_left
    :: (Eq a, Show a, LeftGCDMonoid a) => a -> a -> Property
leftGCDMonoidLaw_reductivity_left :: forall a. (Eq a, Show a, LeftGCDMonoid a) => a -> a -> Property
leftGCDMonoidLaw_reductivity_left a
a a
b =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"isJust (stripPrefix (commonPrefix a b) a)"
        (Maybe a -> Bool
forall a. Maybe a -> Bool
isJust (a -> a -> Maybe a
forall m. LeftReductive m => m -> m -> Maybe m
stripPrefix (a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix a
a a
b) a
a))
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"commonPrefix a b /= mempty"
        (a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix a
a a
b a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"stripPrefix (commonPrefix a b) a /= mempty"
        (a -> a -> Maybe a
forall m. LeftReductive m => m -> m -> Maybe m
stripPrefix (a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix a
a a
b) a
a Maybe a -> Maybe a -> Bool
forall a. Eq a => a -> a -> Bool
/= Maybe a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"commonPrefix a b"
        (a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix a
a a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Maybe a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"stripPrefix (commonPrefix a b) a"
        (a -> a -> Maybe a
forall m. LeftReductive m => m -> m -> Maybe m
stripPrefix (a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix a
a a
b) a
a)

leftGCDMonoidLaw_reductivity_right
    :: (Eq a, Show a, LeftGCDMonoid a) => a -> a -> Property
leftGCDMonoidLaw_reductivity_right :: forall a. (Eq a, Show a, LeftGCDMonoid a) => a -> a -> Property
leftGCDMonoidLaw_reductivity_right a
a a
b =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"isJust (stripPrefix (commonPrefix a b) b)"
        (Maybe a -> Bool
forall a. Maybe a -> Bool
isJust (a -> a -> Maybe a
forall m. LeftReductive m => m -> m -> Maybe m
stripPrefix (a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix a
a a
b) a
b))
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"commonPrefix a b /= mempty"
        (a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix a
a a
b a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"stripPrefix (commonPrefix a b) b /= mempty"
        (a -> a -> Maybe a
forall m. LeftReductive m => m -> m -> Maybe m
stripPrefix (a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix a
a a
b) a
b Maybe a -> Maybe a -> Bool
forall a. Eq a => a -> a -> Bool
/= Maybe a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"commonPrefix a b"
        (a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix a
a a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Maybe a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"stripPrefix (commonPrefix a b) b"
        (a -> a -> Maybe a
forall m. LeftReductive m => m -> m -> Maybe m
stripPrefix (a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix a
a a
b) a
b)

leftGCDMonoidLaw_uniqueness
    :: (Eq a, Show a, LeftGCDMonoid a) => a -> a -> a -> Property
leftGCDMonoidLaw_uniqueness :: forall a.
(Eq a, Show a, LeftGCDMonoid a) =>
a -> a -> a -> Property
leftGCDMonoidLaw_uniqueness a
a a
b a
c =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"antecedent ==> consequent"
        (Bool
antecedent Bool -> Bool -> Bool
==> Bool
consequent)
    -- Note that in the expressions below, we use '==' to compare Boolean
    -- expressions, even in cases where it is redundant, in order to make
    -- test output more readable:
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"antecedent == True"
        (Bool
antecedent Bool -> Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Bool
True)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"antecedent == False"
        (Bool
antecedent Bool -> Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Bool
False)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"consequent == True"
        (Bool
consequent Bool -> Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Bool
True)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"consequent == False"
        (Bool
consequent Bool -> Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Bool
False)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Maybe a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"stripPrefix c a"
        (a -> a -> Maybe a
forall m. LeftReductive m => m -> m -> Maybe m
stripPrefix a
c a
a)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Maybe a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"stripPrefix c b"
        (a -> a -> Maybe a
forall m. LeftReductive m => m -> m -> Maybe m
stripPrefix a
c a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"commonPrefix a b"
        (a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix a
a a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Maybe a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"stripPrefix (commonPrefix a b) c"
        (a -> a -> Maybe a
forall m. LeftReductive m => m -> m -> Maybe m
stripPrefix (a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix a
a a
b) a
c)
  where
    antecedent :: Bool
antecedent =
        (Maybe a -> Bool) -> [Maybe a] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
all Maybe a -> Bool
forall a. Maybe a -> Bool
isJust
            [ a -> a -> Maybe a
forall m. LeftReductive m => m -> m -> Maybe m
stripPrefix a
c a
a
            , a -> a -> Maybe a
forall m. LeftReductive m => m -> m -> Maybe m
stripPrefix a
c a
b
            , a -> a -> Maybe a
forall m. LeftReductive m => m -> m -> Maybe m
stripPrefix (a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix a
a a
b) a
c
            ]
    consequent :: Bool
consequent =
        a
c a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix a
a a
b

leftGCDMonoidLaw_idempotence
    :: (Eq a, Show a, LeftGCDMonoid a) => a -> Property
leftGCDMonoidLaw_idempotence :: forall a. (Eq a, Show a, LeftGCDMonoid a) => a -> Property
leftGCDMonoidLaw_idempotence a
a =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"commonPrefix a a == a"
        (a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix a
a a
a a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a
a)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"commonPrefix a a"
        (a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix a
a a
a)

leftGCDMonoidLaw_identity_left
    :: (Eq a, Show a, LeftGCDMonoid a) => a -> Property
leftGCDMonoidLaw_identity_left :: forall a. (Eq a, Show a, LeftGCDMonoid a) => a -> Property
leftGCDMonoidLaw_identity_left a
a =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"commonPrefix mempty a == mempty"
        (a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix a
forall a. Monoid a => a
mempty a
a a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"a /= mempty"
        (a
a a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"commonPrefix mempty a"
        (a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix a
forall a. Monoid a => a
mempty a
a)

leftGCDMonoidLaw_identity_right
    :: (Eq a, Show a, LeftGCDMonoid a) => a -> Property
leftGCDMonoidLaw_identity_right :: forall a. (Eq a, Show a, LeftGCDMonoid a) => a -> Property
leftGCDMonoidLaw_identity_right a
a =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"commonPrefix a mempty == mempty"
        (a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix a
a a
forall a. Monoid a => a
mempty a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"a /= mempty"
        (a
a a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"commonPrefix a mempty"
        (a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix a
a a
forall a. Monoid a => a
mempty)

leftGCDMonoidLaw_commutativity
    :: (Eq a, Show a, LeftGCDMonoid a) => a -> a -> Property
leftGCDMonoidLaw_commutativity :: forall a. (Eq a, Show a, LeftGCDMonoid a) => a -> a -> Property
leftGCDMonoidLaw_commutativity a
a a
b =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"commonPrefix a b == commonPrefix b a"
        (a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix a
a a
b a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix a
b a
a)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"commonPrefix a b == mempty"
        (a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix a
a a
b a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"commonPrefix a b /= mempty"
        (a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix a
a a
b a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"commonPrefix a b"
        (a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix a
a a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"commonPrefix b a"
        (a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix a
b a
a)

leftGCDMonoidLaw_associativity
    :: (Eq a, Show a, LeftGCDMonoid a) => a -> a -> a -> Property
leftGCDMonoidLaw_associativity :: forall a.
(Eq a, Show a, LeftGCDMonoid a) =>
a -> a -> a -> Property
leftGCDMonoidLaw_associativity a
a a
b a
c =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"commonPrefix (commonPrefix a b) c == commonPrefix a (commonPrefix b c)"
        (a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix (a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix a
a a
b) a
c a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix a
a (a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix a
b a
c))
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"commonPrefix (commonPrefix a b) c /= mempty"
        (a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix (a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix a
a a
b) a
c a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"commonPrefix a (commonPrefix b c) /= mempty"
        (a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix a
a (a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix a
b a
c) a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"commonPrefix a b"
        (a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix a
a a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"commonPrefix (commonPrefix a b) c"
        (a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix (a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix a
a a
b) a
c)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"commonPrefix b c"
        (a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix a
b a
c)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"commonPrefix a (commonPrefix b c)"
        (a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix a
a (a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix a
b a
c))

leftGCDMonoidLaw_stripCommonPrefix_commonPrefix
    :: (Eq a, Show a, LeftGCDMonoid a) => a -> a -> Property
leftGCDMonoidLaw_stripCommonPrefix_commonPrefix :: forall a. (Eq a, Show a, LeftGCDMonoid a) => a -> a -> Property
leftGCDMonoidLaw_stripCommonPrefix_commonPrefix a
a a
b =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"stripCommonPrefix a b & λ(p, _, _) -> p == commonPrefix a b"
        (a -> a -> (a, a, a)
forall m. LeftGCDMonoid m => m -> m -> (m, m, m)
stripCommonPrefix a
a a
b (a, a, a) -> ((a, a, a) -> Bool) -> Bool
forall a b. a -> (a -> b) -> b
& \(a
p, a
_, a
_) -> a
p a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix a
a a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"commonPrefix a b /= mempty"
        (a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix a
a a
b a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> (a, a, a) -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"stripCommonPrefix a b"
        (a -> a -> (a, a, a)
forall m. LeftGCDMonoid m => m -> m -> (m, m, m)
stripCommonPrefix a
a a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"commonPrefix a b"
        (a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix a
a a
b)

leftGCDMonoidLaw_stripCommonPrefix_mappend_1
    :: (Eq a, Show a, LeftGCDMonoid a) => a -> a -> Property
leftGCDMonoidLaw_stripCommonPrefix_mappend_1 :: forall a. (Eq a, Show a, LeftGCDMonoid a) => a -> a -> Property
leftGCDMonoidLaw_stripCommonPrefix_mappend_1 a
a a
b =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"stripCommonPrefix a b & λ(p, x, _) -> p <> x == a"
        (a -> a -> (a, a, a)
forall m. LeftGCDMonoid m => m -> m -> (m, m, m)
stripCommonPrefix a
a a
b (a, a, a) -> ((a, a, a) -> Bool) -> Bool
forall a b. a -> (a -> b) -> b
& \(a
p, a
x, a
_) -> a
p a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
x a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a
a)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"stripCommonPrefix a b & λ(p, x, _) -> p /= mempty && x /= mempty"
        (a -> a -> (a, a, a)
forall m. LeftGCDMonoid m => m -> m -> (m, m, m)
stripCommonPrefix a
a a
b (a, a, a) -> ((a, a, a) -> Bool) -> Bool
forall a b. a -> (a -> b) -> b
& \(a
p, a
x, a
_) -> a
p a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty Bool -> Bool -> Bool
&& a
x a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> (a, a, a) -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"stripCommonPrefix a b"
        (a -> a -> (a, a, a)
forall m. LeftGCDMonoid m => m -> m -> (m, m, m)
stripCommonPrefix a
a a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"stripCommonPrefix a b & λ(p, x, _) -> p <> x"
        (a -> a -> (a, a, a)
forall m. LeftGCDMonoid m => m -> m -> (m, m, m)
stripCommonPrefix a
a a
b (a, a, a) -> ((a, a, a) -> a) -> a
forall a b. a -> (a -> b) -> b
& \(a
p, a
x, a
_) -> a
p a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
x)

leftGCDMonoidLaw_stripCommonPrefix_mappend_2
    :: (Eq a, Show a, LeftGCDMonoid a) => a -> a -> Property
leftGCDMonoidLaw_stripCommonPrefix_mappend_2 :: forall a. (Eq a, Show a, LeftGCDMonoid a) => a -> a -> Property
leftGCDMonoidLaw_stripCommonPrefix_mappend_2 a
a a
b =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"stripCommonPrefix a b & λ(p, _, x) -> p <> x == b"
        (a -> a -> (a, a, a)
forall m. LeftGCDMonoid m => m -> m -> (m, m, m)
stripCommonPrefix a
a a
b (a, a, a) -> ((a, a, a) -> Bool) -> Bool
forall a b. a -> (a -> b) -> b
& \(a
p, a
_, a
x) -> a
p a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
x a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"stripCommonPrefix a b & λ(p, _, x) -> p /= mempty && x /= mempty"
        (a -> a -> (a, a, a)
forall m. LeftGCDMonoid m => m -> m -> (m, m, m)
stripCommonPrefix a
a a
b (a, a, a) -> ((a, a, a) -> Bool) -> Bool
forall a b. a -> (a -> b) -> b
& \(a
p, a
_, a
x) -> a
p a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty Bool -> Bool -> Bool
&& a
x a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> (a, a, a) -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"stripCommonPrefix a b"
        (a -> a -> (a, a, a)
forall m. LeftGCDMonoid m => m -> m -> (m, m, m)
stripCommonPrefix a
a a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"stripCommonPrefix a b & λ(p, _, x) -> p <> x"
        (a -> a -> (a, a, a)
forall m. LeftGCDMonoid m => m -> m -> (m, m, m)
stripCommonPrefix a
a a
b (a, a, a) -> ((a, a, a) -> a) -> a
forall a b. a -> (a -> b) -> b
& \(a
p, a
_, a
x) -> a
p a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
x)

leftGCDMonoidLaw_stripCommonPrefix_stripPrefix_1
    :: (Eq a, Show a, LeftGCDMonoid a) => a -> a -> Property
leftGCDMonoidLaw_stripCommonPrefix_stripPrefix_1 :: forall a. (Eq a, Show a, LeftGCDMonoid a) => a -> a -> Property
leftGCDMonoidLaw_stripCommonPrefix_stripPrefix_1 a
a a
b =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"stripCommonPrefix a b & λ(p, x, _) -> Just x == stripPrefix p a"
        (a -> a -> (a, a, a)
forall m. LeftGCDMonoid m => m -> m -> (m, m, m)
stripCommonPrefix a
a a
b (a, a, a) -> ((a, a, a) -> Bool) -> Bool
forall a b. a -> (a -> b) -> b
& \(a
p, a
x, a
_) -> a -> Maybe a
forall a. a -> Maybe a
Just a
x Maybe a -> Maybe a -> Bool
forall a. Eq a => a -> a -> Bool
== a -> a -> Maybe a
forall m. LeftReductive m => m -> m -> Maybe m
stripPrefix a
p a
a)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"stripCommonPrefix a b & λ(p, x, _) -> p /= mempty && x /= mempty"
        (a -> a -> (a, a, a)
forall m. LeftGCDMonoid m => m -> m -> (m, m, m)
stripCommonPrefix a
a a
b (a, a, a) -> ((a, a, a) -> Bool) -> Bool
forall a b. a -> (a -> b) -> b
& \(a
p, a
x, a
_) -> a
p a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty Bool -> Bool -> Bool
&& a
x a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> (a, a, a) -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"stripCommonPrefix a b"
        (a -> a -> (a, a, a)
forall m. LeftGCDMonoid m => m -> m -> (m, m, m)
stripCommonPrefix a
a a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Maybe a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"stripCommonPrefix a b & λ(p, _, _) -> stripPrefix p a"
        (a -> a -> (a, a, a)
forall m. LeftGCDMonoid m => m -> m -> (m, m, m)
stripCommonPrefix a
a a
b (a, a, a) -> ((a, a, a) -> Maybe a) -> Maybe a
forall a b. a -> (a -> b) -> b
& \(a
p, a
_, a
_) -> a -> a -> Maybe a
forall m. LeftReductive m => m -> m -> Maybe m
stripPrefix a
p a
a)

leftGCDMonoidLaw_stripCommonPrefix_stripPrefix_2
    :: (Eq a, Show a, LeftGCDMonoid a) => a -> a -> Property
leftGCDMonoidLaw_stripCommonPrefix_stripPrefix_2 :: forall a. (Eq a, Show a, LeftGCDMonoid a) => a -> a -> Property
leftGCDMonoidLaw_stripCommonPrefix_stripPrefix_2 a
a a
b =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"stripCommonPrefix a b & λ(p, _, x) -> Just x == stripPrefix p b"
        (a -> a -> (a, a, a)
forall m. LeftGCDMonoid m => m -> m -> (m, m, m)
stripCommonPrefix a
a a
b (a, a, a) -> ((a, a, a) -> Bool) -> Bool
forall a b. a -> (a -> b) -> b
& \(a
p, a
_, a
x) -> a -> Maybe a
forall a. a -> Maybe a
Just a
x Maybe a -> Maybe a -> Bool
forall a. Eq a => a -> a -> Bool
== a -> a -> Maybe a
forall m. LeftReductive m => m -> m -> Maybe m
stripPrefix a
p a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"stripCommonPrefix a b & λ(p, _, x) -> p /= mempty && x /= mempty"
        (a -> a -> (a, a, a)
forall m. LeftGCDMonoid m => m -> m -> (m, m, m)
stripCommonPrefix a
a a
b (a, a, a) -> ((a, a, a) -> Bool) -> Bool
forall a b. a -> (a -> b) -> b
& \(a
p, a
_, a
x) -> a
p a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty Bool -> Bool -> Bool
&& a
x a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> (a, a, a) -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"stripCommonPrefix a b"
        (a -> a -> (a, a, a)
forall m. LeftGCDMonoid m => m -> m -> (m, m, m)
stripCommonPrefix a
a a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Maybe a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"stripCommonPrefix a b & λ(p, _, _) -> stripPrefix p b"
        (a -> a -> (a, a, a)
forall m. LeftGCDMonoid m => m -> m -> (m, m, m)
stripCommonPrefix a
a a
b (a, a, a) -> ((a, a, a) -> Maybe a) -> Maybe a
forall a b. a -> (a -> b) -> b
& \(a
p, a
_, a
_) -> a -> a -> Maybe a
forall m. LeftReductive m => m -> m -> Maybe m
stripPrefix a
p a
b)

--------------------------------------------------------------------------------
-- OverlappingGCDMonoid
--------------------------------------------------------------------------------

-- | 'Laws' for instances of 'OverlappingGCDMonoid'.
--
-- Includes the following laws:
--
-- __/Reductivity/__
--
-- @
-- 'isJust' ('stripSuffix' ('overlap' a b) a)
-- @
-- @
-- 'isJust' ('stripPrefix' ('overlap' a b) b)
-- @
--
-- __/Idempotence/__
--
-- @
-- 'overlap' a a '==' a
-- @
--
-- __/Identity/__
--
-- @
-- 'overlap' 'mempty' a '==' 'mempty'
-- @
-- @
-- 'overlap' a 'mempty' '==' 'mempty'
-- @
--
-- __/Equivalences/__
--
-- @
-- 'overlap' a b '<>' 'stripPrefixOverlap' a b '==' b
-- @
--
-- @
-- 'stripSuffixOverlap' b a '<>' 'overlap' a b '==' a
-- @
--
-- @
-- 'stripOverlap' a b '&' \\(_, x, _) -> x '==' 'overlap' a b
-- @
--
-- @
-- 'stripOverlap' a b '&' \\(_, _, x) -> x '==' 'stripPrefixOverlap' a b
-- @
--
-- @
-- 'stripOverlap' a b '&' \\(x, _, _) -> x '==' 'stripSuffixOverlap' b a
-- @
--
-- Note that the following superclass laws are __not__ included:
--
-- * 'Test.QuickCheck.Classes.monoidLaws'
-- * 'Test.QuickCheck.Classes.Semigroup.Cancellative.leftReductiveLaws'
-- * 'Test.QuickCheck.Classes.Semigroup.Cancellative.rightReductiveLaws'
--
overlappingGCDMonoidLaws
    :: forall a. (Arbitrary a, Show a, Eq a, OverlappingGCDMonoid a)
    => Proxy a
    -> Laws
overlappingGCDMonoidLaws :: forall a.
(Arbitrary a, Show a, Eq a, OverlappingGCDMonoid a) =>
Proxy a -> Laws
overlappingGCDMonoidLaws Proxy a
_ = String -> [(String, Property)] -> Laws
Laws String
"OverlappingGCDMonoid"
    [ forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> a -> t) -> (String, Property)
makeLaw2 @a
        String
"overlappingGCDMonoidLaw_reductivity_left"
        (a -> a -> Property
forall a.
(Eq a, Show a, OverlappingGCDMonoid a) =>
a -> a -> Property
overlappingGCDMonoidLaw_reductivity_left)
    , forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> a -> t) -> (String, Property)
makeLaw2 @a
        String
"overlappingGCDMonoidLaw_reductivity_right"
        (a -> a -> Property
forall a.
(Eq a, Show a, OverlappingGCDMonoid a) =>
a -> a -> Property
overlappingGCDMonoidLaw_reductivity_right)
    , forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> t) -> (String, Property)
makeLaw1 @a
        String
"overlappingGCDMonoidLaw_idempotence"
        (a -> Property
forall a. (Eq a, Show a, OverlappingGCDMonoid a) => a -> Property
overlappingGCDMonoidLaw_idempotence)
    , forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> t) -> (String, Property)
makeLaw1 @a
        String
"overlappingGCDMonoidLaw_identity_left"
        (a -> Property
forall a. (Eq a, Show a, OverlappingGCDMonoid a) => a -> Property
overlappingGCDMonoidLaw_identity_left)
    , forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> t) -> (String, Property)
makeLaw1 @a
        String
"overlappingGCDMonoidLaw_identity_right"
        (a -> Property
forall a. (Eq a, Show a, OverlappingGCDMonoid a) => a -> Property
overlappingGCDMonoidLaw_identity_right)
    , forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> a -> t) -> (String, Property)
makeLaw2 @a
        String
"overlappingGCDMonoidLaw_overlap_stripPrefixOverlap"
        (a -> a -> Property
forall a.
(Eq a, Show a, OverlappingGCDMonoid a) =>
a -> a -> Property
overlappingGCDMonoidLaw_overlap_stripPrefixOverlap)
    , forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> a -> t) -> (String, Property)
makeLaw2 @a
        String
"overlappingGCDMonoidLaw_overlap_stripSuffixOverlap"
        (a -> a -> Property
forall a.
(Eq a, Show a, OverlappingGCDMonoid a) =>
a -> a -> Property
overlappingGCDMonoidLaw_overlap_stripSuffixOverlap)
    , forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> a -> t) -> (String, Property)
makeLaw2 @a
        String
"overlappingGCDMonoidLaw_stripOverlap_overlap"
        (a -> a -> Property
forall a.
(Eq a, Show a, OverlappingGCDMonoid a) =>
a -> a -> Property
overlappingGCDMonoidLaw_stripOverlap_overlap)
    , forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> a -> t) -> (String, Property)
makeLaw2 @a
        String
"overlappingGCDMonoidLaw_stripOverlap_stripPrefixOverlap"
        (a -> a -> Property
forall a.
(Eq a, Show a, OverlappingGCDMonoid a) =>
a -> a -> Property
overlappingGCDMonoidLaw_stripOverlap_stripPrefixOverlap)
    , forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> a -> t) -> (String, Property)
makeLaw2 @a
        String
"overlappingGCDMonoidLaw_stripOverlap_stripSuffixOverlap"
        (a -> a -> Property
forall a.
(Eq a, Show a, OverlappingGCDMonoid a) =>
a -> a -> Property
overlappingGCDMonoidLaw_stripOverlap_stripSuffixOverlap)
    ]

overlappingGCDMonoidLaw_reductivity_left
    :: (Eq a, Show a, OverlappingGCDMonoid a) => a -> a -> Property
overlappingGCDMonoidLaw_reductivity_left :: forall a.
(Eq a, Show a, OverlappingGCDMonoid a) =>
a -> a -> Property
overlappingGCDMonoidLaw_reductivity_left a
a a
b =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"isJust (stripSuffix (overlap a b) a)"
        (Maybe a -> Bool
forall a. Maybe a -> Bool
isJust (a -> a -> Maybe a
forall m. RightReductive m => m -> m -> Maybe m
stripSuffix (a -> a -> a
forall m. OverlappingGCDMonoid m => m -> m -> m
overlap a
a a
b) a
a))
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"overlap a b /= mempty"
        (a -> a -> a
forall m. OverlappingGCDMonoid m => m -> m -> m
overlap a
a a
b a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"stripSuffix (overlap a b) a /= mempty"
        (a -> a -> Maybe a
forall m. RightReductive m => m -> m -> Maybe m
stripSuffix (a -> a -> a
forall m. OverlappingGCDMonoid m => m -> m -> m
overlap a
a a
b) a
a Maybe a -> Maybe a -> Bool
forall a. Eq a => a -> a -> Bool
/= Maybe a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"overlap a b"
        (a -> a -> a
forall m. OverlappingGCDMonoid m => m -> m -> m
overlap a
a a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Maybe a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"stripSuffix (overlap a b) a"
        (a -> a -> Maybe a
forall m. RightReductive m => m -> m -> Maybe m
stripSuffix (a -> a -> a
forall m. OverlappingGCDMonoid m => m -> m -> m
overlap a
a a
b) a
a)

overlappingGCDMonoidLaw_reductivity_right
    :: (Eq a, Show a, OverlappingGCDMonoid a) => a -> a -> Property
overlappingGCDMonoidLaw_reductivity_right :: forall a.
(Eq a, Show a, OverlappingGCDMonoid a) =>
a -> a -> Property
overlappingGCDMonoidLaw_reductivity_right a
a a
b =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"isJust (stripPrefix (overlap a b) b)"
        (Maybe a -> Bool
forall a. Maybe a -> Bool
isJust (a -> a -> Maybe a
forall m. LeftReductive m => m -> m -> Maybe m
stripPrefix (a -> a -> a
forall m. OverlappingGCDMonoid m => m -> m -> m
overlap a
a a
b) a
b))
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"overlap a b /= mempty"
        (a -> a -> a
forall m. OverlappingGCDMonoid m => m -> m -> m
overlap a
a a
b a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"stripPrefix (overlap a b) b /= mempty"
        (a -> a -> Maybe a
forall m. LeftReductive m => m -> m -> Maybe m
stripPrefix (a -> a -> a
forall m. OverlappingGCDMonoid m => m -> m -> m
overlap a
a a
b) a
b Maybe a -> Maybe a -> Bool
forall a. Eq a => a -> a -> Bool
/= Maybe a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"overlap a b"
        (a -> a -> a
forall m. OverlappingGCDMonoid m => m -> m -> m
overlap a
a a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Maybe a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"stripPrefix (overlap a b) b"
        (a -> a -> Maybe a
forall m. LeftReductive m => m -> m -> Maybe m
stripPrefix (a -> a -> a
forall m. OverlappingGCDMonoid m => m -> m -> m
overlap a
a a
b) a
b)

overlappingGCDMonoidLaw_idempotence
    :: (Eq a, Show a, OverlappingGCDMonoid a) => a -> Property
overlappingGCDMonoidLaw_idempotence :: forall a. (Eq a, Show a, OverlappingGCDMonoid a) => a -> Property
overlappingGCDMonoidLaw_idempotence a
a =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"overlap a a == a"
        (a -> a -> a
forall m. OverlappingGCDMonoid m => m -> m -> m
overlap a
a a
a a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a
a)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"overlap a a"
        (a -> a -> a
forall m. OverlappingGCDMonoid m => m -> m -> m
overlap a
a a
a)

overlappingGCDMonoidLaw_identity_left
    :: (Eq a, Show a, OverlappingGCDMonoid a) => a -> Property
overlappingGCDMonoidLaw_identity_left :: forall a. (Eq a, Show a, OverlappingGCDMonoid a) => a -> Property
overlappingGCDMonoidLaw_identity_left a
a =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"overlap mempty a == mempty"
        (a -> a -> a
forall m. OverlappingGCDMonoid m => m -> m -> m
overlap a
forall a. Monoid a => a
mempty a
a a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"a /= mempty"
        (a
a a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"overlap mempty a"
        (a -> a -> a
forall m. OverlappingGCDMonoid m => m -> m -> m
overlap a
forall a. Monoid a => a
mempty a
a)

overlappingGCDMonoidLaw_identity_right
    :: (Eq a, Show a, OverlappingGCDMonoid a) => a -> Property
overlappingGCDMonoidLaw_identity_right :: forall a. (Eq a, Show a, OverlappingGCDMonoid a) => a -> Property
overlappingGCDMonoidLaw_identity_right a
a =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"overlap a mempty == mempty"
        (a -> a -> a
forall m. OverlappingGCDMonoid m => m -> m -> m
overlap a
a a
forall a. Monoid a => a
mempty a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"a /= mempty"
        (a
a a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"overlap a mempty"
        (a -> a -> a
forall m. OverlappingGCDMonoid m => m -> m -> m
overlap a
a a
forall a. Monoid a => a
mempty)

overlappingGCDMonoidLaw_overlap_stripPrefixOverlap
    :: (Eq a, Show a, OverlappingGCDMonoid a) => a -> a -> Property
overlappingGCDMonoidLaw_overlap_stripPrefixOverlap :: forall a.
(Eq a, Show a, OverlappingGCDMonoid a) =>
a -> a -> Property
overlappingGCDMonoidLaw_overlap_stripPrefixOverlap a
a a
b =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"overlap a b <> stripPrefixOverlap a b == b"
        (a -> a -> a
forall m. OverlappingGCDMonoid m => m -> m -> m
overlap a
a a
b a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a -> a -> a
forall m. OverlappingGCDMonoid m => m -> m -> m
stripPrefixOverlap a
a a
b a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"overlap a b /= mempty && stripPrefixOverlap a b /= mempty"
        (a -> a -> a
forall m. OverlappingGCDMonoid m => m -> m -> m
overlap a
a a
b a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty Bool -> Bool -> Bool
&& a -> a -> a
forall m. OverlappingGCDMonoid m => m -> m -> m
stripPrefixOverlap a
a a
b a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"overlap a b"
        (a -> a -> a
forall m. OverlappingGCDMonoid m => m -> m -> m
overlap a
a a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"stripPrefixOverlap a b"
        (a -> a -> a
forall m. OverlappingGCDMonoid m => m -> m -> m
stripPrefixOverlap a
a a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"overlap a b <> stripPrefixOverlap a b"
        (a -> a -> a
forall m. OverlappingGCDMonoid m => m -> m -> m
overlap a
a a
b a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a -> a -> a
forall m. OverlappingGCDMonoid m => m -> m -> m
stripPrefixOverlap a
a a
b)

overlappingGCDMonoidLaw_overlap_stripSuffixOverlap
    :: (Eq a, Show a, OverlappingGCDMonoid a) => a -> a -> Property
overlappingGCDMonoidLaw_overlap_stripSuffixOverlap :: forall a.
(Eq a, Show a, OverlappingGCDMonoid a) =>
a -> a -> Property
overlappingGCDMonoidLaw_overlap_stripSuffixOverlap a
a a
b =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"stripSuffixOverlap b a <> overlap a b == a"
        (a -> a -> a
forall m. OverlappingGCDMonoid m => m -> m -> m
stripSuffixOverlap a
b a
a a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a -> a -> a
forall m. OverlappingGCDMonoid m => m -> m -> m
overlap a
a a
b a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a
a)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"stripSuffixOverlap b a /= mempty && overlap a b /= mempty"
        (a -> a -> a
forall m. OverlappingGCDMonoid m => m -> m -> m
stripSuffixOverlap a
b a
a a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty Bool -> Bool -> Bool
&& a -> a -> a
forall m. OverlappingGCDMonoid m => m -> m -> m
overlap a
a a
b a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"stripSuffixOverlap b a"
        (a -> a -> a
forall m. OverlappingGCDMonoid m => m -> m -> m
stripSuffixOverlap a
b a
a)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"overlap a b"
        (a -> a -> a
forall m. OverlappingGCDMonoid m => m -> m -> m
overlap a
a a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"stripSuffixOverlap b a <> overlap a b"
        (a -> a -> a
forall m. OverlappingGCDMonoid m => m -> m -> m
stripSuffixOverlap a
b a
a a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a -> a -> a
forall m. OverlappingGCDMonoid m => m -> m -> m
overlap a
a a
b)

overlappingGCDMonoidLaw_stripOverlap_overlap
    :: (Eq a, Show a, OverlappingGCDMonoid a) => a -> a -> Property
overlappingGCDMonoidLaw_stripOverlap_overlap :: forall a.
(Eq a, Show a, OverlappingGCDMonoid a) =>
a -> a -> Property
overlappingGCDMonoidLaw_stripOverlap_overlap a
a a
b =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"stripOverlap a b & λ(_, x, _) -> x == overlap a b"
        (a -> a -> (a, a, a)
forall m. OverlappingGCDMonoid m => m -> m -> (m, m, m)
stripOverlap a
a a
b (a, a, a) -> ((a, a, a) -> Bool) -> Bool
forall a b. a -> (a -> b) -> b
& \(a
_, a
x, a
_) -> a
x a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a -> a -> a
forall m. OverlappingGCDMonoid m => m -> m -> m
overlap a
a a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"overlap a b /= mempty"
        (a -> a -> a
forall m. OverlappingGCDMonoid m => m -> m -> m
overlap a
a a
b a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> (a, a, a) -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"stripOverlap a b"
        (a -> a -> (a, a, a)
forall m. OverlappingGCDMonoid m => m -> m -> (m, m, m)
stripOverlap a
a a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"overlap a b"
        (a -> a -> a
forall m. OverlappingGCDMonoid m => m -> m -> m
overlap a
a a
b)

overlappingGCDMonoidLaw_stripOverlap_stripPrefixOverlap
    :: (Eq a, Show a, OverlappingGCDMonoid a) => a -> a -> Property
overlappingGCDMonoidLaw_stripOverlap_stripPrefixOverlap :: forall a.
(Eq a, Show a, OverlappingGCDMonoid a) =>
a -> a -> Property
overlappingGCDMonoidLaw_stripOverlap_stripPrefixOverlap a
a a
b =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"stripOverlap a b & λ(_, _, x) -> x == stripPrefixOverlap a b"
        (a -> a -> (a, a, a)
forall m. OverlappingGCDMonoid m => m -> m -> (m, m, m)
stripOverlap a
a a
b (a, a, a) -> ((a, a, a) -> Bool) -> Bool
forall a b. a -> (a -> b) -> b
& \(a
_, a
_, a
x) -> a
x a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a -> a -> a
forall m. OverlappingGCDMonoid m => m -> m -> m
stripPrefixOverlap a
a a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"stripPrefixOverlap a b /= mempty"
        (a -> a -> a
forall m. OverlappingGCDMonoid m => m -> m -> m
stripPrefixOverlap a
a a
b a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> (a, a, a) -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"stripOverlap a b"
        (a -> a -> (a, a, a)
forall m. OverlappingGCDMonoid m => m -> m -> (m, m, m)
stripOverlap a
a a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"stripPrefixOverlap a b"
        (a -> a -> a
forall m. OverlappingGCDMonoid m => m -> m -> m
stripPrefixOverlap a
a a
b)

overlappingGCDMonoidLaw_stripOverlap_stripSuffixOverlap
    :: (Eq a, Show a, OverlappingGCDMonoid a) => a -> a -> Property
overlappingGCDMonoidLaw_stripOverlap_stripSuffixOverlap :: forall a.
(Eq a, Show a, OverlappingGCDMonoid a) =>
a -> a -> Property
overlappingGCDMonoidLaw_stripOverlap_stripSuffixOverlap a
a a
b =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"stripOverlap a b & λ(x, _, _) -> x == stripSuffixOverlap b a"
        (a -> a -> (a, a, a)
forall m. OverlappingGCDMonoid m => m -> m -> (m, m, m)
stripOverlap a
a a
b (a, a, a) -> ((a, a, a) -> Bool) -> Bool
forall a b. a -> (a -> b) -> b
& \(a
x, a
_, a
_) -> a
x a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a -> a -> a
forall m. OverlappingGCDMonoid m => m -> m -> m
stripSuffixOverlap a
b a
a)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"stripSuffixOverlap b a /= mempty"
        (a -> a -> a
forall m. OverlappingGCDMonoid m => m -> m -> m
stripSuffixOverlap a
b a
a a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> (a, a, a) -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"stripOverlap a b"
        (a -> a -> (a, a, a)
forall m. OverlappingGCDMonoid m => m -> m -> (m, m, m)
stripOverlap a
a a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"stripSuffixOverlap b a"
        (a -> a -> a
forall m. OverlappingGCDMonoid m => m -> m -> m
stripSuffixOverlap a
b a
a)

--------------------------------------------------------------------------------
-- RightGCDMonoid
--------------------------------------------------------------------------------

-- | 'Laws' for instances of 'RightGCDMonoid'.
--
-- Includes the following laws:
--
-- __/Reductivity/__
--
-- @
-- 'isJust' ('stripSuffix' ('commonSuffix' a b) a)
-- @
-- @
-- 'isJust' ('stripSuffix' ('commonSuffix' a b) b)
-- @
--
-- __/Uniqueness/__
--
-- @
-- 'all' 'isJust'
--     [ 'stripSuffix' c a
--     , 'stripSuffix' c b
--     , 'stripSuffix' ('commonSuffix' a b) c
--     ]
-- ==>
--     (c '==' 'commonSuffix' a b)
-- @
--
-- __/Idempotence/__
--
-- @
-- 'commonSuffix' a a '==' a
-- @
--
-- __/Identity/__
--
-- @
-- 'commonSuffix' 'mempty' a '==' 'mempty'
-- @
-- @
-- 'commonSuffix' a 'mempty' '==' 'mempty'
-- @
--
-- __/Commutativity/__
--
-- @
-- 'commonSuffix' a b '==' 'commonSuffix' b a
-- @
--
-- __/Associativity/__
--
-- @
-- 'commonSuffix' ('commonSuffix' a b) c
-- '=='
-- 'commonSuffix' a ('commonSuffix' b c)
-- @
--
-- __/Equivalences/__
--
-- @
-- 'stripCommonSuffix' a b '&' \\(_, _, s) -> s '==' 'commonSuffix' a b
-- @
--
-- @
-- 'stripCommonSuffix' a b '&' \\(x, _, s) -> x '<>' s '==' a
-- @
--
-- @
-- 'stripCommonSuffix' a b '&' \\(_, x, s) -> x '<>' s '==' b
-- @
--
-- @
-- 'stripCommonSuffix' a b '&' \\(x, _, s) -> 'Just' x '==' 'stripSuffix' s a
-- @
--
-- @
-- 'stripCommonSuffix' a b '&' \\(_, x, s) -> 'Just' x '==' 'stripSuffix' s b
-- @
--
-- Note that the following superclass laws are __not__ included:
--
-- * 'Test.QuickCheck.Classes.monoidLaws'
-- * 'Test.QuickCheck.Classes.Semigroup.Cancellative.rightReductiveLaws'
--
rightGCDMonoidLaws
    :: forall a. (Arbitrary a, Show a, Eq a, RightGCDMonoid a)
    => Proxy a
    -> Laws
rightGCDMonoidLaws :: forall a.
(Arbitrary a, Show a, Eq a, RightGCDMonoid a) =>
Proxy a -> Laws
rightGCDMonoidLaws Proxy a
_ = String -> [(String, Property)] -> Laws
Laws String
"RightGCDMonoid"
    [ forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> a -> t) -> (String, Property)
makeLaw2 @a
        String
"rightGCDMonoidLaw_reductivity_left"
        (a -> a -> Property
forall a. (Eq a, Show a, RightGCDMonoid a) => a -> a -> Property
rightGCDMonoidLaw_reductivity_left)
    , forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> a -> t) -> (String, Property)
makeLaw2 @a
        String
"rightGCDMonoidLaw_reductivity_right"
        (a -> a -> Property
forall a. (Eq a, Show a, RightGCDMonoid a) => a -> a -> Property
rightGCDMonoidLaw_reductivity_right)
    , forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> a -> t) -> (String, Property)
makeLaw2 @a
        String
"rightGCDMonoidLaw_uniqueness"
        (a -> a -> a -> Property
forall a.
(Eq a, Show a, RightGCDMonoid a) =>
a -> a -> a -> Property
rightGCDMonoidLaw_uniqueness)
    , forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> t) -> (String, Property)
makeLaw1 @a
        String
"rightGCDMonoidLaw_idempotence"
        (a -> Property
forall a. (Eq a, Show a, RightGCDMonoid a) => a -> Property
rightGCDMonoidLaw_idempotence)
    , forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> t) -> (String, Property)
makeLaw1 @a
        String
"rightGCDMonoidLaw_identity_left"
        (a -> Property
forall a. (Eq a, Show a, RightGCDMonoid a) => a -> Property
rightGCDMonoidLaw_identity_left)
    , forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> t) -> (String, Property)
makeLaw1 @a
        String
"rightGCDMonoidLaw_identity_right"
        (a -> Property
forall a. (Eq a, Show a, RightGCDMonoid a) => a -> Property
rightGCDMonoidLaw_identity_right)
    , forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> a -> t) -> (String, Property)
makeLaw2 @a
        String
"rightGCDMonoidLaw_commutativity"
        (a -> a -> Property
forall a. (Eq a, Show a, RightGCDMonoid a) => a -> a -> Property
rightGCDMonoidLaw_commutativity)
    , forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> a -> a -> t) -> (String, Property)
makeLaw3 @a
        String
"rightGCDMonoidLaw_associativity"
        (a -> a -> a -> Property
forall a.
(Eq a, Show a, RightGCDMonoid a) =>
a -> a -> a -> Property
rightGCDMonoidLaw_associativity)
    , forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> a -> t) -> (String, Property)
makeLaw2 @a
        String
"rightGCDMonoidLaw_stripCommonSuffix_commonSuffix"
        (a -> a -> Property
forall a. (Eq a, Show a, RightGCDMonoid a) => a -> a -> Property
rightGCDMonoidLaw_stripCommonSuffix_commonSuffix)
    , forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> a -> t) -> (String, Property)
makeLaw2 @a
        String
"rightGCDMonoidLaw_stripCommonSuffix_mappend_1"
        (a -> a -> Property
forall a. (Eq a, Show a, RightGCDMonoid a) => a -> a -> Property
rightGCDMonoidLaw_stripCommonSuffix_mappend_1)
    , forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> a -> t) -> (String, Property)
makeLaw2 @a
        String
"rightGCDMonoidLaw_stripCommonSuffix_mappend_2"
        (a -> a -> Property
forall a. (Eq a, Show a, RightGCDMonoid a) => a -> a -> Property
rightGCDMonoidLaw_stripCommonSuffix_mappend_2)
    , forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> a -> t) -> (String, Property)
makeLaw2 @a
        String
"rightGCDMonoidLaw_stripCommonSuffix_stripSuffix_1"
        (a -> a -> Property
forall a. (Eq a, Show a, RightGCDMonoid a) => a -> a -> Property
rightGCDMonoidLaw_stripCommonSuffix_stripSuffix_1)
    , forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> a -> t) -> (String, Property)
makeLaw2 @a
        String
"rightGCDMonoidLaw_stripCommonSuffix_stripSuffix_2"
        (a -> a -> Property
forall a. (Eq a, Show a, RightGCDMonoid a) => a -> a -> Property
rightGCDMonoidLaw_stripCommonSuffix_stripSuffix_2)
    ]

rightGCDMonoidLaw_reductivity_left
    :: (Eq a, Show a, RightGCDMonoid a) => a -> a -> Property
rightGCDMonoidLaw_reductivity_left :: forall a. (Eq a, Show a, RightGCDMonoid a) => a -> a -> Property
rightGCDMonoidLaw_reductivity_left a
a a
b =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"isJust (stripSuffix (commonSuffix a b) a)"
        (Maybe a -> Bool
forall a. Maybe a -> Bool
isJust (a -> a -> Maybe a
forall m. RightReductive m => m -> m -> Maybe m
stripSuffix (a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix a
a a
b) a
a))
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"commonSuffix a b /= mempty"
        (a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix a
a a
b a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"stripSuffix (commonSuffix a b) a /= mempty"
        (a -> a -> Maybe a
forall m. RightReductive m => m -> m -> Maybe m
stripSuffix (a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix a
a a
b) a
a Maybe a -> Maybe a -> Bool
forall a. Eq a => a -> a -> Bool
/= Maybe a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"commonSuffix a b"
        (a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix a
a a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Maybe a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"stripSuffix (commonSuffix a b) a"
        (a -> a -> Maybe a
forall m. RightReductive m => m -> m -> Maybe m
stripSuffix (a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix a
a a
b) a
a)

rightGCDMonoidLaw_reductivity_right
    :: (Eq a, Show a, RightGCDMonoid a) => a -> a -> Property
rightGCDMonoidLaw_reductivity_right :: forall a. (Eq a, Show a, RightGCDMonoid a) => a -> a -> Property
rightGCDMonoidLaw_reductivity_right a
a a
b =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"isJust (stripSuffix (commonSuffix a b) b)"
        (Maybe a -> Bool
forall a. Maybe a -> Bool
isJust (a -> a -> Maybe a
forall m. RightReductive m => m -> m -> Maybe m
stripSuffix (a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix a
a a
b) a
b))
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"commonSuffix a b /= mempty"
        (a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix a
a a
b a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"stripSuffix (commonSuffix a b) b /= mempty"
        (a -> a -> Maybe a
forall m. RightReductive m => m -> m -> Maybe m
stripSuffix (a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix a
a a
b) a
b Maybe a -> Maybe a -> Bool
forall a. Eq a => a -> a -> Bool
/= Maybe a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"commonSuffix a b"
        (a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix a
a a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Maybe a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"stripSuffix (commonSuffix a b) b"
        (a -> a -> Maybe a
forall m. RightReductive m => m -> m -> Maybe m
stripSuffix (a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix a
a a
b) a
b)

rightGCDMonoidLaw_uniqueness
    :: (Eq a, Show a, RightGCDMonoid a) => a -> a -> a -> Property
rightGCDMonoidLaw_uniqueness :: forall a.
(Eq a, Show a, RightGCDMonoid a) =>
a -> a -> a -> Property
rightGCDMonoidLaw_uniqueness a
a a
b a
c =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"antecedent ==> consequent"
        (Bool
antecedent Bool -> Bool -> Bool
==> Bool
consequent)
    -- Note that in the expressions below, we use '==' to compare Boolean
    -- expressions, even in cases where it is redundant, in order to make
    -- test output more readable:
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"antecedent == True"
        (Bool
antecedent Bool -> Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Bool
True)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"antecedent == False"
        (Bool
antecedent Bool -> Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Bool
False)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"consequent == True"
        (Bool
consequent Bool -> Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Bool
True)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"consequent == False"
        (Bool
consequent Bool -> Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Bool
False)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Maybe a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"stripSuffix c a"
        (a -> a -> Maybe a
forall m. RightReductive m => m -> m -> Maybe m
stripSuffix a
c a
a)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Maybe a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"stripSuffix c b"
        (a -> a -> Maybe a
forall m. RightReductive m => m -> m -> Maybe m
stripSuffix a
c a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"commonSuffix a b"
        (a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix a
a a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Maybe a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"stripSuffix (commonSuffix a b) c"
        (a -> a -> Maybe a
forall m. RightReductive m => m -> m -> Maybe m
stripSuffix (a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix a
a a
b) a
c)
  where
    antecedent :: Bool
antecedent =
        (Maybe a -> Bool) -> [Maybe a] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
all Maybe a -> Bool
forall a. Maybe a -> Bool
isJust
            [ a -> a -> Maybe a
forall m. RightReductive m => m -> m -> Maybe m
stripSuffix a
c a
a
            , a -> a -> Maybe a
forall m. RightReductive m => m -> m -> Maybe m
stripSuffix a
c a
b
            , a -> a -> Maybe a
forall m. RightReductive m => m -> m -> Maybe m
stripSuffix (a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix a
a a
b) a
c
            ]
    consequent :: Bool
consequent =
        a
c a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix a
a a
b

rightGCDMonoidLaw_idempotence
    :: (Eq a, Show a, RightGCDMonoid a) => a -> Property
rightGCDMonoidLaw_idempotence :: forall a. (Eq a, Show a, RightGCDMonoid a) => a -> Property
rightGCDMonoidLaw_idempotence a
a =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"commonSuffix a a == a"
        (a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix a
a a
a a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a
a)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"commonSuffix a a"
        (a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix a
a a
a)

rightGCDMonoidLaw_identity_left
    :: (Eq a, Show a, RightGCDMonoid a) => a -> Property
rightGCDMonoidLaw_identity_left :: forall a. (Eq a, Show a, RightGCDMonoid a) => a -> Property
rightGCDMonoidLaw_identity_left a
a =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"commonSuffix mempty a == mempty"
        (a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix a
forall a. Monoid a => a
mempty a
a a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"a /= mempty"
        (a
a a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"commonSuffix mempty a"
        (a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix a
forall a. Monoid a => a
mempty a
a)

rightGCDMonoidLaw_identity_right
    :: (Eq a, Show a, RightGCDMonoid a) => a -> Property
rightGCDMonoidLaw_identity_right :: forall a. (Eq a, Show a, RightGCDMonoid a) => a -> Property
rightGCDMonoidLaw_identity_right a
a =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"commonSuffix a mempty == mempty"
        (a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix a
a a
forall a. Monoid a => a
mempty a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"a /= mempty"
        (a
a a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"commonSuffix a mempty"
        (a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix a
a a
forall a. Monoid a => a
mempty)

rightGCDMonoidLaw_commutativity
    :: (Eq a, Show a, RightGCDMonoid a) => a -> a -> Property
rightGCDMonoidLaw_commutativity :: forall a. (Eq a, Show a, RightGCDMonoid a) => a -> a -> Property
rightGCDMonoidLaw_commutativity a
a a
b =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"commonSuffix a b == commonSuffix b a"
        (a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix a
a a
b a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix a
b a
a)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"commonSuffix a b == mempty"
        (a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix a
a a
b a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"commonSuffix a b /= mempty"
        (a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix a
a a
b a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"commonSuffix a b"
        (a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix a
a a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"commonSuffix b a"
        (a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix a
b a
a)

rightGCDMonoidLaw_associativity
    :: (Eq a, Show a, RightGCDMonoid a) => a -> a -> a -> Property
rightGCDMonoidLaw_associativity :: forall a.
(Eq a, Show a, RightGCDMonoid a) =>
a -> a -> a -> Property
rightGCDMonoidLaw_associativity a
a a
b a
c =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"commonSuffix (commonSuffix a b) c == commonSuffix a (commonSuffix b c)"
        (a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix (a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix a
a a
b) a
c a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix a
a (a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix a
b a
c))
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"commonSuffix (commonSuffix a b) c /= mempty"
        (a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix (a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix a
a a
b) a
c a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"commonSuffix a (commonSuffix b c) /= mempty"
        (a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix a
a (a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix a
b a
c) a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"commonSuffix a b"
        (a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix a
a a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"commonSuffix (commonSuffix a b) c"
        (a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix (a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix a
a a
b) a
c)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"commonSuffix b c"
        (a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix a
b a
c)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"commonSuffix a (commonSuffix b c)"
        (a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix a
a (a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix a
b a
c))

rightGCDMonoidLaw_stripCommonSuffix_commonSuffix
    :: (Eq a, Show a, RightGCDMonoid a) => a -> a -> Property
rightGCDMonoidLaw_stripCommonSuffix_commonSuffix :: forall a. (Eq a, Show a, RightGCDMonoid a) => a -> a -> Property
rightGCDMonoidLaw_stripCommonSuffix_commonSuffix a
a a
b =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"stripCommonSuffix a b & λ(_, _, s) -> s == commonSuffix a b"
        (a -> a -> (a, a, a)
forall m. RightGCDMonoid m => m -> m -> (m, m, m)
stripCommonSuffix a
a a
b (a, a, a) -> ((a, a, a) -> Bool) -> Bool
forall a b. a -> (a -> b) -> b
& \(a
_, a
_, a
s) -> a
s a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix a
a a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"commonSuffix a b /= mempty"
        (a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix a
a a
b a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> (a, a, a) -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"stripCommonSuffix a b"
        (a -> a -> (a, a, a)
forall m. RightGCDMonoid m => m -> m -> (m, m, m)
stripCommonSuffix a
a a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"commonSuffix a b"
        (a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix a
a a
b)

rightGCDMonoidLaw_stripCommonSuffix_mappend_1
    :: (Eq a, Show a, RightGCDMonoid a) => a -> a -> Property
rightGCDMonoidLaw_stripCommonSuffix_mappend_1 :: forall a. (Eq a, Show a, RightGCDMonoid a) => a -> a -> Property
rightGCDMonoidLaw_stripCommonSuffix_mappend_1 a
a a
b =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"stripCommonSuffix a b & λ(x, _, s) -> x <> s == a"
        (a -> a -> (a, a, a)
forall m. RightGCDMonoid m => m -> m -> (m, m, m)
stripCommonSuffix a
a a
b (a, a, a) -> ((a, a, a) -> Bool) -> Bool
forall a b. a -> (a -> b) -> b
& \(a
x, a
_, a
s) -> a
x a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
s a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a
a)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"stripCommonSuffix a b & λ(x, _, s) -> x /= mempty && s /= mempty"
        (a -> a -> (a, a, a)
forall m. RightGCDMonoid m => m -> m -> (m, m, m)
stripCommonSuffix a
a a
b (a, a, a) -> ((a, a, a) -> Bool) -> Bool
forall a b. a -> (a -> b) -> b
& \(a
x, a
_, a
s) -> a
x a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty Bool -> Bool -> Bool
&& a
s a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> (a, a, a) -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"stripCommonSuffix a b"
        (a -> a -> (a, a, a)
forall m. RightGCDMonoid m => m -> m -> (m, m, m)
stripCommonSuffix a
a a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"stripCommonSuffix a b & λ(x, _, s) -> x <> s"
        (a -> a -> (a, a, a)
forall m. RightGCDMonoid m => m -> m -> (m, m, m)
stripCommonSuffix a
a a
b (a, a, a) -> ((a, a, a) -> a) -> a
forall a b. a -> (a -> b) -> b
& \(a
x, a
_, a
s) -> a
x a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
s)

rightGCDMonoidLaw_stripCommonSuffix_mappend_2
    :: (Eq a, Show a, RightGCDMonoid a) => a -> a -> Property
rightGCDMonoidLaw_stripCommonSuffix_mappend_2 :: forall a. (Eq a, Show a, RightGCDMonoid a) => a -> a -> Property
rightGCDMonoidLaw_stripCommonSuffix_mappend_2 a
a a
b =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"stripCommonSuffix a b & λ(_, x, s) -> x <> s == b"
        (a -> a -> (a, a, a)
forall m. RightGCDMonoid m => m -> m -> (m, m, m)
stripCommonSuffix a
a a
b (a, a, a) -> ((a, a, a) -> Bool) -> Bool
forall a b. a -> (a -> b) -> b
& \(a
_, a
x, a
s) -> a
x a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
s a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"stripCommonSuffix a b & λ(_, x, s) -> x /= mempty && s /= mempty"
        (a -> a -> (a, a, a)
forall m. RightGCDMonoid m => m -> m -> (m, m, m)
stripCommonSuffix a
a a
b (a, a, a) -> ((a, a, a) -> Bool) -> Bool
forall a b. a -> (a -> b) -> b
& \(a
_, a
x, a
s) -> a
x a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty Bool -> Bool -> Bool
&& a
s a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> (a, a, a) -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"stripCommonSuffix a b"
        (a -> a -> (a, a, a)
forall m. RightGCDMonoid m => m -> m -> (m, m, m)
stripCommonSuffix a
a a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"stripCommonSuffix a b & λ(_, x, s) -> x <> s"
        (a -> a -> (a, a, a)
forall m. RightGCDMonoid m => m -> m -> (m, m, m)
stripCommonSuffix a
a a
b (a, a, a) -> ((a, a, a) -> a) -> a
forall a b. a -> (a -> b) -> b
& \(a
_, a
x, a
s) -> a
x a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
s)

rightGCDMonoidLaw_stripCommonSuffix_stripSuffix_1
    :: (Eq a, Show a, RightGCDMonoid a) => a -> a -> Property
rightGCDMonoidLaw_stripCommonSuffix_stripSuffix_1 :: forall a. (Eq a, Show a, RightGCDMonoid a) => a -> a -> Property
rightGCDMonoidLaw_stripCommonSuffix_stripSuffix_1 a
a a
b =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"stripCommonSuffix a b & λ(x, _, s) -> Just x == stripSuffix s a"
        (a -> a -> (a, a, a)
forall m. RightGCDMonoid m => m -> m -> (m, m, m)
stripCommonSuffix a
a a
b (a, a, a) -> ((a, a, a) -> Bool) -> Bool
forall a b. a -> (a -> b) -> b
& \(a
x, a
_, a
s) -> a -> Maybe a
forall a. a -> Maybe a
Just a
x Maybe a -> Maybe a -> Bool
forall a. Eq a => a -> a -> Bool
== a -> a -> Maybe a
forall m. RightReductive m => m -> m -> Maybe m
stripSuffix a
s a
a)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"stripCommonSuffix a b & λ(x, _, s) -> x /= mempty && s /= mempty"
        (a -> a -> (a, a, a)
forall m. RightGCDMonoid m => m -> m -> (m, m, m)
stripCommonSuffix a
a a
b (a, a, a) -> ((a, a, a) -> Bool) -> Bool
forall a b. a -> (a -> b) -> b
& \(a
x, a
_, a
s) -> a
x a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty Bool -> Bool -> Bool
&& a
s a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> (a, a, a) -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"stripCommonSuffix a b"
        (a -> a -> (a, a, a)
forall m. RightGCDMonoid m => m -> m -> (m, m, m)
stripCommonSuffix a
a a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Maybe a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"stripCommonSuffix a b & λ(_, _, s) -> stripSuffix s a"
        (a -> a -> (a, a, a)
forall m. RightGCDMonoid m => m -> m -> (m, m, m)
stripCommonSuffix a
a a
b (a, a, a) -> ((a, a, a) -> Maybe a) -> Maybe a
forall a b. a -> (a -> b) -> b
& \(a
_, a
_, a
s) -> a -> a -> Maybe a
forall m. RightReductive m => m -> m -> Maybe m
stripSuffix a
s a
a)

rightGCDMonoidLaw_stripCommonSuffix_stripSuffix_2
    :: (Eq a, Show a, RightGCDMonoid a) => a -> a -> Property
rightGCDMonoidLaw_stripCommonSuffix_stripSuffix_2 :: forall a. (Eq a, Show a, RightGCDMonoid a) => a -> a -> Property
rightGCDMonoidLaw_stripCommonSuffix_stripSuffix_2 a
a a
b =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"stripCommonSuffix a b & λ(_, x, s) -> Just x == stripSuffix s b"
        (a -> a -> (a, a, a)
forall m. RightGCDMonoid m => m -> m -> (m, m, m)
stripCommonSuffix a
a a
b (a, a, a) -> ((a, a, a) -> Bool) -> Bool
forall a b. a -> (a -> b) -> b
& \(a
_, a
x, a
s) -> a -> Maybe a
forall a. a -> Maybe a
Just a
x Maybe a -> Maybe a -> Bool
forall a. Eq a => a -> a -> Bool
== a -> a -> Maybe a
forall m. RightReductive m => m -> m -> Maybe m
stripSuffix a
s a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"stripCommonSuffix a b & λ(_, x, s) -> x /= mempty && s /= mempty"
        (a -> a -> (a, a, a)
forall m. RightGCDMonoid m => m -> m -> (m, m, m)
stripCommonSuffix a
a a
b (a, a, a) -> ((a, a, a) -> Bool) -> Bool
forall a b. a -> (a -> b) -> b
& \(a
_, a
x, a
s) -> a
x a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty Bool -> Bool -> Bool
&& a
s a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> (a, a, a) -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"stripCommonSuffix a b"
        (a -> a -> (a, a, a)
forall m. RightGCDMonoid m => m -> m -> (m, m, m)
stripCommonSuffix a
a a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Maybe a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"stripCommonSuffix a b & λ(_, _, s) -> stripSuffix s b"
        (a -> a -> (a, a, a)
forall m. RightGCDMonoid m => m -> m -> (m, m, m)
stripCommonSuffix a
a a
b (a, a, a) -> ((a, a, a) -> Maybe a) -> Maybe a
forall a b. a -> (a -> b) -> b
& \(a
_, a
_, a
s) -> a -> a -> Maybe a
forall m. RightReductive m => m -> m -> Maybe m
stripSuffix a
s a
b)

--------------------------------------------------------------------------------
-- DistributiveGCDMonoid
--------------------------------------------------------------------------------

-- | 'Laws' for instances of 'DistributiveGCDMonoid'.
--
-- Includes the following laws:
--
-- __/Left-distributivity/__
--
-- @
-- 'gcd' (a '<>' b) (a '<>' c) '==' a '<>' 'gcd' b c
-- @
--
-- __/Right-distributivity/__
--
-- @
-- 'gcd' (a '<>' c) (b '<>' c) '==' 'gcd' a b '<>' c
-- @
--
-- Note that the following superclass laws are __not__ included:
--
-- * 'gcdMonoidLaws'
-- * 'leftDistributiveGCDMonoidLaws'
-- * 'rightDistributiveGCDMonoidLaws'
--
distributiveGCDMonoidLaws
    :: forall a. (Arbitrary a, Show a, Eq a, DistributiveGCDMonoid a)
    => Proxy a
    -> Laws
distributiveGCDMonoidLaws :: forall a.
(Arbitrary a, Show a, Eq a, DistributiveGCDMonoid a) =>
Proxy a -> Laws
distributiveGCDMonoidLaws Proxy a
_ = String -> [(String, Property)] -> Laws
Laws String
"DistributiveGCDMonoid"
    [ forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> a -> a -> t) -> (String, Property)
makeLaw3 @a
        String
"distributiveGCDMonoidLaw_distributivity_left"
        (a -> a -> a -> Property
forall a.
(Eq a, Show a, DistributiveGCDMonoid a) =>
a -> a -> a -> Property
distributiveGCDMonoidLaw_distributivity_left)
    , forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> a -> a -> t) -> (String, Property)
makeLaw3 @a
        String
"distributiveGCDMonoidLaw_distributivity_right"
        (a -> a -> a -> Property
forall a.
(Eq a, Show a, DistributiveGCDMonoid a) =>
a -> a -> a -> Property
distributiveGCDMonoidLaw_distributivity_right)
    ]

distributiveGCDMonoidLaw_distributivity_left
    :: (Eq a, Show a, DistributiveGCDMonoid a) => a -> a -> a -> Property
distributiveGCDMonoidLaw_distributivity_left :: forall a.
(Eq a, Show a, DistributiveGCDMonoid a) =>
a -> a -> a -> Property
distributiveGCDMonoidLaw_distributivity_left a
a a
b a
c =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"gcd (a <> b) (a <> c) == a <> gcd b c"
        (a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd (a
a a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
b) (a
a a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
c) a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a
a a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
b a
c)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"a <> b"
        (a
a a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"a <> c"
        (a
a a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
c)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"gcd (a <> b) (a <> c)"
        (a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd (a
a a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
b) (a
a a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
c))
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"gcd b c"
        (a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
b a
c)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"a <> gcd b c"
        (a
a a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
b a
c)

distributiveGCDMonoidLaw_distributivity_right
    :: (Eq a, Show a, DistributiveGCDMonoid a) => a -> a -> a -> Property
distributiveGCDMonoidLaw_distributivity_right :: forall a.
(Eq a, Show a, DistributiveGCDMonoid a) =>
a -> a -> a -> Property
distributiveGCDMonoidLaw_distributivity_right a
a a
b a
c =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"gcd (a <> c) (b <> c) == gcd a b <> c"
        (a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd (a
a a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
c) (a
b a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
c) a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
a a
b a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
c)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"a <> c"
        (a
a a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
c)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"b <> c"
        (a
b a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
c)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"gcd (a <> c) (b <> c)"
        (a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd (a
a a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
c) (a
b a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
c))
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"gcd a b"
        (a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
a a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"gcd a b <> c"
        (a -> a -> a
forall m. GCDMonoid m => m -> m -> m
gcd a
a a
b a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
c)

--------------------------------------------------------------------------------
-- LeftDistributiveGCDMonoid
--------------------------------------------------------------------------------

-- | 'Laws' for instances of 'LeftDistributiveGCDMonoid'.
--
-- Includes the following law:
--
-- __/Left-distributivity/__
--
-- @
-- 'commonPrefix' (a '<>' b) (a '<>' c) '==' a '<>' 'commonPrefix' b c
-- @
--
-- Note that the following superclass laws are __not__ included:
--
-- * 'leftGCDMonoidLaws'
--
leftDistributiveGCDMonoidLaws
    :: forall a. (Arbitrary a, Show a, Eq a, LeftDistributiveGCDMonoid a)
    => Proxy a
    -> Laws
leftDistributiveGCDMonoidLaws :: forall a.
(Arbitrary a, Show a, Eq a, LeftDistributiveGCDMonoid a) =>
Proxy a -> Laws
leftDistributiveGCDMonoidLaws Proxy a
_ = String -> [(String, Property)] -> Laws
Laws String
"LeftDistributiveGCDMonoid"
    [ forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> a -> a -> t) -> (String, Property)
makeLaw3 @a
        String
"leftDistributiveGCDMonoidLaw_distributivity"
        (a -> a -> a -> Property
forall a.
(Eq a, Show a, LeftDistributiveGCDMonoid a) =>
a -> a -> a -> Property
leftDistributiveGCDMonoidLaw_distributivity)
    ]

leftDistributiveGCDMonoidLaw_distributivity
    :: (Eq a, Show a, LeftDistributiveGCDMonoid a) => a -> a -> a -> Property
leftDistributiveGCDMonoidLaw_distributivity :: forall a.
(Eq a, Show a, LeftDistributiveGCDMonoid a) =>
a -> a -> a -> Property
leftDistributiveGCDMonoidLaw_distributivity a
a a
b a
c =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"commonPrefix (a <> b) (a <> c) == a <> commonPrefix b c"
        (a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix (a
a a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
b) (a
a a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
c) a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a
a a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix a
b a
c)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"commonPrefix b c /= mempty && a /= mempty"
        (a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix a
b a
c a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty Bool -> Bool -> Bool
&& a
a a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"a <> b"
        (a
a a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"a <> c"
        (a
a a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
c)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"commonPrefix (a <> b) (a <> c)"
        (a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix (a
a a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
b) (a
a a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
c))
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"commonPrefix b c"
        (a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix a
b a
c)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"a <> commonPrefix b c"
        (a
a a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a -> a -> a
forall m. LeftGCDMonoid m => m -> m -> m
commonPrefix a
b a
c)

--------------------------------------------------------------------------------
-- RightDistributiveGCDMonoid
--------------------------------------------------------------------------------

-- | 'Laws' for instances of 'RightDistributiveGCDMonoid'.
--
-- Includes the following law:
--
-- __/Right-distributivity/__
--
-- @
-- 'commonSuffix' (a '<>' c) (b '<>' c) '==' 'commonSuffix' a b '<>' c
-- @
--
-- Note that the following superclass laws are __not__ included:
--
-- * 'rightGCDMonoidLaws'
--
rightDistributiveGCDMonoidLaws
    :: forall a. (Arbitrary a, Show a, Eq a, RightDistributiveGCDMonoid a)
    => Proxy a
    -> Laws
rightDistributiveGCDMonoidLaws :: forall a.
(Arbitrary a, Show a, Eq a, RightDistributiveGCDMonoid a) =>
Proxy a -> Laws
rightDistributiveGCDMonoidLaws Proxy a
_ = String -> [(String, Property)] -> Laws
Laws String
"RightDistributiveGCDMonoid"
    [ forall a t.
(Arbitrary a, Show a, Eq a, Semigroup a, Testable t) =>
String -> (a -> a -> a -> t) -> (String, Property)
makeLaw3 @a
        String
"rightDistributiveGCDMonoidLaw_distributivity"
        (a -> a -> a -> Property
forall a.
(Eq a, Show a, RightDistributiveGCDMonoid a) =>
a -> a -> a -> Property
rightDistributiveGCDMonoidLaw_distributivity)
    ]

rightDistributiveGCDMonoidLaw_distributivity
    :: (Eq a, Show a, RightDistributiveGCDMonoid a) => a -> a -> a -> Property
rightDistributiveGCDMonoidLaw_distributivity :: forall a.
(Eq a, Show a, RightDistributiveGCDMonoid a) =>
a -> a -> a -> Property
rightDistributiveGCDMonoidLaw_distributivity a
a a
b a
c =
    String -> Bool -> Property
forall t. Testable t => String -> t -> Property
makeProperty
        String
"commonSuffix (a <> c) (b <> c) == commonSuffix a b <> c"
        (a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix (a
a a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
c) (a
b a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
c) a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix a
a a
b a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
c)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> Bool -> Property -> Property
forall t. Testable t => String -> Bool -> t -> Property
cover
        String
"commonSuffix a b /= mempty && c /= mempty"
        (a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix a
a a
b a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty Bool -> Bool -> Bool
&& a
c a -> a -> Bool
forall a. Eq a => a -> a -> Bool
/= a
forall a. Monoid a => a
mempty)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"a <> c"
        (a
a a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
c)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"b <> c"
        (a
b a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
c)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"commonSuffix (a <> c) (b <> c)"
        (a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix (a
a a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
c) (a
b a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
c))
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"commonSuffix a b"
        (a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix a
a a
b)
    Property -> (Property -> Property) -> Property
forall a b. a -> (a -> b) -> b
& String -> a -> Property -> Property
forall a prop.
(Show a, Testable prop) =>
String -> a -> prop -> Property
report
        String
"commonSuffix a b <> c"
        (a -> a -> a
forall m. RightGCDMonoid m => m -> m -> m
commonSuffix a
a a
b a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
c)