Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce DummyRing, DummyCommutativeRing, and DummyField #1508

Merged
merged 1 commit into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CAP/PackageInfo.g
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ SetPackageInfo( rec(

PackageName := "CAP",
Subtitle := "Categories, Algorithms, Programming",
Version := "2023.11-01",
Version := "2023.11-02",
Date := (function ( ) if IsBound( GAPInfo.SystemEnvironment.GAP_PKG_RELEASE_DATE ) then return GAPInfo.SystemEnvironment.GAP_PKG_RELEASE_DATE; else return Concatenation( ~.Version{[ 1 .. 4 ]}, "-", ~.Version{[ 6, 7 ]}, "-01" ); fi; end)( ),
License := "GPL-2.0-or-later",

Expand Down
2 changes: 1 addition & 1 deletion CAP/doc/Doc.autodoc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@

@Chapter Create wrapper hulls of a category

@Chapter Dummy categories
@Chapter Dummy implementations

@Chapter Examples and Tests
4 changes: 3 additions & 1 deletion CAP/examples/DummyCategory.g
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#! @Chapter Examples and Tests

#! @Section Dummy category
#! @Section Dummy implementations

#! @Subsection Dummy categories

#! @Example

Expand Down
37 changes: 37 additions & 0 deletions CAP/examples/dummy_rings.g
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#! @Chapter Examples and Tests

#! @Section Dummy implementations

#! @Subsection Dummy rings

#! @Example

LoadPackage( "CAP", false );
#! true

DummyRing( );
#! Dummy ring 1
DummyRing( );
#! Dummy ring 2
IsRing( DummyRing( ) );
#! true

DummyCommutativeRing( );
#! Dummy commutative ring 1
DummyCommutativeRing( );
#! Dummy commutative ring 2
IsRing( DummyCommutativeRing( ) );
#! true
IsCommutative( DummyCommutativeRing( ) );
#! true

DummyField( );
#! Dummy field 1
DummyField( );
#! Dummy field 2
IsRing( DummyField( ) );
#! true
IsField( DummyField( ) );
#! true

#! @EndExample
47 changes: 0 additions & 47 deletions CAP/gap/DummyCategory.gd

This file was deleted.

93 changes: 0 additions & 93 deletions CAP/gap/DummyCategory.gi

This file was deleted.

115 changes: 115 additions & 0 deletions CAP/gap/DummyImplementations.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# CAP: Categories, Algorithms, Programming
#
# Declarations
#

#! @Chapter Dummy implementations
#!
#! A dummy implementation of a concept seems to provide an interface for the concept, but calling any operation in this interface will simply signal an error.
#! Hence, when using a dummy implementation, we can be sure that we only rely on the abstract interface but not on any implementation details,
#! for the simple reason that there is no actual implementation.
#! This is useful for testing or compilation against a generic implementation of a concept.

####################################
#
#! @Section Dummy rings
#
####################################

####################################
#
# GAP filters
#
####################################

#! @Description
#! The ⪆ filter of dummy rings.
DeclareFilter( "IsDummyRing",
IsRingWithOne );

#! @Description
#! The ⪆ filter of elements of a dummy ring.
DeclareFilter( "IsDummyRingElement",
IsRingElementWithOne );

#! @Description
#! The ⪆ filter of dummy commutative rings.
DeclareFilter( "IsDummyCommutativeRing",
IsDummyRing );

#! @Description
#! The ⪆ filter of elements of a dummy commutative ring.
DeclareFilter( "IsDummyCommutativeRingElement",
IsDummyRingElement );

#! @Description
#! The ⪆ filter of dummy fields.
DeclareFilter( "IsDummyField",
IsDummyCommutativeRing );

#! @Description
#! The ⪆ filter of elements of a dummy commutative ring.
DeclareFilter( "IsDummyFieldElement",
IsDummyCommutativeRingElement );

####################################
#
# Constructors
#
####################################

#! @Description
#! @Returns a dummy ring
DeclareGlobalFunction( "DummyRing" );

#! @Description
#! @Returns a dummy commutative ring
DeclareGlobalFunction( "DummyCommutativeRing" );

#! @Description
#! @Returns a dummy field
DeclareGlobalFunction( "DummyField" );

####################################
#
#! @Section Dummy categories
#
####################################

####################################
#
# GAP categories
#
####################################

#! @Description
#! The ⪆ category of a dummy CAP category.
DeclareCategory( "IsDummyCategory",
IsCapCategory );

#! @Description
#! The ⪆ category of objects in a dummy CAP category.
DeclareCategory( "IsDummyCategoryObject",
IsCapCategoryObject );

#! @Description
#! The ⪆ category of morphisms in a dummy CAP category.
DeclareCategory( "IsDummyCategoryMorphism",
IsCapCategoryMorphism );

####################################
#
# Constructors
#
####################################

#! @Description
#! Creates a dummy category subject to the options given via <A>options</A>, which is a record passed on to <Ref Oper="CategoryConstructor" Label="for IsRecord" />.
#! Note that the options `{category,object,morphism}_filter` will be set to `IsDummyCategory{,Object,Morphism}` and the options `{object,morphism}_{constructor,datum}` and
#! `create_func_*` will be set to dummy implementations (throwing errors when actually called).
#! The dummy category will pretend to support empty limits by default.
#! @Arguments options
#! @Returns a category
DeclareOperation( "DummyCategory",
[ IsRecord ] );
Loading