RechenwegWS 2026/27
Rechenweg · Grundzüge digitaler Systeme · Test 2 – alte Testangaben
GDSBeispiel T2-2022b.3·Prädikatenlogik (Formalisieren, Auswerten in einer Interpretation)

Test 3 2022W, Aufgabe 3: Prädikatenlogik – Kinder und Kostüme

PDF

Aufgabe 3 (22 Punkte)

Seien Trägt/2, Kind/1, Kostüm/1 und Lustig/1 Prädikatensymbole sowie superman und batman Konstantensymbole mit folgender Bedeutung:

Symbol Bedeutung
Kind(x)\mathit{Kind}(x) xx ist ein Kind
Kostu¨m(x)\mathit{Kostüm}(x) xx ist ein Kostüm
Lustig(x)\mathit{Lustig}(x) xx ist lustig
Tra¨gt(x,y)\mathit{Trägt}(x, y) xx trägt yy
superman\mathit{superman} Superman-K(ostüm)
batman\mathit{batman} Batman-K(ostüm)
catwoman\mathit{catwoman} Catwoman-K(ostüm)

(a) (13 Punkte) Verwenden Sie diese Symbole, um die nachfolgenden Sätze in prädikatenlogische Formeln zu übersetzen.

i. Nichts ist lustig. ii. Es gibt lustige Kostüme. iii. Kinder die ein Superman-K tragen, tragen kein Batman-K. iv. Es gibt Kinder, die jedes lustige Kostüm tragen. v. Alle Kinder tragen das gleiche Kostüm.

(b) (9 Punkte) Sei weiters folgende Interpretation II gegeben:

  • U={Mia,Max,Tahel,Flo,Superman-K,Catwoman-K,Batman-K,Spiderman-K}U = \{\text{Mia}, \text{Max}, \text{Tahel}, \text{Flo}, \text{Superman-K}, \text{Catwoman-K}, \text{Batman-K}, \text{Spiderman-K}\}
  • I(Kind)={Mia,Max,Tahel}I(\mathit{Kind}) = \{\text{Mia}, \text{Max}, \text{Tahel}\}
  • I(Kostu¨m)={Superman-K,Batman-K,Spiderman-K}I(\mathit{Kostüm}) = \{\text{Superman-K}, \text{Batman-K}, \text{Spiderman-K}\}
  • I(Lustig)={Mia,Max,Superman-K,Batman-K}I(\mathit{Lustig}) = \{\text{Mia}, \text{Max}, \text{Superman-K}, \text{Batman-K}\}
  • I(Tra¨gt)={(Mia,Batman-K),(Mia,Spiderman-K),(Mia,Catwoman-K),(Max,Superman-K),(Max,Catwoman-K),(Tahel,Batman-K),(Flo,Spiderman-K),(Flo,Superman-K)}I(\mathit{Trägt}) = \{(\text{Mia}, \text{Batman-K}), (\text{Mia}, \text{Spiderman-K}), (\text{Mia}, \text{Catwoman-K}), (\text{Max}, \text{Superman-K}), (\text{Max}, \text{Catwoman-K}), (\text{Tahel}, \text{Batman-K}), (\text{Flo}, \text{Spiderman-K}), (\text{Flo}, \text{Superman-K})\}
  • I(superman)=Superman-KI(\mathit{superman}) = \text{Superman-K}, I(batman)=Batman-KI(\mathit{batman}) = \text{Batman-K}, I(catwoman)=Catwoman-KI(\mathit{catwoman}) = \text{Catwoman-K}

Übersetzen Sie die nachfolgenden Formeln in natürliche Sprache. Geben Sie an, ob die Formeln in der Interpretation II wahr oder falsch sind. Begründen Sie Ihre Antwort; es ist keine formale Auswertung erforderlich.

i. ∃x∃y (Lustig(x)∧Tra¨gt(y,x))\exists x \exists y\, (\mathit{Lustig}(x) \wedge \mathit{Trägt}(y, x)) ii. ∀x (Kind(x)⇒(Tra¨gt(x,batman)∨Tra¨gt(x,catwoman)))\forall x\, (\mathit{Kind}(x) \Rightarrow (\mathit{Trägt}(x, \mathit{batman}) \vee \mathit{Trägt}(x, \mathit{catwoman}))) iii. ∀x (Tra¨gt(x,superman)⇎Tra¨gt(x,batman))\forall x\, (\mathit{Trägt}(x, \mathit{superman}) \not\Leftrightarrow \mathit{Trägt}(x, \mathit{batman}))

Lösung

Lösung verborgen – erst selbst probieren!

Überblick

