Browse Source

added questionnaire for propositional logic

main
Stefan Pranger 9 months ago
parent
commit
9762611c70
  1. 9
      2_propositional_logic/0001.tex
  2. 9
      2_propositional_logic/0001_sol.tex
  3. 7
      2_propositional_logic/0002.tex
  4. 14
      2_propositional_logic/0002_sol.tex
  5. 7
      2_propositional_logic/0003.tex
  6. 13
      2_propositional_logic/0003_sol.tex
  7. 1
      2_propositional_logic/0004.tex
  8. 5
      2_propositional_logic/0004_sol.tex
  9. 5
      2_propositional_logic/0004_sol.tex~
  10. 10
      2_propositional_logic/0005.tex
  11. 9
      2_propositional_logic/0005_sol.tex
  12. 2
      2_propositional_logic/0006.tex
  13. 21
      2_propositional_logic/0006_sol.tex
  14. 2
      2_propositional_logic/0007.tex
  15. 22
      2_propositional_logic/0007_sol.tex
  16. 3
      2_propositional_logic/0008.tex
  17. 5
      2_propositional_logic/0008_sol.tex
  18. 1
      2_propositional_logic/0009.tex
  19. 2
      2_propositional_logic/0009_sol.tex
  20. 26
      2_propositional_logic/0010.tex
  21. 26
      2_propositional_logic/0010_sol.tex
  22. 7
      2_propositional_logic/0011.tex
  23. 47
      2_propositional_logic/0011_sol.tex
  24. 3
      2_propositional_logic/0012.tex
  25. 26
      2_propositional_logic/0012_sol.tex
  26. 1
      2_propositional_logic/0013.tex
  27. 3
      2_propositional_logic/0013_sol.tex
  28. 1
      2_propositional_logic/0014.tex
  29. 4
      2_propositional_logic/0014_sol.tex
  30. 1
      2_propositional_logic/0015.tex
  31. 1
      2_propositional_logic/0015_sol.tex
  32. 1
      2_propositional_logic/0016.tex
  33. 4
      2_propositional_logic/0016_sol.tex
  34. 3
      2_propositional_logic/0017.tex
  35. 1
      2_propositional_logic/0017_sol.tex
  36. 3
      2_propositional_logic/0018.tex
  37. 1
      2_propositional_logic/0018_sol.tex
  38. 13
      2_propositional_logic/0019.tex
  39. 13
      2_propositional_logic/0019_sol.tex
  40. 19
      2_propositional_logic/0020.tex
  41. 1
      2_propositional_logic/0020_sol.tex
  42. 36
      2_propositional_logic/0021.tex
  43. 44
      2_propositional_logic/0021_sol.tex
  44. 47
      2_propositional_logic/0022.tex
  45. 30
      2_propositional_logic/0022_sol.tex
  46. 6
      2_propositional_logic/1001.tex
  47. 6
      2_propositional_logic/1002.tex
  48. 6
      2_propositional_logic/1003.tex
  49. 6
      2_propositional_logic/1004.tex
  50. 6
      2_propositional_logic/1005.tex
  51. 6
      2_propositional_logic/1006.tex
  52. 6
      2_propositional_logic/1007.tex
  53. 6
      2_propositional_logic/1008.tex
  54. 3
      2_propositional_logic/1009.tex
  55. 5
      2_propositional_logic/1009_sol.tex
  56. 2
      2_propositional_logic/1010.tex
  57. 1
      2_propositional_logic/1011.tex
  58. 1
      2_propositional_logic/1012.tex
  59. 1
      2_propositional_logic/1013.tex
  60. 1
      2_propositional_logic/1013_sol.tex
  61. 1
      2_propositional_logic/1014.tex
  62. 4
      2_propositional_logic/1014_sol.tex
  63. 2
      2_propositional_logic/1015.tex
  64. 3
      2_propositional_logic/1016.tex
  65. 2
      2_propositional_logic/1017.tex
  66. 2
      2_propositional_logic/1018.tex
  67. 12
      2_propositional_logic/1019.tex
  68. 2
      2_propositional_logic/1020.tex
  69. 4
      2_propositional_logic/1021.tex
  70. 37
      2_propositional_logic/1022.tex
  71. 37
      2_propositional_logic/1023.tex
  72. 37
      2_propositional_logic/1024.tex
  73. 38
      2_propositional_logic/1025.tex
  74. 37
      2_propositional_logic/1026.tex
  75. 35
      2_propositional_logic/1027.tex
  76. 61
      2_propositional_logic/1028.tex
  77. 9
      2_propositional_logic/multiple_choice/1_1_declarative_lect.tex
  78. 9
      2_propositional_logic/multiple_choice/1_1_declarative_lect_sol.tex
  79. 10
      2_propositional_logic/multiple_choice/2_1_syntax_lect.tex
  80. 9
      2_propositional_logic/multiple_choice/2_1_syntax_lect_sol.tex
  81. 13
      2_propositional_logic/multiple_choice/4_1_notions_lect.tex
  82. 13
      2_propositional_logic/multiple_choice/4_1_notions_lect_sol.tex
  83. 12
      2_propositional_logic/multiple_choice/4_1_notions_self.tex
  84. 7
      2_propositional_logic/practical_questions/1_1_declarative_lect.tex
  85. 14
      2_propositional_logic/practical_questions/1_1_declarative_lect_sol.tex
  86. 6
      2_propositional_logic/practical_questions/1_1_declarative_self.tex
  87. 7
      2_propositional_logic/practical_questions/1_2_declarative_lect.tex
  88. 13
      2_propositional_logic/practical_questions/1_2_declarative_lect_sol.tex
  89. 6
      2_propositional_logic/practical_questions/1_2_declarative_self.tex
  90. 6
      2_propositional_logic/practical_questions/1_3_declarative_self.tex
  91. 6
      2_propositional_logic/practical_questions/1_4_declarative_self.tex
  92. 6
      2_propositional_logic/practical_questions/1_5_declarative_self.tex
  93. 6
      2_propositional_logic/practical_questions/1_6_declarative_self.tex
  94. 6
      2_propositional_logic/practical_questions/1_7_declarative_self.tex
  95. 6
      2_propositional_logic/practical_questions/1_8_declarative_self.tex
  96. 2
      2_propositional_logic/practical_questions/2_1_syntax_lect.tex
  97. 21
      2_propositional_logic/practical_questions/2_1_syntax_lect_sol.tex
  98. 3
      2_propositional_logic/practical_questions/2_1_syntax_self.tex
  99. 2
      2_propositional_logic/practical_questions/2_2_syntax_lect.tex
  100. 22
      2_propositional_logic/practical_questions/2_2_syntax_lect_sol.tex

9
2_propositional_logic/0001.tex

@ -0,0 +1,9 @@
\item \lect Look at the following statements and tick them if they are true.
\begin{itemize}
\item[$\square$] "\textit{Give me the butter}." is a declarative sentence.
\item[$\square$] Questions are always declarative sentences.
\item[$\square$] Declarative sentences can be true and false at the same time.
\item[$\square$] "\textit{My best friend is staying overnight.}" is a declarative sentence.
\end{itemize}

9
2_propositional_logic/0001_sol.tex

@ -0,0 +1,9 @@
\item \lect Look at the following statements and tick them if they are true.
\begin{itemize}
\item[$\square$] "\textit{Give me the butter}." is a declarative sentence.
\item[$\square$] Questions are always declarative sentences.
\item[$\square$] Declarative sentences can be true and false at the same time.
\item[$\ticked$] "\textit{My best friend is staying overnight.}" is a declarative sentence.
\end{itemize}

7
2_propositional_logic/0002.tex

@ -0,0 +1,7 @@
\item \lect Model the following sentences as detailed as possible in propositional logic.
\begin{enumerate}
\item Alice will either take the bike or the tram to get to the concert, not both.
\item Students will have to take an exam at the end of the semester.
\item If he is hungry and the fridge is not empty, he cooks for himself.
\end{enumerate}

14
2_propositional_logic/0002_sol.tex

@ -0,0 +1,14 @@
\begin{enumerate}
\item $p:$ \quad Alice will take the bike to get to the concert.
$q:$ \quad Alice will take the tram to get to the concert.
$$ (p \land \lnot q) \lor (\lnot p \land q) $$
\item $p:$ \quad Students will have to take an exam at the end of the semester.
$$ p $$
\item $p:$ \quad He is hungry.
$q:$ \quad The fridge is empty.
$r:$ \quad He cooks for himself.
$$ p \land \lnot q \imp r $$
\end{enumerate}

