Presentation is loading. Please wait.

Presentation is loading. Please wait.

Propositional Equivalence Goal: Show how propositional equivalences are established & introduce the most important such equivalences.

Similar presentations


Presentation on theme: "Propositional Equivalence Goal: Show how propositional equivalences are established & introduce the most important such equivalences."— Presentation transcript:

1 Propositional Equivalence Goal: Show how propositional equivalences are established & introduce the most important such equivalences.

2 Copyright © Peter Cappello2 EquivalenceName p  T ≡ p; p  F ≡ p Identity p  T ≡ T; p  F ≡ F Domination p  p ≡ p; p  p ≡ p Idempotent  (  p) ≡ p Double negation p  q ≡ q  p; p  q ≡ q  p Commutative

3 Copyright © Peter Cappello3 EquivalenceName (p  q)  r ≡ p  (q  r ) (p  q)  r ≡ p  (q  r ) Associative p  (q  r ) ≡ (p  q)  (p  r ) p  (q  r ) ≡ (p  q)  (p  r ) Distributive  (p  q) ≡  p   q  (p  q) ≡  p   q DeMorgan p  (p  q ) ≡ p p  (p  q ) ≡ p Absorption p   p ≡ T p   p ≡ F Negation

4 Copyright © Peter Cappello4 Exercise A tautology is a compound proposition that always is true. Is the following a tautology? ( (p  q)  (  p  r) )  (q  r)

5 Copyright © Peter Cappello5 The Satisfiability Problem Satisfiability Problem Given a function of boolean variables, is there an assignment of values to its variables that makes it true? Is f( p, q, r ) = ( (p  q)  (  p  r) )  (q  r) satisfiable? Satisfiability is important in CS theory, algorithms, program correctness, AI, hardware design, etc. Algorithm 1.Construct the truth table. 2.If any assignment (row) evaluates to true, return true; 3.Else return false. If the formula has n variables, how many rows does the truth table have?

6 An example satisfiability problem Let p( row, col, n ) denote the proposition “Box( row, col ) contains number n.” Using such propositions, design a compound proposition that is satisfiable if & only if n appears in some box, for 1 ≤ n ≤ 4. Copyright © Peter Cappello6 13 41

7 7 Problem Give logical expressions for a 2-bit adder, where true corresponds to 1 false corresponds to 0 For example, 01 + 11 = 100. Input: Operand 1: a 1 a 0 Operand 2: b 1 b 0 Output s 2 s 1 s 0 That is, define 3 Boolean functions: s 0 ( a 1, a 0, b 1, b 0 ) = ? s 1 ( a 1, a 0, b 1, b 0 ) = ? s 2 ( a 1, a 0, b 1, b 0 ) = ?

8 Copyright © Peter Cappello8 Can you define a Boolean function in the C programming language? boolean[] adder( boolean a1, boolean a0, boolean b1, boolean b0 ) {... } Or, for an n-bit adder: boolean[] adder( boolean[] a, boolean[] b ) {... } For an n-bit adder, it may be useful to compute, for 0 ≤ i ≤ n, a sum bit, s i and a carry bit, c i. For the sum bit, s i, we may use: s i = a i  b i  c i-1, where c -1 = 0 and s n = c n-1. The equation above is called a recurrence equation. What is a recurrence equation for the carry bit, c i ?

9 Copyright © Peter Cappello9 Unraveling the for loop, suggests a diagram: Each box above has 3 inputs & 2 outputs, and is called a full adder.full adder A harder problem: Compute these sum & carry bits in parallel. s n-1 s0s0 s1s1 s2s2 snsn a n-1 b n-1 a2a2 b2b2 a1a1 b1b1 a0a0 b0b0 c0c0 0 c1c1 c2c2 c n-2 c n-1

10 END Copyright © Peter Cappello 201110


Download ppt "Propositional Equivalence Goal: Show how propositional equivalences are established & introduce the most important such equivalences."

Similar presentations


Ads by Google