Skip to content

Commit

Permalink
simplify compiled code of CartesianLambdaIntroduction
Browse files Browse the repository at this point in the history
by a logic template
  • Loading branch information
mohamed-barakat committed Jan 14, 2025
1 parent dc90b84 commit ee3a1eb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 23 deletions.
2 changes: 1 addition & 1 deletion PackageInfo.g
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ SetPackageInfo( rec(

PackageName := "FinSetsForCAP",
Subtitle := "The elementary topos of (skeletal) finite sets",
Version := "2024.10-02",
Version := "2025.01-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",
Expand Down
9 changes: 9 additions & 0 deletions gap/CompilerLogic.gi
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,15 @@ CapJitAddLogicTemplate(
)
);

CapJitAddLogicTemplate(
rec(
variable_names := [ "mor" ],
variable_filters := [ IsMorphismInSkeletalCategoryOfFiniteSets ],
src_template := "List( [ 0 .. Length( Source( mor ) ) - 1 ], i -> AsList( mor )[1 + i] )",
dst_template := "AsList( mor )",
)
);

CapJitAddLogicTemplate(
rec(
variable_names := [ "length", "value", "func" ],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,34 +135,13 @@ function ( cat_1, alpha_1 )
deduped_3_1 := Length( Range( alpha_1 ) );
hoisted_1_1 := AsList( alpha_1 );
return CreateCapCategoryMorphismWithAttributes( cat_1, CreateCapCategoryObjectWithAttributes( cat_1, Length, BigInt( 1 ) ), CreateCapCategoryObjectWithAttributes( cat_1, Length, deduped_3_1 ^ deduped_4_1 ), AsList, [ Sum( List( [ 0 .. deduped_4_1 - 1 ], function ( k_2 )
return CAP_JIT_INCOMPLETE_LOGIC( hoisted_1_1[(1 + CAP_JIT_INCOMPLETE_LOGIC( k_2 ))] ) * deduped_3_1 ^ k_2;
return hoisted_1_1[(1 + k_2)] * deduped_3_1 ^ k_2;
end ) ) ] );
end
########

, 503 : IsPrecompiledDerivation := true );

##
cat!.cached_precompiled_functions.CartesianLambdaIntroduction :=

########
function ( cat_1, alpha_1 )
local hoisted_1_1, hoisted_2_1, deduped_4_1, deduped_5_1, deduped_6_1;
deduped_6_1 := Length( Source( alpha_1 ) );
deduped_5_1 := Length( Range( alpha_1 ) );
deduped_4_1 := [ 0 .. deduped_6_1 - 1 ];
hoisted_1_1 := AsList( alpha_1 );
hoisted_2_1 := List( deduped_4_1, function ( i_2 )
return hoisted_1_1[1 + i_2];
end );
return CreateCapCategoryMorphismWithAttributes( cat_1, CreateCapCategoryObjectWithAttributes( cat_1, Length, BigInt( 1 ) ), CreateCapCategoryObjectWithAttributes( cat_1, Length, deduped_5_1 ^ deduped_6_1 ), AsList, [ Sum( List( deduped_4_1, function ( k_2 )
return hoisted_2_1[(1 + k_2)] * deduped_5_1 ^ k_2;
end ) ) ] );
end
########

;

##
AddCartesianLeftCoevaluationMorphismWithGivenRange( cat,

Expand Down

0 comments on commit ee3a1eb

Please sign in to comment.