How can I write a relation in prolog that determines if there are any two pairs in a list with the same sum. The relation should fail if there exist no pairs whose sums are equal. The relation should also fail if the list contains less than four elements.
- list([1 2 3]) fails since it only has 3 elements
- list([2 3 4 1]) succeeds since 2+3=4+1
- list([3 1 2 4 5 6]) succeds since 5+1=2+4
- list([1 8 20 100]) fails since there are no pairs with equal sums