7
2_propositional_logic/0003.tex

@ -0,0 +1,7 @@
\item \lect Model the following sentences as detailed as possible in propositional logic.
\begin{enumerate}
\item If the air temperature is above 30°C, then the water temperature is above 20°C and I am able to go for a swim.
\item Your kid will be safe if and only if it learns to swim.
\item What time is it?
\end{enumerate}

13
2_propositional_logic/0003_sol.tex

@ -0,0 +1,13 @@
\begin{enumerate}
\item $p:$ \quad The air temperature is above 30°C.
$q:$ \quad The water temperature is above 20°C.
$r:$ \quad I am able to go for a swim.
$$ p \imp q \land r $$
\item $p:$ \quad Your kid will be safe.
$q:$ \quad Your kid learns to swim.
$$ p \leftrightarrow q $$
\item This is no declarative sentence.
\end{enumerate}

1
2_propositional_logic/0004.tex

@ -0,0 +1 @@
\item \lect Give the definition of well-formed formulas in propositional logic. \\

5
2_propositional_logic/0004_sol.tex

@ -0,0 +1,5 @@
We give the definition of well-formed formulas in propositional logic
using a grammar in Backus-Naur form (BNF) as:
%
$$\varphi \coloneqq ~ < \text{atomic proposition>} ~ | ~\varphi \wedge \varphi~ |~ \varphi \vee \varphi~ | ~\neg \varphi ~| ~\varphi \imp \varphi~ | ~\varphi \leftrightarrow \varphi~ | ~( \varphi )$$

5
2_propositional_logic/0004_sol.tex~

@ -0,0 +1,5 @@
We give the definition of well-formed formulas in propositional logic
using a grammar in Backus-Naur form (BNF) as:
%
$$\varphi \coloneqq ~ < \text{atomic proposition>} ~ | ~\varphi \wedge \varphi~ |~ \varphi \vee \varphi~ | ~\neg \varphi ~| ~\varphi \imp \varphi~ | ~\varphi \leftrightarrow \varphi~ | ~( \varphi )$$

10
2_propositional_logic/0005.tex

@ -0,0 +1,10 @@
\item \lect Let $p, q$ and $r$ be a atomic propositions. Tick all statements that are true.
\begin{itemize}
\item[$\square$] "$\lnot p \land \lor \enspace q$" is a propositional formula.
\item[$\square$] "$(p \land q) \lor (r \imp p)$" is a propositional formula.
\item[$\square$] "$\lnot p$" is a propositional formula.
\item[$\square$] "$\lor$" is a propositional formula.
\item[$\square$] "$p$" is a propositional formula.
\end{itemize}

9
2_propositional_logic/0005_sol.tex

@ -0,0 +1,9 @@
\item \lect Let $p, q$ and $r$ be a atomic propositions. Tick all statements that are true.
\begin{itemize}
\item[$\square$] "$\lnot p \land \lor \enspace q$" is a propositional formula.
\item[$\ticked$] "$(p \land q) \lor (r \imp p)$" is a propositional formula.
\item[$\ticked$] "$\lnot p$" is a propositional formula.
\item[$\square$] "$\lor$" is a propositional formula.
\item[$\ticked$] "$p$" is a propositional formula.
\end{itemize}

2
2_propositional_logic/0006.tex

@ -0,0 +1,2 @@
\item \lect Determine whether the string $\neg (a \vee \neg \neg b)$ is a well-formed formula using the parse
tree. Explain your answer.

21
2_propositional_logic/0006_sol.tex

@ -0,0 +1,21 @@
\begin{center}
\begin{forest}
for tree={circle, draw,
minimum size=2em,
inner sep=0pt,
s sep=2mm,
l sep=1mm}
[$\lnot$, name=not_one
[$\lor$, name=or
[$a$, name=a]
[$\lnot$, name=not_two
[$\lnot$, name=not_three
[$b$, name=b]
]
]
]
]
\end{forest}
\end{center}
Every leaf is a atomic variable and the other nodes are labeled with logical operators, thus this is a well-formed formula.

2
2_propositional_logic/0007.tex

@ -0,0 +1,2 @@
\item \lect Determine whether the string $\neg (a \vee \neg b \neg)$ is a well-formed formula using the parse
tree. Explain your answer.

22
2_propositional_logic/0007_sol.tex

@ -0,0 +1,22 @@
\begin{center}
\begin{forest}
for tree={circle, draw,
minimum size=2em,
inner sep=0pt,
s sep=2mm,
l sep=1mm}
[$\lnot$, name=not_one
[$\lor$, name=or
[$a$, name=a]
[$\lnot$, name=not_two
[$b$, name=b
[$\lnot$, name=not_three]
]
]
]
]
\end{forest}
\end{center}
One leaf is labeled with a logical operator, which is not allowed.
Thus this is not a well-formed formula.

3
2_propositional_logic/0008.tex

@ -0,0 +1,3 @@
\item \lect What do we refer to if we talk about the \emph{syntax} of propositional logic
and what do we understand under the \emph{semantics} of propositional logic. What is the difference between
syntax and semantic?

5
2_propositional_logic/0008_sol.tex

@ -0,0 +1,5 @@
Syntax refers to \emph{grammar}, while semantics refers to \emph{meaning}.
Syntax is the set of rules needed to ensure a formula is a well-formed formula; semantics assigns a truth value to formulas by assigning a truth value to the propositional variables used in the formula and by assigning the meaning via truth table to the logical operators.

1
2_propositional_logic/0009.tex

@ -0,0 +1 @@
\item \lect Give the definition of a model $\mathcal{M}$ of a formula in propositional logic?

2
2_propositional_logic/0009_sol.tex

@ -0,0 +1,2 @@
A \emph{model} $\mathcal{M}$ of a propositional formula $\varphi$ is an assignment of each propositional
variable in $\varphi$ to a truth value.

26
2_propositional_logic/0010.tex

@ -0,0 +1,26 @@
\item \lect Consider the propositional formula $\varphi = (p \wedge q)
\rightarrow (q \vee \neg r)$. Fill out the truth table for $\varphi$ and its
subformulas.
\begin{tabular}{|c|c|c||c|c|c||c|}
\hline
$p$&$q$&$r$&$p\wedge q$&$\neg r$&$q \vee \neg r$&$\varphi = (p \wedge q)\rightarrow (q \vee \neg r)$\\
\hline
\hline
\textbf{F} &\textbf{F} &\textbf{F} & & & & \\
\hline
\textbf{F} &\textbf{F} &\textbf{T} & & & & \\
\hline
\textbf{F} &\textbf{T} &\textbf{F} & & & & \\
\hline
\textbf{F} &\textbf{T} &\textbf{T} & & & & \\
\hline
\textbf{T} &\textbf{F} &\textbf{F} & & & & \\
\hline
\textbf{T} &\textbf{F} &\textbf{T} & & & & \\
\hline
\textbf{T} &\textbf{T} &\textbf{F} & & & & \\
\hline
\textbf{T} &\textbf{T} &\textbf{T} & & & & \\
\hline
\end{tabular}

26
2_propositional_logic/0010_sol.tex

@ -0,0 +1,26 @@
\item \lect Consider the propositional formula $\varphi = (p \wedge q)
\rightarrow (q \vee \neg r)$. Fill out the truth table for $\varphi$ and its
subformulas.
\begin{tabular}{|c|c|c||c|c|c||c|}
\hline
$p$&$q$&$r$&$p\wedge q$&$\neg r$&$q \vee \neg r$&$\varphi = (p \wedge q)\rightarrow (q \vee \neg r)$\\
\hline
\hline
\textbf{F} &\textbf{F} &\textbf{F} & F & T & T & T \\
\hline
\textbf{F} &\textbf{F} &\textbf{T} & F & F & F & T \\
\hline
\textbf{F} &\textbf{T} &\textbf{F} & F & T & T & T \\
\hline
\textbf{F} &\textbf{T} &\textbf{T} & F & F & T & T \\
\hline
\textbf{T} &\textbf{F} &\textbf{F} & F & T & T & T \\
\hline
\textbf{T} &\textbf{F} &\textbf{T} & F & F & F & T \\
\hline
\textbf{T} &\textbf{T} &\textbf{F} & T & T & T & T \\
\hline
\textbf{T} &\textbf{T} &\textbf{T} & T & F & T & T \\
\hline
\end{tabular}

