From ec66fbcd72cd2f604395a186401a89aaadbb2843 Mon Sep 17 00:00:00 2001 From: Mohamed Barakat Date: Wed, 29 Jul 2026 12:58:08 +0200 Subject: [PATCH] comply with CartesianCategories v2026.07-03 and added a logic template --- PackageInfo.g | 3 ++- gap/CompilerLogic.gi | 10 +++++++++ .../CategoryOfZXDiagrams_precompiled.gi | 21 +++++++------------ 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/PackageInfo.g b/PackageInfo.g index e312699..89f2498 100644 --- a/PackageInfo.g +++ b/PackageInfo.g @@ -10,7 +10,7 @@ SetPackageInfo( rec( PackageName := "ZXCalculusForCAP", Subtitle := "The category of ZX-diagrams", -Version := "2026.06-01", +Version := "2026.07-01", 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", @@ -85,6 +85,7 @@ Dependencies := rec( NeededOtherPackages := [ [ "CAP", ">= 2025.06-06" ], [ "MonoidalCategories", ">= 2023.05-03" ], # monoidal structure + [ "CartesianCategories", ">= 2026.07-03" ], # cocartesian structure [ "FinSetsForCAP", ">= 2025.12-07" ], # SKELETAL_FIN_SETS_ExplicitCoequalizer ], SuggestedOtherPackages := [ diff --git a/gap/CompilerLogic.gi b/gap/CompilerLogic.gi index b281d8b..18576f8 100644 --- a/gap/CompilerLogic.gi +++ b/gap/CompilerLogic.gi @@ -155,3 +155,13 @@ CapJitAddLogicTemplate( dst_template := "bool", ) ); + +## +CapJitAddLogicTemplate( + rec( + variable_names := [ "list" ], + variable_filters := [ IsList ], + src_template := "Concatenation( CapJitTypedExpression( [ ], { } -> rec( filter := IsList, element_type := rec( filter := IsInt ) ) ), list )", + dst_template := "list", + ) +); diff --git a/gap/precompiled_categories/CategoryOfZXDiagrams_precompiled.gi b/gap/precompiled_categories/CategoryOfZXDiagrams_precompiled.gi index eb6eb6c..f91d517 100644 --- a/gap/precompiled_categories/CategoryOfZXDiagrams_precompiled.gi +++ b/gap/precompiled_categories/CategoryOfZXDiagrams_precompiled.gi @@ -303,13 +303,10 @@ end ######## function ( cat_1, a_1, s_1 ) - local hoisted_1_1, deduped_2_1, deduped_3_1; - deduped_3_1 := AsInteger( a_1 ); - deduped_2_1 := deduped_3_1 - 1; - hoisted_1_1 := [ BigInt( 0 ) .. deduped_2_1 ]; - return CreateCapCategoryMorphismWithAttributes( cat_1, s_1, a_1, VertexLabeledGraph, NTuple( 4, ListWithIdenticalEntries( deduped_3_1, "neutral" ), List( [ 0 .. AsInteger( s_1 ) - 1 ], function ( x_2 ) - return -1 + BigInt( SafePosition( hoisted_1_1, x_2 ) ); - end ), [ 0 .. deduped_2_1 ], CapJitTypedExpression( [ ], function ( ) + local deduped_1_1, deduped_2_1; + deduped_2_1 := AsInteger( a_1 ); + deduped_1_1 := [ 0 .. deduped_2_1 - 1 ]; + return CreateCapCategoryMorphismWithAttributes( cat_1, s_1, a_1, VertexLabeledGraph, NTuple( 4, ListWithIdenticalEntries( deduped_2_1, "neutral" ), deduped_1_1, deduped_1_1, CapJitTypedExpression( [ ], function ( ) return rec( filter := IsList, element_type := rec( @@ -591,13 +588,9 @@ end ######## function ( cat_1, a_1, s_1 ) - local hoisted_1_1, deduped_2_1, deduped_3_1; - deduped_3_1 := AsInteger( a_1 ); - deduped_2_1 := [ 0 .. AsInteger( s_1 ) - 1 ]; - hoisted_1_1 := [ 0 .. deduped_3_1 - 1 ]; - return CreateCapCategoryMorphismWithAttributes( cat_1, s_1, a_1, VertexLabeledGraph, NTuple( 4, ListWithIdenticalEntries( deduped_3_1, "neutral" ), List( deduped_2_1, function ( x_2 ) - return -1 + BigInt( SafePosition( hoisted_1_1, x_2 ) ); - end ), deduped_2_1, CapJitTypedExpression( [ ], function ( ) + local deduped_1_1; + deduped_1_1 := AsInteger( a_1 ); + return CreateCapCategoryMorphismWithAttributes( cat_1, s_1, a_1, VertexLabeledGraph, NTuple( 4, ListWithIdenticalEntries( deduped_1_1, "neutral" ), [ 0 .. deduped_1_1 - 1 ], [ 0 .. AsInteger( s_1 ) - 1 ], CapJitTypedExpression( [ ], function ( ) return rec( filter := IsList, element_type := rec(