In the diagram, square ABCD has sides of length 4, and triangle ABE is equilateral. Line segments BE and AC intersect at P. Point Q is on BC so that PQ is perpendicular to BC and PQ=x. Compute AP.