1 / 10

# CS1502 Formal Methods in Computer Science

CS1502 Formal Methods in Computer Science. Lecture Notes 5 Normal Forms Boolean Logic. Normal Forms. Using logical equivalences , we can transform logical sentences into more standard forms . Important for applications of computers science.

Télécharger la présentation

## CS1502 Formal Methods in Computer Science

E N D

### Presentation Transcript

1. CS1502 Formal Methods in Computer Science Lecture Notes 5 Normal Forms Boolean Logic

2. Normal Forms • Using logical equivalences, we can transform logical sentences into more standard forms. Important for applications of computers science. • We will use the equivalences we saw earlier (e.g., DeMorgan’s laws, …)

3. Reminder: Equivalences • Two FOL sentences P and Q mean the same thing (are logicallyequivalent, written P  Q) iff they have the same truth value in all situations. If two sentences are logically equivalent, you can substitute one for the other. • Identity Laws: P ^ T  P; P v F  P • Domination Laws: P v T  T; P ^ F  F • Idempotent Laws: P v P  P; P ^ P  P • Double Negation: ~~P  P • Commutative Laws: P v Q  Q v P; P ^ Q  Q ^ P • Associative Laws: (P v Q) v R P v (Q v R) (P ^ Q) ^ R  P ^ (Q ^ R) • Distributive Laws: P v (Q ^ R)  (P v Q) ^ (P v R) P ^ (Q v R)  (P ^ Q) v (P ^ R) • DeMorgan’s Laws: ~(P ^ Q)  ~P v ~Q ~(P v Q)  ~P ^ ~Q

4. Negation Normal FormNNF • A sentence S is in negation normal form if the  is moved as far insideS as possible. Use DeMorgan’s and double negation laws.[(A  B)  C] (A  B)   C (A B)   C (A B)   C

5. Another Example ~(~(P ^ Q) v R) P ^ Q ^ ~R

6. Conjunctive and disjunctive normal forms • CNF: a sentence that is a conjunction of one or more disjunctions of one or more literals • DNF: a sentence that is a disjunction of one or more conjunctions of one or more literals • First put the sentence in negation normal form, then continue to transform it. • CNF example: (~A v C v D) ^ (A v ~C v E) ^ W • DNF example: (~A ^ C ^ D) v (A ^ ~C ^ E) v W

7. Example [(A  B)  C] (A  B)   C(A B)   C(A B)   C NNF, CNF(A  C)  (B   C) NNF,DNF We will use these normal forms when we do resolution theorem proving

8. CNF or DNF? Cube(a) ^ Small(a) ^ ~Red(a) Trick question!! CNF: all outside connectives are ^ (each term contains just one literal) DNF: all inside connectives are ^ (there is just one term)

9. Boolean Algebra • The circuits in computers have inputs (0 or 1) and produce outputs (0 or 1). In 1938, Claude Shannon showed how the rules of propositional logic could be used to design circuits (in his MS thesis at MIT). These rules form the basis for BooleanAlgebra. • 1 is True and 0 is False. • + is v ∙ is ^ ¯ is ~ (sometimes ‘) + is Xor • All the logical equivalences we learned apply, as do the truth-table methods • Example of hardware minimization: Not covered; we ran out of time.

10. Gates are Building Blocks of Circuits AND And, Xor, Not, Or, Nor, Nand Not covered, we ran out of time.

More Related