Friday 12 February 2016

Boolean Homework

Logic Gates perform a logical operation one or more logical inputs and produces a single logical output. Logic gates are implemented using diodes or transistors acting as electronic switches. Billions of gates are in a computer.

Types of logic gates:
- AND - outputs true if both inputs are true
- OR - outputs true if either are true
- NOT - outputs the inverse of the input




Boolean Algebra:
Logic gates can be represented using boolean algebra. They all have names and symbols. A proposition is a statement that can be defined as either true for false, for example 'Let P be it is raining' as this can be either true or false. These statements are booleans as they only have 1 answers whereas 'what is the weather' can have many answers.

Example of boolean algebra:
x=a^b


Conjunction:
The informal term is AND, it behaves the same as the AND logic gate. For the statement to be true all inputs must also be true. When used in boolean algebra is has the symbol ^.

The truth table for conjunction is as follows:
P
Q
P AND Q
T
T
T
T
F
F
F
T
F
F
F
F


Disjunction:
The informal term is OR. Either of the inputs can be true for the whole statement to be true. When used in boolean algebra it has the symbol ∨.

The truth table for disjunction is as follows:
P
Q
P OR Q
T
T
T
T
F
T
F
T
T
F
F
F


Negation:
The informal term is NOT. It gives the reverse of the input. It has the symbol ¬ and will apply to the proposition following it.

The truth table for negation is as follows:
P
NOT P
T
F
F
T


Equivalence:
The informal term is equality. It has two possible symbols ↔ or ≡. It means that the truth on both sides are equivalent. For this to be true both sides must evaluate to the same truth value.

The truth table for equivalence is as follows:
P
Q
P ↔ Q
T
T
T
T
F
F
F
T
F
F
F
T
There is no logic gate for equivalence.

Exclusive Disjunction
The informal term is XOR. It has a symbol of ⊕. It will only output true if both values are true or both values are false. The logic gate is shown earlier.

The truth table for this is as follows:



pqp⊕q
FFF
FTT
TFT
TTF
Boolean Algebra Questions:
1. The missile will be activated (M) when the key is turned (K) and the button is pressed (B)

2. I will go to the party (P) if Sam is going (S), but not Alex (A) as I don’t get on with him anymore 

3.When the new iPhone comes out it will have a secret key combination to take selfies (S). You have to press the main button (M), the on button (O) and the volume button (V)

4.I will only go outside (O) if it is sunny (S), I have an umbrella (U) or I have to put out the trash (T)

5.The burglar alarm will only be activated (B) when the door sensor (D) or the window sensor (W) is activated, but ONLY if the alarm system is turned on (A)

6.When applying to college (C) you have to choose Physics (P) and Geography (G) or History (H)

7.When feeding the dog (D) you must not feed it with chocolate (C) or sharp objects (S)

8.The heating system will activate (H) when the thermostat setting has not been reached (T)
1. M = K ^ B
2. P = S ^ ¬ A
3. S = M ^ O ^ V
4. O = S  U ∨ T
5. B = A ^ (D ∨ W)
6. C = P ∨ G ∨ H
7. D = ¬ (C ∨ S)
8. H = ¬ T


Exam Question:


t = (g) ^ (s ∨ c) ^ (f)



Question from the board:
t = False
If (g and (s or c) and f)
       t = True
 

No comments:

Post a Comment