# Checking whether a poset is thin with Sage

Following the definition in https://arxiv.org/pdf/1508.05446.pdf after theorem 7.7 a finite graded poset (we can assume it is connected) is called thin if each interval [x,y] of rank 2 has cardinality 4. Is there a quick way to check with Sage whether a given graded poset is thin?

edit: Thanks to John Palmieri, who suggests to look at the code for is_slender() and modify it. Here is the code:

def is_slender(self, certificate=False):

for x in self:
d = {}
for y in self.upper_covers(x):
for c in self.upper_covers(y):
d[c] = d.get(c, 0) + 1
for c, y in d.items():
if y >= 3:
if certificate:
return (False, (x, c))
return False
if certificate:
return (True, None)
return True


I do not fully understand it yet as Im not experienced with programming in SAGE but I will try to modify it a bit and see if Im succesful.

edit retag close merge delete

2

The method .is_slenderis almost what you want: https://doc.sagemath.org/html/en/refe.... You could modify that to create a new method that does what you want.

( 2023-03-19 20:50:14 +0200 )edit

Thank you for that comment. Do you know where I can find the program code for .is_slender to modify it?

( 2023-03-20 01:49:13 +0200 )edit
2

If P is a poset, evaluate P.is_slender?? to view the source code. This should also print the name of the file containing that code. Alternatively, you can run search_def('is_slender') and it should print "combinat/posets/poset.py", which means that the code is in the file returned by os.path.join(SAGE_ROOT, 'src', 'sage', 'combinat', 'posets', 'poset.py').

( 2023-03-20 04:07:52 +0200 )edit
1

I don't know the code but you may just be able to replace if y >= 3: with if y >= 3 or y == 1:.

( 2023-03-20 16:33:06 +0200 )edit

Thank you. I do some tests to see if this gives the right thing.

( 2023-03-20 19:33:30 +0200 )edit