comp-think/2021-2022

Lecture "Programming languages", exercise 1

essepuntato opened this issue Β· 20 comments

What is the boolean value of not (not True or False and True) or False?

not (not True or False and True) or False = True
as follows:
(not True or False and True) = False
not False or False = True

I think the solution is True. Indeed,

not (not True or False and True) or False =
not (False or False and True) or False =
not (False or False) or False =
not False or False =
True or False = True

The boolean value of not (not True or False and True) or False is True:

  1. not (not True or False and True) or False
  • False
  1. not (not True or False) or False
  • False
  1. not (False) or False
  • True
  1. True or False = True
not (not True or False and True) or False=
not (False or False and True) or False=
not (False or False) or False=
not False or False=
True or False=
True

The boolean value of not (not True or False and True) or False is True.

That's because the application order of the boolean operations is: first, the not operations, then, the and operations. Finally, the or operations. Of course, the round brackets also affect the application order.
For not (not True or False and True) or False we first execute the part between brackets: (not True or False and True)

  1. not True = False
  2. False and True = False
  3. False or False = False

We then obtain not False or False, and we execute:

  1. not False = True
  2. True or False = True

The result is True, starting from the values between the brackets:

  1. not True = False and False and True = False.
  2. False or False = False
  3. not False or False = True

not (not True or False and True) or False
not (False or False and True) or False
not (False or False) or False
not (False) or False
True or False
True

Following the order of the operators I got

1)not 2)and 3)or

not ((not true) or (false and true)) or false
(not((false) or (false))) or false
(not (false)) or false
(not false) or false
true or false = true

the result of this boolean statement is:

not (False or False) or False =
not False or False =
True or False = True

The boolean value of not (not True or False and True) or False is True.

  1. not (False or false and true) or False;
  2. not (False and true) or False;
  3. not False or False;
  4. True or False= True.

not (not True or False and True) or False ->
not (False or False and True) or False ->
not (False or False) or False ->
not False or False ->
True or False = True

The value of not (not True or False and True) or False is:

not (not True or False and True) or False = not (False or False) or False = not False or False = True or False = True

not (NOT True or False and True) or False
= not (False or False AND True) or False
= not (False OR False) or False
= NOT False or False
= True or False
= True

The final output of the above-mentioned equation will be true or 1

I think the answer is True...image

Hi all,

Just a couple of notes:

  • @elizastuglik and @Postitisnt, the result is correct, but you solved or operations before and operations, while ors should be the last to run.
  • @ManuSrivastava1 despite the fact that in some cases 1 is interpreted as True, the operation return only a boolean and not a number.

not (False or False and True) or False
not (False or False) or False
not False or False
True or False = True

not (not True or False and True) or False

not True == False
False and True == False

not (False or False) or False

False or False == False
not (False) or False

not False == True
True or False == True

I think the solution is True, infact:

not True= False
False AND True= False
False OR True= True

not (False or False and True) or False
not (False or False) or False
not (False) or False
True or False

TRUE

not True β€”β€”> False β€”β€”> not(False or False and True) or False

False and Trueβ€”β€”> False β€”β€”> not(False or False) or False

False or Falseβ€”β€”> False β€”β€”>not False or False

not Falseβ€”β€”> True β€”β€”> True or False

True or Falseβ€”β€”> True