7
2_propositional_logic/0011.tex

@ -0,0 +1,7 @@
\item \lect Consider the propositional formula $\varphi = \neg (\neg p
\vee q) \rightarrow (p \wedge \neg r)$.
Find a propositional formula $\psi$ that is syntactically
different from $\varphi$, but semantically equivalent to
$\varphi$. Show the semantic equivalence of $\varphi$ and
$\psi$ using truth tables.

47
2_propositional_logic/0011_sol.tex

@ -0,0 +1,47 @@
\begin{tabular}{|c|c|c||c|c|c||c|}
\hline
$p$ & $q$ & $r$ & $\neg p \vee q$ & $\neg (\neg p \vee q)$ & $p \wedge \neg r$ & $\varphi = \neg (\neg p \vee q) \rightarrow (p \wedge \neg r)$\\
\hline
\hline
\textbf{F} &\textbf{F} &\textbf{F} & T & F & F & T \\
\hline
\textbf{F} &\textbf{F} &\textbf{T} & T & F & F & T \\
\hline
\textbf{F} &\textbf{T} &\textbf{F} & T & F & F & T \\
\hline
\textbf{F} &\textbf{T} &\textbf{T} & T & F & F & T \\
\hline
\textbf{T} &\textbf{F} &\textbf{F} & F & T & T & T \\
\hline
\textbf{T} &\textbf{F} &\textbf{T} & F & T & F & F \\
\hline
\textbf{T} &\textbf{T} &\textbf{F} & T & F & T & T \\
\hline
\textbf{T} &\textbf{T} &\textbf{T} & T & F & F & T \\
\hline
\end{tabular}
$$\psi = \neg p \vee q \vee \neg r$$
\begin{tabular}{|c|c|c||c|c||c|}
\hline
$p$ & $q$ & $r$ & $\neg p$ & $\neg r$ & $\psi = \neg p \vee q \vee \neg r$\\
\hline
\hline
\textbf{F} &\textbf{F} &\textbf{F} & T & T & T \\
\hline
\textbf{F} &\textbf{F} &\textbf{T} & T & F & T \\
\hline
\textbf{F} &\textbf{T} &\textbf{F} & T & T & T \\
\hline
\textbf{F} &\textbf{T} &\textbf{T} & T & F & T \\
\hline
\textbf{T} &\textbf{F} &\textbf{F} & F & T & T \\
\hline
\textbf{T} &\textbf{F} &\textbf{T} & F & F & F \\
\hline
\textbf{T} &\textbf{T} &\textbf{F} & F & T & T \\
\hline
\textbf{T} &\textbf{T} &\textbf{T} & F & F & T \\
\hline
\end{tabular}

3
2_propositional_logic/0012.tex

@ -0,0 +1,3 @@
\item \lect Given is a formula $\varphi = ( p \lor ( \neg q \implies r ) ) \land ( \neg r \implies p )$
and a model $\mathcal{M} = \{ p = F, \ q = T, \ r = T\}$.
Determine the truth value of $\varphi$ for the given model $\mathcal{M}$ using its parse tree.

26
2_propositional_logic/0012_sol.tex

@ -0,0 +1,26 @@
\begin{center}
\begin{forest}
for tree={circle, draw,
minimum size=2em,
inner sep=0pt,
s sep=2mm,
l sep=1mm}
[$\land$, name=and, label={$T$}
[$\lor$, name=or, edge label={node[midway,left]{$T$}}
[$p$, name=p_one, edge label={node[midway,left]{$F$}}]
[$\imp$, name=imp_one, edge label={node[midway,right]{$T$}}
[$\lnot$, name=not_one, edge label={node[midway,left]{$F$}}
[$q$, name=q, edge label={node[midway,left]{$T$}}]
]
[$r$, name=r_one, edge label={node[midway,right]{$T$}}]
]
]
[$\imp$, name=imp_two, edge label={node[midway,right]{$T$}}
[$\lnot$, name=not_two, edge label={node[midway,left]{$F$}}
[$r$, name=r_two, edge label={node[midway,left]{$T$}}]
]
[$p$, name=p_two, edge label={node[midway,right]{$F$}}]
]
]
\end{forest}
\end{center}

1
2_propositional_logic/0013.tex

@ -0,0 +1 @@
\item \lect Give the definition of semantic entailment. \\

3
2_propositional_logic/0013_sol.tex

@ -0,0 +1,3 @@
Let $\varphi$ and $\psi$ be formulas in propositional logic. We say
that $\varphi \models \psi$ if and only if every model $\mathcal{M}$ that satisfies
$\varphi$ ($\mathcal{M} \models \varphi$) also satisfies $\psi$ ($\mathcal{M} \models \psi$).

1
2_propositional_logic/0014.tex

@ -0,0 +1 @@
\item \lect Give the definition of semantic equivalence.\\

4
2_propositional_logic/0014_sol.tex

@ -0,0 +1,4 @@
Let $\varphi$ and $\psi$ be formulas in propositional logic. We say
that $\varphi$ and $\psi$ are semantically equivalent if and only if $\varphi \models \psi$ and $\psi \models \varphi$ holds.
In that case we write $\varphi \equiv \psi$.

1
2_propositional_logic/0015.tex

@ -0,0 +1 @@
\item \lect Give the definition of validity. \\

1
2_propositional_logic/0015_sol.tex

@ -0,0 +1 @@
Let $\varphi$ be a formula of propositional logic. We call $\varphi$ valid if $\models \varphi$ holds, i.e., any possible model for $\varphi$ is a satisfying model.

1
2_propositional_logic/0016.tex

@ -0,0 +1 @@
\item \lect Give the definition of satisfiability and unsatisfiability. \\

4
2_propositional_logic/0016_sol.tex

@ -0,0 +1,4 @@
Given a formula $\varphi$ in propositional logic, we say that $\varphi$ is
\emph{satisfiable} if it has a model in which is evaluates to \emph{true}.
We say that $\varphi$ is
\emph{unsatisfiable} if there is no model under which $\varphi$ evaluates to \emph{true}.

3
2_propositional_logic/0017.tex

@ -0,0 +1,3 @@
\item \lect Consider a formula $\varphi$ in propositional logic. Let the
number of propositional variables in $\varphi$ be $n$. How many lines
does the truth table for $\varphi$ have? \\

1
2_propositional_logic/0017_sol.tex

@ -0,0 +1 @@
$2^n$

3
2_propositional_logic/0018.tex

@ -0,0 +1,3 @@
\item \lect Consider a truth table for a propositional formula $\varphi$
that has $R$ rows. How many propositional variables does
$\varphi$ have? \\

1
2_propositional_logic/0018_sol.tex

@ -0,0 +1 @@
$log_2(R)$

13
2_propositional_logic/0019.tex

@ -0,0 +1,13 @@
\item \lect Consider a formula $\varphi$ in propositional logic. In the
following list, tick all statements that are true.
\begin{itemize}
\item[$\square$] If $\varphi$ is not satisfiable, $\neg \varphi$
is valid.
\item[$\square$] If $\varphi$ is valid, $\neg \varphi$ is not
valid.
\item[$\square$] If $\varphi$ is valid, $\neg \varphi$ is not
satisfiable.
\item[$\square$] If $\varphi$ is not valid, $\neg \varphi$ is
satisfiable.
\end{itemize}

13
2_propositional_logic/0019_sol.tex

@ -0,0 +1,13 @@
\item \lect Consider a formula $\varphi$ in propositional logic. In the
following list, tick all statements that are true.
\begin{itemize}
\item[$\ticked$] If $\varphi$ is not satisfiable, $\neg \varphi$
is valid.
\item[$\ticked$] If $\varphi$ is valid, $\neg \varphi$ is not
valid.
\item[$\ticked$] If $\varphi$ is valid, $\neg \varphi$ is not
satisfiable.
\item[$\ticked$] If $\varphi$ is not valid, $\neg \varphi$ is
satisfiable.
\end{itemize}

19
2_propositional_logic/0020.tex

