Personally, I keep all of my math macros in a separate LyX file that I can then include from other LyX documents (via Insert > File > Child Document). The solution requires placing some of the LaTeX code in a LyX preamble (because LyX macros can't handle the \mathpalette macro's structure). So I also have a separate LaTeX file for the preamble code, which I can then \input{…} in the "LaTeX preamble" setting of both the child and parent LyX documents.
In math-macros-preamble.tex, I place:
\newcommand{\semanticlogic}[2]{\ooalign{$\m@th#1\ocircle$\cr\scalebox{0.9}[1]{$\m@th#1#2$}\cr}}
\newcommand{\encircled}[1]{\mathpalette\semanticlogic{#1}}
\semanticlogic is a macro that takes as its arguments (1) the style macro (provided by \mathpalette) and (2) the operator to be encircled. The \encircled macro wraps \mathpalette so that it's easy to use inside a LyX macro.
In math-macros.lyx, I add \input{math-macros-preamble} to its preamble, then define a macro from \newcommand{\oimplies}{\mathbin{\encircled{\shortrightarrow}}}, giving it a LyX representation like \mathbin{$\ocircle\shortrightarrow$} so that it looks nicer when inlined into the parent document. Similarly, I create \onot as \encircled{\mkern1mu \neg}.
In the parent document, where I use the logic operators, I also add \input{math-macros-preamble} to its preamble, and include math-macros.lyx as a child document.
