10.07.2015 Aufrufe

0 - Prof. Dr. Dirk W. Hoffmann

0 - Prof. Dr. Dirk W. Hoffmann

0 - Prof. Dr. Dirk W. Hoffmann

MEHR ANZEIGEN
WENIGER ANZEIGEN

Erfolgreiche ePaper selbst erstellen

Machen Sie aus Ihren PDF Publikationen ein blätterbares Flipbook mit unserer einzigartigen Google optimierten e-Paper Software.

Kapitel 2Boolesche Algebra<strong>Prof</strong>. <strong>Dr</strong>. <strong>Dirk</strong> W. <strong>Hoffmann</strong>Hochschule Karlsruhe University of Applied Sciences Fakultät für Informatik


Boolesche AlgebraGegeben: Menge V, Operatoren •, + : V × V → VV heißt Boolesche Algebra,wenn die folgenden vier Huntingtonschen Axiome gelten: Kommutativgesetze (K): Distributivgesetze (D): Neutrale Elemente (N): Inverse Elemente (I):a • b = b • aa + b = b + aa • (b + c) = (a • b) + (a • c)a + (b • c) = (a + b) • (a + c)Es existieren e, n ∈ V mita • e = a und a + n = aFür alle a ∈ V existiert ein a‘ mita • a‘= n und a + a‘ = eTechnische Informatik I • Hochschule Karlsruhe • <strong>Prof</strong>. <strong>Dr</strong>. D. W. <strong>Hoffmann</strong>2. 2


Boolesche Algebra: Beispiele Beispiel 1: Mengenalgebra ( T = Trägermenge)Boolesche Algebra MengenalgebraV ℘(T) Potenzmenge der Trägermenge T• ∩ Durchschnitt+ ∪ Vereinigungn ∅ Leere Mengee T Trägermenge Veranschaulichung durch Venn-Diagrammea‘ T \ A Komplementärmenge= T \ AA= A ∪ BAB= A ∩ BABTechnische Informatik I • Hochschule Karlsruhe • <strong>Prof</strong>. <strong>Dr</strong>. D. W. <strong>Hoffmann</strong>2. 3


Boolesche Algebra: Beispiele A ∩ (B ∪ C)AB∩AB=ABCCC (A ∩ B) ∪ (A ∩ C)=AB∪AB=ABCCCTechnische Informatik I • Hochschule Karlsruhe • <strong>Prof</strong>. <strong>Dr</strong>. D. W. <strong>Hoffmann</strong>2. 4


Boolesche Algebra: Beispiele A ∪ (B ∩ C)AB∪AB=ABCCC (A ∪ B) ∩ (A ∪ C)=AB∩AB=ABCCCTechnische Informatik I • Hochschule Karlsruhe • <strong>Prof</strong>. <strong>Dr</strong>. D. W. <strong>Hoffmann</strong>2. 5


Beispiel 2: SchaltalgebraBoolesche Algebra: BeispieleBoolesche AlgebraSchaltalgebraV { 1, 0 } Wahrheitswerte (TRUE, FALSE)• ∧ Konjunktion (UND-Operator)+ ∨ Disjunktion (ODER-Operator)n 0 „Falsch“ (FALSE)e 1 „Wahr“ (TRUE)a‘ ¬a Negation (Verneinung)Technische Informatik I • Hochschule Karlsruhe • <strong>Prof</strong>. <strong>Dr</strong>. D. W. <strong>Hoffmann</strong>2. 6


Notation und Operatorenbindung Abgeleitete Operatoren („syntactic sugar“) (a → b) für (¬a ∨ b) (a ← b) für (b → a) (a ↔ b) für (a → b) ∧ (a ← b) (a ⊕ b) für ¬(a ↔ b)(lmplikation)(lnv. Implikation)(Äquivalenz)(Antivalenz) Bezeichnungen ¬(a ∨ b) ¬(a ∧ b)(NOR-Operation)(NAND-Operation)Technische Informatik I • Hochschule Karlsruhe • <strong>Prof</strong>. <strong>Dr</strong>. D. W. <strong>Hoffmann</strong>2. 7


Die zweistelligen Booleschen Funktionenb a f 0 f 1 f 2 f 3 f 4 f 5 f 6 f 7 f 8 f 9 f 10 f 11 f 12 f 13 f 14 f 150 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 10 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 11 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 11 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1NullfunktionKonjunktionAntivalenzDisjunktionNORÄquivalenzImplikationInverse ImplikationNANDEinsfunktionf 0 = 0f 1 = a ∧ bf 2 = ¬a ∧ bf 3 = bf 4 = ¬b ∧ af 5 = af 6 = a ⊕ bf 7 = a ∨ bf 8 = ¬(a ∨ b)f 9 = a ↔ bf 10 = ¬af 11 = a → bf 12 = ¬bf 13 = a ← bf 14 = ¬(a ∧ b)f 15 = 1Technische Informatik I • Hochschule Karlsruhe • <strong>Prof</strong>. <strong>Dr</strong>. D. W. <strong>Hoffmann</strong>2. 9


