# What happens with subdivisions of normal fans in Sage?

I've been trying to compute specific subdivisions of a particular 4D complete fan, to try to speed up computations I have started looking into using Sage. The problem I'm having is that I would like to compute subdivisions without adding new rays, and I would like to pick which of the existing rays get subdivided (and in what order).

My specific problem is that I want to look at the normal fan of the polytope P4:

sage: P4=Polyhedron( vertices=[[-2,0,1,1],[0,1,1,1],[2,0,1,1],[-1,-1,1,1],
[1,-1,1,1],[-1,-1,-1,1],[1,-1,-1,1],[0,0,0,-1]])
sage: P4
A 4-dimensional polyhedron in ZZ^4 defined as the convex hull of 8 vertices

This polytope has nonsimplicial 2 dimensional faces, which should give corresponding 3 dimensional cones in the normal fan:

sage: P4.faces(2)
(<0,1,2>,<0,1,3>,<0,2,3>,<1,2,3>,<0,1,4>,<1,3,4>,<0,3,4>,<3,4,5>,<1,4,5>,<1,3,5>,
<3,5,6>,<2,3,6>,<1,2,5,6>,<5,6,7>,<3,5,7>,<3,6,7>,<4,5,7>,<0,2,4,6,7>,<3,4,7>)

This list is given by which vertices bound the face. The nonsimplicial 2-faces are <1,2,5,6> and <0,2,4,6,7>.

My first problem comes when I try to create the normal fan of this polytope:

sage: fan=NormalFan(P4)
sage: fan
Rational polyhedral fan in 4-d lattice N
sage: for cone in fan(3): print(cone.ambient_ray_indices())
(0, 1, 2)
(0, 2, 3)
(1, 2, 3)
(0, 1, 3)
(0, 2, 4)
(0, 4, 5)
(0, 1, 5)
(1, 3, 5)
(2, 3, 4, 5)
(0, 3, 5)
(1, 4, 5, 6)
(0, 1, 6)
(0, 4, 6)
(2, 4, 6, 7)
(0, 2, 7)
(0, 6, 7)
(1, 2, 7)
(1, 6, 7)

Something that has gone well is that I obtained a 4D fan with 8 rays. However, my two nonsimplicial 2-faces in P4 (one of which had 5 vertices!) have become three nonsimplicial 3-cones in fan (all of which have only 4 vertices!). This indicates that I don't actually know what this code does, since I should have obtained an identical list, up to relabeling of vertices/rays.

I reach another problem when I try to compute star subdivisions at existing rays:

sage: for cone in fan(1): print([cone.rays(),cone.ambient_ray_indices()])
[N(0, 0, 0, -1) in 4-d lattice N, (0,)]
[N(0, 0, -2, 1) in 4-d lattice N, (1,)]
[N(0, 2, 0, 1) in 4-d lattice N, (2,)]
[N(1, 1, 0, 1) in 4-d lattice N, (3,)]
[N(0, -1, 1, 0) in 4-d lattice N, (4,)]
[N(4, -8, 6, 1) in 4-d lattice N, (5,)]
[N(-4, -8, 6, 1) in 4-d lattice N, (6,)]
[N(-1, 1, 0, 1) in 4-d lattice N, (7,)]
sage: fan4=fan.subdivide(new_rays=[(0,-1,1,0)])
sage: for cone in fan4(3): print(cone.ambient_ray_indices())
(0, 1, 2)
(0, 2, 3)
(1, 2, 3)
(0, 1, 3)
(0, 2, 4)
(0, 4, 5)
(0, 1, 5)
(1, 3, 5)
(2, 3, 4, 5)
(0, 3, 5)
(1, 4, 5, 6)
(0, 1, 6)
(0, 4, 6)
(2, 4, 6, 7)
(0, 2, 7)
(0, 6, 7)
(1, 2, 7)
(1, 6, 7)
(0, 1, 7)

So I have tried to compute a star subdivision at ray 4, which should "simplicialize" all three nonsimplicial 3-cones in this fan. However, we see that nothing has changed. This suggests to me that the subdivision command can only subdivide at new rays, which is not what I need.

So my main questions are:

1) Why doesn't my fan correspond to the polytope I started with?

2) Is there a way to do subdivisions without adding new rays?

3) Is the problem that I'm trying to use Sage, and should I be looking for a different way to try to compute these types of objects?