Skip to content

Commit

Permalink
Use modeling_* options in ModulePresentationsForCAP
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Kuhmichel committed Feb 21, 2023
1 parent 87ccffd commit cd63dbd
Showing 1 changed file with 114 additions and 72 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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, underlying_matrix, range )

return ObjectifyMorphismWithSourceAndRangeForCAPWithAttributes( rec( ), cat,
source,
range,
UnderlyingMatrix, UnderlyingMatrix( UnderlyingMorphism( morphism_in_freyd ) ) );
return ObjectifyMorphismWithSourceAndRangeForCAPWithAttributes( rec(), cat,
source,
range,
UnderlyingMatrix, underlying_matrix );

end;

morphism_datum := function( cat, mor )
local freyd, category_of_rows, morphism_datum;
##
modeling_tower_morphism_constructor := function( cat, source, underlying_matrix, range )
local freyd, rows, rows_morphism;

freyd := ModelingCategory( cat );

category_of_rows := UnderlyingCategory( freyd );
rows := UnderlyingCategory( freyd );

rows_morphism := CategoryOfRowsMorphism( rows, source, underlying_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;

Expand All @@ -81,16 +103,15 @@ 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 );

wrapper!.compiler_hints.category_attribute_names := [
"UnderlyingRing",
"UnderlyingRing"
];

SetUnderlyingRing( wrapper, ring );
Expand Down Expand Up @@ -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, underlying_matrix, range )

return ObjectifyMorphismWithSourceAndRangeForCAPWithAttributes( rec( ), cat,
source,
range,
UnderlyingMatrix, UnderlyingMatrix( UnderlyingMorphism( morphism_in_freyd ) ) );
return ObjectifyMorphismWithSourceAndRangeForCAPWithAttributes( rec(), cat,
source,
range,
UnderlyingMatrix, underlying_matrix );

end;

morphism_datum := function( cat, mor )
local freyd, category_of_columns, morphism_datum;
##
modeling_tower_morphism_constructor := function( cat, source, underlying_matrix, range )
local freyd, columns, columns_morphism;

freyd := ModelingCategory( cat );

category_of_columns := UnderlyingCategory( freyd );
columns := UnderlyingCategory( freyd );

columns_morphism := CategoryOfColumnsMorphism( columns, source, underlying_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;

Expand All @@ -195,16 +238,15 @@ 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 );

wrapper!.compiler_hints.category_attribute_names := [
"UnderlyingRing",
"UnderlyingRing"
];

SetUnderlyingRing( wrapper, ring );
Expand Down

0 comments on commit cd63dbd

Please sign in to comment.