(a) Für jeden Satz bestimmen wir: Über welche Objekte wird gesprochen (Quantor), welche Eigenschaften schränken sie ein, was wird behauptet? Faustregel der VO: „alle … sind …“ → ∀x (…⇒…)\forall x\,(\ldots \Rightarrow \ldots), „es gibt … mit …“ → ∃x (…∧…)\exists x\,(\ldots \wedge \ldots). (b) Wir übersetzen jede Formel zurück und suchen in II ein Beispiel (bei ∃\exists) bzw. prüfen alle Elemente oder suchen ein Gegenbeispiel (bei ∀\forall). Wichtig: Der Allquantor läuft über ganz UU, also auch über Kostüme und Nicht-Kinder.

(a) Formalisieren

i. Nichts ist lustig. Es gibt kein Objekt, das lustig ist: ¬∃x Lustig(x)(≡∀x ¬Lustig(x))\neg \exists x\, \mathit{Lustig}(x) \qquad \bigl(\equiv \forall x\, \neg \mathit{Lustig}(x)\bigr)

ii. Es gibt lustige Kostüme. Mindestens ein Objekt ist Kostüm und lustig: ∃x (Kostu¨m(x)∧Lustig(x))\exists x\, (\mathit{Kostüm}(x) \wedge \mathit{Lustig}(x))

iii. Kinder, die ein Superman-K tragen, tragen kein Batman-K. Für jedes xx: Wenn xx ein Kind ist und das Superman-Kostüm trägt, dann trägt xx nicht das Batman-Kostüm: ∀x ((Kind(x)∧Tra¨gt(x,superman))⇒¬Tra¨gt(x,batman))\forall x\, \bigl((\mathit{Kind}(x) \wedge \mathit{Trägt}(x, \mathit{superman})) \Rightarrow \neg \mathit{Trägt}(x, \mathit{batman})\bigr)

iv. Es gibt Kinder, die jedes lustige Kostüm tragen. Es gibt ein Kind xx, sodass für jedes yy gilt: Ist yy ein lustiges Kostüm, so trägt xx es: ∃x (Kind(x)∧∀y ((Kostu¨m(y)∧Lustig(y))⇒Tra¨gt(x,y)))\exists x\, \Bigl(\mathit{Kind}(x) \wedge \forall y\, \bigl((\mathit{Kostüm}(y) \wedge \mathit{Lustig}(y)) \Rightarrow \mathit{Trägt}(x, y)\bigr)\Bigr)

v. Alle Kinder tragen das gleiche Kostüm. Es gibt ein Kostüm yy, das von jedem Kind getragen wird. Der Existenzquantor muss vor dem Allquantor stehen – sonst dürfte jedes Kind ein anderes Kostüm tragen: ∃y (Kostu¨m(y)∧∀x (Kind(x)⇒Tra¨gt(x,y)))\exists y\, \Bigl(\mathit{Kostüm}(y) \wedge \forall x\, \bigl(\mathit{Kind}(x) \Rightarrow \mathit{Trägt}(x, y)\bigr)\Bigr)

Alternative Lesart von v.

Versteht man den Satz strenger als „was ein Kind an Kostümen trägt, tragen alle Kinder“, so lautet eine Formalisierung ∀x ∀z ∀y ((Kind(x)∧Kind(z)∧Kostu¨m(y)∧Tra¨gt(x,y))⇒Tra¨gt(z,y)).\forall x\, \forall z\, \forall y\, \bigl((\mathit{Kind}(x) \wedge \mathit{Kind}(z) \wedge \mathit{Kostüm}(y) \wedge \mathit{Trägt}(x, y)) \Rightarrow \mathit{Trägt}(z, y)\bigr). Die oben angegebene Form ist die übliche Übersetzung von „das gleiche Kostüm“.

Ergebnis

i. ¬∃x Lustig(x)\neg\exists x\, \mathit{Lustig}(x) ii. ∃x (Kostu¨m(x)∧Lustig(x))\exists x\,(\mathit{Kostüm}(x) \wedge \mathit{Lustig}(x)) iii. ∀x ((Kind(x)∧Tra¨gt(x,superman))⇒¬Tra¨gt(x,batman))\forall x\,((\mathit{Kind}(x) \wedge \mathit{Trägt}(x,\mathit{superman})) \Rightarrow \neg\mathit{Trägt}(x,\mathit{batman})) iv. ∃x (Kind(x)∧∀y ((Kostu¨m(y)∧Lustig(y))⇒Tra¨gt(x,y)))\exists x\,(\mathit{Kind}(x) \wedge \forall y\,((\mathit{Kostüm}(y) \wedge \mathit{Lustig}(y)) \Rightarrow \mathit{Trägt}(x,y))) v. ∃y (Kostu¨m(y)∧∀x (Kind(x)⇒Tra¨gt(x,y)))\exists y\,(\mathit{Kostüm}(y) \wedge \forall x\,(\mathit{Kind}(x) \Rightarrow \mathit{Trägt}(x,y)))

(b) Auswerten in II

