Repository navigation
Expand file tree
/
Copy pathISPracticum1.tex
More file actions
239 lines (233 loc) · 12.6 KB
/
Copy pathISPracticum1.tex
File metadata and controls
239 lines (233 loc) · 12.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
% Practicum IS
\documentclass[]{article}
\usepackage{enumerate}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{fullpage}
\usepackage{soul}
\title{Practicum IS 1}
\author{Michiel van Heusden 4173309, Siemen Kraayenbrink - 4032322}
\date{}
\begin{document}
\maketitle
Beste corrector,
\newline Wij hebben veel tijd gestopt in dit practicum, maar het helaas niet afgekregen. Het koste ons veel moeite om onze logica kennis
die wat weggezakt was weer terug te halen. Wij hopen dat de antwoorden die we hebben gegeven nog wat punten opleveren. Succes met nakijken!
\subsection*{1}
\begin{enumerate}[a]
\item Herschrijven
\begin{enumerate}[i]
\item $ \forall x : typeOf(x,vis) \longrightarrow typeOf(vis, zoogdier) $
\begin{itemize}
\item $typeOf(x,y) $ geeft aan of $x$ van het type $y$ is (hier: of $vis$ een $zoogdier$ is)
\item $zoogdier$ is een constante voor het type zoogdier
\item $vis$ is een constante voor het type vis
\end{itemize}
% ii
\item $ \forall x, \exists y : typeOf(x,vis) \longrightarrow (heeft(x, y) \land typeOf(y,staart)) $
\begin{itemize}
\item $heeft(x,y) $ geeft aan of $x$ $y$ heeft
\item $staart$ is een constante om het type staart aan te geven
\end{itemize}
% iii
\item $\forall x : heeft(x,griep) \longrightarrow heeft(x,koorts) $
\begin{itemize}
\item $griep$ is een constante om griep aan te geven
\item $koorts$ is een constante om koorts aan te geven
\end{itemize}
% iv
\item $ \forall x, \exists y : typeOf(x,docent) \longrightarrow (heeft(x, y) \land typeOf(y,vak)) $
\begin{itemize}
\item $docent$ is een constante om het type docent aan te geven
\item $vak$ is een constante om het type vak aan te geven
\end{itemize}
% v
\item $ \exists x,y : typeOf(x,docent) \land \neg heeft(x,y) \land typeOf(x,vak) $
% vi
\item $ Tante(x,y) = typeOf(x,vrouw) \land (neefVan(y,x) \lor nichtVan(y,x)) $
\begin{itemize}
\item $vrouw$ is een constante om het type vrouw aan te geven
\item $neefVan(x,y)$ geeft aan of $x$ de neef van $y$ is
\item $nichtVan(x,y)$ geeft aan of $x$ de nicht van $y$ is
\end{itemize}
% vii
\item $Deelt(x,y) = \exists z \in \mathbb{N}: z * x = y$
% viii
\item $ \forall x, \exists y: typeOf(x,paart) \longrightarrow (\neg heeft(x,y) \land typeOf(y,staart)) $
\begin{itemize}
\item $paard$ is een constante om het type paard aan te geven
\end{itemize}
% ix : geen paard heeft geen staart -> alle paarden hebben een staart
\item $ \forall x, \exists y: typeOf(x,paart) \longrightarrow (heeft(x,y) \land typeOf(y,staart)) $
% x
\item $ \forall x, \exists y: broerVan(y,x) \longrightarrow \neg lust(x,thee) $
\begin{itemize}
\item $broerVan(x,y)$ geeft aan of $x$ de broer is van $y$
\item $lust(x,y)$ geeft aan of $x$ iets van het type $y$ lust
\item $thee$ is een constante om thee aan te geven
\end{itemize}
% ix
\item $kwadraatGetal(x) = \exists y \in \mathbb{N}: y*y = x $
\end{enumerate}
% einde a
\item $ ambigue uitspraken $
\begin{enumerate}[i]
\item
\begin{enumerate}[1]
\item Er is een persoon, en iedereen houdt van hem/haar \\ $\exists x, \forall y: houdtVan(y,x)$
\item Er is voor iedereen iemand om van te houden \\ $\forall y, \exists x: houdtVan(y,x)$
\end{enumerate}
\begin{itemize}
\item $houdtVan(x,y)$ geeft aan dat $x$ van $y$ houdt
\end{itemize}
\item
\begin{enumerate}[1]
\item Er is voor iedereen een persoon om van te houden en dit persoon houdt van hem/haar \\ $\exists! z \exists x \forall y: houdtVan(x,z) \longrightarrow houdtVan(y,x)$
\item Voor iedereen is er een persoon om van te houden en dit persoon houdt ook van hem/haar \\ $\forall y \exists x: houdtVan(x,y) \longrightarrow houdtVan(y,x)$
\end{enumerate}
\item
\begin{enumerate}[1]
\item Tim tilt de jongen die een stok vast heeft op \\ $\exists Tim, y, z: heeft(y,z)\land typeOf(z,stok) \longrightarrow tiltOp(Tim,y) $
\item Tim gebruikt de stok om de jongen op te tillen \\ $\exists Tim, y, z: tiltOpMet(Tim,y,z) $
\end{enumerate}
\begin{itemize}
\item $tiltOp(x,y)$ geeft aan dat $y$ door $x$ wordt op getild
\item $tiltOpMet(x,y,z)$ geeft aan dat $y$ door $x$ wordt opgetild, met behulp van $z$
\item $stok$ is een constante die het type stok aan geeft
\end{itemize}
\item %iv
\begin{enumerate}[1]
\item Er is geen partner-koppel waar tussen het klikt \\ $\forall x, \exists y : partners(x,y) \longrightarrow \neg klikt(x,y)$
\item Er is een persoon waarmee niet een persoon, dat een partner is van iemand, klikt \\ $\exists z, \forall x, \exists y: partners(x,y) \longrightarrow klikt(z,y) $
\end{enumerate}
\begin{itemize}
\item $partners(x,y)$ geeft aan dat $x$ en $y$ partners zijn
\item $ klikt(x,y)$ geeft aan of het klikt tussen $x$ en $y$
\end{itemize}
\item % v
\begin{enumerate}[1]
\item Iedereen kan zowel boeken kopen als boeken lezen bij Bruna of Ako \\ $\forall x \exists y: kanBoekLezenBij(x,y) \land kanBoekKopenBij(x,y) \land (typeOf(y,Ako) \lor typeOf(y,Bruna)) $
\item Iedereen kan boeken kopen bij Bruna of boeken lezen bij de Ako. \\ $\forall x \exists y: (kanBoekKopenBij(x,y) \land typeOf(y,Bruna)) \lor ((kanBoekLezenBij(x,y) \land typeOf(y,Ako)) ) $
\end{enumerate}
\begin{itemize}
\item $kanBoekLezenBij(x,y)$ geeft aan dat $x$ op locatie $y$ een boek kan lezen
\item $kanBoekKopenBij(x,y)$ geeft aan dat $x$ op locatie $y$ een boek kan kopen
\item $Ako$ is een constantie die een Ako winkel aangeeft
\item $Bruna$ is een constantie die een Bruna winkel aangeeft
\end{itemize}
\item % vi
\begin{enumerate}[1]
\item Als de zon onder is de maan of de zon onzichtbaar, of beide \\ $\exists zon, maan : (onder(zon) \longrightarrow (onzichtbaar(maan) \lor onzichtbaar(zon)))$
\item De zon kan onzichtbaar zijn, maar als hij onder is is de maan onzichtbaar \\ $\exists zon, maan : (onder(zon) \longrightarrow onzichtbaar(maan))\lor onzichtbaar(zon)$
\end{enumerate}
\begin{itemize}
\item $onder(x)$ geeft aan of $x$ onder de horizon verdwenen is
\item $onzichtbaar(x)$ geeft aan of $x$ niet zichtbaar is
\end{itemize}
\end{enumerate} % einde b
\end{enumerate}
\subsection*{2}
\begin{enumerate}[a]
\item
\begin{enumerate}[i]
\item
\begin{enumerate}[1]
%\item $\forall y, x : kniptHaar(y,y) \longrightarrow \neg (kniptHaar(x,y) \land typeOf(x,kapper)) $
\item $ \forall x, y: \lnot (typeOf(x, kapper) \land typeOf(y,persoon) \land knipt(x,y) \land knipt(y,y)) $
\begin{itemize}
\item $knipt(x,y)$ geeft aan dat $x$ de haren van $y$ knipt.
\item $kapper$ is een constante om het type kapper aan te geven.
\item $persoon$ is een constante om het type persoon aan te geven.
\end{itemize}
%\item $\forall x,y : \neg kniptHaar(y,y) \longrightarrow (kniptHaar(x,y) \land typeOf(x,kapper)) $
\item $ \forall x, y: typeOf(x, kapper) \land typeOf(y, persoon) \land \lnot knipt(y, y) \longrightarrow knipt(x, y) $
%\item $\forall x: typeOf(x,kapper) \longrightarrow typeOf(x,persoon)$
\item $ \forall x: typeOf(x, kapper) \longrightarrow typeOf(x, persoon)$
\end{enumerate}
% ii
\item $\forall x: \neg typeOf(x,kapper)$
% iii
\item Formules (1), (2) en (3)
% iv
\item We schrijven eerst alle formules om naar CNF equivalenten. Vervolgens plakken we al die formules aan elkaar met $\land$ -tekens en
gaan we op zoek naar literals die tegenstrijdig zijn. Op deze manier kan je concluderen dat de waarde van de literals niet uit maakt en ze verwijderen
uit de gecombineerde formule. Dit proces gaat door tot dat we de formule die we proberen af te leiden over houden.
% v
\item
\begin{enumerate}[1]
%\item $ (\neg kniptHaar(y,y) \lor \lnot kniptHaar(x,y)) \land (\lneg kniptHaar(y,y) \lor typeOf(x,kapper)) $
\item $\lnot typeOf(x, kapper) \lor \lnot typeOf(y, persoon) \lor \lnot knipt(x, y) \lor \lnot knipt(y, y)$
%\item $ (kniptHaar(y,y) \lor kniptHaar(x, y)) \land (kniptHaar(y,y) \lor typeOf(x,kapper))$
\item $ \lnot typeOf(x, kapper) \lor \lnot typeOf(y, persoon) \lor knipt(y, y) \lor knipt(x, y) $
\item $ \lnot typeOf(x,kapper) \lor typeOf(x,persoon) $
\end{enumerate}
% vi
\item Zoals gezegd zetten we alles onder elkaar:
\begin{enumerate}[1]
\item $\lnot typeOf(x, kapper) \lor \lnot typeOf(y, persoon) \lor \lnot knipt(x, y) \lor \lnot knipt(y, y)$
\item $ \lnot typeOf(x, kapper) \lor \lnot typeOf(y, persoon) \lor knipt(y, y) \lor knipt(x, y) $
\item $ \lnot typeOf(x,kapper) \lor typeOf(x,persoon) $
\end{enumerate}
\item Vervolgens gaan we overbodigen, ofwel tegenspraak wegstrepen. We beginnen bij knipt:
\begin{enumerate}[1]
\item $\lnot typeOf(x, kapper) \lor \lnot typeOf(y, persoon) \lor$\st{$ \lnot knipt(x, y) \lor \lnot knipt(y, y)$}
\item $ \lnot typeOf(x, kapper) \lor \lnot typeOf(y, persoon) \lor$\st{$knipt(y, y) \lor knipt(x, y)$}
\item $ \lnot typeOf(x,kapper) \lor typeOf(x,persoon) $
\end{enumerate}
\item Dit kunnen we nog een keer doen, deze keer kijken we naar typeOf met als 2e argument "persoon" omdat we uiteindelijk kapper willen overhouden.
\begin{enumerate}[1]
\item $ \lnot typeOf(x, kapper) \lor $\st{$\lnot typeOf(y, persoon)$}$ \lor$\st{$ \lnot knipt(x, y) \lor \lnot knipt(y, y)$}
\item $ \lnot typeOf(x, kapper) \lor $\st{$\lnot typeOf(y, persoon)$}$ \lor$\st{$knipt(y, y) \lor knipt(x, y)$}
\item $ \lnot typeOf(x,kapper) $\st{$\lor typeOf(x,persoon) $}
\end{enumerate}
\item We zien dat we nu alleen nog de af te leiden formule over hebben (in CNF), dus de resolutie heeft gewerkt.
\end{enumerate}
\item %2b starts here
\begin{enumerate}[i]
\item
\begin{enumerate}[1]
\item $\forall x, y: typeOf(x, persoon) \longrightarrow \lnot(kindVan(x, y) \land \lnot kanStuderen(y)) \longrightarrow Blij(x)$
\begin{itemize}
\item $typeOf(x, y)$ geeft net als vorgaande situatie het type van $x$ in waarde van $y$.
\item $kindVan(x, y)$ geeft aan dat $x$ een kind is van $y$.
\item $kanStuderen(x)$ geeft aan dat $x$ kan studeren.
\item $Blij(x)$ geeft aan dat $x$ blij is.
\end{itemize}
\item $\forall x: typeOf(x, persoon) \land Intelligent(x) \longrightarrow kanStuderen(x)$
\begin{itemize}
\item $Intelligent(x)$ geeft aan dat $x$ intelligent is.
\end{itemize}
\item $???$
\end{enumerate}
\end{enumerate}
\subsection*{3}
\begin{enumerate}[a]
\item Sudoku Variabelen:
\begin{itemize}
\item $ [r_1 .. r_9] $ voor alle rijen, deze geven aan of ze correct ingevuld zijn
\item $ [k_1 .. k_9] $ voor alle kolommen, deze geven aan of ze correct ingevuld zijn
\item $ [b_1 .. b_9] $ voor alle blokken, deze geven aan of ze correct ingevuld zijn
\item $ [1Op(i,j) .. 9Op(i,j)] $ deze variabelen geven de waarde aan van vakje $i,j$. Hiervan kan er slechts een per $i,j$ combinatie $true$ zijn
\end{itemize}
% b
\item In totaal zijn er 108 variabelen $true$:
\begin{itemize}
\item $ \forall i \in [1..9] : r_i $, $b_i$ en $k_i$ zijn $true$.
\item Van $ [1Op(i,j) .. 9Op(i,j)] $ zijn slechts 81 variabelen $true$.
\item Ook geldt dat $\forall i,n \in [1..9]$ alle $n$ een keer voorkomt.
\item Tot slot geldt dat $\forall j,n \in [1..9]$ alle $n$ een keer voorkomt.
\end{itemize}
% c
\item $\forall i,j \in [1..9]: 1Op(i,j) xor .. xor 9Op(i,j) $
% d
\item Per blok met cellen tussen $(i_{min},j_{min})$ en $(i_{max},j_{max})$
$ \exists [i1..i3]\in(i_{min} .. i_{max}), [j1..j3]\in (j_{min} .. j_{max}), : 1Op(i1,j1) \land .. \land 9Op(i3,j3) \land i1 \neq i2 \land i3 \neq i1 \land i2 \neq i3
\land j1 \neq j2 \land j3 \neq j1 \land j2 \neq j3 $ % alle getallen 1 keer
% e
\item Per rij $j$ : $ [i1..i9] : 1Op(i1,j) \land .. \land 9Op(i1,j) \land i1 \neq i2 \land .. \land i8 \neq i9 $
% f
\item Per kolom $i$ : $[j1..j9] : 1Op(i,j1) \land .. \land 9Op(i,j9) \land j1 \neq j2 \land .. \land j8 \neq j9 $
% g
\item ?
\end{enumerate}
\end{document}