Desired behavior
\{ and \} should turn into \left\{ and \right\{.
Attempt 1
\edef\{{\left\{}
\edef\}{\right\}}
Error message
TeX capacity exceeded, sorry [input stack size=5000].
\font@name ->
\OT1/cmr/m/n/10
l.16 \edef\{{\left\{
}
If you really absolutely need more capacity,
you can ask a wizard to enlarge me.
Attempt 2
\documentclass{standalone}
\edef\{{\left\string{}
\edef\}{\right\string}}
\begin{document}
$\{\}$
\end{document}
Result
Error message
Missing delimiter (. inserted).
<to be read again>
{
l.7 $\{
\}$
I was expecting to see something like `(' or `\{' or
`\}' here. If you typed, e.g., `{' instead of `\{', you
should probably delete the `{' by typing `1' now, so that
braces don't get unbalanced. Otherwise just proceed.
Acceptable delimiters are characters whose \delcode is
nonnegative, or you can use `\delimiter <delimiter code>'.
! Missing delimiter (. inserted).
<to be read again>
}
l.7 $\{\}
$
I was expecting to see something like `(' or `\{' or
`\}' here. If you typed, e.g., `{' instead of `\{', you
should probably delete the `{' by typing `1' now, so that
braces don't get unbalanced. Otherwise just proceed.
Acceptable delimiters are characters whose \delcode is
nonnegative, or you can use `\delimiter <delimiter code>'.
Attempt 3
\documentclass{standalone}
\edef\{{\left\string\{}
\edef\}{\right\string\}}
\begin{document}
$\{\}$
\end{document}
Output
Related, working solutions
Doing this for \langle and \rangle works just fine:
\edef\langle{\left\langle}
\edef\rangle{\right\rangle}
Even doing this for ( and ) is a bit more complicated, but works:
\begingroup
\catcode`(\active
\xdef({\left\string(}
\catcode`)\active
\xdef){\right\string)}
\endgroup
\mathcode`(="8000
\mathcode`)="8000



\DeclarePairedDelimiterfrommathtoolsto define\braced{{x_i}^2}. – Davislor May 27 '19 at 21:10\{x_i^2\}, IMO. – Solomon Ucko May 27 '19 at 21:12