1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Finding Boolean formulae.

  1. Nov 9, 2013 #1
    Hi,
    1. The problem statement, all variables and given/known data
    I'd like to find Bθ:{0,1}3→{0,1}2 which is defined as follows:
    Input: x,y,z[itex]\in[/itex]{0,1},
    Output: s,c[itex]\in[/itex]{0,1},
    Functionality:2c+s=x+y+z


    2. Relevant equations



    3. The attempt at a solution
    I first tried listing all the possible combinations of x,y,z, and there are obviously 8. I noted that x+y+z would yield 1 only if at least one of the three were one. I then tried to find a Boolean formula for s and one for c, so I could use the relation given in the "functionality" above, but I truly got lost. How may I possibly assign a function to s and c? There certainly could be more than one such function satisfying that equation, couldn't there? In any case, I'd sincerely be thankful for some guidance/advice.
     
  2. jcsd
  3. Nov 9, 2013 #2

    jedishrfu

    Staff: Mentor

    I'd start by building a truth table with five columns x,y,z,s,c

    then construct your equation for s using only the rows where s has a one value.

    As an example for row x=1, y=0, z=0 then s=1 ===> we'd construct a term x . y' . z' where y' means "not y"

    s = x . y' . z' + x' . y . z' ... where + means OR and . means AND

    he eqn says that s will be true when the first erm is true or the second term is true or ... or the last term is true.

    Use boolean algebra to simplify the s equation.

    Do the same the construct the c equation,
     
  4. Nov 9, 2013 #3
    How can you tell, in your example, that x,y,z being 1,0,0 respectively, s would have to be 1? What if c were 1? In the latter case (c=1), s could surely also be zero and 2*1+0=1=x+y+z.
     
  5. Nov 9, 2013 #4

    jedishrfu

    Staff: Mentor

    okay look at the first term it will be true if x=1, y=0 and z=0 because its x and not-y and not-z which is 1 . 1 . 1 right?
     
  6. Nov 9, 2013 #5
    I agree that 1+0+0=1, or, alternatively, that 1 AND 1 AND 1=1, but how does that restrict s to be 1 as you first wrote?
     
  7. Nov 9, 2013 #6

    jedishrfu

    Staff: Mentor

    the first term represents the a row in your truth table where the inputs make s a 1 so when x=1 and y=0 (ie not-y=1) and z=0 (not-z=1) then this term will evaluate to 1.1.1 = 1 and so s will be a one. Remember the operators + and . are boolean operators Or and AND respectively.
     
  8. Nov 9, 2013 #7
    I am well aware of the truth tables of both AND and OR. However, x+y+z=1 still doesn't necessarily restrict s to be 1! That's all I am saying. Do you agree that x,y,z being 1,0,0 still doesn't necessarily entail s=1? As I wrote earlier, if c were 1 then s has two possible values still satisfying the desired functionality: s could be either 1 or 0, hence not just 1. Do you agree? If you do agree, then what made you write that s had to be 1 in that case?
     
  9. Nov 9, 2013 #8

    jedishrfu

    Staff: Mentor

    Okay I see where your're going and yes you need to factor carry in as well so you need a column for possible carry inputs
    making the s terms be x.y.z.c so the first term might be x.y'.z'.c' which will be one if x=1,y=0,z=0 and c=0

    So one question I have are you trying to make a standard 2 input full-adder with the z being the input carry then my original terms of x.y.z without the c would be the correct way to go.

    so the s = xy'z' + x'yz' + x'y'z... ie a series of terms and if one or more of these terms evaluates to 1 then s will be a 1. The + symbols dont mean add they mean OR the terms together.
     
    Last edited: Nov 9, 2013
  10. Nov 9, 2013 #9
    I am not really sure how to go about this, I am afraid. Despite your explanation. For instance, how did you derive
    s = xy'z' + x'yz' + x'y'z...? As far as I am concerned, s=1 iff x+y+z=1 and s=0 iff x+y+z=0.
     
  11. Nov 9, 2013 #10

    jedishrfu

    Staff: Mentor

    You are confusing the ordinary addition operator with the boolean + operator which means OR. I derived it from the truth table using every row where s=1 and there are more terms needed to complete the s equation which I didn't write because we aren't supposed to give you the answer here.

    In essence my equation is codifying the truth table into a single equation each term represents a single row where s=1 (we ignore the rows where s=0). I used primes to mean NOT so the row where x,y,z are 1,0,0 is written as xy'z'. Why? because that term will be true if x,y,z are set to 1,0,0 respectively and the other s terms will be false.

    so I expanded to more terms using more rows and wrote xy'z' + x'yz' + ... that means:

    Code (Text):


    s = ( x AND (NOT y) AND (NOT z) ) OR ( (NOT x) AND y AND (NOT z) ) OR ...

    from this equation s can only have two values 0 or 1

     
    If you are treating the + as a boolean OR then the flaw in your equation is that it will set s true when x=1 and y=1 and z=0 which is wrong because in binary 1+1+0= 10 meaning s=0 and c=1

    Try rereading your book maybe after having this discussion it will make more sense and try not to over think it. I first learned this stuff when I was in 9th grade by accident while I was studying for algebra and learning about computers more than 50 years ago.
     
    Last edited: Nov 9, 2013
  12. Nov 9, 2013 #11
    This is what I don't quite get. C is either 0 or 1, right? Hence, 2c would always be equal to c, wouldn't it?
     
  13. Nov 10, 2013 #12

    jedishrfu

    Staff: Mentor

    You have to look at the bigger picture. This problem describes a single stage full adder. Combine 32 stages together to get a register adder that can add two 32 bit numbers to produce a 32 bit answer. The z input is the carry bit from the previous stage.

    The xyz input can sum at most to 11 binary which means the s is one and the carry is one to be passed into the next stage.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted