Assumed that p1p2, p3p4 are the diagonals, then they are the original bisector to each other and the vectors have 90° difference with the same length. And then the diagonals may also be p1p3/p2p4 or p1p4/p2p3 .

```
class Solution(object):
def validSquare(self, p1, p2, p3, p4):
return not (p1==p2 or p1==p3 or p1==p4 or p2==p3 or p2==p4 or p3==p4) and (self.issquare(p1,p2,p3,p4) or self.issquare(p1,p3,p2,p4) or self.issquare(p1,p4,p2,p3))
def issquare(self, p1, p2, p3, p4):
return not p1[0]+p2[0]-p3[0]-p4[0] and not p1[1] + p2[1] - p3[1] - p4[1] and not (p1[0]-p2[0])*(p3[0]-p4[0])+(p1[1]-p2[1])*(p3[1]-p4[1]) and (p1[0]-p2[0] == p3[1]-p4[1] or p1[1]-p2[1] == p3[0]-p4[0])
```