{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 136,
   "metadata": {},
   "outputs": [],
   "source": [
    "using CapAndHomalg"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 137,
   "metadata": {},
   "outputs": [],
   "source": [
    "LoadPackage( \"IntrinsicModules\" )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 138,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: Q"
      ]
     },
     "execution_count": 138,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ℚ = HomalgFieldOfRationalsInSingular()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 139,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: Q[x1,x2,x3,x4]"
      ]
     },
     "execution_count": 139,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "R = ℚ[\"x1..4\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 140,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: <A 4 x 4 matrix over an external ring>"
      ]
     },
     "execution_count": 140,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Mmat = HomalgMatrix( \"[1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1]\", 4, 4, R )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 141,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1,0,0,1,\n",
      "0,0,0,0,\n",
      "0,0,0,0,\n",
      "1,0,0,1 \n"
     ]
    }
   ],
   "source": [
    "Display( Mmat )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 142,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: <A 4 x 4 matrix over an external ring>"
      ]
     },
     "execution_count": 142,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "D1 = HomalgMatrix( \"[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1]\", 4, 4, R )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 143,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1,0,0,0,\n",
      "0,0,0,0,\n",
      "0,0,0,0,\n",
      "0,0,0,-1\n"
     ]
    }
   ],
   "source": [
    "Display( D1 )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 144,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: <A 4 x 4 matrix over an external ring>"
      ]
     },
     "execution_count": 144,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "D2 = HomalgMatrix( \"[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0]\", 4, 4, R )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 145,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0,0,0, 0,\n",
      "0,1,0, 0,\n",
      "0,0,-1,0,\n",
      "0,0,0, 0 \n"
     ]
    }
   ],
   "source": [
    "Display( D2 )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 146,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: <A 4 x 4 matrix over an external ring>"
      ]
     },
     "execution_count": 146,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "D3 = HomalgMatrix( \"[0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0]\", 4, 4, R )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 147,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0, 0,0,1,\n",
      "0, 0,0,0,\n",
      "0, 0,0,0,\n",
      "-1,0,0,0 \n"
     ]
    }
   ],
   "source": [
    "Display( D3 )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 148,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: <A 4 x 4 matrix over an external ring>"
      ]
     },
     "execution_count": 148,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "D4 = HomalgMatrix( \"[0, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 0]\", 4, 4, R )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 149,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0,0, 0,0,\n",
      "0,0, 1,0,\n",
      "0,-1,0,0,\n",
      "0,0, 0,0 \n"
     ]
    }
   ],
   "source": [
    "Display( D4 )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 150,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "4"
      ]
     },
     "execution_count": 150,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "n = NrRows( Mmat )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 151,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: <A 4 x 1 matrix over an external ring>"
      ]
     },
     "execution_count": 151,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x = HomalgMatrix( \"[x1, x2, x3, x4]\", n, 1, R )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 152,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: <An unevaluated 4 x 4 matrix over an external ring>"
      ]
     },
     "execution_count": 152,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Amat =UnionOfColumns( D1 * x, D2 * x, D3 * x, D4 * x )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 153,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "x1, 0,  x4, 0,  \n",
      "0,  x2, 0,  x3, \n",
      "0,  -x3,0,  -x2,\n",
      "-x4,0,  -x1,0   \n"
     ]
    }
   ],
   "source": [
    "Display( Amat )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 154,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: Columns( Q[x1,x2,x3,x4] )"
      ]
     },
     "execution_count": 154,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ColsR = CategoryOfColumns( R )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 155,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: <A morphism in Columns( Q[x1,x2,x3,x4] )>"
      ]
     },
     "execution_count": 155,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "M =  Mmat / ColsR"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 156,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: <A morphism in Columns( Q[x1,x2,x3,x4] )>"
      ]
     },
     "execution_count": 156,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "L = WeakCokernelProjection( M )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 157,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Source: \n",
      "A column module over Q[x1,x2,x3,x4] of rank 4\n",
      "\n",
      "Matrix: \n",
      "0,0,1,0,\n",
      "0,1,0,0,\n",
      "1,0,0,-1\n",
      "\n",
      "Range: \n",
      "A column module over Q[x1,x2,x3,x4] of rank 3\n",
      "\n",
      "A morphism in Columns( Q[x1,x2,x3,x4] )\n"
     ]
    }
   ],
   "source": [
    "Display( L )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 158,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: <A morphism in Columns( Q[x1,x2,x3,x4] )>"
      ]
     },
     "execution_count": 158,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X = WeakKernelEmbedding( L )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 159,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Source: \n",
      "A column module over Q[x1,x2,x3,x4] of rank 1\n",
      "\n",
      "Matrix: \n",
      "1,\n",
      "0,\n",
      "0,\n",
      "1 \n",
      "\n",
      "Range: \n",
      "A column module over Q[x1,x2,x3,x4] of rank 4\n",
      "\n",
      "A morphism in Columns( Q[x1,x2,x3,x4] )\n"
     ]
    }
   ],
   "source": [
    "Display( X )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 160,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: <A morphism in Columns( Q[x1,x2,x3,x4] )>"
      ]
     },
     "execution_count": 160,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Y = Lift( M, X )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 161,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Source: \n",
      "A column module over Q[x1,x2,x3,x4] of rank 4\n",
      "\n",
      "Matrix: \n",
      "1,0,0,1\n",
      "\n",
      "Range: \n",
      "A column module over Q[x1,x2,x3,x4] of rank 1\n",
      "\n",
      "A morphism in Columns( Q[x1,x2,x3,x4] )\n"
     ]
    }
   ],
   "source": [
    "Display( Y )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 162,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: <A morphism in Columns( Q[x1,x2,x3,x4] )>"
      ]
     },
     "execution_count": 162,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "A = Amat / ColsR"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 163,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: <A morphism in Columns( Q[x1,x2,x3,x4] )>"
      ]
     },
     "execution_count": 163,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Q = PreCompose( A, L )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 164,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Source: \n",
      "A column module over Q[x1,x2,x3,x4] of rank 4\n",
      "\n",
      "Matrix: \n",
      "0,    -x3,0,    -x2,\n",
      "0,    x2, 0,    x3, \n",
      "x1+x4,0,  x1+x4,0   \n",
      "\n",
      "Range: \n",
      "A column module over Q[x1,x2,x3,x4] of rank 3\n",
      "\n",
      "A morphism in Columns( Q[x1,x2,x3,x4] )\n"
     ]
    }
   ],
   "source": [
    "Display( Q )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 165,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: <A zero (left) ideal>"
      ]
     },
     "execution_count": 165,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "J = FittingIdeal( 0,  LeftPresentation( UnderlyingMatrix( Q ) ) )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 166,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: Q[x1,x2,x3,x4]/( 0 )"
      ]
     },
     "execution_count": 166,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "S = R / J"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 167,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: Columns( Q[x1,x2,x3,x4]/( 0 ) )"
      ]
     },
     "execution_count": 167,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ColsS = CategoryOfColumns( S )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 168,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: <A morphism in Columns( Q[x1,x2,x3,x4]/( 0 ) )>"
      ]
     },
     "execution_count": 168,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "QS =  Q / ColsS"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 169,
   "metadata": {},
   "outputs": [
    {
     "ename": "LoadError",
     "evalue": "Error thrown by GAP: Error, either the number of columns or the number of rows of the matrix of relations must be 1\n\n",
     "output_type": "error",
     "traceback": [
      "Error thrown by GAP: Error, either the number of columns or the number of rows of the matrix of relations must be 1\n\n",
      "",
      "Stacktrace:",
      " [1] error(::String, ::String) at ./error.jl:42",
      " [2] error_handler() at /Users/aquadrat/.julia/packages/GAP/7w7Vl/src/GAP.jl:158",
      " [3] _call_gap_func(::Main.ForeignGAP.MPtr, ::Main.ForeignGAP.MPtr) at /Users/aquadrat/.julia/packages/GAP/7w7Vl/src/ccalls.jl:209",
      " [4] call_gap_func(::Main.ForeignGAP.MPtr, ::Main.ForeignGAP.MPtr; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /Users/aquadrat/.julia/packages/GAP/7w7Vl/src/ccalls.jl:174",
      " [5] call_gap_func at /Users/aquadrat/.julia/packages/GAP/7w7Vl/src/ccalls.jl:164 [inlined]",
      " [6] #_#6 at /Users/aquadrat/.julia/packages/GAP/7w7Vl/src/ccalls.jl:191 [inlined]",
      " [7] (::Main.ForeignGAP.MPtr)(::Main.ForeignGAP.MPtr) at /Users/aquadrat/.julia/packages/GAP/7w7Vl/src/ccalls.jl:191",
      " [8] top-level scope at In[169]:1",
      " [9] include_string(::Function, ::Module, ::String, ::String) at ./loading.jl:1091"
     ]
    }
   ],
   "source": [
    "KS = WeakKernelEmbedding( QS )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Source: \n",
      "A column module over Q[x1,x2,x3,x4] of rank 1\n",
      "\n",
      "Matrix: \n",
      "1, \n",
      "0, \n",
      "-1,\n",
      "0  \n",
      "\n",
      "Range: \n",
      "A column module over Q[x1,x2,x3,x4] of rank 4\n",
      "\n",
      "A morphism in Columns( Q[x1,x2,x3,x4] )\n"
     ]
    }
   ],
   "source": [
    "Display( KS )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: <A torsion-free (left) ideal given by 4 generators>"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "J1 = FittingIdeal( 1,  LeftPresentation( UnderlyingMatrix( Q ) ) )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0,                               \n",
      "-x1*x2^2+x1*x3^2-x2^2*x4+x3^2*x4,\n",
      "0,                               \n",
      "x1*x2^2-x1*x3^2+x2^2*x4-x3^2*x4  \n",
      "\n",
      "A (left) ideal generated by the 4 entries of the above matrix\n"
     ]
    }
   ],
   "source": [
    "Display( J1 )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: Q[x1,x2,x3,x4]/( -x1*x2^2+x1*x3^2-x2^2*x4+x3^2*x4, x1*x2^2-x1*x3^2+x2^2*x4-x3^2*x4 )"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "S1 = R / J1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: Columns( Q[x1,x2,x3,x4]/( -x1*x2^2+x1*x3^2-x2^2*x4+x3^2*x4, x1*x2^2-x1*x3^2+x2^2*x4-x3^2*x4 ) )"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ColsS1 = CategoryOfColumns( S1 )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: <A morphism in Columns( Q[x1,x2,x3,x4]/( -x1*x2^2+x1*x3^2-x2^2*x4+x3^2*x4, x1*x2^2-x1*x3^2+x2^2*x4-x3^2*x4 ) )>"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "QS1 =  Q / ColsS1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: <A morphism in Columns( Q[x1,x2,x3,x4]/( -x1*x2^2+x1*x3^2-x2^2*x4+x3^2*x4, x1*x2^2-x1*x3^2+x2^2*x4-x3^2*x4 ) )>"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "KS1 = WeakKernelEmbedding( QS1 )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Source: \n",
      "A column module over Q[x1,x2,x3,x4]/( x1*x2^2-x1*x3^2+x2^2*x4-x3^2*x4 ) of rank 4\n",
      "\n",
      "Matrix: \n",
      "1, 0,        0,           0,          \n",
      "0, 0,        -x1*x3-x3*x4,x1*x2+x2*x4,\n",
      "-1,x2^2-x3^2,0,           0,          \n",
      "0, 0,        x1*x2+x2*x4, -x1*x3-x3*x4\n",
      "\n",
      "modulo [ x1*x2^2-x1*x3^2+x2^2*x4-x3^2*x4 ]\n",
      "\n",
      "Range: \n",
      "A column module over Q[x1,x2,x3,x4]/( x1*x2^2-x1*x3^2+x2^2*x4-x3^2*x4 ) of rank 4\n",
      "\n",
      "A morphism in Columns( Q[x1,x2,x3,x4]/( -x1*x2^2+x1*x3^2-x2^2*x4+x3^2*x4, x1*x2^2-x1*x3^2+x2^2*x4-x3^2*x4 ) )\n"
     ]
    }
   ],
   "source": [
    "Display( KS1 )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: <A morphism in Columns( Q[x1,x2,x3,x4] )>"
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "AS = A / ColsS"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: <A morphism in Columns( Q[x1,x2,x3,x4] )>"
      ]
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "XS = X / ColsS"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: <A morphism in Columns( Q[x1,x2,x3,x4] )>"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "BS = Lift( PreCompose( KS, AS ), XS )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Source: \n",
      "A column module over Q[x1,x2,x3,x4] of rank 1\n",
      "\n",
      "Matrix: \n",
      "x1-x4\n",
      "\n",
      "Range: \n",
      "A column module over Q[x1,x2,x3,x4] of rank 1\n",
      "\n",
      "A morphism in Columns( Q[x1,x2,x3,x4] )\n"
     ]
    }
   ],
   "source": [
    "Display( BS )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 114,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: <A morphism in Columns( Q[x1,x2,x3,x4] )>"
      ]
     },
     "execution_count": 114,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "C = WeakKernelEmbedding( BS )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 115,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Source: \n",
      "A column module over Q[x1,x2,x3,x4] of rank 0\n",
      "\n",
      "Matrix: \n",
      "(an empty 1 x 0 matrix)\n",
      "\n",
      "Range: \n",
      "A column module over Q[x1,x2,x3,x4] of rank 1\n",
      "\n",
      "A morphism in Columns( Q[x1,x2,x3,x4] )\n"
     ]
    }
   ],
   "source": [
    "Display( C )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: <A morphism in Columns( Q[x1,x2,x3,x4] )>"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "V = PostInverse( X )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Source: \n",
      "A column module over Q[x1,x2,x3,x4] of rank 4\n",
      "\n",
      "Matrix: \n",
      "0,0,0,1\n",
      "\n",
      "Range: \n",
      "A column module over Q[x1,x2,x3,x4] of rank 1\n",
      "\n",
      "A morphism in Columns( Q[x1,x2,x3,x4] )\n"
     ]
    }
   ],
   "source": [
    "Display( V )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: <A morphism in Columns( Q[x1,x2,x3,x4] )>"
      ]
     },
     "execution_count": 55,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "VS = V / ColsS"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: <A morphism in Columns( Q[x1,x2,x3,x4] )>"
      ]
     },
     "execution_count": 58,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "B = PreCompose( PreCompose( KS, AS ), VS )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Source: \n",
      "A column module over Q[x1,x2,x3,x4] of rank 1\n",
      "\n",
      "Matrix: \n",
      "x1-x4\n",
      "\n",
      "Range: \n",
      "A column module over Q[x1,x2,x3,x4] of rank 1\n",
      "\n",
      "A morphism in Columns( Q[x1,x2,x3,x4] )\n"
     ]
    }
   ],
   "source": [
    "Display( B )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: <A morphism in Columns( Q[x1,x2,x3,x4]/( -x1*x2^2+x1*x3^2-x2^2*x4+x3^2*x4, x1*x2^2-x1*x3^2+x2^2*x4-x3^2*x4 ) )>"
      ]
     },
     "execution_count": 60,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "AS1 = A / ColsS1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: <A morphism in Columns( Q[x1,x2,x3,x4]/( -x1*x2^2+x1*x3^2-x2^2*x4+x3^2*x4, x1*x2^2-x1*x3^2+x2^2*x4-x3^2*x4 ) )>"
      ]
     },
     "execution_count": 61,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "XS1 = X / ColsS1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: <A morphism in Columns( Q[x1,x2,x3,x4]/( -x1*x2^2+x1*x3^2-x2^2*x4+x3^2*x4, x1*x2^2-x1*x3^2+x2^2*x4-x3^2*x4 ) )>"
      ]
     },
     "execution_count": 62,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "BS1 = Lift( PreCompose( KS1, AS1 ), XS1 )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Source: \n",
      "A column module over Q[x1,x2,x3,x4]/( x1*x2^2-x1*x3^2+x2^2*x4-x3^2*x4 ) of rank 4\n",
      "\n",
      "Matrix: \n",
      "x1-x4,x2^2*x4-x3^2*x4,0,0\n",
      "\n",
      "modulo [ x1*x2^2-x1*x3^2+x2^2*x4-x3^2*x4 ]\n",
      "\n",
      "Range: \n",
      "A column module over Q[x1,x2,x3,x4]/( x1*x2^2-x1*x3^2+x2^2*x4-x3^2*x4 ) of rank 1\n",
      "\n",
      "A morphism in Columns( Q[x1,x2,x3,x4]/( -x1*x2^2+x1*x3^2-x2^2*x4+x3^2*x4, x1*x2^2-x1*x3^2+x2^2*x4-x3^2*x4 ) )\n"
     ]
    }
   ],
   "source": [
    "Display( BS1 )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: <A morphism in Columns( Q[x1,x2,x3,x4]/( -x1*x2^2+x1*x3^2-x2^2*x4+x3^2*x4, x1*x2^2-x1*x3^2+x2^2*x4-x3^2*x4 ) )>"
      ]
     },
     "execution_count": 64,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "BS1bis = Lift( PreCompose( KS1, AS1 ), XS1 )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Source: \n",
      "A column module over Q[x1,x2,x3,x4]/( x1*x2^2-x1*x3^2+x2^2*x4-x3^2*x4 ) of rank 4\n",
      "\n",
      "Matrix: \n",
      "x1-x4,x2^2*x4-x3^2*x4,0,0\n",
      "\n",
      "modulo [ x1*x2^2-x1*x3^2+x2^2*x4-x3^2*x4 ]\n",
      "\n",
      "Range: \n",
      "A column module over Q[x1,x2,x3,x4]/( x1*x2^2-x1*x3^2+x2^2*x4-x3^2*x4 ) of rank 1\n",
      "\n",
      "A morphism in Columns( Q[x1,x2,x3,x4]/( -x1*x2^2+x1*x3^2-x2^2*x4+x3^2*x4, x1*x2^2-x1*x3^2+x2^2*x4-x3^2*x4 ) )\n"
     ]
    }
   ],
   "source": [
    "Display( BS1bis )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: <A zero (left) ideal>"
      ]
     },
     "execution_count": 66,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "FittingIdeal( 0,  LeftPresentation( UnderlyingMatrix( BS1bis ) ) )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 111,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: <A morphism in Columns( Q[x1,x2,x3,x4]/( -x1*x2^2+x1*x3^2-x2^2*x4+x3^2*x4, x1*x2^2-x1*x3^2+x2^2*x4-x3^2*x4 ) )>"
      ]
     },
     "execution_count": 111,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "C =  WeakKernelEmbedding( BS1 )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 112,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Source: \n",
      "A column module over Q[x1,x2,x3,x4]/( x1*x2^2-x1*x3^2+x2^2*x4-x3^2*x4 ) of rank 3\n",
      "\n",
      "Matrix: \n",
      "0,0,x2^2-x3^2,\n",
      "0,0,2,        \n",
      "0,1,0,        \n",
      "1,0,0         \n",
      "\n",
      "modulo [ x1*x2^2-x1*x3^2+x2^2*x4-x3^2*x4 ]\n",
      "\n",
      "Range: \n",
      "A column module over Q[x1,x2,x3,x4]/( x1*x2^2-x1*x3^2+x2^2*x4-x3^2*x4 ) of rank 4\n",
      "\n",
      "A morphism in Columns( Q[x1,x2,x3,x4]/( -x1*x2^2+x1*x3^2-x2^2*x4+x3^2*x4, x1*x2^2-x1*x3^2+x2^2*x4-x3^2*x4 ) )\n"
     ]
    }
   ],
   "source": [
    "Display( C )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: <A zero (left) ideal>"
      ]
     },
     "execution_count": 67,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "FittingIdeal( 1,  LeftPresentation( UnderlyingMatrix( BS1bis ) ) )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: <A zero (left) ideal>"
      ]
     },
     "execution_count": 68,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "FittingIdeal( 2,  LeftPresentation( UnderlyingMatrix( BS1bis ) ) )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: <A torsion-free (left) ideal given by 4 generators>"
      ]
     },
     "execution_count": 70,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "F3 = FittingIdeal( 3,  LeftPresentation( UnderlyingMatrix( BS1bis ) ) )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 71,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "x1-x4,          \n",
      "x2^2*x4-x3^2*x4,\n",
      "0,              \n",
      "0               \n",
      "\n",
      "modulo [ x1*x2^2-x1*x3^2+x2^2*x4-x3^2*x4 ]\n",
      "\n",
      "A (left) ideal generated by the 4 entries of the above matrix\n"
     ]
    }
   ],
   "source": [
    "Display( F3 )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: <A morphism in Columns( Q[x1,x2,x3,x4]/( -x1*x2^2+x1*x3^2-x2^2*x4+x3^2*x4, x1*x2^2-x1*x3^2+x2^2*x4-x3^2*x4 ) )>"
      ]
     },
     "execution_count": 73,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "BS11 = BS / ColsS1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Source: \n",
      "A column module over Q[x1,x2,x3,x4]/( x1*x2^2-x1*x3^2+x2^2*x4-x3^2*x4 ) of rank 1\n",
      "\n",
      "Matrix: \n",
      "x1-x4\n",
      "\n",
      "modulo [ x1*x2^2-x1*x3^2+x2^2*x4-x3^2*x4 ]\n",
      "\n",
      "Range: \n",
      "A column module over Q[x1,x2,x3,x4]/( x1*x2^2-x1*x3^2+x2^2*x4-x3^2*x4 ) of rank 1\n",
      "\n",
      "A morphism in Columns( Q[x1,x2,x3,x4]/( -x1*x2^2+x1*x3^2-x2^2*x4+x3^2*x4, x1*x2^2-x1*x3^2+x2^2*x4-x3^2*x4 ) )\n"
     ]
    }
   ],
   "source": [
    "Display( BS11 )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 75,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: <A principal torsion-free (left) ideal given by a cyclic generator>"
      ]
     },
     "execution_count": 75,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "I = FittingIdeal( 0,  LeftPresentation( UnderlyingMatrix( BS ) ) )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "x1-x4\n",
      "\n",
      "A (left) ideal generated by the entry of the above matrix\n"
     ]
    }
   ],
   "source": [
    "Display( I )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 78,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: <A torsion-free (left) ideal given by 18 generators>"
      ]
     },
     "execution_count": 78,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "J2 = FittingIdeal( 2,  LeftPresentation( UnderlyingMatrix( Q ) ) )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 79,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0,           \n",
      "0,           \n",
      "0,           \n",
      "0,           \n",
      "-x2^2+x3^2,  \n",
      "0,           \n",
      "-x1*x3-x3*x4,\n",
      "0,           \n",
      "-x1*x2-x2*x4,\n",
      "x1*x3+x3*x4, \n",
      "0,           \n",
      "-x1*x2-x2*x4,\n",
      "-x1*x2-x2*x4,\n",
      "0,           \n",
      "-x1*x3-x3*x4,\n",
      "x1*x2+x2*x4, \n",
      "0,           \n",
      "-x1*x3-x3*x4 \n",
      "\n",
      "A (left) ideal generated by the 18 entries of the above matrix\n"
     ]
    }
   ],
   "source": [
    "Display( J2 )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 80,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: <A torsion-free (left) ideal given by 12 generators>"
      ]
     },
     "execution_count": 80,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "J3 = FittingIdeal( 3,  LeftPresentation( UnderlyingMatrix( Q ) ) )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 81,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0,    \n",
      "x3,   \n",
      "0,    \n",
      "x2,   \n",
      "0,    \n",
      "x2,   \n",
      "0,    \n",
      "x3,   \n",
      "x1+x4,\n",
      "0,    \n",
      "x1+x4,\n",
      "0     \n",
      "\n",
      "A (left) ideal generated by the 12 entries of the above matrix\n"
     ]
    }
   ],
   "source": [
    "Display( J3 )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: Q[x1,x2,x3,x4]/( -x2^2+x3^2, -x1*x3-x3*x4, -x1*x2-x2*x4, x1*x3+x3*x4, -x1*x2-x2*x4, -x1*x2-x2*x4, -x1*x3-x3*x4, x1*x2+x2*x4, -x1*x3-x3*x4 )"
      ]
     },
     "execution_count": 82,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "S2 = R / J2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 83,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: Columns( Q[x1,x2,x3,x4]/( -x2^2+x3^2, -x1*x3-x3*x4, -x1*x2-x2*x4, x1*x3+x3*x4, -x1*x2-x2*x4, -x1*x2-x2*x4, -x1*x3-x3*x4, x1*x2+x2*x4, -x1*x3-x3*x4 ) )"
      ]
     },
     "execution_count": 83,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ColsS2 = CategoryOfColumns( S2 )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 84,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: <A morphism in Columns( Q[x1,x2,x3,x4]/( -x2^2+x3^2, -x1*x3-x3*x4, -x1*x2-x2*x4, x1*x3+x3*x4, -x1*x2-x2*x4, -x1*x2-x2*x4, -x1*x3-x3*x4, x1*x2+x2*x4, -x1*x3-x3*x4 ) )>"
      ]
     },
     "execution_count": 84,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "QS2 =  Q / ColsS2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 85,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: <A morphism in Columns( Q[x1,x2,x3,x4]/( -x2^2+x3^2, -x1*x3-x3*x4, -x1*x2-x2*x4, x1*x3+x3*x4, -x1*x2-x2*x4, -x1*x2-x2*x4, -x1*x3-x3*x4, x1*x2+x2*x4, -x1*x3-x3*x4 ) )>"
      ]
     },
     "execution_count": 85,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "KS2 = WeakKernelEmbedding( QS2 )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 86,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Source: \n",
      "A column module over Q[x1,x2,x3,x4]/( x1*x3+x3*x4, x2^2-x3^2, x1*x2+x2*x4 ) of rank 7\n",
      "\n",
      "Matrix: \n",
      "1, 0, 0,  0, 0,  0,    0,    \n",
      "0, 0, -x3,0, x2, 0,    x1+x4,\n",
      "-1,x3,0,  x2,0,  0,    0,    \n",
      "0, 0, x2, 0, -x3,x1+x4,0     \n",
      "\n",
      "modulo [ x1*x3+x3*x4, x2^2-x3^2, x1*x2+x2*x4 ]\n",
      "\n",
      "Range: \n",
      "A column module over Q[x1,x2,x3,x4]/( x1*x3+x3*x4, x2^2-x3^2, x1*x2+x2*x4 ) of rank 4\n",
      "\n",
      "A morphism in Columns( Q[x1,x2,x3,x4]/( -x2^2+x3^2, -x1*x3-x3*x4, -x1*x2-x2*x4, x1*x3+x3*x4, -x1*x2-x2*x4, -x1*x2-x2*x4, -x1*x3-x3*x4, x1*x2+x2*x4, -x1*x3-x3*x4 ) )\n"
     ]
    }
   ],
   "source": [
    "Display( KS2 )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 104,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: Q[x1,x2,x3,x4]/( x3, x2, x1+x4 )"
      ]
     },
     "execution_count": 104,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "S3 = R / J3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 105,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: Columns( Q[x1,x2,x3,x4]/( x3, x2, x1+x4 ) )"
      ]
     },
     "execution_count": 105,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ColsS3 = CategoryOfColumns( S3 )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 106,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: <A morphism in Columns( Q[x1,x2,x3,x4]/( x3, x2, x1+x4 ) )>"
      ]
     },
     "execution_count": 106,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "QS3 =  Q / ColsS3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 107,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: <A morphism in Columns( Q[x1,x2,x3,x4]/( x3, x2, x1+x4 ) )>"
      ]
     },
     "execution_count": 107,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "KS3 = WeakKernelEmbedding( QS3 )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 108,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Source: \n",
      "A column module over Q[x1,x2,x3,x4]/( x3, x2, x1+x4 ) of rank 4\n",
      "\n",
      "Matrix: \n",
      "1,0,0,0,\n",
      "0,1,0,0,\n",
      "0,0,1,0,\n",
      "0,0,0,1 \n",
      "\n",
      "modulo [ x3, x2, x1+x4 ]\n",
      "\n",
      "Range: \n",
      "A column module over Q[x1,x2,x3,x4]/( x3, x2, x1+x4 ) of rank 4\n",
      "\n",
      "A morphism in Columns( Q[x1,x2,x3,x4]/( x3, x2, x1+x4 ) )\n"
     ]
    }
   ],
   "source": [
    "Display( KS3 )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 124,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: <A morphism in Columns( Q[x1,x2,x3,x4]/( x3, x2, x1+x4 ) )>"
      ]
     },
     "execution_count": 124,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "AS3 = A / ColsS3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 125,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: <A morphism in Columns( Q[x1,x2,x3,x4]/( x3, x2, x1+x4 ) )>"
      ]
     },
     "execution_count": 125,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "XS3 = X / ColsS3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 126,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: <A morphism in Columns( Q[x1,x2,x3,x4]/( x3, x2, x1+x4 ) )>"
      ]
     },
     "execution_count": 126,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "BS3 = Lift( PreCompose( KS3, AS3 ), XS3 )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 127,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Source: \n",
      "A column module over Q[x1,x2,x3,x4]/( x3, x2, x1+x4 ) of rank 4\n",
      "\n",
      "Matrix: \n",
      "-x4,0,x4,0\n",
      "\n",
      "modulo [ x3, x2, x1+x4 ]\n",
      "\n",
      "Range: \n",
      "A column module over Q[x1,x2,x3,x4]/( x3, x2, x1+x4 ) of rank 1\n",
      "\n",
      "A morphism in Columns( Q[x1,x2,x3,x4]/( x3, x2, x1+x4 ) )\n"
     ]
    }
   ],
   "source": [
    "Display( BS3 )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 171,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: <A principal torsion-free (right) ideal given by a cyclic generator>"
      ]
     },
     "execution_count": 171,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "I3 = FittingIdeal( 0,  RightPresentation( UnderlyingMatrix( BS3 ) ) )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 172,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "x4\n",
      "\n",
      "modulo [ x3, x2, x1+x4 ]\n",
      "\n",
      "A (right) ideal generated by the entry of the above matrix\n"
     ]
    }
   ],
   "source": [
    "Display( I3 )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 128,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: Q[x1,x2,x3,x4][t]/( x4*t-1 )"
      ]
     },
     "execution_count": 128,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "T = R[\"t\"] / g\"t*x4 - 1\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 129,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: Columns( Q[x1,x2,x3,x4][t]/( x4*t-1 ) )"
      ]
     },
     "execution_count": 129,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ColsT = CategoryOfColumns( T )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 131,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: <A morphism in Columns( Q[x1,x2,x3,x4][t]/( x4*t-1 ) )>"
      ]
     },
     "execution_count": 131,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "BT = BS3 / ColsT"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 132,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GAP: <A morphism in Columns( Q[x1,x2,x3,x4][t]/( x4*t-1 ) )>"
      ]
     },
     "execution_count": 132,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "KT = WeakKernelEmbedding( BT )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 133,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Source: \n",
      "A column module over Q[x1,x2,x3,x4][t]/( x4*t-1 ) of rank 3\n",
      "\n",
      "Matrix: \n",
      "0,0,1,\n",
      "0,1,0,\n",
      "0,0,1,\n",
      "1,0,0 \n",
      "\n",
      "modulo [ x4*t-1 ]\n",
      "\n",
      "Range: \n",
      "A column module over Q[x1,x2,x3,x4][t]/( x4*t-1 ) of rank 4\n",
      "\n",
      "A morphism in Columns( Q[x1,x2,x3,x4][t]/( x4*t-1 ) )\n"
     ]
    }
   ],
   "source": [
    "Display( KT )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Julia 1.5.3",
   "language": "julia",
   "name": "julia-1.5"
  },
  "language_info": {
   "file_extension": ".jl",
   "mimetype": "application/julia",
   "name": "julia",
   "version": "1.5.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