@ -0,0 +1,19 @@
\item \lect Given are the truth tables for the propositional logic formulas $\varphi$ and $\psi$.
Determine whether it holds that $\varphi \models \psi$, $\psi \models \varphi$, or neither.
\begin{center}
\begin{tabular}{ | c | c | c | c | c | c | }
\hline
$p$&$q$&$r$&$\varphi$ & $\psi$\\
\hline
\textbf{F} &\textbf{F} &\textbf{F} & F & F \\
\textbf{F} &\textbf{F} &\textbf{T} & T & T \\
\textbf{F} &\textbf{T} &\textbf{F} & F & F \\
\textbf{F} &\textbf{T} &\textbf{T} & T & T \\
\textbf{T} &\textbf{F} &\textbf{F} & F & F \\
\textbf{T} &\textbf{F} &\textbf{T} & F & T \\
\textbf{T} &\textbf{T} &\textbf{F} & T & T \\
\textbf{T} &\textbf{T} &\textbf{T} & T & T \\
\hline
\end{tabular}
\end{center}

1
2_propositional_logic/0020_sol.tex

@ -0,0 +1 @@
It holds that $\varphi \models \psi$.

36
2_propositional_logic/0021.tex

@ -0,0 +1,36 @@
\item \lect Consider the propositional formulas $\varphi = (p \rightarrow
q) \vee \neg r$ and $\psi = (\neg r \wedge p) \vee (\neg q \rightarrow \neg r)$.
\begin{enumerate}
\item Fill out the truth table for $\varphi$ and $\psi$ and
their subformulas.
\begin{tabular}{|c|c|c||c|c|c|c|c||c|c|}
\hline
$p$&$q$&$r$&$\neg q$&$\neg r$&$p \rightarrow q$&$\neg r \wedge p$&$\neg q \rightarrow \neg r$&$\varphi$&$\psi$\\
\hline
\hline
\textbf{F} &\textbf{F} &\textbf{F} & & & & & & &\\
\hline
\textbf{F} &\textbf{F} &\textbf{T} & & & & & & &\\
\hline
\textbf{F} &\textbf{T} &\textbf{F} & & & & & & &\\
\hline
\textbf{F} &\textbf{T} &\textbf{T} & & & & & & &\\
\hline
\textbf{T} &\textbf{F} &\textbf{F} & & & & & & &\\
\hline
\textbf{T} &\textbf{F} &\textbf{T} & & & & & & &\\
\hline
\textbf{T} &\textbf{T} &\textbf{F} & & & & & & &\\
\hline
\textbf{T} &\textbf{T} &\textbf{T} & & & & & & &\\
\hline
\end{tabular}
\vspace{0.5cm}
\item Which of the formulas is satisfiable?
\item Which of the formulas is valid?
\item Which of the two formulas $\varphi$ and $\psi$ entails the other?
\end{enumerate}

44
2_propositional_logic/0021_sol.tex

@ -0,0 +1,44 @@
\item \lect Consider the propositional formulas $\varphi = (p \rightarrow
q) \vee \neg r$ and $\psi = (\neg r \wedge p) \vee (\neg q \rightarrow \neg r)$.
\begin{enumerate}
\item Fill out the truth table for $\varphi$ and $\psi$ and
their subformulas.
\begin{tabular}{|c|c|c||c|c|c|c|c||c|c|}
\hline
$p$&$q$&$r$&$\neg q$&$\neg r$&$p \rightarrow q$&$\neg r \wedge p$&$\neg q \rightarrow \neg r$&$\varphi$&$\psi$\\
\hline
\hline
\textbf{F} &\textbf{F} &\textbf{F} & T & T & T & F & T & T & T \\
\hline
\textbf{F} &\textbf{F} &\textbf{T} & T & F & T & F & F & T & F \\
\hline
\textbf{F} &\textbf{T} &\textbf{F} & F & T & T & F & T & T & T \\
\hline
\textbf{F} &\textbf{T} &\textbf{T} & F & F & T & F & T & T & T \\
\hline
\textbf{T} &\textbf{F} &\textbf{F} & T & T & F & T & T & T & T \\
\hline
\textbf{T} &\textbf{F} &\textbf{T} & T & F & F & F & F & F & F \\
\hline
\textbf{T} &\textbf{T} &\textbf{F} & F & T & T & T & T & T & T \\
\hline
\textbf{T} &\textbf{T} &\textbf{T} & F & F & T & F & T & T & T \\
\hline
\end{tabular}
\vspace{0.5cm}
\item Which of the formulas is satisfiable?
Both of them are satisfiable.
\item Which of the formulas is valid?
None of them are valid.
\item Which of the two formulas $\varphi$ and $\psi$ entails the other?
It holds that $\psi \models \varphi$.
\end{enumerate}

47
2_propositional_logic/0022.tex

@ -0,0 +1,47 @@
\item \lect Use propositional logic to solve Sudoku. Rules: A Sudoku grid consists of a 9x9 square, which is partitioned into nine 3x3 squares. The goal of the game is to write one number from 1 to 9 in each cell in such a way, that each row, each column, and each 3x3-square contains each number exactly once. Usually several numbers are already given.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% source: https://texample.net/tikz/examples/sudoku/
%%%% Author: Roberto Bonvallet, published 2012-02-01, last accessed 2021-02-14, modified
\newcounter{row}
\newcounter{col}
\newcommand\setrow[9]{
\setcounter{col}{1}
\foreach \n in {#1, #2, #3, #4, #5, #6, #7, #8, #9} {
\edef\x{\value{col} - 0.5}
\edef\y{9.5 - \value{row}}
\node[anchor=center] at (\x, \y) {\n};
\stepcounter{col}
}
\stepcounter{row}
}
\begin{center}
\begin{tikzpicture}[scale=.35]
\begin{scope}
\draw (0, 0) grid (9, 9);
\draw[very thick, scale=3] (0, 0) grid (3, 3);
\setcounter{row}{1}
\setrow { }{6}{ } {7}{ }{ } {1}{5}{ }
\setrow { }{ }{3} {9}{ }{ } {8}{ }{ }
\setrow { }{ }{2} {3}{ }{ } { }{4}{9}
\setrow { }{ }{7} { }{ }{4} { }{ }{ }
\setrow { }{4}{ } { }{9}{ } { }{8}{ }
\setrow { }{ }{ } {1}{ }{ } {4}{ }{ }
\setrow {6}{7}{ } { }{ }{9} {3}{ }{ }
\setrow { }{ }{9} { }{ }{2} {5}{ }{ }
\setrow { }{2}{8} { }{ }{7} { }{6}{ }
\node[anchor=center] at (4.5, -1) {Sudoku};
\end{scope}
\end{tikzpicture}
\end{center}
In order to model SUDOKU using propositional logic, we first need to define the propositional variables that we
want to use in our formula. We define variables $x_{ijk}$ for every row $i$,
for every column $j$, and for every value $k$. This encoding yields to 729 variables ranging from $x_{111}$ to $x_{999}$.
Using this variables, define the constraints for the rows, the columns, the 3x3-squares and the predefined numbers. \\
\vspace{0.5cm}

30
2_propositional_logic/0022_sol.tex

@ -0,0 +1,30 @@
\begin{itemize}
\item \emph{Row-constraints:} \emph{If} a cell in a row has a certain value, \emph{then} no other cell in that row can have that value. For each $i$, and each $k$ we have:
$$x_{i1k} \imp \lnot x_{i2k} \land \lnot x_{i3k} \land ... \land \lnot x_{i9k}$$
$$x_{i2k} \imp \lnot x_{i1k} \land \lnot x_{i2k} \land ... \land \lnot x_{i9k}$$
$$\vdots$$
$$x_{i9k} \imp \lnot x_{i1k} \land \lnot x_{i2k} \land ... \land \lnot x_{i8k}$$
\item \emph{Column-constraints:} \emph{If} a cell in a column has a certain value, \emph{then} no other cell in that column can have that value. For each $j$, and each $k$ we have:
$$x_{1jk} \imp \lnot x_{2jk} \land \lnot x_{3jk} \land ... \land \lnot x_{9jk}$$
$$x_{2jk} \imp \lnot x_{1jk} \land \lnot x_{2jk} \land ... \land \lnot x_{9jk}$$
$$\vdots$$
$$x_{9jk} \imp \lnot x_{1jk} \land \lnot x_{2jk} \land ... \land \lnot x_{8jk}$$
\item \emph{Square-constraints:} \emph{If} a cell in a 3x3 square has a certain value, \emph{then} no other cell in that square can have that value. For the first square, we have for each $k$:
$$x_{11k} \imp \lnot x_{12k} \land \lnot x_{13k} \land \lnot x_{21k} \land \lnot x_{22k} \land \lnot x_{23k} \land \lnot x_{31k} \land \lnot x_{32k} \land \lnot x_{33k}$$
$$\vdots$$
$$x_{33k} \imp \lnot x_{11k} \land \lnot x_{12k} \land \lnot x_{13k} \land \lnot x_{21k} \land \lnot x_{22k} \land \lnot x_{23k} \land \lnot x_{31k} \land \lnot x_{32k}$$
The constraints for the remaining squares are similar.
\item \emph{Predefined-number-constraints:} If a cell has a predefined value, we need to set the corresponding variable to true, e.g., the cell in the fifth row and the fifth column has the value 9.
Therefore we have $$x_{559}.$$
\item \emph{Cell-constraints:} Each cell must contain a number ranging from one to nine.
For each $i$, and each $j$ we have
$$x_{ij1} \lor x_{ij2} \lor ... \lor x_{ij9}.$$ On its own, this constraint would allow for a cell to have more than one value. However, this is not possible due to the other constraints.
\end{itemize}
To construct the final propositional formula, all constraints need to be connected via conjunctions.
A satisfying assignment for the final formula represents one possible solution for the Sudoku puzzle.
In case that there does not exists a solution, the SAT sovler would return UNSAT.

