Lösungen/Solutions/
B1S1Ue/Ex3

Generierung von Wahrheitswerttabellen für alle Ueb./
Générer des tableaux de vérité pour toutes les ex.

Remove["Global`@*"]

tab[1] = Table[{a}, {a, 0, 1}];
tabZ[1] = tab[1] /. {0 -> False, 1 -> True};
tab[2] = 
        Flatten[Table[{a, b}, {a, 0, 1}, {b, 0, 1}], 
          1];
tabZ[2] = tab[2] /. {0 -> False, 1 -> True};
tab[3] = 
        Flatten[Table[{a, b, c}, {a, 0, 1}, {b, 0, 1}, {c, 0, 1}], 
          2];
tabZ[3] = tab[3] /. {0 -> False, 1 -> True};
tab[4] = 
        Flatten[Table[{a, b, c, d}, {a, 0, 1}, {b, 0, 1}, {c, 0, 1}, {d, 0, 
              1}], 3];
tabZ[4] = tab[4] /. {0 -> False, 1 -> True};

{tab[2] // MatrixForm, tabZ[2] // MatrixForm}

Konstruktion des Programms / Construction du programme

Programm / Programme

Fertiges Programm / 
Programme complet

\(Wtab[f_, tabX_] := 
      Module[{res, newtabX, u, exttabX, output, output1}, \ 
        res = Table[Apply[f, tabX[\([n]\)]], {n, 1, Length[tabX]}]; 
        newtabX = Transpose[tabX]; 
u = 
          Length[newtabX]; 
\ \ \ \ \ exttabX = 
          Transpose[
            Append[newtabX, res]]; 
\ \ \ \ \ Prepend[exttabX, 
              Append[Range[u], {expr}]] /. {True -> 1, False -> 0} // 
          MatrixForm]\)

Funktionen definieren und Programm anwenden / 
Définir des fonctions et appliquer le programme

Wichtige Junktoren / Symboles logiques importants

Subjunktion neu / Subjonction de nouveau

imp[x_, y_] := Or[Not[x], y]; Attributes[imp] = {Listable};

sub[x_, y_] := Or[Not[x], y]; Attributes[sub] = {Listable};

Bijunktion  / Bijonction

bij[x_, y_] := And[imp[x, y], imp[y, x]]; 
    Attributes[bij] = {Listable};

Lösungen / Solutions

Ueb / Ex 1

a

Remove[t] ;t =  
      Module[{f, 
          n}, 

f[x1_, x2_, 
            x3_] :=       sub[ And[Not[x1], x2, x3], 
            Not[bij[x1, 
                And[x2, 
                  x3]]]]
; 
n =                          3
; 
Attributes[f] = {Listable}; 
Wtab[f, 
          tabZ[n]]];t

→→↗↘→→↗↘→ P ≡ T (aNF, kNF)

expr  =  ¬ ((¬ A ∧ ¬ B ∧ 
                C) ∨ (A ∧ ¬ B ∧ ¬ C) ∨ (A ∧ B ∧ C))

LogicalExpand[expr] //  TraditionalForm

Ueb / Ex 2

a = m^2 - n^2; b = 2  m n;  c = n^2 + m^2;

{a^2 + b^2,  c^2} // Expand

Ctab = Table[m^2 + n^2, {n, 1, 3}, {m, 1, 3}] // Flatten // 
        Union

c=16

c=16 ∉  Ctab   ⇒   False