Download presentation
Presentation is loading. Please wait.
Published byTyrone Parks Modified over 9 years ago
1
Copyright © 2007-2010 Curt Hill Truth Tables A way to show Boolean Operations
2
Copyright © 2007-2010 Curt Hill Definition A table that contains the output of a function for every possible input A unary function may only have two possible inputs so needs only two rows A binary function has four
3
Copyright © 2007-2010 Curt Hill Example p q T T T T F F F F p q T T T FF F F T p qp q T T T F ¬p q T F F F
4
Copyright © 2007-2010 Curt Hill Uses We use truth tables to define our functions –Then they have one column for each input and one column for output We also use them to construct our complicated functions
5
Copyright © 2007-2010 Curt Hill Construction of Complicated Truth Tables For the most part we can write down simple conjunction and disjunction functions Larger functions turn out to be harder We just create separate columns for the smaller parts Thus our table is created left to right
6
Copyright © 2007-2010 Curt Hill Consider p ¬(q p) First write the table of inputs Next write q p Then ¬(q p) –Use the previous column as input Finally the whole expression –Use the last column and the p as inputs
7
Copyright © 2007-2010 Curt Hill Table of Inputs p q T T T T F F F F
8
Copyright © 2007-2010 Curt Hill (q p) p q T T T T F F F FF F F T q p
9
Copyright © 2007-2010 Curt Hill ¬(q p) p q T T T T F F F FF F F T q p¬(q p) F T T T
10
Copyright © 2007-2010 Curt Hill p ¬(q p) p q T T T T F F F FF F F T q p¬(q p) F T T T p ¬(q p) T T T T
11
Copyright © 2007-2010 Curt Hill Discussion A truth table column with all True is called a tautology A truth table column with all False is a contradiction The problem with truth tables is the size: –3 variables 8 rows –4 variables 16 rows –5 variables 32 rows
12
Example Lets try a big one on the board (p r ¬s) ¬(q r) Copyright © 2007-2010 Curt Hill
13
Generation Generating a truth table from an expression may be tedious but certainly possible What about the reverse? Suppose we have a truth table and we would like the logical expression: how is this done? Copyright © 2007-2010 Curt Hill
14
Finding the expression Look only at rows that have a true for the expression Create an expression for each variable in the row –The expression is just the variable if the variable is true –The expression is negated if false –All of these are ANDed together Or the resulting expressions Copyright © 2007-2010 Curt Hill
15
Example Two rows have trues First row needs q p Last row needs ¬q ¬p Final expression is (q p) (¬q ¬p) This could be simplified, but it is a start Copyright © 2007-2010 Curt Hill p q T T T T F F F FT F F T
16
One more Lets try this on a four variable On the board Copyright © 2007-2010 Curt Hill
17
Proofs The truth table may be the basis of a proof It is often quite cumbersome One column for sub-expressions An equivalence should end up with two columns the same Let try the converse p q q p What we want are two different columns Copyright © 2007-2010 Curt Hill
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.