6
2_propositional_logic/1001.tex

@ -0,0 +1,6 @@
\item \self Model the following sentences as detailed as possible in propositional logic.
\begin{enumerate}
\item If all students prepare themselves appropriately, everyone will pass the exam.
\item Graz is the second biggest city of Austria.
\item If I only had more money!
\end{enumerate}

6
2_propositional_logic/1002.tex

@ -0,0 +1,6 @@
\item \self Model the following sentences as detailed as possible in propositional logic.
\begin{enumerate}
\item If I pass the exam, then if I pass it with more than 90 Points I will get the best grade possible.
\item Do you like Pizza?
\item All cats hate dogs and love mice.
\end{enumerate}

6
2_propositional_logic/1003.tex

@ -0,0 +1,6 @@
\item \self Model the following sentences as detailed as possible in propositional logic.
\begin{enumerate}
\item Bob will win the lottery, if and only if he gets all the numbers right.
\item Mozart was born in Salzburg, not in Innsbruck.
\item If the year is a leap-year, then February will have 29 days.
\end{enumerate}

6
2_propositional_logic/1004.tex

@ -0,0 +1,6 @@
\item \self Model the following sentences as detailed as possible in propositional logic.
\begin{enumerate}
\item Either Bob, Alice or neither are going to the lecture today.
\item Today is Friday, if and only if yesterday was Thursday and tomorrow is not Sunday.
\item Try to be patient and please be quiet.
\end{enumerate}

6
2_propositional_logic/1005.tex

@ -0,0 +1,6 @@
\item \self Model the following sentences as detailed as possible in propositional logic.
\begin{enumerate}
\item If a formula is unsat, it cannot be valid.
\item It can be proven that there exists an infinite number of primes.
\item A sentence is called declarative, if and only if it can be assigned a truth value.
\end{enumerate}

6
2_propositional_logic/1006.tex

@ -0,0 +1,6 @@
\item \self Model the following sentences as detailed as possible in propositional logic.
\begin{enumerate}
\item Today it will be either be foggy or it will rain today, but not both.
\item If and only if everybody comes in a costume to the party, we have a carnival.
\item No pain, no gain.
\end{enumerate}

6
2_propositional_logic/1007.tex

@ -0,0 +1,6 @@
\item \self Model the following sentences as detailed as possible in propositional logic.
\begin{enumerate}
\item If all students pass, the professor will be happy.
\item Bob is taller than Alice, but shorter than Charlie.
\item If there is lightning there must be thunder and vice versa.
\end{enumerate}

6
2_propositional_logic/1008.tex

@ -0,0 +1,6 @@
\item \self Model the following sentences as detailed as possible in propositional logic.
\begin{enumerate}
\item If the past hurts, you can either run from it, or learn from it.
\item If life gives you lemons, make lemonade.
\item A good pizza has salami or tuna on it, but not both at the same time.
\end{enumerate}

3
2_propositional_logic/1009.tex

@ -0,0 +1,3 @@
\item \self
Determine whether the string $(a \vee b) \rightarrow (\neg (x \neg ))$ is a well-formed formula using the parse tree.
Explain your answer. \\

5
2_propositional_logic/1009_sol.tex

@ -0,0 +1,5 @@
Propositional logic formulas consist of \emph{atomic propositions}, \emph{logical operators}, and \emph{parentheses}.
The \emph{well-formed formulas} of propositional logic are those
which we obtain by using the construction rules below:
$$\varphi \coloneqq ~ < \text{atomic proposition>} ~ | ~\varphi \wedge \varphi~ |~ \varphi \vee \varphi~ | ~\neg \varphi ~| ~\varphi \imp \varphi~ | ~\varphi \leftrightarrow \varphi~ | ~( \varphi )$$

2
2_propositional_logic/1010.tex

@ -0,0 +1,2 @@
\item \self Given the formula $\varphi = p \lor q \land q \imp \lnot r \leftrightarrow \lnot p \land s$, how should the formula be interpreted according to the binding priorities? Make brackets to make the correct binding priorities clear
and draw the parse tree for $\varphi$. \\

1
2_propositional_logic/1011.tex

@ -0,0 +1 @@
\item \self How can you determine using a parse tree whether a string is a \emph{well-formed formula}?

1
2_propositional_logic/1012.tex

@ -0,0 +1 @@
\item \self How can you determine using a parse tree whether a string is a \emph{well-formed formula}?

1
2_propositional_logic/1013.tex

@ -0,0 +1 @@
\item \self Give the definition of the \emph{semantics} of propositional logic. \\

1
2_propositional_logic/1013_sol.tex

@ -0,0 +1 @@
The semantics of propositional logic define truth values to propositional variables and defines the rules for the propositional operators via their corresponding \emph{truth tables}.

1
2_propositional_logic/1014.tex

@ -0,0 +1 @@
\item \self Give the definition of a model $\mathcal{M}$ of a formula in propositional logic? \\

4
2_propositional_logic/1014_sol.tex

@ -0,0 +1,4 @@
\emph{Satisfying Model:} truth assignment such that the formula resolves to \emph{true}.\\
\emph{Falsifying Model:} truth assignment such that the formula resolves to \emph{false}.\\
We write: $\mathcal{M} \models \varphi$: The model satisfies the formula.\\
and $\mathcal{M} \nmodels \varphi$: The model does not satisfy the formula.

2
2_propositional_logic/1015.tex

@ -0,0 +1,2 @@
\item \self What is the difference between a \emph{satisfying model} and a \emph{falsifying model}
of a formula in propositional logic? Give a satisfying and a falsifying model for the formula $\varphi = a \implies b$. \\

3
2_propositional_logic/1016.tex

@ -0,0 +1,3 @@
\item \self Given is a formula $\varphi = ( ( p \land \neg q) \implies ( p \lor \neg r ) ) \land ( \neg q \implies \neg r )$
and a model $\mathcal{M} = \{ p = T, \ q = F, \ r = T\}$.
Determine the truth value of $\varphi$ for the given model $\mathcal{M}$ using its parse tree.

2
2_propositional_logic/1017.tex

@ -0,0 +1,2 @@
\item \self Given is a formula $\varphi = ( ( q \implies \neg p) \lor r) \implies (q \land (r \implies p) )$.
Determine a satisfying model $\mathcal{M}_1$ and a falsifying model $\mathcal{M}_2$ using its parse tree.

2
2_propositional_logic/1018.tex

@ -0,0 +1,2 @@
\item \self Given is a formula $\varphi = ( \neg ( r \leftrightarrow q) \implies \neg r ) \land (\neg (r \implies q) \lor (p \implies q))$.
Determine a satisfying model $\mathcal{M}_1$ and a falsifying model $\mathcal{M}_2$ using its parse tree.

12
2_propositional_logic/1019.tex

@ -0,0 +1,12 @@
%4 Points
\item \self Consider a formula $\varphi$ in propositional logic. In the
following list, tick all statements that are true.
\begin{itemize}
\item[$\square$] If $\varphi$ is a tautology, a falsifying model can be found.
\item[$\square$] If $\varphi$ is equivalent to $\psi$, a satisfying model for $\varphi$ always satisfies $\psi$.
\item[$\square$] If $\varphi$ has no satisfying model, it is called a tautology.
\item[$\square$] If $\varphi$ semantically entails $\psi$, a satisfying model for $\psi$ always satisfies $\varphi$.
\end{itemize}

