# Why does Reduce give False on SameQ with its copy-pasted result?

If I evaluate

Reduce[#, x] & /@ {{4 x > 1, 2 x < 5}, {5 x > 1, x < 5}, {4 x > 1, x < 5}}


the result is

{1/4 < x < 5/2, 1/5 < x < 5, 1/4 < x < 5}


If I select the result and copy-paste it on a new line (that is, I am not typing by hand the inequalities) to compare it with SameQ

(Reduce[#, x] & /@ {{4 x > 1, 2 x < 5}, {5 x > 1, x < 5}, {4 x > 1,
x < 5}}) === {1/4 < x < 5/2, 1/5 < x < 5, 1/4 < x < 5}


I get False

Why is that so?

In particular, I found that out when using Length on the expressions

{Length /@ (Reduce[#, x] & /@ {{4 x > 1, 2 x < 5}, {5 x > 1,
x < 5}, {4 x > 1, x < 5}}),
Length /@ {1/4 < x < 5/2, 1/5 < x < 5, 1/4 < x < 5}}


which, surprisingly to me, leads to different results

{{5, 5, 5}, {3, 3, 3}}


Reduce is returning Inequality objects, which let's you mix inequalities like a < x <= b.

Typing a < x < b gives a Less object.

FullForm[Reduce[#, x] & /@ {{4 x > 1, 2 x < 5}, {5 x > 1, x < 5}, {4 x > 1, x < 5}}]

List[Inequality[Rational[1,4],Less,x,Less,Rational[5,2]],Inequality[Rational[1,5],Less,x,Less,5],Inequality[Rational[1,4],Less,x,Less,5]]

FullForm[{1/4 < x < 5/2, 1/5 < x < 5, 1/4 < x < 5}]

List[Less[Rational[1,4],x,Rational[5,2]],Less[Rational[1,5],x,5],Less[Rational[1,4],x,5]]


A simple example to see where Inequality comes in handy:

FullForm[a < x <= b]

Inequality[a, Less, x, LessEqual, b]


But using only < is interpreted as Less. I imagine Reduce always returns Inequality objects for consistency.

FullForm[a < x < b]

Less[a, x, b]

• But I am not typing it. I literally copy-paste the output. Why is its form not preserved? Is that a common feature of Mathematica? Apr 20, 2021 at 14:25
• When you copy it's copying the plain text, not the underlying FullForm. Apr 20, 2021 at 14:26
• This is not common in Mathematica, it's a corner case I think. Apr 20, 2021 at 14:27
• I don't quite grok Chip's last comment, but the lack of a canonical representation of inequalities is one of the mildly irritating design choices of the language (at least for me). Apr 20, 2021 at 14:31
• I agree, I'd prefer if Reduce returned Less, etc when possible. Or even have Inequality auto evaluate where possible. Apr 20, 2021 at 14:32