{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Short Introduction to application `matroid`\n",
    "\n",
    "This tutorial is meant to show the main features for handling matroids available. To make `matroid` your current application start `polymake` with the option `-A matroid` or use the context switch\n",
    "\n",
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "application \"matroid\";"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "from within the `polymake` shell.  A permanent setting can be stored with \n",
    "```perl\n",
    "set_custom $default_application=\"matroid\";\n",
    "```\n",
    "\n",
    "## Constructing a Simple Matroid and Playing Around\n",
    "\n",
    "This is how to produce a matroid from a vector configuration over the rationals.  The matroid is defined by the linear dependence among subsets of these vectors.\n",
    "\n",
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "$M=new Matroid(VECTORS=>[[1,0,0],[1,0,1],[1,1,0],[1,0,2]]);"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "\n",
    "If `matroid` is not your default application you have to qualify `Matroid` as in:\n",
    "\n",
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "$M=new matroid::Matroid(VECTORS=>[[1,0,0],[1,0,1],[1,1,0],[1,0,2]]);"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "\n",
    "Output of basic statistics.\n",
    "\n",
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "3 4 3"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/html": [
       "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.0//EN\" \"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd\">\n",
       "<svg height=\"841pt\" id=\"document\" viewBox=\"0 -824 570 824\" width=\"595pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:svg=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
       "\t<title id=\"document_title\">unnamed</title>\n",
       "\t<line stroke=\"rgb(0,0,0)\" stroke-width=\"1\" x1=\"297.5\" x2=\"331.201741105223\" y1=\"-66.5\" y2=\"-302.5\" />\n",
       "\t<line stroke=\"rgb(0,0,0)\" stroke-width=\"1\" x1=\"297.5\" x2=\"425.887585162755\" y1=\"-66.5\" y2=\"-302.5\" />\n",
       "\t<line stroke=\"rgb(0,0,0)\" stroke-width=\"1\" x1=\"297.5\" x2=\"282.253974261923\" y1=\"-66.5\" y2=\"-302.5\" />\n",
       "\t<line stroke=\"rgb(0,0,0)\" stroke-width=\"1\" x1=\"297.5\" x2=\"233.306207418622\" y1=\"-66.5\" y2=\"-302.5\" />\n",
       "\t<line stroke=\"rgb(0,0,0)\" stroke-width=\"1\" x1=\"331.201741105223\" x2=\"225.28198334595\" y1=\"-302.5\" y2=\"-538.5\" />\n",
       "\t<line stroke=\"rgb(0,0,0)\" stroke-width=\"1\" x1=\"331.201741105223\" x2=\"369.71801665405\" y1=\"-302.5\" y2=\"-538.5\" />\n",
       "\t<line stroke=\"rgb(0,0,0)\" stroke-width=\"1\" x1=\"425.887585162755\" x2=\"369.71801665405\" y1=\"-302.5\" y2=\"-538.5\" />\n",
       "\t<line stroke=\"rgb(0,0,0)\" stroke-width=\"1\" x1=\"425.887585162755\" x2=\"514.15404996215\" y1=\"-302.5\" y2=\"-538.5\" />\n",
       "\t<line stroke=\"rgb(0,0,0)\" stroke-width=\"1\" x1=\"282.253974261923\" x2=\"225.28198334595\" y1=\"-302.5\" y2=\"-538.5\" />\n",
       "\t<line stroke=\"rgb(0,0,0)\" stroke-width=\"1\" x1=\"282.253974261923\" x2=\"514.15404996215\" y1=\"-302.5\" y2=\"-538.5\" />\n",
       "\t<line stroke=\"rgb(0,0,0)\" stroke-width=\"1\" x1=\"282.253974261923\" x2=\"80.8459500378501\" y1=\"-302.5\" y2=\"-538.5\" />\n",
       "\t<line stroke=\"rgb(0,0,0)\" stroke-width=\"1\" x1=\"233.306207418622\" x2=\"369.71801665405\" y1=\"-302.5\" y2=\"-538.5\" />\n",
       "\t<line stroke=\"rgb(0,0,0)\" stroke-width=\"1\" x1=\"233.306207418622\" x2=\"80.8459500378501\" y1=\"-302.5\" y2=\"-538.5\" />\n",
       "\t<line stroke=\"rgb(0,0,0)\" stroke-width=\"1\" x1=\"225.28198334595\" x2=\"297.5\" y1=\"-538.5\" y2=\"-774.5\" />\n",
       "\t<line stroke=\"rgb(0,0,0)\" stroke-width=\"1\" x1=\"369.71801665405\" x2=\"297.5\" y1=\"-538.5\" y2=\"-774.5\" />\n",
       "\t<line stroke=\"rgb(0,0,0)\" stroke-width=\"1\" x1=\"514.15404996215\" x2=\"297.5\" y1=\"-538.5\" y2=\"-774.5\" />\n",
       "\t<line stroke=\"rgb(0,0,0)\" stroke-width=\"1\" x1=\"80.8459500378501\" x2=\"297.5\" y1=\"-538.5\" y2=\"-774.5\" />\n",
       "\t<rect height=\"13.5\" rx=\"0\" ry=\"0\" style=\"fill: rgb(255,255,255); stroke: rgb(0,0,0); stroke-width: 1\" width=\"14.52\" x=\"290.24\" y=\"-74.5\" />\n",
       "\t<text font-family=\"Times-Roman\" font-size=\"10\" text-anchor=\"middle\" x=\"297.5\" y=\"-64\"> </text>\n",
       "\t<rect height=\"13.5\" rx=\"0\" ry=\"0\" style=\"fill: rgb(255,255,255); stroke: rgb(0,0,0); stroke-width: 1\" width=\"9.76\" x=\"326.321741105223\" y=\"-310.5\" />\n",
       "\t<text font-family=\"Times-Roman\" font-size=\"10\" text-anchor=\"middle\" x=\"331.201741105223\" y=\"-300\">0</text>\n",
       "\t<rect height=\"13.5\" rx=\"0\" ry=\"0\" style=\"fill: rgb(255,255,255); stroke: rgb(0,0,0); stroke-width: 1\" width=\"9.76\" x=\"421.007585162755\" y=\"-310.5\" />\n",
       "\t<text font-family=\"Times-Roman\" font-size=\"10\" text-anchor=\"middle\" x=\"425.887585162755\" y=\"-300\">1</text>\n",
       "\t<rect height=\"13.5\" rx=\"0\" ry=\"0\" style=\"fill: rgb(255,255,255); stroke: rgb(0,0,0); stroke-width: 1\" width=\"9.76\" x=\"277.373974261923\" y=\"-310.5\" />\n",
       "\t<text font-family=\"Times-Roman\" font-size=\"10\" text-anchor=\"middle\" x=\"282.253974261923\" y=\"-300\">2</text>\n",
       "\t<rect height=\"13.5\" rx=\"0\" ry=\"0\" style=\"fill: rgb(255,255,255); stroke: rgb(0,0,0); stroke-width: 1\" width=\"9.76\" x=\"228.426207418622\" y=\"-310.5\" />\n",
       "\t<text font-family=\"Times-Roman\" font-size=\"10\" text-anchor=\"middle\" x=\"233.306207418622\" y=\"-300\">3</text>\n",
       "\t<rect height=\"13.5\" rx=\"0\" ry=\"0\" style=\"fill: rgb(255,255,255); stroke: rgb(0,0,0); stroke-width: 1\" width=\"19.28\" x=\"215.64198334595\" y=\"-546.5\" />\n",
       "\t<text font-family=\"Times-Roman\" font-size=\"10\" text-anchor=\"middle\" x=\"225.28198334595\" y=\"-536\">0 2</text>\n",
       "\t<rect height=\"13.5\" rx=\"0\" ry=\"0\" style=\"fill: rgb(255,255,255); stroke: rgb(0,0,0); stroke-width: 1\" width=\"28.8\" x=\"355.31801665405\" y=\"-546.5\" />\n",
       "\t<text font-family=\"Times-Roman\" font-size=\"10\" text-anchor=\"middle\" x=\"369.71801665405\" y=\"-536\">0 1 3</text>\n",
       "\t<rect height=\"13.5\" rx=\"0\" ry=\"0\" style=\"fill: rgb(255,255,255); stroke: rgb(0,0,0); stroke-width: 1\" width=\"19.28\" x=\"504.51404996215\" y=\"-546.5\" />\n",
       "\t<text font-family=\"Times-Roman\" font-size=\"10\" text-anchor=\"middle\" x=\"514.15404996215\" y=\"-536\">1 2</text>\n",
       "\t<rect height=\"13.5\" rx=\"0\" ry=\"0\" style=\"fill: rgb(255,255,255); stroke: rgb(0,0,0); stroke-width: 1\" width=\"19.28\" x=\"71.2059500378501\" y=\"-546.5\" />\n",
       "\t<text font-family=\"Times-Roman\" font-size=\"10\" text-anchor=\"middle\" x=\"80.8459500378501\" y=\"-536\">2 3</text>\n",
       "\t<rect height=\"13.5\" rx=\"0\" ry=\"0\" style=\"fill: rgb(0,0,0); stroke: rgb(0,0,0); stroke-width: 1\" width=\"14.52\" x=\"290.24\" y=\"-782.5\" />\n",
       "\t<text font-family=\"Times-Roman\" font-size=\"10\" text-anchor=\"middle\" x=\"297.5\" y=\"-772\"> </text>\n",
       "\t<!--\n",
       "\tGenerated using the Perl SVG Module V2.84\n",
       "\tby Ronan Oger\n",
       "\tInfo: http://www.roitsystems.com/\n",
       "\t-->\n",
       "</svg>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<details><summary><pre style=\"display:inline\"><small>Click here for additional output</small></pre></summary>\n",
       "<pre>\n",
       "polymake: used package SVG\n",
       "   Generated using the Perl SVG Module\n",
       "   by Ronan Oger\n",
       "\n",
       "</pre>\n",
       "</details>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "print $M->N_BASES, \" \", $M->N_ELEMENTS, \" \", $M->RANK;\n",
    "svg($M->LATTICE_OF_FLATS->VISUAL);"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The `VECTORS` are numbered consecutively, starting from zero.  The bases are encoded as sets of these ordinal numbers."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{0 1 2}\n",
       "{0 2 3}\n",
       "{1 2 3}\n"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "print $M->BASES;"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "Similarly you can compute the circuits and cocircuits.\n",
    "\n",
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{0 1 3}\n"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "print $M->CIRCUITS;"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{2}\n",
       "{0 1}\n",
       "{0 3}\n",
       "{1 3}\n"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "print $M->COCIRCUITS;"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "You can also compute other properties, like \n",
    "\n",
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1 1 0 0"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "print $M->PAVING?\"1\":\"0\", \" \",\n",
    "$M->BINARY?\"1\":\"0\", \" \",\n",
    "$M->SERIES_PARALLEL?\"1\":\"0\", \" \",\n",
    "$M->CONNECTED?\"1\":\"0\";"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{0 1 3}\n",
       "{2}\n"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "print $M->CONNECTED_COMPONENTS;"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "x_0^3 + x_0^2 + x_0*x_1"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "print $M->TUTTE_POLYNOMIAL;"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "Even the lattice of flats could be computed and visualised.\n",
    "\n",
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{0 2} {0 1 3} {1 2} {2 3} "
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "$lattice=$M->LATTICE_OF_FLATS;\n",
    "foreach (@{$lattice->nodes_of_rank(2)}){print $lattice->FACES->[$_],\" \"};"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{0 1 3}\n",
       "{2 3}\n",
       "{1 2}\n",
       "{0 2}\n"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "print $M->MATROID_HYPERPLANES;"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "## Matroid Polytopes\n",
    "\n",
    "You can construct a polytope from the bases of a matroid as the convex hull of the characteristic vectors of the bases.  This is the *matroid polytope* of that matroid, sometimes also called the *matroid bases polytope*.  The matroid polytope of the matroid `$M` is a subobject `POLYTOPE` of type `polytope::Polytope<Rational>.\n",
    "\n",
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1 1 1 1 0\n",
       "1 1 0 1 1\n",
       "1 0 1 1 1\n"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "print $M->POLYTOPE->VERTICES;"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "3 3"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/html": [
       "<details><summary><pre style=\"display:inline\"><small>Click here for additional output</small></pre></summary>\n",
       "<pre>\n",
       "polymake: used package lrs\n",
       "  Implementation of the reverse search algorithm of Avis and Fukuda.\n",
       "  Copyright by David Avis.\n",
       "  http://cgm.cs.mcgill.ca/~avis/C/lrs.html\n",
       "\n",
       "</pre>\n",
       "</details>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "print $M->POLYTOPE->F_VECTOR;"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "## Other Constructions\n",
    "\n",
    "The vertices of a polytope give rise to a matroid.  Here is an example for the vertices of the three-dimensional regular cube.  Notice that point coordinates in the application 'polytope' are given by homogeneous coordinates.  Hence this matroid is defined by the relation of affine dependence.\n",
    "\n",
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "$C=new Matroid(VECTORS=>polytope::cube(3)->VERTICES);"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "58"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "print $C->N_BASES;"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "The system also allows you to construct a matroid from a graph.  The bases correspond to the spanning trees then.  Notice that there is more than one way to encode a graph in `polymake`.  Read the [tutorial on graphs](apps_graph.ipynb) for details.\n",
    "\n",
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [],
   "source": [
    "$G=matroid_from_graph(polytope::cube(3)->GRAPH);"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "384"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "print $G->N_BASES;"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "It is also possible to derive a new matroid from others. \n",
    "\n",
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "# The arguments are two matroids and for each matroid a basepoint. The basepoints will be identified. \n",
    "$se=series_extension(uniform_matroid(2,3),0,uniform_matroid(1,3),0);"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1 0 0\n",
       "0 1 0\n",
       "0 0 1\n",
       "1 1 1\n"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "print deletion($se,4)->VECTORS;"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [],
   "source": [
    "$pe=parallel_extension(uniform_matroid(1,3),0,uniform_matroid(2,3),0);"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1 1 1\n",
       "1 0 0\n",
       "0 1 0\n",
       "0 0 1\n"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "print dual(contraction($pe,4))->VECTORS;"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "234"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "print projective_plane(3)->N_BASES;"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "28"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "print fano_matroid()->N_BASES;"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "6552 = 234*28"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "print direct_sum(projective_plane(3),fano_matroid())->N_BASES,\" = 234*28\";"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{0 1 2}\n",
       "{3 4 5}\n",
       "{0 1 3 4}\n",
       "{0 1 3 5}\n",
       "{0 1 4 5}\n",
       "{0 2 3 4}\n",
       "{0 2 3 5}\n",
       "{0 2 4 5}\n",
       "{1 2 3 4}\n",
       "{1 2 3 5}\n",
       "{1 2 4 5}\n"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "print two_sum(uniform_matroid(2,4),0,uniform_matroid(2,4),0)->CIRCUITS;"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "Of course you can also construct your matroid from scratch by specifying, e.g., its set of bases or non-bases and then compute other properties. The following constructs the Fano matroid, which is the simplest matroid that cannot be constructed from a vector configuration (over a field with a characteristic other than two).\n",
    "\n",
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [],
   "source": [
    "$a=new Array<Set<Int>>([0,1,5],[1,2,6],[0,2,3],[1,3,4],[2,4,5],[3,5,6],[0,4,6]);"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [],
   "source": [
    "$m=new Matroid(NON_BASES=>$a,N_ELEMENTS=>7);"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{0 1 2 4}\n",
       "{0 1 3 6}\n",
       "{0 2 5 6}\n",
       "{0 3 4 5}\n",
       "{1 2 3 5}\n",
       "{1 4 5 6}\n",
       "{2 3 4 6}\n"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "print $m->COCIRCUITS;"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "\n",
    "Note that you have to specify N_ELEMENTS when constructing a matroid in this way because this is not implicit in BASES, etc.\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "polymake",
   "language": "polymake",
   "name": "polymake"
  },
  "language_info": {
   "codemirror_mode": "perl",
   "file_extension": ".pl",
   "mimetype": "text/x-polymake",
   "name": "polymake"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
