📚 The CoCalc Library - books, templates and other resources
License: OTHER
\documentclass{article}1\usepackage[pdftex,active,tightpage]{preview}2\setlength\PreviewBorder{2mm}34\usepackage[utf8]{inputenc} % this is needed for umlauts5\usepackage[ngerman]{babel} % this is needed for umlauts6\usepackage[T1]{fontenc} % this is needed for correct output of umlauts in pdf7\usepackage{amssymb,amsmath,amsfonts} % nice math rendering8\usepackage{braket} % needed for \Set9\usepackage{algorithm,algpseudocode}1011\algnewcommand\True{\textbf{true}\space}12\algnewcommand\False{\textbf{false}\space}13\algnewcommand{\LineComment}[1]{\State \(\triangleright\) #1}14\begin{document}15\begin{preview}16\begin{algorithm}[H]17\begin{algorithmic}18\Require Klauselmenge $K$, Symbolmenge $S$, (partielles) Modell $M$1920\Procedure{DPLL}{$K$, $S$, $M$}21\If{Alle Klauseln sind wahr in $M$}22\State \Return \texttt{true}23\EndIf2425\If{Eine Klausel ist falsch in $M$}26\State \Return \texttt{false}27\EndIf28\\2930\LineComment{Eine Einheitsklausel hat nur ein Literal}31\State $K_i, P, Wert \gets \Call{FindeEinheitsklausel}{K, S, M}$32\If{$P$ existiert}33\State $M \gets \Call{SetzePInModell}{P, Wert, M}$34\State \Return $\Call{DPLL}{K \setminus \Set{K_i}, S \setminus \Set{P}, M}$35\EndIf36\\3738\LineComment{Ein reines Literal ist eines, das in jeder Klausel}39\LineComment{immer wahr bzw. immer falsch ist}40\LineComment{Dieser Schritt ist der Grund,}41\LineComment{warum DPLL nicht immer alle Lösungen findet}42\State $P, Wert \gets \Call{FindeReinesLiteral}{K, M}$43\If{$P$ existiert}44\State $M \gets \Call{SetzePInModell}{P, Wert, M}$45\State $K \gets \Call{EntferneWahreKlauseln}{K, M}$46\State \Return $\Call{DPLL}{K, S \setminus \Set{P}, M}$47\EndIf48\\4950\State $P \gets S.pop()$ \Comment{Symbolmenge schrumpft}51\State $M_1 \gets \Call{SetzePInModell}{P, \texttt{true}, M}$52\State $M_2 \gets \Call{SetzePInModell}{P, \texttt{false}, M}$53\State \Return $\Call{DPLL}{K, S, M_1} \lor \Call{DPLL}{K, S, M_2}$54\EndProcedure55\end{algorithmic}56\caption{DPLL-Verfahren}57\label{alg:dpll}58\end{algorithm}59\end{preview}60\end{document}616263