%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % writeLaTeX Example: A quick guide to LaTeX % % Source: Dave Richeson (divisbyzero.com), Dickinson College % % A one-size-fits-all LaTeX cheat sheet. Kept to two pages, so it % can be printed (double-sided) on one piece of paper % % Feel free to distribute this example, but please keep the referral % to divisbyzero.com % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % How to use writeLaTeX: % % You edit the source code here on the left, and the preview on the % right shows you the result within a few seconds. % % Bookmark this page and share the URL with your co-authors. They can % edit at the same time! % % You can upload figures, bibliographies, custom classes and % styles using the files menu. % % If you're new to LaTeX, the wikibook is a great place to start: % http://en.wikibooks.org/wiki/LaTeX % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \documentclass[10pt,landscape]{article} \usepackage{amssymb,amsmath,amsthm,amsfonts} \usepackage{multicol,multirow} \usepackage{calc} \usepackage{ifthen} \usepackage[document]{ragged2e} \usepackage{helvet} \renewcommand{\familydefault}{\sfdefault} \usepackage{wrapfig} \usepackage[fontsize=8pt]{fontsize} \usepackage[landscape]{geometry} \geometry{a4paper, landscape, margin=0.25cm} \usepackage[colorlinks=true,citecolor=blue,linkcolor=blue]{hyperref} \usepackage[ protrusion=true, activate={true,nocompatibility}, final, tracking=true, kerning=true, spacing=true, factor=1100]{microtype} \SetTracking{encoding={*}, shape=sc}{40} %%Packages added by Sebastian Lenzlinger: \usepackage{enumerate} %% Used to change the style of enumerations (see below). \newtheorem{definition}{Definition} \newtheorem{theorem}{Theorem} \newtheorem{axiom}{Axiom} \newtheorem{lem}{Lemma} \newtheorem{corr}{Corollary} \usepackage{tikz} %% Pagacke to create graphics (graphs, automata, etc.) \usetikzlibrary{automata} %% Tikz library to draw automata \usetikzlibrary{arrows} %% Tikz library for nicer arrow heads %%End %\microtypecontext{spacing=nonfrench} \ifthenelse{\lengthtest { \paperwidth = 11in}} { \geometry{top=.5cm,left=.5cm,right=.5cm,bottom=.5cm} } {\ifthenelse{ \lengthtest{ \paperwidth = 297mm}} {\geometry{top=0.3cm,left=0.3cm,right=0.3cm,bottom=0.3cm} } {\geometry{top=0.5cm,left=0.5cm,right=0.5cm,bottom=0.5cm} } } \pagestyle{empty} \makeatletter %% Renew default font \renewcommand{\section}{\@startsection{section}{1}{0mm}% {0.1mm}% {0.0001mm}%x {\normalfont\normalsize\bfseries}} \renewcommand{\subsection}{\@startsection{subsection}{2}{0mm}% {0.0001mm}% {0.00001mm}% {\normalfont\small\bfseries}} \renewcommand{\subsubsection}{\@startsection{subsubsection}{3}{0mm}% {-1ex plus -.5ex minus -.2ex}% {1ex plus .2ex}% {\normalfont\small\bfseries}} \makeatother \setcounter{secnumdepth}{0} \setlength{\parindent}{0pt} \setlength{\parskip}{0pt plus 0.5ex} % ----------------------------------------------------------------------- \title{Theory of Computer Science} \begin{document} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Custom Commands %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \renewcommand{\l}[1]{\mathcal{L}(#1)} \newcommand{\s}{\Sigma} \newcommand{\then}{\rightsquigarrow} \renewcommand{\empty}{\varnothing} \newcommand{\any}{$\forall$} \newcommand{\some}{$\exists$} \newcommand{\predux}{$\leq_p$} \newcommand{\tin}{$\in$} \newcommand{\ntin}{$\not\in$} \newcommand{\ffrom}[1]{\stackrel{(#1)}{\Rightarrow}} \raggedright \footnotesize \microtypecontext{spacing=nonfrench} \begin{multicols*}{4} \setlength{\premulticols}{0.1cm} \setlength{\postmulticols}{0.1cm} \setlength{\multicolsep}{0.1cm} \setlength{\columnsep}{0.1cm} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Finite Automata %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{Finite Automata} \textbf{From Lang. }over an alphabet $\Sigma$ is a subset of $\Sigma^*$ \textbf{DFA} is a 5-tuple $M=\langle Q\text{ the finite set of states}, \Sigma \text{ input alphabet }, \delta: Q \times \Sigma \rightarrow Q\text{ transition function }, q_0 \text{ start state }, F \subseteq Q \text { set of accept states}\rangle$ \textbf{Def. } A DFA \emph{accepts} a word $w=a_1...a_2$ if $\exists$ a seq. of states $q'_0,...,q'_n \in Q$, s.t. $q'_0=q_0,\ \delta(q'_{n-1},a_i)=q'_i, \forall i \in \{0,...,n\}$ and $q'_n\in F$. \textbf{Def. } $\mathcal{L}(M)=\{w\in\Sigma^* | w \text { is accepted by } M\}$ is the language \emph{recognized} by $M$ \textbf{NFA} is 5-tuple like \emph{DFA}, but $\delta:Q\times (\Sigma \cup \{\epsilon\}) \rightarrow \mathcal{P}(Q)$. Other diffs: $\delta$ can lead to 0 or more succ states for same $a\in\Sigma$. Can take $\epsilon$-transitions w.o. using symbol from input. \emph{NFA accepts} if $\exists$ \emph{at least one} acc. seq. of states. \textbf{$\epsilon$-closure} NFA $M$, $q\in Q$: $p$ is in $\epsilon$-closure $E(q)$ of $q$ \emph{iff.} $\exists$ seq. of states $q_{0ton}$, s.t. (1) $q'_0 = q$ (2) $q'_i \in \delta(q'_{i-1},\epsilon), \forall i\in\{1,..,n\}$ and (3) $q'_n = p$ \textbf{NFA accepts} word $w=a_1..a_n$ if $\exists$ seq. of states $q'_{0\ to \ n}$ s.t. (1) $q'_0\in E(q_0)$ (2) $q'_i\in \bigcup_{q\in\delta(q'_{i-1},a_i)} E(q), \forall i \in \{1,..,n\}$ (3) $q'n\in F$ \textbf{Thm. } Every lang. recognize by an NFA is also recognized by a DFA. \textbf{Remark } Specification of an automaton is always finite, while the recognized lang can be infinite. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Grammars %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{Grammars} \textbf{Grammar} is a 4-tuple $G = \langle V \text{ finite set of \emph{variables} }, \Sigma \text{ finite alphabet of \emph{terminal symbols} with } V\cup\Sigma=\empty, R\subseteq(V\cup\Sigma)^*V(V\cup\Sigma)^* \text{ finite set of \emph{rules} }, S\in V \textit{ start variable}\rangle$ \textbf{Derivation} ($u\Rightarrow V)$ word $v\in (V\cup \Sigma)^*$ from $u\in (V\cup \Sigma)^+$ if (1) $u=xyz, v=xy'z$ with $x,z\in (V\cup \Sigma)^*$ (2) $\exists$ rule $y\rightarrow y'\in R$. Write $u\Rightarrow^*v$ if v can be derived from u in finitely many steps. \textbf{Lang. generated} by grammar G, $\mathcal{L}(G)=\{w\in\Sigma^* | S \Rightarrow^* w\}$ %%%%%%%%%%%%%%%%%%%% %% Chomsky Hierarchy %%%%%%%%%%%%%%%%%%%% \textbf{G is \emph{type 0}}: all rules allowed \textbf{G is \emph{type 1 (context-sensitive)}}: all rules have form $\alpha B\beta \rightarrow \alpha\beta\gamma$ with $B\in V, \alpha\gamma\in (V\cup\Sigma)^*, \beta\in (V\cup\Sigma)^+$ \textbf{G is \emph{type 2 (context-free}}: all rules have from $A\rightarrow w: A\in V, w\in (V\cup\Sigma)^+$ \textbf{G is \emph{type 3 (regular)}}: all rules have form $A\rightarrow w: A\in V, w\in \Sigma \cup \Sigma V$ \textbf{Regular Grammar: } $S\rightarrow \epsilon$ always allowed if $S$ is start variable and never occurs on right side of any rule \textbf{Type 0-3 Lang} Lang $L\subseteq \Sigma^*$ is type 0/1/2/3 if $\exists$ a type 0/1/2/3 grammar $G$ with $\mathcal{L}(G)=L$ %%%%%%%%%%%%%%%%%%%%%%%%% %% Regular Languages %%%%%%%%%%%%%%%%%%%%%%%%% \section{Regular Languages} A language is regular if it generated by some regular grammar (i.e. $S\rightarrow\epsilon$ iff $S$ never on RHS). Regular grammars restrict usage of $\epsilon$ rules. But it is not necessary for the characterization of reg langs. \textbf{Thm.} $\forall G=\langle V,\Sigma, R, S\rangle \exists G'=\langle V',\Sigma, R', S\rangle, R'\subseteq (V'\cup \Sigma)^*V'(V'\cup\Sigma)*\times(V'\setminus\{S\}\cup\Sigma)^*$ s.t. $\mathcal{L}(G)=\mathcal{L}(G')$ NOTE: true for all grammars. \textbf{\emph{Proof.}} add new variable $S'\not\in V$ (1) $\forall r\in R$ add a rule $r'$ to R', where $r'$ is result of replacing all occurrences of $S$ in $w$ with $S'$ (2) $\forall\text{rules } S\rightarrow w\in R$ add a rule $S\rightarrow w'$ to $R'$, where $w'$ is result of replacing all occ. of $S$ in $w$ with $S'$. Then $\mathcal{L}(G) = \mathcal{L}(\langle V\cup\{S'\}, \Sigma, R', S\rangle\Box$ \textbf{Thm.} $\forall$ grammar $G$ with rules $R\subseteq V \times (\Sigma\cup\Sigma V \cup \{\epsilon\}), \exists$ regular grammar $G'$ with $\mathcal{L}(G)=\mathcal{L}G')$ \textbf{Thm.} Every lang recog by DFA is regular. \textbf{Thm.} For every reg grammar G $\exists$ NFA M with $\l{G}=\l{M}$ \textbf{Equivalence}$NFA \rightarrow DFA \rightarrow reg \ gram \rightarrow NFA$ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Closure props and decidablity %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %---- Closure \subsection{Def: Closure Props and Dec.ability} \textbf{Concat:} Langs $L_1, L_2$ over $\s_1,\s_2$, concat is $L_1L_2=\{w_1w_2\in (\s_1\cup\s_2)^* | w_1\in L_1, w_2\in L_2$ \textbf{Star: } Let $L^0=\{\epsilon\}, L^1=L, L^{i+1}=L^iL\ for \ i\in\mathbf{N}_0$. \emph{star} on $L$: $L^*=\bigcup_{i\geq 0}L^i$ \textbf{Closure:} $\mathcal{K}$ class of langs, $\mathcal{K}$ is \emph{closed under $\oplus$} if $L,L'\in\mathcal{K}$ implies $L\oplus L'\in \mathcal{K}$ \textbf{Thm. } RL are closed under $\cup,\cap$, complement, concat and star %---- Decidability \textbf{Decidability:} A \emph{decision problem} is a problem where (1) for given \emph{input} (2) an \emph{algo} determines if input has a given \emph{property} (3) then outputs yes/no %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Regular Expressions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \subsection{RL: Regex} \textbf{Regular expressions } over alphabet $\s$ are defined inductively: (1) $\empty, \epsilon$ are a regex (2) If $a \in \s$, then $a$ is a regex (3) If $\alpha, \beta$ are regex, then also $(\alpha\beta)\text{ concat }, (\alpha|\beta) \text{ alternative }, (a^*)\text{ Kleene closure }$ \textbf{Conventions:} ommit parenthesis, then kleene binds more than concat bind more than alternative, and parentheses for nested concat/alt are ommited, treat as left-associative, but doesn't matter. \textbf{Lang described by a Regex:} Defined inductively: Assume $\alpha,\beta$ are regex. (1) $\l{\empty}=\empty$ (2) $\l{\epsilon}=\{\epsilon\}$ (3) $\gamma=a,a\in\s,\then\l{\gamma}=\{a\}$ (4) $\gamma=(\alpha\beta)\then\l{\gamma}=\l{\alpha}\l{\beta}$ (5) $\l{(\alpha|\beta)}=\l{\alpha}\cup\l{\beta}$ (6) $\l{(\alpha^*)}=\l{\alpha}^*$ \textbf{Thms.} (1) Every \emph{finite} language can be described by a regex. (2) \any lang that can be descr. by a regex, \some NFA accepts it (3) \any lang \emph{recognized} by a DFA can be descr. by a regex (4) The set of langs that can be descr. by regexs are exactly the regular languages! %---- Generalized Nodeterministic Finite Automata \textbf{GNFAs} are like NFAs but transition labals can be arbitrary regex over input alphabet. We use special form: (1) Start state has transition to all others, but no incoming (2) one accept state $\not =$ start state (3) accept state has incomiong trans from every other state, but no outgoing (4) \any other states, one transition goes from every state to every other state \emph{including} self \textbf{GNFA accepts w} if $w=w_1...w_k$ where each $w_i\in\s^*$ and \some seq of states $q_0,...,q_k\in Q$ with (1) $q_0=q_s$ (2) $\forall i: w_i\in\l{R_i(=\delta(q_{i-1},q_i))}$ and (3) $q_k=q_a$ \textbf{DFA to GNFA: }(1) add new start state with $\epsilon$-trans to origianl start state (2) add new accept state with $\epsilon$-trans from og. acc. states (4) combine parallel transitions into one, labelled with the alternative of og labels (5) if required trans missing, add labbeled with $\empty$ \textbf{GNFA to regex (Algo)} \emph{Convert($M=\langle Q, \s, \delta, q_s, q_a\rangle)$} (1) If $|Q|=2$ return $\delta(q_s,q_a)$ (2) Select any $q\in Q\setminus\{q_s,q_a\}$ and let $M'=\langle Q\setminus \{q\}, \s, \delta', q_s, q_a\rangle$, where $\forall q_i\not = q_a, q_j\not = q_s$ we define $\delta'(q_i,q_j)=(\gamma_1)(\gamma_2)^*(\gamma_3)|(\gamma_4)$, where $\gamma_1=\delta(q_i,q),\gamma_2=\delta(q,q),\gamma_3=\delta(q,q_j),\gamma_4=\delta(q_i,q_j)$ \textbf{Thm. }Set of langs that can be descr. by regexs is exaclty the set of RLs. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Pumping Lemma %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \subsection{RL: Pumping Lemma} If L is an RL then $\exists p\in\mathbf{N}$ ( a\emph{ pumping number} for L) s.t. $\forall x \in L, |X|\geq p$ can be split into $x=uvw$ with (1) $|v|\geq1$ (2) $|uv|\leq p$ and $uv^iw\in L, \forall i=0,1,2,...$ \textbf{Application:} If L is regular, than the pumping lemma holds for L. By Controposition: If PL does not hold for L, then L cannot be regular. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% CF langs %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{Context-Free Languages} \textbf{Thm. }\any Context-free grammer G with rules $P\subseteq V\times (V\cup\s)^* \exists \text{ context-free grammar } G', \l{G}=\l{G'}$ \textbf{$\epsilon$-Rules: }As with RLs, restriction of $\epsilon$ occurances in rules is not necessary to characterize the set of context-free languages %------ CNF \textbf{CNF: } A CF grammar G is in \emph{Chomsky Normal Form} if all rules have following three forms (1) $A\rightarrow BC, A,B,C$ variables (2) $A\rightarrow a$, var A and terminal $a$ or (3) $S\rightarrow \epsilon$ start variable $S$, i.e. $P\subseteq (V\times (V'V'\cup \s))\cup \{\langle S,\epsilon\rangle\}, V'=V\setminus\{S\}$ \textbf{Thm.} \any CF grammar G \some G' in CNF with $\l{G}=\l{G'}$ \textbf{Observation} $G$ grammar in CNF and $w\in\l{G}$ non empty word generated by $G$, $\then$ \any derivations of $w$ have exactly $2|w|-1$ derivation steps! \textbf{\emph{Proof.}} \textbf{Base Case} ($|w| = 1$ since $w\not = \epsilon$): Since by construction $w\in\mathcal{L}(G)$, there is some rule $S\rightarrow w \in R$ from the start variable. Since $|w|=1$ we have $w=a\in\Sigma$ for some terminal $a$. We apply this rule in one step, and since $2\cdot |w| - 1 = 2 \cdot 1 - 1 = 1$, the base case holds.\\ \textbf{Induction Hypothesis:} Assume the statement holds for any strings $a=0$). (2) Write $n_3=1$ on to tape such that $(n_1,n_2,n_3)$ is on the tape. (3) If $n_2=0$, go to 6. (4) Simulate $M_{pred}(n_2)$ and write in to $n_2$. (5) Simulate $M_{mult}(n_1,n_3)$ and write in to $n_3$. Go to 2. (6) Move $n_3$ to beginning of the tape overwriting whats under it and deleting everything after it. Then $n_3=n_1^{n_2}$ is on the tape.$\Box$ %%%%%%%%%%%%%%%%%%%%%%% %% Comp of comput func is comput %%%%%%%%%%%%%%%%%%%%% \textbf{Composition of Comp Functions}Since $g$ and $f$ are computable, there are TMs that compute them. Call them $C_g$ and $C_f$. The following TM computes $(f \circ g)(x): \Sigma^*_1 \rightarrow_p \Sigma^*_3$:\\ $C_{fg}$ = On input $\langle\langle C_f,C_g,x\rangle\rangle$: (1)If the input is malformed, reject. (Can not really happen, we assumed well formed input.) (2) Run $C_g$ on $x$ and store it on tape where $\langle C_g, x\rangle$ was, such the tape contents are $\langle\langle C_f,C_g(x)\rangle\rangle$ If it rejects or is undefined, reject. (3)Run $C_f$ on the above result. Then we have $\langle\langle C_f(C_g(x))\rangle\rangle$ on the tape. (4) Check if what is on the tape represents anything but a correct result of computing. If not, move into a reject state. (5) Format tape content to match the definition of computing a function value of a computable function. (6) Move into an accept state. $C_{fg}$ computes $(f\circ g)(x)$, such that in the end we have $\langle\langle f(g(x))\rangle\rangle$ on the tape, and is undefined when $g(x)$ is undefined or $f(g(x))$ is undefined. $\Box$ %%%%%%%%%%%%%%%%%%%%%%% %% Trans of Redux %%%%%%%%%%%%%%%%%%%%%% \textbf{Transitivity of Redux:}Let $A\subseteq\Sigma_A^*$, $B\subseteq\Sigma_B^*$ and $C\subseteq \Sigma_C^*$ for some arbitray sets of symbols $\Sigma_A, \Sigma_B$ and $\Sigma_C$. Furthermore assume that $A\leq B$ and $B\leq C$. Since $A\leq B$, there is some total computable function $f:\Sigma_A^*\rightarrow \Sigma_B^*$. And since $B\leq C$, there is some total computable function $g:\Sigma_B^*\rightarrow\Sigma_C^*$. Note that any total function is also a partial function over the same domain. Now consider the following function $g\circ f:\Sigma_A^* \rightarrow \Sigma_C^*$. This function is computable, since the compositon of computable, partial functions is also a computable, partial function. In particular this holds for total functions. Additionally the following must hold: $x\in A\text{ iff. }g(f(x))\in C$. We distinguish two cases:\\ \textbf{Case 1:} If $x\not\in A$, then from $A\leq B$, $f(x)\not\in B$. Therefore, since $B\leq C$ we get that $g(f(x))\not\in C$.\\ \textbf{Case 2:} If $x\in A$, then, analogous to Case 1, $f(x)\in B$. It follows that since $B\leq C$, $g(f(x))\in C$.\\ Both cases are well defined because of the totality of $f$ and $g$ and $x\in A \text{ iff. } g(f(x))\in A$, given- $A\leq B$ and $B\leq C$.$\Box$ %%%%%%%%%%%%%%%%%%%%%% %% Using RT %%%%%%%%%%%%%%%%%%%%%% \textbf{Using Rice's Theorem:} (1)$L=\{w\in\{0,1\}^*|M_w$\\$ \text{ computes unary func over nat nos which is undef on input 0}\}$ \emph{Sol:} Use RT with $\mathbf{S}=\{f\in\mathbf{R}|f:\mathbb{N}_0\rightarrow\mathbb{N}_0, f(0)=undef\}$ (2)$L = \{ w \in \{0,1\}^* \mid M_w \text{ halts on all inputs} \} $\emph{Sol:} RT not applicable, but if was asked to halt also in valid config, then use set of all total comp funcs. (3)$L = \{ w \in \{0, 1, \}^* \mid M_w \text{ always halts after an even number of steps} \}$ \emph{Sol:} RT not app since even no of steps prop of computation, not computed func. (4) $L = \{ w \in \{0, 1, \}^* \mid M_w \text{ computes the binary multiplication function } \text{mul} : \mathbb{N}_0^2 \rightarrow \mathbb{N}_0 \text{ with } \text{mul}(x, y) = x \cdot y \}$\emph{Sol:} RT applicable with $\mathbf{S}=\{mul\}$. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Undecidability of emptyness problem %%%%%%%%%%%%%%%%%%%%%%%%%%%%% \textbf{Undec if Emptiness problem:}\emph{Def:} Given general (type-0) grammar $G$, is $\l{G}=\empty$? \emph{Proof:} Use $\text{ComputesUndef} = \{ w \in \{0, 1\}^* \mid \text{DTM } M_w \text{ computes the partial function } \Omega \}$ $\Omega$ is part func undef on all input words. it is computable with DTM that always enters infinite loop. With $\mathbf{S}=\{\Omega\}$ and RT it is undec. Now $CompUndef\leq Emptyness$: M: Input $w \in \{0, 1\}^*$: Sim $M_w$ on input $x$. If the sim rejects or does not terminate, $M$ does the same. If the sim of $M_w$ on $x$ accepts, $M$ then checks if the tape content and head position correspond to a configu of a valid computation result. If yes, $M$ accepts $x$; otherwise, it rejects. $f(w) = \text{the grammar equivalent to the comp func from hint}$ where $f(w)$ computes $\Omega$ Redux $f$ is total and computable. And, it holds that $w \in \text{ComputesUndef} \iff M_w$ computes $\Omega$ $\iff M$ does not accept any input $\iff L(M) = \emptyset \iff L(f(w)) = \emptyset \iff f(w) \in \text{Emptiness}$ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Nodeterministic Algos %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \textbf{HittingSet}\emph{G:} finit $U\not=\empty$, finite set of sets $S=\{S_1,..,S_n\},S_i\subseteq U \forall S_i\in S$, $k\in\mathbb{N}_0$ \emph{Q:}$\exists H\subseteq U, |H|\leq k, s.t. \ \S_i\cap H\not=\empty \forall S_i\in S$? \textbf{HS G\& Check algo:} In: $U, S_i \ for \ i\in\{1,..,n\},k\then$ $rem:= S$; FOR $i=1$ TO $k$:\{ GUESS $e\in U$; $rem:= rem\setminus\{S_i|S_i\in S, e \in S_i\};$\} IF $rem==\empty$:\{ACCEPT;\} REJECT $\Box$ \textbf{SetPacking is NP-Compete:} \emph{G:} fin set $M$, Set of Sets $\mathbf{S}=\{S_1,..,S_n\},S_i\subseteq M \forall i\in\{1,..,n\}$, $k\in\mathbb{N}_0$ \emph{Q:} \some $\mathbf{S}'\subseteq\mathbf{S}, |\mathbf{S}'|\geq k$ s.t. \any set in $\mathbf{S}' $ are pairwise disjoint. \emph{SOL}(1) SetPacking is in NP: Input $S,k$: $\mathbf{S}' =\empty $; FOR $i=1$ TO $k$: \{ GUESS $S\in \mathbf{S}$; if $S\in\mathbf{S}'$: REJECT; FOR $S'\in \mathbf{S} '$: \{ IF $S\cap S'$: REJECT\}; $\mathbf{S} ':= \mathbf{S} ' \cup \{S\}$ END;\} ACCEPT$\Box$ \end{multicols*} \end{document}