# Question on Inactivate with Hold and HoldForm

I am a little bit puzzled by the following, for me inconsistent, behaviour of Inactivate.

expr=HoldForm[f[a,b]];
Inactivate[expr] // InputForm
(* HoldForm[f[a, b]] *)


Nothing has happened. The documentation states, a little bit vague: Hold maintains expressions in unevaluated form, and all parts are inactive. With respect to the second statement, observe that the parts inside Hold are not wrapped in Inactive.

expr={HoldForm[f[a,b]]};
Inactivate[expr] // InputForm
(* {HoldForm[f[a, b]]} *)


This is as above. However:

Inactivate /@ expr // InputForm
(* {HoldForm[Inactive[f][a, b]]} *)


Mathematica has to evaluate {Inactivate[HoldForm[f[a,b]]]}, for which, according to the first example, I would have expected {HoldForm[f[a,b]]}. However, in this situation the heads have been inactivated.

Is there any documentation on this phemomenon? More precisely: under what conditions are the heads in an held expression explicitely inactivated and when not?

• How very odd. Inactivate[Hold[f[a, b]]] works as expected, but the indirect approach you demonstrate does not. Commented Dec 28, 2016 at 20:44

Inactivate is HoldFirst. So, it applies Inactive where it can to the unevaluated argument, and then returns the argument. In your example, expr (unevaluated) has no Head to inactivate, so Inactivate[expr] returns expr, which then evaluates to HoldForm[f[a,b]].
• Further evidence in favor of this answer: expr = HoldForm[f[a, b]]; Inactivate[Evaluate@expr] // InputForm Commented Dec 28, 2016 at 22:11