Skip to content

add method "is_cayley" to lattice polytopes#41224

Merged
vbraun merged 4 commits intosagemath:developfrom
fchapoton:is_cayley
Dec 21, 2025
Merged

add method "is_cayley" to lattice polytopes#41224
vbraun merged 4 commits intosagemath:developfrom
fchapoton:is_cayley

Conversation

@fchapoton
Copy link
Copy Markdown
Contributor

as this could be useful

📝 Checklist

  • The title is concise and informative.
  • The description explains in detail what this PR is about.
  • I have created tests covering the changes.
  • I have updated the documentation and checked the documentation preview.

@cxzhong
Copy link
Copy Markdown
Contributor

cxzhong commented Dec 4, 2025

you may need to consider all directions given by vertex differences

@fchapoton
Copy link
Copy Markdown
Contributor Author

The algorithm should be fine as currently written.

@orlitzky : would you please have a look if you can ?

@orlitzky
Copy link
Copy Markdown
Contributor

Is this the algorithm from Macaulay2? If so it would be polite to add an ALGORITHM:: block that says so, even though the implementation is pretty obvious. The way I think it works is that we may suppose the two parallel hyperplanes are v1 + H and v2 + H. We should have H as a facet, so some facet normal n is orthogonal to it, meaning that (if the polytope is Cayley) we should get only <v1 + H, n> = <v1,n> and <v2 + H, n> = <v2,n> in the set of inner products.

I am not sure this works in corner cases though. Should the trivial polytope be Cayley? How about (say) a 3d polytope in a 4d space, where all of the vertices are contained in the same 3d subspace?

I would also add at least one example that is not Cayley for good measure. You should just need to append another vertex to the cube.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Dec 14, 2025

Documentation preview for this PR (built with commit 69a6069; changes) is ready! 🎉
This preview will update shortly after each push to this PR.

@fchapoton
Copy link
Copy Markdown
Contributor Author

I have made some changes, as suggested.

@orlitzky
Copy link
Copy Markdown
Contributor

Yes, sorry, I got busy. I don't know the origin of this definition (Cayley polytope), but if there is no important reason to require them to be full dimensional, I guess it would be easy to handle both cases with

if not self.is_full_dimensional():
    # all vertices are contained in a strict subspace; trivially true
    return True

at the beginning? Otherwise I think we should raise an error to avoid confidently returning False in cases like

sage: P = LatticePolytope([(0,0,0),(1,0,0),(0,1,0),(2,2,0)])
sage: P.is_full_dimensional()
False
sage: [ len(set(n.dot_product(v) for v in P.vertices()))
....:   for n in P.facet_normals() ]
[3, 3, 3, 3]

@fchapoton
Copy link
Copy Markdown
Contributor Author

merci, voilà !

@orlitzky
Copy link
Copy Markdown
Contributor

LGTM, thanks!

vbraun pushed a commit to vbraun/sage that referenced this pull request Dec 20, 2025
sagemathgh-41224: add method "is_cayley" to lattice polytopes
    
as this could be useful

### 📝 Checklist

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
- [x] I have created tests covering the changes.
- [x] I have updated the documentation and checked the documentation
preview.
    
URL: sagemath#41224
Reported by: Frédéric Chapoton
Reviewer(s):
@vbraun vbraun merged commit 6713da1 into sagemath:develop Dec 21, 2025
22 of 23 checks passed
@fchapoton fchapoton deleted the is_cayley branch December 22, 2025 07:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants