I have noticed that

TrueQ @ (And @@ {False, True, True, True})

gives False and, on the contrary,

TrueQ @ And @@ {False, True, True, True}


False[False, True, True, True]

The disparity is probably explained here: TrueQ returning False on true statement: "TrueQ does not attempt to resolve equivalencies:TrueQ will return True only if the input is explicitly True". Indeed, by means of

a = And @@ {False, True, True, True};
{SameQ[a, True],TrueQ @ a}

we get {False,False}

But the point now is: why FullForm[a] is False ?

Reading the help : "FullForm acts as a "wrapper", which affects display, but not evaluation". Therefore FullForm[a] should give False[False,True,True,True].

My first thought was about the HoldAll attribute (which FullForm have not) but I was wrong:

fullForm = FullForm;
SetAttributes[fullForm, HoldAll];

still evalutes to False. Any hints ? Thanks !

  • 3
    $\begingroup$ No: this is precedence of operators: TrueQ @ And @@ {False, True, True, True} first evaluates to TrueQ[And] @@{False, True, True, True} which then evaluates to False@@{False,True,True,True} and then to False[False, True, True, True]. $\endgroup$
    – march
    Mar 11, 2016 at 17:22
  • 2
    $\begingroup$ Of course, And @@ {False, True, True, True} immediately becomes And[False, True, True, True], and the short-circuit property of And[] has it evaluate to False. For TrueQ @ And @@ {False, True, True, True}, have a look at FullForm[Hold[TrueQ @ And @@ {False, True, True, True}]]. $\endgroup$ Mar 11, 2016 at 17:25
  • $\begingroup$ Thanks for replies ! (1) About the operators precedence: I smelled something but, strangely, TrueQ is not mentioned in tutorial/OperatorInputForms ( and that made me quite doubtful. Now I see. (2) About FullForm: I'm still confused: given that FullForm and FullForm @ Hold are not equivalent, what does it mean "wrapper", as, quoted from help, in the question above ? $\endgroup$ Mar 11, 2016 at 18:22

1 Answer 1

  1. In a = And @@ {False, True, True, True}; the right had side is evaluated before making the assignment. At that point a with either be held verbatim as a or it will evaluate to False.

  2. As march noted TrueQ @ And @@ {False, True, True, True} is not evaluating in the order you probably think it is. TrueQ[And] works as expected, and this new head (False) is Applied to your List expression.

  3. Indeed FullForm acts as a formatting wrapper; it will not prevent things inside it from evaluating. If you want that try the HoldForm wrapper as well:

    HoldForm[ FullForm[ TrueQ[And][1 + 1, 2 + 2] ] ]
    TrueQ[And][Plus[1, 1], Plus[2, 2]]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.