%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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[landscape]{geometry}
\geometry{a4paper, landscape, margin=0.5in}
\usepackage[colorlinks=true,citecolor=blue,linkcolor=blue]{hyperref}
\usepackage{helvet}
\renewcommand{\familydefault}{\sfdefault}

%%Packages added by Sebastian Lenzlinger:
\usepackage{enumerate} %% Used to change the style of enumerations (see below).

\newtheorem{definition}{Definition}
\newtheorem{theorem}{Theorem}
\newtheorem{ax}{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

\ifthenelse{\lengthtest { \paperwidth = 11in}}
    { \geometry{top=.5in,left=.5in,right=.5in,bottom=.5in} }
	{\ifthenelse{ \lengthtest{ \paperwidth = 297mm}}
		{\geometry{top=1cm,left=1cm,right=1cm,bottom=1cm} }
		{\geometry{top=1cm,left=1cm,right=1cm,bottom=1cm} }
	}
\pagestyle{empty}
\makeatletter
\renewcommand{\section}{\@startsection{section}{1}{0mm}%
                                {-1ex plus -.5ex minus -.2ex}%
                                {0.5ex plus .2ex}%x
                                {\normalfont\large\bfseries}}
\renewcommand{\subsection}{\@startsection{subsection}{2}{0mm}%
                                {-1explus -.5ex minus -.2ex}%
                                {0.5ex plus .2ex}%
                                {\normalfont\normalsize\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{Discrete Mathamatics HS22 UniBas}

\begin{document}
\newcommand{\mcv}{\mathcal{V}}
\newcommand{\mcf}{\mathcal{F}}
\newcommand{\mcp}{\mathcal{P}}
\newcommand{\mcc}{\mathcal{C}}
\newcommand{\mcs}{\mathcal{S}}
\newcommand{\sig}{\mathcal{S} = \langle \mathcal{V},\mathcal{C},\mathcal{F},\mathcal{P}\rangle}
\newcommand{\natzero}{\mathbb{N}_0}
\newcommand{\natone}{\mathbb{N}_1}
\newcommand{\mci}{\mathcal{I}}
\newcommand{\intp}{\mathcal{I}=\langle U, \cdot^\mathcal{I}}
\newcommand{\toia}[1]{{#1}^{\mathcal{I},\alpha}}
\newcommand{\iam}[1]{\mathcal{I},\alpha\models #1}
\newcommand{\niam}[1]{\mathcal{I},\alpha\not\models #1}



\raggedright
\footnotesize
\begin{multicols*}{3}
\setlength{\premulticols}{1pt}
\setlength{\postmulticols}{1pt}
\setlength{\multicolsep}{1pt}
\setlength{\columnsep}{1pt}

\textbf{Induction}
\textbf{Weak: }I.H. only supposes $P(k)$ is true for $k=n$; \textbf{Strong(/Complete): }for all $ k \in \natzero$.\\
\emph{Are there statements that only are provable w/ strong ind. but not w/ weak?} We can always use a stronger statement.

\textbf{Sets}\\
\textbf{Def. Set. }A \emph{set} is an \emph{unordered collection} if \emph{distinct} objects.\\
\textbf{Axiom of Extensionality.} Two sets are equal if they contain the same elements.\\
\textbf{Set Ops.}\\
\emph{Intersection: }$A\cap B = \{x|x\in A \text{ and } x\in B\}$\\
\emph{Union: }$A\cup B = \{x|x\in A \text{ or } x\in B\}$\\
\emph{Set Diff: }$A\setminus B = \{x|x\in A \text{ and } x\not\in B\}$\\
\emph{Complement: }$\overline{A}=B\setminus A$, where $A\subseteq B$ and $B$ is the set of \emph{all} considered objects (in a given context).\\
\textbf{Theorems. }\\
\emph{Commutativity: }
  $  A\cup B = B\cup A$;
  $  A\cap B = B\cap A$
\emph{Associativity: }$(A\cup B) \cup C = A \cup (B \cup C)$; same for $\cap$.
\emph{Distrubution: }$A\cup(B\cap C) = (A\cup B) \cap (A\cup C)$; $A\cap(B\cup C) = (A\cap B) \cup (A\cap C)$
\emph{De Morgan: }$\overline{A\cup B}=\overline{A}\cap\overline{B}$;$\overline{A\cap B}= \overline{A}\cup\overline{B}$.
\textbf{Theorems for finite sets.}
$\lvert A\cup B\rvert = \lvert A\rvert + \lvert B\rvert - \lvert A \cap B\rvert$;\emph{Disjoint sets: }$\lvert A\cup B\rvert = \lvert A\rvert + \lvert B\rvert$\\
$\lvert\mathcal{P}(S)\rvert=2^{\lvert S \rvert}$;\\
\emph{Card. of a finite Set.} Finite set $S$: $\vert \mathcal{P}(S)\rvert= 2^{\lvert S\rvert}$;
$|A|=|B|$ for any sets if there is a bijection from $A$ to $B$;
$|A|\leq |B|$ if there is an injection from $A$ to $B$;
$|A|<|B|$ if $|A|\leq |B|$ and $|A|\not = |B|$;
A set $A$ is countable if $|A|\leq |\mathbb N_0|$;
If $A$ is a countable set, then every $B\subseteq A$ is also countable.;
If $A$ and $B$ are countable, then so is $A\cup B$.;
A countale union of countable sets is countable.;
\textbf{Theorem. }The set $B=\{b | b\text{ is a binary tree}\}$ is countable. \emph{Proof.}
For $n\in\natzero$ the set $B_n$ of all binary trees with $n$ leaves is finite. With $M = \{B_i | i \in \natzero$ the set of all binary trees is $\bigcup_{B'\in M}B'$. Since $M$ is a countable set of countable sets, $B$ is countable. q.e.d.\\
\textbf{Cantors Theorem. } For every set $S$ it holds that $|S|<|\mathcal{P}(S)|$\\
\textbf{}{Tuples: }
Two $n$-tuples $x=(x_1,x_2,...,x_n)$ and $y=(y_1,y_2,...,y_n)$ are equal$(x=y)$, if $x_i=y_i$ for  all $i\in\{1,2,3,...,n\}$
    
\underline{\textbf{Binary Relations}}\\
\textbf{Properties of homogeneous bin. Relations}
homogen. means $R\subseteq A\times A$
\textbf{Def. }\emph{reflexive:} Bin.rel. $R$ over set $A$ where for all $a\in A$ it holds that $(a,a)\in R$. \emph{irreflexive:} Bin.rel. $R$ over set $A$ where for all $a\in A$ it holds that $(a,a)\not\in R$. \emph{symmetric:} Bin.rel. $R$ over set $A$ where for all $a,b\in A$ $(a,b)\in R$ iff. $(b,a)\in R$. \emph{asymmetric:} Bin.rel. $R$ over set $A$ where for all $a,b\in A$, if $(a,b)\in R$ then $(b,a)\not\in R$. \emph{antisymmetric:} Bin.rel. $R$ over set $A$ where for all $a,b\in A$, where $a\not=b$, if $(a,b)\in R$ then $(b,a)\not\in R$. \emph{transitivity:} Bin.rel. $R$ over set $A$ where for all $a,b,c\in A$ it holds that if $(a,b)\in R$ and $(b,c)\in R$ then $(a,c)\in R$. \\
Bin.rel. $R$ over set $A$:
$(i)$ irreflexiv and antisymmetric iff. asymetric.

\underline{\textbf{Classes of relations}}\\
\textbf{Def. Equivalence Relation:} reflexiv, symmetric and transitive\\
\underline{Def. Partition:}
A \emph{partition} of a set $S$ is a set $P\subseteq\mathcal{P}(S)$ where (i) $X\not=\emptyset$, for all $X\in P$ (ii) $\bigcup{X}_{X\in P} = S$ (iii) $X \cap Y = \emptyset$ for all $X,Y\in P$ with $X\not=Y$. Members of $P$ are called blocks.
\emph{Examples: }(i) $\emptyset$ has exactly one partition, namely $\emptyset$. Note that this \emph{is} the partition, not the member of the partition. (ii) For any \emph{non-empty} set $X, P=\{X\}$ is the \emph{trivial partition}.(iii) For any \emph{non-empty proper subset} $A$ of a set $S$. $\{A,S\setminus A\}$ is a partition. Every $s\in S$ is in exactly one block $X\in P $.\\
\underline{Def. Equivalence Class:} For an equ.rel. $R$ over $S$ and any$x\in S$ the \emph{equivalence class of $x$} is the set $[x]_R=\{y\in S\mid xRy\}$\\
\textbf{Def. Partial order($\preccurlyeq$):} reflexiv, antisymmetric and transitive\\
\underline{Theorem }A partition $P$ of a set $S$ induces a relation $\sim_P$ which is an eq.rel. and for an eq.rel.$R$ the set $P=\{[x]_R|x\in S\}$ of equivalence classes is a partition.\\
\underline{Def. Least/Greates Element: } Let $\preccurlyeq$ over $S$ be  a partial order. $x\in S$ is a \emph{least (greatest)} element of $S$ if \emph{for all $y\in S, x\preccurlyeq y \ (y \preccurlyeq x)$}\\
\underline{Theorem: } The least/greates element is unique.\\
\underline{Def. minimal/maximal Element: } $\preccurlyeq$ P.O. over $S$. $x\in S$ is \emph{maximal element} if \emph{there is no $y \in S$ with $x\preccurlyeq y$ and $x\not=y$}. $x\in S$ is \emph{minimal element} if \emph{there is no $y \in S$ with $y\preccurlyeq x$ and $x\not=y$}. \\
\textbf{Def. Total Relation: } A bin.rel. $R$ is \emph{total (or connex)} if for all $x,y\in S$ either $xRy$ or $yRx$ is true. I.E. there are no elements with $x\not\preccurlyeq x$ and $y\not\preccurlyeq x$.\\
\textbf{Def. Total Order: } total and a partial order.\\
\textbf{Def. Strict order($\prec$): }irreflexive, asymmetric and transitive\\
\underline{Trichotomy: }A bin.rel. $R$ over $S$ is called \emph{trichotomous } if for all $x,y\in S$ either $xRy$ or $yRx$ or $x=y$(exactly one) is true.\\

\textbf{Def. Strict Total Order(also $\prec$): }trichotomous and strict order\\
\underline{Least/greates/minimal/maximal for S.T.O.s: }almost like for P.O.s but $x\not=y$ for least and greatest.

\textbf{Set ops on Relations}
If $R$ is a relation over sets $S_1,...,S_n$, and $R'$ is a rel. over $S'_1,..,S'_n$. then $R\cup R'$ is a relation over $S_1\cup S'_1,...,S_n'\cup S'_n$ \\
\textbf{Def. Inverse Relation: }$R\subseteq A \times B$:
$R^-1 =\{(b,a)\mid (a,b)\in R$\}\\
\textbf{Def. Rel. Composition: }$R_1$ bin.rel. over $A,B$ and $R_2$ bin.rel over $B,C$. $R_2\circ R_1 = \{(a,c)\mid \ there \ is \ a \ b\in B\text{ with }(a,b)\in R_1 \ and \ (b,c)\in R_2\}$\\
\underline{Theorem (Associativity of Composition):} For relations $R_1,R_2,R_3$ over sets $S_1,S_2,S_3,S_4$ where $R_i\subseteq S_i \times S_{i-1}$ then $R_1\circ(R_2\circ R_2)=(R_1\circ R_2)\circ R_3$\\
\textbf{Def. Transitive closure: }The transitive closure $R^+$ of a rel. $R$ is the smallest relation over $S$ that is transitive and has $R$ as a subset.\\
\underline{Theorem: } Let the i-th power of a homogeneous relation $R$ be defined as $R^1=R,\ i=1$ and $R^i=R\circ R^{i-1}, i>1$. Then $R^+=\bigcup_{i=1}^{\infty}R_i$.

\textbf{Functions}
\textbf{Def.} A bin.rel. $R$ over sets $A$ and $B$ is \textit{functional} if for every $a\in A$ there is \textit{at most one} $b \in B$ with $(a,b)\in R$.\\
\textbf{Def. Partial Function:} A \textit{partial function} $f$ from a set $A$ to set $B$ ($f:A \nrightarrow B$) is given by \textit{a functional relation} $G$ over $A$ and $B$. $G$ is called the \textit{graph} of $f$.
We write $f(x)=y$ for $(x,y)\in G$ and say $y$ is the \textit{image} of $x$ under $f$. If there is no $yt\in B$ with $(x,z)\in G$ $f(x)$ is \emph{undefined}.
\textbf{Total Func.} A \emph{(total) function} $f:A \rightarrow B$ is a partial function such that $f(x)$ is defined for all $x\in A$. I.E. the domain = domain of definition.\\
The restriction of $f$ to $X$ is the partial function $f |_X : X \nrightarrow $B with $f |_X (x ) = f (x )$ for all $x \in X $.
A function $f' :A' \nrightarrow B$ is called an extension of $f$ if $A \subseteq A'$ and $f '|_A = f $. Let $g:B \nrightarrow C$ be a p.f. too, then the \emph{composition of f and g} is $g \circ f: A \nrightarrow C$ with $(g\circ f)(x) = g(f(x))$ if $f$ is def. for $x$ and $g$ is defined for $f(X)$; undefined otherwise. If (total) functions then always defined. Function composition is 1. not commutative and 2. associative (analog relations).\\
\textbf{Properties of funcs.}Let $f: A \rightarrow B$ and $g: B\rightarrow C$ be functions, then: $f$ is \emph{injective} if for all $x,y\in A$ with $x\not= y$ it holds that $f(x)\not=f(y)$. If $f$ and $g$ are injective(surjective) then so is $g\circ f$. A functio is \emph{surjective} if image = codomain: for all $y\in B, \exists x\in A  : f(x) = y$. A function is bijective if it is surj. and inj. If $f$ is bijective, the \emph{inverse function} of $f$ is the function $f^{-1}:B \rightarrow A: f^{-1}(y)=x\ iff. \ f(x) = y$. Let $f, g$ be bij., then $(g\circ f)^{-1} = f^{-1} \circ g^{-1}$\\
\textbf{Permutations.} Let $S$ be a set. A \emph{bijection} $\pi : S \rightarrow S$ is called a \emph{permutation} of $S$. If $\pi$ and $\pi'$ are \emph{disjoint} perms over set $S$, then $\pi\pi'=\pi'\pi$. Every cycle can be expressed as a product of transpositions (2-cycles).

\textbf{Groups}
 A\emph{ binary operation} on set $S$ is a function $f: S\times S \rightarrow S$\\
 \textbf{Def. Group} A group $G= (S,\cdot)$ is given by a set $S$ and bin.op. $\cdot$ on $S$ that satisfy the \emph{group axioms:} 1. \emph{Associativity} ($x\cdot y) \cdot z = x \cdot (y \cdot z ) \ \forall x,y,z\in S$; 2. \emph{Identity elem. }$\exists{e}\in S\ s.t.\ \forall x\in S \ x\circ e = e \cdot x = x$ holds; 3. \emph{Inverse elem. }$\forall x\in S \exists y\in S \ s.t. \ x\cdot y = y \cdot x = e$, where $e$ is the identity element. ABELIAN: if $\cdot$ is also \emph{commutative}. Cardinality $|S|$ is called \emph{order}of the group. \textbf{Uniqueness} $e \land \forall x \ x^{-1}$ are unique in a group. \textbf{Right (Left) Quotient. } $\forall a,b\in S \ x\cdot b = a\ (b\cdot x = a)$ has exectly one solution $x\in S,\ x = a \cdot b^{-1}\ (x = b^{-1}\cdot a)$. ABELIAN: $a/b=b/a$.\textbf{Group Homomorphism} $G=(S,\cdot), G'=(S',\circ)$ a homomorphism from $G$ to $G'$ is a function $f:S\rightarrow S', \ \forall x,y,\in S: f(x\cdot y)=f(x)\circ f(y)$ \textbf{G. Isom.} Homomorphism that is bijectiv. \textbf{Subgroup} $H=(S',\circ)$ of $G=(S, \cdot)$, with $S'\subseteq G$ and $\cdot$ the restriction of $\circ$ to $S'$. Always contains identity element and is closed under group up and inverse.
 \textbf{Th. Symmetric Gr.} Set $M$, then $Sym(M)=(S,\cdot)$, where $S$ is set of all permutations of $M$ and $\cdot$ is function composition, is a group. $M$ finite write $S_n$. \emph{Order} $Sym(M)=n!$ \emph{Abelian?} not for $n\ge 3$. \textbf{Generating set} of a group $G$ is a set $S'\subseteq S$ s.t. every $e\in S$ can be expressed as a combo of finitely many elems of $S'$ and their inverses.\textbf{Permutation Group} is a group $G=(S,\cdot)|\forall x \in S$ is a permutation of some set $M$ op is func comp. \textbf{NOTICE} Every perm gr is a subgr of a symmetric gr and every such subgr is a perm gr.
 
 
 \textbf{Divisibiolity and Modular Arithmetic}
 If $\exists k \in \mathbb Z \text{ s.t. } mk = n \Rightarrow m|n$. $a,b,c,d\in \mathbb Z:d|a \land d|b \Rightarrow \forall x,y\in \mathbb Z$ $d|xa + yb$ and for $n\in \natone: a|b \Rightarrow ac |bc \land a^n|b^n$. \textbf{Th.} Divisibility over $\natzero$ is a partial order. \textbf{Euclid} $\forall a,b \in \mathbb Z, \ b\not=0,\ \exists \ unique\ q,r\in \mathbb Z: a=qb +r\ and\ 0\leq r <|b|, r:= a \ mod \ b$. \textbf{Def. Congruent Modulo} $n>1, a,b\in \mathbb Z: n|a-b \Rightarrow \ a \equiv b \ (mod\ n)$ is an equivalence relation. \textbf{Th.} $a,b\in \mathbb Z,\ n>1: a\equiv b\ (mod\ n) \Leftrightarrow \exists q,q'\in \mathbb Z: a= qn+r \land b=q'n +r$. \textbf{Th. Compatibility} If $a\equiv b(\mod n) \land a\equiv b'(\mod n) \Rightarrow(( a+a' \equiv b+b'; a-a'\equiv b-b; aa'\equiv bb';\forall k\in\mathbb Z: a+k\equiv b+k ; ak \equiv bk;\forall k\in\natzero \ a^k\equiv b^k )\mod n)$. \textbf{Th. Fermat} $a\in \mathbb Z \ and\ p\in\text{Prime }: \not\exists k\in\mathbb Z\ $ s.t. $\ a=kp \Rightarrow a^{p-1} \equiv 1(\mod p)$ 
 
 
 \textbf{Graphs}
 Digraph $G=(N,A):\ |N|=n,\ |A|=m$. The graph induced by $G$ has $E=\{\{u,v\}|(u,v)\in A, u\not=v\}.$ \textbf{Th.} $0\leq |E| \leq m$ no selfloops: $\lceil \frac{m}{2}\rceil \leq |E| \leq m$ and $|V|=n$ always. \textbf{Deg. Lemma} 1. Digraph: $\sum_{v\in N} indeg(v)=\sum_{v\in N} outdeg(V)=|A|$. 2. Graph: $\sum_{v\in V} deg(v) = 2|E|$. \emph{CORROLARY:} Every graph has an even no. of vert. with odd degree.\textbf{Walk length n} digraph(graph): $(v_0,v_1,\ldots ,v_n)\in N(V)^{n+1}|(v_i,v_{i+1})\in A(\{v_i,v_{i+1}\}\in V)\ \forall 0\leq i< n$ 
 ALLOWED: $n=0$
 \textbf{Defs. } $\pi = (v_0,\ldots ,v_n)$ be walk in graph/digraph: \emph{Path} $\forall 0\leq i < j \leq n| v_i\not=v_j$: \emph{Tour} $v_0=v_n$; \emph{Cycle} Tour with $n\geq 3(1)$ (di)graph and $\forall 0\leq i < j \leq n| v_i\not=v_j$.
 \textbf{Def. }Succ. rel $S_G$ and Reachabilty rel. $R_G$ on graph $G=(V,E)$: $(u,v)\in S_G \Leftrightarrow \{u,v\}\in E$; $(u,v)\in R_G \Leftrightarrow \exists$ walk from $u$ to $v$. Digraphs analog.
 Recall Trans closure plus: $R^0 =$ identity relation,let G be (di)graph. Then \textbf{Th.} $(u,v)\in S^n_G \Leftrightarrow \exists$ walk of length $n$ from $u$ to $v$. and \textbf{Corr.} $R_G=\bigcup_{n=0}^\infty S^n_G$. AKA $R_G$ is refl. and trans. closure of $S_G$.
 \textbf{Th.} (Di)graph $G$: $\exists \text{ path from } u \text{ to } v \Leftrightarrow \exists \text{ walk from } u \text{ to } v \Leftrightarrow (u,v)\in R_G$. \textbf{Th. }For GRAPH $R_G$ is an equiv. rel. The equiv classes are called \emph{connected components} of $G$. Connected iff. 1 con.comp. DIGRAPH: Eq. cl. of $R_G^{\text{ind}}$ of induced gr. \emph{weakly con. comp}.
 \textbf{Def. $M_G$} (Di)graph $G$ if $(u,v)\in R_G \land (v,u)\in R_G$ then \emph{mutually reachable}. DIGRAPH: $M_G$ is an eq.rel. Eq. class of $M_G$ in digraph: \emph{strongly con. comp}.
 \textbf{Def.} Acyclic $\land$ (graph: \emph{forest}; digraph: \emph{DAG}). Forest and connected = tree. \textbf{Th.} $G$ graph, then is tree iff. $\exists$ exactly one path from any $u\in V$ to any $v\in V$.\textbf{Let G be tree: }\emph{leaf}
  of G has deg=1. \underline{Th.} $|V|\geq 2\Rightarrow G$ has min. 2 leaves.\underline{Th.}$V\not=\emptyset\Rightarrow|E|=|V|-1$.
Let $C$ be con. comp of forest $G\Rightarrow |E|=|V|-|C|$.\textbf{Th. }$G$ gr. with $V\not=\emptyset$. $G$ is $tree\Leftrightarrow acyclic\land connected\Leftrightarrow acyclic\land |E|=|V|-1\Leftrightarrow connected\land |E|=|V|-1\Leftrightarrow \forall u,v\in V \ \exists$ exactly one path from u to v. An \emph{isomprphism} from $G$ to $G'$ is a bijective function $\sigma : V\rightarrow V'$, s.t. $\forall u,v\in V: \{u,v\}\in E \Leftrightarrow \{\sigma (u),\sigma (v)\}\in E'$.
\emph{Induced Subgr.} is induced via $V'\subseteq V$. They are the largest subgraphs for a given set of vertices;

\textbf{\underline{Recurrence}}
$g:\mathbb{R}_{0}^{+} \rightarrow \mathbb R$. $O$,$\Omega$ ,$\Theta$
\textbf{Th.} Let $A\geq 1, B\geq 1, T(n) = A\cdot T(\frac{n}{B}) + f(n)$. Then: $\exists \epsilon > 0| f(n) = O(n^{log_{B}(A)-\epsilon}) \Rightarrow T(n) = \Theta(n^{log_B A}); f(n)=\Theta(n^{log_B A}) \Rightarrow T(n)= \Theta (n^{log_B A}log_2 n); f(n) = \Omega(n^{log_B (A) + \epsilon}) \Rightarrow T(n)= \Theta(f(n))$.


\textbf{Prop. Logic}

\textbf{Def. Syntax of PF:}
Let $A$ be a set of \textit{atomic propositions}. The set of \textit{propositional formulas over $A$} is inductively defined as follows:\\
Every \textit{atom} $a\in A$ is a PF over $A$.\\
If $\varphi$ is a PF over $A$, then so is $\lnot\varphi$.
If $\varphi \text{ and } \psi$ are PFs over $A$, then so are the \textit{conjunction} $(\varphi \land \psi)$ and the \textit{disjunction} $(\varphi \lor \psi)$.
Implication: $(\varphi\rightarrow\psi)\equiv(\varphi\lor\psi)$.
Biconditional: $(\varphi\leftrightarrow\psi)\equiv((\varphi\rightarrow\psi)\land(\psi\rightarrow\varphi))$.\\

\textbf{Def. Semantics of PF:}
A \textit{truth assignment (aka. interpretation)} for a set of atomic propositions $A$ is a function $\mathcal I \to \{0,1\}$. A PF $\varphi \text{ (over} A)$ \textit{holds under $\mathcal I$} (written $\mathcal I \models \varphi$) according to the following definitions:\\
$\mathcal I \models a$ iff. $\mathcal I(a) = 1$ for all $a\in A$\\
$\mathcal I \models \lnot \varphi$ iff. not $\mathcal I \models \varphi$\\
$\mathcal I \models (\varphi \land \psi)$ iff. $\mathcal I \models \varphi$ and $\mathcal I \models \psi$\\
$\mathcal I \models (\varphi \lor \psi$ iff. $\mathcal I \models \varphi$ or $\mathcal I \models \psi$\\
\textbf{Properties of PFs:}
A PF $\varphi$ is (i) \textit{satisfiable} if it has at least one model (ii) \textit{unsatisfyable} if it is not satisfiable (iii) \textit{valid} (also \textit{tautology}) if it is true under EVERY interpretation (iv) \textit{falsifiable} if it is no tautology.\\

\textbf{Def. Equivalence of PEs:}
Two PEs $\varphi$ and $\psi$ over $A$ are \textit{(logically) equivalent} ($\varphi\equiv\psi$) if FOR ALL INTERPRETATIONS $\mathcal I$ for $A$ it is true that $\mathcal I \models \varphi$ iff $\mathcal I \models \psi$.\\

\textbf{Some Equivalences: }
(i)Idempotence: $(\varphi\land\varphi)\equiv\varphi$, $(\varphi\lor\varphi)\equiv\varphi$ (ii)Commutativity: $(\varphi\lor\psi)\equiv(\psi\lor\varphi)$,$(\varphi\land\psi)\equiv(\psi\land\varphi)$  (iii) Associativity: ($((\varphi\lor\psi)\lor\chi)\equiv(\psi\lor(\varphi\lor\chi))$, ($((\varphi\land\psi)\land\chi)\equiv(\psi\land(\varphi\land\chi))$  (iv) Absorbtion: $(\varphi\land(\varphi\lor\psi))\equiv\varphi$ ditto with and/or flipped (v) Distributivity: $(\varphi\land(\psi\lor\chi))\equiv((\varphi\land\psi)\lor(\varphi\land\chi))$ ditto with and/or flipped (vi)Double neg.: $\lnot\lnot\varphi\equiv\varphi$ (vii) De Morgan: $\lnot(\varphi\land\psi)\equiv(\lnot\varphi\lor\lnot\psi) $ ditto and/or flipped (viii) Tautology rules: $(\varphi \lor \psi)\equiv\varphi$ and $(\varphi\land\psi)\equiv\psi$ if $\varphi$ is a tautology (ix)Unsatisfiability rules: $(\varphi \lor \psi)\equiv\psi$ and $(\varphi\land\psi)\equiv\varphi$ if $\varphi$ is unsatisfiable.\\

\textbf{Substitution Theorem: } Let $a$ and $a'$ be equivalent PEs over $A$. Let $c$ be a PE with (at least) one occurrence of the subformula $a$. Then $c$ is equivalent to $c'$, where $c'$ is constructed from $c$ by replacing an occurence of $a$ with $a'$.

\underline{Literal } is an atomic proposition or its negation. \underline{Clause } is a disjunction of literals. \underline{Monomial} is conjunction of literals.
Clause and monomial are also used in case of only one literals.\\
\textbf{Def. CNF.} A formula is in CNF if it is a conjunction of clauses.\\
\textbf{Def. DNF.} A formula is in DNF if it is a disjunction of monomials.\\
\textbf{Algo to construct CNF:} 1. Replace abbreviations $\rightarrow, \leftrightarrow$ by their definition. $(\rightarrow/\leftrightarrow)$-elimination. 2. Use DeMorgan and double neg. rule to move negations insude. 3. Distribute $\lor$ over $\land$ w/ distributivity. 4. (optional) Simplify at end or ar intermediate steps (e.g. w/ idempotence).\\
\underline{Theorem. } A formula in CNF is a tautology iff. every clause is a tautology. A formula in DNF is satisfiable iff at least one of its monomials is satisfiable.\\

\textbf{Def. Model for KB. } Let KB be a \textit{knowledge base} over $A$, i.e. a set of PF over $A$.
A truth assignment $\mci$ for $A$ is a model for KB ($\mci\models KB$) if $\mci$ is a model for EVERY formula $\varphi\in KB$.\\
\textbf{Props of KBs. } A KB is\\
1. satisfiable if KB has at least one model; 
2. unsatisfiable of KB is not satisfiable; 
3. valid (or a tautology) if every interpretation is a model for KB; 
4. falsifiable if KB is no tautology.

\textbf{Def. Logical Consequence. } Let KB be a set of formulas and $\varphi$ a formula. We say KB logically implies $\varphi$ ($KB\models\varphi$) if all models of KB are also models of $\varphi$.\\
\underline{Deduction Th. } $KB \cup \{\varphi\} \models \psi \text{ iff } KB\models(\varphi\rightarrow\psi)$.;
\underline{Contraposition The.} $KB \cup \{\varphi\} \models \lnot\psi \text{ iff } KB \cup \{\psi\}\models\lnot\varphi$.;
\underline{Contradiction The.} $KB\cup\{\psi\} \text{ is unsatisfiable iff } KB\models\lnot\varphi$ \\

\textbf{Some Inference Rules. } Modus Ponens $\varphi,(\varphi\rightarrow\psi)_\psi$. Modus Tollens $\lnot\psi,(\varphi\rightarrow\psi)_\lnot\varphi$. AND-Elim. $(\varphi\land\psi)_{\varphi/\psi}$. AND-Intro. $\varphi,\psi_{(\varphi\land\psi)}$. OR-Intro. $\varphi_{(\varphi\lor\psi)}$. Bimp-Elim. $(\varphi\leftrightarrow\psi)_{(\varphi\rightarrow\psi)/(\psi\rightarrow\varphi)}$\\
\textbf{Def. Calculus. }A set of inference rules is called a calculus.
\textbf{Def. Correctness and Completeness of a Calculus.} We write $KB\vdash_C \varphi$ if there is a derivation of $\varphi$ from KB in calculus $C$.\\
A calculus $C$ is \textit{correct} if for all $KB$ and $\varphi$ $KB\vdash_C \varphi$ implies $KB \models \varphi$\\
and called \textit{complete} if $KB\models\varphi$ implies $KB\vdash_C \varphi$.\\
\textbf{Refutation Copmlete: } A calc. $C$ is \emph{refutation-complete} if $KB\vdash_C \square$(symbol for provably unsatisfiable formulas) for all unsatisfiable $KB$. \textbf{Resoluton Calc.:} Use ref-completeness and show $KB\models \varphi$ by deriving $KB\cup\{\lnot \varphi\}\vdash_R \square$ with \emph{resolution calc. $R$}. Rule: $\frac{C_1 \cup \{X\}, C_2 \cup \{\lnot X\}}{C_1\cup C_2}$. Example from $KB$ to $\Delta$: $KB=\{(P\lor P), ((\lnot P \lor Q) \land (\lnot P \lor R) \land (Q \lor \lnot P) \land R), ((\lnot Q \lor \lnot R \lor S)( \land P) \} \Rightarrow \Delta = \{\{P\},\{\lnot P,Q\},\{\lnot P, R\}, \{R\},\{\lnot Q, \lnot R, S\}\}$
\textbf{Predicate Logic}\\
\textbf{Signature.}
A \textit{signature} (of predicate logic) is a 4-tuple $\mathcal{S} = \langle \mathcal{V},\mathcal{C},\mathcal{F},\mathcal{P}\rangle$ consisting of the following disjoint sets, where all sets are \underline{finite or countable}:\\
$\mathcal{V}$ of \textit{variable symbols}; 
$\mathcal{C}$ of \textit{constant symbols}; 
$\mathcal{F}$ of \textit{function symbols}; 
$\mathcal{P}$ of \textit{predicate/relation symbols}; 
Every function symbol $f\in\mathcal{F}$ and predicate symbol $P\in\mathcal{P}$ has an associated \textit{arity} $ar(f),ar(P)\in\mathbb{N}_1$.\\

\textbf{Term.} Let $\mathcal{S} = \langle \mathcal{V},\mathcal{C},\mathcal{F},\mathcal{P}\rangle$ be a signature. A \textit{term} over $\mathcal{S}$ is inductively constructed according to the following rules:\\
1. Every variable symbol $v\in \mathcal{V}$ is a term.; 
2. Every constant symbol $c\in\mathcal{C}$ is a term.; 
3. If $t_1,...,t_k$ are terms and $f\in\mathcal{F}$ is a function symbol with arity $k$, then $f(t_1,...,t_k)$ is a term.\\

\textbf{Formula.} For a signature $\mathcal{S} = \langle \mathcal{V},\mathcal{C},\mathcal{F},\mathcal{P}\rangle$ the set of predicate logic formulas over $\mathcal{S}$ is inductively defined as follows:\\
1. If $t_1,...,t_k$ are terms (over $\mathcal{S}$) and $P\in\mathcal{P}$ is a $k$-ary pred. sym., then the \textit{atomic formula (or atom)} $P(t_1,..,t_k)$ is a formula over $\mathcal{S}$.; 
2. If $t_1,t_2$ are terms (over $\mathcal{S}$), then the \textit{identity} $t_1=t_2$ is a formula over $\mathcal{S}$.; 
3. If $x\in\mcv$ is a variable symbol and $\varphi$ a formula over $\mcs$,\\ then the \textit{universal quantification} $\forall x\varphi$ 
and the \textit{existential quantification} $\exists x \varphi$ are formulas over $\mcs$.; 
4. If $\varphi$ is a formula over $\mcs$, then so is its \textit{negation} $\lnot\varphi$.; 
5. If $\varphi$ and $\psi$ are formulas over $\mcs$, then so are \textit{conjunction} $(\varphi\land\psi)$ and the \textit{disjunction} $(\varphi\lor\psi)$.\\ \emph{Sentence/closed formula }has no free vars. \emph{Open} has a least one free var. \emph{Ground formulas} are closed f. without quantifiers.
\textbf{Th.etc.} Ded./Contrapos./Contra.dict theorems also hold. All Equivs from prop. logic hold plus: $(\forall x \varphi \land \forall x \psi) \equiv \forall x(\varphi \land \psi)$; $(\forall x \varphi \lor \forall x \psi) \models \forall x(\varphi \lor \psi)$;$x\not\in free( \psi): (\forall x \varphi \land (\lor) \psi) \equiv \forall x ( \varphi \land (\lor) \psi)$;$\lnot \forall x \varphi \equiv \exists x \lnot \varphi$; all hold same if change forall with exist.
\end{multicols*}

\end{document}
