# Built-in symbols which are more close to the root/core of Wolfram Language

Seeing the vast scope of science covered by the Wolfram Language (WL) and the large amount of built-in symbols (functions), I am curious to know which built-in symbols are more close to the root of WL, i.e., they are wired deeper in the kernel and are less easily bypassed by tricks.

For example, when assigning UpValues the assignment tag should be at level no deeper than 2. If we make an assignment like

Clear[f,g,tag,fg]
tag/:f[g[tag]]:=fg[tag]


a warning message is displaced as

TagSetDelayed::tagpos: "Tag tag in f[g[tag]] is too deep for an assigned rule to be found."

and the evaluation returns \$Failed, because the tag is at level 3.

However, there are some built-in symbols which are not restricted by the level-2-requirement:

list = {HoldPattern, ReleaseHold, Unevaluated, Evaluate,
Refresh, Activate, IgnoringInactive};
Map[(tag /: f[#[tag]] := #) &, list];


In this code the tag is at level 3, however all assignments can be made successfully without generating error message.

Even at level 4 there is no error message for some combinations:

Map[(tag /: f[#[[1]]@#[[2]]@tag] := #) &, Tuples[list, 2]]


For example, this assignment is successful,

tag /: f[Evaluate@HoldPattern@tag] := tag


It appears that the built-in symbols in list are not considered as normal wrapper. Some of these symbols are also less easily bypassed by using tricks like assigning UpValues, for instance,

tag /: HoldPattern[tag[x_]] := x;
HoldPattern[tag[_]]


which still returns

HoldPattern[tag[_]]

It is reasonable that, out of the thousands of built-in symbols, some of them are more fundamental and the others are built basing on the fundamental ones. Can we find out these fundamental symbols? So we can at least know a bit more about the mystery behind the veil.

• Everything listed here that's still in the current version is most likely part of the core. – J. M.'s torpor May 8 '15 at 18:28
• Left hand side of definition is to some extent evaluated, so from your list ReleaseHold, Unevaluated, Evaluate, Refresh and Activate when applied to tag inside f, simply evaluate to tag. Symbols like HoldPattern or IgnoringInactive are also not "more fundamental" they just have special meaning in pattern matching and so are not taken into account when calculating how deep is tag inside pattern. – jkuczm May 8 '15 at 19:23
• One can try to find such symbols with special meaning in pattern matching by testing whether expressions involving those symbols match themselves. Evaluation of Quiet@Select[Names["System*"], With[{heldExpressions = ToExpression[#, InputForm, Function[sym, {HoldComplete[sym[x]], HoldComplete[sym[x, y]]}, HoldAllComplete]]}, ! MatchQ[heldExpressions, heldExpressions]] &] gives list of 20 such symbols. – jkuczm May 8 '15 at 21:19
• @ jkuczm, I see what you mean. When making assignments (with six operators: Set, SetDelayed, TagSet, TagSetDelayed, UpSet and UpSetDelayed), the head then all arguments of lhs are completely evaluated, but the applying of any existing rule for the last step to completely evaluate the partly evaluated lhs (using first UpValues, then DownValues and finally SubValues`) is avoided. Thank you for your comments, now my understanding of the evaluation process is strengthened. – saturasl May 9 '15 at 21:57