homalg-project / CAP_project

CAP project -- Categories, Algorithms, and Programming
https://homalg-project.github.io/docs/CAP_project-based/
24 stars 18 forks source link

Test *AdjunctMorphismWithGiven #1593

Closed TKuh closed 6 months ago

TKuh commented 7 months ago

As requested by @zickgraf here https://github.com/homalg-project/CAP_project/commit/cc441fbbe2ffe9342fc9035dd9b35ad7ab95f578#r138678925

I created new files for these checks (instead of adding them to the existing tests) because they would otherwise be translated to CartesianCategories where they would fail.

Specifically, this test (I'm omitting some details)

hom_da := InternalHomOnObjects( d, a );
hom_da_x_c := TensorProductOnObjects( hom_da, c );

cohom_ad := InternalHomOnObjects( a_op, d_op );
cohom_ad_x_c := TensorProductOnObjects( cohom_ad, c_op );

# Adjoint( Hom( d, a ) → Hom( c, b ) )  ==  Hom( d, a ) ⊗ c → b
hom_to_tensor_adjunction_on_hom_beta_alpha := InternalHomToTensorProductLeftAdjunctMorphismWithGivenTensorProduct( c, b, hom_beta_alpha, hom_da_x_c );

# Adjoint( Cohom( b, c ) → Cohom( a, d ) )  ==  b → Cohom( a, d ) ⊗ c
cohom_to_tensor_adjunction_on_cohom_alpha_beta_op := InternalCoHomToTensorProductLeftAdjunctMorphismWithGivenTensorProduct( b_op, c_op, cohom_alpha_beta_op, cohom_ad_x_c );

Assert( 0, IsCongruentForMorphisms( cohom_to_tensor_adjunction_on_cohom_alpha_beta_op, Opposite( opposite, hom_to_tensor_adjunction_on_hom_beta_alpha ) ) );

becomes the following in CartesianCategories:

exp_da := ExponentialOnObjects( d, a );
exp_da_x_c := DirectProduct( exp_da, c );

coexp_ad := ExponentialOnObjects( a_op, d_op );
coexp_ad_x_c := Coproduct( coexp_ad, c_op );

# Adjoint( Exp( d, a ) → Exp( c, b ) )  ==  Exp( d, a ) × c → b
exp_to_tensor_adjunction_on_exp_beta_alpha := ExponentialToDirectProductLeftAdjunctMorphismWithGivenDirectProduct( c, b, exp_beta_alpha, exp_da_x_c );

# Adjoint( Coexp( b, c ) → Coexp( a, d ) )  ==  b → Coexp( a, d ) × c
coexp_to_tensor_adjunction_on_coexp_alpha_beta_op := CoexponentialToCoproductLeftAdjunctMorphismWithGivenCoproduct( b_op, c_op, coexp_alpha_beta_op, coexp_ad_x_c );

# b → Coexp( a, d ) × c  ==  op( Exp( d, a ) × c → b )
Assert( 0, IsCongruentForMorphisms( coexp_to_tensor_adjunction_on_coexp_alpha_beta_op, Opposite( opposite, exp_to_tensor_adjunction_on_exp_beta_alpha ) ) );

The problem is now, that testing with the TerminalCategory lets the above Assert fail:

Assert( 0, IsCongruentForMorphisms( coexp_to_tensor_adjunction_on_coexp_alpha_beta_op, Opposite( opposite, exp_to_tensor_adjunction_on_exp_beta_alpha ) ) );
Error, in function IsCongruentForMorphisms
       of category Opposite with all operations:
       ranges are not equal

gap> r1 := Range(coexp_to_tensor_adjunction_on_coexp_alpha_beta_op);
<A zero object in Opposite with all operations>
gap> r2 := Range( Opposite( opposite, exp_to_tensor_adjunction_on_exp_beta_alpha ) );
<A zero object in Opposite with all operations>

gap> r1 = r2;
false

gap> Display( r1 );
Coproduct

An object in Opposite with all operations given by the above data

gap> Display( r2 );
DirectProduct

An object in Opposite with all operations given by the above data

This is essentially because of the *WithGiven.

However, it works with MonoidalCategories because then both ranges will just be TensorProductOnObjects, hence equal.

codecov[bot] commented 7 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 81.88%. Comparing base (927cc1a) to head (c3f5990).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1593 +/- ## ========================================== + Coverage 81.82% 81.88% +0.06% ========================================== Files 515 523 +8 Lines 69220 69352 +132 ========================================== + Hits 56637 56787 +150 + Misses 12583 12565 -18 ``` | [Flag](https://app.codecov.io/gh/homalg-project/CAP_project/pull/1593/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=homalg-project) | Coverage Δ | | |---|---|---| | [ActionsForCAP](https://app.codecov.io/gh/homalg-project/CAP_project/pull/1593/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=homalg-project) | `64.09% <ø> (ø)` | | | [AttributeCategoryForCAP](https://app.codecov.io/gh/homalg-project/CAP_project/pull/1593/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=homalg-project) | `88.88% <ø> (ø)` | | | [CAP](https://app.codecov.io/gh/homalg-project/CAP_project/pull/1593/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=homalg-project) | `84.86% <ø> (ø)` | | | [CartesianCategories](https://app.codecov.io/gh/homalg-project/CAP_project/pull/1593/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=homalg-project) | `92.36% <100.00%> (ø)` | | | [CompilerForCAP](https://app.codecov.io/gh/homalg-project/CAP_project/pull/1593/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=homalg-project) | `96.10% <ø> (ø)` | | | [ComplexesAndFilteredObjectsForCAP](https://app.codecov.io/gh/homalg-project/CAP_project/pull/1593/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=homalg-project) | `73.60% <ø> (ø)` | | | [FreydCategoriesForCAP](https://app.codecov.io/gh/homalg-project/CAP_project/pull/1593/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=homalg-project) | `81.15% <ø> (ø)` | | | [GeneralizedMorphismsForCAP](https://app.codecov.io/gh/homalg-project/CAP_project/pull/1593/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=homalg-project) | `61.60% <ø> (ø)` | | | [GradedModulePresentationsForCAP](https://app.codecov.io/gh/homalg-project/CAP_project/pull/1593/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=homalg-project) | `44.62% <ø> (ø)` | | | [GroupRepresentationsForCAP](https://app.codecov.io/gh/homalg-project/CAP_project/pull/1593/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=homalg-project) | `72.05% <ø> (ø)` | | | [HomologicalAlgebraForCAP](https://app.codecov.io/gh/homalg-project/CAP_project/pull/1593/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=homalg-project) | `73.21% <ø> (ø)` | | | [InternalExteriorAlgebraForCAP](https://app.codecov.io/gh/homalg-project/CAP_project/pull/1593/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=homalg-project) | `93.09% <ø> (ø)` | | | [LinearAlgebraForCAP](https://app.codecov.io/gh/homalg-project/CAP_project/pull/1593/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=homalg-project) | `66.72% <ø> (+0.39%)` | :arrow_up: | | [ModulePresentationsForCAP](https://app.codecov.io/gh/homalg-project/CAP_project/pull/1593/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=homalg-project) | `68.66% <ø> (ø)` | | | [ModulesOverLocalRingsForCAP](https://app.codecov.io/gh/homalg-project/CAP_project/pull/1593/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=homalg-project) | `90.70% <ø> (ø)` | | | [MonoidalCategories](https://app.codecov.io/gh/homalg-project/CAP_project/pull/1593/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=homalg-project) | `89.66% <100.00%> (+0.14%)` | :arrow_up: | | [ToricSheaves](https://app.codecov.io/gh/homalg-project/CAP_project/pull/1593/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=homalg-project) | `21.79% <ø> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=homalg-project#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

zickgraf commented 6 months ago

Thanks @TKuh!

@mohamed-barakat This mainly affects MonoidalCategories and CartesianCategories, will you review/merge?

mohamed-barakat commented 6 months ago

Please rebase and update the version numbers if necessary.

mohamed-barakat commented 6 months ago

Thanks