| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Proarrow.Testing.Laws
Description
Reusable law-checking properties, parameterized over any Testable kind: testCategory,
testMonoidal, testBinaryProducts, testClosed, and friends. Wiring a new category into a
test suite is a Testable instance plus calls to these; the test/Props directory of
proarrow's source repository has many examples.
A test returns a TestTree, ready for a testGroup. A prop returns a
, to be composed into a property of your own. Where both exist (e.g. Property ()testMonoid
and propMonoid), the test one wraps the prop one.
Many of these take an explicit witness that TestOb is closed under the structure being tested
(e.g. that follows from TestOb (a ** b) and TestOb a). The TestOb b_-suffixed
variant (e.g. testMonoidal_) supplies it from a TestObIsOb constraint, for categories where
every object is a TestOb, typically those that leave TestOb at its default.Ob
Synopsis
- propIso :: forall {k} (a :: k) (b :: k). (Testable k, TestOb a, TestOb b) => (a ~> b) -> (b ~> a) -> Property ()
- propIso' :: forall {k} (c :: (k -> k -> Type) -> Constraint) (a :: k) (b :: k). (Testable k, TestOb a, TestOb b, Ob b => c (ExOptic (GetterFl :: (k +-> k) -> (k +-> k) -> Constraint) b b), Ob b => c (ExOptic (Flip (GetterFl :: (k +-> k) -> (k +-> k) -> Constraint)) b b)) => Optic c a a b b -> Property ()
- propIsoP :: forall {j1} {k1} {j2} {k2} p q (a :: k1) (b :: j1) (c :: k2) (d :: j2). (TestableTypeP p, TestableTypeP q, TestOb a, TestOb b, TestOb c, TestOb d) => (p a b -> q c d) -> (q c d -> p a b) -> Property ()
- propNaturalIsoP :: forall {j} {k} (p :: j +-> k) (q :: j +-> k). (TestableProfunctor p, TestableTypeP p, TestableProfunctor q, TestableTypeP q) => (p :~> q) -> (q :~> p) -> Property ()
- testCategory :: Testable k => TestTree
- testDagger :: (Testable k, Dagger k) => TestTree
- testDaggerProfunctor :: forall {k} (p :: k +-> k). (DaggerProfunctor p, TestableProfunctor p) => TestTree
- testCategoryProLaws :: forall {j} {k} (cl :: (TESTED '[CategoryOf] j +-> TESTED '[CategoryOf] k) -> Constraint) (p :: j +-> k). (ProLaws cl, TestableProfunctor p, cl (TestedP p :: TESTED '[CategoryOf] k -> TESTED '[CategoryOf] j -> Type)) => TestOptions -> String -> TestTree
- defaultTestOptions :: TestOptions
- testProfunctor :: forall {j} {k} (p :: j +-> k). TestableProfunctor p => TestTree
- testProfunctorWith :: forall {j} {k} (p :: j +-> k). TestableProfunctor p => TestOptions -> TestTree
- propDecidable :: forall {j} {k} (p :: j +-> k). (DecidableProfunctor p, Testable j, Testable k, TestableTypeP p) => Property ()
- propNaturalTransformation :: forall {j} {k} (p :: j +-> k) (q :: j +-> k). (TestableProfunctor p, TestableProfunctor q) => (p :~> q) -> Property ()
- testFinitary :: forall {j} {k} (p :: j +-> k). (Finitary p, TestableProfunctor p, TestableTypeP p) => String -> TestTree
- propNumbering :: forall {j} {k} (p :: j +-> k). (Finitary p, TestableProfunctor p, TestableTypeP p) => Property ()
- propFunctor :: forall {k1} {k2} (f :: k1 -> k2). (Functor f, Testable k1, Testable k2) => (forall (a :: k1) r. TestOb a => (TestOb (f a) => r) -> r) -> Property ()
- testFunctor :: forall {k1} {k2} (f :: k1 -> k2). (Functor f, Testable k1, Testable k2) => (forall (a :: k1) r. TestOb a => (TestOb (f a) => r) -> r) -> TestTree
- testFunctor_ :: forall {k1} {k2} (f :: k1 -> k2). (Functor f, Testable k1, Testable k2, forall (a :: k1). TestOb a => TestOb' (f a)) => TestTree
- testMonoidalProfunctor :: forall {j} {k} (p :: j +-> k). (MonoidalProfunctor p, TestableProfunctor p, TestOb (Unit :: j), TestOb (Unit :: k)) => WithTestOb2 j -> WithTestOb2 k -> TestTree
- testMonStrong :: forall {k} (p :: k +-> k). (Strong (Tensor :: k -> (k, k) -> Type) p, Monoidal k, TestableProfunctor p, TestOb (Unit :: k)) => WithTestOb2 k -> TestTree
- testMonStrong_ :: forall {k} (p :: k +-> k). (Strong (Tensor :: k -> (k, k) -> Type) p, Monoidal k, TestableProfunctor p, TestObIsOb k) => TestTree
- testMonCostrong :: forall {k} (p :: k +-> k). (Costrong (Tensor :: k -> (k, k) -> Type) p, Monoidal k, TestableProfunctor p, TestOb (Unit :: k)) => WithTestOb2 k -> TestTree
- testMonCostrong_ :: forall {k} (p :: k +-> k). (Costrong (Tensor :: k -> (k, k) -> Type) p, Monoidal k, TestableProfunctor p, TestObIsOb k) => TestTree
- testRepresentable :: forall {j} {k} (p :: j +-> k). (Representable p, TestableProfunctor p) => WithTestObRep j p -> TestTree
- testRepresentable_ :: forall {j} {k} (p :: j +-> k). (Representable p, TestableProfunctor p, TestObIsOb k) => TestTree
- testCorepresentable :: forall {j} {k} (p :: j +-> k). (Corepresentable p, TestableProfunctor p) => WithTestObCorep k p -> TestTree
- testCorepresentable_ :: forall {j} {k} (p :: j +-> k). (Corepresentable p, TestableProfunctor p, TestObIsOb j) => TestTree
- testPromonad :: forall {k} (p :: k +-> k). (Promonad p, TestableProfunctor p) => TestTree
- testProcomonad :: forall {k} (p :: k +-> k). (Procomonad p, TestableProfunctor p, TestObIsOb k) => TestTree
- testProadjunction :: forall {j} {k} (p :: j +-> k) (q :: k +-> j). (Proadjunction p q, TestableProfunctor p, TestableProfunctor q, TestObIsOb j, TestObIsOb k) => TestTree
- testAdjunction :: forall {j} {k} (p :: j +-> k). (Adjunction p, TestableProfunctor p) => WithTestObCorep k p -> WithTestObRep j p -> TestTree
- testAdjunction_ :: forall {j} {k} (p :: j +-> k). (Adjunction p, TestableProfunctor p, TestObIsOb j, TestObIsOb k) => TestTree
- testTerminalObject :: (Testable k, HasTerminalObject k, TestOb (TerminalObject :: k)) => TestTree
- testInitialObject :: (Testable k, HasInitialObject k, TestOb (InitialObject :: k)) => TestTree
- testBinaryProducts :: (Testable k, HasBinaryProducts k) => WithTestObProd k -> TestTree
- testBinaryProducts_ :: (Testable k, HasBinaryProducts k, TestObIsOb k) => TestTree
- testBinaryCoproducts :: (Testable k, HasBinaryCoproducts k) => WithTestObCoprod k -> TestTree
- testBinaryCoproducts_ :: (Testable k, HasBinaryCoproducts k, TestObIsOb k) => TestTree
- propReflectsEq :: TestingEqShow x => String -> String -> Bool -> x -> x -> Property ()
- testEqualizers :: (Testable k, HasEqualizers k) => WithTestOb k -> TestTree
- testEqualizers_ :: (Testable k, HasEqualizers k, TestObIsOb k) => TestTree
- testCoequalizers :: (Testable k, HasCoequalizers k) => WithTestOb k -> TestTree
- testCoequalizers_ :: (Testable k, HasCoequalizers k, TestObIsOb k) => TestTree
- testPullbacks :: (Testable k, HasPullbacks k) => WithTestOb k -> TestTree
- testPullbacks_ :: (Testable k, HasPullbacks k, TestObIsOb k) => TestTree
- testPushouts :: (Testable k, HasPushouts k) => WithTestOb k -> TestTree
- testPushouts_ :: (Testable k, HasPushouts k, TestObIsOb k) => TestTree
- testEpiMonoFactorization :: (Testable k, HasEpiMonoFactorization k) => WithTestOb k -> TestTree
- testEpiMonoFactorization_ :: (Testable k, HasEpiMonoFactorization k, TestObIsOb k) => TestTree
- testMonoidal :: (Testable k, Monoidal k, TestOb (Unit :: k)) => WithTestOb2 k -> TestTree
- testMonoidal_ :: (Testable k, Monoidal k, TestObIsOb k) => TestTree
- testSymMonoidal :: (Testable k, SymMonoidal k, TestOb (Unit :: k)) => WithTestOb2 k -> TestTree
- testSymMonoidal_ :: (Testable k, SymMonoidal k, TestObIsOb k) => TestTree
- testCopyDiscard :: (Testable k, CopyDiscard k, TestOb (Unit :: k)) => WithTestOb2 k -> TestTree
- testCopyDiscard_ :: (Testable k, CopyDiscard k, TestObIsOb k) => TestTree
- testCartesian :: (Testable k, Cartesian k, TestOb (Unit :: k)) => (forall (a :: k) r. TestOb a => (Ob a => r) -> r) -> WithTestOb2 k -> TestTree
- propCartesianAt :: forall {k} (a :: k). (Testable k, Cartesian k, TensorIsProduct a a, TestOb (Unit :: k), TestOb a, Ob a, TestOb (a ** a)) => Property ()
- testCartesian_ :: (Testable k, Cartesian k, TestObIsOb k, TestOb (Unit :: k)) => TestTree
- testDistributive :: (Testable k, Distributive k, TestOb (Unit :: k), TestOb (InitialObject :: k)) => WithTestOb2 k -> WithTestObCoprod k -> TestTree
- testDistributive_ :: (Testable k, Distributive k, TestObIsOb k) => TestTree
- testClosed :: (Testable k, Closed k, TestOb (Unit :: k)) => WithTestOb2 k -> WithTestObExp k -> TestTree
- testClosed_ :: (Testable k, Closed k, TestObIsOb k) => TestTree
- testDialogue :: (Testable k, Dialogue k, TestOb (Unit :: k)) => WithTestOb2 k -> WithTestObDual k -> TestTree
- testDialogue_ :: (Testable k, Dialogue k, TestObIsOb k) => TestTree
- testStarAutonomous :: (Testable k, StarAutonomous k, TestOb (Unit :: k)) => WithTestOb2 k -> WithTestObExp k -> WithTestObDual k -> TestTree
- testStarAutonomous_ :: (Testable k, StarAutonomous k, TestObIsOb k) => TestTree
- testIsoMix :: (Testable k, IsoMix k, TestOb (Unit :: k)) => WithTestOb2 k -> WithTestObDual k -> TestTree
- testIsoMix_ :: (Testable k, IsoMix k, TestObIsOb k) => TestTree
- testCompactClosed :: (Testable k, CompactClosed k, TestOb (Unit :: k)) => WithTestOb2 k -> WithTestObExp k -> WithTestObDual k -> TestTree
- testCompactClosed_ :: (Testable k, CompactClosed k, TestObIsOb k) => TestTree
- testHypergraph :: (Testable k, SymMonoidal k, Supplies CommutativeMonoid k, Supplies CocommutativeComonoid k, TestOb (Unit :: k)) => WithTestOb2 k -> TestTree
- testHypergraph_ :: (Testable k, SymMonoidal k, TestObIsOb k, Supplies CommutativeMonoid k, Supplies CocommutativeComonoid k) => TestTree
- testTraced :: (Testable k, TracedMonoidal k, TestOb (Unit :: k)) => WithTestOb2 k -> TestTree
- testTraced_ :: (Testable k, TracedMonoidal k, TestObIsOb k) => TestTree
- propMonoid :: forall {k} (m :: k). (Testable k, Monoid m, TestOb m, TestOb (Unit :: k)) => WithTestOb2 k -> Property ()
- propCommutativeMonoid :: forall {k} (m :: k). (Testable k, CommutativeMonoid m, TestOb m, TestOb (Unit :: k)) => WithTestOb2 k -> Property ()
- propCocommutativeComonoid :: forall {k} (m :: k). (Testable k, CocommutativeComonoid m, TestOb m, TestOb (Unit :: k)) => WithTestOb2 k -> Property ()
- propFrobenius :: forall {k} (m :: k). (Testable k, SymMonoidal k, CommutativeMonoid m, CocommutativeComonoid m, TestOb m, TestOb (Unit :: k)) => WithTestOb2 k -> Property ()
- testMonoid :: forall {k} (m :: k). (Testable k, Monoid m, TestOb m, TestOb (Unit :: k)) => WithTestOb2 k -> TestTree
- testMonoid_ :: forall {k} (m :: k). (Testable k, Monoid m, TestObIsOb k) => TestTree
- testComonoid :: forall {k} (m :: k). (Testable k, Comonoid m, TestOb m, TestOb (Unit :: k)) => WithTestOb2 k -> TestTree
- testComonoid_ :: forall {k} (m :: k). (Testable k, Comonoid m, TestObIsOb k) => TestTree
- testCommutativeMonoid :: forall {k} (m :: k). (Testable k, CommutativeMonoid m, TestOb m, TestOb (Unit :: k)) => WithTestOb2 k -> TestTree
- testCommutativeMonoid_ :: forall {k} (m :: k). (Testable k, CommutativeMonoid m, TestObIsOb k) => TestTree
- testCocommutativeComonoid :: forall {k} (m :: k). (Testable k, CocommutativeComonoid m, TestOb m, TestOb (Unit :: k)) => WithTestOb2 k -> TestTree
- testCocommutativeComonoid_ :: forall {k} (m :: k). (Testable k, CocommutativeComonoid m, TestObIsOb k) => TestTree
- testFrobenius :: forall {k} (m :: k). (Testable k, CommutativeMonoid m, CocommutativeComonoid m, TestOb m, TestOb (Unit :: k)) => WithTestOb2 k -> TestTree
- testFrobenius_ :: forall {k} (m :: k). (Testable k, CommutativeMonoid m, CocommutativeComonoid m, TestObIsOb k) => TestTree
- testSubobjectClassifier :: (Testable k, HasSubobjectClassifier k, HasEpiMonoFactorization k, HasPushouts k, HasPullbacks k, TestOb (Omega :: k)) => WithTestObProd k -> TestTree
- testSubobjectClassifier_ :: (Testable k, HasSubobjectClassifier k, HasEpiMonoFactorization k, HasPushouts k, HasPullbacks k, TestObIsOb k, TestOb (Omega :: k)) => TestTree
- testNegation :: (Testable k, ElementaryTopos k, TestOb (Omega :: k)) => TestTree
- testLawvereTierney :: (Testable k, ElementaryTopos k, TestOb (Omega :: k), TestOb (TerminalObject :: k)) => WithTestObProd k -> ((Omega :: k) ~> (Omega :: k)) -> TestTree
- lawvereTierneyLaws :: (Testable k, ElementaryTopos k, TestOb (Omega :: k), TestOb (TerminalObject :: k)) => WithTestObProd k -> [(String, ((Omega :: k) ~> (Omega :: k)) -> Property ())]
- testLawvereTierneyFamily :: (Testable k, ElementaryTopos k, TestOb (Omega :: k), TestOb (TerminalObject :: k)) => String -> WithTestObProd k -> (((TerminalObject :: k) ~> (Omega :: k)) -> (Omega :: k) ~> (Omega :: k)) -> TestTree
- testLawvereTierney_ :: (Testable k, ElementaryTopos k, TestObIsOb k, TestOb (Omega :: k), TestOb (TerminalObject :: k)) => ((Omega :: k) ~> (Omega :: k)) -> TestTree
- testLawvereTierneyFamily_ :: (Testable k, ElementaryTopos k, TestObIsOb k, TestOb (Omega :: k), TestOb (TerminalObject :: k)) => String -> (((TerminalObject :: k) ~> (Omega :: k)) -> (Omega :: k) ~> (Omega :: k)) -> TestTree
- testSiteLaws :: forall t j k. (StableSite t k, HasFiniteCovers t k, FiniteCat j, FiniteCat k) => TestTree
- testStableSite :: (StableSite t k, HasFiniteCovers t k, FiniteCat k) => TestTree
- propFactorsThroughLeg :: forall t {k} (a :: k) c (x :: k). (Site t k, FiniteCat k, Ob a) => (x ~> a) -> Factors t k a c x -> Property ()
- testGeneratedSieveIsSieve :: forall t j k. (HasFiniteCovers t k, FiniteCat j, FiniteCat k) => TestTree
- testAtomicIsDoubleNegation :: (HasPullbacks k, FiniteCat k, Testable (PROD (FINITARY () k)), TestOb (Omega :: PROD (FINITARY () k))) => TestTree
- testRanFullyFaithful :: forall {j} {k} (p :: j +-> k). (Finitary p, FiniteCat j, FiniteCat k) => TestTree
- testRiftFullyFaithful :: forall {j} {k} (p :: j +-> k). (Finitary p, FiniteCat j, FiniteCat k) => TestTree
- testCoveredByImage :: forall t {j} {k} (w :: j +-> k). (HasFiniteCovers t j, Corepresentable w, Finitary w, FiniteCat j, FiniteCat k) => TestTree
- testDenseIsCovering :: forall t j k. (HasFiniteCovers t k, FiniteCat j, FiniteCat k) => TestTree
- propGluesBack :: forall {j} {k} t p (a :: k) (b :: j) c. (Sheaf t p, Ob a, Ob b, TestingEqShow (p a b)) => Cover t k a c -> p a b -> Property ()
- testGluesBack :: forall {j} {k} t (p :: j +-> k). (HasFiniteCovers t k, Sheaf t p, TestableProfunctor p, TestableTypeP p, TestObIsOb k) => TestTree
- testGluesBackAt :: forall {j} {k} t (p :: j +-> k) (a :: k) c. (Sheaf t p, TestableProfunctor p, TestableTypeP p, TestOb a) => String -> Cover t k a c -> TestTree
- testEqualizersAreSheaves :: (Testable (SHEAVES t j k), HasFiniteCovers t k, FiniteCat j, FiniteCat k) => TestTree
- testSheafification :: forall t {j} {k} (p :: j +-> k) (q :: j +-> k). (HasFiniteCovers t k, Sheaf t q, Finitary p, Finitary q, FiniteCat j, FiniteCat k, Testable j, Testable k, TestableProfunctor p) => TestTree
- testPlusFixes :: forall t {j} {k} (q :: j +-> k). (HasFiniteCovers t k, Finitary q, FiniteCat j, FiniteCat k) => TestTree
Isomorphisms
propIso :: forall {k} (a :: k) (b :: k). (Testable k, TestOb a, TestOb b) => (a ~> b) -> (b ~> a) -> Property () Source Github #
Two arrows are mutually inverse: f . g = id and g . f = id.
propIso' :: forall {k} (c :: (k -> k -> Type) -> Constraint) (a :: k) (b :: k). (Testable k, TestOb a, TestOb b, Ob b => c (ExOptic (GetterFl :: (k +-> k) -> (k +-> k) -> Constraint) b b), Ob b => c (ExOptic (Flip (GetterFl :: (k +-> k) -> (k +-> k) -> Constraint)) b b)) => Optic c a a b b -> Property () Source Github #
propIsoP :: forall {j1} {k1} {j2} {k2} p q (a :: k1) (b :: j1) (c :: k2) (d :: j2). (TestableTypeP p, TestableTypeP q, TestOb a, TestOb b, TestOb c, TestOb d) => (p a b -> q c d) -> (q c d -> p a b) -> Property () Source Github #
Two functions between the elements of p a b and of q c d are mutually inverse, at
generated elements.
propNaturalIsoP :: forall {j} {k} (p :: j +-> k) (q :: j +-> k). (TestableProfunctor p, TestableTypeP p, TestableProfunctor q, TestableTypeP q) => (p :~> q) -> (q :~> p) -> Property () Source Github #
Two natural transformations are mutually inverse: propIsoP at generated objects, and each is
natural (propNaturalTransformation).
Categories
testCategory :: Testable k => TestTree Source Github #
The category laws: id is a left and right identity for (.), and (.) is associative.
testDagger :: (Testable k, Dagger k) => TestTree Source Github #
The laws of a dagger category: ProLaws DaggerProfunctor at the hom profunctor,
so dagger is an involution and reverses composition.
testDaggerProfunctor :: forall {k} (p :: k +-> k). (DaggerProfunctor p, TestableProfunctor p) => TestTree Source Github #
The DaggerProfunctor laws of p stated as code: dagger is an involution that
reverses dimap.
Profunctors
testCategoryProLaws :: forall {j} {k} (cl :: (TESTED '[CategoryOf] j +-> TESTED '[CategoryOf] k) -> Constraint) (p :: j +-> k). (ProLaws cl, TestableProfunctor p, cl (TestedP p :: TESTED '[CategoryOf] k -> TESTED '[CategoryOf] j -> Type)) => TestOptions -> String -> TestTree Source Github #
testProLaws for a profunctor class whose laws need only the categories of p, with the given
options.
defaultTestOptions :: TestOptions Source Github #
The falsify options of a plain testProperty, to adjust for one test, e.g. a larger
overrideMaxRatio where a law's arrows rarely exist.
testProfunctor :: forall {j} {k} (p :: j +-> k). TestableProfunctor p => TestTree Source Github #
The profunctor laws of p stated as code (ProLaws Profunctor).
testProfunctorWith :: forall {j} {k} (p :: j +-> k). TestableProfunctor p => TestOptions -> TestTree Source Github #
testProfunctor with the given falsify options for each law.
propDecidable :: forall {j} {k} (p :: j +-> k). (DecidableProfunctor p, Testable j, Testable k, TestableTypeP p) => Property () Source Github #
propNaturalTransformation :: forall {j} {k} (p :: j +-> k) (q :: j +-> k). (TestableProfunctor p, TestableProfunctor q) => (p :~> q) -> Property () Source Github #
testFinitary :: forall {j} {k} (p :: j +-> k). (Finitary p, TestableProfunctor p, TestableTypeP p) => String -> TestTree Source Github #
The numbering laws of a Finitary profunctor: elements has
size entries and is numbered in order, and fromIndex recovers any element
from its index (ProLaws Finitary), including elements the instance did not
itself produce. That law, fromIndex . toIndex, checks that size is correct and not
merely self-consistent, but only as far as the TestableType generator is independent of the
instance. One defined as
optGen makes it vacuous. The label names the profunctor, which nothing in
its type can supply.elements
propNumbering :: forall {j} {k} (p :: j +-> k). (Finitary p, TestableProfunctor p, TestableTypeP p) => Property () Source Github #
Functors, representability and adjunctions
propFunctor :: forall {k1} {k2} (f :: k1 -> k2). (Functor f, Testable k1, Testable k2) => (forall (a :: k1) r. TestOb a => (TestOb (f a) => r) -> r) -> Property () Source Github #
Check the functor laws of a Functor f: map id = id and map (g . f) = map g . map
f. The witness lifts TestOb along f (usually \ @a r -> r when follows
from TestOb (f a)). Functors encoded as representable profunctors (TestOb aFunctorForRep) are
instead tested via their with ReptestProfunctor, since
the profunctor laws on Rep f are the functor laws on f.
testFunctor :: forall {k1} {k2} (f :: k1 -> k2). (Functor f, Testable k1, Testable k2) => (forall (a :: k1) r. TestOb a => (TestOb (f a) => r) -> r) -> TestTree Source Github #
The functor laws of f (propFunctor) as a ready-made test.
testFunctor_ :: forall {k1} {k2} (f :: k1 -> k2). (Functor f, Testable k1, Testable k2, forall (a :: k1). TestOb a => TestOb' (f a)) => TestTree Source Github #
testMonoidalProfunctor :: forall {j} {k} (p :: j +-> k). (MonoidalProfunctor p, TestableProfunctor p, TestOb (Unit :: j), TestOb (Unit :: k)) => WithTestOb2 j -> WithTestOb2 k -> TestTree Source Github #
The MonoidalProfunctor laws of p stated as code (ProLaws MonoidalProfunctor).
The witnesses say how TestOb is closed under the tensor of j and of k.
testMonStrong :: forall {k} (p :: k +-> k). (Strong (Tensor :: k -> (k, k) -> Type) p, Monoidal k, TestableProfunctor p, TestOb (Unit :: k)) => WithTestOb2 k -> TestTree Source Github #
testMonStrong_ :: forall {k} (p :: k +-> k). (Strong (Tensor :: k -> (k, k) -> Type) p, Monoidal k, TestableProfunctor p, TestObIsOb k) => TestTree Source Github #
testMonCostrong :: forall {k} (p :: k +-> k). (Costrong (Tensor :: k -> (k, k) -> Type) p, Monoidal k, TestableProfunctor p, TestOb (Unit :: k)) => WithTestOb2 k -> TestTree Source Github #
testMonCostrong_ :: forall {k} (p :: k +-> k). (Costrong (Tensor :: k -> (k, k) -> Type) p, Monoidal k, TestableProfunctor p, TestObIsOb k) => TestTree Source Github #
testRepresentable :: forall {j} {k} (p :: j +-> k). (Representable p, TestableProfunctor p) => WithTestObRep j p -> TestTree Source Github #
The Representable laws of p stated as code (ProLaws Representable): index and
tabulate are inverse and natural. The witness lifts TestOb along p .% -
testRepresentable_ :: forall {j} {k} (p :: j +-> k). (Representable p, TestableProfunctor p, TestObIsOb k) => TestTree Source Github #
testCorepresentable :: forall {j} {k} (p :: j +-> k). (Corepresentable p, TestableProfunctor p) => WithTestObCorep k p -> TestTree Source Github #
The Corepresentable laws of p stated as code (ProLaws Corepresentable): coindex
and cotabulate are inverse and natural. The witness lifts TestOb along p .%% -
testCorepresentable_ :: forall {j} {k} (p :: j +-> k). (Corepresentable p, TestableProfunctor p, TestObIsOb j) => TestTree Source Github #
testPromonad :: forall {k} (p :: k +-> k). (Promonad p, TestableProfunctor p) => TestTree Source Github #
testProcomonad :: forall {k} (p :: k +-> k). (Procomonad p, TestableProfunctor p, TestObIsOb k) => TestTree Source Github #
The Procomonad laws of p stated as code: proextract is natural and a
counit for produplicate. The middle object of produplicate is only known to
be an object, hence TestObIsOb.
testProadjunction :: forall {j} {k} (p :: j +-> k) (q :: k +-> j). (Proadjunction p q, TestableProfunctor p, TestableProfunctor q, TestObIsOb j, TestObIsOb k) => TestTree Source Github #
The zigzag laws of the adjunction between p and q stated as code, for elements of each:
ProLaws ( and LeftProadjoint q)(. The middle object of
the unit is only known to be an object, hence Proadjunction p)TestObIsOb.
testAdjunction :: forall {j} {k} (p :: j +-> k). (Adjunction p, TestableProfunctor p) => WithTestObCorep k p -> WithTestObRep j p -> TestTree Source Github #
Check the adjunction laws of an Adjunction p. An adjunction here is a profunctor that is
both Representable and Corepresentable, with left adjoint L = p and right adjoint
%% -R = p . It carries no laws of its own beyond theirs (% -leftAdjunct/rightAdjunct are just
and index . cotabulate), so this groups coindex . tabulatetestCorepresentable
(for L) and testRepresentable (for R). The two witnesses lift TestOb along L and R
respectively.
testAdjunction_ :: forall {j} {k} (p :: j +-> k). (Adjunction p, TestableProfunctor p, TestObIsOb j, TestObIsOb k) => TestTree Source Github #
Limits and colimits
testTerminalObject :: (Testable k, HasTerminalObject k, TestOb (TerminalObject :: k)) => TestTree Source Github #
Every arrow into the TerminalObject is terminate, from
.Laws '[HasTerminalObject]
testInitialObject :: (Testable k, HasInitialObject k, TestOb (InitialObject :: k)) => TestTree Source Github #
Every arrow out of the InitialObject is initiate, from
.Laws '[HasInitialObject]
testBinaryProducts :: (Testable k, HasBinaryProducts k) => WithTestObProd k -> TestTree Source Github #
The universal property of the binary product, from
: the projections recover the
components of Laws '[HasBinaryProducts]f , pairing commutes with precomposition, and pairing the projections is
the identity.&&& g
testBinaryProducts_ :: (Testable k, HasBinaryProducts k, TestObIsOb k) => TestTree Source Github #
testBinaryCoproducts :: (Testable k, HasBinaryCoproducts k) => WithTestObCoprod k -> TestTree Source Github #
The universal property of the binary coproduct, dual to testBinaryProducts, from
.Laws '[HasBinaryCoproducts]
testBinaryCoproducts_ :: (Testable k, HasBinaryCoproducts k, TestObIsOb k) => TestTree Source Github #
propReflectsEq :: TestingEqShow x => String -> String -> Bool -> x -> x -> Property () Source Github #
Check that composing with an arrow reflects equality: the composites agree exactly when the
two arrows already did. eqComposed is the caller's comparison of the composites (a
conjunction, where two projections have to be checked together), and desc names it for the
failure message.
This is the mono half of an equalizer, the epi half of a coequalizer, and the jointly-monic and jointly-epic halves of a pullback and a pushout.
testEqualizers :: (Testable k, HasEqualizers k) => WithTestOb k -> TestTree Source Github #
Checks the equalizer laws: the equalizer arrow e equalizes f and g; any h that factors
through e (generated as e . p) is recovered by factorEqualizer; and e is mono.
The equalizer object is not computed by a type family, so its Ob comes from the arrow via
Objs, and withTestOb only has to bridge that one Ob to TestOb.
testEqualizers_ :: (Testable k, HasEqualizers k, TestObIsOb k) => TestTree Source Github #
testCoequalizers :: (Testable k, HasCoequalizers k) => WithTestOb k -> TestTree Source Github #
Checks the coequalizer laws, dual to testEqualizers: the coequalizer arrow c coequalizes f
and g; any h that factors through c (built here as p . c for an arbitrary p, so the
precondition holds by construction) is correctly recovered by factorCoequalizer; and
c is epi (post-composing with it on the right reflects equality).
testCoequalizers_ :: (Testable k, HasCoequalizers k, TestObIsOb k) => TestTree Source Github #
testPullbacks :: (Testable k, HasPullbacks k) => WithTestOb k -> TestTree Source Github #
Checks the pullback laws: the pullback cone commutes; it's jointly monic (composing with both
legs at once reflects equality); and any compatible cone (built here as (p1 . j, p2 . j) for an
arbitrary j, so compatibility holds by construction) is correctly recovered by
factorPullback.
testPullbacks_ :: (Testable k, HasPullbacks k, TestObIsOb k) => TestTree Source Github #
testPushouts :: (Testable k, HasPushouts k) => WithTestOb k -> TestTree Source Github #
Checks the pushout laws, dual to testPullbacks: the pushout cocone commutes; it's jointly epic
(post-composing with both legs at once reflects equality); and any compatible cocone (built here as
(j . p1, j . p2) for an arbitrary j, so compatibility holds by construction) is correctly
recovered by factorPushout.
testPushouts_ :: (Testable k, HasPushouts k, TestObIsOb k) => TestTree Source Github #
testEpiMonoFactorization :: (Testable k, HasEpiMonoFactorization k) => WithTestOb k -> TestTree Source Github #
Checks the epi-mono factorization laws: factorize splits f as m . e through an
image object, with e epi and m mono.
As with testEqualizers the image object is revealed at runtime rather than computed by a type
family, so withTestOb bridges its recovered Ob to TestOb. The epi and mono halves are the
two directions of propReflectsEq: composing on the right with e, and on the left with m.
testEpiMonoFactorization_ :: (Testable k, HasEpiMonoFactorization k, TestObIsOb k) => TestTree Source Github #
Monoidal structure
testMonoidal :: (Testable k, Monoidal k, TestOb (Unit :: k)) => WithTestOb2 k -> TestTree Source Github #
testMonoidal_ :: (Testable k, Monoidal k, TestObIsOb k) => TestTree Source Github #
testSymMonoidal :: (Testable k, SymMonoidal k, TestOb (Unit :: k)) => WithTestOb2 k -> TestTree Source Github #
The laws of a symmetric monoidal category, from
: Laws SymMonoidalStructuresswap is a natural
self-inverse satisfying the hexagon identity.
testSymMonoidal_ :: (Testable k, SymMonoidal k, TestObIsOb k) => TestTree Source Github #
testCopyDiscard :: (Testable k, CopyDiscard k, TestOb (Unit :: k)) => WithTestOb2 k -> TestTree Source Github #
The laws of a copy-discard category: every object is a cocommutative comonoid (the laws of its
supply, in Proarrow.Monoid), and copy and discard are that comonoid
and respect the tensor (CopyDiscardStructures).
testCopyDiscard_ :: (Testable k, CopyDiscard k, TestObIsOb k) => TestTree Source Github #
testCopyDiscard where TestOb is Ob.
testCartesian :: (Testable k, Cartesian k, TestOb (Unit :: k)) => (forall (a :: k) r. TestOb a => (Ob a => r) -> r) -> WithTestOb2 k -> TestTree Source Github #
The coherence law tying Cartesian to its CopyDiscard superclass
(Fox's theorem): the comonoid supplied on every object is the natural one, copy = id &&& id
and discard = terminate.
propCartesianAt :: forall {k} (a :: k). (Testable k, Cartesian k, TensorIsProduct a a, TestOb (Unit :: k), TestOb a, Ob a, TestOb (a ** a)) => Property () Source Github #
testCartesian_ :: (Testable k, Cartesian k, TestObIsOb k, TestOb (Unit :: k)) => TestTree Source Github #
testDistributive :: (Testable k, Distributive k, TestOb (Unit :: k), TestOb (InitialObject :: k)) => WithTestOb2 k -> WithTestObCoprod k -> TestTree Source Github #
testDistributive_ :: (Testable k, Distributive k, TestObIsOb k) => TestTree Source Github #
testClosed :: (Testable k, Closed k, TestOb (Unit :: k)) => WithTestOb2 k -> WithTestObExp k -> TestTree Source Github #
testClosed_ :: (Testable k, Closed k, TestObIsOb k) => TestTree Source Github #
testDialogue :: (Testable k, Dialogue k, TestOb (Unit :: k)) => WithTestOb2 k -> WithTestObDual k -> TestTree Source Github #
Laws of a dialogue category, from :
Laws DialogueStructuresdual is a contravariant functor, linDist is a natural bijection
Hom(a ** b, Dual c) ≅ Hom(a, Dual (b ** c)) with inverse linDistInv, and
doubleNegInv is the one they give.
testDialogue_ :: (Testable k, Dialogue k, TestObIsOb k) => TestTree Source Github #
testStarAutonomous :: (Testable k, StarAutonomous k, TestOb (Unit :: k)) => WithTestOb2 k -> WithTestObExp k -> WithTestObDual k -> TestTree Source Github #
Laws of a *-autonomous category, from
: Laws StarAutonomousStructuresdual is bijective on hom-sets
with inverse dualInv, and doubleNeg is an isomorphism. The rest is testDialogue.
The exponential witness is needed because Closed is a superclass, although no
law builds an exponential.
testStarAutonomous_ :: (Testable k, StarAutonomous k, TestObIsOb k) => TestTree Source Github #
testIsoMix :: (Testable k, IsoMix k, TestOb (Unit :: k)) => WithTestOb2 k -> WithTestObDual k -> TestTree Source Github #
Laws of an isomix category, from :
Laws IsoMixStructuresdualUnit and dualUnitInv are inverses, and dualityCounit is the
one the dialogue structure gives.
testIsoMix_ :: (Testable k, IsoMix k, TestObIsOb k) => TestTree Source Github #
testCompactClosed :: (Testable k, CompactClosed k, TestOb (Unit :: k)) => WithTestOb2 k -> WithTestObExp k -> WithTestObDual k -> TestTree Source Github #
Laws of a compact closed category, from
:
Laws CompactClosedStructuresdistribDual and dualUnit are isomorphisms (so Dual is strong monoidal), and
dualityUnit and dualityCounit satisfy the zigzag identities. See
testStarAutonomous for the exponential witness.
testCompactClosed_ :: (Testable k, CompactClosed k, TestObIsOb k) => TestTree Source Github #
testHypergraph :: (Testable k, SymMonoidal k, Supplies CommutativeMonoid k, Supplies CocommutativeComonoid k, TestOb (Unit :: k)) => WithTestOb2 k -> TestTree Source Github #
The laws of a category that supplies special commutative Frobenius algebras, stated for
every object: the monoid and comonoid laws of its points, their commutativity, and the Frobenius laws of
FrobeniusStructures.
testHypergraph_ :: (Testable k, SymMonoidal k, TestObIsOb k, Supplies CommutativeMonoid k, Supplies CocommutativeComonoid k) => TestTree Source Github #
Traced monoidal categories
testTraced :: (Testable k, TracedMonoidal k, TestOb (Unit :: k)) => WithTestOb2 k -> TestTree Source Github #
The trace laws of Proarrow.Category.Monoidal.Strength (TracedStructures).
testTraced_ :: (Testable k, TracedMonoidal k, TestObIsOb k) => TestTree Source Github #
Monoids and comonoids
propMonoid :: forall {k} (m :: k). (Testable k, Monoid m, TestOb m, TestOb (Unit :: k)) => WithTestOb2 k -> Property () Source Github #
propCommutativeMonoid :: forall {k} (m :: k). (Testable k, CommutativeMonoid m, TestOb m, TestOb (Unit :: k)) => WithTestOb2 k -> Property () Source Github #
The laws of a commutative monoid: propMonoid, and mappend is unchanged by swap.
propCocommutativeComonoid :: forall {k} (m :: k). (Testable k, CocommutativeComonoid m, TestOb m, TestOb (Unit :: k)) => WithTestOb2 k -> Property () Source Github #
The laws of a cocommutative comonoid, as those of a commutative monoid in the opposite category.
propFrobenius :: forall {k} (m :: k). (Testable k, SymMonoidal k, CommutativeMonoid m, CocommutativeComonoid m, TestOb m, TestOb (Unit :: k)) => WithTestOb2 k -> Property () Source Github #
Check that the object m is a special commutative Frobenius algebra: it is a
CommutativeMonoid (via propCommutativeMonoid) and a CocommutativeComonoid
(via propCocommutativeComonoid), and satisfies speciality (mappend . comult = id) and the
Frobenius condition. A Hypergraph category supplies this structure, and
samples an object and delegates here.testHypergraph
testMonoid :: forall {k} (m :: k). (Testable k, Monoid m, TestOb m, TestOb (Unit :: k)) => WithTestOb2 k -> TestTree Source Github #
The monoid laws of m (propMonoid) as a ready-made test.
testMonoid_ :: forall {k} (m :: k). (Testable k, Monoid m, TestObIsOb k) => TestTree Source Github #
testComonoid :: forall {k} (m :: k). (Testable k, Comonoid m, TestOb m, TestOb (Unit :: k)) => WithTestOb2 k -> TestTree Source Github #
The comonoid laws of m, as the monoid laws of m in the opposite category.
testComonoid_ :: forall {k} (m :: k). (Testable k, Comonoid m, TestObIsOb k) => TestTree Source Github #
testCommutativeMonoid :: forall {k} (m :: k). (Testable k, CommutativeMonoid m, TestOb m, TestOb (Unit :: k)) => WithTestOb2 k -> TestTree Source Github #
The laws of a commutative monoid (propCommutativeMonoid) as a ready-made test.
testCommutativeMonoid_ :: forall {k} (m :: k). (Testable k, CommutativeMonoid m, TestObIsOb k) => TestTree Source Github #
testCocommutativeComonoid :: forall {k} (m :: k). (Testable k, CocommutativeComonoid m, TestOb m, TestOb (Unit :: k)) => WithTestOb2 k -> TestTree Source Github #
The laws of a cocommutative comonoid (propCocommutativeComonoid) as a ready-made test.
testCocommutativeComonoid_ :: forall {k} (m :: k). (Testable k, CocommutativeComonoid m, TestObIsOb k) => TestTree Source Github #
testFrobenius :: forall {k} (m :: k). (Testable k, CommutativeMonoid m, CocommutativeComonoid m, TestOb m, TestOb (Unit :: k)) => WithTestOb2 k -> TestTree Source Github #
The laws of a special commutative Frobenius algebra (propFrobenius) as a ready-made test.
testFrobenius_ :: forall {k} (m :: k). (Testable k, CommutativeMonoid m, CocommutativeComonoid m, TestObIsOb k) => TestTree Source Github #
Toposes
testSubobjectClassifier :: (Testable k, HasSubobjectClassifier k, HasEpiMonoFactorization k, HasPushouts k, HasPullbacks k, TestOb (Omega :: k)) => WithTestObProd k -> TestTree Source Github #
Checks the subobject classifier , the object of truth values: a map into it is a
predicate, and each mono Omegam has one classifying map, true on m and nowhere else. The
laws quantify over generalized elements (arrows into the object):
isclassifyGraphftrueat(x, y)iffy = f . x. This is the pullback condition for the graph<id, f>. Atf =it isidisEq, so equality testing is pinned down too.- Distinct arrows get distinct classifiers, the testable consequence of the classifying map being unique.
is true atclassifyKernelPairf(x, x')ifffidentifies them, in both directions.is true on the image ofclassifyImageffand nowhere else: every element it calls true factors through the image mono, byfactorPullback. This is the law that separates a subobject classifier from an arbitrary map intoOmega.
The elements come from the Testable palette, which is sound iff that palette generates: true
for the concrete finite categories, not for a presheaf topos.
testSubobjectClassifier_ :: (Testable k, HasSubobjectClassifier k, HasEpiMonoFactorization k, HasPushouts k, HasPullbacks k, TestObIsOb k, TestOb (Omega :: k)) => TestTree Source Github #
testNegation :: (Testable k, ElementaryTopos k, TestOb (Omega :: k)) => TestTree Source Github #
testLawvereTierney :: (Testable k, ElementaryTopos k, TestOb (Omega :: k), TestOb (TerminalObject :: k)) => WithTestObProd k -> ((Omega :: k) ~> (Omega :: k)) -> TestTree Source Github #
The three equations a Lawvere–Tierney topology satisfies, for an arrow
j :: : it fixes Omega ~> Omegatrue, is idempotent, and preserves meets.
Such a j is the same data as a Grothendieck topology: the covering sieves are the ones j
sends to true. lawvereTierney is the j a coverage induces, so this is how a
coverage's stability and composition get checked, without quantifying over arrows the coverage
was never handed.
lawvereTierneyLaws :: (Testable k, ElementaryTopos k, TestOb (Omega :: k), TestOb (TerminalObject :: k)) => WithTestObProd k -> [(String, ((Omega :: k) ~> (Omega :: k)) -> Property ())] Source Github #
The three laws of testLawvereTierney, by name, for an arrow given later. Shared by it and
testLawvereTierneyFamily.
testLawvereTierneyFamily :: (Testable k, ElementaryTopos k, TestOb (Omega :: k), TestOb (TerminalObject :: k)) => String -> WithTestObProd k -> (((TerminalObject :: k) ~> (Omega :: k)) -> (Omega :: k) ~> (Omega :: k)) -> TestTree Source Github #
testLawvereTierney for a family of arrows indexed by the truth values, at a generated one:
openTopology and closedTopology are the ones the internal logic gives.
testLawvereTierney_ :: (Testable k, ElementaryTopos k, TestObIsOb k, TestOb (Omega :: k), TestOb (TerminalObject :: k)) => ((Omega :: k) ~> (Omega :: k)) -> TestTree Source Github #
testLawvereTierneyFamily_ :: (Testable k, ElementaryTopos k, TestObIsOb k, TestOb (Omega :: k), TestOb (TerminalObject :: k)) => String -> (((TerminalObject :: k) ~> (Omega :: k)) -> (Omega :: k) ~> (Omega :: k)) -> TestTree Source Github #
Sites and sheaves
testSiteLaws :: forall t j k. (StableSite t k, HasFiniteCovers t k, FiniteCat j, FiniteCat k) => TestTree Source Github #
The three laws a listable, stable coverage owes, as one group: testStableSite,
testGeneratedSieveIsSieve and testDenseIsCovering. Checking a site starts here.
The rest of this section checks what is built on the coverage: testGluesBack and
testGluesBackAt the sheaf condition, testEqualizersAreSheaves the category of sheaves, and
testSheafification (with testPlusFixes) the reflector. testLawvereTierney, under Toposes,
checks the generated topology and with it HasFiniteCovers's Composition law.
testStableSite :: (StableSite t k, HasFiniteCovers t k, FiniteCat k) => TestTree Source Github #
StableSite's law: pulling a cover back along f gives a cover. For every leg l' of
the cover pullbackCover returns, the instance names a leg l of the original and a
factor u with f . This checks that
equation, and that the pulled-back legs generate a covering sieve, which matters for covers that
are built instead of listed, like the meets of . legArrow l' = legArrow l . uJoins. Covering is
checked instead of dense so that the check does not assume covers compose. It runs at
j ~ (), since whether a sieve covers does not depend on j.
On a thin site (at most one arrow between two objects) the equation holds as soon as it
typechecks. It bites only where two legs share a source and target: the ends of an edge in the
graph schema E ⇉ V, or ByImage, whose legs are named by elements.
propFactorsThroughLeg :: forall t {k} (a :: k) c (x :: k). (Site t k, FiniteCat k, Ob a) => (x ~> a) -> Factors t k a c x -> Property () Source Github #
One leg's half of testStableSite: the arrow is the leg it factors through, composed with
the factor.
testGeneratedSieveIsSieve :: forall t j k. (HasFiniteCovers t k, FiniteCat j, FiniteCat k) => TestTree Source Github #
A cover's generated sieve (the arrows that factor through one of its legs) is a sieve: closed
under composing on either side, as closedUnder decides. That holds for any coverage,
lawful or not, so this checks factorsThrough and the hom-profunctor's
elements, which every verdict in Proarrow.Category.Enriched.Finitary.Sheaf is read
off. It catches, for instance, an argument-swapped factorsThrough.
testAtomicIsDoubleNegation :: (HasPullbacks k, FiniteCat k, Testable (PROD (FINITARY () k)), TestOb (Omega :: PROD (FINITARY () k))) => TestTree Source Github #
On a category with pullbacks (which give the Ore condition), the topology Atomic
generates is the double-negation one: lawvereTierney and doubleNegation are
the same arrow, one computed by closing sieves and one from the internal logic. At j ~ ()
only: over a non-trivial j, ¬¬ is the dense topology along j as well, while the coverage
acts on k alone.
testRanFullyFaithful :: forall {j} {k} (p :: j +-> k). (Finitary p, FiniteCat j, FiniteCat k) => TestTree Source Github #
A profunctor p :: j +-> k is fully faithful in the sense of Ran when the functor from k to
copresheaves on j sending a to p a (-) is: each hom-set a ~> a' is in bijection with the
natural transformations p a' (-) -> p a (-), which are (p . For a corepresentable
|> p) a a'p that is the functor p being fully faithful, which is
%% -ByImage's Fully faithful law. testRiftFullyFaithful is the other
side, and neither implies the other.
testRiftFullyFaithful :: forall {j} {k} (p :: j +-> k). (Finitary p, FiniteCat j, FiniteCat k) => TestTree Source Github #
A profunctor p :: j +-> k is fully faithful in the sense of Rift when the functor from j to
presheaves on k sending b to p (-) b is: each hom-set b ~> b' is in bijection with the
natural transformations p (-) b -> p (-) b', which are (p . For a representable
<| p) b b'p that is the functor p being fully faithful. For a corepresentable % -p it says the
image of p is dense. That makes %% -ByImage subcanonical, and
when p is fully faithful the converse holds too. The comparison lemma asks for something else, %% -testCoveredByImage.
testCoveredByImage :: forall t {j} {k} (w :: j +-> k). (HasFiniteCovers t j, Corepresentable w, Finitary w, FiniteCat j, FiniteCat k) => TestTree Source Github #
Every object of j is covered, for the coverage t, by the arrows into it from the image of
the functor w : the sieve they generate is covering. With %% -w fully faithful
(%% -testRanFullyFaithful) this is the hypothesis of the comparison lemma, see
Induced. Neither this nor testRiftFullyFaithful implies the other.
testDenseIsCovering :: forall t j k. (HasFiniteCovers t k, FiniteCat j, FiniteCat k) => TestTree Source Github #
For every sieve at every pair of objects of a finite site: it is covering exactly when it is dense,
that is when its closure is the maximal sieve. Two independent computations of one
fact: isCovering reads it off the coverage, closure off the induced
topology.
propGluesBack :: forall {j} {k} t p (a :: k) (b :: j) c. (Sheaf t p, Ob a, Ob b, TestingEqShow (p a b)) => Cover t k a c -> p a b -> Property () Source Github #
The uniqueness half of the sheaf condition at one cover: an element x at the covered object
is the gluing of its own restrictions to the legs.
The other half (a glued element restricts back to the family) has no generic test: the only
matching family generic code can build is an element's own restrictions, and there it follows
from uniqueness. Other families come from the site, so that test is written per site. At a
finite site isSheaf decides both halves at once, by
checking that restriction is a bijection onto the matching families.
testGluesBack :: forall {j} {k} t (p :: j +-> k). (HasFiniteCovers t k, Sheaf t p, TestableProfunctor p, TestableTypeP p, TestObIsOb k) => TestTree Source Github #
propGluesBack at every cover of a random element's object. Named for the law and not for the
class, since it is half of what Sheaf asks for (see propGluesBack for the other half).
The object is drawn from those that actually have a cover: on a site where only some objects are covered, drawing uniformly would leave most runs asserting nothing while reporting successes.
testGluesBackAt :: forall {j} {k} t (p :: j +-> k) (a :: k) c. (Sheaf t p, TestableProfunctor p, TestableTypeP p, TestOb a) => String -> Cover t k a c -> TestTree Source Github #
propGluesBack at one named cover, for a site whose covers cannot be listed. The label names
the profunctor and cover, which nothing in the type can supply.
testEqualizersAreSheaves :: (Testable (SHEAVES t j k), HasFiniteCovers t k, FiniteCat j, FiniteCat k) => TestTree Source Github #
testSheafification :: forall t {j} {k} (p :: j +-> k) (q :: j +-> k). (HasFiniteCovers t k, Sheaf t q, Finitary p, Finitary q, FiniteCat j, FiniteCat k, Testable j, Testable k, TestableProfunctor p) => TestTree Source Github #
Sheafification is the reflector into the sheaves: it turns a presheaf p into the closest
sheaf, and every map from p to a sheaf factors uniquely through it. For a finitary p and a
sheaf q, decided at a finite site:
is natural;unitPlusis a sheaf, bySheafifyt pisSheaf;- one plus construction fixes
q(testPlusFixes); - maps
correspond to mapsSheafifyt p ~> qp ~> q. The hom-sets ofare finite, so this is a count, made a bijection byFINITARYj kextendSheafify: extending every mapp ~> qgives every map out of the sheafification once, and restricting an extension along the unit gives the map back.
This also makes extendPlus's choice of cover safe to leave unspecified: another
choice would show up here as an extension that is not one of the maps.
testPlusFixes :: forall t {j} {k} (q :: j +-> k). (HasFiniteCovers t k, Finitary q, FiniteCat j, FiniteCat k) => TestTree Source Github #