Notation und Operatorenbindung Alternative Notation der Booleschen Operatoren (a • b) bzw. (ab) anstelle (a ∧ b) (a + b) anstelle (a ∨ b) a anstelle ¬a (a ↔ b) anstelle (a ⊕ b) Bindung der Operatoren ∧ bindet stärker als ∨ ¬ bindet stärker als ∧ Klammerung Gleiche binäre Operatoren werden linksassoziativ zusammengefasst,z.B. a ∧ b ∧ c = (a ∧ b) ∧ cTechnische Informatik I • Hochschule Karlsruhe • <strong>Prof</strong>. <strong>Dr</strong>. D. W. <strong>Hoffmann</strong>2. 10


Kommutativgesetzea ∧ b = b ∧ aUmformungsregelna ∨ b = b ∨ aDistributivgesetze a ∧ (b ∨ c) = (a ∧ b) ∨ (a ∧ c)a ∨ (b ∧ c) = (a ∨ b) ∧ (a ∨ c)Neutrale Elementea ∧ 1 = aa ∨ 0 = aInverse Elemente a ∧ ¬a = 0a ∨ ¬a = 1(K)(D)(N)(I)In jeder Booleschen Algebra, so auch in der Schaltalgebra,gelten die vier oben gezeigten Huntingtonschen AxiomeAus den Huntingtonschen Axiomen lassen sichweitere praktische Rechenregeln ableiten…Technische Informatik I • Hochschule Karlsruhe • <strong>Prof</strong>. <strong>Dr</strong>. D. W. <strong>Hoffmann</strong>2. 11


Kommutativgesetzea ∧ b = b ∧ aUmformungsregelna ∨ b = b ∨ aDistributivgesetze a ∧ (b ∨ c) = (a ∧ b) ∨ (a ∧ c)a ∨ (b ∧ c) = (a ∨ b) ∧ (a ∨ c)Neutrale Elementea ∧ 1 = aa ∨ 0 = aInverse Elemente a ∧ ¬a = 0a ∨ ¬a = 1AssoziativgesetzeIdempotenzgesetzeAbsorptionsgesetzea ∧ (b ∧ c) = (a ∧ b) ∧ c = a ∧ b ∧ ca ∨ (b ∨ c) = (a ∨ b) ∨ c = a ∨ b ∨ ca ∧ a = aa ∨ a = aa ∨ (a ∧ b) = aa ∧ (a ∨ b) = aGesetze von DeMorgan ¬(a ∨ b) = ¬a ∧ ¬b¬(a ∧ b) = ¬a ∨ ¬bAuslöschungsgesetze a ∧ 0 = 0a ∨ 1 = 1Gesetz der Doppelnegation ¬¬a = a (DN)(K)(D)(N)(I)(A)(ID)(AB)(M)(L)Technische Informatik I • Hochschule Karlsruhe • <strong>Prof</strong>. <strong>Dr</strong>. D. W. <strong>Hoffmann</strong>2. 12


Vereinfachung von AusdrückenAnwendung der Regeln Beispiel 1: Y = (A ∨ B) ∧ (¬A ∨ B) ∧ (A ∨ ¬B) Beispiel 2: Y = (A → B) → ((¬A → B) → B)Technische Informatik I • Hochschule Karlsruhe • <strong>Prof</strong>. <strong>Dr</strong>. D. W. <strong>Hoffmann</strong>2. 13


Bitweise logische OperationenA,B seien Bitvektoren, ⊗ eine beliebige VerknüpfungOperand AOperand Ba 5 a 4 a 3 a 2 a 1 a 0 b 5 b 4 b 3 b 2 b 1 b 014a 5 ⊗ b 5 a 4 ⊗ b 4 a 3 ⊗ b 3 a 2 ⊗ b 2 a 1 ⊗ b 1 a 0 ⊗ b 0Ergebnis E = A ⊗ BTechnische Informatik I • Hochschule Karlsruhe • <strong>Prof</strong>. <strong>Dr</strong>. D. W. <strong>Hoffmann</strong>2.


Bitweise logische Operationen UND, ODER und XOR wirken wie spezielle Bit-Masken1 1 0 1 0 01 1 0 1 0 01 1 0 1 0 0∧0 1 1 1 0 0∨0 1 1 1 0 0⊕0 1 1 1 0 0=0 1 0 1 0 0=1 1 1 1 0 0=1 0 1 0 0 0UND wird verwendet,um Bits gezielt auf 0 zusetzen. Dazu hat dieMaske an allenBitpositionen, dieübernommen werdensollen, eine 1 und anden Stellen, die auf 0gesetzt werden sollen,eine 0.ODER wird verwendet,um Bits gezielt auf 1 zusetzen. Dazu hat dieMaske an allenBitpositionen, dieübernommen werdensollen, eine 0 und anden Stellen, die auf 1gesetzt werden sollen,eine 1.XOR wird verwendet,um Bits gezielt zukippen. Dazu hat dieMaske an allenBitpositionen, dieübernommen werdensollen, eine 0 und anden Stellen, die gekipptwerden sollen, eine 1.Technische Informatik I • Hochschule Karlsruhe • <strong>Prof</strong>. <strong>Dr</strong>. D. W. <strong>Hoffmann</strong>2. 15

Hurra! Ihre Datei wurde hochgeladen und ist bereit für die Veröffentlichung.

Erfolgreich gespeichert!

Leider ist etwas schief gelaufen!