Zur Übersicht, wer was trägt:

Träger trägt
Mia Batman-K, Spiderman-K, Catwoman-K
Max Superman-K, Catwoman-K
Tahel Batman-K
Flo Spiderman-K, Superman-K
die vier Kostüme nichts

i. ∃x∃y (Lustig(x)∧Tra¨gt(y,x))\exists x \exists y\, (\mathit{Lustig}(x) \wedge \mathit{Trägt}(y, x))

Übersetzung: „Es gibt etwas Lustiges, das von jemandem getragen wird.“

Begründung: Wähle x=Superman-Kx = \text{Superman-K} (lustig) und y=Maxy = \text{Max}; es gilt (Max,Superman-K)∈I(Tra¨gt)(\text{Max}, \text{Superman-K}) \in I(\mathit{Trägt}). Ein Zeuge genügt.

Ergebnis

i. wahr (Zeuge: Max trägt das lustige Superman-K).

ii. ∀x (Kind(x)⇒(Tra¨gt(x,batman)∨Tra¨gt(x,catwoman)))\forall x\, (\mathit{Kind}(x) \Rightarrow (\mathit{Trägt}(x, \mathit{batman}) \vee \mathit{Trägt}(x, \mathit{catwoman})))

Übersetzung: „Jedes Kind trägt das Batman-K oder das Catwoman-K (oder beide).“

Begründung: Für Nicht-Kinder ist die Implikation automatisch wahr (Prämisse falsch). Zu prüfen sind nur die drei Kinder:

  • Mia trägt Batman-K ✓ (und Catwoman-K)
  • Max trägt Catwoman-K ✓
  • Tahel trägt Batman-K ✓
Ergebnis

ii. wahr.

iii. ∀x (Tra¨gt(x,superman)⇎Tra¨gt(x,batman))\forall x\, (\mathit{Trägt}(x, \mathit{superman}) \not\Leftrightarrow \mathit{Trägt}(x, \mathit{batman}))

Übersetzung: „Alles trägt genau eines der beiden Kostüme Superman-K und Batman-K.“ (A⇎BA \not\Leftrightarrow B ist das exklusive Oder: genau eines von beiden ist wahr.)

Begründung: Der Quantor läuft über ganz UU. Für die Personen stimmt es (Mia, Tahel: nur Batman-K; Max, Flo: nur Superman-K). Aber z. B. x=Superman-Kx = \text{Superman-K} trägt keines der beiden Kostüme: beide Seiten sind falsch, 0⇔00 \Leftrightarrow 0 ist wahr, also ist 0⇎00 \not\Leftrightarrow 0 falsch. Ein Gegenbeispiel genügt.

Ergebnis

iii. falsch (Gegenbeispiel: das Objekt Superman-K – ebenso jedes andere Kostüm – trägt weder Superman-K noch Batman-K).

Probe

Alle drei Formeln mit Python über der gegebenen Interpretation ausgewertet: i. wahr, ii. wahr, iii. falsch; Gegenbeispiele bei iii genau die vier Kostüm-Objekte.

Hilfreiches

Faustregeln beim Formalisieren

„Alle AA sind BB“: ∀x (A(x)⇒B(x))\forall x\,(A(x) \Rightarrow B(x)). „Einige AA sind BB“: ∃x (A(x)∧B(x))\exists x\,(A(x) \wedge B(x)). „Kein AA ist BB“: ∀x (A(x)⇒¬B(x))≡¬∃x (A(x)∧B(x))\forall x\,(A(x) \Rightarrow \neg B(x)) \equiv \neg\exists x\,(A(x) \wedge B(x)).

Semantik der Quantoren

I⊨∀x FI \models \forall x\, F genau dann, wenn FF für jedes u∈Uu \in U (als Wert von xx) wahr ist; I⊨∃x FI \models \exists x\, F genau dann, wenn FF für mindestens ein u∈Uu \in U wahr ist.

Typische Fehler
  • ∃x (Kostu¨m(x)⇒Lustig(x))\exists x\,(\mathit{Kostüm}(x) \Rightarrow \mathit{Lustig}(x)) für ii. – das wäre schon wahr, sobald es irgendein Nicht-Kostüm gibt.
  • Bei v. die Quantoren vertauschen: ∀x (Kind(x)⇒∃y (…))\forall x\,(\mathit{Kind}(x) \Rightarrow \exists y\,(\ldots)) heißt nur „jedes Kind trägt irgendein Kostüm“.
  • Bei (b) iii. nur die Kinder prüfen – der Allquantor ohne Einschränkung läuft über alle Objekte in UU.
  • ⇎\not\Leftrightarrow mit „nicht beide“ verwechseln: Es heißt „genau eines“.

Verwandte Beispiele: T2-2022b.6 (Äquivalenz prädikatenlogischer Formeln).