aboutsummaryrefslogtreecommitdiff
path: root/slides/preplogic-slides.tex
diff options
context:
space:
mode:
Diffstat (limited to 'slides/preplogic-slides.tex')
-rw-r--r--slides/preplogic-slides.tex520
1 files changed, 520 insertions, 0 deletions
diff --git a/slides/preplogic-slides.tex b/slides/preplogic-slides.tex
new file mode 100644
index 0000000..0dbbc0b
--- /dev/null
+++ b/slides/preplogic-slides.tex
@@ -0,0 +1,520 @@
1\documentclass[11pt]{beamer}
2\usetheme{Madrid}
3\usepackage[utf8]{inputenc}
4\usepackage{amsmath}
5\usepackage{amsfonts}
6\usepackage{amssymb}
7\usepackage{setspace}
8\author{Sebastiano Tronto}
9\title{Elementary Logic (PrepCamp)}
10%\setbeamercovered{transparent}
11%\setbeamertemplate{navigation symbols}{}
12\logo{\includegraphics[scale=0.065]{unilu.jpg}}
13\institute{uni.lu}
14\date{September 7-8, 2020}
15%\subject{}
16
17\newtheorem {proposition}{Proposition}
18\theoremstyle{definition}
19\newtheorem {remark}{Remark}
20\newtheorem {exercise}{Exercise}
21
22
23\newcommand{\refgithub}{
24 \begin{itemize}
25 \item \textbf{These slides:}
26 \item \textbf{Exercises:}
27 \item \textbf{Contact:} \texttt{sebastiano.tronto@uni.lu}
28 \end{itemize}
29}
30
31\begin{document}
32
33\begin{frame}
34\titlepage
35\end{frame}
36
37\begin{frame}
38 \begin{columns}
39 \column{0.5\linewidth}
40 \tableofcontents
41 \column{0.5\linewidth}
42 \refgithub
43 \end{columns}
44\end{frame}
45
46
47\section{Statements}
48\begin{frame}{Statements}
49\begin{itemize}
50 \pause
51 \item Unambiguous
52 \pause
53\begin{example}[A bad joke]
54\textbf{Q:} How many months have 30 days?
55\pause
56
57\textbf{A:} 11, some of them have even more!
58\pause
59
60:-(
61\end{example}
62\pause
63 \item Objective
64 \pause
65\begin{example}
66\textbf{Good:} 3 is greater than 4
67
68\textbf{Bad:} 3 is nicer than 4
69\end{example}
70\end{itemize}
71\end{frame}
72
73\begin{frame}{Statements}
74 \begin{itemize}
75 \item Mathematical: ``\emph{Three is greater than four}\,''
76 (or ``$3 > 4$'')
77 \item ...or not: ``\emph{I am 26 years old}\,''
78 \item \textbf{Key point:} staments can be \textbf{true} or
79 \textbf{false}
80\end{itemize}
81\end{frame}
82
83%\begin{frame}[plain]
84%\begin{center}
85%\includegraphics[scale=0.4]{xkcd169.png}
86%https://xkcd.com/169/
87%\end{center}
88%\end{frame}
89
90
91\section{Logical operations}
92
93\begin{frame}{Logical operations}
94\begin{itemize}
95\item We can combine statements to make new ones
96\item Negation (\textbf{not}), conjunction (\textbf{and}), disjunction
97 (\textbf{or})
98\end{itemize}
99\end{frame}
100
101\begin{frame}{Negation (\textbf{not})}
102\begin{center}
103If $A$ is a statement, the statement ``not $A$'' (in symbols: $\neg A$) is
104\textbf{true} when $A$ is \textbf{false}, and it is \textbf{false} when $A$ is
105\textbf{true}.
106\pause
107\end{center}
108
109\begin{example}
110\begin{center}
111$\neg (3>4)$ is equivalent to $3\leq 4$
112
113``\emph{$3$ is \textbf{not} greater than $4$}'' is equivalent to
114``\emph{$3$ is less or equal than $4$}''
115\end{center}
116\end{example}
117\end{frame}
118
119\begin{frame}{Conjunction (\textbf{and})}
120\begin{center}
121The statement ``$A$ and $B$'' (in symbols:
122$A\land B$) is \textbf{true} when both $A$ and $B$ are \textbf{true}, and it is
123\textbf{false} if at \emph{at least} one of them is \textbf{false}.
124\pause
125
126\begin{example}
127``$(3<4)\land (5$ is an odd number$)$'' is \textbf{true}
128\end{example}
129
130\begin{example}
131``(Today is Monday) $\land$ (we are in France)'' is \textbf{false}
132\end{example}
133\end{center}
134
135\end{frame}
136
137\begin{frame}{Disjunction (\textbf{or})}
138\begin{center}
139The statement ``$A$ or $B$'' (in symbols:
140$A\lor B$) is \textbf{true} when at least one of $A$ and $B$ is \textbf{true},
141and it is \textbf{false} if both of them are \textbf{false}.
142\pause
143
144\begin{example}
145``$(3=4)\lor (5$ is an even number$)$'' is \textbf{false}
146\end{example}
147
148\begin{example}
149``(Today is Monday) $\lor$ (we are in Luxembourg)'' is \textbf{true}
150\end{example}
151\end{center}
152
153\end{frame}
154
155
156\begin{frame}{Logical operations}
157\begin{itemize}
158 \item \textbf{Important:} $\lor$ is always \emph{inclusive}:
159 \pause
160
161\begin{center}
162\begin{example}[Another bad joke]
163Waiter: ``Would you like cheese or dessert?''
164
165Mathematician: ``Yes.''
166\end{example}
167\end{center}
168\pause
169 \item $\neg$ has precedence over $\land$ and $\lor$:
170 \begin{align*}
171 \neg A\land B \text{ means } (\neg A)\land B,\qquad
172 \neg A\lor B \text{ means } (\neg A)\lor B
173 \end{align*}
174 (or just use parenthesis)
175\end{itemize}
176
177
178\end{frame}
179
180\begin{frame}{Properties}
181 \begin{center}
182 If $A$, $B$ and $C$ are statements:
183 \end{center}
184 {\fontsize{9}{17}\selectfont
185 \begin{align*}
186 \begin{array}{cc|c}
187 A\land B = B\land A & A \lor B = B\lor A &\textbf{commutativity}\\
188 \hline
189 A\land (B\land C) = (A\land B)\land C \quad &
190 A\lor (B\lor C) = (A\lor B)\lor C & \textbf{associativity}\\
191 \hline
192 A\land(B\lor C) = (A\land B)\lor(A\land C) & & \textbf{distributivity} \\
193 A\lor(B\land C) = (A\lor B)\land(A\lor C) & &\textbf{distributivity*} \\
194 \hline
195 \neg(\neg A) = A & & \textbf{double negation} \\
196 \hline
197 A \land \textbf{true} = A & A \land \textbf{false} = \textbf{false} \\
198 A\lor \textbf{true} = \textbf{true} & A \lor \textbf{false} = A \\
199 (\neg A) \land A = \textbf{false} & (\neg A) \lor A = \textbf{true} \\
200 \hline
201 \neg (A\land B) = (\neg A)\lor (\neg B) &
202 \neg (A\lor B) = (\neg A)\land (\neg B) & \textbf{De Morgan's laws}
203 \end{array}
204 \end{align*}}
205\end{frame}
206
207\subsection{Boolean algebra}
208
209\begin{frame}{Boolean algebra}
210 \begin{itemize}
211 \item For simplicity: \textbf{true}\,$=1$, \textbf{false}\,$=0$
212 \pause \item We have a set $\{0,1\}$ with some operations
213 $(\land,\lor,\neg)$
214 \pause \item This is called a \textbf{Boolean algebra}
215 \end{itemize}
216\end{frame}
217
218\subsection{Truth tables}
219
220\begin{frame}{Truth tables}
221 A compact way of describing an operator, or a composition of operators
222 \pause
223 \vspace{4pt}
224 Example:
225\begin{align*}
226 \begin{array}{|c|c|c|c|c|c|}
227 \hline
228 A & B & \neg A & A\land B & A\lor B & (A\lor B)\land (\neg A) \\
229 \hline
230 0 & 0 & 1 & 0 & 0 & 0 \\
231 0 & 1 & 1 & 0 & 1 & 1 \\
232 1 & 0 & 0 & 0 & 1 & 0 \\
233 1 & 1 & 0 & 1 & 1 & 0 \\
234 \hline
235 \end{array}
236\end{align*}
237\end{frame}
238
239\begin{frame}{Truth tables}
240 \begin{center}
241 We can check that two statements are equivalent with truth tables
242 \end{center}
243\begin{align*}
244 \begin{array}{|c|c|c|c|}
245 \hline
246 A & B & \neg(A\land B) & (\neg A)\lor (\neg B)\\
247 \hline
248 0 & 0 & 1 & 1 \\
249 0 & 1 & 1 & 1 \\
250 1 & 0 & 1 & 1 \\
251 1 & 1 & 0 & 0 \\
252 \hline
253 \end{array}
254\end{align*}
255\end{frame}
256
257
258\section{Implication}
259
260\begin{frame}{Implication}
261 \begin{itemize}
262 \item ``$A\implies B$'' means \emph{``If $A$ (is true), then $B$ (is true)''}
263 \end{itemize}
264 \pause
265 \begin{example}
266 \emph{``If it rains, I will bring an umbrella''}
267
268 (It rains)$\implies$(I will bring an umbrella)
269 \end{example}
270 \pause
271 \begin{example}
272 \emph{``If my grandpa had wheels, he would be a bike''}
273
274 (My grandpa has wheels)$\implies$(My grandpa is a bike)
275 \end{example}
276\end{frame}
277
278
279\begin{frame}{Implication}
280 \begin{itemize}
281 \item It is a logical operation: ``$A\implies B$'' means ``$B\lor(\neg A)$''
282 \pause
283 \end{itemize}
284 \begin{align*}
285 \begin{array}{|c|c|c|c|}
286 \hline
287 A & B & A\implies B & \\
288 \hline
289 0 & 0 & 1 & \text{No rain, I don't bring an umbrella} \\
290 \hline
291 0 & 1 & 1 & \text{No rain, I bring an umbrella anyway} \\
292 \hline
293 1 & 0 & 0 & \text{It rains, I don't bring an umbrella} \\
294 \hline
295 1 & 1 & 1 & \text{It rains, I bring an umbrella} \\
296 \hline
297 \end{array}
298 \end{align*}
299 \pause
300 \begin{remark}
301 ``\textbf{false} $\implies A$'' is always \textbf{true}, whatever $A$ is
302 (\emph{ex falso quodlibet})
303 ``$A\implies$\textbf{true}'' is always true, whatever $A$ is
304 \end{remark}
305\end{frame}
306
307
308\begin{frame}{Notation}
309 Sometimes we use the following symbols:
310 \begin{itemize}
311 \item ``$A\impliedby B$'' is the same as ``$B\implies A$''
312 \item ``$A\iff B$ is the same as ``$(A\implies B)\land (B\implies A)$''.\\
313 It is read ``$A$ is equivalent to $B$'' or ``$A$ if and only if $B$''.
314 \end{itemize}
315\end{frame}
316
317\begin{frame}{Contrapositive}
318 \begin{itemize}
319 \item The statement $(\neg B)\implies (\neg A)$ is called
320 \emph{contrapositive} of $A\implies B$
321 \pause
322 \item It is equivalent to ``$A\implies B$''
323 \pause
324 \item Two proofs:
325 \begin{enumerate}
326 \item Properties of logical operations
327 \item Truth tables
328 \end{enumerate}
329 \end{itemize}
330\end{frame}
331
332\begin{frame}{End of part 1}
333 See you tomorrow!
334
335 \refgithub
336\end{frame}
337
338\section{Quantifiers}
339
340\begin{frame}{Quantifiers}
341 Let $S$ be a set and let $A(x)$ be a ``variable statement'' that depends on
342 $x\in S$ (for example $S=\mathbb{N}$ and $A(x)=$``x is an even number'').
343 \pause
344
345 \begin{itemize}
346 \item \textbf{Universal quantifier} ($\forall$ or ``for all''):
347 ``$\forall x\in S,\,A(x)$'' means that if we replace $x$ with any
348 element of $S$, $A(x)$ is always \textbf{true}.
349 \item \textbf{Existential quantifier} ($\exists$ or ``there exists''):
350 ``$\exists x\in S,\, A(x)$'' means that $A(x)$ is \textbf{true} for
351 at least one value of $x$ is $S$.
352 \end{itemize}
353\end{frame}
354
355\begin{frame}{Quantifiers - examples}
356 \begin{example}
357 $S=$``the set of all cars'', $A(x)$=``$x$ is red''
358
359 $\forall x\in S,\, A(X)$ is \textbf{false}.
360
361 $\exists x\in S,\, A(X)$ is \textbf{true}.
362 \end{example}
363 \begin{example}
364 $S=\mathbb{N}$, $A(x)=x>5$
365
366 $\forall x\in S,\, A(x)$ is \textbf{false}.
367
368 $\exists x\in S,\, A(X)$ is \textbf{true}.
369 \end{example}
370\end{frame}
371
372\begin{frame}{Negation of quantifiers}
373 \begin{center}
374 \textbf{Today's most important fact:}
375 \end{center}
376 \begin{align*}
377 \neg(\forall x\in S,\, A(x))&=\only<1>{\quad?}
378 \onslide<2->{\exists x\in S,\,\neg A(x)}\\
379 \neg(\exists x\in S,\, A(x))&=\only<1-2>{\quad?}
380 \onslide<3->{\forall x\in S,\,\neg A(x)}\\
381 \end{align*}
382 \pause
383 \begin{example}
384 \begin{center}
385 $\neg$``every number is even'' = ``there is at least one odd number''
386 \end{center}
387 \end{example}
388\end{frame}
389
390\begin{frame}
391 (exercise)
392\end{frame}
393
394\section{Proofs}
395
396\begin{frame}{Proofs}
397 \begin{itemize}
398 \item A proof is a sequence of statements, each one logically deriving from
399 the previous.
400 \pause
401 \item Proofs are used to derive new statements from statements that are
402 known to be true.
403 \pause
404 \item If $A$ is known to be true and the implication $A\implies B$ is
405 logically clear, then also $B$ must be true.
406 \pause
407 \item Every mathematical theorem must be justified with a proof.
408 \end{itemize}
409\end{frame}
410
411\subsection{Direct proofs}
412\begin{frame}{Example: direct proof}
413 \begin{theorem}
414 The sum of two even numbers is even.
415 \end{theorem}
416 \pause
417 \begin{proof}
418 \begin{enumerate}
419 \item Recall the definition: a natural number $x$ is called \emph{even}
420 if there is some natural number $n$ such that $x=2n$.
421 \pause
422 \item If $x$ and $y$ are even numbers, then there are natural numbers $n$
423 and $m$ such that $x=2n$ and $y=2m$.
424 \pause
425 \item Then $x+y=2n+2m=2(n+m)$.
426 \pause
427 \item Then $x+y$ is even.
428 \end{enumerate}
429 \end{proof}
430\end{frame}
431
432
433\subsection{Proofs by contradiction}
434
435\begin{frame}{Proofs by contradiction}
436 Idea: I want to show $A=\textbf{true}$. I show that the implication
437 ``$(\neg A)\implies\textbf{false}$'' is \textbf{true}.
438 Then $\neg A=\textbf{false}$, so $A=\textbf{true}$.
439 \pause
440\begin{definition}
441 A natural number is called \emph{prime} if it is different from $1$ and it
442 is only divisible by $1$ and itself.
443\end{definition}
444 \begin{theorem}
445 There are infinitely many prime numbers.
446 \end{theorem}
447
448\end{frame}
449
450\begin{frame}{Proofs by contradiction}
451 \begin{theorem}
452 There are infinitely many prime numbers.
453 \end{theorem}
454 \pause
455 \begin{proof}
456 \begin{enumerate}
457 \item Assume that there are only finitely many prime numbers.
458 \pause
459 \item So there are $n$ prime numbers, for some number $n$.
460 Call them $p_1,p_2,\dots,p_n$.
461 \pause
462 \item Let $u=p_1\times p_2\times \dots \times p_n +1$.
463 \pause
464 \item $u$ is not divisible by any of the prime numbers $p_1,\dots,p_n$.
465 \pause
466 \item Therefore $u$ is only divisible by $1$ and itself. So $u$ is prime.
467 \pause
468 \item So $p_1,\dots,p_n$ are not the only prime numbers.
469 \end{enumerate}
470 \end{proof}
471
472\end{frame}
473
474
475\subsection{Proofs by induction}
476
477\begin{frame}{Proofs by induction}
478 If I want to prove $\forall n\in \mathbb N,\, A(n)$:
479 \begin{enumerate}
480 \item Prove $A(0)$ (\emph{base step})
481 \item Prove $\forall n\in \mathbb N,\, (A(n)\implies A(n+1))$
482 (\emph{inductive step})
483 \end{enumerate}
484 \pause
485 \begin{theorem}[Sum of natural numbers]
486 $\forall n\in \mathbb N,\quad 0+1+\cdots + n=\frac{n(n+1)}{2}$
487 \end{theorem}
488
489\end{frame}
490
491
492\begin{frame}
493 \begin{proof}
494 \begin{enumerate}
495 \item Base case: $0=0$.
496 \pause
497 \item Let $n$ be any natural number.
498 \pause
499
500 If $A(n)=\textbf{false}$, then $A(n)\implies A(n+1)$ is \textbf{true}.
501 \pause
502
503 If $A(n)=\textbf{true}$, we have to show that $A(n+1)=\textbf{true}$.
504 \pause
505
506 \begin{align*}
507 \begin{array}{rlr}
508 0+\cdots +(n+1)& = (0+\cdots+ n)+(n+1)=\\
509 & = \frac{n(n+1)}{2}+(n+1)= & \text{since }A(n)=\textbf{true}\\
510 & = \frac{n^2+n+2n+2}{2}\\
511 & = \frac{(n+1)(n+2)}{2}
512 \end{array}
513 \end{align*}
514 so $A(n+1)=\textbf{true}$
515
516 \end{enumerate}
517 \end{proof}
518\end{frame}
519
520\end{document}

Generated with cgit - Back to sebastiano.tronto.net