# Translating GAP-output into sage for lattices

Hi, I mainly use GAP for computations so my experience with Sage is very little. I wonder whether there is an easy method to translate a GAP statistic for posets into a sage statistic for lattices that can be used to enter in the database http://www.findstat.org/ . The following example illustrates the problem: The GAP output in this example is:

[ [ [ [ 1, 1, 1, 1, 1 ], [ 0, 1, 0, 0, 1 ], [ 0, 0, 1, 0, 1 ], [ 0, 0, 0, 1, 1 ], [ 0, 0, 0, 0, 1 ] ], 2 ],

[ [ [ 1, 1, 1, 1, 1 ], [ 0, 1, 0, 1, 1 ], [ 0, 0, 1, 1, 1 ], [ 0, 0, 0, 1, 1 ], [ 0, 0, 0, 0, 1 ] ], 2 ],

[ [ [ 1, 1, 1, 1, 1 ], [ 0, 1, 0, 0, 1 ], [ 0, 0, 1, 1, 1 ], [ 0, 0, 0, 1, 1 ], [ 0, 0, 0, 0, 1 ] ], 2 ],

[ [ [ 1, 1, 1, 1, 1 ], [ 0, 1, 1, 1, 1 ], [ 0, 0, 1, 1, 1 ], [ 0, 0, 0, 1, 1 ], [ 0, 0, 0, 0, 1 ] ], 1 ],

[ [ [ 1, 1, 1, 1, 1 ], [ 0, 1, 1, 1, 1 ], [ 0, 0, 1, 0, 1 ], [ 0, 0, 0, 1, 1 ], [ 0, 0, 0, 0, 1 ] ], 2 ] ]

This is a list with 5 entries where the first entry is for example [ [ [ 1, 1, 1, 1, 1 ], [ 0, 1, 0, 0, 1 ], [ 0, 0, 1, 0, 1 ], [ 0, 0, 0, 1, 1 ], [ 0, 0, 0, 0, 1 ] ], 2 ]. So this first entry is a list with two entries, the first is the matrix [ [ [ 1, 1, 1, 1, 1 ], [ 0, 1, 0, 0, 1 ], [ 0, 0, 1, 0, 1 ], [ 0, 0, 0, 1, 1 ], [ 0, 0, 0, 0, 1 ] ] that is the leq-matrix of a lattice, namely the diamond lattice (which in sage can be entered as ([(0,1),(0,2),(0,3),(1,4),(2,4),(3,4)],5) ) and the second entry is the number 2, which is the value of the statistic. So to every of the five entries in the big list, there corresponds a lattice with a number (statistic).

Now I try to obtain the same statistic in sage that can be entered in the findstat database and the text should look as follows:

([(0,1),(0,2),(0,3),(1,4),(2,4),(3,4)],5) => 2

([(0,2),(0,3),(2,4),(3,4),(4,1)],5) => 2

([(0,2),(0,3),(1,4),(2,4),(3,1)],5) => 2

([(0,4),(2,3),(3,1),(4,2)],5) => 1

([(0,3),(1,4),(2,4),(3,1),(3,2)],5) => 2

Is there an easy way to translate bigger lists such as the above GAP list automatically into the needed sage output to enter in the findstat database?

Thanks for any help!

There are several steps you might be asking about:

`sage_eval`

, see my answer`with open(filename, 'r') as f: s = f.read()`