Skip to content

Commit

Permalink
Merge pull request #678 from zickgraf/XOrFail
Browse files Browse the repository at this point in the history
Add Lift/Colift/SolveLinearSystemInAbCategoryOrFail
  • Loading branch information
sebastianpos authored Jul 13, 2021
2 parents 983e246 + 54bba6a commit 7423cb4
Show file tree
Hide file tree
Showing 28 changed files with 937 additions and 320 deletions.
2 changes: 1 addition & 1 deletion CAP/PackageInfo.g
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Version := Maximum( [
## this line prevents merge conflicts
"2020.04-16", ## Sepp's version
## this line prevents merge conflicts
"2021.05-03", ## Fabian's version
"2021.06-01", ## Fabian's version
## this line prevents merge conflicts
"2021.05-04", ## Kamal's version
] ),
Expand Down
19 changes: 17 additions & 2 deletions CAP/examples/HomStructureTest.g
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,27 @@ ForAll( [ 1, 2 ], i ->
)
);
#! true
Lift( c, d );

IsLiftable( c, d );
#! false
LiftOrFail( c, d );
#! fail
IsLiftable( d, c );
#! true
LiftOrFail( d, c );
#! 0
Lift( d, c );
#! 0

IsColiftable( c, d );
#! true
ColiftOrFail( c, d );
#! 0
Colift( c, d );
#! 0
Colift( d, c );
IsColiftable( d, c );
#! false
ColiftOrFail( d, c );
#! fail

#! @EndExample
132 changes: 105 additions & 27 deletions CAP/gap/CategoryMorphisms.gd
Original file line number Diff line number Diff line change
Expand Up @@ -1559,12 +1559,12 @@ DeclareOperation( "AddIsColiftableAlongEpimorphism",
[ IsCapCategory, IsList ] );

