According to Comparison Expressions (XQuery):
When you are comparing two sequences by using general comparison
operators and a value exists in the second sequence that compares True
to a value in the first sequence, the overall result is True.
Otherwise, it is False. For example, (1, 2, 3) = (3, 4) is True,
because the value 3 appears in both sequences.
(1,2,3,4)=1 is equivalent to (1,2,3,4)=(1) in this case 1 exists in the first sequence so it's TRUE. Though for 2,3,4 it's FALSE BUT using the above rule if for at least one element condition is TRUE then OVERALL result is TRUE.
(1,2,3,4)!=1 is equivalent to (1,2,3,4)!=(1) we have 1 from the second sequence and it's compared TRUE (with !=) to the element of the first sequence 2 or 3,4 so we get overall result - TRUE.
More examples:
(1,2,3,4)>3 - TRUE (4 > 3)
(1,2,3,4)<3 - TRUE (1,2 <3)
(1,2,3,4)<5 - TRUE (1,2,3,4 < 5)
(1,2,3,4)>5 - FALSE (There is no element from the first sequence > 5 )
So if for at least one element condition is TRUE then overall result is TRUE.
Think about it as OR:
(1,2,3,4)!=1 => (1!=1) OR (2!=3) OR (3!=3) OR (4!=3)