BuK/IIm18/Vorlesung1

Aus ProgrammingWiki

Wiki-Quelltext dieser Seite.

= Ausgewählte mathematische Grundlagen = 


== Aufgabe 3==

''Für die folgende Implikation ist die zugehörige Wahrheitstafel aufzustellen.''

Implikation: $\lnot B \land (A \rightarrow B) \Rightarrow \lnot A$

{| border="1px" cellpadding="8" cellspacing="0"
|-style="text-align: center;background-color:lightgrey;"
|| '''$A$''' || '''$B$''' || '''$\lnot A$''' || '''$\lnot B$''' || '''$A \rightarrow B$''' || '''$\lnot B \land (A \rightarrow B)$''' || $\lnot B \land (A \rightarrow B) \Rightarrow \lnot A$
|-style="text-align: center;"
|| w || w || f || f || w || f || style="background: lightgreen;"|w
|-style="text-align: center;"
|| w || f || f || w || f || f || style="background: lightgreen;"|w
|-style="text-align: center;"
|| f || w || w || f || w || f || style="background: lightgreen;"|w
|-style="text-align: center;"
|| f || f || w || w || w || w || style="background: lightgreen;"|w
|-
|}

Für jede mögliche Belegung der Variablen $A$, $B$ und $C$ trift die Implikation zu. Somit handelt es sich hierbei um eine Tautologie.

== Aufgabe 6 ==

''Für die folgenden logischen Ausdrücke sollen durch Wahrheitstafeln auf Richtigkeit überprüft werden.''

'''Kontraposition:''' $(A \rightarrow B) \Leftrightarrow ( \lnot B \rightarrow \lnot A)$

{| border="1px" cellpadding="8" cellspacing="0"
|-style="text-align: center;background-color:lightgrey;"
|| '''$A$''' || '''$B$''' || '''$\lnot A$''' || '''$\lnot B$''' || '''$A \rightarrow B$''' || '''$\lnot B \rightarrow \lnot A$''' || $(B \rightarrow A) \Leftrightarrow ( \lnot B \rightarrow A)$
|-style="text-align: center;"
|| w || w || f || f || w || w || style="background: lightgreen;"|w
|-style="text-align: center;"
|| w || f || f || w || f || f || style="background: lightgreen;"|w
|-style="text-align: center;"
|| f || w || w || f || w || w || style="background: lightgreen;"|w
|-style="text-align: center;"
|| f || f || w || w || w || w || style="background: lightgreen;"|w
|-
|}

Die Wahrheitstafel zeigt die Tautologie des logischen Ausdrucks der Kontraposition. Somit ist nachgewiesen, dass der Ausdruck richtig.


'''Widerspruchsbeweis:''' $(A \rightarrow B) \Leftrightarrow (A \land \lnot B \rightarrow f)$

{| border="1px" cellpadding="8" cellspacing="0"
|-style="text-align: center;background-color:lightgrey;"
|| '''$A$''' || '''$B$''' || '''$\lnot B$''' || '''$A \rightarrow B$'''|| '''$A \land \lnot B$''' || '''$(A \rightarrow B) \Leftrightarrow (A \land \lnot B)$''' 
|-style="text-align: center;"
|| w || w || f || w || f || style="background: tomato;"|f
|-style="text-align: center;"
|| w || f || w || f || w || style="background: tomato;"|f
|-style="text-align: center;"
|| f || w || f || w || f || style="background: tomato;"|f
|-style="text-align: center;"
|| f || f || w || w || f || style="background: tomato;"|f
|-
|}


Da die Implikation $A \Rightarrow B$ logisch äquivalent zu der Aussage $\lnot A\lor B$ ist, lässt sich einfach anhand einer Wahrheitstafel zeigen. Demzufolge ist $\lnot (A \Rightarrow B)$ ebenfalls logisch äquivalent zu $A \land \lnot B$. Somit kann die Implikation $A \Rightarrow B$ durch die Widerlegung der Aussage $A \land \lnot B$ bewiesen werden.

Die Wahrheitstafel zeigt genau diesen Sachverhalt, was die Richtigkeit des logischen Ausdrucks des Widerspruchsbeweis bestätigt.


== Aufgabe 8 ==