2
2_propositional_logic/1020.tex

@ -0,0 +1,2 @@
\item \self Why are truth tables, in general, not used to determine
equivalence of large formulas? \\

4
2_propositional_logic/1021.tex

@ -0,0 +1,4 @@
\item \self Consider a formula $\varphi$ in propositional logic. You want
to test whether $\varphi$ is \emph{valid}. However, you only have
a procedure for checking satisfiability. Describe how to use this
procedure to determine whether $\varphi$ is valid. \\

37
2_propositional_logic/1022.tex

@ -0,0 +1,37 @@
\item \self Consider the propositional formulas $\varphi = (p \vee q)
\rightarrow r$, and $\psi = r \vee (\neg p \wedge \neg q)$.
\begin{enumerate}
\item Fill out the truth table for $\varphi$ and $\psi$ (and
their subformulas).
\begin{tabular}{|c|c|c||c|c|c|c||c|c|}
\hline
$p$&$q$&$r$&$\neg p$&$\neg q$&$p \vee q$&$\neg p \wedge \neg q$&$\varphi$&$\psi$\\
\hline
\hline
\textbf{F} &\textbf{F} &\textbf{F} & & & & & &\\
\hline
\textbf{F} &\textbf{F} &\textbf{T} & & & & & &\\
\hline
\textbf{F} &\textbf{T} &\textbf{F} & & & & & &\\
\hline
\textbf{F} &\textbf{T} &\textbf{T} & & & & & &\\
\hline
\textbf{T} &\textbf{F} &\textbf{F} & & & & & &\\
\hline
\textbf{T} &\textbf{F} &\textbf{T} & & & & & &\\
\hline
\textbf{T} &\textbf{T} &\textbf{F} & & & & & &\\
\hline
\textbf{T} &\textbf{T} &\textbf{T} & & & & & &\\
\hline
\end{tabular}
\item Which of the formulas is satisfiable?
\item Which of the formulas is valid?
\item Is $\varphi$ equivalent to $\psi$?
\item Does $\varphi$ semantically entail $\psi$?
\item Does $\psi$ semantically entail $\varphi$?
\end{enumerate}

37
2_propositional_logic/1023.tex

@ -0,0 +1,37 @@
\item \self Consider the Boolean functions $\varphi_1$ and $\varphi_2$ over variables $p$,
$q$, and $r$. Their truth table is given below.
\begin{tabular}{|c|c|c|c|c||c|c|}
\hline
$p$&$q$&$r$&$\varphi_1$&$\varphi_2$&$\psi$&$\gamma$\\
\hline
\hline
\textbf{F} &\textbf{F} &\textbf{F} &\textbf{F} &\textbf{F} & &\\
\hline
\textbf{F} &\textbf{F} &\textbf{T} &\textbf{F} &\textbf{F} & &\\
\hline
\textbf{F} &\textbf{T} &\textbf{F} &\textbf{T} &\textbf{T} & &\\
\hline
\textbf{F} &\textbf{T} &\textbf{T} &\textbf{F} &\textbf{F} & &\\
\hline
\textbf{T} &\textbf{F} &\textbf{F} &\textbf{T} &\textbf{F} & &\\
\hline
\textbf{T} &\textbf{F} &\textbf{T} &\textbf{F} &\textbf{T} & &\\
\hline
\textbf{T} &\textbf{T} &\textbf{F} &\textbf{F} &\textbf{F} & &\\
\hline
\textbf{T} &\textbf{T} &\textbf{T} &\textbf{F} &\textbf{F} & &\\
\hline
\end{tabular}
\begin{enumerate}
\item Fill the column for $\psi$ such that $\varphi_1$ entails
$\psi$ (i.e., $\varphi_1 \models \psi$), but $\varphi_2$ does
\emph{not} entail $\psi$ (i.e., $\varphi_2 \nvDash \psi$).
\item Fill the column for $\gamma$ such that $\varphi_1$ implies
$\gamma$ (i.e., $\varphi_1 \rightarrow \gamma$) as well as $\varphi_2$ implies $\gamma$ (i.e., $\varphi_2 \rightarrow \gamma$).
\end{enumerate}

37
2_propositional_logic/1024.tex

@ -0,0 +1,37 @@
\item \self Consider the propositional formula $\varphi = p \rightarrow
(q \rightarrow r)$.
\begin{enumerate}
\item Fill out the truth table for $\varphi$ and its
subformulas.
\begin{tabular}{|c|c|c||c|c|c|}
\hline
$p$&$q$&$r$&$(q \rightarrow r)$&$\varphi=p \rightarrow (q \rightarrow r)$\\
\hline
\hline
\textbf{F} &\textbf{F} &\textbf{F} & & \\
\hline
\textbf{F} &\textbf{F} &\textbf{T} & & \\
\hline
\textbf{F} &\textbf{T} &\textbf{F} & & \\
\hline
\textbf{F} &\textbf{T} &\textbf{T} & & \\
\hline
\textbf{T} &\textbf{F} &\textbf{F} & & \\
\hline
\textbf{T} &\textbf{F} &\textbf{T} & & \\
\hline
\textbf{T} &\textbf{T} &\textbf{F} & & \\
\hline
\textbf{T} &\textbf{T} &\textbf{T} & & \\
\hline
\end{tabular}
\item Is $\varphi$ satisfiable?
\item Give a formula $\psi$ that is semantically equivalent to
$\varphi$, but does not use the ``$\rightarrow$'' connective.
\item How can you check whether $\psi$ is semantically equivalent
to $\varphi$?
\end{enumerate}

38
2_propositional_logic/1025.tex

@ -0,0 +1,38 @@
\item \self Consider the propositional formula $\varphi = (p \rightarrow q)
\wedge(q \rightarrow r) \wedge (\neg r \vee p)$.
\begin{enumerate}
\item Fill out the truth table for $\varphi$ (and its
subformulas).
\begin{tabular}{|c|c|c||c|c|c|c|c|}
\hline
$p$&$q$&$r$&$(p \rightarrow q)$&$(q \rightarrow r)$&$\;\neg r\;$&$(\neg r \vee p)$&$\quad\varphi\quad$\\
\hline
\hline
\textbf{F} &\textbf{F} &\textbf{F} & & & & &\\
\hline
\textbf{F} &\textbf{F} &\textbf{T} & & & & &\\
\hline
\textbf{F} &\textbf{T} &\textbf{F} & & & & &\\
\hline
\textbf{F} &\textbf{T} &\textbf{T} & & & & &\\
\hline
\textbf{T} &\textbf{F} &\textbf{F} & & & & &\\
\hline
\textbf{T} &\textbf{F} &\textbf{T} & & & & &\\
\hline
\textbf{T} &\textbf{T} &\textbf{F} & & & & &\\
\hline
\textbf{T} &\textbf{T} &\textbf{T} & & & & &\\
\hline
\end{tabular}
\item Is $\varphi$ satisfiable?
\item Is $\varphi$ valid?
\item Give a formula $\psi$ that semantically entails $\varphi$
(i.e., it should be the case that $\psi \models \varphi$).
\item How can you check, using a truth table, whether $\psi$
semantically entails $\varphi$?
\end{enumerate}

37
2_propositional_logic/1026.tex

@ -0,0 +1,37 @@
\item \self Consider the propositional formula $\varphi = (\neg p \rightarrow r) \wedge (r \rightarrow \neg p) \wedge q$.
\begin{enumerate}
\item Fill out the truth table for $\varphi$ (and its
subformulas).
\begin{tabular}{|c|c|c||c|c|c|c|}
\hline
$p$&$q$&$r$&$\;\neg p\;$&$(\neg p \rightarrow r)$&$(r \rightarrow \neg p)$&$\quad\varphi\quad$\\
\hline
\hline
\textbf{F} &\textbf{F} &\textbf{F} & & & &\\
\hline
\textbf{F} &\textbf{F} &\textbf{T} & & & &\\
\hline
\textbf{F} &\textbf{T} &\textbf{F} & & & &\\
\hline
\textbf{F} &\textbf{T} &\textbf{T} & & & &\\
\hline
\textbf{T} &\textbf{F} &\textbf{F} & & & &\\
\hline
\textbf{T} &\textbf{F} &\textbf{T} & & & &\\
\hline
\textbf{T} &\textbf{T} &\textbf{F} & & & &\\
\hline
\textbf{T} &\textbf{T} &\textbf{T} & & & &\\
\hline
\end{tabular}
\item Is the negation of $\varphi$ satisfiable?
\item Is the negation of $\varphi$ valid?
\item Give a formula $\psi$ that semantically entails $\varphi$
(i.e., it should be the case that $\psi \models \varphi$).
\item Give a formula $\psi$ such that $\varphi$ semantically entails $\psi$
(i.e., it should be the case that $\varphi \models \psi$).
\end{enumerate}