#! @Description
#! The arguments are two morphisms $\alpha: a \rightarrow c$, $\beta: b \rightarrow c$.
#! The output is a lift $\alpha / \beta: a \rightarrow b$ of $\alpha$ along $\beta$
#! if such a lift exists or $\mathtt{fail}$ if it doesn't.
#! The arguments are two morphisms $\alpha: a \rightarrow c$, $\beta: b \rightarrow c$
#! such that a lift $\alpha / \beta: a \rightarrow b$ of $\alpha$ along $\beta$ exists.
#! The output is such a lift $\alpha / \beta: a \rightarrow b$.
#! Recall that a lift $\alpha / \beta: a \rightarrow b$ of $\alpha$ along $\beta$ is
#! a morphism such that $\beta \circ (\alpha / \beta) \sim_{a,c} \alpha$.
#! @Returns a morphism in $\mathrm{Hom}(a,b) + \{ \mathtt{fail} \}$
#! @Returns a morphism in $\mathrm{Hom}(a,b)$
#! @Arguments alpha, beta
DeclareOperation( "Lift",
[ IsCapCategoryMorphism, IsCapCategoryMorphism ] );
Expand All @@ -1573,8 +1573,7 @@ DeclareOperation( "Lift",
#! The arguments are a category $C$ and a function $F$.
#! This operation adds the given function $F$
#! to the category for the basic operation <C>Lift</C>.
#! The function $F$ maps a pair $(\alpha, \beta)$ to a lift $\alpha / \beta$ if it
#! exists, and to <C>fail</C> otherwise.
#! The function $F$ maps a pair $(\alpha, \beta)$ to a lift $\alpha / \beta$.
#! @Returns nothing
#! @Arguments C, F
DeclareOperation( "AddLift",
Expand All @@ -1589,37 +1588,35 @@ DeclareOperation( "AddLift",
DeclareOperation( "AddLift",
[ IsCapCategory, IsList ] );

##
#! @Description
#! The arguments are two morphisms $\alpha: a \rightarrow c$, $\beta: a \rightarrow b$.
#! The output is a colift $\alpha \backslash \beta: c \rightarrow b$ of $\beta$ along $\alpha$
#! if such a colift exists or $\mathtt{fail}$ if it doesn't.
#! Recall that a colift $\alpha \backslash \beta: c \rightarrow b$ of $\beta$ along $\alpha$ is
#! a morphism such that $(\alpha \backslash \beta) \circ \alpha \sim_{a,b} \beta$.
#! @Returns a morphism in $\mathrm{Hom}(c,b) + \{ \mathtt{fail} \}$
#! The arguments are two morphisms $\alpha: a \rightarrow c$, $\beta: b \rightarrow c$.
#! The output is a lift $\alpha / \beta: a \rightarrow b$ of $\alpha$ along $\beta$
#! if such a lift exists or $\mathtt{fail}$ if it doesn't.
#! Recall that a lift $\alpha / \beta: a \rightarrow b$ of $\alpha$ along $\beta$ is
#! a morphism such that $\beta \circ (\alpha / \beta) \sim_{a,c} \alpha$.
#! @Returns a morphism in $\mathrm{Hom}(a,b) + \{ \mathtt{fail} \}$
#! @Arguments alpha, beta
DeclareOperation( "Colift",
DeclareOperation( "LiftOrFail",
[ IsCapCategoryMorphism, IsCapCategoryMorphism ] );


#! @Description
#! The arguments are a category $C$ and a function $F$.
#! This operation adds the given function $F$
#! to the category for the basic operation <C>Colift</C>.
#! The function $F$ maps a pair $(\alpha, \beta)$ to a colift $\alpha \backslash \beta$ if it
#! to the category for the basic operation <C>LiftOrFail</C>.
#! The function $F$ maps a pair $(\alpha, \beta)$ to a lift $\alpha / \beta$ if it
#! exists, and to <C>fail</C> otherwise.
#! @Returns nothing
#! @Arguments C, F
DeclareOperation( "AddColift",
DeclareOperation( "AddLiftOrFail",
[ IsCapCategory, IsFunction ] );

DeclareOperation( "AddColift",
DeclareOperation( "AddLiftOrFail",
[ IsCapCategory, IsFunction, IsInt ] );

DeclareOperation( "AddColift",
DeclareOperation( "AddLiftOrFail",
[ IsCapCategory, IsList, IsInt ] );

DeclareOperation( "AddColift",
DeclareOperation( "AddLiftOrFail",
[ IsCapCategory, IsList ] );

#! @Description
Expand Down Expand Up @@ -1652,8 +1649,69 @@ DeclareOperation( "AddIsLiftable",
DeclareOperation( "AddIsLiftable",
[ IsCapCategory, IsList ] );

#! @Description
#! The arguments are two morphisms $\alpha: a \rightarrow c$, $\beta: a \rightarrow b$
#! such that a colift $\alpha \backslash \beta: c \rightarrow b$ of $\beta$ along $\alpha$ exists.
#! The output is such a colift $\alpha \backslash \beta: c \rightarrow b$.
#! Recall that a colift $\alpha \backslash \beta: c \rightarrow b$ of $\beta$ along $\alpha$ is
#! a morphism such that $(\alpha \backslash \beta) \circ \alpha \sim_{a,b} \beta$.
#! @Returns a morphism in $\mathrm{Hom}(c,b)$
#! @Arguments alpha, beta
DeclareOperation( "Colift",
[ IsCapCategoryMorphism, IsCapCategoryMorphism ] );


#! @Description
#! The arguments are a category $C$ and a function $F$.
#! This operation adds the given function $F$
#! to the category for the basic operation <C>Colift</C>.
#! The function $F$ maps a pair $(\alpha, \beta)$ to a colift $\alpha \backslash \beta$.
#! @Returns nothing
#! @Arguments C, F
DeclareOperation( "AddColift",
[ IsCapCategory, IsFunction ] );

DeclareOperation( "AddColift",
[ IsCapCategory, IsFunction, IsInt ] );

DeclareOperation( "AddColift",
[ IsCapCategory, IsList, IsInt ] );

DeclareOperation( "AddColift",
[ IsCapCategory, IsList ] );

#! @Description
#! The arguments are two morphisms $\alpha: a \rightarrow c$, $\beta: a \rightarrow b$.
#! The output is a colift $\alpha \backslash \beta: c \rightarrow b$ of $\beta$ along $\alpha$
#! if such a colift exists or $\mathtt{fail}$ if it doesn't.
#! Recall that a colift $\alpha \backslash \beta: c \rightarrow b$ of $\beta$ along $\alpha$ is
#! a morphism such that $(\alpha \backslash \beta) \circ \alpha \sim_{a,b} \beta$.
#! @Returns a morphism in $\mathrm{Hom}(c,b) + \{ \mathtt{fail} \}$
#! @Arguments alpha, beta
DeclareOperation( "ColiftOrFail",
[ IsCapCategoryMorphism, IsCapCategoryMorphism ] );


#! @Description
#! The arguments are a category $C$ and a function $F$.
#! This operation adds the given function $F$
#! to the category for the basic operation <C>ColiftOrFail</C>.
#! The function $F$ maps a pair $(\alpha, \beta)$ to a colift $\alpha \backslash \beta$ if it
#! exists, and to <C>fail</C> otherwise.
#! @Returns nothing
#! @Arguments C, F
DeclareOperation( "AddColiftOrFail",
[ IsCapCategory, IsFunction ] );

DeclareOperation( "AddColiftOrFail",
[ IsCapCategory, IsFunction, IsInt ] );

DeclareOperation( "AddColiftOrFail",
[ IsCapCategory, IsList, IsInt ] );

DeclareOperation( "AddColiftOrFail",
[ IsCapCategory, IsList ] );

##
#! @Description
#! The arguments are two morphisms $\alpha: a \rightarrow c$, $\beta: a \rightarrow b$.
#! The output is <C>true</C> if there exists
Expand Down Expand Up @@ -2003,12 +2061,11 @@ DeclareOperation( "AddInterpretMorphismFromDistinguishedObjectToHomomorphismStru
#! where $i = 1 \dots m$ and $j = 1 \dots n$.
#! The third list $\gamma$ (the right side) is a list of morphisms $\gamma_i: A_i \rightarrow D_i$,
#! where $i = 1, \dots, m$.
#! The output is either
#! a list of morphisms $X_j: B_j \rightarrow C_j$ for $j=1\dots n$ solving the linear system
#! defined by $\alpha$, $\beta$, $\gamma$, i.e.,
#! Assumes that a solution to the linear system defined by $\alpha$, $\beta$, $\gamma$ exists, i.e.,
#! there exist morphisms $X_j: B_j \rightarrow C_j$ for $j=1\dots n$ such that
#! $\sum_{j = 1}^n \alpha_{ij}\cdot X_j \cdot \beta_{ij} = \gamma_i$
#! for all $i = 1 \dots m$,
#! or $\texttt{fail}$ if no such solution exists.
#! for all $i = 1 \dots m$.
#! The output is list of such morphisms $X_j: B_j \rightarrow C_j$ for $j=1\dots n$.
#! @Returns a list of morphisms $[X_1, \dots, X_n]$
#! @Arguments alpha, beta, gamma
DeclareOperation( "SolveLinearSystemInAbCategory",
Expand All @@ -2026,6 +2083,27 @@ DeclareOperation( "AddSolveLinearSystemInAbCategory",
DeclareOperation( "AddSolveLinearSystemInAbCategory",
[ IsCapCategory, IsList ] );

#! @Description
#! Like <C>SolveLinearSystemInAbCategory</C>,
#! but without the assumption that a solution exists.
#! If no solution exists, `fail` is returned.
#! @Returns a list of morphisms $[X_1, \dots, X_n]$ or `fail`
#! @Arguments alpha, beta, gamma
DeclareOperation( "SolveLinearSystemInAbCategoryOrFail",
[ IsList, IsList, IsList ] );

DeclareOperation( "AddSolveLinearSystemInAbCategoryOrFail",
[ IsCapCategory, IsFunction ] );

DeclareOperation( "AddSolveLinearSystemInAbCategoryOrFail",
[ IsCapCategory, IsFunction, IsInt ] );

DeclareOperation( "AddSolveLinearSystemInAbCategoryOrFail",
[ IsCapCategory, IsList, IsInt ] );

DeclareOperation( "AddSolveLinearSystemInAbCategoryOrFail",
[ IsCapCategory, IsList ] );

#! @Description
#! Like <C>SolveLinearSystemInAbCategory</C>,
#! but the output is simply <C>true</C> if a solution exists,
Expand Down
Loading

0 comments on commit 7423cb4

Please sign in to comment.