#!/usr/bin/env python3

from linpy import *

x, y, z, t = symbols('x y z t')

tesseract = \
    Le(0, x) & Le(x, 1) & \
    Le(0, y) & Le(y, 1) & \
    Le(0, z) & Le(z, 1) & \
    Le(0, t) & Le(t, 1)

def faces(polyhedron):
    for points in polyhedron.faces():
        face = points[0].aspolyhedron()
        face = face.union(*[point.aspolyhedron() for point in points[1:]])
        face = face.aspolyhedron()
        yield face

print('Faces of tesseract\n\n  {}\n\nare:\n'.format(tesseract))
for face in faces(tesseract):
    assert(len(face.vertices()) == 8)
    print('  {}'.format(face))
