# 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.

The method

`.is_slender`

is 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.Thank you for that comment. Do you know where I can find the program code for .is_slender to modify it?

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')`

.I don't know the code but you may just be able to replace

`if y >= 3:`

with`if y >= 3 or y == 1:`

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