35
2_propositional_logic/1027.tex

@ -0,0 +1,35 @@
\item \self Consider the propositional formula
$\varphi = ((p \rightarrow q)\wedge(\neg p \rightarrow \neg q)) \rightarrow r$.
\begin{enumerate}
\item Fill out the truth table for $\varphi$ and its
subformulas.
\begin{tabular}{|c|c|c||c|c|c|c|c|c|}
\hline
$p$&$q$&$r$&$\;\neg p\;$&$\;\neg q\;$&$(p \rightarrow q)$&$(\neg p \rightarrow \neg q)$&$(p \rightarrow q)\wedge (\neg p \rightarrow \neg q)$&$\quad\varphi\quad$\\
\hline
\hline
\textbf{F} &\textbf{F} &\textbf{F} & & & & & &\\
\hline
\textbf{F} &\textbf{F} &\textbf{T} & & & & & &\\
\hline
\textbf{F} &\textbf{T} &\textbf{F} & & & & & &\\
\hline
\textbf{F} &\textbf{T} &\textbf{T} & & & & & &\\
\hline
\textbf{T} &\textbf{F} &\textbf{F} & & & & & &\\
\hline
\textbf{T} &\textbf{F} &\textbf{T} & & & & & &\\
\hline
\textbf{T} &\textbf{T} &\textbf{F} & & & & & &\\
\hline
\textbf{T} &\textbf{T} &\textbf{T} & & & & & &\\
\hline
\end{tabular}
\item Is $\varphi$ unsatisfiable?
\item Is the negation of $\varphi$ valid?
\item Give a formula $\psi$ that is semantically equivalent to
$\varphi$, but does not use the ``$\rightarrow$'' connective.
\end{enumerate}

61
2_propositional_logic/1028.tex

@ -0,0 +1,61 @@
\item \self Describe the Latin Square Puzzle using propositional logic.
In the Latin Square Puzzle one has to color cells in an (n×n) grid such that there is exactly one colored cell in each row and each column. Furthermore, colored cells must not be adjacent to each other (also not diagonally). Numbers contained in certain cells of the grid indicate the exact number of colored cells that have to be adjacent (including diagonally) to it. Numbered cells can contain the numbers {0, 1, 2} and cannot be colored.
\newcounter{rowl}
\newcounter{coll}
\newcommand\setrowlsp[5]{
\setcounter{coll}{1}
\foreach \n in {#1, #2, #3, #4, #5} {
\edef\x{\value{coll} - 0.5}
\edef\y{5.5 - \value{rowl}}
\node[anchor=center] at (\x, \y) {\n};
\stepcounter{coll}
}
\stepcounter{rowl}
}
\begin{center}
\begin{tikzpicture}[every node/.style={minimum size=.5cm-\pgflinewidth, outer sep=0pt},scale=.5]
\begin{scope}
\draw (0, 0) grid (5, 5);
\setcounter{rowl}{1}
\setrowlsp { }{ }{ }{2}{ }
\setrowlsp { }{ }{ }{ }{ }
\setrowlsp { }{ }{ }{ }{ }
\setrowlsp { }{ }{ }{ }{ }
\setrowlsp { }{1}{ }{ }{ }
\end{scope}
\begin{scope}[xshift=8cm]
\node[fill=lightgray] at (0.5,0.5) {};
\node[fill=lightgray] at (1.5,2.5) {};
\node[fill=lightgray] at (2.5,4.5) {};
\node[fill=lightgray] at (3.5,1.5) {};
\node[fill=lightgray] at (4.5,3.5) {};
\draw (0, 0) grid (5, 5);
\setcounter{rowl}{1}
\setrowlsp { }{ }{ }{2}{ }
\setrowlsp { }{ }{ }{ }{ }
\setrowlsp { }{ }{ }{ }{ }
\setrowlsp { }{ }{ }{ }{ }
\setrowlsp { }{1}{ }{ }{ }
\node[anchor=center] at (-1.5, -1) {Example Latin Square Puzzle and its solution};
\end{scope}
\end{tikzpicture}
\end{center}
Find propositional formulas which describe the puzzle and which could be used to solve it. Focus on explaining the concept of the formulas. You do not have to explicitly list all formulas and you do not have to solve the puzzle.
\emph{Hints:} Use propositional atoms $c_{i,j}$, $c_{i,j,0}$, $c_{i,j,1}$,$c_{i,j,2}$ to represent each cell of the $(n \times n)$ game board. If $c_{i,j}$ has the value \emph{True}, the cell $i,j$ is colored, otherwise it is not colored. If $c_{i,j,x}$ has the value \emph{True}, the cell $i,j$ contains the number $x$.
Express the following constraints:
\begin{enumerate}
\item There is exactly one colored cell in row $i$.
\item No colored cells are adjacent to each other.
\item No numbered cells can be colored.
\item Numbered cells are adjacent to the indicated amount of colored cells.
\end{enumerate}

9
2_propositional_logic/multiple_choice/1_1_declarative_lect.tex

@ -0,0 +1,9 @@
\item \lect Look at the following statements and tick them if they are true.
\begin{itemize}
\item[$\square$] "\textit{Give me the butter}." is a declarative sentence.
\item[$\square$] Questions are always declarative sentences.
\item[$\square$] Declarative sentences can be true and false at the same time.
\item[$\square$] "\textit{My best friend is staying overnight.}" is a declarative sentence.
\end{itemize}

9
2_propositional_logic/multiple_choice/1_1_declarative_lect_sol.tex

@ -0,0 +1,9 @@
\item \lect Look at the following statements and tick them if they are true.
\begin{itemize}
\item[$\square$] "\textit{Give me the butter}." is a declarative sentence.
\item[$\square$] Questions are always declarative sentences.
\item[$\square$] Declarative sentences can be true and false at the same time.
\item[$\ticked$] "\textit{My best friend is staying overnight.}" is a declarative sentence.
\end{itemize}

10
2_propositional_logic/multiple_choice/2_1_syntax_lect.tex

@ -0,0 +1,10 @@
\item \lect Let $p, q$ and $r$ be a atomic propositions. Tick all statements that are true.
\begin{itemize}
\item[$\square$] "$\lnot p \land \lor \enspace q$" is a propositional formula.
\item[$\square$] "$(p \land q) \lor (r \imp p)$" is a propositional formula.
\item[$\square$] "$\lnot p$" is a propositional formula.
\item[$\square$] "$\lor$" is a propositional formula.
\item[$\square$] "$p$" is a propositional formula.
\end{itemize}

9
2_propositional_logic/multiple_choice/2_1_syntax_lect_sol.tex

@ -0,0 +1,9 @@
\item \lect Let $p, q$ and $r$ be a atomic propositions. Tick all statements that are true.
\begin{itemize}
\item[$\square$] "$\lnot p \land \lor \enspace q$" is a propositional formula.
\item[$\ticked$] "$(p \land q) \lor (r \imp p)$" is a propositional formula.
\item[$\ticked$] "$\lnot p$" is a propositional formula.
\item[$\square$] "$\lor$" is a propositional formula.
\item[$\ticked$] "$p$" is a propositional formula.
\end{itemize}

13
2_propositional_logic/multiple_choice/4_1_notions_lect.tex

@ -0,0 +1,13 @@
\item \lect Consider a formula $\varphi$ in propositional logic. In the
following list, tick all statements that are true.
\begin{itemize}
\item[$\square$] If $\varphi$ is not satisfiable, $\neg \varphi$
is valid.
\item[$\square$] If $\varphi$ is valid, $\neg \varphi$ is not
valid.
\item[$\square$] If $\varphi$ is valid, $\neg \varphi$ is not
satisfiable.
\item[$\square$] If $\varphi$ is not valid, $\neg \varphi$ is
satisfiable.
\end{itemize}