''Beweisen Sie die Aussage, wonach aus der Gültigkeit der Aussagen $A \rightarrow B$, $B \rightarrow C$ und $\lnot C$ die Gültigkeiten von $\lnot A$ und $\lnot B$ folgen. Stellen Sie den Sachverhalt in einer Wahrheitstafel dar.''

{| border="1px" cellpadding="8" cellspacing="0"
|-style="text-align: center;background-color:lightgrey;"
|| '''Nummer''' ||'''$A$''' || '''$B$''' || '''$C$''' || '''$\lnot A$''' || '''$\lnot B$''' || '''$\lnot C$''' || '''$A \rightarrow B$'''|| '''$B \rightarrow C$''' 
|-style="text-align: center;"
|| 1 || w || w || w || f || f || f || w || w
|-style="text-align: center;"
|| 2 || w || w || f || f || f || w || w || f
|-style="text-align: center;"
|| 3 || w || f || w || f || w || f || f || w
|-style="text-align: center;"
|| 4 || w || f || f || f || w || w || f || w
|-style="text-align: center;"
|| 5 ||f || w || w || w || f || f || w || w
|-style="text-align: center;"
|| 6 || f || w || f || w || f || w || w || f
|-style="text-align: center;"
|| 7 || f || f || w || w || w || f || w || w
|-style="text-align: center; background-color: lightgreen;"
|| 8 || f || f || f || '''w''' || '''w''' || '''w''' || '''w''' || '''w'''
|-
|}

Damit die oben genannte Aussage zutrifft, müssen die Variablen $A$, $B$ und $C$ mit $f$ belegt sein.



''Was kann man über die Gültigkeit von A und B schließen, wenn bekannt ist, dass $A \rightarrow B$, $B \rightarrow C$ und $C$ gelten? 
Verwenden Sie die Tabelle aus der vorhergehenden Aufgabenlösung.''

{| border="1px" cellpadding="8" cellspacing="0"
|-style="text-align: center;background-color:lightgrey;"
|| '''Nummer''' ||'''$A$''' || '''$B$''' || '''$C$''' || '''$\lnot A$''' || '''$\lnot B$''' || '''$\lnot C$''' || '''$A \rightarrow B$'''|| '''$B \rightarrow C$''' 
|-style="text-align: center; background-color: lightgreen;"
|| 1 || w || w || '''w''' || f || f || f || '''w''' || '''w'''
|-style="text-align: center;"
|| 2 || w || w || f || f || f || w || w || f
|-style="text-align: center;"
|| 3 || w || f || w || f || w || f || f || w
|-style="text-align: center;"
|| 4 || w || f || f || f || w || w || f || w
|-style="text-align: center; background-color: lightgreen;"
|| 5 ||f || w || '''w''' || w || f || f || '''w''' || '''w'''
|-style="text-align: center;"
|| 6 || f || w || f || w || f || w || w || f
|-style="text-align: center; background-color: lightgreen;"
|| 7 || f || f || '''w''' || w || w || f || '''w''' || '''w'''
|-style="text-align: center;"
|| 8 || f || f || f || w || w || w || w || w
|-
|}

Unter der Annahme, dass die Aussage $A \rightarrow B$, $B \rightarrow C$ und $C$ gültig ist, gibt es 3 mögliche Belegungen von $A$ und $B$.

$(w,w)$, $(f,w)$ sowie $(f,f)$


<language>SchemeJS</language>
== Aufgabe 11 ==

Für die Folg. definierte Funktion $q:\R \rightarrow \R$ ist an der Stelle $x=3$ ''undefiniert''. Hierfür wird das Symbol $\bot$ verwendet.

$q(x) =
\left \{
	\begin{array}{ll}
		\frac{ 35 }{ x-3 }  & \mbox{, wenn } x \neq 3 \\
		\bot & \mbox{, sonst. }
	\end{array}
\right.$

Schreiben Sie ein Programm, das q berechnet.

<code id="76a1ee93-f7c0-452f-a1f7-87369464eb6a">
(define eternity 
  (lambda () 
    (eternity)))

(define q
  (lambda (x)
    (if (= x 3)
        (eternity)
        (/ 35 (- x 3)))))
</code>

<run id="533611b8-4900-11e9-8646-d663bd873d93">(q 3)</run>
<run id="adb6145f-123d-46d2-9579-f130e4fbc90b">(q 38)</run>