starte Aufgaben
This commit is contained in:
parent
e614f52939
commit
274e4e04c2
BIN
Logik und Logikprogrammierung - Prüfungsvorbereitung copy.pdf
Normal file
BIN
Logik und Logikprogrammierung - Prüfungsvorbereitung copy.pdf
Normal file
Binary file not shown.
311
Logik und Logikprogrammierung - Prüfungsvorbereitung copy.tex
Normal file
311
Logik und Logikprogrammierung - Prüfungsvorbereitung copy.tex
Normal file
@ -0,0 +1,311 @@
|
||||
\documentclass[10pt, a4paper]{exam}
|
||||
\printanswers % Comment this line to hide the answers
|
||||
\usepackage[utf8]{inputenc}
|
||||
\usepackage[T1]{fontenc}
|
||||
\usepackage[ngerman]{babel}
|
||||
\usepackage{listings}
|
||||
\usepackage{float}
|
||||
\usepackage{graphicx}
|
||||
\usepackage{color}
|
||||
\usepackage{listings}
|
||||
\usepackage[dvipsnames]{xcolor}
|
||||
\usepackage{tabularx}
|
||||
\usepackage{geometry}
|
||||
\usepackage{color,graphicx,overpic}
|
||||
\usepackage{amsmath,amsthm,amsfonts,amssymb}
|
||||
\usepackage{tabularx}
|
||||
\usepackage{listings}
|
||||
\usepackage[many]{tcolorbox}
|
||||
\usepackage{multicol}
|
||||
\usepackage{hyperref}
|
||||
\usepackage{pgfplots}
|
||||
\usepackage{bussproofs}
|
||||
\usepackage{tikz}
|
||||
\usetikzlibrary{automata, arrows.meta, positioning}
|
||||
\renewcommand{\solutiontitle}{\noindent\textbf{Antwort}: }
|
||||
\SolutionEmphasis{\small}
|
||||
\geometry{top=1cm,left=1cm,right=1cm,bottom=1cm}
|
||||
|
||||
\pdfinfo{
|
||||
/Title (Logik und Logikprogrammierung - Prüfungsvorbereitung)
|
||||
/Creator (TeX)
|
||||
/Producer (pdfTeX 1.40.0)
|
||||
/Author (Robert Jeutter)
|
||||
/Subject ()
|
||||
}
|
||||
\title{Logik und Logikprogrammierung - Prüfungsvorbereitung}
|
||||
\author{}
|
||||
\date{}
|
||||
|
||||
% Don't print section numbers
|
||||
\setcounter{secnumdepth}{0}
|
||||
|
||||
\newtcolorbox{myboxii}[1][]{
|
||||
breakable,
|
||||
freelance,
|
||||
title=#1,
|
||||
colback=white,
|
||||
colbacktitle=white,
|
||||
coltitle=black,
|
||||
fonttitle=\bfseries,
|
||||
bottomrule=0pt,
|
||||
boxrule=0pt,
|
||||
colframe=white,
|
||||
overlay unbroken and first={
|
||||
\draw[red!75!black,line width=3pt]
|
||||
([xshift=5pt]frame.north west) --
|
||||
(frame.north west) --
|
||||
(frame.south west);
|
||||
\draw[red!75!black,line width=3pt]
|
||||
([xshift=-5pt]frame.north east) --
|
||||
(frame.north east) --
|
||||
(frame.south east);
|
||||
},
|
||||
overlay unbroken app={
|
||||
\draw[red!75!black,line width=3pt,line cap=rect]
|
||||
(frame.south west) --
|
||||
([xshift=5pt]frame.south west);
|
||||
\draw[red!75!black,line width=3pt,line cap=rect]
|
||||
(frame.south east) --
|
||||
([xshift=-5pt]frame.south east);
|
||||
},
|
||||
overlay middle and last={
|
||||
\draw[red!75!black,line width=3pt]
|
||||
(frame.north west) --
|
||||
(frame.south west);
|
||||
\draw[red!75!black,line width=3pt]
|
||||
(frame.north east) --
|
||||
(frame.south east);
|
||||
},
|
||||
overlay last app={
|
||||
\draw[red!75!black,line width=3pt,line cap=rect]
|
||||
(frame.south west) --
|
||||
([xshift=5pt]frame.south west);
|
||||
\draw[red!75!black,line width=3pt,line cap=rect]
|
||||
(frame.south east) --
|
||||
([xshift=-5pt]frame.south east);
|
||||
},
|
||||
}
|
||||
|
||||
\begin{document}
|
||||
\begin{myboxii}[Disclaimer]
|
||||
Aufgaben aus dieser Vorlage stammen aus der Vorlesung \textit{Logik und Logikprogrammierung} und wurden zu Übungszwecken verändert oder anders formuliert! Für die Korrektheit der Lösungen wird keine Gewähr gegeben.
|
||||
\end{myboxii}
|
||||
|
||||
%##########################################
|
||||
\begin{questions}
|
||||
\question Definitionen und Sätze
|
||||
\begin{parts}
|
||||
\part Der Korrektheitssatz der Aussagenlogik für den Wahrheitswertebereich $B$ lautet...
|
||||
\begin{solution}
|
||||
\end{solution}
|
||||
|
||||
\part Eine Menge von Formeln $\Gamma$ heißt erfüllbar, wenn...
|
||||
\begin{solution}
|
||||
\end{solution}
|
||||
|
||||
\part Zwei Formeln $\alpha$ und $\beta$ heißen äquivalent, wenn...
|
||||
\begin{solution}
|
||||
\end{solution}
|
||||
|
||||
\part Der Kompaktheitssatz der Aussagenlogik lautet...
|
||||
\begin{solution}
|
||||
\end{solution}
|
||||
|
||||
\part Eine Horn Klausel ist eine Formel der Form
|
||||
\begin{solution}
|
||||
\end{solution}
|
||||
\end{parts}
|
||||
|
||||
\question Wahrheitswertebereiche
|
||||
\begin{parts}
|
||||
\part Werte die Formel $\varpi_a=\lnot p \wedge \lnot\lnot p$ im Heytingschen Wahrheitswertebereich $H_{\mathbb{R}}$ aus für die $H_{\mathbb{R}}$-Belegung $B$ mit $B(p)=\mathbb{R}\backslash \{0\}$
|
||||
\begin{solution}
|
||||
\end{solution}
|
||||
|
||||
\part Überprüfe ob die Formel $\varphi_B=(\lnot p\rightarrow \lnot p)\rightarrow p$ eine $K_3$-Tautologie ist. Ist $\varphi_b$ eine $B_{\mathbb{R}}$ Tautologie?
|
||||
\begin{solution}
|
||||
\end{solution}
|
||||
|
||||
\part Überprüfe ob die semantische Folgeung $\{p\rightarrow q, q\rightarrow r\}\Vdash_B r\rightarrow\lnot p$ gilt.
|
||||
\begin{solution}
|
||||
\end{solution}
|
||||
\end{parts}
|
||||
|
||||
\question Erfüllbarkeit
|
||||
\begin{parts}
|
||||
\part Überprüfe mittels Markierungsalgorithmus, ob die Formel $\varphi_a=(\lnot p\vee q)\wedge(t\vee \lnot s)\wedge(\lnot r\vee s\vee \lnot q)\wedge r\wedge (\lnot p\vee t)\wedge \lnot s \wedge (\lnot r\vee p)$ erfüllbar ist.
|
||||
\begin{solution}
|
||||
\end{solution}
|
||||
|
||||
\part Überprüfe mittels SLD Resolution, ob die Formel $\varphi_b=(r\wedge p)\vee\lnot t\vee (p\wedge \lnot q)\vee \lnot p\vee (\lnot r\wedge q \wedge t)$ eine Tautologie ist
|
||||
\begin{solution}
|
||||
\end{solution}
|
||||
\end{parts}
|
||||
|
||||
\question Monotone Formeln: Eine aussagenlogische Formel $\varphi$ heißt monoton, falls für alle zu $\varphi$ passenden $B$-Belegungen $B_1,B_2$ mit $B_1(p_i)\leq B_2(p_i)$ für alle $i\in\mathbb{N}$ gilt $B_1(\varphi)\leq B_2(\varphi)$. Beispielsweise sind $p_1\wedge p_2$ und $\lnot\lnot p_1$ monoton.
|
||||
\begin{parts}
|
||||
\part Entscheide, welche der Formeln $\varphi=p_1\wedge(p_2\rightarrow p_3)$, $\psi=\lnot p_1\rightarrow p_2$ monoton sind.
|
||||
\begin{solution}
|
||||
\end{solution}
|
||||
|
||||
\part Zeige per vollständiger Induktion über den Formelaufbau, dass aussagenlogische Formeln in denen weder $\lnot$ noch $\rightarrow$ vorkommen, monoton sind.
|
||||
\begin{solution}
|
||||
\end{solution}
|
||||
\end{parts}
|
||||
|
||||
\question Definitionen und Sätze: Sei $\sum$ eine Signatur. Verfollständige die folgenden Definitionen und Sätze.
|
||||
\begin{parts}
|
||||
\part Es gilt $\Delta\vdash \varphi$ für eine $\sum$-Formel $\varphi$ und eine Menge $\Delta$ von $\sum$-Formeln, falls
|
||||
\begin{solution}
|
||||
\end{solution}
|
||||
|
||||
\part Der Vollständigkeitssatz der Prädikatenlogik lautet...
|
||||
\begin{solution}
|
||||
\end{solution}
|
||||
|
||||
\part Der Satz von Löwenheim-Skolem lautet...
|
||||
\begin{solution}
|
||||
\end{solution}
|
||||
|
||||
\part Die (elementare) Theorie einer $\sum$-Struktur $A$ ist
|
||||
\begin{solution}
|
||||
\end{solution}
|
||||
\end{parts}
|
||||
|
||||
\question Natürliches Schließen
|
||||
\begin{parts}
|
||||
\part Gebe die Regeln $(\forall-I)$, $(\exists-E)$ und $(GfG)$ inklusive Bedingung an
|
||||
\begin{solution}
|
||||
\end{solution}
|
||||
|
||||
\part Zeige, dass $\forall x\exists y(f(x)=y)$ ein Theorem ist, indem du eine entsprechende Deduktion angibst
|
||||
\begin{solution}
|
||||
\end{solution}
|
||||
|
||||
\part Zeige, dass $\exists x\forall y(f(x)=y)$ nicht allgemeingültig ist
|
||||
\begin{solution}
|
||||
\end{solution}
|
||||
|
||||
\part Zeige, dass die Formel aus c) erfüllbar ist
|
||||
\begin{solution}
|
||||
\end{solution}
|
||||
\end{parts}
|
||||
|
||||
\question Prädikatenlogische Definierbarkeit: Betrachte im folgenden Graphen als $\sum$-Struktur, wobei $\sum$ eine Signatur mit einem zweistelligen Relationssymbol $E$ ist.
|
||||
\begin{parts}
|
||||
\part Betrachte den (kommt noch) Graphen und die $\sum$-Formel $\varphi_a=\forall x\exists y\exists z(((E(x,y)\wedge E(y,z))\vee(E(y,x)\wedge E(z,x)))\wedge y\not =z)$. Gebe eine Kante an, sodass $G$ mit dieser zusätzlichen Kante als $\sum_a$-Struktur ein Modell der Formel $\varphi_a$ ist. Begründe deine Antwort.
|
||||
\begin{solution}
|
||||
\end{solution}
|
||||
|
||||
\part Betrachte die folgenden (kommen noch) Graphen $G_1$ und $G_2$. Gebe einen $\sum$-Satz $\varphi_b$ an, so dass $G_1\Vdash \varphi_b$ und $G_2\not\Vdash\varphi_b$ gilt.
|
||||
\begin{solution}
|
||||
\end{solution}
|
||||
|
||||
\part Gebe einen $\sum$-Satz $\varphi_c$ an, so dass für alle $\sum$-Strukturen $A$ genau dann $A\Vdash \varphi_c$ gilt, wenn $E^A$ eine Äquivalenzrelation ist (d.h. reflexiv, symmetrisch und transitiv).
|
||||
\begin{solution}
|
||||
\end{solution}
|
||||
\end{parts}
|
||||
|
||||
\question Normalformeln und Unifikatoren
|
||||
\begin{parts}
|
||||
\part Betrachte die Formel $\varphi=\forall x(\exists y(R(x,y)\wedge \lnot \exists x(R(y,x))))$. Gebe eine Formel $\psi_1$ in Pränexform an, die äquivalent zu $\varphi$ ist und eine Formel $\psi_2$ in Skolemform, die erfüllbarkeitsäquivalent zu $\varphi$ ist.
|
||||
\begin{solution}
|
||||
\end{solution}
|
||||
|
||||
\part Sei $\sum$ eine Signatur mit zweistelligem Relationssymbol $R$, zweistelligem Funktionssymbol $f$, einstelligem Funktionssymbol $g$ und Konstanten $a,b$. Ermittle mit dem Unifikationsalgorithmus, welche der folgenden Paare atomarer Formeln unifizierbar sind und gebe einen allgemeinsten Unifikator an, falls dieser existiert.\\
|
||||
i) $(R(x, f(y,g(a))), R(a,f(g(x),y)))$\\
|
||||
ii) $(R(f(g,x),y),g(y), R(f(y,z),z))$
|
||||
\begin{solution}
|
||||
\end{solution}
|
||||
\end{parts}
|
||||
|
||||
\question Gegeben sei folgende Wissensbasis:\begin{itemize}
|
||||
\item über(rot, orange).
|
||||
\item über(orange, gelb).
|
||||
\item über(gelb, grün).
|
||||
\item über(grün, blau).
|
||||
\item über(blau, violett).
|
||||
\item top(X):~über(\_, X), !, fail.
|
||||
\item top(\_).
|
||||
\item oben(X):-über(X,\_),top(X).
|
||||
\end{itemize} Wie antwortet ein Prolog System mit dieser Wissensbasis auf die folgenden Fragen:
|
||||
\begin{parts}
|
||||
\part ?-top(grün).
|
||||
\begin{solution}
|
||||
\end{solution}
|
||||
|
||||
\part ?-top(X).
|
||||
\begin{solution}
|
||||
\end{solution}
|
||||
|
||||
\part ?-top(rot).
|
||||
\begin{solution}
|
||||
\end{solution}
|
||||
|
||||
\part ?-oben(grün).
|
||||
\begin{solution}
|
||||
\end{solution}
|
||||
|
||||
\part ?-oben(X).
|
||||
\begin{solution}
|
||||
\end{solution}
|
||||
|
||||
\part ?-oben(rot).
|
||||
\begin{solution}
|
||||
\end{solution}
|
||||
\end{parts}
|
||||
|
||||
\question Man implementiere folgende Prädikate in Form von Prolog Klauseln
|
||||
\begin{parts}
|
||||
\part Das Prädikat $parition(L,E,Kl,Gr)$ soll eine gegebene Liste ganzer Zahlen $L$ in zwei Teillisten partitionieren.\begin{itemize}
|
||||
\item die Liste $Kl$ aller Elemente aus $L$, welche kleiner oder gleich $E$ sind und
|
||||
\item die Liste $Gr$ aller Elemente aus $L$, welche größer als $E$ sind
|
||||
\end{itemize}
|
||||
Beispiel: ?-parition([1,2,3,4,5,6], 3, Kl, Gr). \begin{itemize}
|
||||
\item $Kl=[1,2,3]$
|
||||
\item $Gr=[4,5,6]$
|
||||
\end{itemize}
|
||||
\begin{solution}
|
||||
\end{solution}
|
||||
|
||||
\part Das Prädikat $merge(L1,L2,L)$ soll zwei sortierte Listen mit ganzen Zahlen $L1$ und $L2$ zu einer sortierten Liste $L$ verschmelzen.
|
||||
\begin{solution}
|
||||
\end{solution}
|
||||
|
||||
\part Das Prädikat $listmerge(ListenListe, L)$ bekommt eine Liste sortierter Listen $ListenListe$ und soll sie zu einer sortierten Liste L verschmelzen. Das in Aufgabe b) definierte Prädikat $merge$ kann dabei verwendet werden.
|
||||
\begin{solution}
|
||||
\end{solution}
|
||||
|
||||
\part Das Prädikat $am\_groesten(L, Max)$ soll das größte Element $Max$ einer Zahlenliste $L$ ermitteln. Falls $L$ leer ist, soll ,,nein'' geantwortet werden.
|
||||
\begin{solution}
|
||||
\end{solution}
|
||||
|
||||
\part Das Prädikat $am\_kuerzesten(ListenListe, L)$ soll aus einer Liste von $ListenListe$ die kürzeste Liste $L$ ermitteln. Dies soll möglichst effizient geschehen: \begin{itemize}
|
||||
\item Gestalte die Prozedur rechtsrekursiv
|
||||
\item Sehe davon ab, Listenlängen explizit zu ermitteln. Ermittle diese mit einem Hilfsprädikat $kuerzer\_als(L1,L2)$
|
||||
\item Höre mit der Suche auf, sobald eine leere Liste gefunden wurde. Kürzer geht nicht
|
||||
\end{itemize}
|
||||
Falls $ListenListe$ leer ist, soll ,,nein'' geantwortet werden.
|
||||
\begin{solution}
|
||||
\end{solution}
|
||||
\end{parts}
|
||||
|
||||
\question Ein binärer Suchbaum mit natürlichen Zahlen in den Knoten sei in Prolog wie folgt als strukturierter Term repräsentiert:\begin{itemize}
|
||||
\item leerer Baum: nil
|
||||
\item nichtlerer Baum: baum(Wurzel, LinkerUnterbaum, RechterUnterbaum)
|
||||
\end{itemize}
|
||||
Beispiel Baum mit Wurzel 6, Wurzel 4 im linken Unterbaum, Wurzel 7 im rechten Unterbaum und 2,4 und 9 als Blätter: $baum(6,baum(4, baum(2,nil,nil), baum(5, nil, nil)), baum(7, nil, baum(0, nil, nil)))$.\\
|
||||
Man implementiere folgende Prädikate in Prolog
|
||||
\begin{parts}
|
||||
\part Das Prädikat $enthalten(Baum, Zahl)$ bekommt einen binären Suchbaum $Baum$ sowie eine Zahl $Zahl$ und soll entscheiden, ob diese Zahl in Baum enthalten ist und die Antwort ,,ja'' oder ,,nein'' liefern.
|
||||
\begin{solution}
|
||||
\end{solution}
|
||||
|
||||
\part Das Prädikat $flattern(Baum,Liste)$ soll aus einem gegebenen Suchbaum $Baum$ die Liste $Liste$ aller der im Baum enthaltenen Zahlen in aufsteigender sortierter Reihenfolge liefern.
|
||||
\begin{solution}
|
||||
\end{solution}
|
||||
\end{parts}
|
||||
|
||||
\end{questions}
|
||||
\end{document}
|
Loading…
Reference in New Issue
Block a user