皮尔斯的逻辑联结符号

皮尔斯的逻辑联结符号

如何写出逻辑联结词的皮尔斯符号? 在此处输入图片描述

我曾在这里看到过这些符号文章

答案1

也许使用tikz并编写一个简短的宏:

\documentclass{article}
\usepackage{tikz}

\newcommand{\piercebox}[1]{%
 \def\parr{{#1}}%
 \tikz[line cap=round,scale=.25]{
  \pgfmathparse{\parr[0]}
  \draw[black!0] (0,0) -- (0,1) -- (1,1) -- (1,0);
  \ifnum\pgfmathresult=1
   \draw (0,0) -- (0,1);
  \fi
  \pgfmathparse{\parr[1]}
  \ifnum\pgfmathresult=1
   \draw (1,0) -- (1,1);
  \fi
  \pgfmathparse{\parr[2]}
  \ifnum\pgfmathresult=1  
   \draw (0,1) -- (1,1);
  \fi
  \pgfmathparse{\parr[3]}
  \ifnum\pgfmathresult=1
   \draw (0,0) -- (1,0);
  \fi
  \pgfmathparse{\parr[4]}
  \ifnum\pgfmathresult=1
   \draw (0,0) -- (1,1);
  \fi
  \pgfmathparse{\parr[5]}
  \ifnum\pgfmathresult=1
   \draw (1,0) -- (0,1);
  \fi
 }%
}

\begin{document}

\piercebox{1,0,0,0,0,0}
\piercebox{0,1,0,0,0,0}
\piercebox{0,0,1,0,0,0}
\piercebox{0,0,0,1,0,0}
\piercebox{0,0,0,0,1,0}
\piercebox{0,0,0,0,0,1}

\bigskip

\piercebox{1,1,1,1,1,1}

\piercebox{1,1,1,0,1,1}
\piercebox{1,0,1,1,1,1}
\piercebox{0,1,1,1,1,1}
\piercebox{1,1,0,1,1,1}

\piercebox{0,1,0,1,1,1}
\piercebox{1,0,0,1,1,1}
\piercebox{1,1,0,0,1,1}
\piercebox{0,0,1,1,1,1}
\piercebox{0,1,1,0,1,1}
\piercebox{1,0,1,0,1,1}

\piercebox{0,0,1,0,1,1}
\piercebox{1,0,0,0,1,1}
\piercebox{0,1,0,0,1,1}
\piercebox{0,0,0,1,1,1}

\piercebox{0,0,0,0,1,1}

\end{document}

得出的结果是:

在此处输入图片描述

答案2

在此处输入图片描述

图片模式来救援:

\documentclass{article}

\newcommand\zz[6]{%
\begin{picture}(10,10)
\ifnum#1=1 \put(0,0){\line(1,0){10}}\fi
\ifnum#2=1 \put(10,0){\line(0,1){10}}\fi
\ifnum#3=1 \put(0,10){\line(1,0){10}}\fi
\ifnum#4=1 \put(0,0){\line(0,1){10}}\fi
\ifnum#5=1 \put(0,0){\line(1,1){10}}\fi
\ifnum#6=1 \put(0,10){\line(1,-1){10}}\fi
\end{picture}}

\begin{document}


\zz111111 + \zz010101 + \zz000011 + \zz111110

\end{document}

答案3

主题的变体picture。这提供了适应当前字体大小的符号。需要较小的符号,例如文章中的表 5。

\documentclass{article}
\usepackage{amsmath}
\usepackage{pict2e}

\makeatletter
\DeclareRobustCommand{\peirceconn}[1]{%
  % #1 = four bit binary number: top, left, right, bottom
  % 0 = false, 1 = true
  \mathrel{\mathpalette\peirce@conn{#1}}%
}
\newcommand{\peirce@conn}[2]{%
  \peirce@@conn#1#2....\@nil
}
\def\peirce@@conn#1#2#3#4#5#6\@nil{
  \settoheight{\unitlength}{$#1F$}
  \begin{picture}(1.2,1)
  \roundcap
  \peirce@linethickness{#1}
  \ifnum#2=0 % top is false
    \Line(0.1,1)(1.1,1)
  \fi
  \ifnum#3=0 % left is false
    \Line(0.1,0)(0.1,1)
  \fi
  \ifnum#4=0 % right is false
    \Line(1.1,0)(1.1,1)
  \fi
  \ifnum#5=0 % bottom is false
    \Line(0.1,0)(1.1,0)
  \fi
  \Line(0.1,0)(1.1,1)
  \Line(0.1,1)(1.1,0)
  \end{picture}
}
\newcommand{\peirce@linethickness}[1]{%
  \linethickness{%
    \fontdimen8
      \ifx#1\displaystyle\textfont\else
      \ifx#1\textstyle\textfont\else
      \ifx#1\scriptstyle\scriptfont\else
      \scriptscriptfont\fi\fi\fi 3
  }%
}
\makeatother

\begin{document}

$\peirceconn{0000}$
$\peirceconn{0001}$
$\peirceconn{0010}$
$\peirceconn{0100}$
$\peirceconn{1000}$
$\peirceconn{1100}$
$\peirceconn{1010}$
$\peirceconn{1001}$
$\peirceconn{0110}$
$\peirceconn{0101}$
$\peirceconn{0011}$
$\peirceconn{0111}$
$\peirceconn{1011}$
$\peirceconn{1101}$
$\peirceconn{1110}$
$\peirceconn{1111}$

$x\peirceconn{1111}y\frac{x\peirceconn{1110}y}{x\peirceconn{0001}y}$

\footnotesize

$x\peirceconn{0101}y$

\Large

$x\peirceconn{1010}y$

\end{document}

在此处输入图片描述

与原表比较

在此处输入图片描述

相关内容