13
2_propositional_logic/multiple_choice/4_1_notions_lect_sol.tex

@ -0,0 +1,13 @@
\item \lect Consider a formula $\varphi$ in propositional logic. In the
following list, tick all statements that are true.
\begin{itemize}
\item[$\ticked$] If $\varphi$ is not satisfiable, $\neg \varphi$
is valid.
\item[$\ticked$] If $\varphi$ is valid, $\neg \varphi$ is not
valid.
\item[$\ticked$] If $\varphi$ is valid, $\neg \varphi$ is not
satisfiable.
\item[$\ticked$] If $\varphi$ is not valid, $\neg \varphi$ is
satisfiable.
\end{itemize}

12
2_propositional_logic/multiple_choice/4_1_notions_self.tex

@ -0,0 +1,12 @@
%4 Points
\item \self Consider a formula $\varphi$ in propositional logic. In the
following list, tick all statements that are true.
\begin{itemize}
\item[$\square$] If $\varphi$ is a tautology, a falsifying model can be found.
\item[$\square$] If $\varphi$ is equivalent to $\psi$, a satisfying model for $\varphi$ always satisfies $\psi$.
\item[$\square$] If $\varphi$ has no satisfying model, it is called a tautology.
\item[$\square$] If $\varphi$ semantically entails $\psi$, a satisfying model for $\psi$ always satisfies $\varphi$.
\end{itemize}

7
2_propositional_logic/practical_questions/1_1_declarative_lect.tex

@ -0,0 +1,7 @@
\item \lect Model the following sentences as detailed as possible in propositional logic.
\begin{enumerate}
\item Alice will either take the bike or the tram to get to the concert, not both.
\item Students will have to take an exam at the end of the semester.
\item If he is hungry and the fridge is not empty, he cooks for himself.
\end{enumerate}

14
2_propositional_logic/practical_questions/1_1_declarative_lect_sol.tex

@ -0,0 +1,14 @@
\begin{enumerate}
\item $p:$ \quad Alice will take the bike to get to the concert.
$q:$ \quad Alice will take the tram to get to the concert.
$$ (p \land \lnot q) \lor (\lnot p \land q) $$
\item $p:$ \quad Students will have to take an exam at the end of the semester.
$$ p $$
\item $p:$ \quad He is hungry.
$q:$ \quad The fridge is empty.
$r:$ \quad He cooks for himself.
$$ p \land \lnot q \imp r $$
\end{enumerate}

6
2_propositional_logic/practical_questions/1_1_declarative_self.tex

@ -0,0 +1,6 @@
\item \self Model the following sentences as detailed as possible in propositional logic.
\begin{enumerate}
\item If all students prepare themselves appropriately, everyone will pass the exam.
\item Graz is the second biggest city of Austria.
\item If I only had more money!
\end{enumerate}

7
2_propositional_logic/practical_questions/1_2_declarative_lect.tex

@ -0,0 +1,7 @@
\item \lect Model the following sentences as detailed as possible in propositional logic.
\begin{enumerate}
\item If the air temperature is above 30°C, then the water temperature is above 20°C and I am able to go for a swim.
\item Your kid will be safe if and only if it learns to swim.
\item What time is it?
\end{enumerate}

13
2_propositional_logic/practical_questions/1_2_declarative_lect_sol.tex

@ -0,0 +1,13 @@
\begin{enumerate}
\item $p:$ \quad The air temperature is above 30°C.
$q:$ \quad The water temperature is above 20°C.
$r:$ \quad I am able to go for a swim.
$$ p \imp q \land r $$
\item $p:$ \quad Your kid will be safe.
$q:$ \quad Your kid learns to swim.
$$ p \leftrightarrow q $$
\item This is no declarative sentence.
\end{enumerate}

6
2_propositional_logic/practical_questions/1_2_declarative_self.tex

@ -0,0 +1,6 @@
\item \self Model the following sentences as detailed as possible in propositional logic.
\begin{enumerate}
\item If I pass the exam, then if I pass it with more than 90 Points I will get the best grade possible.
\item Do you like Pizza?
\item All cats hate dogs and love mice.
\end{enumerate}

6
2_propositional_logic/practical_questions/1_3_declarative_self.tex

@ -0,0 +1,6 @@
\item \self Model the following sentences as detailed as possible in propositional logic.
\begin{enumerate}
\item Bob will win the lottery, if and only if he gets all the numbers right.
\item Mozart was born in Salzburg, not in Innsbruck.
\item If the year is a leap-year, then February will have 29 days.
\end{enumerate}

6
2_propositional_logic/practical_questions/1_4_declarative_self.tex

@ -0,0 +1,6 @@
\item \self Model the following sentences as detailed as possible in propositional logic.
\begin{enumerate}
\item Either Bob, Alice or neither are going to the lecture today.
\item Today is Friday, if and only if yesterday was Thursday and tomorrow is not Sunday.
\item Try to be patient and please be quiet.
\end{enumerate}

6
2_propositional_logic/practical_questions/1_5_declarative_self.tex

@ -0,0 +1,6 @@
\item \self Model the following sentences as detailed as possible in propositional logic.
\begin{enumerate}
\item If a formula is unsat, it cannot be valid.
\item It can be proven that there exists an infinite number of primes.
\item A sentence is called declarative, if and only if it can be assigned a truth value.
\end{enumerate}

6
2_propositional_logic/practical_questions/1_6_declarative_self.tex

@ -0,0 +1,6 @@
\item \self Model the following sentences as detailed as possible in propositional logic.
\begin{enumerate}
\item Today it will be either be foggy or it will rain today, but not both.
\item If and only if everybody comes in a costume to the party, we have a carnival.
\item No pain, no gain.
\end{enumerate}

6
2_propositional_logic/practical_questions/1_7_declarative_self.tex

@ -0,0 +1,6 @@
\item \self Model the following sentences as detailed as possible in propositional logic.
\begin{enumerate}
\item If all students pass, the professor will be happy.
\item Bob is taller than Alice, but shorter than Charlie.
\item If there is lightning there must be thunder and vice versa.
\end{enumerate}

6
2_propositional_logic/practical_questions/1_8_declarative_self.tex

@ -0,0 +1,6 @@
\item \self Model the following sentences as detailed as possible in propositional logic.
\begin{enumerate}
\item If the past hurts, you can either run from it, or learn from it.
\item If life gives you lemons, make lemonade.
\item A good pizza has salami or tuna on it, but not both at the same time.
\end{enumerate}

2
2_propositional_logic/practical_questions/2_1_syntax_lect.tex

@ -0,0 +1,2 @@
\item \lect Determine whether the string $\neg (a \vee \neg \neg b)$ is a well-formed formula using the parse
tree. Explain your answer.

21
2_propositional_logic/practical_questions/2_1_syntax_lect_sol.tex

@ -0,0 +1,21 @@
\begin{center}
\begin{forest}
for tree={circle, draw,
minimum size=2em,
inner sep=0pt,
s sep=2mm,
l sep=1mm}
[$\lnot$, name=not_one
[$\lor$, name=or
[$a$, name=a]
[$\lnot$, name=not_two
[$\lnot$, name=not_three
[$b$, name=b]
]
]
]
]
\end{forest}
\end{center}
Every leaf is a atomic variable and the other nodes are labeled with logical operators, thus this is a well-formed formula.

3
2_propositional_logic/practical_questions/2_1_syntax_self.tex

@ -0,0 +1,3 @@
\item \self
Determine whether the string $(a \vee b) \rightarrow (\neg (x \neg ))$ is a well-formed formula using the parse tree.
Explain your answer. \\

2
2_propositional_logic/practical_questions/2_2_syntax_lect.tex

@ -0,0 +1,2 @@
\item \lect Determine whether the string $\neg (a \vee \neg b \neg)$ is a well-formed formula using the parse
tree. Explain your answer.

22
2_propositional_logic/practical_questions/2_2_syntax_lect_sol.tex

@ -0,0 +1,22 @@
\begin{center}
\begin{forest}
for tree={circle, draw,
minimum size=2em,
inner sep=0pt,
s sep=2mm,
l sep=1mm}
[$\lnot$, name=not_one
[$\lor$, name=or
[$a$, name=a]
[$\lnot$, name=not_two
[$b$, name=b
[$\lnot$, name=not_three]
]
]
]
]
\end{forest}
\end{center}
One leaf is labeled with a logical operator, which is not allowed.
Thus this is not a well-formed formula.

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save