You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

212 lines
5.3 KiB

1 year ago
  1. \renewcommand{\phi}{\varphi}
  2. \renewcommand{\implies}{\rightarrow}
  3. \newcommand{\imp}{\rightarrow}
  4. \newcommand{\entails}{\enspace \vdash \enspace}
  5. \newcommand{\ent}{\enspace \vdash \enspace}
  6. \newcommand{\eqv}{\leftrightarrow}
  7. \newcommand{\biimp}{\leftrightarrow}
  8. \newcommand{\lxor}{\oplus}
  9. \newcommand{\nentails}{\nvdash}
  10. \newcommand{\nmodels}{\nvDash}
  11. \newcommand{\true}{\ensuremath{\top}}
  12. \newcommand{\false}{\ensuremath{\bot}}
  13. % multiple choice itemize
  14. \newcommand{\ticked}{\ensuremath{\boxtimes}}
  15. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  16. % TSEITIN rules
  17. \newcommand{\tseitinAnd}[3]{
  18. \def\CHI{#1}%
  19. \def\PHI{#2}%
  20. \def\PSI{#3}%
  21. \ensuremath{(\lnot \CHI \lor \PHI) \land (\lnot \CHI \lor \PSI) \land (\lnot \PSI \lor \lnot \PSI \lor \CHI)}%
  22. }
  23. \newcommand{\tseitinOr}[3]{
  24. \def\CHI{#1}%
  25. \def\PHI{#2}%
  26. \def\PSI{#3}%
  27. \ensuremath{(\lnot \PHI \lor \CHI) \land (\lnot \PSI \lor \CHI) \land (\lnot \CHI \lor \lnot \PHI \lor \PSI)}%
  28. }
  29. \newcommand{\tseitinNot}[2]{
  30. \def\CHI{#1}%
  31. \def\PHI{#2}%
  32. \ensuremath{(\lnot \CHI \lor \lnot \PHI) \land (\CHI \lor \PHI)}%
  33. }
  34. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  35. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  36. % DPLL helper
  37. \newenvironment{dplltabular}[1]
  38. {\begin{tabular}{ |l|*{#1}{c|} } \hline}
  39. {\end{tabular}}
  40. \ExplSyntaxOn
  41. \NewDocumentCommand{\dpllrow}{m}
  42. {
  43. \seq_set_split:Nnn \l_row {|} { #1 }
  44. \seq_use:Nn \l_row { & }
  45. \\
  46. \hline
  47. }
  48. \seq_new:N \l_row % allocate a sequence
  49. \ExplSyntaxOff
  50. \newcommand{\dpllStep}[1]{
  51. Step & \dpllrow{#1}
  52. }
  53. \newcommand{\dpllDecL}[1]{
  54. Decision Level & \dpllrow{#1}
  55. }
  56. \newcommand{\dpllAssi}[1]{
  57. Assignment & \dpllrow{#1}
  58. }
  59. \newcommand{\dpllBCP}[1]{
  60. BCP & \dpllrow{#1}
  61. }
  62. \newcommand{\dpllPL}[1]{
  63. PL & \dpllrow{#1}
  64. }
  65. \newcommand{\dpllDeci}[1]{
  66. Decision & \dpllrow{#1}
  67. }
  68. \newcommand{\dpllClause}[3]{
  69. \def\ITEM{#1}%
  70. \def\CLAUSE{#2}%
  71. Cl. \ITEM: \CLAUSE & \dpllrow{#3}
  72. }
  73. \ExplSyntaxOn
  74. \NewDocumentCommand{\clause}{m}
  75. {
  76. \seq_set_split:Nnn \l_clause {;} { #1 }
  77. \seq_use:Nn \l_clause { \lor }
  78. }
  79. \seq_new:N \l_clause % allocate a sequence
  80. \ExplSyntaxOff
  81. \ExplSyntaxOn
  82. \NewDocumentCommand{\cube}{m}
  83. {
  84. \seq_set_split:Nnn \l_cube {;} { #1 }
  85. \seq_use:Nn \l_cube { \land }
  86. }
  87. \seq_new:N \l_cube % allocate a sequence
  88. \ExplSyntaxOff
  89. \newcommand{\cmark}{\ding{51}}
  90. \newcommand{\xmark}{\ding{55}}
  91. \newcommand{\done}{\cmark}
  92. \newcommand{\conflict}{\{\} \xmark}
  93. \NewEnviron{conflictgraph}[1][1.5cm]{%
  94. \begin{tikzpicture}[->,
  95. >=stealth',
  96. shorten >=1pt,
  97. auto,
  98. node distance=#1,
  99. thick,
  100. base node/.style={circle,draw,minimum size=20pt},
  101. real node/.style={double,circle,draw,minimum size=20pt}]
  102. \BODY
  103. \end{tikzpicture}
  104. }
  105. \newcommand*\circled[1]{\tikz[baseline=(char.base)]{
  106. \node[shape=circle,draw,inner sep=1.5pt] (char) {#1};}}
  107. \tikzset{
  108. line/.style={-},
  109. dot/.style={decoration={
  110. markings,
  111. mark=at position #1 with {\draw circle (2pt);}},postaction={decorate}},
  112. fulldot/.style={decoration={
  113. markings,
  114. mark=at position #1 with {\fill circle (2pt);}},postaction={decorate}},
  115. }
  116. \newenvironment{scprooftree}[1]%
  117. {\gdef\scalefactor{#1}\begin{center}\proofSkipAmount \leavevmode}%
  118. {\scalebox{\scalefactor}{\DisplayProof}\proofSkipAmount \end{center} }
  119. \tikzset{
  120. line/.style={-},
  121. dot/.style={decoration={
  122. markings,
  123. mark=at position #1 with {\draw circle (2pt);}},postaction={decorate}},
  124. fulldot/.style={decoration={
  125. markings,
  126. mark=at position #1 with {\fill circle (2pt);}},postaction={decorate}},
  127. }
  128. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  129. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  130. % BDD helper
  131. \newenvironment{cofactors}
  132. {\begin{tabbing}}
  133. {\end{tabbing}}
  134. \NewEnviron{bdd}[1][3em]{%
  135. \begin{tikzpicture}[node distance=#1,
  136. base node/.style={circle,draw,minimum size=20pt},
  137. func node/.style={rectangle,draw,minimum size=10pt},
  138. cofactor/.style={circle,draw,minimum size=10pt},
  139. phantom/.style={circle,draw,inner sep=0pt,minimum size=0pt}]
  140. \BODY
  141. \end{tikzpicture}
  142. }
  143. \newcommand{\funcEdge}[3][]{
  144. \path[] (#2) edge [#1] (#3);
  145. }
  146. \newcommand{\thenEdge}[3][]{
  147. \path[] (#2) edge [#1] (#3);
  148. }
  149. \newcommand{\elseEdge}[3][]{
  150. \path[] (#2) edge [#1] node [midway,draw,circle,fill=white,transform shape,inner sep=0pt,minimum size=0.3em] (ref) {} (#3);
  151. }
  152. \newcommand{\negatedEdge}[3][]{
  153. \path[] (#2) edge [#1] node [midway,draw,circle,fill=black,transform shape,inner sep=0pt,minimum size=0.3em] (ref) {} (#3);
  154. }
  155. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  156. \NewEnviron{egraph}[1][1.5cm]{%
  157. \begin{tikzpicture}[-,
  158. >=stealth',
  159. shorten >=1pt,
  160. auto,
  161. node distance=#1,
  162. thick,
  163. base node/.style={circle,draw,minimum size=20pt}]
  164. \BODY
  165. \end{tikzpicture}
  166. }
  167. \newcommand{\chord}[2]{
  168. \draw[dashed,red] (#1) -- (#2);
  169. }
  170. \newcommand{\egraphFuncConstraint}[3]{%
  171. &((e_{#1=#2}~\land~e_{#2=#3})~\imp~e_{#1=#3})~\land\\
  172. &((e_{#1=#2}~\land~e_{#1=#3})~\imp~e_{#2=#3})~\land\\
  173. &((e_{#1=#3}~\land~e_{#2=#3})~\imp~e_{#1=#2})
  174. }
  175. \newcommand{\eq}[2]{
  176. e_{#1=#2}
  177. }
  178. \newcommand{\ackermannFuncConstraint}[3]{%
  179. (#2=#3~\imp~#1_{#2}=#1_{#3})
  180. }