From 1c7fa260e380a178bc3870642d2b526425721ffe Mon Sep 17 00:00:00 2001 From: Tom Kuhmichel Date: Tue, 21 Feb 2023 18:51:26 +0100 Subject: [PATCH] Use modeling_* options in ModulePresentationsForCAP Closes #980 --- ...sFreydCategoryOfCategoryOfRowsOrColumns.gi | 182 +++++++++++------- 1 file changed, 112 insertions(+), 70 deletions(-) diff --git a/ModulePresentationsForCAP/gap/ModulePresentationsAsFreydCategoryOfCategoryOfRowsOrColumns.gi b/ModulePresentationsForCAP/gap/ModulePresentationsAsFreydCategoryOfCategoryOfRowsOrColumns.gi index a59b647a7d..730d0ba9dc 100644 --- a/ModulePresentationsForCAP/gap/ModulePresentationsAsFreydCategoryOfCategoryOfRowsOrColumns.gi +++ b/ModulePresentationsForCAP/gap/ModulePresentationsAsFreydCategoryOfCategoryOfRowsOrColumns.gi @@ -15,60 +15,82 @@ InstallMethod( LeftPresentationsAsFreydCategoryOfCategoryOfRows, [ IsHomalgRing ], function( ring ) - local category_of_rows, freyd, object_constructor, object_datum, morphism_constructor, morphism_datum, wrapper; + local category_of_rows, freyd, object_constructor, modeling_tower_object_constructor, object_datum, modeling_tower_object_datum, morphism_constructor, modeling_tower_morphism_datum, morphism_datum, modeling_tower_morphism_constructor, wrapper; category_of_rows := CategoryOfRows( ring : FinalizeCategory := true ); - freyd := FREYD_CATEGORY( category_of_rows : FinalizeCategory := true ); + freyd := FreydCategory( category_of_rows : FinalizeCategory := true ); - object_constructor := function( cat, object_in_freyd ) - - return ObjectifyObjectForCAPWithAttributes( rec( ), cat, - UnderlyingMatrix, UnderlyingMatrix( RelationMorphism( object_in_freyd ) ) - ); + ## + object_constructor := function( cat, matrix) + return ObjectifyObjectForCAPWithAttributes( rec(), cat, + UnderlyingMatrix, matrix ); + end; - object_datum := function( cat, obj ) - local freyd, category_of_rows, relation_morphism; + ## + modeling_tower_object_constructor := function( cat, matrix ) + local freyd, rows; freyd := ModelingCategory( cat ); - category_of_rows := UnderlyingCategory( freyd ); + rows := UnderlyingCategory( freyd ); + + return FreydCategoryObject( freyd, + AsCategoryOfRowsMorphism( rows, matrix ) ); + + end; + + ## + object_datum := function( cat, obj ) - relation_morphism := CategoryOfRowsMorphism( category_of_rows, - CategoryOfRowsObject( category_of_rows, NrRows( UnderlyingMatrix( obj ) ) ), - UnderlyingMatrix( obj ), - CategoryOfRowsObject( category_of_rows, NrCols( UnderlyingMatrix( obj ) ) ) - ); + return UnderlyingMatrix( obj ); - return FreydCategoryObject( freyd, relation_morphism ); + end; + + ## + modeling_tower_object_datum := function( cat, obj ) + + return UnderlyingMatrix( RelationMorphism( obj ) ); end; - morphism_constructor := function( cat, source, morphism_in_freyd, range ) + ## + morphism_constructor := function( cat, source, matrix, range ) - return ObjectifyMorphismWithSourceAndRangeForCAPWithAttributes( rec( ), cat, - source, - range, - UnderlyingMatrix, UnderlyingMatrix( UnderlyingMorphism( morphism_in_freyd ) ) ); + return ObjectifyMorphismWithSourceAndRangeForCAPWithAttributes( rec(), cat, + source, + range, + UnderlyingMatrix, matrix ); end; - morphism_datum := function( cat, mor ) - local freyd, category_of_rows, morphism_datum; + ## + modeling_tower_morphism_constructor := function( cat, source, matrix, range ) + local freyd, rows, rows_morphism; freyd := ModelingCategory( cat ); - category_of_rows := UnderlyingCategory( freyd ); + rows := UnderlyingCategory( freyd ); + + rows_morphism := CategoryOfRowsMorphism( rows, source, matrix, range ); + + return AsFreydCategoryMorphism( freyd, rows_morphism ); + + end; + + ## + morphism_datum := function( cat, mor ) + + return UnderlyingMatrix( mor ); - morphism_datum := CategoryOfRowsMorphism( category_of_rows, - CategoryOfRowsObject( category_of_rows, NrRows( UnderlyingMatrix( mor ) ) ), - UnderlyingMatrix( mor ), - CategoryOfRowsObject( category_of_rows, NrCols( UnderlyingMatrix( mor ) ) ) - ); + end; + + ## + modeling_tower_morphism_datum := function( cat, mor ) - return FreydCategoryMorphism( freyd, ObjectDatum( cat, Source( mor ) ), morphism_datum, ObjectDatum( cat, Range( mor ) ) ); + return UnderlyingMatrix( UnderlyingMorphism( mor ) ); end; @@ -81,11 +103,10 @@ InstallMethod( LeftPresentationsAsFreydCategoryOfCategoryOfRows, object_datum := object_datum, morphism_constructor := morphism_constructor, morphism_datum := morphism_datum, - # TODO: use new system - modeling_tower_object_constructor := { cat, obj } -> obj, - modeling_tower_object_datum := { cat, obj } -> obj, - modeling_tower_morphism_constructor := { cat, source, mor, range } -> mor, - modeling_tower_morphism_datum := { cat, mor } -> mor, + modeling_tower_object_constructor := modeling_tower_object_constructor, + modeling_tower_object_datum := modeling_tower_object_datum, + modeling_tower_morphism_constructor := modeling_tower_morphism_constructor, + modeling_tower_morphism_datum := modeling_tower_morphism_datum, only_primitive_operations := true, ) : FinalizeCategory := false ); @@ -129,60 +150,82 @@ InstallMethod( RightPresentationsAsFreydCategoryOfCategoryOfColumns, [ IsHomalgRing ], function( ring ) - local category_of_columns, freyd, object_constructor, object_datum, morphism_constructor, morphism_datum, wrapper; + local category_of_columns, freyd, object_constructor, modeling_tower_object_constructor, object_datum, modeling_tower_object_datum, morphism_constructor, modeling_tower_morphism_datum, morphism_datum, modeling_tower_morphism_constructor, wrapper; category_of_columns := CategoryOfColumns( ring : FinalizeCategory := true ); - freyd := FREYD_CATEGORY( category_of_columns : FinalizeCategory := true ); + freyd := FreydCategory( category_of_columns : FinalizeCategory := true ); - object_constructor := function( cat, object_in_freyd ) - - return ObjectifyObjectForCAPWithAttributes( rec( ), cat, - UnderlyingMatrix, UnderlyingMatrix( RelationMorphism( object_in_freyd ) ) - ); + ## + object_constructor := function( cat, matrix) + return ObjectifyObjectForCAPWithAttributes( rec(), cat, + UnderlyingMatrix, matrix ); + end; - object_datum := function( cat, obj ) - local freyd, category_of_columns, relation_morphism; + ## + modeling_tower_object_constructor := function( cat, matrix ) + local freyd, columns; freyd := ModelingCategory( cat ); - category_of_columns := UnderlyingCategory( freyd ); + columns := UnderlyingCategory( freyd ); + + return FreydCategoryObject( freyd, + AsCategoryOfColumnsMorphism( columns, matrix ) ); + + end; + + ## + object_datum := function( cat, obj ) - relation_morphism := CategoryOfColumnsMorphism( category_of_columns, - CategoryOfColumnsObject( category_of_columns, NrCols( UnderlyingMatrix( obj ) ) ), - UnderlyingMatrix( obj ), - CategoryOfColumnsObject( category_of_columns, NrRows( UnderlyingMatrix( obj ) ) ) - ); + return UnderlyingMatrix( obj ); - return FreydCategoryObject( freyd, relation_morphism ); + end; + + ## + modeling_tower_object_datum := function( cat, obj ) + + return UnderlyingMatrix( RelationMorphism( obj ) ); end; - morphism_constructor := function( cat, source, morphism_in_freyd, range ) + ## + morphism_constructor := function( cat, source, matrix, range ) - return ObjectifyMorphismWithSourceAndRangeForCAPWithAttributes( rec( ), cat, - source, - range, - UnderlyingMatrix, UnderlyingMatrix( UnderlyingMorphism( morphism_in_freyd ) ) ); + return ObjectifyMorphismWithSourceAndRangeForCAPWithAttributes( rec(), cat, + source, + range, + UnderlyingMatrix, matrix ); end; - morphism_datum := function( cat, mor ) - local freyd, category_of_columns, morphism_datum; + ## + modeling_tower_morphism_constructor := function( cat, source, matrix, range ) + local freyd, columns, columns_morphism; freyd := ModelingCategory( cat ); - category_of_columns := UnderlyingCategory( freyd ); + columns := UnderlyingCategory( freyd ); + + columns_morphism := CategoryOfColumnsMorphism( columns, source, matrix, range ); + + return AsFreydCategoryMorphism( freyd, columns_morphism ); + + end; + + ## + morphism_datum := function( cat, mor ) + + return UnderlyingMatrix( mor ); - morphism_datum := CategoryOfColumnsMorphism( category_of_columns, - CategoryOfColumnsObject( category_of_columns, NrCols( UnderlyingMatrix( mor ) ) ), - UnderlyingMatrix( mor ), - CategoryOfColumnsObject( category_of_columns, NrRows( UnderlyingMatrix( mor ) ) ) - ); + end; + + ## + modeling_tower_morphism_datum := function( cat, mor ) - return FreydCategoryMorphism( freyd, ObjectDatum( cat, Source( mor ) ), morphism_datum, ObjectDatum( cat, Range( mor ) ) ); + return UnderlyingMatrix( UnderlyingMorphism( mor ) ); end; @@ -195,11 +238,10 @@ InstallMethod( RightPresentationsAsFreydCategoryOfCategoryOfColumns, object_datum := object_datum, morphism_constructor := morphism_constructor, morphism_datum := morphism_datum, - # TODO: use new system - modeling_tower_object_constructor := { cat, obj } -> obj, - modeling_tower_object_datum := { cat, obj } -> obj, - modeling_tower_morphism_constructor := { cat, source, mor, range } -> mor, - modeling_tower_morphism_datum := { cat, mor } -> mor, + modeling_tower_object_constructor := modeling_tower_object_constructor, + modeling_tower_object_datum := modeling_tower_object_datum, + modeling_tower_morphism_constructor := modeling_tower_morphism_constructor, + modeling_tower_morphism_datum := modeling_tower_morphism_datum, only_primitive_operations := true, ) : FinalizeCategory := false );